@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260702085048 → 0.8.1-dev.20260706110649
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/CopyButton-UPJPMJUB.mjs +57 -0
- package/dist/DateTimeViewClient-R3M6ISVK.mjs +16 -0
- package/dist/DateViewClient-VLTRN47D.mjs +9 -0
- package/dist/{chunk-SDNYBQSI.mjs → HlsPlayer-57543DTW.mjs} +3 -2
- package/dist/HlsPlayer-5AWFZ2P6.mjs +601 -0
- package/dist/IframeClient-RGJFZ5P2.mjs +98 -0
- package/dist/InputControlClient-NJV6B65M.mjs +604 -0
- package/dist/InputControlClient-OQDLYA4S.mjs +604 -0
- package/dist/InputControlClient-TW664WIJ.mjs +602 -0
- package/dist/{LinkNodeButton-WDDPNYWI.mjs → LinkNodeButton-FUL3J5HR.mjs} +6 -5
- package/dist/LinkNodeButton-IGJOGOKI.mjs +362 -0
- package/dist/LinkNodeButton-ZONM74OO.mjs +174 -0
- package/dist/Pagination-6OFACRMQ.mjs +229 -0
- package/dist/Pagination-FSYLYKUA.mjs +181 -0
- package/dist/Pagination-YCD5CU2L.mjs +183 -0
- package/dist/Slider-554BKC7N.mjs +322 -0
- package/dist/Slider-PEIVH6A5.mjs +320 -0
- package/dist/chunk-2GSYECIS.mjs +109 -0
- package/dist/chunk-3GWLDT7C.mjs +204 -0
- package/dist/chunk-3R4VVVNK.mjs +903 -0
- package/dist/chunk-47HD7QP7.mjs +199 -0
- package/dist/chunk-56HSDML5.mjs +22 -0
- package/dist/chunk-67IG5NBU.mjs +200 -0
- package/dist/chunk-7ZFZLN56.mjs +903 -0
- package/dist/chunk-CM7LUGCH.mjs +107 -0
- package/dist/chunk-IKIXEQPV.mjs +198 -0
- package/dist/chunk-IMNQO57B.mjs +25 -0
- package/dist/chunk-R2HV35IB.mjs +201 -0
- package/dist/chunk-SPRVN5IM.mjs +118 -0
- package/dist/chunk-TVL6KVD5.mjs +229 -0
- package/dist/chunk-WEV5U33G.mjs +207 -0
- package/dist/chunk-YG6FKKQJ.mjs +900 -0
- package/dist/index.d.mts +57 -170
- package/dist/index.d.ts +57 -170
- package/dist/index.js +3945 -3808
- package/dist/index.mjs +596 -2924
- package/dist/server.d.mts +72 -0
- package/dist/server.d.ts +72 -0
- package/dist/server.js +5126 -0
- package/dist/server.mjs +2698 -0
- package/package.json +18 -4
- package/dist/HlsPlayer-DZNDKG2P.mjs +0 -7
- package/dist/chunk-DOKQUUH3.mjs +0 -414
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
AssetUtility_default,
|
|
4
|
+
BooleanSelect_default,
|
|
5
|
+
CheckboxInput_default,
|
|
6
|
+
ColorInput_default,
|
|
7
|
+
DateTimeInput_default,
|
|
8
|
+
EmailInput_default,
|
|
9
|
+
LineTextInput_default,
|
|
10
|
+
MoneyInput_default,
|
|
11
|
+
MultilineTextInput_default,
|
|
12
|
+
NumberInput_default,
|
|
13
|
+
OtpInput_default,
|
|
14
|
+
PercentageInput_default,
|
|
15
|
+
PhoneInput_default,
|
|
16
|
+
SelectWithSearchInput_default,
|
|
17
|
+
TimeInput_default
|
|
18
|
+
} from "./chunk-YG6FKKQJ.mjs";
|
|
19
|
+
import {
|
|
20
|
+
Hyperlink,
|
|
21
|
+
Icon_default,
|
|
22
|
+
InputControlType_default
|
|
23
|
+
} from "./chunk-CM7LUGCH.mjs";
|
|
24
|
+
import {
|
|
25
|
+
Button_default,
|
|
26
|
+
ClientButton_default
|
|
27
|
+
} from "./chunk-IKIXEQPV.mjs";
|
|
28
|
+
import "./chunk-56HSDML5.mjs";
|
|
29
|
+
|
|
30
|
+
// src/components/controls/edit/InputControlClient.tsx
|
|
31
|
+
import React4 from "react";
|
|
32
|
+
|
|
33
|
+
// src/components/controls/edit/Select.tsx
|
|
34
|
+
import { useState, useEffect } from "react";
|
|
35
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
36
|
+
var Select = (props) => {
|
|
37
|
+
const [list, setList] = useState([]);
|
|
38
|
+
const getSafeValue = (val) => {
|
|
39
|
+
if (val === null || val === void 0) return "";
|
|
40
|
+
if (typeof val === "boolean") return val ? "1" : "0";
|
|
41
|
+
return val;
|
|
42
|
+
};
|
|
43
|
+
const textChangeHandler = (event) => {
|
|
44
|
+
let rawValue = event.target.value;
|
|
45
|
+
if (rawValue === "") rawValue = null;
|
|
46
|
+
let finalValue = rawValue;
|
|
47
|
+
if (list && props.dataKeyFieldName) {
|
|
48
|
+
const key = props.dataKeyFieldName;
|
|
49
|
+
const selectedItem = list.find(
|
|
50
|
+
(item) => String(item[key]) === String(rawValue)
|
|
51
|
+
);
|
|
52
|
+
if (selectedItem) {
|
|
53
|
+
const keyValue = selectedItem[key];
|
|
54
|
+
if (typeof keyValue === "number") {
|
|
55
|
+
finalValue = Number(rawValue);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
props.callback?.({
|
|
60
|
+
name: props.name,
|
|
61
|
+
value: finalValue,
|
|
62
|
+
index: props.index,
|
|
63
|
+
groupKey: props.groupKey
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
async function fetchData() {
|
|
68
|
+
if (props.dataset) {
|
|
69
|
+
setList(props.dataset);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (props.dataSource && props.serviceClient) {
|
|
73
|
+
let dataSource = props.dataSource;
|
|
74
|
+
let response;
|
|
75
|
+
if (props.dataSourceDependsOn && props.dependentValue) {
|
|
76
|
+
dataSource = dataSource.replace(
|
|
77
|
+
`{${props.dataSourceDependsOn}}`,
|
|
78
|
+
props.dependentValue
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
response = await props.serviceClient.get(dataSource);
|
|
82
|
+
setList(response.result ?? []);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
fetchData();
|
|
86
|
+
}, [
|
|
87
|
+
props.dataset,
|
|
88
|
+
props.dataSource,
|
|
89
|
+
props.dependentValue,
|
|
90
|
+
props.dataSourceDependsOn
|
|
91
|
+
]);
|
|
92
|
+
const value = getSafeValue(props.value);
|
|
93
|
+
return /* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
94
|
+
props.attributes?.label && /* @__PURE__ */ jsx("span", { className: "text-sm font-medium inline-block pb-1", children: props.attributes?.label }),
|
|
95
|
+
" ",
|
|
96
|
+
props.attributes?.label && props.attributes?.required && /* @__PURE__ */ jsx("span", { className: "bg-error-weak", children: "*" }),
|
|
97
|
+
/* @__PURE__ */ jsxs(
|
|
98
|
+
"select",
|
|
99
|
+
{
|
|
100
|
+
name: props.name,
|
|
101
|
+
id: props.name,
|
|
102
|
+
value,
|
|
103
|
+
onChange: textChangeHandler,
|
|
104
|
+
required: props.attributes?.required,
|
|
105
|
+
disabled: props.attributes?.readOnly,
|
|
106
|
+
className: "peer select py-1.5 block w-full text-black rounded border-gray-300 shadow-sm\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none",
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ jsx("option", { value: "", children: props.attributes?.placeholder || "Select" }),
|
|
109
|
+
list.map((item, index) => {
|
|
110
|
+
const keyField = props.dataKeyFieldName;
|
|
111
|
+
const textField = props.dataTextFieldName;
|
|
112
|
+
return /* @__PURE__ */ jsx("option", { value: item[keyField], children: item[textField] }, index);
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsx("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 text-alert text-sm", children: props.attributes?.errorMessage || "" })
|
|
118
|
+
] });
|
|
119
|
+
};
|
|
120
|
+
var Select_default = Select;
|
|
121
|
+
|
|
122
|
+
// src/components/controls/edit/SelectWithSearchPanel.tsx
|
|
123
|
+
import React2, {
|
|
124
|
+
useEffect as useEffect2,
|
|
125
|
+
useRef,
|
|
126
|
+
useState as useState2,
|
|
127
|
+
useCallback
|
|
128
|
+
} from "react";
|
|
129
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
130
|
+
var SelectWithSearchPanel = (props) => {
|
|
131
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
132
|
+
const [searchTerm, setSearchTerm] = useState2("");
|
|
133
|
+
const [highlightedIndex, setHighlightedIndex] = useState2(0);
|
|
134
|
+
const [list, setList] = useState2([]);
|
|
135
|
+
const listRef = useRef(null);
|
|
136
|
+
const [isError, setIsError] = useState2(false);
|
|
137
|
+
const containerRef = useRef(null);
|
|
138
|
+
const [isCreateOpen, setIsCreateOpen] = useState2(false);
|
|
139
|
+
const [formData, setFormData] = useState2({});
|
|
140
|
+
const getNestedValue = (obj, path) => {
|
|
141
|
+
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
142
|
+
};
|
|
143
|
+
useEffect2(() => {
|
|
144
|
+
const handleClickOutside = (event) => {
|
|
145
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
146
|
+
setIsOpen(false);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
150
|
+
return () => {
|
|
151
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
152
|
+
};
|
|
153
|
+
}, []);
|
|
154
|
+
useEffect2(() => {
|
|
155
|
+
async function fetchData() {
|
|
156
|
+
if (props.dataset) {
|
|
157
|
+
setList(props.dataset);
|
|
158
|
+
} else if (props.dataSource && props.serviceClient) {
|
|
159
|
+
let dataSource = props.dataSource;
|
|
160
|
+
if (props.dataSourceDependsOn && props.dependentValue) {
|
|
161
|
+
dataSource = dataSource.replace(
|
|
162
|
+
`{${props.dataSourceDependsOn}}`,
|
|
163
|
+
props.dependentValue
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
const response = await props.serviceClient.get(dataSource);
|
|
167
|
+
if (response?.result) setList(response.result);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
fetchData();
|
|
171
|
+
}, [
|
|
172
|
+
props.dataSource,
|
|
173
|
+
props.dependentValue,
|
|
174
|
+
props.dataset,
|
|
175
|
+
props.dataSourceDependsOn
|
|
176
|
+
]);
|
|
177
|
+
const filteredItems = list?.filter((item) => {
|
|
178
|
+
const value = getNestedValue(item, props.dataTextFieldName);
|
|
179
|
+
return value?.toLowerCase().includes(searchTerm?.toLowerCase());
|
|
180
|
+
});
|
|
181
|
+
const playBeep = () => {
|
|
182
|
+
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
|
183
|
+
const oscillator = audioCtx.createOscillator();
|
|
184
|
+
const gainNode = audioCtx.createGain();
|
|
185
|
+
oscillator.type = "square";
|
|
186
|
+
oscillator.frequency.setValueAtTime(300, audioCtx.currentTime);
|
|
187
|
+
gainNode.gain.setValueAtTime(0.02, audioCtx.currentTime);
|
|
188
|
+
oscillator.connect(gainNode);
|
|
189
|
+
gainNode.connect(audioCtx.destination);
|
|
190
|
+
oscillator.start();
|
|
191
|
+
setTimeout(() => {
|
|
192
|
+
oscillator.stop();
|
|
193
|
+
audioCtx.close();
|
|
194
|
+
}, 250);
|
|
195
|
+
};
|
|
196
|
+
useEffect2(() => {
|
|
197
|
+
const filteredItems2 = list?.filter(
|
|
198
|
+
(item) => item[props?.dataTextFieldName]?.toLowerCase().includes(searchTerm?.toLowerCase())
|
|
199
|
+
);
|
|
200
|
+
if (searchTerm.length > 0 && filteredItems2.length === 0) {
|
|
201
|
+
playBeep();
|
|
202
|
+
setIsError(true);
|
|
203
|
+
} else {
|
|
204
|
+
setIsError(false);
|
|
205
|
+
}
|
|
206
|
+
}, [searchTerm]);
|
|
207
|
+
const handleSelect = (event, item) => {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
setSearchTerm(getNestedValue(item, props.dataTextFieldName));
|
|
210
|
+
if (props.callback) {
|
|
211
|
+
const val = {};
|
|
212
|
+
props.callback({
|
|
213
|
+
name: props.name,
|
|
214
|
+
value: item[props.dataKeyFieldName],
|
|
215
|
+
index: props.index,
|
|
216
|
+
groupKey: props.groupKey
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
setHighlightedIndex(0);
|
|
220
|
+
setIsOpen(false);
|
|
221
|
+
};
|
|
222
|
+
const handleKeyDown = (e) => {
|
|
223
|
+
if (e.key === "Escape") {
|
|
224
|
+
setIsOpen(false);
|
|
225
|
+
setHighlightedIndex(-1);
|
|
226
|
+
} else if (e.key === "ArrowDown") {
|
|
227
|
+
e.preventDefault();
|
|
228
|
+
setHighlightedIndex((prev) => {
|
|
229
|
+
const nextIndex = prev < filteredItems.length - 1 ? prev + 1 : prev;
|
|
230
|
+
scrollIntoView(nextIndex);
|
|
231
|
+
return nextIndex;
|
|
232
|
+
});
|
|
233
|
+
} else if (e.key === "ArrowUp") {
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
setHighlightedIndex((prev) => {
|
|
236
|
+
const prevIndex = prev > 0 ? prev - 1 : prev;
|
|
237
|
+
scrollIntoView(prevIndex);
|
|
238
|
+
return prevIndex;
|
|
239
|
+
});
|
|
240
|
+
} else if (e.key === "Enter" && highlightedIndex >= 0) {
|
|
241
|
+
handleSelect(e, filteredItems[highlightedIndex]);
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
const scrollIntoView = (index) => {
|
|
245
|
+
if (listRef.current) {
|
|
246
|
+
const item = listRef.current.children[index];
|
|
247
|
+
if (item) {
|
|
248
|
+
item.scrollIntoView();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const textChangeHandler = (event) => {
|
|
253
|
+
const newSearchTerm = event.target.value;
|
|
254
|
+
setSearchTerm(newSearchTerm);
|
|
255
|
+
setIsOpen(true);
|
|
256
|
+
setHighlightedIndex(0);
|
|
257
|
+
};
|
|
258
|
+
const handleInputChange = (event, field) => {
|
|
259
|
+
setFormData((prev) => ({ ...prev, [field]: event.target.value }));
|
|
260
|
+
};
|
|
261
|
+
const handleSaveModal = useCallback(async () => {
|
|
262
|
+
console.log("Form Data:", formData);
|
|
263
|
+
return formData;
|
|
264
|
+
}, []);
|
|
265
|
+
return /* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
266
|
+
/* @__PURE__ */ jsxs2("label", { className: "text-sm mb-1 font-medium", children: [
|
|
267
|
+
props.attributes?.label,
|
|
268
|
+
" ",
|
|
269
|
+
" ",
|
|
270
|
+
props?.attributes?.required && /* @__PURE__ */ jsx2("span", { className: "bg-error-weak", children: "*" })
|
|
271
|
+
] }),
|
|
272
|
+
/* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(
|
|
273
|
+
"input",
|
|
274
|
+
{
|
|
275
|
+
type: "text",
|
|
276
|
+
value: searchTerm,
|
|
277
|
+
onChange: textChangeHandler,
|
|
278
|
+
onFocus: () => setIsOpen(true),
|
|
279
|
+
onKeyDown: handleKeyDown,
|
|
280
|
+
placeholder: props.attributes?.placeholder,
|
|
281
|
+
className: `peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm
|
|
282
|
+
${isError ? "focus:border-red-300 focus:ring focus:ring-red-200 focus:ring-opacity-50" : "focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"}
|
|
283
|
+
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none`
|
|
284
|
+
}
|
|
285
|
+
) }),
|
|
286
|
+
/* @__PURE__ */ jsx2("div", { ref: containerRef, children: isOpen && /* @__PURE__ */ jsxs2(React2.Fragment, { children: [
|
|
287
|
+
/* @__PURE__ */ jsxs2("div", { className: "fixed z-50 right-0 bg-white top-[62px] w-1/4 border-l border-gray-200", children: [
|
|
288
|
+
/* @__PURE__ */ jsx2("div", { className: "flex flex-col p-2 bg-accent-950 text-white", children: /* @__PURE__ */ jsxs2("h5", { className: "text-md text-white font-medium", children: [
|
|
289
|
+
"Select a",
|
|
290
|
+
" ",
|
|
291
|
+
props.attributes?.label || props.attributes?.heading
|
|
292
|
+
] }) }),
|
|
293
|
+
/* @__PURE__ */ jsx2("div", { className: "flex justify-end px-4 border-b py-2 border-gray-200 h-10", children: props.createFields && props.createFields.length > 0 && /* @__PURE__ */ jsx2(
|
|
294
|
+
"button",
|
|
295
|
+
{
|
|
296
|
+
type: "button",
|
|
297
|
+
className: "text-primary hover:text-primary-800",
|
|
298
|
+
onMouseDown: (e) => {
|
|
299
|
+
e.preventDefault();
|
|
300
|
+
setIsCreateOpen(true);
|
|
301
|
+
},
|
|
302
|
+
children: "Create"
|
|
303
|
+
}
|
|
304
|
+
) })
|
|
305
|
+
] }),
|
|
306
|
+
isCreateOpen && /* @__PURE__ */ jsxs2("div", { className: "fixed right-0 w-1/4 h-full top-[62px] bg-white shadow-lg border-l border-gray-200 z-50", children: [
|
|
307
|
+
/* @__PURE__ */ jsx2("div", { className: "flex flex-col p-2 bg-accent-950", children: /* @__PURE__ */ jsxs2("h5", { className: "text-md font-medium text-white", children: [
|
|
308
|
+
"Create New ",
|
|
309
|
+
props.attributes?.label
|
|
310
|
+
] }) }),
|
|
311
|
+
/* @__PURE__ */ jsx2("div", { className: "flex justify-end px-4 border-b py-2 border-gray-200", children: /* @__PURE__ */ jsx2(
|
|
312
|
+
"button",
|
|
313
|
+
{
|
|
314
|
+
type: "button",
|
|
315
|
+
onClick: () => setIsCreateOpen(false),
|
|
316
|
+
className: "text-red-600 hover:text-red-800",
|
|
317
|
+
children: "Close"
|
|
318
|
+
}
|
|
319
|
+
) }),
|
|
320
|
+
/* @__PURE__ */ jsxs2("div", { className: "p-4", children: [
|
|
321
|
+
props.createFields?.map((field) => /* @__PURE__ */ jsxs2("div", { className: "mb-4", children: [
|
|
322
|
+
/* @__PURE__ */ jsx2("label", { className: "text-sm mb-1 font-medium block", children: field.label }),
|
|
323
|
+
/* @__PURE__ */ jsx2(
|
|
324
|
+
"input",
|
|
325
|
+
{
|
|
326
|
+
type: field.type,
|
|
327
|
+
value: formData[field.name] || "",
|
|
328
|
+
onChange: (e) => handleInputChange(e, field.name),
|
|
329
|
+
placeholder: field.placeholder,
|
|
330
|
+
required: field.required,
|
|
331
|
+
disabled: field.disabled,
|
|
332
|
+
pattern: field.pattern,
|
|
333
|
+
minLength: field.minLength,
|
|
334
|
+
maxLength: field.maxLength,
|
|
335
|
+
className: "peer mt-1 py-1.5 block w-full text-black rounded border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
|
|
336
|
+
}
|
|
337
|
+
)
|
|
338
|
+
] }, field.name)),
|
|
339
|
+
/* @__PURE__ */ jsxs2(Button_default, { onClick: async () => {
|
|
340
|
+
handleSaveModal();
|
|
341
|
+
return { isSuccessful: true };
|
|
342
|
+
}, className: "w-full", children: [
|
|
343
|
+
"Save ",
|
|
344
|
+
props.attributes?.label
|
|
345
|
+
] })
|
|
346
|
+
] })
|
|
347
|
+
] }),
|
|
348
|
+
/* @__PURE__ */ jsx2(
|
|
349
|
+
"div",
|
|
350
|
+
{
|
|
351
|
+
ref: listRef,
|
|
352
|
+
className: "fixed z-10 right-0 mt-[130px] top-0 w-1/4 bg-white border-l border-gray-200 shadow-lg overflow-y-auto",
|
|
353
|
+
style: { height: "calc(100vh - 130px)" },
|
|
354
|
+
children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(
|
|
355
|
+
"button",
|
|
356
|
+
{
|
|
357
|
+
onClick: (e) => {
|
|
358
|
+
handleSelect(e, item);
|
|
359
|
+
},
|
|
360
|
+
className: `w-full px-4 py-2 flex items-center space-x-2 text-left border-b border-gray-200 ${index === highlightedIndex ? "bg-gray-200" : "hover:bg-gray-100"}`,
|
|
361
|
+
role: "option",
|
|
362
|
+
tabIndex: -1,
|
|
363
|
+
onMouseEnter: () => setHighlightedIndex(index),
|
|
364
|
+
children: /* @__PURE__ */ jsx2("span", { children: getNestedValue(item, props.dataTextFieldName) })
|
|
365
|
+
}
|
|
366
|
+
) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ jsx2("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
] }) })
|
|
370
|
+
] });
|
|
371
|
+
};
|
|
372
|
+
var SelectWithSearchPanel_default = SelectWithSearchPanel;
|
|
373
|
+
|
|
374
|
+
// src/components/controls/edit/AssetUpload.tsx
|
|
375
|
+
import React3, { useEffect as useEffect3 } from "react";
|
|
376
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
377
|
+
var AssetUpload = (props) => {
|
|
378
|
+
const isDisabled = props.attributes?.disable ?? false;
|
|
379
|
+
let allValues = [];
|
|
380
|
+
if (props.value !== void 0 && props.value !== null && props.value !== "") {
|
|
381
|
+
try {
|
|
382
|
+
allValues = JSON.parse(props.value.toString());
|
|
383
|
+
} catch (error) {
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
const getInitialTab = () => {
|
|
387
|
+
if (allValues.length > 0) {
|
|
388
|
+
const asset = allValues[0];
|
|
389
|
+
if (asset.posterUrl) {
|
|
390
|
+
return "video";
|
|
391
|
+
} else if (asset.assetUrl) {
|
|
392
|
+
return "image";
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
return "image";
|
|
396
|
+
};
|
|
397
|
+
const [assetType, setAssetType] = React3.useState(getInitialTab);
|
|
398
|
+
useEffect3(() => {
|
|
399
|
+
setAssetType(getInitialTab());
|
|
400
|
+
}, [props.value]);
|
|
401
|
+
const assetUploadCallback = (newAsset) => {
|
|
402
|
+
if (isDisabled) return;
|
|
403
|
+
let updated = [];
|
|
404
|
+
updated.push({
|
|
405
|
+
assetUrl: newAsset.assetUrl,
|
|
406
|
+
title: newAsset.title,
|
|
407
|
+
posterUrl: newAsset.posterUrl,
|
|
408
|
+
intrinsicHeight: newAsset.intrinsicHeight,
|
|
409
|
+
intrinsicWidth: newAsset.intrinsicWidth
|
|
410
|
+
});
|
|
411
|
+
props.callback?.({
|
|
412
|
+
name: props.name,
|
|
413
|
+
value: JSON.stringify(updated),
|
|
414
|
+
index: props.index,
|
|
415
|
+
groupKey: props.groupKey
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
const deleteFile = (index) => {
|
|
419
|
+
if (isDisabled) return;
|
|
420
|
+
let existingValue = [];
|
|
421
|
+
if (props.value) {
|
|
422
|
+
try {
|
|
423
|
+
existingValue = JSON.parse(props.value.toString());
|
|
424
|
+
} catch (error) {
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
if (existingValue.length > index) {
|
|
428
|
+
existingValue.splice(index, 1);
|
|
429
|
+
props.callback?.({
|
|
430
|
+
name: props.name,
|
|
431
|
+
value: JSON.stringify(existingValue),
|
|
432
|
+
index: props.index,
|
|
433
|
+
groupKey: props.groupKey
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const textChangeHandler = (index, event) => {
|
|
438
|
+
if (isDisabled) return;
|
|
439
|
+
let existingValue = [];
|
|
440
|
+
if (props.value) {
|
|
441
|
+
try {
|
|
442
|
+
existingValue = JSON.parse(props.value.toString());
|
|
443
|
+
} catch (error) {
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
const text = event.target.value;
|
|
447
|
+
if (existingValue.length > index) {
|
|
448
|
+
const updatedArray = [...existingValue];
|
|
449
|
+
updatedArray[index] = { ...updatedArray[index], title: text };
|
|
450
|
+
props.callback?.({
|
|
451
|
+
name: props.name,
|
|
452
|
+
value: JSON.stringify(updatedArray),
|
|
453
|
+
index: props.index,
|
|
454
|
+
groupKey: props.groupKey
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
const getAssetType = (asset) => {
|
|
459
|
+
if (asset.assetUrl?.endsWith(".m3u8") || asset.posterUrl) return "video";
|
|
460
|
+
return "image";
|
|
461
|
+
};
|
|
462
|
+
const shouldShowDetails = () => {
|
|
463
|
+
if (allValues.length === 0) return false;
|
|
464
|
+
const asset = allValues[0];
|
|
465
|
+
if (assetType === "video") {
|
|
466
|
+
return Boolean(asset.posterUrl && asset.assetUrl && asset.assetUrl.endsWith(".m3u8"));
|
|
467
|
+
}
|
|
468
|
+
if (assetType === "image") {
|
|
469
|
+
return Boolean(asset.assetUrl && !asset.assetUrl.endsWith(".m3u8"));
|
|
470
|
+
}
|
|
471
|
+
return false;
|
|
472
|
+
};
|
|
473
|
+
return /* @__PURE__ */ jsxs3(React3.Fragment, { children: [
|
|
474
|
+
/* @__PURE__ */ jsx3("label", { className: "block mb-1", children: /* @__PURE__ */ jsx3("span", { className: "text-sm font-medium", children: props?.attributes?.label }) }),
|
|
475
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex gap-6 bg-neutral-100 rounded p-2", children: [
|
|
476
|
+
/* @__PURE__ */ jsx3(
|
|
477
|
+
ClientButton_default,
|
|
478
|
+
{
|
|
479
|
+
className: assetType === "image" ? "px-2 py-1 rounded bg-body-200 scale-95" : "text-neutral-700",
|
|
480
|
+
ButtonType: "Link" /* Link */,
|
|
481
|
+
onClick: () => setAssetType("image"),
|
|
482
|
+
disabled: isDisabled,
|
|
483
|
+
children: "Image Upload"
|
|
484
|
+
}
|
|
485
|
+
),
|
|
486
|
+
/* @__PURE__ */ jsx3(
|
|
487
|
+
ClientButton_default,
|
|
488
|
+
{
|
|
489
|
+
className: assetType === "video" ? "bg-body-200 px-2 py-1 rounded-md scale-95" : "text-neutral-700",
|
|
490
|
+
ButtonType: "Link" /* Link */,
|
|
491
|
+
onClick: () => setAssetType("video"),
|
|
492
|
+
disabled: isDisabled,
|
|
493
|
+
children: "Video Upload"
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
] }),
|
|
497
|
+
shouldShowDetails() && /* @__PURE__ */ jsxs3("div", { className: "relative mt-4 rounded-md p-4 border-2 border-dotted border-gray-300 bg-gray-50", children: [
|
|
498
|
+
/* @__PURE__ */ jsx3("span", { className: "absolute -top-2.5 left-3 bg-primary-600 text-white text-xs px-2 py-0.5 rounded-full", children: getAssetType(allValues[0]) === "video" ? "Video" : "Image" }),
|
|
499
|
+
/* @__PURE__ */ jsx3("div", { className: "flex flex-col gap-3", children: allValues.map((digitalAsset, index) => /* @__PURE__ */ jsxs3("div", { className: "flex justify-between items-start gap-5", children: [
|
|
500
|
+
/* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-2 gap-x-8 gap-y-3 text-sm w-full", children: [
|
|
501
|
+
/* @__PURE__ */ jsxs3("div", { children: [
|
|
502
|
+
/* @__PURE__ */ jsx3("p", { className: "text-gray-500", children: "Title" }),
|
|
503
|
+
/* @__PURE__ */ jsx3(
|
|
504
|
+
"input",
|
|
505
|
+
{
|
|
506
|
+
type: "text",
|
|
507
|
+
value: digitalAsset.title,
|
|
508
|
+
onChange: (event) => textChangeHandler(index, event),
|
|
509
|
+
placeholder: "title",
|
|
510
|
+
disabled: isDisabled,
|
|
511
|
+
className: "w-full mt-1 py-1.5 block rounded border-gray-300 shadow-sm bg-white\n focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50\n disabled:bg-gray-100 disabled:text-gray-400 disabled:cursor-not-allowed"
|
|
512
|
+
}
|
|
513
|
+
)
|
|
514
|
+
] }),
|
|
515
|
+
digitalAsset.intrinsicWidth && digitalAsset.intrinsicHeight && /* @__PURE__ */ jsxs3("div", { children: [
|
|
516
|
+
/* @__PURE__ */ jsx3("p", { className: "text-gray-500", children: "Resolution" }),
|
|
517
|
+
/* @__PURE__ */ jsxs3("p", { className: "font-medium text-gray-900 mt-3", children: [
|
|
518
|
+
digitalAsset.intrinsicWidth,
|
|
519
|
+
"\xD7",
|
|
520
|
+
digitalAsset.intrinsicHeight
|
|
521
|
+
] })
|
|
522
|
+
] }),
|
|
523
|
+
(digitalAsset.assetUrl || digitalAsset.posterUrl) && /* @__PURE__ */ jsxs3("div", { children: [
|
|
524
|
+
/* @__PURE__ */ jsx3("p", { className: "text-gray-500", children: "Image / Poster" }),
|
|
525
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-shrink-0 flex flex-col gap-3 mt-1", children: [
|
|
526
|
+
getAssetType(digitalAsset) === "video" && digitalAsset.posterUrl && /* @__PURE__ */ jsx3(
|
|
527
|
+
"img",
|
|
528
|
+
{
|
|
529
|
+
src: AssetUtility_default.resolveUrl(props.serviceClient?.baseUrl, digitalAsset.posterUrl),
|
|
530
|
+
alt: digitalAsset.title || "Video poster",
|
|
531
|
+
className: "w-32 h-auto object-cover rounded border p-1"
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
getAssetType(digitalAsset) === "image" && digitalAsset.assetUrl && /* @__PURE__ */ jsx3(
|
|
535
|
+
"img",
|
|
536
|
+
{
|
|
537
|
+
src: AssetUtility_default.resolveUrl(props.serviceClient?.baseUrl, digitalAsset.assetUrl),
|
|
538
|
+
alt: digitalAsset.title || "Uploaded image",
|
|
539
|
+
className: "w-32 h-auto object-cover rounded border p-1"
|
|
540
|
+
}
|
|
541
|
+
)
|
|
542
|
+
] })
|
|
543
|
+
] }),
|
|
544
|
+
digitalAsset.assetUrl?.endsWith(".m3u8") && /* @__PURE__ */ jsxs3("div", { className: "col-span-2", children: [
|
|
545
|
+
/* @__PURE__ */ jsx3("p", { className: "text-gray-500", children: "HLS Link" }),
|
|
546
|
+
/* @__PURE__ */ jsx3(
|
|
547
|
+
Hyperlink,
|
|
548
|
+
{
|
|
549
|
+
href: digitalAsset.assetUrl,
|
|
550
|
+
className: "text-primary-600 underline mt-1 break-all",
|
|
551
|
+
title: digitalAsset.assetUrl,
|
|
552
|
+
children: digitalAsset.assetUrl
|
|
553
|
+
}
|
|
554
|
+
)
|
|
555
|
+
] })
|
|
556
|
+
] }),
|
|
557
|
+
/* @__PURE__ */ jsx3(
|
|
558
|
+
"span",
|
|
559
|
+
{
|
|
560
|
+
onClick: () => !isDisabled && deleteFile(index),
|
|
561
|
+
className: isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
562
|
+
children: /* @__PURE__ */ jsx3(Icon_default, { className: "w-4 h-4 text-primary", name: "delete" })
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
] }, index)) })
|
|
566
|
+
] })
|
|
567
|
+
] });
|
|
568
|
+
};
|
|
569
|
+
var AssetUpload_default = AssetUpload;
|
|
570
|
+
|
|
571
|
+
// src/components/controls/edit/InputControlClient.tsx
|
|
572
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
573
|
+
var InputControl = React4.forwardRef(
|
|
574
|
+
(props, ref) => {
|
|
575
|
+
const ControlComponents = {
|
|
576
|
+
[InputControlType_default.lineTextInput]: LineTextInput_default,
|
|
577
|
+
[InputControlType_default.emailInput]: EmailInput_default,
|
|
578
|
+
[InputControlType_default.multilineTextInput]: MultilineTextInput_default,
|
|
579
|
+
[InputControlType_default.moneyInput]: MoneyInput_default,
|
|
580
|
+
[InputControlType_default.select]: Select_default,
|
|
581
|
+
[InputControlType_default.percentageInput]: PercentageInput_default,
|
|
582
|
+
[InputControlType_default.phoneInput]: PhoneInput_default,
|
|
583
|
+
[InputControlType_default.numberInput]: NumberInput_default,
|
|
584
|
+
[InputControlType_default.checkboxInput]: CheckboxInput_default,
|
|
585
|
+
[InputControlType_default.otpInput]: OtpInput_default,
|
|
586
|
+
[InputControlType_default.datetimeInput]: DateTimeInput_default,
|
|
587
|
+
[InputControlType_default.colorInput]: ColorInput_default,
|
|
588
|
+
[InputControlType_default.selectWithSearchInput]: SelectWithSearchInput_default,
|
|
589
|
+
[InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
|
|
590
|
+
[InputControlType_default.booleanSelect]: BooleanSelect_default,
|
|
591
|
+
[InputControlType_default.timeInput]: TimeInput_default,
|
|
592
|
+
[InputControlType_default.asset]: AssetUpload_default
|
|
593
|
+
};
|
|
594
|
+
const SelectedControlComponent = ControlComponents[props.controlType];
|
|
595
|
+
return /* @__PURE__ */ jsx4(React4.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx4(SelectedControlComponent, { ...props }) : "Control not found" });
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
InputControl.displayName = "InputControl";
|
|
599
|
+
var InputControlClient_default = InputControl;
|
|
600
|
+
export {
|
|
601
|
+
InputControlClient_default as default
|
|
602
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
ServiceClient_default
|
|
4
|
+
} from "./chunk-3GWLDT7C.mjs";
|
|
5
|
+
import {
|
|
6
|
+
Button_default
|
|
7
|
+
} from "./chunk-IKIXEQPV.mjs";
|
|
8
|
+
import "./chunk-56HSDML5.mjs";
|
|
7
9
|
|
|
8
10
|
// src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
|
|
9
11
|
import { useCallback, useState } from "react";
|
|
@@ -88,7 +90,6 @@ var LinkNodeButton = (props) => {
|
|
|
88
90
|
console.log("API Response:", response);
|
|
89
91
|
if (response && !response.isSuccessful) {
|
|
90
92
|
const errorMessage = response.message || "API request failed";
|
|
91
|
-
ToastService_default.showError(errorMessage);
|
|
92
93
|
setError(errorMessage);
|
|
93
94
|
setIsLoading(false);
|
|
94
95
|
return { isSuccessful: false, message: errorMessage };
|