@orangelogic/design-system 2.56.0 → 2.57.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/{button.CiWlWCNb.js → button.2-Io1Wm4.js} +80 -66
- package/library/chunks/{color-swatch-group.Bsa_Z57a.js → color-swatch-group.VXPK-2tU.js} +167 -157
- package/library/chunks/{color-swatch.CsKJgvVf.js → color-swatch.8OhqVqb6.js} +2 -2
- package/library/chunks/{confirm-popover.Bfuw361W.js → confirm-popover.DGvyB12c.js} +3 -3
- package/library/chunks/{content-builder.UlVFSATk.js → content-builder.WranV3P4.js} +6 -5
- package/library/chunks/{dialog.C28qzMSQ.js → dialog.CIeu0rVD.js} +2 -2
- package/library/chunks/{dot-pagination.D3RYAiHL.js → dot-pagination.CyCA3kSP.js} +1 -1
- package/library/chunks/{file-on-demand.Cr7E_KqH.js → file-on-demand.aux9gsvH.js} +10 -10
- package/library/chunks/{folder-select.ELghy6Qk.js → folder-select.B7u40ijN.js} +5 -5
- package/library/chunks/{format-time.HdcgoabZ.js → format-time.C56HetWv.js} +1 -1
- package/library/chunks/{header.oyZxakKM.js → header.RvymymCe.js} +1 -1
- package/library/chunks/{i18n.C3Z8Xe8q.js → i18n.dCiJrmqj.js} +74 -83
- package/library/chunks/{iframe.C6CLUrTT.js → iframe.Cwqniwf2.js} +1 -1
- package/library/chunks/{image.BJfasRY_.js → image.gpleN29o.js} +3 -3
- package/library/chunks/list-editor.BToq5cqp.js +1641 -0
- package/library/chunks/{option.BOHZB9Sv.js → option.CJ1p2V0m.js} +1 -1
- package/library/chunks/{popup.Ba501Rgg.js → popup.BE5MfEQJ.js} +1 -1
- package/library/chunks/purify.es.BGaRrCfO.js +553 -0
- package/library/chunks/{select.oVg7uA-M.js → select.xBh4yerC.js} +3 -3
- package/library/chunks/string.DPf4puTr.js +136 -0
- package/library/chunks/{tab-group.BWYMMhrE.js → tab-group.CjvHb3OJ.js} +3 -3
- package/library/chunks/{table.-ecyjIUr.js → table.CrX_NJiY.js} +2019 -1744
- package/library/chunks/{timecode.PY1bymeS.js → timecode.XXmVg6tU.js} +1 -1
- package/library/chunks/{tree.82OigIgE.js → tree.CDaFhGjU.js} +1 -1
- package/library/components/alert.js +1 -1
- package/library/components/asset-link-format.js +4 -4
- package/library/components/atoms.js +14 -14
- package/library/components/border-input-group.js +1 -1
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +2 -2
- package/library/components/color-picker.js +3 -3
- package/library/components/color-swatch-group.js +6 -6
- package/library/components/color-swatch.js +3 -3
- package/library/components/confirm-popover.js +4 -4
- package/library/components/copy-button.js +1 -1
- package/library/components/corner-position-input-group.js +3 -3
- package/library/components/details.js +1 -1
- package/library/components/dialog.js +3 -3
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +1 -1
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +5 -5
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +11 -11
- package/library/components/folder-select.js +4 -4
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +2 -2
- package/library/components/header.js +2 -2
- package/library/components/icon-button.js +1 -1
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +1 -1
- package/library/components/image.js +3 -3
- package/library/components/input.js +1 -1
- package/library/components/line-clamp.js +31 -23
- package/library/components/list-editor.js +9 -8
- package/library/components/masonry.js +1 -1
- package/library/components/menu-item.js +2 -2
- package/library/components/menu.js +1 -1
- package/library/components/molecules.js +4 -4
- package/library/components/option.js +2 -2
- package/library/components/organisms.js +2 -2
- package/library/components/pagination.js +4 -4
- package/library/components/popup.js +2 -2
- package/library/components/position-picker.js +1 -1
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/range.js +2 -2
- package/library/components/rating.js +1 -1
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +4 -4
- package/library/components/share-option-list.js +1 -1
- package/library/components/size-input-group.js +2 -2
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +1 -1
- package/library/components/tab-group.js +3 -3
- package/library/components/tab.js +1 -1
- package/library/components/table.js +2 -2
- package/library/components/tag.js +1 -1
- package/library/components/timecode.js +2 -2
- package/library/components/tooltip.js +2 -2
- package/library/components/tree-item.js +2 -2
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +1 -1
- package/library/components/types.js +30808 -30016
- package/library/components/video.js +2 -2
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/button/button.d.ts +4 -0
- package/library/packages/atoms/src/components/line-clamp/line-clamp.d.ts +3 -1
- package/library/packages/atoms/src/components/table/components/table-toolbar/table-saved-search-dropdown.d.ts +60 -0
- package/library/packages/atoms/src/components/table/components/table-toolbar/table-toolbar.d.ts +38 -5
- package/library/packages/atoms/src/components/table/table.d.ts +28 -5
- package/library/packages/atoms/src/components/table/tabulator-tables/core/row/Row.d.ts +2 -2
- package/library/packages/events/src/cx-content-builder-translatable-value-change.d.ts +13 -0
- package/library/packages/events/src/cx-table-export.d.ts +1 -1
- package/library/packages/events/src/cx-table-save-search-select.d.ts +8 -0
- package/library/packages/events/src/events.d.ts +2 -0
- package/library/packages/molecules/src/data-tab-group/data-tab-group.d.ts +1 -0
- package/library/packages/molecules/src/details-group/details-group.d.ts +1 -0
- package/library/packages/molecules/src/list-editor/list-editor.d.ts +14 -0
- package/library/packages/molecules/src/timeline/timeline.d.ts +4 -0
- package/library/packages/organisms/src/color-swatch-group/color-swatch-group.d.ts +1 -0
- package/library/packages/organisms/src/comment/comment.d.ts +13 -0
- package/library/packages/organisms/src/comment/components/comment-menu/comment-menu.d.ts +14 -0
- package/library/packages/organisms/src/content-builder/components/color-swatch-picker/color-swatch-picker.d.ts +21 -0
- package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +19 -0
- package/library/packages/organisms/src/content-builder/components/config-form/config-form.d.ts +28 -8
- package/library/packages/organisms/src/content-builder/components/config-manager/config-manager.d.ts +28 -1
- package/library/packages/organisms/src/content-builder/components/gallery-config/gallery-config.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/accordion.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/color-swatches.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/gallery.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/tab-group.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/timeline.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs-controller.d.ts +10 -0
- package/library/packages/organisms/src/content-builder/content-builder-constants.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/content-builder.d.ts +19 -2
- package/library/packages/organisms/src/content-builder/content-builder.utils.d.ts +0 -7
- package/library/packages/organisms/src/content-builder/plugins/plugin-factory.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/styleController.d.ts +3 -1
- package/library/packages/types/src/color-swatch.d.ts +1 -0
- package/library/packages/types/src/content-builder.d.ts +7 -0
- package/library/packages/types/src/table.d.ts +13 -1
- package/library/packages/utils/src/custom-element/i18n-utils.d.ts +2 -0
- package/library/packages/utils/src/custom-element/i18n.d.ts +32 -9
- package/library/packages/utils/src/string/string.d.ts +2 -0
- package/library/react-web-component.d.ts +115 -58
- package/package.json +1 -1
- package/library/chunks/list-editor.Ct803qvF.js +0 -737
- package/library/chunks/string.D6poLUEC.js +0 -678
|
@@ -1,737 +0,0 @@
|
|
|
1
|
-
import { C as _ } from "./button.CiWlWCNb.js";
|
|
2
|
-
import { C as z } from "./dialog.C28qzMSQ.js";
|
|
3
|
-
import M from "../components/grid.js";
|
|
4
|
-
import q from "../components/grid-item.js";
|
|
5
|
-
import C from "../components/input.js";
|
|
6
|
-
import T from "../components/line-clamp.js";
|
|
7
|
-
import R from "../components/radio.js";
|
|
8
|
-
import O from "../components/radio-group.js";
|
|
9
|
-
import $ from "../components/space.js";
|
|
10
|
-
import { C as P, H as k } from "./table.-ecyjIUr.js";
|
|
11
|
-
import { C as I } from "./typography.BFpl0WMA.js";
|
|
12
|
-
import { i as A, n, C as w, x as l, c as E } from "./custom-element.vnXBMQxc.js";
|
|
13
|
-
import { c as D } from "./component.styles.CI-v8BZa.js";
|
|
14
|
-
import { d as F } from "./popup.Ba501Rgg.js";
|
|
15
|
-
import { L as S } from "./i18n.C3Z8Xe8q.js";
|
|
16
|
-
import { w as g } from "./watch.BCJD77bD.js";
|
|
17
|
-
import { r as x } from "./state.Cw55xXlb.js";
|
|
18
|
-
import { e as b } from "./query.BBf1UFkC.js";
|
|
19
|
-
import { r as j } from "./choose.BTbF6BAn.js";
|
|
20
|
-
import { e as L } from "./class-map.CoZTSvbM.js";
|
|
21
|
-
import { c as y } from "./repeat.CauKaXyy.js";
|
|
22
|
-
import { n as m } from "./when.Dr1es41R.js";
|
|
23
|
-
import { t as B } from "./toString.CL_lYXbK.js";
|
|
24
|
-
import H from "../components/icon-button.js";
|
|
25
|
-
import { C as N } from "./image.BJfasRY_.js";
|
|
26
|
-
import { t as U, a as G, D as v } from "./asset.Ba-CxnNM.js";
|
|
27
|
-
import { a as V } from "./index.Cpamj0jB.js";
|
|
28
|
-
import { A as u } from "./content-builder.UlVFSATk.js";
|
|
29
|
-
import { e as J, t as f } from "./string.D6poLUEC.js";
|
|
30
|
-
var X = 0;
|
|
31
|
-
function W(t) {
|
|
32
|
-
var e = ++X;
|
|
33
|
-
return B(t) + e;
|
|
34
|
-
}
|
|
35
|
-
const Z = A`
|
|
36
|
-
:host {
|
|
37
|
-
isolation: isolate;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.asset-picker__input[data-user-invalid] ~ .asset-picker__button::part(base) {
|
|
41
|
-
border-color: var(--cx-input-invalid-border-color);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.asset-picker__input[data-user-invalid]:focus-within
|
|
45
|
-
~ .asset-picker__button::part(base) {
|
|
46
|
-
border-color: var(--cx-input-invalid-border-color);
|
|
47
|
-
box-shadow: var(--cx-input-invalid-shadow);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.asset-picker__button-container {
|
|
51
|
-
position: relative;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.asset-picker__button {
|
|
55
|
-
position: relative;
|
|
56
|
-
z-index: 1;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.asset-picker__image {
|
|
60
|
-
--height: 150px;
|
|
61
|
-
--width: 200px;
|
|
62
|
-
border-radius: var(--cx-border-radius-medium);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.asset-picker__input {
|
|
66
|
-
position: absolute;
|
|
67
|
-
top: 0;
|
|
68
|
-
left: 0;
|
|
69
|
-
width: 100%;
|
|
70
|
-
height: 100%;
|
|
71
|
-
opacity: 0;
|
|
72
|
-
}
|
|
73
|
-
`;
|
|
74
|
-
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, p = (t, e, i, r) => {
|
|
75
|
-
for (var s = r > 1 ? void 0 : r ? Q(e, i) : e, c = t.length - 1, h; c >= 0; c--)
|
|
76
|
-
(h = t[c]) && (s = (r ? h(e, i, s) : h(s)) || s);
|
|
77
|
-
return r && s && K(e, i, s), s;
|
|
78
|
-
};
|
|
79
|
-
let d = class extends w {
|
|
80
|
-
constructor() {
|
|
81
|
-
super(...arguments), this.localize = new S(this), this.value = "", this.name = "", this.type = [u.Image], this.multiple = !1, this.accepts = [], this.required = !1, this.disabled = !1, this.onRequestAsset = void 0;
|
|
82
|
-
}
|
|
83
|
-
async handleRequestAssetClick() {
|
|
84
|
-
if (this.onRequestAsset)
|
|
85
|
-
try {
|
|
86
|
-
this.emit("cx-asset-request-status", {
|
|
87
|
-
detail: {
|
|
88
|
-
busy: !0
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
const t = await this.onRequestAsset(
|
|
92
|
-
this.type.join(" "),
|
|
93
|
-
this.multiple,
|
|
94
|
-
this.accepts
|
|
95
|
-
);
|
|
96
|
-
if (this.accepts.length > 0 && Object.values(t).some(
|
|
97
|
-
(i) => !this.accepts.includes(J(i.src) ?? "")
|
|
98
|
-
))
|
|
99
|
-
U(this.localize.term("nonAcceptedExtension", this.accepts), {
|
|
100
|
-
notificationType: "warning"
|
|
101
|
-
});
|
|
102
|
-
else if (this.multiple) {
|
|
103
|
-
const i = Object.values(t);
|
|
104
|
-
this.emit("cx-content-builder-asset-select", {
|
|
105
|
-
detail: i
|
|
106
|
-
});
|
|
107
|
-
} else {
|
|
108
|
-
const { id: i, name: r, src: s, type: c } = t;
|
|
109
|
-
let h = s;
|
|
110
|
-
c === u.Audio && (h = (await G({
|
|
111
|
-
extraFields: [v],
|
|
112
|
-
recordIds: [i]
|
|
113
|
-
})).items[0]?.[v]), h && this.emit("cx-content-builder-asset-select", {
|
|
114
|
-
detail: {
|
|
115
|
-
id: i,
|
|
116
|
-
name: r,
|
|
117
|
-
src: h,
|
|
118
|
-
type: c
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
} catch {
|
|
123
|
-
} finally {
|
|
124
|
-
this.emit("cx-asset-request-status", {
|
|
125
|
-
detail: {
|
|
126
|
-
busy: !1
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
async handleValueChange() {
|
|
132
|
-
await this.updateComplete, this.inputEl?.setCustomValidity(
|
|
133
|
-
!this.required || this.value ? "" : this.localize.term("pleaseSelectAnAsset")
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
handleDeleteClick() {
|
|
137
|
-
this.emit("cx-content-builder-asset-delete");
|
|
138
|
-
}
|
|
139
|
-
/** True when the picker accepts this asset type. */
|
|
140
|
-
acceptsType(t) {
|
|
141
|
-
return this.type.includes(t);
|
|
142
|
-
}
|
|
143
|
-
renderAssetPreview() {
|
|
144
|
-
if (this.value && this.acceptsType(u.Image))
|
|
145
|
-
return l`<cx-image
|
|
146
|
-
part="image"
|
|
147
|
-
class="asset-picker__image"
|
|
148
|
-
src=${this.value}
|
|
149
|
-
alt=${this.name}
|
|
150
|
-
width="200px"
|
|
151
|
-
object-fit=${V.Cover}
|
|
152
|
-
></cx-image>`;
|
|
153
|
-
if (this.name && this.acceptsType(u.Video))
|
|
154
|
-
return l`
|
|
155
|
-
<cx-typography variant="body-2">
|
|
156
|
-
${f(this.name, 30, 11, 11)}
|
|
157
|
-
</cx-typography>`;
|
|
158
|
-
if (this.name && this.acceptsType(u.Other)) {
|
|
159
|
-
const t = this.name.split(",");
|
|
160
|
-
return l`<cx-typography variant="body-2">
|
|
161
|
-
${f(t[0], 30, 11, 11)}
|
|
162
|
-
|
|
163
|
-
${m(
|
|
164
|
-
t.length > 1,
|
|
165
|
-
() => l` ${this.localize.term("andOthers", t.length - 1)}`
|
|
166
|
-
)}
|
|
167
|
-
</cx-typography>`;
|
|
168
|
-
}
|
|
169
|
-
if (this.name && this.acceptsType(u.All)) {
|
|
170
|
-
const t = this.name.split(",");
|
|
171
|
-
return l`<cx-typography variant="body-2">
|
|
172
|
-
${f(t[0], 30, 11, 11)}
|
|
173
|
-
${m(t.length > 1, () => l` ${this.localize.term("andOthers", t.length - 1)}`)}
|
|
174
|
-
</cx-typography>`;
|
|
175
|
-
}
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
render() {
|
|
179
|
-
return l`
|
|
180
|
-
<cx-space
|
|
181
|
-
part="base"
|
|
182
|
-
class="asset-picker"
|
|
183
|
-
spacing="2x-small"
|
|
184
|
-
direction="horizontal"
|
|
185
|
-
align-items=${this.acceptsType(u.Image) ? "flex-start" : "center"}
|
|
186
|
-
>
|
|
187
|
-
${this.renderAssetPreview()}
|
|
188
|
-
${m(
|
|
189
|
-
!this.disabled,
|
|
190
|
-
() => l`
|
|
191
|
-
<div class="asset-picker__button-container">
|
|
192
|
-
<cx-input
|
|
193
|
-
class="asset-picker__input"
|
|
194
|
-
aria-label=${this.localize.term("choose")}
|
|
195
|
-
name=${this.name}
|
|
196
|
-
value=${this.value}
|
|
197
|
-
?required=${this.required}
|
|
198
|
-
.form=${this.closest("form")}
|
|
199
|
-
></cx-input>
|
|
200
|
-
<cx-button
|
|
201
|
-
part="button"
|
|
202
|
-
class="asset-picker__button"
|
|
203
|
-
@click=${this.handleRequestAssetClick}
|
|
204
|
-
>
|
|
205
|
-
${this.localize.term("choose")}
|
|
206
|
-
</cx-button>
|
|
207
|
-
</div>
|
|
208
|
-
${m(
|
|
209
|
-
this.value,
|
|
210
|
-
() => l`<cx-icon-button
|
|
211
|
-
label=${this.localize.term("delete")}
|
|
212
|
-
name="delete"
|
|
213
|
-
@click=${this.handleDeleteClick}
|
|
214
|
-
>
|
|
215
|
-
</cx-icon-button>`
|
|
216
|
-
)}
|
|
217
|
-
`
|
|
218
|
-
)}
|
|
219
|
-
</cx-space>
|
|
220
|
-
`;
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
d.styles = [D, Z];
|
|
224
|
-
d.dependencies = {
|
|
225
|
-
"cx-button": _,
|
|
226
|
-
"cx-icon-button": H,
|
|
227
|
-
"cx-image": N,
|
|
228
|
-
"cx-input": C,
|
|
229
|
-
"cx-space": $,
|
|
230
|
-
"cx-typography": I
|
|
231
|
-
};
|
|
232
|
-
p([
|
|
233
|
-
b(".asset-picker__button")
|
|
234
|
-
], d.prototype, "buttonEl", 2);
|
|
235
|
-
p([
|
|
236
|
-
b(".asset-picker__input")
|
|
237
|
-
], d.prototype, "inputEl", 2);
|
|
238
|
-
p([
|
|
239
|
-
n({ reflect: !0, type: String })
|
|
240
|
-
], d.prototype, "value", 2);
|
|
241
|
-
p([
|
|
242
|
-
n({ reflect: !0, type: String })
|
|
243
|
-
], d.prototype, "name", 2);
|
|
244
|
-
p([
|
|
245
|
-
n({
|
|
246
|
-
converter: {
|
|
247
|
-
fromAttribute: (t) => (t ?? "").split(" ").filter((e) => e !== ""),
|
|
248
|
-
toAttribute: (t) => t.join(" ")
|
|
249
|
-
},
|
|
250
|
-
reflect: !0
|
|
251
|
-
})
|
|
252
|
-
], d.prototype, "type", 2);
|
|
253
|
-
p([
|
|
254
|
-
n({ reflect: !0, type: Boolean })
|
|
255
|
-
], d.prototype, "multiple", 2);
|
|
256
|
-
p([
|
|
257
|
-
n({
|
|
258
|
-
converter: {
|
|
259
|
-
fromAttribute: (t) => (t ?? "").split(" ").filter((e) => e !== ""),
|
|
260
|
-
toAttribute: (t) => t.join(" ")
|
|
261
|
-
},
|
|
262
|
-
reflect: !0
|
|
263
|
-
})
|
|
264
|
-
], d.prototype, "accepts", 2);
|
|
265
|
-
p([
|
|
266
|
-
n({ reflect: !0, type: Boolean })
|
|
267
|
-
], d.prototype, "required", 2);
|
|
268
|
-
p([
|
|
269
|
-
n({ attribute: "disabled", reflect: !0, type: Boolean })
|
|
270
|
-
], d.prototype, "disabled", 2);
|
|
271
|
-
p([
|
|
272
|
-
n({ attribute: "on-request-asset", type: Function })
|
|
273
|
-
], d.prototype, "onRequestAsset", 2);
|
|
274
|
-
p([
|
|
275
|
-
g("value")
|
|
276
|
-
], d.prototype, "handleValueChange", 1);
|
|
277
|
-
d = p([
|
|
278
|
-
E("cx-asset-picker")
|
|
279
|
-
], d);
|
|
280
|
-
const Y = A`
|
|
281
|
-
:host {
|
|
282
|
-
--overridden-min-height: var(--min-height, 160px);
|
|
283
|
-
--overridden-max-height: var(--max-height, 260px);
|
|
284
|
-
display: block;
|
|
285
|
-
width: 100%;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.list-editor {
|
|
289
|
-
width: 100%;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.list-editor__table {
|
|
293
|
-
--cell-border-color: transparent;
|
|
294
|
-
--header-font-size: var(--cx-font-size-small);
|
|
295
|
-
--row-header-border-color: transparent;
|
|
296
|
-
--cell-horizontal-padding: var(--cx-spacing-2x-small);
|
|
297
|
-
--min-height: var(--overridden-min-height);
|
|
298
|
-
--max-height: var(--overridden-max-height);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.list-editor__table--no-header {
|
|
302
|
-
--cell-hover-background-color: transparent;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.list-editor__item::part(expand-button) {
|
|
306
|
-
display: none;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.list-editor__item__text {
|
|
310
|
-
--line-height: 1;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.list-editor__item__text__description {
|
|
314
|
-
color: var(--cx-color-neutral-600);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.list-editor__dialog {
|
|
318
|
-
--width: 540px;
|
|
319
|
-
}
|
|
320
|
-
`;
|
|
321
|
-
var tt = Object.defineProperty, et = Object.getOwnPropertyDescriptor, o = (t, e, i, r) => {
|
|
322
|
-
for (var s = r > 1 ? void 0 : r ? et(e, i) : e, c = t.length - 1, h; c >= 0; c--)
|
|
323
|
-
(h = t[c]) && (s = (r ? h(e, i, s) : h(s)) || s);
|
|
324
|
-
return r && s && tt(e, i, s), s;
|
|
325
|
-
};
|
|
326
|
-
const it = {
|
|
327
|
-
resizable: !1
|
|
328
|
-
};
|
|
329
|
-
let a = class extends w {
|
|
330
|
-
constructor() {
|
|
331
|
-
super(...arguments), this.localize = new S(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.boundary = document.body, this.onRequestAsset = void 0, this.editedItem = null, this.isAdding = !1, this.columnsMap = {}, this.sortedEntries = [], this.disableCloseConfigDialog = !1, this.hoverMenu = {
|
|
332
|
-
data: [
|
|
333
|
-
{
|
|
334
|
-
icon: "create",
|
|
335
|
-
name: "edit",
|
|
336
|
-
options: {
|
|
337
|
-
buttonProps: {
|
|
338
|
-
variant: "default"
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
tooltip: this.localize.term("edit")
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
icon: "delete",
|
|
345
|
-
name: "delete",
|
|
346
|
-
options: {
|
|
347
|
-
buttonProps: {
|
|
348
|
-
variant: "default"
|
|
349
|
-
},
|
|
350
|
-
iconStyle: {
|
|
351
|
-
color: "var(--cx-color-danger)"
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
tooltip: this.localize.term("delete")
|
|
355
|
-
}
|
|
356
|
-
],
|
|
357
|
-
options: {
|
|
358
|
-
placement: k.Right
|
|
359
|
-
}
|
|
360
|
-
}, this.OMITTED_FIELDS = ["id"];
|
|
361
|
-
}
|
|
362
|
-
handleColumnsChange() {
|
|
363
|
-
this.columnsMap = {}, this.columns.forEach((t) => {
|
|
364
|
-
this.columnsMap[t.field] = t;
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
handleEditedItemChange() {
|
|
368
|
-
const t = {};
|
|
369
|
-
for (const e of this.columns)
|
|
370
|
-
t[e.field] = e.configOrder;
|
|
371
|
-
this.sortedEntries = Object.entries(this.editedItem || {}).filter(([e]) => this.OMITTED_FIELDS.indexOf(e) === -1 && this.columnsMap[e]).sort(([e], [i]) => (t[e] ?? Number.MAX_SAFE_INTEGER) - (t[i] ?? Number.MAX_SAFE_INTEGER));
|
|
372
|
-
}
|
|
373
|
-
handleTableActions(t) {
|
|
374
|
-
const { name: e, row: i } = t.detail, r = "component" in i ? i.component : i;
|
|
375
|
-
if (r) {
|
|
376
|
-
if (this.useEvents) {
|
|
377
|
-
this.emit(`cx-list-editor-${e}`, {
|
|
378
|
-
detail: {
|
|
379
|
-
index: r.getIndex(),
|
|
380
|
-
item: r.getData()
|
|
381
|
-
}
|
|
382
|
-
});
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
e === "edit" ? this.editedItem = r.getData() : e === "delete" && this.emit("cx-list-editor-change", {
|
|
386
|
-
detail: {
|
|
387
|
-
data: this.data.filter((s) => s.id !== r.getData().id)
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
handleCancelClick() {
|
|
393
|
-
this.disableCloseConfigDialog || (this.isAdding = !1, this.editedItem = null);
|
|
394
|
-
}
|
|
395
|
-
handleRequestClose(t) {
|
|
396
|
-
if (this.disableCloseConfigDialog) {
|
|
397
|
-
t.preventDefault();
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
t.stopPropagation(), this.isAdding = !1, this.editedItem = null;
|
|
401
|
-
}
|
|
402
|
-
handleAddClick() {
|
|
403
|
-
this.isAdding = !0, this.editedItem = {
|
|
404
|
-
...this.sampleItem,
|
|
405
|
-
id: W(`${Date.now()}-`)
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
handleSaveClick() {
|
|
409
|
-
if (this.editedItem) {
|
|
410
|
-
const t = this.data.findIndex(
|
|
411
|
-
(i) => i.id === this.editedItem.id
|
|
412
|
-
);
|
|
413
|
-
if (!this.isAdding && t === -1) {
|
|
414
|
-
this.editedItem = null;
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
let e = this.data;
|
|
418
|
-
this.isAdding ? e = [...e, this.editedItem] : e = this.data.map((i) => i.id === this.editedItem.id ? this.editedItem : i), this.emit("cx-list-editor-change", {
|
|
419
|
-
detail: {
|
|
420
|
-
data: e
|
|
421
|
-
}
|
|
422
|
-
}), this.editedItem = null, this.isAdding = !1;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
handleTableRowMoved() {
|
|
426
|
-
this.emit("cx-list-editor-change", {
|
|
427
|
-
detail: {
|
|
428
|
-
data: this.table?.tabulatorInstance?.getData() ?? this.data ?? []
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
}
|
|
432
|
-
handleAssetRequestStatus(t) {
|
|
433
|
-
this.disableCloseConfigDialog = t.detail.busy;
|
|
434
|
-
}
|
|
435
|
-
async handleLoadingEventChange() {
|
|
436
|
-
if (await this.updateComplete, !this.table)
|
|
437
|
-
return;
|
|
438
|
-
if (!this.loadingItemIndex) {
|
|
439
|
-
this.table.tabulatorInstance?.getRows().forEach((i) => {
|
|
440
|
-
const r = i._row.hoverMenuElement;
|
|
441
|
-
i._row.hoverMenuElement.actions = r.actions.map((s) => (s.options?.buttonProps && (s.options.buttonProps.loading = !1), s));
|
|
442
|
-
});
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
const t = this.table.tabulatorInstance?.getRow(this.loadingItemIndex);
|
|
446
|
-
if (!t || !t?._row?.hoverMenuElement)
|
|
447
|
-
return;
|
|
448
|
-
const e = t._row.hoverMenuElement;
|
|
449
|
-
e.actions = e.actions.map((i) => (i.options?.buttonProps && (i.options.buttonProps.loading = i.name === this.loadingEvent && this.loadingItemIndex === t.getIndex()), i));
|
|
450
|
-
}
|
|
451
|
-
render() {
|
|
452
|
-
return l`
|
|
453
|
-
<cx-space direction="vertical" align-items="flex-start">
|
|
454
|
-
<div class="list-editor">
|
|
455
|
-
<cx-table
|
|
456
|
-
part="table"
|
|
457
|
-
class=${L({
|
|
458
|
-
"list-editor__table": !0,
|
|
459
|
-
"list-editor__table--no-header": this.noHeader
|
|
460
|
-
})}
|
|
461
|
-
?movable-rows=${this.sortable}
|
|
462
|
-
?no-header=${this.noHeader}
|
|
463
|
-
layout="fitColumns"
|
|
464
|
-
row-height=${this.rowHeight}
|
|
465
|
-
.columns=${this.columns}
|
|
466
|
-
.columnDefaults=${it}
|
|
467
|
-
.hoverMenu=${this.hoverMenu}
|
|
468
|
-
.data=${this.data ?? []}
|
|
469
|
-
no-selectable
|
|
470
|
-
@cx-table.rowMoved=${this.handleTableRowMoved}
|
|
471
|
-
@cx-table-row-action-click=${this.handleTableActions}
|
|
472
|
-
></cx-table>
|
|
473
|
-
<cx-dialog
|
|
474
|
-
part="dialog"
|
|
475
|
-
class="list-editor__dialog"
|
|
476
|
-
use-overlay-scrollbar
|
|
477
|
-
strategy="fixed"
|
|
478
|
-
?open=${!!this.editedItem}
|
|
479
|
-
.boundary=${this.boundary}
|
|
480
|
-
@cx-request-close=${this.handleRequestClose}
|
|
481
|
-
>
|
|
482
|
-
<cx-space slot="label" direction="vertical" spacing="2x-small">
|
|
483
|
-
<cx-typography variant="h4">
|
|
484
|
-
${this.isAdding ? this.addDialogLabel : this.editDialogLabel}
|
|
485
|
-
</cx-typography>
|
|
486
|
-
${m(
|
|
487
|
-
!this.isAdding && this.editedItem?.[this.displayField],
|
|
488
|
-
() => l`<cx-typography variant="body3">
|
|
489
|
-
<cx-line-clamp lines="1">
|
|
490
|
-
${this.editedItem?.[this.displayField]}
|
|
491
|
-
</cx-line-clamp>
|
|
492
|
-
</cx-typography>`
|
|
493
|
-
)}
|
|
494
|
-
</cx-space>
|
|
495
|
-
<cx-grid columns="3" spacing="var(--cx-spacing-small)" wrap="wrap">
|
|
496
|
-
${y(
|
|
497
|
-
this.sortedEntries,
|
|
498
|
-
([t]) => t,
|
|
499
|
-
([t, e]) => l`<cx-grid-item xs="3" sm="1">
|
|
500
|
-
<cx-typography variant="body2">
|
|
501
|
-
${this.columnsMap[t].title}
|
|
502
|
-
</cx-typography>
|
|
503
|
-
</cx-grid-item>
|
|
504
|
-
<cx-grid-item xs="3" sm="2">
|
|
505
|
-
${j(
|
|
506
|
-
this.columnsMap[t].controlType,
|
|
507
|
-
[
|
|
508
|
-
[
|
|
509
|
-
"image-picker",
|
|
510
|
-
() => l`<cx-asset-picker
|
|
511
|
-
value=${e}
|
|
512
|
-
type="image"
|
|
513
|
-
id=${t}
|
|
514
|
-
@cx-content-builder-asset-select=${async (s) => {
|
|
515
|
-
if (Array.isArray(s.detail))
|
|
516
|
-
return;
|
|
517
|
-
const { src: c } = s.detail;
|
|
518
|
-
this.editedItem = {
|
|
519
|
-
...this.editedItem,
|
|
520
|
-
[t]: c
|
|
521
|
-
};
|
|
522
|
-
}}
|
|
523
|
-
@cx-content-builder-asset-delete=${async () => {
|
|
524
|
-
this.editedItem = {
|
|
525
|
-
...this.editedItem,
|
|
526
|
-
[t]: ""
|
|
527
|
-
};
|
|
528
|
-
}}
|
|
529
|
-
@cx-asset-request-status=${this.handleAssetRequestStatus}
|
|
530
|
-
.onRequestAsset=${this.onRequestAsset}
|
|
531
|
-
>
|
|
532
|
-
</cx-asset-picker>`
|
|
533
|
-
],
|
|
534
|
-
[
|
|
535
|
-
"radio-group",
|
|
536
|
-
() => {
|
|
537
|
-
const i = (r) => {
|
|
538
|
-
const s = r.target.value;
|
|
539
|
-
this.editedItem = {
|
|
540
|
-
...this.editedItem,
|
|
541
|
-
[t]: s
|
|
542
|
-
};
|
|
543
|
-
};
|
|
544
|
-
return l`<cx-radio-group
|
|
545
|
-
data-testid="radio-group-control"
|
|
546
|
-
horizontal
|
|
547
|
-
value=${(e || this.columnsMap[t].defaultValue) ?? ""}
|
|
548
|
-
size="medium"
|
|
549
|
-
@cx-change=${i}
|
|
550
|
-
>
|
|
551
|
-
${y(
|
|
552
|
-
this.columnsMap[t].options ?? [],
|
|
553
|
-
(r) => r.value,
|
|
554
|
-
(r) => l`<cx-radio value=${r.value}>
|
|
555
|
-
${r.name}
|
|
556
|
-
</cx-radio>`
|
|
557
|
-
)}
|
|
558
|
-
</cx-radio-group>`;
|
|
559
|
-
}
|
|
560
|
-
]
|
|
561
|
-
],
|
|
562
|
-
() => l`
|
|
563
|
-
<cx-input
|
|
564
|
-
value=${e}
|
|
565
|
-
@cx-change=${(r) => {
|
|
566
|
-
const s = r.target.value;
|
|
567
|
-
this.editedItem = {
|
|
568
|
-
...this.editedItem,
|
|
569
|
-
[t]: s
|
|
570
|
-
};
|
|
571
|
-
}}
|
|
572
|
-
></cx-input>`
|
|
573
|
-
)}
|
|
574
|
-
</cx-grid-item>`
|
|
575
|
-
)}
|
|
576
|
-
</cx-grid>
|
|
577
|
-
<cx-space
|
|
578
|
-
slot="footer"
|
|
579
|
-
spacing="x-small"
|
|
580
|
-
wrap="nowrap"
|
|
581
|
-
justify-content="end"
|
|
582
|
-
>
|
|
583
|
-
<cx-button
|
|
584
|
-
data-testid="cancel-button"
|
|
585
|
-
variant="default"
|
|
586
|
-
size="medium"
|
|
587
|
-
@click=${this.handleCancelClick}
|
|
588
|
-
>
|
|
589
|
-
${this.localize.term("cancel")}
|
|
590
|
-
</cx-button>
|
|
591
|
-
<cx-button
|
|
592
|
-
data-testid="save-button"
|
|
593
|
-
variant="primary"
|
|
594
|
-
size="medium"
|
|
595
|
-
@click=${this.handleSaveClick}
|
|
596
|
-
>
|
|
597
|
-
${this.localize.term("save")}
|
|
598
|
-
</cx-button>
|
|
599
|
-
</cx-space>
|
|
600
|
-
</cx-dialog>
|
|
601
|
-
</div>
|
|
602
|
-
${m(
|
|
603
|
-
this.canAdd,
|
|
604
|
-
() => l`
|
|
605
|
-
<cx-button
|
|
606
|
-
data-testid="add-button"
|
|
607
|
-
variant="default"
|
|
608
|
-
size="medium"
|
|
609
|
-
@click=${this.handleAddClick}
|
|
610
|
-
>
|
|
611
|
-
${this.addItemText || this.localize.term("add")}
|
|
612
|
-
</cx-button>
|
|
613
|
-
`
|
|
614
|
-
)}
|
|
615
|
-
</cx-space>
|
|
616
|
-
`;
|
|
617
|
-
}
|
|
618
|
-
};
|
|
619
|
-
a.styles = [D, Y];
|
|
620
|
-
a.dependencies = {
|
|
621
|
-
"cx-asset-picker": d,
|
|
622
|
-
"cx-button": _,
|
|
623
|
-
"cx-dialog": z,
|
|
624
|
-
"cx-grid": M,
|
|
625
|
-
"cx-grid-item": q,
|
|
626
|
-
"cx-input": C,
|
|
627
|
-
"cx-line-clamp": T,
|
|
628
|
-
"cx-radio": R,
|
|
629
|
-
"cx-radio-group": O,
|
|
630
|
-
"cx-space": $,
|
|
631
|
-
"cx-table": P,
|
|
632
|
-
"cx-typography": I
|
|
633
|
-
};
|
|
634
|
-
o([
|
|
635
|
-
b("cx-dialog")
|
|
636
|
-
], a.prototype, "dialog", 2);
|
|
637
|
-
o([
|
|
638
|
-
b("cx-table")
|
|
639
|
-
], a.prototype, "table", 2);
|
|
640
|
-
o([
|
|
641
|
-
n({
|
|
642
|
-
converter: {
|
|
643
|
-
fromAttribute: (t) => {
|
|
644
|
-
try {
|
|
645
|
-
const e = JSON.parse(t);
|
|
646
|
-
return Array.isArray(e) ? e : [];
|
|
647
|
-
} catch {
|
|
648
|
-
return [];
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
toAttribute: (t) => JSON.stringify(t)
|
|
652
|
-
},
|
|
653
|
-
reflect: !1,
|
|
654
|
-
type: String
|
|
655
|
-
})
|
|
656
|
-
], a.prototype, "data", 2);
|
|
657
|
-
o([
|
|
658
|
-
n({ attribute: "can-add", reflect: !0, type: Boolean })
|
|
659
|
-
], a.prototype, "canAdd", 2);
|
|
660
|
-
o([
|
|
661
|
-
n({ attribute: "add-dialog-label", reflect: !0, type: String })
|
|
662
|
-
], a.prototype, "addDialogLabel", 2);
|
|
663
|
-
o([
|
|
664
|
-
n({ attribute: "edit-dialog-label", reflect: !0, type: String })
|
|
665
|
-
], a.prototype, "editDialogLabel", 2);
|
|
666
|
-
o([
|
|
667
|
-
n({ attribute: "display-field", reflect: !0, type: String })
|
|
668
|
-
], a.prototype, "displayField", 2);
|
|
669
|
-
o([
|
|
670
|
-
n({ attribute: "description-field", reflect: !0, type: String })
|
|
671
|
-
], a.prototype, "descriptionField", 2);
|
|
672
|
-
o([
|
|
673
|
-
n({ attribute: "add-item-text", reflect: !0, type: String })
|
|
674
|
-
], a.prototype, "addItemText", 2);
|
|
675
|
-
o([
|
|
676
|
-
n({ attribute: "sample-item", type: Object })
|
|
677
|
-
], a.prototype, "sampleItem", 2);
|
|
678
|
-
o([
|
|
679
|
-
n({ attribute: "use-events", reflect: !0, type: Boolean })
|
|
680
|
-
], a.prototype, "useEvents", 2);
|
|
681
|
-
o([
|
|
682
|
-
n({ reflect: !0, type: Boolean })
|
|
683
|
-
], a.prototype, "sortable", 2);
|
|
684
|
-
o([
|
|
685
|
-
n({ attribute: "loading-event", reflect: !0, type: String })
|
|
686
|
-
], a.prototype, "loadingEvent", 2);
|
|
687
|
-
o([
|
|
688
|
-
n({ attribute: "loading-item-index", reflect: !0, type: String })
|
|
689
|
-
], a.prototype, "loadingItemIndex", 2);
|
|
690
|
-
o([
|
|
691
|
-
n({ attribute: "columns", reflect: !1, type: Array })
|
|
692
|
-
], a.prototype, "columns", 2);
|
|
693
|
-
o([
|
|
694
|
-
n({ attribute: "no-header", reflect: !0, type: Boolean })
|
|
695
|
-
], a.prototype, "noHeader", 2);
|
|
696
|
-
o([
|
|
697
|
-
n({ attribute: "row-height", reflect: !0, type: Number })
|
|
698
|
-
], a.prototype, "rowHeight", 2);
|
|
699
|
-
o([
|
|
700
|
-
n({ type: Object })
|
|
701
|
-
], a.prototype, "boundary", 2);
|
|
702
|
-
o([
|
|
703
|
-
n({ attribute: "on-request-asset", type: Function })
|
|
704
|
-
], a.prototype, "onRequestAsset", 2);
|
|
705
|
-
o([
|
|
706
|
-
x()
|
|
707
|
-
], a.prototype, "editedItem", 2);
|
|
708
|
-
o([
|
|
709
|
-
x()
|
|
710
|
-
], a.prototype, "isAdding", 2);
|
|
711
|
-
o([
|
|
712
|
-
x()
|
|
713
|
-
], a.prototype, "columnsMap", 2);
|
|
714
|
-
o([
|
|
715
|
-
x()
|
|
716
|
-
], a.prototype, "sortedEntries", 2);
|
|
717
|
-
o([
|
|
718
|
-
g("columns")
|
|
719
|
-
], a.prototype, "handleColumnsChange", 1);
|
|
720
|
-
o([
|
|
721
|
-
g("editedItem"),
|
|
722
|
-
g("columns", { waitUntilFirstUpdate: !0 })
|
|
723
|
-
], a.prototype, "handleEditedItemChange", 1);
|
|
724
|
-
o([
|
|
725
|
-
g("loadingEvent", { waitUntilFirstUpdate: !0 }),
|
|
726
|
-
g("loadingItemIndex", { waitUntilFirstUpdate: !0 }),
|
|
727
|
-
F(10)
|
|
728
|
-
], a.prototype, "handleLoadingEventChange", 1);
|
|
729
|
-
a = o([
|
|
730
|
-
E("cx-list-editor")
|
|
731
|
-
], a);
|
|
732
|
-
export {
|
|
733
|
-
a as C,
|
|
734
|
-
d as a,
|
|
735
|
-
it as c,
|
|
736
|
-
W as u
|
|
737
|
-
};
|