@acoustte-digital-services/digitalstore-controls-dev 0.8.1 → 0.8.2-dev.20260324084945
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +79 -5
- package/dist/index.d.ts +79 -5
- package/dist/index.js +2984 -147
- package/dist/index.mjs +2980 -146
- package/package.json +58 -7
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
"use strict";
|
|
2
4
|
var __create = Object.create;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
@@ -30,13 +32,35 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
32
|
// src/index.ts
|
|
31
33
|
var index_exports = {};
|
|
32
34
|
__export(index_exports, {
|
|
35
|
+
DataList: () => DataList_default,
|
|
33
36
|
InputControl: () => InputControl_default,
|
|
34
37
|
InputControlType: () => InputControlType_default,
|
|
38
|
+
PageBodyRenderer: () => PageBodyRenderer_default,
|
|
35
39
|
ViewControl: () => ViewControl_default,
|
|
36
|
-
ViewControlTypes: () => ViewControlTypes_default
|
|
40
|
+
ViewControlTypes: () => ViewControlTypes_default,
|
|
41
|
+
getWidget: () => getWidget,
|
|
42
|
+
registerWidgets: () => registerWidgets
|
|
37
43
|
});
|
|
38
44
|
module.exports = __toCommonJS(index_exports);
|
|
39
45
|
|
|
46
|
+
// src/components/pageRenderingEngine/nodes/WidgetRegistry.tsx
|
|
47
|
+
var GLOBAL_KEY = "__DIGITALSTORE_WIDGET_REGISTRY__";
|
|
48
|
+
var getRegistry = () => {
|
|
49
|
+
const globalAny = globalThis;
|
|
50
|
+
if (!globalAny[GLOBAL_KEY]) {
|
|
51
|
+
globalAny[GLOBAL_KEY] = {};
|
|
52
|
+
}
|
|
53
|
+
return globalAny[GLOBAL_KEY];
|
|
54
|
+
};
|
|
55
|
+
var registerWidgets = (widgets) => {
|
|
56
|
+
const registry = getRegistry();
|
|
57
|
+
Object.assign(registry, widgets);
|
|
58
|
+
};
|
|
59
|
+
var getWidget = (code) => {
|
|
60
|
+
const registry = getRegistry();
|
|
61
|
+
return registry[code];
|
|
62
|
+
};
|
|
63
|
+
|
|
40
64
|
// src/components/controls/view/ViewControl.tsx
|
|
41
65
|
var import_react11 = __toESM(require("react"));
|
|
42
66
|
|
|
@@ -75,6 +99,8 @@ var DateView = (props) => {
|
|
|
75
99
|
let timezone;
|
|
76
100
|
try {
|
|
77
101
|
const val = props.value && props.value.toString().includes("Z") ? props.value : props.value + "Z";
|
|
102
|
+
{
|
|
103
|
+
}
|
|
78
104
|
const parsedDate = new Date(val);
|
|
79
105
|
const timezoneOffset = parsedDate.getTimezoneOffset();
|
|
80
106
|
timezone = import_moment_timezone.default.tz.zone(import_moment_timezone.default.tz.guess())?.abbr(timezoneOffset);
|
|
@@ -192,6 +218,8 @@ var StatusView_default = Status;
|
|
|
192
218
|
var import_react8 = __toESM(require("react"));
|
|
193
219
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
194
220
|
var Money = (props) => {
|
|
221
|
+
{
|
|
222
|
+
}
|
|
195
223
|
const parsedNumber = parseFloat(props.value);
|
|
196
224
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react8.default.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: parsedNumber < 0 ? "text-alert" : "", children: [
|
|
197
225
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "mr-0.5", children: "\u20B9" }),
|
|
@@ -204,6 +232,8 @@ var MoneyView_default = Money;
|
|
|
204
232
|
var import_react9 = __toESM(require("react"));
|
|
205
233
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
206
234
|
var MultilineTextBullets = (props) => {
|
|
235
|
+
{
|
|
236
|
+
}
|
|
207
237
|
const lines = props.value?.split("\\n");
|
|
208
238
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react9.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "list-disc", children: lines && lines.map((line, index) => {
|
|
209
239
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("li", { children: line }, index);
|
|
@@ -236,7 +266,7 @@ var ViewControl = import_react11.default.forwardRef(
|
|
|
236
266
|
[ViewControlTypes_default.booleanView]: BooleanView_default
|
|
237
267
|
// [ViewControlTypes.booleanView]: BooleanView
|
|
238
268
|
};
|
|
239
|
-
const SelectedControlComponent = ControlComponents[props.controlType];
|
|
269
|
+
const SelectedControlComponent = props.controlType ? ControlComponents[props.controlType] : void 0;
|
|
240
270
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react11.default.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SelectedControlComponent, { ...props }) : "Control not found" });
|
|
241
271
|
}
|
|
242
272
|
);
|
|
@@ -406,6 +436,9 @@ var MoneyInput = (props) => {
|
|
|
406
436
|
var MoneyInput_default = MoneyInput;
|
|
407
437
|
|
|
408
438
|
// src/components/controls/edit/InputControlType.tsx
|
|
439
|
+
var Constants = {
|
|
440
|
+
pagesize: 10
|
|
441
|
+
};
|
|
409
442
|
var InputControlType = {
|
|
410
443
|
lineTextInput: "text",
|
|
411
444
|
multilineTextInput: "multilinetext",
|
|
@@ -947,6 +980,7 @@ var ColorInput = (props) => {
|
|
|
947
980
|
{
|
|
948
981
|
type: "color",
|
|
949
982
|
name: props.name,
|
|
983
|
+
title: color,
|
|
950
984
|
id: props.name,
|
|
951
985
|
value: color,
|
|
952
986
|
onChange: handleColorChange,
|
|
@@ -1133,53 +1167,28 @@ var ToastService_default = ToastService;
|
|
|
1133
1167
|
|
|
1134
1168
|
// src/components/StyleTypes.tsx
|
|
1135
1169
|
var buttonClasses = /* @__PURE__ */ new Map([
|
|
1136
|
-
[
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
],
|
|
1140
|
-
[
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
],
|
|
1144
|
-
[
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
],
|
|
1148
|
-
[
|
|
1149
|
-
"PrimaryHollow" /* PrimaryHollow */,
|
|
1150
|
-
"inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-primary border text-primary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"
|
|
1151
|
-
],
|
|
1152
|
-
[
|
|
1153
|
-
"SecondaryHollow" /* SecondaryHollow */,
|
|
1154
|
-
"inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-secondary border text-secondary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"
|
|
1155
|
-
],
|
|
1156
|
-
[
|
|
1157
|
-
"NeutralHollow" /* NeutralHollow */,
|
|
1158
|
-
"inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-neutral border text-neutral rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"
|
|
1159
|
-
],
|
|
1160
|
-
[
|
|
1161
|
-
"Ripple" /* Ripple */,
|
|
1162
|
-
"px-3 py-1.5 inline-flex items-center text-sm font-medium rounded border-[1.5px] border-primary ripple btn-bg-primary btn-primary-text"
|
|
1163
|
-
],
|
|
1164
|
-
[
|
|
1165
|
-
"Danger" /* Danger */,
|
|
1166
|
-
"inline-flex text-sm font-medium items-center justify-center px-4 py-2 border border-alert bg-alert text-white rounded hover:bg-alert-600 hover:border-alert-600 focus:outline-none active:ring-1 active:ring-alert"
|
|
1167
|
-
],
|
|
1168
|
-
["Link" /* Link */, ""],
|
|
1169
|
-
[
|
|
1170
|
-
"Light" /* Light */,
|
|
1171
|
-
"inline-flex items-center justify-center rounded bg-white border px-4 py-2 leading-6 text-primary shadow-sm hover:shadow focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1172
|
-
]
|
|
1170
|
+
["Primary" /* Solid */, "btn-solid"],
|
|
1171
|
+
["PrimaryHollow" /* Hollow */, "btn-hollow"],
|
|
1172
|
+
["Link" /* Link */, "btn-link"]
|
|
1173
|
+
// [StyleTypes.Solid, "relative inline-flex items-center justify-center bg-gradient-to-b from-secondary to-secondary-strong rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-body hover:bg-secondary-strong"],
|
|
1174
|
+
// [StyleTypes.Solid, "relative inline-flex items-center justify-center bg-neutral-strong rounded px-4 py-3 lg:py-2 font-medium shadow-sm hover:shadow-lg focus:outline-none active:scale-95 disabled:opacity-50 disabled:cursor-not-allowed transition duration-150 ease-in-out text-body hover:bg-neutral-stronger"],
|
|
1175
|
+
// [StyleTypes.Hollow, "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-primary border text-primary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"],
|
|
1176
|
+
// [StyleTypes.Hollow, "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-secondary border text-secondary rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"],
|
|
1177
|
+
// [StyleTypes.Hollow, "inline-flex font-medium items-center justify-center px-4 py-3 lg:py-2 transparent border-neutral border text-neutral rounded hover:shadow-md focus:outline-none transition duration-150 ease-in-out active:scale-95"],
|
|
1178
|
+
// [StyleTypes.Ripple, "px-3 py-1.5 inline-flex items-center text-sm font-medium rounded border-[1.5px] border-primary ripple btn-bg-primary btn-primary-text"],
|
|
1179
|
+
// [StyleTypes.Danger, "inline-flex text-sm font-medium items-center justify-center px-4 py-2 border border-alert bg-alert text-white rounded hover:bg-alert-600 hover:border-alert-600 focus:outline-none active:ring-1 active:ring-alert"],
|
|
1180
|
+
// [StyleTypes.Link, ""],
|
|
1181
|
+
// [StyleTypes.Light, "inline-flex items-center justify-center rounded bg-white border px-4 py-2 leading-6 text-primary shadow-sm hover:shadow focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:opacity-50 disabled:cursor-not-allowed"],
|
|
1173
1182
|
]);
|
|
1174
1183
|
var progressClasses = /* @__PURE__ */ new Map([
|
|
1175
|
-
["Primary" /*
|
|
1176
|
-
["PrimaryHollow" /*
|
|
1177
|
-
[
|
|
1178
|
-
[
|
|
1179
|
-
[
|
|
1180
|
-
[
|
|
1181
|
-
[
|
|
1182
|
-
[
|
|
1184
|
+
["Primary" /* Solid */, ""],
|
|
1185
|
+
["PrimaryHollow" /* Hollow */, ""],
|
|
1186
|
+
// [StyleTypes.Solid, ""],
|
|
1187
|
+
// [StyleTypes.Hollow, ""],
|
|
1188
|
+
// [StyleTypes.Solid, ""],
|
|
1189
|
+
// [StyleTypes.Hollow, ""],
|
|
1190
|
+
// [StyleTypes.Ripple, ""],
|
|
1191
|
+
// [StyleTypes.Danger, ""],
|
|
1183
1192
|
["Link" /* Link */, ""]
|
|
1184
1193
|
]);
|
|
1185
1194
|
|
|
@@ -1188,56 +1197,21 @@ var import_react25 = require("react");
|
|
|
1188
1197
|
|
|
1189
1198
|
// src/components/ClientButton.tsx
|
|
1190
1199
|
var import_react24 = __toESM(require("react"));
|
|
1191
|
-
|
|
1192
|
-
// src/components/utilities/ToastService.tsx
|
|
1193
|
-
var ToastService2 = class {
|
|
1194
|
-
static showError(message) {
|
|
1195
|
-
console.error(message);
|
|
1196
|
-
if (typeof window !== "undefined") {
|
|
1197
|
-
alert(message);
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
static showSuccess(message) {
|
|
1201
|
-
console.log(message);
|
|
1202
|
-
if (typeof window !== "undefined") {
|
|
1203
|
-
alert(message);
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
static showWarning(message) {
|
|
1207
|
-
console.warn(message);
|
|
1208
|
-
if (typeof window !== "undefined") {
|
|
1209
|
-
alert(message);
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
static showInfo(message) {
|
|
1213
|
-
console.info(message);
|
|
1214
|
-
if (typeof window !== "undefined") {
|
|
1215
|
-
alert(message);
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
};
|
|
1219
|
-
var ToastService_default2 = ToastService2;
|
|
1220
|
-
|
|
1221
|
-
// src/components/ClientButton.tsx
|
|
1222
1200
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1223
1201
|
var ClientButton = (props) => {
|
|
1224
1202
|
const execute = async (event) => {
|
|
1225
|
-
event.preventDefault();
|
|
1226
1203
|
if (props.onClick !== void 0) {
|
|
1227
1204
|
props.onClick();
|
|
1228
1205
|
} else {
|
|
1229
|
-
|
|
1206
|
+
ToastService_default.showError("No action defined.");
|
|
1230
1207
|
}
|
|
1231
1208
|
};
|
|
1232
|
-
let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /*
|
|
1209
|
+
let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
|
|
1233
1210
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react24.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1234
1211
|
"button",
|
|
1235
1212
|
{
|
|
1236
1213
|
type: "button",
|
|
1237
1214
|
onClick: execute,
|
|
1238
|
-
"data-role": props.dataRole,
|
|
1239
|
-
disabled: props.disabled,
|
|
1240
|
-
tabIndex: props.tabIndex,
|
|
1241
1215
|
className: buttonClass + " " + props.className,
|
|
1242
1216
|
children: props.children
|
|
1243
1217
|
}
|
|
@@ -1261,21 +1235,27 @@ var Confirm = ({ message, onConfirm, onCancel }) => {
|
|
|
1261
1235
|
onCancel();
|
|
1262
1236
|
}
|
|
1263
1237
|
};
|
|
1264
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: showModal && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fixed inset-0 flex items-center justify-center z-
|
|
1238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: showModal && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fixed inset-0 flex items-center justify-center z-50", children: [
|
|
1265
1239
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute inset-0 bg-black opacity-70" }),
|
|
1266
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "bg-white rounded-md p-6 shadow border z-50", children: [
|
|
1267
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xl font-
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "bg-white rounded-md p-6 w-2/6 shadow border z-50", children: [
|
|
1241
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xl font-medium mb-4", children: "Confirmation" }),
|
|
1268
1242
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "mb-4", children: message }),
|
|
1269
1243
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-end gap-8", children: [
|
|
1270
1244
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1271
1245
|
ClientButton_default,
|
|
1272
1246
|
{
|
|
1273
1247
|
onClick: handleCancelAction,
|
|
1274
|
-
ButtonType: "PrimaryHollow" /*
|
|
1248
|
+
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
1275
1249
|
children: "Cancel"
|
|
1276
1250
|
}
|
|
1277
1251
|
),
|
|
1278
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1253
|
+
ClientButton_default,
|
|
1254
|
+
{
|
|
1255
|
+
onClick: handleConfirmAction,
|
|
1256
|
+
children: "Confirm"
|
|
1257
|
+
}
|
|
1258
|
+
)
|
|
1279
1259
|
] })
|
|
1280
1260
|
] })
|
|
1281
1261
|
] }) });
|
|
@@ -1293,10 +1273,9 @@ var Button = (props) => {
|
|
|
1293
1273
|
const [showModal, setShowModal] = (0, import_react26.useState)(null);
|
|
1294
1274
|
const execute = async (event) => {
|
|
1295
1275
|
event.preventDefault();
|
|
1276
|
+
event.stopPropagation();
|
|
1296
1277
|
if (props.confirm) {
|
|
1297
|
-
const confirmed = await showConfirmation(
|
|
1298
|
-
"Are you sure you want to delete this item?"
|
|
1299
|
-
);
|
|
1278
|
+
const confirmed = await showConfirmation("Are you sure you want to delete this item?");
|
|
1300
1279
|
setShowModal(null);
|
|
1301
1280
|
if (!confirmed) {
|
|
1302
1281
|
return;
|
|
@@ -1311,15 +1290,12 @@ var Button = (props) => {
|
|
|
1311
1290
|
isValid = await props.onValidate();
|
|
1312
1291
|
if (!isValid) {
|
|
1313
1292
|
setInProgress(false);
|
|
1314
|
-
ToastService_default.showError(
|
|
1315
|
-
"There are error in the form. Please fix them before proceeding."
|
|
1316
|
-
);
|
|
1293
|
+
ToastService_default.showError("There are errors in the form. Please fix them before proceeding.");
|
|
1317
1294
|
return;
|
|
1318
1295
|
}
|
|
1319
1296
|
}
|
|
1320
1297
|
if (props.onClick !== void 0) {
|
|
1321
|
-
let response = await props.onClick(
|
|
1322
|
-
console.log(response);
|
|
1298
|
+
let response = await props.onClick();
|
|
1323
1299
|
if (response.isSuccessful) {
|
|
1324
1300
|
setIsActionPerformed(true);
|
|
1325
1301
|
setResponseMessage(response.message);
|
|
@@ -1338,61 +1314,27 @@ var Button = (props) => {
|
|
|
1338
1314
|
return new Promise((resolve) => {
|
|
1339
1315
|
const onConfirm = () => resolve(true);
|
|
1340
1316
|
const onCancel = () => resolve(false);
|
|
1341
|
-
setShowModal(
|
|
1342
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1343
|
-
Confirm_default,
|
|
1344
|
-
{
|
|
1345
|
-
message: props.confirmationMessage,
|
|
1346
|
-
onConfirm,
|
|
1347
|
-
onCancel
|
|
1348
|
-
}
|
|
1349
|
-
)
|
|
1350
|
-
);
|
|
1317
|
+
setShowModal(/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Confirm_default, { message: props.confirmationMessage, onConfirm, onCancel }));
|
|
1351
1318
|
});
|
|
1352
1319
|
};
|
|
1353
|
-
let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /*
|
|
1354
|
-
let progressClass = props.ButtonType ? progressClasses.get(props.ButtonType) : progressClasses.get("Primary" /*
|
|
1320
|
+
let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
|
|
1321
|
+
let progressClass = props.ButtonType ? progressClasses.get(props.ButtonType) : progressClasses.get("Primary" /* Solid */);
|
|
1322
|
+
const isDisabled = inProgress || isActionPerformed && props.oneTimeAction;
|
|
1355
1323
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_react26.default.Fragment, { children: [
|
|
1356
1324
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1357
1325
|
"button",
|
|
1358
1326
|
{
|
|
1359
1327
|
type: "submit",
|
|
1360
1328
|
onClick: execute,
|
|
1361
|
-
id: props.id,
|
|
1362
1329
|
disabled: props.disabled,
|
|
1363
|
-
|
|
1330
|
+
title: isDisabled ? "The button is disabled to prevent any action" : "",
|
|
1331
|
+
className: buttonClass + " relative " + props.className,
|
|
1364
1332
|
children: [
|
|
1365
1333
|
isActionPerformed && props.oneTimeAction && responseMessage ? responseMessage : props.children,
|
|
1366
|
-
inProgress && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react26.default.Fragment, { children: props.hideProgressIndicator === true ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1367
|
-
"
|
|
1368
|
-
{
|
|
1369
|
-
|
|
1370
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1371
|
-
fill: "none",
|
|
1372
|
-
viewBox: "0 0 24 24",
|
|
1373
|
-
children: [
|
|
1374
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1375
|
-
"circle",
|
|
1376
|
-
{
|
|
1377
|
-
className: "opacity-25",
|
|
1378
|
-
cx: "12",
|
|
1379
|
-
cy: "12",
|
|
1380
|
-
r: "10",
|
|
1381
|
-
stroke: "currentColor",
|
|
1382
|
-
strokeWidth: "4"
|
|
1383
|
-
}
|
|
1384
|
-
),
|
|
1385
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1386
|
-
"path",
|
|
1387
|
-
{
|
|
1388
|
-
className: "opacity-75",
|
|
1389
|
-
fill: "currentColor",
|
|
1390
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
1391
|
-
}
|
|
1392
|
-
)
|
|
1393
|
-
]
|
|
1394
|
-
}
|
|
1395
|
-
) })
|
|
1334
|
+
inProgress && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react26.default.Fragment, { children: props.hideProgressIndicator === true ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("svg", { className: "animate-spin ml-2 mr-3 h-5 w-5 " + progressClass, xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
1335
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
1336
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
|
|
1337
|
+
] }) })
|
|
1396
1338
|
]
|
|
1397
1339
|
}
|
|
1398
1340
|
),
|
|
@@ -1414,7 +1356,7 @@ var SelectWithSearchPanel = (props) => {
|
|
|
1414
1356
|
const containerRef = (0, import_react27.useRef)(null);
|
|
1415
1357
|
const [isCreateOpen, setIsCreateOpen] = (0, import_react27.useState)(false);
|
|
1416
1358
|
const [formData, setFormData] = (0, import_react27.useState)({});
|
|
1417
|
-
const
|
|
1359
|
+
const getNestedValue2 = (obj, path) => {
|
|
1418
1360
|
return path.split(".").reduce((acc, key) => acc?.[key], obj);
|
|
1419
1361
|
};
|
|
1420
1362
|
(0, import_react27.useEffect)(() => {
|
|
@@ -1452,7 +1394,7 @@ var SelectWithSearchPanel = (props) => {
|
|
|
1452
1394
|
props.dataSourceDependsOn
|
|
1453
1395
|
]);
|
|
1454
1396
|
const filteredItems = list?.filter((item) => {
|
|
1455
|
-
const value =
|
|
1397
|
+
const value = getNestedValue2(item, props.dataTextFieldName);
|
|
1456
1398
|
return value?.toLowerCase().includes(searchTerm?.toLowerCase());
|
|
1457
1399
|
});
|
|
1458
1400
|
const playBeep = () => {
|
|
@@ -1483,7 +1425,7 @@ var SelectWithSearchPanel = (props) => {
|
|
|
1483
1425
|
}, [searchTerm]);
|
|
1484
1426
|
const handleSelect = (event, item) => {
|
|
1485
1427
|
event.preventDefault();
|
|
1486
|
-
setSearchTerm(
|
|
1428
|
+
setSearchTerm(getNestedValue2(item, props.dataTextFieldName));
|
|
1487
1429
|
if (props.callback) {
|
|
1488
1430
|
const val = {};
|
|
1489
1431
|
props.callback({
|
|
@@ -1608,7 +1550,10 @@ var SelectWithSearchPanel = (props) => {
|
|
|
1608
1550
|
}
|
|
1609
1551
|
)
|
|
1610
1552
|
] }, field.name)),
|
|
1611
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button_default, { onClick:
|
|
1553
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button_default, { onClick: async () => {
|
|
1554
|
+
handleSaveModal();
|
|
1555
|
+
return { isSuccessful: true };
|
|
1556
|
+
}, className: "w-full", children: [
|
|
1612
1557
|
"Save ",
|
|
1613
1558
|
props.attributes?.label
|
|
1614
1559
|
] })
|
|
@@ -1630,7 +1575,7 @@ var SelectWithSearchPanel = (props) => {
|
|
|
1630
1575
|
role: "option",
|
|
1631
1576
|
tabIndex: -1,
|
|
1632
1577
|
onMouseEnter: () => setHighlightedIndex(index),
|
|
1633
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children:
|
|
1578
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: getNestedValue2(item, props.dataTextFieldName) })
|
|
1634
1579
|
}
|
|
1635
1580
|
) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
|
|
1636
1581
|
}
|
|
@@ -1843,10 +1788,2902 @@ var InputControl = import_react31.default.forwardRef(
|
|
|
1843
1788
|
);
|
|
1844
1789
|
InputControl.displayName = "InputControl";
|
|
1845
1790
|
var InputControl_default = InputControl;
|
|
1791
|
+
|
|
1792
|
+
// src/components/dataForm/DataList.tsx
|
|
1793
|
+
var import_react34 = __toESM(require("react"));
|
|
1794
|
+
var import_navigation = require("next/navigation");
|
|
1795
|
+
|
|
1796
|
+
// src/components/dataForm/NoContentView.tsx
|
|
1797
|
+
var import_react32 = __toESM(require("react"));
|
|
1798
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1799
|
+
var NoContentView = (props) => {
|
|
1800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react32.default.Fragment, { children: props.isDataFound === false && props.children });
|
|
1801
|
+
};
|
|
1802
|
+
var NoContentView_default = NoContentView;
|
|
1803
|
+
|
|
1804
|
+
// src/components/dataForm/ContentView.tsx
|
|
1805
|
+
var import_react33 = __toESM(require("react"));
|
|
1806
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1807
|
+
var ContentView = (props) => {
|
|
1808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react33.default.Fragment, { children: [
|
|
1809
|
+
props.isDataFound == null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "bg-gray-200 rounded-md p-4 animate-pulse", children: [
|
|
1810
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center mb-4", children: [
|
|
1811
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "ml-2", children: [
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
|
|
1815
|
+
] })
|
|
1816
|
+
] }),
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "animate-pulse", children: [
|
|
1819
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
1820
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
1821
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
1824
|
+
] }),
|
|
1825
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "animate-pulse", children: [
|
|
1826
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
1827
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
1828
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
1831
|
+
] }),
|
|
1832
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "animate-pulse", children: [
|
|
1833
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
1834
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
1836
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
1837
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
1838
|
+
] })
|
|
1839
|
+
] })
|
|
1840
|
+
] }) }),
|
|
1841
|
+
props.isDataFound === true && props.children
|
|
1842
|
+
] });
|
|
1843
|
+
};
|
|
1844
|
+
var ContentView_default = ContentView;
|
|
1845
|
+
|
|
1846
|
+
// src/components/dataForm/Hyperlink.tsx
|
|
1847
|
+
var import_link = __toESM(require("next/link"));
|
|
1848
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1849
|
+
function Hyperlink(props) {
|
|
1850
|
+
let linkClass = props.linkType ? buttonClasses.get(props.linkType) : "";
|
|
1851
|
+
const target = props?.href?.startsWith("http") ? "_blank" : "_self";
|
|
1852
|
+
const additionalProps = {};
|
|
1853
|
+
if (target == "_blank") {
|
|
1854
|
+
additionalProps.rel = "noopener noreferrer";
|
|
1855
|
+
}
|
|
1856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: props.href ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1857
|
+
import_link.default,
|
|
1858
|
+
{
|
|
1859
|
+
href: props.href,
|
|
1860
|
+
prefetch: false,
|
|
1861
|
+
className: `${linkClass} ${props.className ?? ""}`,
|
|
1862
|
+
...additionalProps,
|
|
1863
|
+
target,
|
|
1864
|
+
children: props.children
|
|
1865
|
+
}
|
|
1866
|
+
) : props.isHeading ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h5", { className: props.className + "inline-block", children: props.children }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: props.className, children: props.children }) });
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
// src/clients/OdataBuilder.tsx
|
|
1870
|
+
var OdataBuilder = class {
|
|
1871
|
+
constructor(url) {
|
|
1872
|
+
this.baseUrl = url;
|
|
1873
|
+
this.top = Constants.pagesize.toString();
|
|
1874
|
+
this.skip = "0";
|
|
1875
|
+
this.keyword = "";
|
|
1876
|
+
this.filterBy = "";
|
|
1877
|
+
this.orderBy = "";
|
|
1878
|
+
}
|
|
1879
|
+
// parseSearchParams(ReadonlyUrlSearchParams): DataQuery {
|
|
1880
|
+
// this.top = top;
|
|
1881
|
+
// return this;
|
|
1882
|
+
// }
|
|
1883
|
+
setQuery(odata) {
|
|
1884
|
+
if (odata) {
|
|
1885
|
+
for (const key in odata) {
|
|
1886
|
+
if (odata[key] != null && odata[key] != "") {
|
|
1887
|
+
if (key == "$skip") {
|
|
1888
|
+
this.setSkip(odata[key]);
|
|
1889
|
+
}
|
|
1890
|
+
if (key == "$filter") {
|
|
1891
|
+
this.setFilter(odata[key]);
|
|
1892
|
+
}
|
|
1893
|
+
if (key == "$top") {
|
|
1894
|
+
this.setTop(odata[key]);
|
|
1895
|
+
}
|
|
1896
|
+
if (key == "$orderby") {
|
|
1897
|
+
this.setOrderBy(odata[key]);
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
return this;
|
|
1903
|
+
}
|
|
1904
|
+
// parseKeyValuePairs(inputString: string): { [key: string]: string } {
|
|
1905
|
+
// return inputString.split('$')
|
|
1906
|
+
// .map((pair) => pair.split('='))
|
|
1907
|
+
// .reduce((result: { [key: string]: string }, [key, value]) => {
|
|
1908
|
+
// if (key && value) {
|
|
1909
|
+
// result[key.trim()] = value.trim();
|
|
1910
|
+
// }
|
|
1911
|
+
// return result;
|
|
1912
|
+
// }, {});
|
|
1913
|
+
// }
|
|
1914
|
+
static getOdataQueryString(obj, defaultOrder) {
|
|
1915
|
+
let queryString = "";
|
|
1916
|
+
let skip = (obj && obj["$skip"]) ?? "0";
|
|
1917
|
+
let top = (obj && obj["$top"]) ?? Constants.pagesize.toString();
|
|
1918
|
+
queryString = `$skip=${skip}&$top=${top}&$count=true`;
|
|
1919
|
+
if (obj) {
|
|
1920
|
+
if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
|
|
1921
|
+
queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
|
|
1922
|
+
}
|
|
1923
|
+
if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
|
|
1924
|
+
queryString = queryString + `&$orderby=${encodeURIComponent(obj["$orderby"])}`;
|
|
1925
|
+
} else if (defaultOrder) {
|
|
1926
|
+
queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
|
|
1927
|
+
}
|
|
1928
|
+
} else {
|
|
1929
|
+
if (defaultOrder) {
|
|
1930
|
+
queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
return queryString;
|
|
1934
|
+
}
|
|
1935
|
+
setTop(top) {
|
|
1936
|
+
this.top = top;
|
|
1937
|
+
return this;
|
|
1938
|
+
}
|
|
1939
|
+
setSkip(skip) {
|
|
1940
|
+
this.skip = skip;
|
|
1941
|
+
return this;
|
|
1942
|
+
}
|
|
1943
|
+
setKeyword(keyword) {
|
|
1944
|
+
this.keyword = keyword;
|
|
1945
|
+
return this;
|
|
1946
|
+
}
|
|
1947
|
+
setFilter(filterBy) {
|
|
1948
|
+
this.filterBy = filterBy;
|
|
1949
|
+
return this;
|
|
1950
|
+
}
|
|
1951
|
+
setOrderBy(orderBy) {
|
|
1952
|
+
this.orderBy = orderBy;
|
|
1953
|
+
return this;
|
|
1954
|
+
}
|
|
1955
|
+
getPageNumber(pageSize) {
|
|
1956
|
+
let pageNumber = 1;
|
|
1957
|
+
if (this.skip && this.top) {
|
|
1958
|
+
const skip = parseInt(this.skip);
|
|
1959
|
+
const top = parseInt(this.top);
|
|
1960
|
+
if (!isNaN(skip) && !isNaN(top)) {
|
|
1961
|
+
pageNumber = skip / pageSize + 1;
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
return pageNumber;
|
|
1965
|
+
}
|
|
1966
|
+
getUrl() {
|
|
1967
|
+
let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
|
|
1968
|
+
if (this.filterBy !== null && this.filterBy !== "") {
|
|
1969
|
+
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
1970
|
+
}
|
|
1971
|
+
if (this.orderBy !== null && this.orderBy !== "") {
|
|
1972
|
+
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
1973
|
+
}
|
|
1974
|
+
console.log(url);
|
|
1975
|
+
return url;
|
|
1976
|
+
}
|
|
1977
|
+
getNewOrderByUrl(orderBy) {
|
|
1978
|
+
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
1979
|
+
if (this.filterBy !== null && this.filterBy !== "") {
|
|
1980
|
+
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
1981
|
+
}
|
|
1982
|
+
url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
|
|
1983
|
+
return url;
|
|
1984
|
+
}
|
|
1985
|
+
getNewFilterUrl(filterBy) {
|
|
1986
|
+
let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
|
|
1987
|
+
if (filterBy !== null && filterBy !== "") {
|
|
1988
|
+
url = url + `&$filter=${encodeURIComponent(filterBy)}`;
|
|
1989
|
+
}
|
|
1990
|
+
if (this.orderBy !== null && this.orderBy !== "") {
|
|
1991
|
+
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
1992
|
+
}
|
|
1993
|
+
return url;
|
|
1994
|
+
}
|
|
1995
|
+
getNewPageUrl(page) {
|
|
1996
|
+
let skip = page * Constants.pagesize - Constants.pagesize;
|
|
1997
|
+
let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
|
|
1998
|
+
if (this.filterBy !== null && this.filterBy !== "") {
|
|
1999
|
+
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
2000
|
+
}
|
|
2001
|
+
if (this.orderBy !== null && this.orderBy !== "") {
|
|
2002
|
+
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
2003
|
+
}
|
|
2004
|
+
return url;
|
|
2005
|
+
}
|
|
2006
|
+
getNewPageSizeUrl(pageSize) {
|
|
2007
|
+
const currentPage = this.getPageNumber(parseInt(this.top || Constants.pagesize.toString()));
|
|
2008
|
+
const skip = (currentPage - 1) * pageSize;
|
|
2009
|
+
let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
|
|
2010
|
+
if (this.filterBy !== null && this.filterBy !== "") {
|
|
2011
|
+
url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
|
|
2012
|
+
}
|
|
2013
|
+
if (this.orderBy !== null && this.orderBy !== "") {
|
|
2014
|
+
url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
|
|
2015
|
+
}
|
|
2016
|
+
return url;
|
|
2017
|
+
}
|
|
2018
|
+
getOrderBy() {
|
|
2019
|
+
return this.orderBy;
|
|
2020
|
+
}
|
|
2021
|
+
};
|
|
2022
|
+
|
|
2023
|
+
// src/svg/chevron-updown.tsx
|
|
2024
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2025
|
+
var ChevronUpDown = (props) => {
|
|
2026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) });
|
|
2027
|
+
};
|
|
2028
|
+
var chevron_updown_default = ChevronUpDown;
|
|
2029
|
+
|
|
2030
|
+
// src/svg/chevron-down.tsx
|
|
2031
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2032
|
+
var ChevronDown = (props) => {
|
|
2033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) });
|
|
2034
|
+
};
|
|
2035
|
+
var chevron_down_default = ChevronDown;
|
|
2036
|
+
|
|
2037
|
+
// src/svg/chevron-up.tsx
|
|
2038
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2039
|
+
var ChevronUp = (props) => {
|
|
2040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) });
|
|
2041
|
+
};
|
|
2042
|
+
var chevron_up_default = ChevronUp;
|
|
2043
|
+
|
|
2044
|
+
// src/svg/plus.tsx
|
|
2045
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2046
|
+
var Plus = (props) => {
|
|
2047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) });
|
|
2048
|
+
};
|
|
2049
|
+
var plus_default = Plus;
|
|
2050
|
+
|
|
2051
|
+
// src/svg/Icons.tsx
|
|
2052
|
+
var Icons = {
|
|
2053
|
+
chevronUpDown: chevron_updown_default,
|
|
2054
|
+
chevronDown: chevron_down_default,
|
|
2055
|
+
chevronUp: chevron_up_default,
|
|
2056
|
+
plus: plus_default
|
|
2057
|
+
};
|
|
2058
|
+
var Icons_default = Icons;
|
|
2059
|
+
|
|
2060
|
+
// src/svg/Icon.tsx
|
|
2061
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2062
|
+
var Icon = ({ name, className, ...props }) => {
|
|
2063
|
+
const IconComponent = Icons_default[name];
|
|
2064
|
+
if (!IconComponent) {
|
|
2065
|
+
console.error(`Icon "${name}" not found.`);
|
|
2066
|
+
return null;
|
|
2067
|
+
}
|
|
2068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(IconComponent, { ...props, className });
|
|
2069
|
+
};
|
|
2070
|
+
var Icon_default = Icon;
|
|
2071
|
+
|
|
2072
|
+
// src/FormReducer.tsx
|
|
2073
|
+
var FORM_INPUT_UPDATE = "FORM_INPUT_UPDATE";
|
|
2074
|
+
var FORM_INITIAL_UPDATE = "FORM_INITIAL_UPDATE";
|
|
2075
|
+
function setNestedProperty(obj, path, value) {
|
|
2076
|
+
if (path.includes(".")) {
|
|
2077
|
+
const keys = path.split(".");
|
|
2078
|
+
const lastKey = keys.pop();
|
|
2079
|
+
const newObj = { ...obj };
|
|
2080
|
+
let current = newObj;
|
|
2081
|
+
keys.forEach((key) => {
|
|
2082
|
+
current[key] = { ...current[key] };
|
|
2083
|
+
current = current[key];
|
|
2084
|
+
});
|
|
2085
|
+
current[lastKey] = value;
|
|
2086
|
+
return newObj;
|
|
2087
|
+
}
|
|
2088
|
+
return {
|
|
2089
|
+
...obj,
|
|
2090
|
+
[path]: value
|
|
2091
|
+
};
|
|
2092
|
+
}
|
|
2093
|
+
function FormReducer(state, action) {
|
|
2094
|
+
switch (action.type) {
|
|
2095
|
+
case FORM_INPUT_UPDATE:
|
|
2096
|
+
if (!action.name) return state;
|
|
2097
|
+
return {
|
|
2098
|
+
inputValues: setNestedProperty(
|
|
2099
|
+
state.inputValues,
|
|
2100
|
+
action.name.toString(),
|
|
2101
|
+
action.value
|
|
2102
|
+
),
|
|
2103
|
+
lastPropertyChanged: action.name.toString()
|
|
2104
|
+
};
|
|
2105
|
+
case FORM_INITIAL_UPDATE:
|
|
2106
|
+
return {
|
|
2107
|
+
inputValues: { ...action.values },
|
|
2108
|
+
lastPropertyChanged: action.name?.toString() || ""
|
|
2109
|
+
};
|
|
2110
|
+
default:
|
|
2111
|
+
return state;
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
var FormReducer_default = FormReducer;
|
|
2115
|
+
|
|
2116
|
+
// src/components/dataForm/DataList.tsx
|
|
2117
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2118
|
+
var DataList = (props) => {
|
|
2119
|
+
console.log(props.dataset, "datasetssssss");
|
|
2120
|
+
const router = (0, import_navigation.useRouter)();
|
|
2121
|
+
let builder = new OdataBuilder(props.path);
|
|
2122
|
+
let orderBy = "";
|
|
2123
|
+
let activePageNumber = 0;
|
|
2124
|
+
let pages = 0;
|
|
2125
|
+
console.log(props.addLinkText);
|
|
2126
|
+
const [isDataFound, setIsDataFound] = (0, import_react34.useState)(null);
|
|
2127
|
+
(0, import_react34.useEffect)(() => {
|
|
2128
|
+
if (props?.dataset) {
|
|
2129
|
+
if (props?.dataset.result && props.dataset.result.length > 0) {
|
|
2130
|
+
setIsDataFound(true);
|
|
2131
|
+
} else {
|
|
2132
|
+
setIsDataFound(false);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
}, [props.dataset]);
|
|
2136
|
+
function getNestedProperty2(obj, path) {
|
|
2137
|
+
if (path.includes(".")) {
|
|
2138
|
+
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
2139
|
+
} else if (Array.isArray(obj[path])) {
|
|
2140
|
+
return obj[path].map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: item }, index));
|
|
2141
|
+
} else {
|
|
2142
|
+
return obj[path];
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
const initialState = {
|
|
2146
|
+
inputValues: {},
|
|
2147
|
+
lastPropertyChanged: ""
|
|
2148
|
+
};
|
|
2149
|
+
const [formState, dispatch] = (0, import_react34.useReducer)(FormReducer_default, initialState);
|
|
2150
|
+
const handleFilterChange = (0, import_react34.useCallback)(
|
|
2151
|
+
(updatedValues) => {
|
|
2152
|
+
dispatch({
|
|
2153
|
+
type: FORM_INPUT_UPDATE,
|
|
2154
|
+
name: updatedValues.name,
|
|
2155
|
+
value: updatedValues.value
|
|
2156
|
+
});
|
|
2157
|
+
let builder2 = new OdataBuilder(props.path);
|
|
2158
|
+
builder2 = builder2.setQuery(props.query);
|
|
2159
|
+
if (updatedValues.value != "") {
|
|
2160
|
+
const filter = props.filters?.find((x) => x.name == updatedValues.name);
|
|
2161
|
+
if (filter?.dataTypeCode == "number") {
|
|
2162
|
+
router.push(
|
|
2163
|
+
builder2.getNewFilterUrl(
|
|
2164
|
+
updatedValues.name.toString() + " eq " + updatedValues.value
|
|
2165
|
+
)
|
|
2166
|
+
);
|
|
2167
|
+
} else {
|
|
2168
|
+
router.push(
|
|
2169
|
+
builder2.getNewFilterUrl(
|
|
2170
|
+
updatedValues.name.toString() + " eq '" + updatedValues.value + "'"
|
|
2171
|
+
)
|
|
2172
|
+
);
|
|
2173
|
+
}
|
|
2174
|
+
} else {
|
|
2175
|
+
router.push(builder2.getNewFilterUrl(""));
|
|
2176
|
+
}
|
|
2177
|
+
},
|
|
2178
|
+
[dispatch, props, router]
|
|
2179
|
+
);
|
|
2180
|
+
builder = builder.setQuery(props.query);
|
|
2181
|
+
orderBy = builder.getOrderBy();
|
|
2182
|
+
activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
2183
|
+
let label = "";
|
|
2184
|
+
if (props.dataset && props.dataset.count) {
|
|
2185
|
+
pages = Math.ceil(props.dataset.count / Constants.pagesize);
|
|
2186
|
+
label = `Showing ${(activePageNumber - 1) * Constants.pagesize + 1} - `;
|
|
2187
|
+
if (activePageNumber * Constants.pagesize > props.dataset.count) {
|
|
2188
|
+
label = label + `${props.dataset.count} of ${props.dataset.count} results`;
|
|
2189
|
+
} else {
|
|
2190
|
+
label = label + `${activePageNumber * Constants.pagesize} of ${props.dataset.count} results`;
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
const renderPageNumbers = () => {
|
|
2194
|
+
if (pages <= 10) {
|
|
2195
|
+
return Array.from({ length: pages }, (_, index) => index + 1).map(
|
|
2196
|
+
(page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react34.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2197
|
+
Hyperlink,
|
|
2198
|
+
{
|
|
2199
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2200
|
+
href: builder.getNewPageUrl(page),
|
|
2201
|
+
children: page
|
|
2202
|
+
}
|
|
2203
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)
|
|
2204
|
+
);
|
|
2205
|
+
} else {
|
|
2206
|
+
const showFirstPages = activePageNumber <= 5;
|
|
2207
|
+
const showLastPages = activePageNumber > pages - 5;
|
|
2208
|
+
if (showFirstPages) {
|
|
2209
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2210
|
+
Array.from({ length: 8 }, (_, index) => index + 1).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react34.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2211
|
+
Hyperlink,
|
|
2212
|
+
{
|
|
2213
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2214
|
+
href: builder.getNewPageUrl(page),
|
|
2215
|
+
children: page
|
|
2216
|
+
}
|
|
2217
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)),
|
|
2218
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2220
|
+
Hyperlink,
|
|
2221
|
+
{
|
|
2222
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2223
|
+
href: builder.getNewPageUrl(pages - 1),
|
|
2224
|
+
children: pages - 1
|
|
2225
|
+
}
|
|
2226
|
+
),
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2228
|
+
Hyperlink,
|
|
2229
|
+
{
|
|
2230
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2231
|
+
href: builder.getNewPageUrl(pages),
|
|
2232
|
+
children: pages
|
|
2233
|
+
}
|
|
2234
|
+
),
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "relative inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2236
|
+
"select",
|
|
2237
|
+
{
|
|
2238
|
+
className: " py-1 border border-gray-300 bg-white text-gray-700 appearance-none rounded-none",
|
|
2239
|
+
value: activePageNumber > 8 && activePageNumber < pages - 1 ? activePageNumber : "",
|
|
2240
|
+
onChange: (e) => {
|
|
2241
|
+
const page = parseInt(e.target.value);
|
|
2242
|
+
if (page) {
|
|
2243
|
+
router.push(builder.getNewPageUrl(page));
|
|
2244
|
+
}
|
|
2245
|
+
},
|
|
2246
|
+
children: [
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { className: "", value: "", children: "Jump to" }),
|
|
2248
|
+
Array.from(
|
|
2249
|
+
{ length: Math.max(0, pages - 10) },
|
|
2250
|
+
(_, index) => index + 9
|
|
2251
|
+
).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: page, children: page }, page))
|
|
2252
|
+
]
|
|
2253
|
+
}
|
|
2254
|
+
) })
|
|
2255
|
+
] });
|
|
2256
|
+
} else if (showLastPages) {
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2259
|
+
Hyperlink,
|
|
2260
|
+
{
|
|
2261
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2262
|
+
href: builder.getNewPageUrl(1),
|
|
2263
|
+
children: "1"
|
|
2264
|
+
}
|
|
2265
|
+
),
|
|
2266
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2267
|
+
Hyperlink,
|
|
2268
|
+
{
|
|
2269
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2270
|
+
href: builder.getNewPageUrl(2),
|
|
2271
|
+
children: "2"
|
|
2272
|
+
}
|
|
2273
|
+
),
|
|
2274
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2275
|
+
Array.from({ length: 8 }, (_, index) => pages - 7 + index).map(
|
|
2276
|
+
(page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react34.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2277
|
+
Hyperlink,
|
|
2278
|
+
{
|
|
2279
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2280
|
+
href: builder.getNewPageUrl(page),
|
|
2281
|
+
children: page
|
|
2282
|
+
}
|
|
2283
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)
|
|
2284
|
+
)
|
|
2285
|
+
] });
|
|
2286
|
+
} else {
|
|
2287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2289
|
+
Hyperlink,
|
|
2290
|
+
{
|
|
2291
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2292
|
+
href: builder.getNewPageUrl(1),
|
|
2293
|
+
children: "1"
|
|
2294
|
+
}
|
|
2295
|
+
),
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2297
|
+
Hyperlink,
|
|
2298
|
+
{
|
|
2299
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2300
|
+
href: builder.getNewPageUrl(2),
|
|
2301
|
+
children: "2"
|
|
2302
|
+
}
|
|
2303
|
+
),
|
|
2304
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2305
|
+
Array.from(
|
|
2306
|
+
{ length: 5 },
|
|
2307
|
+
(_, index) => activePageNumber - 2 + index
|
|
2308
|
+
).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react34.default.Fragment, { children: activePageNumber !== page ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2309
|
+
Hyperlink,
|
|
2310
|
+
{
|
|
2311
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2312
|
+
href: builder.getNewPageUrl(page),
|
|
2313
|
+
children: page
|
|
2314
|
+
}
|
|
2315
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-3 py-1 border-t border-b border-gray-300 bg-primary text-white", children: page }) }, page)),
|
|
2316
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "px-2 py-1", children: "..." }),
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2318
|
+
Hyperlink,
|
|
2319
|
+
{
|
|
2320
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2321
|
+
href: builder.getNewPageUrl(pages - 1),
|
|
2322
|
+
children: pages - 1
|
|
2323
|
+
}
|
|
2324
|
+
),
|
|
2325
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2326
|
+
Hyperlink,
|
|
2327
|
+
{
|
|
2328
|
+
className: "px-3 py-1 border-t border-b border-gray-300 bg-white text-gray-700 hover:bg-gray-100",
|
|
2329
|
+
href: builder.getNewPageUrl(pages),
|
|
2330
|
+
children: pages
|
|
2331
|
+
}
|
|
2332
|
+
),
|
|
2333
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "relative inline-block", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2334
|
+
"select",
|
|
2335
|
+
{
|
|
2336
|
+
className: "px-2 py-1 border border-gray-300 bg-white text-gray-700 appearance-none rounded-none",
|
|
2337
|
+
value: activePageNumber > 2 && activePageNumber < pages - 1 ? activePageNumber : "",
|
|
2338
|
+
onChange: (e) => {
|
|
2339
|
+
const page = parseInt(e.target.value);
|
|
2340
|
+
if (page) {
|
|
2341
|
+
router.push(builder.getNewPageUrl(page));
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
children: [
|
|
2345
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: "", children: "Jump to" }),
|
|
2346
|
+
Array.from({ length: pages - 4 }, (_, index) => index + 3).filter((page) => page > 2 && page < pages - 1).map((page) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("option", { value: page, children: page }, page))
|
|
2347
|
+
]
|
|
2348
|
+
}
|
|
2349
|
+
) })
|
|
2350
|
+
] });
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
};
|
|
2354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react34.default.Fragment, { children: [
|
|
2355
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(ContentView_default, { isDataFound, children: [
|
|
2356
|
+
(props.title || props.filters || props.addLinkHref) && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2357
|
+
"div",
|
|
2358
|
+
{
|
|
2359
|
+
className: `flex justify-between items-center bg-white pl-6 pr-2 h-14 mb-3 shadow-sm rounded-md border-b border-neutral-200 sticky top-0`,
|
|
2360
|
+
children: [
|
|
2361
|
+
props.title ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h2", { className: "text-lg font-semibold text-black-800", children: props.title }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", {}),
|
|
2362
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2363
|
+
props.filters && props.filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2364
|
+
InputControl_default,
|
|
2365
|
+
{
|
|
2366
|
+
name: filter.name,
|
|
2367
|
+
controlType: InputControlType_default.select,
|
|
2368
|
+
value: formState.inputValues[filter.name],
|
|
2369
|
+
dataSource: filter.servicePath,
|
|
2370
|
+
dataKeyFieldName: filter.dataKeyFieldName,
|
|
2371
|
+
dataTextFieldName: filter.dataTextFieldName,
|
|
2372
|
+
serviceClient: props.serviceClient,
|
|
2373
|
+
callback: handleFilterChange,
|
|
2374
|
+
attributes: { placeholder: filter.placeholder }
|
|
2375
|
+
},
|
|
2376
|
+
filter.name
|
|
2377
|
+
)),
|
|
2378
|
+
props.addLinkHref && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2379
|
+
Hyperlink,
|
|
2380
|
+
{
|
|
2381
|
+
className: "gap-1",
|
|
2382
|
+
linkType: "Primary" /* Solid */,
|
|
2383
|
+
href: props.addLinkHref,
|
|
2384
|
+
children: [
|
|
2385
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { name: "plus", className: "w-4 h-4" }),
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-sm font-medium", children: props.addLinkText || "Add New" })
|
|
2387
|
+
]
|
|
2388
|
+
}
|
|
2389
|
+
)
|
|
2390
|
+
] })
|
|
2391
|
+
]
|
|
2392
|
+
}
|
|
2393
|
+
),
|
|
2394
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex-1 overflow-y-auto justify-end bg-white rounded shadow h-[calc(100vh-14rem)]", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("table", { className: "w-full divide-y divide-gray-200", children: [
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("thead", { className: "bg-gray-50 sticky top-0", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { children: props?.columns?.map((column) => {
|
|
2396
|
+
let url = builder.getNewOrderByUrl(column.name);
|
|
2397
|
+
let icon = "chevronUpDown";
|
|
2398
|
+
if (orderBy.includes(`${column.name} desc`)) {
|
|
2399
|
+
icon = "chevronDown";
|
|
2400
|
+
url = builder.getNewOrderByUrl(column.name);
|
|
2401
|
+
} else if (orderBy.includes(`${column.name}`)) {
|
|
2402
|
+
icon = "chevronUp";
|
|
2403
|
+
url = builder.getNewOrderByUrl(column.name + " desc");
|
|
2404
|
+
}
|
|
2405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2406
|
+
"th",
|
|
2407
|
+
{
|
|
2408
|
+
className: "px-6 py-3 text-left font-medium cursor-pointer bg-neutral-soft " + column.width + (column.controlType == ViewControlTypes_default.moneyView ? " text-right" : ""),
|
|
2409
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Hyperlink, { href: url, className: "!text-neutral-contrast ", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "flex items-center space-x-1", children: [
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-black", children: column.label }),
|
|
2411
|
+
column.enableSorting && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { className: "w-4 h-4", name: icon })
|
|
2412
|
+
] }) })
|
|
2413
|
+
},
|
|
2414
|
+
column.name
|
|
2415
|
+
);
|
|
2416
|
+
}) }) }),
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tbody", { className: "divide-y divide-gray-200 ", children: props.dataset?.result?.map((dataitem, index) => {
|
|
2418
|
+
let validityClass = "";
|
|
2419
|
+
console.log("dataitem", dataitem);
|
|
2420
|
+
if (props.recordValidityColumnName && getNestedProperty2(dataitem, props.recordValidityColumnName) == false) {
|
|
2421
|
+
validityClass = "bg-alert-200";
|
|
2422
|
+
}
|
|
2423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { className: validityClass, children: props?.columns?.map((column, colindex) => {
|
|
2424
|
+
console.log("column", column);
|
|
2425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react34.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2426
|
+
"td",
|
|
2427
|
+
{
|
|
2428
|
+
className: "px-6 py-2 whitespace-normal " + (column.controlType == ViewControlTypes_default.moneyView ? "" : ""),
|
|
2429
|
+
children: column.addhref === true ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2430
|
+
Hyperlink,
|
|
2431
|
+
{
|
|
2432
|
+
className: "",
|
|
2433
|
+
href: `https://${dataitem[column.name]}`,
|
|
2434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2435
|
+
ViewControl_default,
|
|
2436
|
+
{
|
|
2437
|
+
controlType: column.controlType,
|
|
2438
|
+
value: getNestedProperty2(
|
|
2439
|
+
dataitem,
|
|
2440
|
+
column.name
|
|
2441
|
+
),
|
|
2442
|
+
format: column.format,
|
|
2443
|
+
customProps: column.customProps
|
|
2444
|
+
}
|
|
2445
|
+
)
|
|
2446
|
+
}
|
|
2447
|
+
) : column.showAsLink ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2448
|
+
Hyperlink,
|
|
2449
|
+
{
|
|
2450
|
+
href: props.path + dataitem[props.columns[0].name] + "/" + (dataitem.linkUrlSegment ?? column.linkUrlSegment),
|
|
2451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2452
|
+
ViewControl_default,
|
|
2453
|
+
{
|
|
2454
|
+
controlType: column.controlType,
|
|
2455
|
+
value: getNestedProperty2(dataitem, column.name) || column.emptyValueLabel,
|
|
2456
|
+
format: column.format,
|
|
2457
|
+
customProps: column.customProps
|
|
2458
|
+
}
|
|
2459
|
+
)
|
|
2460
|
+
}
|
|
2461
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2462
|
+
ViewControl_default,
|
|
2463
|
+
{
|
|
2464
|
+
controlType: column.controlType,
|
|
2465
|
+
value: getNestedProperty2(dataitem, column.name),
|
|
2466
|
+
format: column.format,
|
|
2467
|
+
customProps: column.customProps
|
|
2468
|
+
}
|
|
2469
|
+
)
|
|
2470
|
+
}
|
|
2471
|
+
) }, colindex);
|
|
2472
|
+
}) }, index);
|
|
2473
|
+
}) })
|
|
2474
|
+
] }) }),
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "pt-4 border-t border-t-gray-50 sticky bottom-0 h-11 mt-2 ", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-gray-700", children: label }),
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex space-x-2 items-center", children: [
|
|
2478
|
+
activePageNumber > 1 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2479
|
+
Hyperlink,
|
|
2480
|
+
{
|
|
2481
|
+
className: "px-3 py-1 rounded-l-md border border-gray-300 bg-white text-gray-500 hover:bg-gray-200",
|
|
2482
|
+
href: builder.getNewPageUrl(activePageNumber - 1),
|
|
2483
|
+
children: "Prev"
|
|
2484
|
+
}
|
|
2485
|
+
),
|
|
2486
|
+
activePageNumber <= 1 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "px-3 py-1 rounded-l-md border border-gray-300 bg-gray-200 text-gray-500 hover:bg-gray-200", children: "Prev" }),
|
|
2487
|
+
renderPageNumbers(),
|
|
2488
|
+
activePageNumber < pages && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2489
|
+
Hyperlink,
|
|
2490
|
+
{
|
|
2491
|
+
className: "px-3 py-1 rounded-r-md border border-gray-300 bg-white text-gray-500 hover:bg-gray-200",
|
|
2492
|
+
href: builder.getNewPageUrl(activePageNumber + 1),
|
|
2493
|
+
children: "Next"
|
|
2494
|
+
}
|
|
2495
|
+
),
|
|
2496
|
+
activePageNumber >= pages && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "px-3 py-1 rounded-r-md border border-gray-300 bg-gray-200 text-gray-500", children: "Next" })
|
|
2497
|
+
] })
|
|
2498
|
+
] }) })
|
|
2499
|
+
] }),
|
|
2500
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(NoContentView_default, { isDataFound, children: [
|
|
2501
|
+
(props.title || props.filters || props.addLinkHref) && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2502
|
+
"div",
|
|
2503
|
+
{
|
|
2504
|
+
className: `flex justify-between items-center bg-white pl-6 pr-2 h-14 mb-3 shadow-sm rounded-md border-b border-neutral-200`,
|
|
2505
|
+
children: [
|
|
2506
|
+
props.title ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "inline-flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h2", { className: "text-lg font-semibold text-black", children: props.title }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", {}),
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
2508
|
+
props.filters && props.filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2509
|
+
InputControl_default,
|
|
2510
|
+
{
|
|
2511
|
+
name: filter.name,
|
|
2512
|
+
controlType: InputControlType_default.select,
|
|
2513
|
+
value: formState.inputValues[filter.name],
|
|
2514
|
+
dataSource: filter.servicePath,
|
|
2515
|
+
dataKeyFieldName: filter.dataKeyFieldName,
|
|
2516
|
+
dataTextFieldName: filter.dataTextFieldName,
|
|
2517
|
+
serviceClient: props.serviceClient,
|
|
2518
|
+
callback: handleFilterChange,
|
|
2519
|
+
attributes: { placeholder: filter.placeholder }
|
|
2520
|
+
},
|
|
2521
|
+
filter.name
|
|
2522
|
+
)),
|
|
2523
|
+
props.addLinkHref && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2524
|
+
Hyperlink,
|
|
2525
|
+
{
|
|
2526
|
+
className: "gap-1",
|
|
2527
|
+
linkType: "Primary" /* Solid */,
|
|
2528
|
+
href: props.addLinkHref,
|
|
2529
|
+
children: [
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { name: "plus", className: "w-4 h-4" }),
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-sm font-medium", children: props.addLinkText || "Add New" })
|
|
2532
|
+
]
|
|
2533
|
+
}
|
|
2534
|
+
)
|
|
2535
|
+
] })
|
|
2536
|
+
]
|
|
2537
|
+
}
|
|
2538
|
+
),
|
|
2539
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex-grow overflow-y-auto justify-end bg-white rounded shadow h-[75vh]", children: [
|
|
2540
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("table", { className: "w-full divide-y divide-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("thead", { className: "bg-gray-50", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("tr", { children: props?.columns?.map((column) => {
|
|
2541
|
+
let url = builder.getNewOrderByUrl(column.name);
|
|
2542
|
+
let icon = "chevronUpDown";
|
|
2543
|
+
if (orderBy.includes(`${column.name} desc`)) {
|
|
2544
|
+
icon = "chevronDown";
|
|
2545
|
+
url = builder.getNewOrderByUrl(column.name);
|
|
2546
|
+
} else if (orderBy.includes(`${column.name}`)) {
|
|
2547
|
+
icon = "chevronUp";
|
|
2548
|
+
url = builder.getNewOrderByUrl(column.name + " desc");
|
|
2549
|
+
}
|
|
2550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2551
|
+
"th",
|
|
2552
|
+
{
|
|
2553
|
+
className: "px-6 py-3 text-left font-medium cursor-pointer bg-neutral-soft " + column.width + (column.controlType == ViewControlTypes_default.moneyView ? " text-right" : ""),
|
|
2554
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Hyperlink, { href: url, className: "text-body-950", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "flex items-center space-x-1", children: [
|
|
2555
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: column.label }),
|
|
2556
|
+
column.enableSorting && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon_default, { className: "w-4 h-4", name: icon })
|
|
2557
|
+
] }) })
|
|
2558
|
+
},
|
|
2559
|
+
column.name
|
|
2560
|
+
);
|
|
2561
|
+
}) }) }) }) }),
|
|
2562
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "w-full text-center bg-transparent pt-5", children: "There are no entries in the table at the moment." })
|
|
2563
|
+
] })
|
|
2564
|
+
] })
|
|
2565
|
+
] });
|
|
2566
|
+
};
|
|
2567
|
+
var DataList_default = DataList;
|
|
2568
|
+
|
|
2569
|
+
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
2570
|
+
var import_react51 = __toESM(require("react"));
|
|
2571
|
+
|
|
2572
|
+
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
2573
|
+
var import_react36 = __toESM(require("react"));
|
|
2574
|
+
|
|
2575
|
+
// src/components/pageRenderingEngine/nodes/TextNode.tsx
|
|
2576
|
+
var import_jsx_runtime41 = (
|
|
2577
|
+
// @ts-expect-error custom code
|
|
2578
|
+
require("react/jsx-runtime")
|
|
2579
|
+
);
|
|
2580
|
+
var TextNode = (props) => {
|
|
2581
|
+
function cssStringToJson(cssString) {
|
|
2582
|
+
const styleObject = {};
|
|
2583
|
+
const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
|
|
2584
|
+
if (matches) {
|
|
2585
|
+
matches.forEach((match) => {
|
|
2586
|
+
const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
|
|
2587
|
+
if (parts && parts.length === 3) {
|
|
2588
|
+
const property = parts[1].trim();
|
|
2589
|
+
const value = parts[2].trim();
|
|
2590
|
+
styleObject[property] = value;
|
|
2591
|
+
}
|
|
2592
|
+
});
|
|
2593
|
+
}
|
|
2594
|
+
return styleObject;
|
|
2595
|
+
}
|
|
2596
|
+
function toCamelCase2(str) {
|
|
2597
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
2598
|
+
}
|
|
2599
|
+
function convertKeysToCamelCase2(obj) {
|
|
2600
|
+
if (Array.isArray(obj)) {
|
|
2601
|
+
return obj.map(convertKeysToCamelCase2);
|
|
2602
|
+
} else if (obj !== null && typeof obj === "object") {
|
|
2603
|
+
return Object.fromEntries(
|
|
2604
|
+
Object.entries(obj).filter(([_, value]) => value !== "").map(([key, value]) => [
|
|
2605
|
+
toCamelCase2(key),
|
|
2606
|
+
convertKeysToCamelCase2(value)
|
|
2607
|
+
])
|
|
2608
|
+
);
|
|
2609
|
+
}
|
|
2610
|
+
return obj;
|
|
2611
|
+
}
|
|
2612
|
+
function getFormatClass(format) {
|
|
2613
|
+
const classes = [];
|
|
2614
|
+
if (format === 1) classes.push("font-medium");
|
|
2615
|
+
if (format === 2) classes.push("italic");
|
|
2616
|
+
if (format === 3) classes.push("font-medium italic");
|
|
2617
|
+
if (format === 8) classes.push("underline");
|
|
2618
|
+
if (format === 9) classes.push("font-medium underline");
|
|
2619
|
+
if (format === 10) classes.push("italic underline");
|
|
2620
|
+
if (format === 11) classes.push("font-medium italic underline");
|
|
2621
|
+
if (format === 256) classes.push("lowercase");
|
|
2622
|
+
if (format === 512) classes.push("uppercase");
|
|
2623
|
+
if (format === 1024) classes.push("capitalize");
|
|
2624
|
+
return classes.join(" ");
|
|
2625
|
+
}
|
|
2626
|
+
const styles = convertKeysToCamelCase2(cssStringToJson(props.node.style));
|
|
2627
|
+
function replacePlaceholders(template, dataItem) {
|
|
2628
|
+
{
|
|
2629
|
+
}
|
|
2630
|
+
return template.replace(/{(\w+)}/g, (_, key) => {
|
|
2631
|
+
{
|
|
2632
|
+
}
|
|
2633
|
+
return key in dataItem ? dataItem[key] : `{${key}}`;
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
const displayText = props.linkText ? props.linkText : props.node.text;
|
|
2637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { style: { ...styles }, className: getFormatClass(props.node.format), children: props.dataitem && props.linkText ? displayText : props.dataitem ? replacePlaceholders(props.node.text, props.dataitem) : props.node.text });
|
|
2638
|
+
};
|
|
2639
|
+
var TextNode_default = TextNode;
|
|
2640
|
+
|
|
2641
|
+
// src/components/pageRenderingEngine/nodes/LineBreakNode.tsx
|
|
2642
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2643
|
+
var LineBreakNode = () => {
|
|
2644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "py-0.5 lg:py-1.5" });
|
|
2645
|
+
};
|
|
2646
|
+
var LineBreakNode_default = LineBreakNode;
|
|
2647
|
+
|
|
2648
|
+
// src/components/pageRenderingEngine/nodes/LinkNode.tsx
|
|
2649
|
+
var import_react35 = __toESM(require("react"));
|
|
2650
|
+
var import_link2 = __toESM(require("next/link"));
|
|
2651
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2652
|
+
var LinkNode = (props) => {
|
|
2653
|
+
const NodeTypes2 = {
|
|
2654
|
+
["text"]: TextNode_default
|
|
2655
|
+
};
|
|
2656
|
+
{
|
|
2657
|
+
}
|
|
2658
|
+
let formatClasses = props.node.cssClass || "";
|
|
2659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_link2.default, { className: formatClasses, href: props.node.url, title: props.node.title, children: [
|
|
2660
|
+
props.node.children && props.node.children.map((node, index) => {
|
|
2661
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react35.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SelectedNode, { node }) }, index);
|
|
2663
|
+
}),
|
|
2664
|
+
props.node.children.length == 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("br", {})
|
|
2665
|
+
] });
|
|
2666
|
+
};
|
|
2667
|
+
var LinkNode_default = LinkNode;
|
|
2668
|
+
|
|
2669
|
+
// src/components/pageRenderingEngine/nodes/SVGIconNode.tsx
|
|
2670
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2671
|
+
var SVGIconNode = ({ node }) => {
|
|
2672
|
+
if (!node?.svgCode) return null;
|
|
2673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2674
|
+
"span",
|
|
2675
|
+
{
|
|
2676
|
+
style: {
|
|
2677
|
+
display: "inline-flex",
|
|
2678
|
+
width: node.width,
|
|
2679
|
+
height: node.height,
|
|
2680
|
+
color: node.color
|
|
2681
|
+
},
|
|
2682
|
+
dangerouslySetInnerHTML: { __html: node.svgCode }
|
|
2683
|
+
}
|
|
2684
|
+
);
|
|
2685
|
+
};
|
|
2686
|
+
var SVGIconNode_default = SVGIconNode;
|
|
2687
|
+
|
|
2688
|
+
// src/components/pageRenderingEngine/nodes/EquationNode.tsx
|
|
2689
|
+
var import_katex = __toESM(require("katex"));
|
|
2690
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2691
|
+
var EquationNode = ({ node }) => {
|
|
2692
|
+
const { equation, inline } = node;
|
|
2693
|
+
let html = "";
|
|
2694
|
+
try {
|
|
2695
|
+
html = import_katex.default.renderToString(equation, {
|
|
2696
|
+
displayMode: !inline,
|
|
2697
|
+
throwOnError: false
|
|
2698
|
+
});
|
|
2699
|
+
} catch (error) {
|
|
2700
|
+
html = import_katex.default.renderToString(`\\text{Invalid equation}`, {
|
|
2701
|
+
throwOnError: false
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
if (inline) {
|
|
2705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2706
|
+
"span",
|
|
2707
|
+
{
|
|
2708
|
+
className: "katex-inline",
|
|
2709
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
2710
|
+
}
|
|
2711
|
+
);
|
|
2712
|
+
}
|
|
2713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2714
|
+
"div",
|
|
2715
|
+
{
|
|
2716
|
+
className: "katex-block my-3 text-center",
|
|
2717
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
2718
|
+
}
|
|
2719
|
+
);
|
|
2720
|
+
};
|
|
2721
|
+
var EquationNode_default = EquationNode;
|
|
2722
|
+
|
|
2723
|
+
// src/components/pageRenderingEngine/nodes/DatafieldNode.tsx
|
|
2724
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2725
|
+
function getNestedProperty(obj, path) {
|
|
2726
|
+
if (!obj || !path) return null;
|
|
2727
|
+
if (path.includes(".")) {
|
|
2728
|
+
return path.split(".").reduce((prev, curr) => {
|
|
2729
|
+
if (prev && typeof prev === "object") {
|
|
2730
|
+
return prev[curr];
|
|
2731
|
+
}
|
|
2732
|
+
return null;
|
|
2733
|
+
}, obj);
|
|
2734
|
+
}
|
|
2735
|
+
const value = obj[path];
|
|
2736
|
+
if (Array.isArray(value)) {
|
|
2737
|
+
return value.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { children: String(item) }, index));
|
|
2738
|
+
}
|
|
2739
|
+
return value;
|
|
2740
|
+
}
|
|
2741
|
+
var DatafieldNode = (props) => {
|
|
2742
|
+
function cssStringToJson(cssString) {
|
|
2743
|
+
const styleObject = {};
|
|
2744
|
+
const matches = cssString?.match(/([\w-]+)\s*:\s*([^;]+)\s*;/g);
|
|
2745
|
+
if (matches) {
|
|
2746
|
+
matches.forEach((match) => {
|
|
2747
|
+
const parts = match.match(/([\w-]+)\s*:\s*([^;]+)\s*;/);
|
|
2748
|
+
if (parts && parts.length === 3) {
|
|
2749
|
+
styleObject[parts[1].trim()] = parts[2].trim();
|
|
2750
|
+
}
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2753
|
+
return styleObject;
|
|
2754
|
+
}
|
|
2755
|
+
function toCamelCase2(str) {
|
|
2756
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
2757
|
+
}
|
|
2758
|
+
function convertKeysToCamelCase2(obj) {
|
|
2759
|
+
return Object.fromEntries(
|
|
2760
|
+
Object.entries(obj).map(([key, value2]) => [
|
|
2761
|
+
toCamelCase2(key),
|
|
2762
|
+
value2
|
|
2763
|
+
])
|
|
2764
|
+
);
|
|
2765
|
+
}
|
|
2766
|
+
const Formats = [
|
|
2767
|
+
"",
|
|
2768
|
+
"font-medium",
|
|
2769
|
+
"italic",
|
|
2770
|
+
"font-medium italic",
|
|
2771
|
+
"",
|
|
2772
|
+
"",
|
|
2773
|
+
"",
|
|
2774
|
+
"",
|
|
2775
|
+
"underline",
|
|
2776
|
+
"font-medium underline",
|
|
2777
|
+
"italic underline",
|
|
2778
|
+
"italic underline font-medium"
|
|
2779
|
+
];
|
|
2780
|
+
const styles = convertKeysToCamelCase2(
|
|
2781
|
+
cssStringToJson(props.node.style)
|
|
2782
|
+
);
|
|
2783
|
+
const fieldName = props.node.fieldName ?? "";
|
|
2784
|
+
const value = props.dataitem ? getNestedProperty(props.dataitem, fieldName) : null;
|
|
2785
|
+
const isEmptyValue = value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0 || typeof value === "object" && value !== null && Object.keys(value).length === 0;
|
|
2786
|
+
const maxLines = props.node.maxLines;
|
|
2787
|
+
if (maxLines && Number(maxLines) > 0) {
|
|
2788
|
+
Object.assign(styles, {
|
|
2789
|
+
display: "-webkit-box",
|
|
2790
|
+
overflow: "hidden",
|
|
2791
|
+
WebkitBoxOrient: "vertical",
|
|
2792
|
+
WebkitLineClamp: String(maxLines)
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
const dataType = props.node.dataType;
|
|
2796
|
+
if (isEmptyValue) return null;
|
|
2797
|
+
if (dataType === "rawContent") {
|
|
2798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2799
|
+
PageBodyRenderer_default,
|
|
2800
|
+
{
|
|
2801
|
+
rawBody: String(value ?? `@databound[${fieldName}]`),
|
|
2802
|
+
routeParameters: props.routeParameters,
|
|
2803
|
+
query: props.query,
|
|
2804
|
+
session: props.session,
|
|
2805
|
+
host: props.host,
|
|
2806
|
+
path: props.path,
|
|
2807
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2808
|
+
breadcrumb: props.breadcrumb,
|
|
2809
|
+
donotApplyContainerClass: true
|
|
2810
|
+
}
|
|
2811
|
+
);
|
|
2812
|
+
}
|
|
2813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2814
|
+
"span",
|
|
2815
|
+
{
|
|
2816
|
+
className: `datafield-node ${props.node.format < Formats.length ? Formats[props.node.format] : ""}`,
|
|
2817
|
+
style: styles,
|
|
2818
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2819
|
+
ViewControl_default,
|
|
2820
|
+
{
|
|
2821
|
+
controlType: dataType,
|
|
2822
|
+
value: value ?? `@databound[${fieldName}]`
|
|
2823
|
+
}
|
|
2824
|
+
)
|
|
2825
|
+
}
|
|
2826
|
+
);
|
|
2827
|
+
};
|
|
2828
|
+
var DatafieldNode_default = DatafieldNode;
|
|
2829
|
+
|
|
2830
|
+
// src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
|
|
2831
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2832
|
+
var ParagraphNode = (props) => {
|
|
2833
|
+
const NodeTypes2 = {
|
|
2834
|
+
["text"]: TextNode_default,
|
|
2835
|
+
["linebreak"]: LineBreakNode_default,
|
|
2836
|
+
["link"]: LinkNode_default,
|
|
2837
|
+
["datafield"]: DatafieldNode_default,
|
|
2838
|
+
["equation"]: EquationNode_default,
|
|
2839
|
+
["svg-icon"]: SVGIconNode_default
|
|
2840
|
+
};
|
|
2841
|
+
const FormatClass = {
|
|
2842
|
+
"center": "text-center",
|
|
2843
|
+
"right": "text-right"
|
|
2844
|
+
};
|
|
2845
|
+
{
|
|
2846
|
+
}
|
|
2847
|
+
const formatClasses = FormatClass[props.node.format] || "";
|
|
2848
|
+
const isInlineOnlyParent = props.parentTag === "summary";
|
|
2849
|
+
const hasChildren = props.node.children && props.node.children.length > 0;
|
|
2850
|
+
if (isInlineOnlyParent) {
|
|
2851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: hasChildren && props.node.children.map((node, index) => {
|
|
2852
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react36.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2854
|
+
SelectedNode,
|
|
2855
|
+
{
|
|
2856
|
+
node,
|
|
2857
|
+
dataitem: props.dataitem,
|
|
2858
|
+
session: props.session,
|
|
2859
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2860
|
+
routeParameters: props.routeParameters
|
|
2861
|
+
}
|
|
2862
|
+
) }, index);
|
|
2863
|
+
}) });
|
|
2864
|
+
}
|
|
2865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: " " + formatClasses, children: [
|
|
2866
|
+
hasChildren && props.node.children.map((node, index) => {
|
|
2867
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react36.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2869
|
+
SelectedNode,
|
|
2870
|
+
{
|
|
2871
|
+
node,
|
|
2872
|
+
dataitem: props.dataitem,
|
|
2873
|
+
session: props.session,
|
|
2874
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
2875
|
+
routeParameters: props.routeParameters
|
|
2876
|
+
}
|
|
2877
|
+
) }, index);
|
|
2878
|
+
}),
|
|
2879
|
+
!hasChildren && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "py-1.5 lg:py-2" })
|
|
2880
|
+
] });
|
|
2881
|
+
};
|
|
2882
|
+
var ParagraphNode_default = ParagraphNode;
|
|
2883
|
+
|
|
2884
|
+
// src/components/pageRenderingEngine/nodes/HeadingNode.tsx
|
|
2885
|
+
var import_react37 = __toESM(require("react"));
|
|
2886
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2887
|
+
var HeadingNode = (props) => {
|
|
2888
|
+
const NodeTypes2 = {
|
|
2889
|
+
["text"]: TextNode_default,
|
|
2890
|
+
["link"]: LinkNode_default,
|
|
2891
|
+
["svg-icon"]: SVGIconNode_default,
|
|
2892
|
+
["datafield"]: DatafieldNode_default
|
|
2893
|
+
};
|
|
2894
|
+
const HeadingTag = `${props.node.tag}`;
|
|
2895
|
+
const FormatClass = {
|
|
2896
|
+
"center": "text-center"
|
|
2897
|
+
};
|
|
2898
|
+
{
|
|
2899
|
+
}
|
|
2900
|
+
const formatClasses = FormatClass[props.node.format] || "";
|
|
2901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: import_react37.default.createElement(
|
|
2902
|
+
HeadingTag,
|
|
2903
|
+
{ className: formatClasses },
|
|
2904
|
+
props.node.children && props.node.children.map((childNode, index) => {
|
|
2905
|
+
const SelectedNode = NodeTypes2[childNode.type];
|
|
2906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react37.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(SelectedNode, { node: childNode, dataitem: props.dataitem, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
2907
|
+
})
|
|
2908
|
+
) });
|
|
2909
|
+
};
|
|
2910
|
+
var HeadingNode_default = HeadingNode;
|
|
2911
|
+
|
|
2912
|
+
// src/components/pageRenderingEngine/nodes/ListNode.tsx
|
|
2913
|
+
var import_react39 = __toESM(require("react"));
|
|
2914
|
+
|
|
2915
|
+
// src/components/pageRenderingEngine/nodes/ListItemNode.tsx
|
|
2916
|
+
var import_react38 = __toESM(require("react"));
|
|
2917
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2918
|
+
var ListItemNode = (props) => {
|
|
2919
|
+
const NodeTypes2 = {
|
|
2920
|
+
text: TextNode_default,
|
|
2921
|
+
linebreak: LineBreakNode_default,
|
|
2922
|
+
link: LinkNode_default,
|
|
2923
|
+
list: ListNode_default
|
|
2924
|
+
};
|
|
2925
|
+
let foundFirstBreak = false;
|
|
2926
|
+
const firstTextChild = props.node.children?.find((c) => c.type === "text");
|
|
2927
|
+
let liStyle = {};
|
|
2928
|
+
if (firstTextChild?.style) {
|
|
2929
|
+
const match = firstTextChild.style.match(/font-size\s*:\s*([^;]+);?/);
|
|
2930
|
+
if (match) {
|
|
2931
|
+
liStyle.fontSize = match[1].trim();
|
|
2932
|
+
}
|
|
2933
|
+
}
|
|
2934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("li", { style: liStyle, children: props.node.children && props.node.children.map((node, index) => {
|
|
2935
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2936
|
+
if (node.type === "linebreak") {
|
|
2937
|
+
if (!foundFirstBreak) {
|
|
2938
|
+
foundFirstBreak = true;
|
|
2939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", {}, index);
|
|
2940
|
+
} else {
|
|
2941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "py-1 lg:py-2" }, index);
|
|
2942
|
+
}
|
|
2943
|
+
} else {
|
|
2944
|
+
foundFirstBreak = false;
|
|
2945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react38.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2946
|
+
}
|
|
2947
|
+
}) });
|
|
2948
|
+
};
|
|
2949
|
+
var ListItemNode_default = ListItemNode;
|
|
2950
|
+
|
|
2951
|
+
// src/components/pageRenderingEngine/nodes/ListNode.tsx
|
|
2952
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2953
|
+
var ListNode = (props) => {
|
|
2954
|
+
const NodeTypes2 = {
|
|
2955
|
+
listitem: ListItemNode_default
|
|
2956
|
+
};
|
|
2957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_react39.default.Fragment, { children: [
|
|
2958
|
+
props.node.listType == "bullet" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ul", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2959
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react39.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2961
|
+
}) }),
|
|
2962
|
+
props.node.listType == "number" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("ol", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2963
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react39.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SelectedNode, { node, dataitem: props.dataitem, routeParameters: props.routeParameters }) }, index);
|
|
2965
|
+
}) })
|
|
2966
|
+
] });
|
|
2967
|
+
};
|
|
2968
|
+
var ListNode_default = ListNode;
|
|
2969
|
+
|
|
2970
|
+
// src/components/pageRenderingEngine/nodes/QuoteNode.tsx
|
|
2971
|
+
var import_react40 = __toESM(require("react"));
|
|
2972
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2973
|
+
var QuoteNode = (props) => {
|
|
2974
|
+
const NodeTypes2 = {
|
|
2975
|
+
["text"]: TextNode_default,
|
|
2976
|
+
["linebreak"]: LineBreakNode_default,
|
|
2977
|
+
["link"]: LinkNode_default
|
|
2978
|
+
};
|
|
2979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("blockquote", { children: props.node.children && props.node.children.map((node, index) => {
|
|
2980
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
2981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_react40.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
2982
|
+
}) });
|
|
2983
|
+
};
|
|
2984
|
+
var QuoteNode_default = QuoteNode;
|
|
2985
|
+
|
|
2986
|
+
// src/components/pageRenderingEngine/nodes/CodeNode.tsx
|
|
2987
|
+
var import_react42 = __toESM(require("react"));
|
|
2988
|
+
|
|
2989
|
+
// src/components/CopyButton.tsx
|
|
2990
|
+
var import_react41 = require("react");
|
|
2991
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2992
|
+
function CopyButton({ text }) {
|
|
2993
|
+
const [copied, setCopied] = (0, import_react41.useState)(false);
|
|
2994
|
+
const timeoutRef = (0, import_react41.useRef)(null);
|
|
2995
|
+
(0, import_react41.useEffect)(() => {
|
|
2996
|
+
return () => {
|
|
2997
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2998
|
+
};
|
|
2999
|
+
}, []);
|
|
3000
|
+
const handleCopy = async () => {
|
|
3001
|
+
try {
|
|
3002
|
+
await navigator.clipboard.writeText(text);
|
|
3003
|
+
setCopied(true);
|
|
3004
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
3005
|
+
timeoutRef.current = setTimeout(() => setCopied(false), 2e3);
|
|
3006
|
+
} catch (err) {
|
|
3007
|
+
console.error("Failed to copy: ", err);
|
|
3008
|
+
}
|
|
3009
|
+
};
|
|
3010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
3011
|
+
"button",
|
|
3012
|
+
{
|
|
3013
|
+
onClick: handleCopy,
|
|
3014
|
+
className: "flex gap-1 items-center hover:text-white transition",
|
|
3015
|
+
children: [
|
|
3016
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3017
|
+
"svg",
|
|
3018
|
+
{
|
|
3019
|
+
width: "16",
|
|
3020
|
+
height: "16",
|
|
3021
|
+
viewBox: "0 0 24 24",
|
|
3022
|
+
className: "w-4 h-4",
|
|
3023
|
+
fill: "currentColor",
|
|
3024
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3025
|
+
"path",
|
|
3026
|
+
{
|
|
3027
|
+
fillRule: "evenodd",
|
|
3028
|
+
clipRule: "evenodd",
|
|
3029
|
+
d: "M12 4C10.8954 4 10 4.89543 10 6H14C14 4.89543 13.1046 4 12 4ZM8.53513 4C9.22675 2.8044 10.5194 2 12 2C13.4806 2 14.7733 2.8044 15.4649 4H17C18.6569 4 20 5.34315 20 7V19C20 20.6569 18.6569 22 17 22H7C5.34315 22 4 20.6569 4 19V7C4 5.34315 5.34315 4 7 4H8.53513ZM8 6H7C6.44772 6 6 6.44772 6 7V19C6 19.5523 6.44772 20 7 20H17C17.5523 20 18 19.5523 18 19V7C18 6.44772 17.5523 6 17 6H16C16 7.10457 15.1046 8 14 8H10C8.89543 8 8 7.10457 8 6Z"
|
|
3030
|
+
}
|
|
3031
|
+
)
|
|
3032
|
+
}
|
|
3033
|
+
),
|
|
3034
|
+
copied ? "Copied!" : "Copy code"
|
|
3035
|
+
]
|
|
3036
|
+
}
|
|
3037
|
+
);
|
|
3038
|
+
}
|
|
3039
|
+
|
|
3040
|
+
// src/components/pageRenderingEngine/nodes/CodeNode.tsx
|
|
3041
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3042
|
+
var CodeNode = (props) => {
|
|
3043
|
+
const NodeTypes2 = {
|
|
3044
|
+
// @ts-expect-error custom code
|
|
3045
|
+
["text"]: TextNode_default,
|
|
3046
|
+
["linebreak"]: LineBreakNode_default,
|
|
3047
|
+
// @ts-expect-error custom code
|
|
3048
|
+
["link"]: LinkNode_default
|
|
3049
|
+
};
|
|
3050
|
+
const textContent = props.node?.children?.map((node) => {
|
|
3051
|
+
if (node.type === "text") return node.text || "";
|
|
3052
|
+
if (node.type === "linebreak") return "\n";
|
|
3053
|
+
if (node.type === "link") return node.text || node.url || "";
|
|
3054
|
+
return "";
|
|
3055
|
+
}).join("") ?? "";
|
|
3056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "code-block", children: [
|
|
3057
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center relative text-gray-200 bg-gray-800 px-4 py-2.5 text-xs font-sans justify-between rounded-t-md", children: [
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { children: "Code Snippet" }),
|
|
3059
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CopyButton, { text: textContent })
|
|
3060
|
+
] }),
|
|
3061
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("code", { className: "block bg-gray-900 text-gray-100 p-4 rounded-b-md text-sm whitespace-pre-wrap", children: props.node.children && props.node.children.map((node, index) => {
|
|
3062
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
3063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react42.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SelectedNode, { node, session: props.session, apiBaseUrl: props.apiBaseUrl, routeParameters: props.routeParameters }) }, index);
|
|
3064
|
+
}) })
|
|
3065
|
+
] });
|
|
3066
|
+
};
|
|
3067
|
+
var CodeNode_default = CodeNode;
|
|
3068
|
+
|
|
3069
|
+
// src/components/pageRenderingEngine/nodes/HorizontalRuleNode.tsx
|
|
3070
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3071
|
+
var HorizontalRuleNode = () => {
|
|
3072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("hr", {});
|
|
3073
|
+
};
|
|
3074
|
+
var HorizontalRuleNode_default = HorizontalRuleNode;
|
|
3075
|
+
|
|
3076
|
+
// src/components/pageRenderingEngine/nodes/ImageNode.tsx
|
|
3077
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3078
|
+
var ImageNode = (props) => {
|
|
3079
|
+
const { node, assetBaseUrl = "" } = props;
|
|
3080
|
+
if (!node.imageUrl) return null;
|
|
3081
|
+
let imageUrl;
|
|
3082
|
+
if (node.imageUrl.startsWith("http")) {
|
|
3083
|
+
imageUrl = node.imageUrl;
|
|
3084
|
+
} else {
|
|
3085
|
+
imageUrl = assetBaseUrl ? `${assetBaseUrl}/${node.imageUrl}` : node.imageUrl;
|
|
3086
|
+
}
|
|
3087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, { children: node.width ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { style: { width: node.width }, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3088
|
+
"img",
|
|
3089
|
+
{
|
|
3090
|
+
loading: "lazy",
|
|
3091
|
+
className: "object-cover",
|
|
3092
|
+
src: imageUrl,
|
|
3093
|
+
width: node.intrinsicWidth,
|
|
3094
|
+
height: node.intrinsicHeight,
|
|
3095
|
+
alt: node.title
|
|
3096
|
+
}
|
|
3097
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3098
|
+
"img",
|
|
3099
|
+
{
|
|
3100
|
+
loading: "lazy",
|
|
3101
|
+
className: "object-cover",
|
|
3102
|
+
src: imageUrl,
|
|
3103
|
+
width: node.intrinsicWidth,
|
|
3104
|
+
height: node.intrinsicHeight,
|
|
3105
|
+
alt: node.title
|
|
3106
|
+
}
|
|
3107
|
+
) });
|
|
3108
|
+
};
|
|
3109
|
+
var ImageNode_default = ImageNode;
|
|
3110
|
+
|
|
3111
|
+
// src/components/pageRenderingEngine/nodes/WidgetNode.tsx
|
|
3112
|
+
var import_react43 = __toESM(require("react"));
|
|
3113
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3114
|
+
function resolveWidget(code) {
|
|
3115
|
+
return getWidget(code);
|
|
3116
|
+
}
|
|
3117
|
+
var WidgetNode = (props) => {
|
|
3118
|
+
const getWidgetParameters = () => {
|
|
3119
|
+
const widgetInputParameters = {
|
|
3120
|
+
...props.routeParameters ?? {}
|
|
3121
|
+
};
|
|
3122
|
+
const rawWidgetParams = props.node.widgetParameters ?? props.node.widgetParams;
|
|
3123
|
+
let widgetParameters = {};
|
|
3124
|
+
const isJSON = (str) => {
|
|
3125
|
+
const s = str.trim();
|
|
3126
|
+
return s.startsWith("{") && s.endsWith("}") || s.startsWith("[") && s.endsWith("]");
|
|
3127
|
+
};
|
|
3128
|
+
if (rawWidgetParams) {
|
|
3129
|
+
if (typeof rawWidgetParams === "string" && isJSON(rawWidgetParams)) {
|
|
3130
|
+
try {
|
|
3131
|
+
widgetParameters = JSON.parse(rawWidgetParams);
|
|
3132
|
+
} catch {
|
|
3133
|
+
widgetParameters = {};
|
|
3134
|
+
}
|
|
3135
|
+
} else if (typeof rawWidgetParams === "object") {
|
|
3136
|
+
widgetParameters = rawWidgetParams;
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
const resolveValue = (val) => {
|
|
3140
|
+
if (typeof val === "string") {
|
|
3141
|
+
const m = /^\{(.+)\}$/.exec(val);
|
|
3142
|
+
if (m) {
|
|
3143
|
+
const actualKey = m[1];
|
|
3144
|
+
return props.routeParameters?.[actualKey] ?? val;
|
|
3145
|
+
}
|
|
3146
|
+
return val;
|
|
3147
|
+
}
|
|
3148
|
+
if (Array.isArray(val)) {
|
|
3149
|
+
return val.map(resolveValue);
|
|
3150
|
+
}
|
|
3151
|
+
if (val && typeof val === "object") {
|
|
3152
|
+
const out = {};
|
|
3153
|
+
for (const k of Object.keys(val)) {
|
|
3154
|
+
out[k] = resolveValue(val[k]);
|
|
3155
|
+
}
|
|
3156
|
+
return out;
|
|
3157
|
+
}
|
|
3158
|
+
return val;
|
|
3159
|
+
};
|
|
3160
|
+
for (const key of Object.keys(widgetParameters)) {
|
|
3161
|
+
const rawVal = widgetParameters[key];
|
|
3162
|
+
if (rawVal === "route") {
|
|
3163
|
+
widgetInputParameters[key] = key === "itemPath" ? props.path : widgetInputParameters[key] ?? null;
|
|
3164
|
+
} else {
|
|
3165
|
+
widgetInputParameters[key] = resolveValue(rawVal);
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
widgetInputParameters["widgetTitle"] = props.node.widgetTitle;
|
|
3169
|
+
return widgetInputParameters;
|
|
3170
|
+
};
|
|
3171
|
+
const widgetCode = props.node.widgetCode;
|
|
3172
|
+
const SelectedWidget = resolveWidget(widgetCode);
|
|
3173
|
+
if (!SelectedWidget) {
|
|
3174
|
+
console.warn("Widget not found:", widgetCode);
|
|
3175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
3176
|
+
"Widget not found: ",
|
|
3177
|
+
widgetCode
|
|
3178
|
+
] });
|
|
3179
|
+
}
|
|
3180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react43.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "container mt-2", children: "..." }), children: import_react43.default.createElement(SelectedWidget, {
|
|
3181
|
+
params: getWidgetParameters(),
|
|
3182
|
+
query: props.query,
|
|
3183
|
+
session: props.session,
|
|
3184
|
+
host: props.host,
|
|
3185
|
+
path: props.path,
|
|
3186
|
+
apiBaseUrl: props.apiBaseUrl
|
|
3187
|
+
}) });
|
|
3188
|
+
};
|
|
3189
|
+
var WidgetNode_default = WidgetNode;
|
|
3190
|
+
|
|
3191
|
+
// src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
|
|
3192
|
+
var import_react44 = __toESM(require("react"));
|
|
3193
|
+
|
|
3194
|
+
// src/components/pageRenderingEngine/nodes/InputControlNode.tsx
|
|
3195
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3196
|
+
var InputControlNode = (props) => {
|
|
3197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3198
|
+
InputControl_default,
|
|
3199
|
+
{
|
|
3200
|
+
name: props.node.name,
|
|
3201
|
+
controlType: "lineTextInput",
|
|
3202
|
+
value: props.value,
|
|
3203
|
+
callback: props.callback,
|
|
3204
|
+
attributes: {
|
|
3205
|
+
pattern: props.node.pattern,
|
|
3206
|
+
maxLength: props.node.maxLength,
|
|
3207
|
+
minLength: props.node.minLength,
|
|
3208
|
+
//maxValue:props.node.maxV,
|
|
3209
|
+
//minValue?: number,
|
|
3210
|
+
readOnly: props.node.readOnly,
|
|
3211
|
+
label: "name",
|
|
3212
|
+
//props.node.label,
|
|
3213
|
+
hintText: props.node.hintText,
|
|
3214
|
+
placeholder: props.node.placeholder,
|
|
3215
|
+
required: props.node.required,
|
|
3216
|
+
errorMessage: props.node.errorMessage,
|
|
3217
|
+
helpText: props.node.helpText,
|
|
3218
|
+
autoFocus: props.node.autoFocus
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
) });
|
|
3222
|
+
};
|
|
3223
|
+
var InputControlNode_default = InputControlNode;
|
|
3224
|
+
|
|
3225
|
+
// src/clients/CacheManage.tsx
|
|
3226
|
+
var import_node_cache = __toESM(require("node-cache"));
|
|
3227
|
+
var CacheManager = class _CacheManager {
|
|
3228
|
+
constructor() {
|
|
3229
|
+
this.maxCacheSize = 1e3;
|
|
3230
|
+
this.cache = new import_node_cache.default({ stdTTL: 0, checkperiod: 300 });
|
|
3231
|
+
}
|
|
3232
|
+
static getInstance() {
|
|
3233
|
+
if (!_CacheManager.instance) {
|
|
3234
|
+
_CacheManager.instance = new _CacheManager();
|
|
3235
|
+
}
|
|
3236
|
+
return _CacheManager.instance;
|
|
3237
|
+
}
|
|
3238
|
+
get(key) {
|
|
3239
|
+
return null;
|
|
3240
|
+
}
|
|
3241
|
+
set(key, data, ttl) {
|
|
3242
|
+
}
|
|
3243
|
+
clear() {
|
|
3244
|
+
this.cache.flushAll();
|
|
3245
|
+
}
|
|
3246
|
+
size() {
|
|
3247
|
+
return this.cache.keys().length;
|
|
3248
|
+
}
|
|
3249
|
+
destroy() {
|
|
3250
|
+
this.cache.close();
|
|
3251
|
+
}
|
|
3252
|
+
};
|
|
3253
|
+
|
|
3254
|
+
// src/clients/ServiceClient.tsx
|
|
3255
|
+
var ServerApiError = class extends Error {
|
|
3256
|
+
constructor(data, status) {
|
|
3257
|
+
super(data.message || "---");
|
|
3258
|
+
this.status = status;
|
|
3259
|
+
this.data = data;
|
|
3260
|
+
this.data.isSuccessful = false;
|
|
3261
|
+
}
|
|
3262
|
+
};
|
|
3263
|
+
var ServiceClient = class {
|
|
3264
|
+
constructor(apiBaseUrl, session) {
|
|
3265
|
+
this.cacheManager = CacheManager.getInstance();
|
|
3266
|
+
this.baseUrl = apiBaseUrl;
|
|
3267
|
+
this.session = session;
|
|
3268
|
+
}
|
|
3269
|
+
buildFullPath(path, params) {
|
|
3270
|
+
let updatedPath = path;
|
|
3271
|
+
if (params) {
|
|
3272
|
+
Object.keys(params).forEach((key) => {
|
|
3273
|
+
updatedPath = updatedPath.replace(
|
|
3274
|
+
`{${key}}`,
|
|
3275
|
+
String(params[key])
|
|
3276
|
+
);
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
return this.baseUrl + updatedPath;
|
|
3280
|
+
}
|
|
3281
|
+
getConfig() {
|
|
3282
|
+
const config = { headers: {} };
|
|
3283
|
+
if (this.session) {
|
|
3284
|
+
if (this.session.oAuthToken) {
|
|
3285
|
+
config.headers["Authorization"] = "Bearer " + this.session.oAuthToken;
|
|
3286
|
+
}
|
|
3287
|
+
config.headers["cid"] = this.session.cid || "";
|
|
3288
|
+
config.headers["UserCurrencyCode"] = this.session.userCurrencyCode || "INR";
|
|
3289
|
+
config.headers["MarketCode"] = this.session?.marketCode || "IND";
|
|
3290
|
+
}
|
|
3291
|
+
return config;
|
|
3292
|
+
}
|
|
3293
|
+
handleFetchError(error) {
|
|
3294
|
+
console.log(error);
|
|
3295
|
+
const serverApiError = error;
|
|
3296
|
+
if (serverApiError) {
|
|
3297
|
+
return serverApiError.data;
|
|
3298
|
+
}
|
|
3299
|
+
return {
|
|
3300
|
+
message: "There is some error. Please try after sometime.",
|
|
3301
|
+
isSuccessful: false
|
|
3302
|
+
};
|
|
3303
|
+
}
|
|
3304
|
+
async fetchJsonWithCache(fullPath, config) {
|
|
3305
|
+
const cacheKey = fullPath + "--" + (this.session?.marketCode || "IND");
|
|
3306
|
+
const cachedData = this.cacheManager.get(cacheKey);
|
|
3307
|
+
if (cachedData) {
|
|
3308
|
+
return cachedData;
|
|
3309
|
+
}
|
|
3310
|
+
console.log("*****************CALLING API:", cacheKey, (/* @__PURE__ */ new Date()).toISOString());
|
|
3311
|
+
const response = await fetch(fullPath, { headers: config.headers });
|
|
3312
|
+
if (!response.ok) {
|
|
3313
|
+
const apiErrorData = await response.json();
|
|
3314
|
+
throw new ServerApiError(apiErrorData, response.status);
|
|
3315
|
+
}
|
|
3316
|
+
const cacheControl = response.headers.get("Cache-Control");
|
|
3317
|
+
let revalidate = null;
|
|
3318
|
+
if (cacheControl) {
|
|
3319
|
+
const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
|
|
3320
|
+
if (maxAgeMatch && maxAgeMatch[1]) {
|
|
3321
|
+
const maxAge = parseInt(maxAgeMatch[1], 10);
|
|
3322
|
+
revalidate = maxAge * 1e3;
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
const data = await response.json();
|
|
3326
|
+
data.isSuccessful = true;
|
|
3327
|
+
if (revalidate !== null && revalidate > 0) {
|
|
3328
|
+
console.log("revalidate............I am caching:" + revalidate);
|
|
3329
|
+
this.cacheManager.set(cacheKey, data, revalidate);
|
|
3330
|
+
}
|
|
3331
|
+
return data;
|
|
3332
|
+
}
|
|
3333
|
+
// private async refreshToken(): Promise<void> {
|
|
3334
|
+
// console.log("*******************calling refresh token***********************");
|
|
3335
|
+
// try {
|
|
3336
|
+
// const response = await fetch(this.baseUrl + "/auth/storefront/login/refreshToken", {
|
|
3337
|
+
// method: 'POST',
|
|
3338
|
+
// headers: {
|
|
3339
|
+
// 'Content-Type': 'application/json'
|
|
3340
|
+
// },
|
|
3341
|
+
// body: JSON.stringify({ refreshToken: this.session.refreshToken })
|
|
3342
|
+
// });
|
|
3343
|
+
// if (!response.ok) {
|
|
3344
|
+
// throw new Error("Failed to refresh token");
|
|
3345
|
+
// }
|
|
3346
|
+
// const responseData = await response.json();
|
|
3347
|
+
// this.session.oAuthToken = responseData.result.accessToken;
|
|
3348
|
+
// if (typeof window === "undefined") {
|
|
3349
|
+
// // Running on the server
|
|
3350
|
+
// } else {
|
|
3351
|
+
// await fetch("/api/login", {
|
|
3352
|
+
// method: "post",
|
|
3353
|
+
// headers: {
|
|
3354
|
+
// "Content-Type": "application/json",
|
|
3355
|
+
// },
|
|
3356
|
+
// body: JSON.stringify({ session: this.session }),
|
|
3357
|
+
// });
|
|
3358
|
+
// }
|
|
3359
|
+
// } catch (error: any) {
|
|
3360
|
+
// throw new Error("Failed to refresh token");
|
|
3361
|
+
// }
|
|
3362
|
+
// }
|
|
3363
|
+
async handleRequest(request) {
|
|
3364
|
+
try {
|
|
3365
|
+
return await request();
|
|
3366
|
+
} catch (error) {
|
|
3367
|
+
throw error;
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
async post(path, data) {
|
|
3371
|
+
const request = async () => {
|
|
3372
|
+
const fullPath = this.baseUrl + path;
|
|
3373
|
+
const config = this.getConfig();
|
|
3374
|
+
const response = await fetch(fullPath, {
|
|
3375
|
+
method: "POST",
|
|
3376
|
+
headers: {
|
|
3377
|
+
...config.headers,
|
|
3378
|
+
"Content-Type": "application/json"
|
|
3379
|
+
},
|
|
3380
|
+
body: JSON.stringify(data)
|
|
3381
|
+
});
|
|
3382
|
+
if (!response.ok) {
|
|
3383
|
+
const apiErrorData = await response.json();
|
|
3384
|
+
throw new ServerApiError(apiErrorData, response.status);
|
|
3385
|
+
}
|
|
3386
|
+
const responseData = await response.json();
|
|
3387
|
+
responseData.isSuccessful = true;
|
|
3388
|
+
return responseData;
|
|
3389
|
+
};
|
|
3390
|
+
try {
|
|
3391
|
+
return await this.handleRequest(request);
|
|
3392
|
+
} catch (error) {
|
|
3393
|
+
return this.handleFetchError(error);
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3396
|
+
async getSingle(path, params) {
|
|
3397
|
+
const request = async () => {
|
|
3398
|
+
const sanitizedParams = params ? Object.fromEntries(
|
|
3399
|
+
Object.entries(params).map(([k, v]) => [k, String(v)])
|
|
3400
|
+
) : void 0;
|
|
3401
|
+
const fullPath = this.buildFullPath(path, sanitizedParams);
|
|
3402
|
+
const config = this.getConfig();
|
|
3403
|
+
return await this.fetchJsonWithCache(fullPath, config);
|
|
3404
|
+
};
|
|
3405
|
+
try {
|
|
3406
|
+
return await this.handleRequest(request);
|
|
3407
|
+
} catch (error) {
|
|
3408
|
+
return this.handleFetchError(error);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
async get(path, params) {
|
|
3412
|
+
const request = async () => {
|
|
3413
|
+
const sanitizedParams = params ? Object.fromEntries(
|
|
3414
|
+
Object.entries(params).map(([k, v]) => [k, String(v)])
|
|
3415
|
+
) : void 0;
|
|
3416
|
+
const fullPath = this.buildFullPath(path, sanitizedParams);
|
|
3417
|
+
const config = this.getConfig();
|
|
3418
|
+
console.log(fullPath);
|
|
3419
|
+
return await this.fetchJsonWithCache(fullPath, config);
|
|
3420
|
+
};
|
|
3421
|
+
try {
|
|
3422
|
+
return await this.handleRequest(request);
|
|
3423
|
+
} catch (error) {
|
|
3424
|
+
return this.handleFetchError(error);
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
};
|
|
3428
|
+
var ServiceClient_default = ServiceClient;
|
|
3429
|
+
|
|
3430
|
+
// src/components/pageRenderingEngine/nodes/FormContainerNode.tsx
|
|
3431
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3432
|
+
var FormContainerNode = (props) => {
|
|
3433
|
+
const NodeTypes2 = {
|
|
3434
|
+
["input-control"]: InputControlNode_default
|
|
3435
|
+
};
|
|
3436
|
+
const { node } = props;
|
|
3437
|
+
const formRef = (0, import_react44.useRef)(null);
|
|
3438
|
+
const initialState = {
|
|
3439
|
+
inputValues: {},
|
|
3440
|
+
lastPropertyChanged: ""
|
|
3441
|
+
};
|
|
3442
|
+
const [formState, dispatch] = (0, import_react44.useReducer)(FormReducer_default, initialState);
|
|
3443
|
+
const handleInputChange = (0, import_react44.useCallback)((updatedValues) => {
|
|
3444
|
+
dispatch({ type: FORM_INPUT_UPDATE, name: updatedValues.name, value: updatedValues.value });
|
|
3445
|
+
}, [dispatch]);
|
|
3446
|
+
(0, import_react44.useEffect)(() => {
|
|
3447
|
+
const fetchInitialData = async () => {
|
|
3448
|
+
const client = new ServiceClient_default(props.apiBaseUrl, props.session);
|
|
3449
|
+
const response = await client.getSingle(props.node.dataFetchApi, props.routeParameters);
|
|
3450
|
+
if (response.isSuccessful) {
|
|
3451
|
+
dispatch({
|
|
3452
|
+
type: FORM_INITIAL_UPDATE,
|
|
3453
|
+
values: response.result,
|
|
3454
|
+
// @ts-expect-error custom code
|
|
3455
|
+
name: "all"
|
|
3456
|
+
});
|
|
3457
|
+
}
|
|
3458
|
+
};
|
|
3459
|
+
fetchInitialData();
|
|
3460
|
+
}, [props.apiBaseUrl, props.node, props.session, props.routeParameters]);
|
|
3461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("form", { className: "group space-y-6 pb-6 overflow-y-auto", noValidate: true, ref: formRef, children: [
|
|
3462
|
+
node.children && node.children.map((node2, index) => {
|
|
3463
|
+
{
|
|
3464
|
+
}
|
|
3465
|
+
const SelectedNode = NodeTypes2[node2.type];
|
|
3466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react44.default.Fragment, { children: SelectedNode && node2.type == "input-control" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3467
|
+
InputControlNode_default,
|
|
3468
|
+
{
|
|
3469
|
+
value: formState.inputValues[node2.name],
|
|
3470
|
+
callback: handleInputChange,
|
|
3471
|
+
node: node2
|
|
3472
|
+
}
|
|
3473
|
+
) }, index);
|
|
3474
|
+
}),
|
|
3475
|
+
node.children.length == 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "py-0.5 lg:py-1.5" })
|
|
3476
|
+
] });
|
|
3477
|
+
};
|
|
3478
|
+
var FormContainerNode_default = FormContainerNode;
|
|
3479
|
+
|
|
3480
|
+
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
3481
|
+
var import_react50 = __toESM(require("react"));
|
|
3482
|
+
|
|
3483
|
+
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
3484
|
+
var import_react46 = __toESM(require("react"));
|
|
3485
|
+
|
|
3486
|
+
// src/components/IFrameLoaderView.tsx
|
|
3487
|
+
var import_react45 = __toESM(require("react"));
|
|
3488
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3489
|
+
var IFrameLoaderView = (props) => {
|
|
3490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react45.default.Fragment, { children: [
|
|
3491
|
+
props.isDataFound == null && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "mt-4 bg-gray-200 rounded-md p-4 animate-pulse", children: [
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center mb-4", children: [
|
|
3493
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 h-8 w-8 rounded-full animate-pulse" }),
|
|
3494
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "ml-2", children: [
|
|
3495
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 h-3 w-16 animate-pulse" }),
|
|
3496
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 h-2 w-12 animate-pulse" })
|
|
3497
|
+
] })
|
|
3498
|
+
] }),
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "grid grid-cols-3 gap-4 mt-6", children: [
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "animate-pulse", children: [
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3504
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3505
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3506
|
+
] }),
|
|
3507
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "animate-pulse", children: [
|
|
3508
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3509
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3510
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3511
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3513
|
+
] }),
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "animate-pulse", children: [
|
|
3515
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-12 mb-2" }),
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-24 mb-2" }),
|
|
3517
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-32 mb-2" }),
|
|
3518
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-16 mb-2" }),
|
|
3519
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "bg-gray-300 rounded-full h-3 w-28 mb-2" })
|
|
3520
|
+
] })
|
|
3521
|
+
] })
|
|
3522
|
+
] }) }),
|
|
3523
|
+
props.children
|
|
3524
|
+
] });
|
|
3525
|
+
};
|
|
3526
|
+
var IFrameLoaderView_default = IFrameLoaderView;
|
|
3527
|
+
|
|
3528
|
+
// src/components/pageRenderingEngine/nodes/IframeClient.tsx
|
|
3529
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3530
|
+
var IframeClient = ({ src }) => {
|
|
3531
|
+
const iframeRef = (0, import_react46.useRef)(null);
|
|
3532
|
+
const [iframeHeight, setIframeHeight] = (0, import_react46.useState)("100%");
|
|
3533
|
+
const [isDataFound, setIsDataFound] = (0, import_react46.useState)(null);
|
|
3534
|
+
(0, import_react46.useEffect)(() => {
|
|
3535
|
+
const handleReceiveMessage = (event) => {
|
|
3536
|
+
const eventName = event?.data?.eventName;
|
|
3537
|
+
const payload = event?.data?.payload;
|
|
3538
|
+
if (eventName === "SET_HEIGHT" && payload?.height) {
|
|
3539
|
+
let height = 500;
|
|
3540
|
+
if (payload.height > 500) {
|
|
3541
|
+
height = payload.height + 50;
|
|
3542
|
+
}
|
|
3543
|
+
setIframeHeight(`${height}px`);
|
|
3544
|
+
}
|
|
3545
|
+
};
|
|
3546
|
+
window.addEventListener("message", handleReceiveMessage);
|
|
3547
|
+
return () => window.removeEventListener("message", handleReceiveMessage);
|
|
3548
|
+
}, []);
|
|
3549
|
+
(0, import_react46.useEffect)(() => {
|
|
3550
|
+
const handleResize = () => {
|
|
3551
|
+
if (iframeRef.current) {
|
|
3552
|
+
iframeRef.current.contentWindow?.postMessage({ eventName: "RESIZE" }, "*");
|
|
3553
|
+
}
|
|
3554
|
+
};
|
|
3555
|
+
window.addEventListener("resize", handleResize);
|
|
3556
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
3557
|
+
}, []);
|
|
3558
|
+
const handleIframeLoad = () => {
|
|
3559
|
+
setIsDataFound(true);
|
|
3560
|
+
};
|
|
3561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react46.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(IFrameLoaderView_default, { isDataFound, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
3562
|
+
"iframe",
|
|
3563
|
+
{
|
|
3564
|
+
ref: iframeRef,
|
|
3565
|
+
src,
|
|
3566
|
+
className: "w-full h-full border-none",
|
|
3567
|
+
scrolling: "no",
|
|
3568
|
+
style: { height: iframeHeight },
|
|
3569
|
+
onLoad: handleIframeLoad
|
|
3570
|
+
}
|
|
3571
|
+
) }) });
|
|
3572
|
+
};
|
|
3573
|
+
var IframeClient_default = IframeClient;
|
|
3574
|
+
|
|
3575
|
+
// src/components/pageRenderingEngine/nodes/EmbedNode.tsx
|
|
3576
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3577
|
+
var EmbedNode = (props) => {
|
|
3578
|
+
let src;
|
|
3579
|
+
if (props.node.provider == "youtube") {
|
|
3580
|
+
src = `https://www.youtube-nocookie.com/embed/${props.node.embedSrc}`;
|
|
3581
|
+
} else if (props.node.provider == "bunny") {
|
|
3582
|
+
src = `https://iframe.mediadelivery.net/embed/${props.node.embedSrc}?autoplay=false&loop=false&muted=false&preload=true&responsive=true`;
|
|
3583
|
+
} else {
|
|
3584
|
+
src = props.node.embedSrc;
|
|
3585
|
+
}
|
|
3586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "aspect-video", children: src && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(IframeClient_default, { src }) });
|
|
3587
|
+
};
|
|
3588
|
+
var EmbedNode_default = EmbedNode;
|
|
3589
|
+
|
|
3590
|
+
// src/components/utilities/AssetUtility.tsx
|
|
3591
|
+
var AssetUtility = class {
|
|
3592
|
+
constructor() {
|
|
3593
|
+
}
|
|
3594
|
+
static resolveUrl(apiBaseUrl, url) {
|
|
3595
|
+
if (!url) return void 0;
|
|
3596
|
+
if (url.startsWith("http")) return url;
|
|
3597
|
+
if (!apiBaseUrl) return url;
|
|
3598
|
+
return `${apiBaseUrl}/digitalassets-management/${url}`;
|
|
3599
|
+
}
|
|
3600
|
+
};
|
|
3601
|
+
var AssetUtility_default = AssetUtility;
|
|
3602
|
+
|
|
3603
|
+
// src/components/Slider.tsx
|
|
3604
|
+
var import_react47 = __toESM(require("react"));
|
|
3605
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3606
|
+
var Slider = ({
|
|
3607
|
+
children,
|
|
3608
|
+
slidesToShow = 4,
|
|
3609
|
+
infinite_scroll = false,
|
|
3610
|
+
autoplay = false,
|
|
3611
|
+
autoplay_speed = 3e3,
|
|
3612
|
+
show_arrows = false,
|
|
3613
|
+
show_dots = false,
|
|
3614
|
+
scaleOnHover = false,
|
|
3615
|
+
className = "",
|
|
3616
|
+
arrowClassName = "bg-black/50 hover:bg-black/80 text-white rounded-full w-10 h-10 flex items-center justify-center",
|
|
3617
|
+
dotActiveClassName = "bg-gray-300",
|
|
3618
|
+
dotInactiveClassName = "bg-gray-600",
|
|
3619
|
+
gap,
|
|
3620
|
+
pillStyle = "cumulative",
|
|
3621
|
+
progressPosition = "bottom"
|
|
3622
|
+
}) => {
|
|
3623
|
+
const [currentSlide, setCurrentSlide] = (0, import_react47.useState)(0);
|
|
3624
|
+
const [transition, setTransition] = (0, import_react47.useState)(true);
|
|
3625
|
+
const [slidesToShowState, setSlidesToShowState] = (0, import_react47.useState)(
|
|
3626
|
+
typeof slidesToShow === "number" ? slidesToShow : slidesToShow.large
|
|
3627
|
+
);
|
|
3628
|
+
const [isPlaying, setIsPlaying] = (0, import_react47.useState)(autoplay);
|
|
3629
|
+
(0, import_react47.useEffect)(() => {
|
|
3630
|
+
if (typeof slidesToShow === "number") return;
|
|
3631
|
+
const handleResize = () => {
|
|
3632
|
+
if (window.innerWidth >= 1024) {
|
|
3633
|
+
setSlidesToShowState(slidesToShow.large);
|
|
3634
|
+
} else if (window.innerWidth >= 768) {
|
|
3635
|
+
setSlidesToShowState(slidesToShow.medium);
|
|
3636
|
+
} else {
|
|
3637
|
+
setSlidesToShowState(slidesToShow.small);
|
|
3638
|
+
}
|
|
3639
|
+
};
|
|
3640
|
+
handleResize();
|
|
3641
|
+
window.addEventListener("resize", handleResize);
|
|
3642
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
3643
|
+
}, [slidesToShow]);
|
|
3644
|
+
(0, import_react47.useEffect)(() => {
|
|
3645
|
+
if (!autoplay) return;
|
|
3646
|
+
const timer = setInterval(() => {
|
|
3647
|
+
if (isPlaying) {
|
|
3648
|
+
nextSlide();
|
|
3649
|
+
}
|
|
3650
|
+
}, autoplay_speed);
|
|
3651
|
+
return () => clearInterval(timer);
|
|
3652
|
+
}, [autoplay, autoplay_speed, currentSlide, isPlaying]);
|
|
3653
|
+
const totalSlides = import_react47.Children.count(children);
|
|
3654
|
+
const maxSlide = totalSlides - slidesToShowState;
|
|
3655
|
+
const nextSlide = () => {
|
|
3656
|
+
if (currentSlide >= maxSlide) {
|
|
3657
|
+
if (infinite_scroll) {
|
|
3658
|
+
setTransition(true);
|
|
3659
|
+
setCurrentSlide(0);
|
|
3660
|
+
}
|
|
3661
|
+
} else {
|
|
3662
|
+
setTransition(true);
|
|
3663
|
+
setCurrentSlide(currentSlide + 1);
|
|
3664
|
+
}
|
|
3665
|
+
};
|
|
3666
|
+
const prevSlide = () => {
|
|
3667
|
+
if (currentSlide <= 0) {
|
|
3668
|
+
if (infinite_scroll) {
|
|
3669
|
+
setTransition(true);
|
|
3670
|
+
setCurrentSlide(maxSlide);
|
|
3671
|
+
}
|
|
3672
|
+
} else {
|
|
3673
|
+
setTransition(true);
|
|
3674
|
+
setCurrentSlide(currentSlide - 1);
|
|
3675
|
+
}
|
|
3676
|
+
};
|
|
3677
|
+
const goToSlide = (index) => {
|
|
3678
|
+
setTransition(true);
|
|
3679
|
+
setCurrentSlide(index);
|
|
3680
|
+
};
|
|
3681
|
+
const handlePillClick = (index) => {
|
|
3682
|
+
goToSlide(index);
|
|
3683
|
+
if (autoplay) {
|
|
3684
|
+
setIsPlaying(true);
|
|
3685
|
+
}
|
|
3686
|
+
};
|
|
3687
|
+
const handleMouseEnter = () => {
|
|
3688
|
+
if (autoplay) {
|
|
3689
|
+
setIsPlaying(false);
|
|
3690
|
+
}
|
|
3691
|
+
};
|
|
3692
|
+
const handleMouseLeave = () => {
|
|
3693
|
+
if (autoplay) {
|
|
3694
|
+
setIsPlaying(true);
|
|
3695
|
+
}
|
|
3696
|
+
};
|
|
3697
|
+
const translateX = -currentSlide * (100 / slidesToShowState);
|
|
3698
|
+
const slides = import_react47.Children.map(children, (child, index) => {
|
|
3699
|
+
if (!import_react47.default.isValidElement(child)) return null;
|
|
3700
|
+
const childProps = child.props;
|
|
3701
|
+
const mergedClassName = `${childProps.className ?? ""} w-full`.trim();
|
|
3702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3703
|
+
"div",
|
|
3704
|
+
{
|
|
3705
|
+
className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
|
|
3706
|
+
style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
|
|
3707
|
+
children: (0, import_react47.cloneElement)(child, {
|
|
3708
|
+
className: mergedClassName
|
|
3709
|
+
})
|
|
3710
|
+
},
|
|
3711
|
+
index
|
|
3712
|
+
);
|
|
3713
|
+
});
|
|
3714
|
+
const getProgressPositionClass = () => {
|
|
3715
|
+
switch (progressPosition) {
|
|
3716
|
+
case "top":
|
|
3717
|
+
return "top-4";
|
|
3718
|
+
case "bottom-outside":
|
|
3719
|
+
return "bottom-4 translate-y-full mt-4";
|
|
3720
|
+
case "bottom":
|
|
3721
|
+
default:
|
|
3722
|
+
return "bottom-4";
|
|
3723
|
+
}
|
|
3724
|
+
};
|
|
3725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
3726
|
+
"div",
|
|
3727
|
+
{
|
|
3728
|
+
className: `relative w-full overflow-hidden ${className}`,
|
|
3729
|
+
onMouseEnter: handleMouseEnter,
|
|
3730
|
+
onMouseLeave: handleMouseLeave,
|
|
3731
|
+
children: [
|
|
3732
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3733
|
+
"div",
|
|
3734
|
+
{
|
|
3735
|
+
className: "flex h-full",
|
|
3736
|
+
style: {
|
|
3737
|
+
transition: transition ? "transform 0.5s ease" : "none",
|
|
3738
|
+
transform: `translateX(${translateX}%)`
|
|
3739
|
+
},
|
|
3740
|
+
children: slides
|
|
3741
|
+
}
|
|
3742
|
+
),
|
|
3743
|
+
show_arrows && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
3744
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3745
|
+
ArrowButton,
|
|
3746
|
+
{
|
|
3747
|
+
direction: "left",
|
|
3748
|
+
onClick: prevSlide,
|
|
3749
|
+
visible: infinite_scroll || currentSlide > 0,
|
|
3750
|
+
className: arrowClassName,
|
|
3751
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5 8.25 12l7.5-7.5" }) })
|
|
3752
|
+
}
|
|
3753
|
+
),
|
|
3754
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
3755
|
+
ArrowButton,
|
|
3756
|
+
{
|
|
3757
|
+
direction: "right",
|
|
3758
|
+
onClick: nextSlide,
|
|
3759
|
+
visible: infinite_scroll || currentSlide < maxSlide,
|
|
3760
|
+
className: arrowClassName,
|
|
3761
|
+
children: [
|
|
3762
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m8.25 4.5 7.5 7.5-7.5 7.5" }) }),
|
|
3763
|
+
" "
|
|
3764
|
+
]
|
|
3765
|
+
}
|
|
3766
|
+
)
|
|
3767
|
+
] }),
|
|
3768
|
+
show_dots && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: `absolute left-1/2 -translate-x-1/2 flex justify-center space-x-1.5 ${getProgressPositionClass()}`, children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3769
|
+
ProgressPill,
|
|
3770
|
+
{
|
|
3771
|
+
active: index === currentSlide,
|
|
3772
|
+
duration: autoplay_speed,
|
|
3773
|
+
index,
|
|
3774
|
+
onClick: () => handlePillClick(index),
|
|
3775
|
+
isPlaying: isPlaying && index === currentSlide && autoplay,
|
|
3776
|
+
style: pillStyle,
|
|
3777
|
+
activeClassName: dotActiveClassName,
|
|
3778
|
+
inactiveClassName: dotInactiveClassName,
|
|
3779
|
+
currentSlide,
|
|
3780
|
+
totalSlides
|
|
3781
|
+
},
|
|
3782
|
+
index
|
|
3783
|
+
)) })
|
|
3784
|
+
]
|
|
3785
|
+
}
|
|
3786
|
+
);
|
|
3787
|
+
};
|
|
3788
|
+
var ArrowButton = ({
|
|
3789
|
+
direction,
|
|
3790
|
+
onClick,
|
|
3791
|
+
visible,
|
|
3792
|
+
children,
|
|
3793
|
+
className = ""
|
|
3794
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3795
|
+
"button",
|
|
3796
|
+
{
|
|
3797
|
+
className: `
|
|
3798
|
+
absolute top-1/2 -translate-y-1/2 z-10
|
|
3799
|
+
${direction === "left" ? "left-2.5" : "right-2.5"}
|
|
3800
|
+
${!visible && "hidden"}
|
|
3801
|
+
${className}
|
|
3802
|
+
`,
|
|
3803
|
+
onClick,
|
|
3804
|
+
"aria-label": direction === "left" ? "Previous slide" : "Next slide",
|
|
3805
|
+
children
|
|
3806
|
+
}
|
|
3807
|
+
);
|
|
3808
|
+
var ProgressPill = ({
|
|
3809
|
+
active,
|
|
3810
|
+
duration,
|
|
3811
|
+
index,
|
|
3812
|
+
onClick,
|
|
3813
|
+
isPlaying,
|
|
3814
|
+
style = "modern",
|
|
3815
|
+
activeClassName = "",
|
|
3816
|
+
inactiveClassName = "",
|
|
3817
|
+
currentSlide,
|
|
3818
|
+
totalSlides
|
|
3819
|
+
}) => {
|
|
3820
|
+
const [progress, setProgress] = (0, import_react47.useState)(0);
|
|
3821
|
+
(0, import_react47.useEffect)(() => {
|
|
3822
|
+
if (active) {
|
|
3823
|
+
setProgress(0);
|
|
3824
|
+
}
|
|
3825
|
+
}, [active, index]);
|
|
3826
|
+
(0, import_react47.useEffect)(() => {
|
|
3827
|
+
if (!active || !isPlaying) {
|
|
3828
|
+
if (!active) {
|
|
3829
|
+
setProgress(0);
|
|
3830
|
+
}
|
|
3831
|
+
return;
|
|
3832
|
+
}
|
|
3833
|
+
const startTime = Date.now();
|
|
3834
|
+
const interval = setInterval(() => {
|
|
3835
|
+
const elapsed = Date.now() - startTime;
|
|
3836
|
+
const newProgress = elapsed / duration * 100;
|
|
3837
|
+
if (newProgress >= 100) {
|
|
3838
|
+
setProgress(100);
|
|
3839
|
+
clearInterval(interval);
|
|
3840
|
+
} else {
|
|
3841
|
+
setProgress(newProgress);
|
|
3842
|
+
}
|
|
3843
|
+
}, 50);
|
|
3844
|
+
return () => clearInterval(interval);
|
|
3845
|
+
}, [active, isPlaying, duration, index]);
|
|
3846
|
+
const isFilled = index < currentSlide;
|
|
3847
|
+
const isActive = index === currentSlide;
|
|
3848
|
+
const shouldShowProgress = isActive || style === "cumulative" && isFilled;
|
|
3849
|
+
const baseClasses = "cursor-pointer transition-all duration-300 ease-out";
|
|
3850
|
+
const getStyleClasses = () => {
|
|
3851
|
+
switch (style) {
|
|
3852
|
+
case "minimal":
|
|
3853
|
+
return `
|
|
3854
|
+
${isActive ? "w-8" : "w-2"} h-2 rounded-full
|
|
3855
|
+
${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
|
|
3856
|
+
hover:scale-110
|
|
3857
|
+
`;
|
|
3858
|
+
case "cumulative":
|
|
3859
|
+
return `
|
|
3860
|
+
w-4 h-1 rounded-full overflow-hidden relative
|
|
3861
|
+
${isFilled ? activeClassName || "bg-white" : inactiveClassName || "bg-white/30"}
|
|
3862
|
+
`;
|
|
3863
|
+
case "modern":
|
|
3864
|
+
return `
|
|
3865
|
+
w-8 h-1.5 rounded-full overflow-hidden relative
|
|
3866
|
+
${isActive ? inactiveClassName || "bg-white/30" : inactiveClassName || "bg-white/30"}
|
|
3867
|
+
hover:h-2
|
|
3868
|
+
`;
|
|
3869
|
+
case "default":
|
|
3870
|
+
default:
|
|
3871
|
+
return `
|
|
3872
|
+
w-6 h-1.5 rounded-full
|
|
3873
|
+
${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
|
|
3874
|
+
hover:w-8
|
|
3875
|
+
`;
|
|
3876
|
+
}
|
|
3877
|
+
};
|
|
3878
|
+
const renderProgressBar = () => {
|
|
3879
|
+
if (style === "modern" && isActive || style === "cumulative" && shouldShowProgress) {
|
|
3880
|
+
const displayProgress = style === "cumulative" && isFilled ? 100 : progress;
|
|
3881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3882
|
+
"div",
|
|
3883
|
+
{
|
|
3884
|
+
className: `absolute top-0 left-0 h-full rounded-full ${style === "cumulative" && isFilled ? activeClassName || "bg-white" : activeClassName || "bg-white"} transition-all duration-50 ease-linear`,
|
|
3885
|
+
style: { width: `${displayProgress}%` }
|
|
3886
|
+
}
|
|
3887
|
+
);
|
|
3888
|
+
}
|
|
3889
|
+
return null;
|
|
3890
|
+
};
|
|
3891
|
+
const renderCumulativeFill = () => {
|
|
3892
|
+
if (style === "cumulative" && isFilled && !isActive) {
|
|
3893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3894
|
+
"div",
|
|
3895
|
+
{
|
|
3896
|
+
className: `absolute top-0 left-0 h-full rounded-full ${activeClassName || "bg-white"} transition-all duration-300`,
|
|
3897
|
+
style: { width: "100%" }
|
|
3898
|
+
}
|
|
3899
|
+
);
|
|
3900
|
+
}
|
|
3901
|
+
return null;
|
|
3902
|
+
};
|
|
3903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
3904
|
+
"button",
|
|
3905
|
+
{
|
|
3906
|
+
className: `${baseClasses} ${getStyleClasses()}`,
|
|
3907
|
+
onClick,
|
|
3908
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
3909
|
+
"aria-current": isActive ? "true" : "false",
|
|
3910
|
+
children: [
|
|
3911
|
+
renderProgressBar(),
|
|
3912
|
+
renderCumulativeFill()
|
|
3913
|
+
]
|
|
3914
|
+
}
|
|
3915
|
+
);
|
|
3916
|
+
};
|
|
3917
|
+
var Slider_default = Slider;
|
|
3918
|
+
|
|
3919
|
+
// src/components/utilities/AnimationUtility.tsx
|
|
3920
|
+
var AnimationUtility = class {
|
|
3921
|
+
static generateAnimationCSS(config, guid) {
|
|
3922
|
+
const {
|
|
3923
|
+
duration = 700,
|
|
3924
|
+
delay = 0,
|
|
3925
|
+
easing = "ease-out",
|
|
3926
|
+
distance = 30,
|
|
3927
|
+
scaleStart = 1,
|
|
3928
|
+
scaleEnd = 1.2,
|
|
3929
|
+
repeat = 1,
|
|
3930
|
+
intensity = 20,
|
|
3931
|
+
speedPerChar = 100,
|
|
3932
|
+
cursor = true,
|
|
3933
|
+
mode = "enter",
|
|
3934
|
+
direction = "left"
|
|
3935
|
+
// Default direction
|
|
3936
|
+
} = config;
|
|
3937
|
+
let base = "", visible = "", keyframes = "";
|
|
3938
|
+
switch (config.animation) {
|
|
3939
|
+
case "Fade":
|
|
3940
|
+
base = `opacity:0; transition:opacity ${duration}ms ${easing} ${delay}ms;`;
|
|
3941
|
+
visible = `opacity:1;`;
|
|
3942
|
+
break;
|
|
3943
|
+
case "FadeInUp":
|
|
3944
|
+
base = `opacity:0; transform:translateY(${distance}px); transition:all ${duration}ms ${easing} ${delay}ms;`;
|
|
3945
|
+
visible = `opacity:1; transform:translateY(0);`;
|
|
3946
|
+
break;
|
|
3947
|
+
case "Slide":
|
|
3948
|
+
const slideTransform = this.getSlideTransform(direction, distance);
|
|
3949
|
+
base = `opacity:0; transform:${slideTransform.start}; transition:all ${duration}ms ${easing} ${delay}ms; will-change: transform, opacity;`;
|
|
3950
|
+
visible = `opacity:1; transform:${slideTransform.end}; will-change: unset;`;
|
|
3951
|
+
break;
|
|
3952
|
+
case "ZoomIn":
|
|
3953
|
+
if (mode === "enter") {
|
|
3954
|
+
base = `opacity:0; transform:scale(${scaleStart}); transition:all ${duration}ms ${easing} ${delay}ms;`;
|
|
3955
|
+
visible = `opacity:1; transform:scale(${scaleEnd});`;
|
|
3956
|
+
} else {
|
|
3957
|
+
base = `transform:scale(${scaleStart}); transition:transform ${duration / 1e3}s ${easing} ${delay / 1e3}s;`;
|
|
3958
|
+
visible = `transform:scale(${scaleEnd});`;
|
|
3959
|
+
}
|
|
3960
|
+
break;
|
|
3961
|
+
case "Bounce":
|
|
3962
|
+
keyframes = `
|
|
3963
|
+
@keyframes bounce {
|
|
3964
|
+
0%,20%,50%,80%,100% { transform: translateY(0); }
|
|
3965
|
+
40% { transform: translateY(-${intensity}px); }
|
|
3966
|
+
60% { transform: translateY(-${intensity / 2}px); }
|
|
3967
|
+
}
|
|
3968
|
+
`;
|
|
3969
|
+
if (mode === "enter") {
|
|
3970
|
+
base = `opacity:0;`;
|
|
3971
|
+
visible = `opacity:1; animation:bounce ${duration}ms ${easing} ${delay}ms ${repeat};`;
|
|
3972
|
+
} else {
|
|
3973
|
+
base = ``;
|
|
3974
|
+
visible = `animation:bounce ${duration / 1e3}s ${easing} ${delay / 1e3}s ${repeat};`;
|
|
3975
|
+
}
|
|
3976
|
+
break;
|
|
3977
|
+
case "Typewriter":
|
|
3978
|
+
keyframes = `
|
|
3979
|
+
@keyframes typewriter { from { width: 0 } to { width: 100% } }
|
|
3980
|
+
@keyframes blink { 50% { border-color: transparent } }
|
|
3981
|
+
`;
|
|
3982
|
+
base = `
|
|
3983
|
+
overflow:hidden;
|
|
3984
|
+
border-right:${cursor ? "2px solid black" : "none"};
|
|
3985
|
+
white-space:nowrap;
|
|
3986
|
+
width:0;
|
|
3987
|
+
margin:0 auto;
|
|
3988
|
+
`;
|
|
3989
|
+
visible = `
|
|
3990
|
+
animation:typewriter ${speedPerChar * 30}ms steps(30,end) ${delay}ms forwards
|
|
3991
|
+
${cursor ? ", blink .75s step-end infinite" : ""};
|
|
3992
|
+
`;
|
|
3993
|
+
break;
|
|
3994
|
+
}
|
|
3995
|
+
if (mode === "hover") {
|
|
3996
|
+
return `
|
|
3997
|
+
${keyframes}
|
|
3998
|
+
${guid} { ${base} }
|
|
3999
|
+
${guid}:hover { ${visible} }
|
|
4000
|
+
`;
|
|
4001
|
+
} else {
|
|
4002
|
+
return `
|
|
4003
|
+
${keyframes}
|
|
4004
|
+
${guid} { ${base} }
|
|
4005
|
+
${guid}.visible { ${visible} }
|
|
4006
|
+
`;
|
|
4007
|
+
}
|
|
4008
|
+
}
|
|
4009
|
+
// Helper method to generate slide transforms based on direction
|
|
4010
|
+
static getSlideTransform(direction, distance) {
|
|
4011
|
+
switch (direction) {
|
|
4012
|
+
case "left":
|
|
4013
|
+
return { start: `translateX(${distance}px)`, end: `translateX(0)` };
|
|
4014
|
+
case "right":
|
|
4015
|
+
return { start: `translateX(-${distance}px)`, end: `translateX(0)` };
|
|
4016
|
+
case "up":
|
|
4017
|
+
return { start: `translateY(${distance}px)`, end: `translateY(0)` };
|
|
4018
|
+
case "down":
|
|
4019
|
+
return { start: `translateY(-${distance}px)`, end: `translateY(0)` };
|
|
4020
|
+
default:
|
|
4021
|
+
return { start: `translateX(${distance}px)`, end: `translateX(0)` };
|
|
4022
|
+
}
|
|
4023
|
+
}
|
|
4024
|
+
};
|
|
4025
|
+
var AnimationUtility_default = AnimationUtility;
|
|
4026
|
+
|
|
4027
|
+
// src/components/pageRenderingEngine/nodes/EnterAnimationClient.tsx
|
|
4028
|
+
var import_react48 = __toESM(require("react"));
|
|
4029
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4030
|
+
function EnterAnimationClient({ hasEnterAnimation, children }) {
|
|
4031
|
+
const ref = (0, import_react48.useRef)(null);
|
|
4032
|
+
(0, import_react48.useEffect)(() => {
|
|
4033
|
+
if (!hasEnterAnimation || !ref.current) return;
|
|
4034
|
+
const observer = new IntersectionObserver(
|
|
4035
|
+
(entries) => {
|
|
4036
|
+
entries.forEach((entry) => {
|
|
4037
|
+
if (entry.isIntersecting) {
|
|
4038
|
+
entry.target.classList.add("visible");
|
|
4039
|
+
observer.unobserve(entry.target);
|
|
4040
|
+
}
|
|
4041
|
+
});
|
|
4042
|
+
},
|
|
4043
|
+
{ threshold: 0.1 }
|
|
4044
|
+
);
|
|
4045
|
+
observer.observe(ref.current);
|
|
4046
|
+
return () => observer.disconnect();
|
|
4047
|
+
}, [hasEnterAnimation]);
|
|
4048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: children && // enforce passing the ref to Wrapper
|
|
4049
|
+
//@ts-ignore
|
|
4050
|
+
import_react48.default.cloneElement(children, { ref }) });
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
// src/components/utilities/PathUtility.tsx
|
|
4054
|
+
var PathUtility = class {
|
|
4055
|
+
constructor() {
|
|
4056
|
+
}
|
|
4057
|
+
normalizePath(path) {
|
|
4058
|
+
if (path == null) {
|
|
4059
|
+
return "/";
|
|
4060
|
+
}
|
|
4061
|
+
const trimmedPath = path.replace(/^\/|\/$/g, "");
|
|
4062
|
+
return trimmedPath === "" ? "/" : "/" + trimmedPath + "/";
|
|
4063
|
+
}
|
|
4064
|
+
joinAndNormalizePaths(path1, path2) {
|
|
4065
|
+
path1 = path1.replace(/\/$/, "");
|
|
4066
|
+
path2 = path2.replace(/^\//, "");
|
|
4067
|
+
const joinedPath = `${path1}/${path2}`;
|
|
4068
|
+
const normalizedPath = joinedPath.replace(/\/{2,}/g, "/");
|
|
4069
|
+
return normalizedPath === "" ? "/" : "/" + normalizedPath;
|
|
4070
|
+
}
|
|
4071
|
+
removeLeadingAndTrailingSlashes(path) {
|
|
4072
|
+
if (path == null) {
|
|
4073
|
+
return "/";
|
|
4074
|
+
}
|
|
4075
|
+
const trimmedPath = path.replace(/^\/|\/$/g, "");
|
|
4076
|
+
return trimmedPath;
|
|
4077
|
+
}
|
|
4078
|
+
removeTrailingSlash(path) {
|
|
4079
|
+
if (path == null) {
|
|
4080
|
+
return "/";
|
|
4081
|
+
}
|
|
4082
|
+
const trimmedPath = path.replace(/\/$/, "");
|
|
4083
|
+
return trimmedPath;
|
|
4084
|
+
}
|
|
4085
|
+
joinPaths(path1, path2) {
|
|
4086
|
+
if (!path1.endsWith("/") && !path2.startsWith("/")) {
|
|
4087
|
+
return `${path1}/${path2}`;
|
|
4088
|
+
} else if (path1.endsWith("/") && path2.startsWith("/")) {
|
|
4089
|
+
return `${path1}${path2.substr(1)}`;
|
|
4090
|
+
} else {
|
|
4091
|
+
return `${path1}${path2}`;
|
|
4092
|
+
}
|
|
4093
|
+
}
|
|
4094
|
+
getFirstSegment(path) {
|
|
4095
|
+
if (!path || path === "/") {
|
|
4096
|
+
return "";
|
|
4097
|
+
}
|
|
4098
|
+
const segments = path.split("/").filter(Boolean);
|
|
4099
|
+
return segments.length > 0 ? segments[0] : "";
|
|
4100
|
+
}
|
|
4101
|
+
};
|
|
4102
|
+
var PathUtility_default = new PathUtility();
|
|
4103
|
+
|
|
4104
|
+
// src/components/NoDataFound.tsx
|
|
4105
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4106
|
+
var NoDataFound = () => {
|
|
4107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center bg-neutral-weak", children: [
|
|
4108
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "mb-5", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "mx-auto w-20 h-20 rounded-full flex items-center justify-center bg-neutral-soft", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4109
|
+
"svg",
|
|
4110
|
+
{
|
|
4111
|
+
className: "w-10 h-10",
|
|
4112
|
+
fill: "none",
|
|
4113
|
+
stroke: "currentColor",
|
|
4114
|
+
viewBox: "0 0 24 24",
|
|
4115
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4117
|
+
"path",
|
|
4118
|
+
{
|
|
4119
|
+
strokeLinecap: "round",
|
|
4120
|
+
strokeLinejoin: "round",
|
|
4121
|
+
strokeWidth: "1.5",
|
|
4122
|
+
d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
|
|
4123
|
+
}
|
|
4124
|
+
)
|
|
4125
|
+
}
|
|
4126
|
+
) }) }),
|
|
4127
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("h3", { className: "text-lg font-medium mb-2", children: "No data available" }),
|
|
4128
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("p", { className: " max-w-sm mb-0", children: "No records found. Data may be empty or not available at the moment." })
|
|
4129
|
+
] });
|
|
4130
|
+
};
|
|
4131
|
+
var NoDataFound_default = NoDataFound;
|
|
4132
|
+
|
|
4133
|
+
// src/components/Pagination.tsx
|
|
4134
|
+
var import_react49 = require("react");
|
|
4135
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4136
|
+
var Pagination = (props) => {
|
|
4137
|
+
const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
|
|
4138
|
+
const builder = (0, import_react49.useMemo)(() => {
|
|
4139
|
+
const b = new OdataBuilder(path);
|
|
4140
|
+
if (query) b.setQuery(query);
|
|
4141
|
+
return b;
|
|
4142
|
+
}, [path, query]);
|
|
4143
|
+
const activePageNumber = builder.getPageNumber(Constants.pagesize);
|
|
4144
|
+
const totalItems = dataset?.count || 0;
|
|
4145
|
+
const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
|
|
4146
|
+
const totalPages = Math.ceil(totalItems / itemsPerPage);
|
|
4147
|
+
const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
|
|
4148
|
+
const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
|
|
4149
|
+
const getPaginationRange = () => {
|
|
4150
|
+
const delta = 1;
|
|
4151
|
+
const range = [];
|
|
4152
|
+
if (totalPages <= 7) {
|
|
4153
|
+
return Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
4154
|
+
}
|
|
4155
|
+
range.push(1);
|
|
4156
|
+
let start = Math.max(2, activePageNumber - delta);
|
|
4157
|
+
let end = Math.min(totalPages - 1, activePageNumber + delta);
|
|
4158
|
+
if (activePageNumber - delta <= 2) {
|
|
4159
|
+
end = Math.min(totalPages - 1, 4);
|
|
4160
|
+
}
|
|
4161
|
+
if (activePageNumber + delta >= totalPages - 1) {
|
|
4162
|
+
start = Math.max(2, totalPages - 4);
|
|
4163
|
+
}
|
|
4164
|
+
if (start > 2) {
|
|
4165
|
+
range.push("...");
|
|
4166
|
+
}
|
|
4167
|
+
for (let i = start; i <= end; i++) {
|
|
4168
|
+
range.push(i);
|
|
4169
|
+
}
|
|
4170
|
+
if (end < totalPages - 1) {
|
|
4171
|
+
range.push("...");
|
|
4172
|
+
}
|
|
4173
|
+
if (totalPages > 1) {
|
|
4174
|
+
range.push(totalPages);
|
|
4175
|
+
}
|
|
4176
|
+
return range;
|
|
4177
|
+
};
|
|
4178
|
+
const paginationRange = getPaginationRange();
|
|
4179
|
+
const PageButton = ({ page, children }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4180
|
+
Hyperlink,
|
|
4181
|
+
{
|
|
4182
|
+
linkType: "Link" /* Link */,
|
|
4183
|
+
className: `
|
|
4184
|
+
min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
|
|
4185
|
+
border text-sm font-medium transition-colors duration-150
|
|
4186
|
+
${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
|
|
4187
|
+
`,
|
|
4188
|
+
href: builder.getNewPageUrl(page),
|
|
4189
|
+
children
|
|
4190
|
+
}
|
|
4191
|
+
);
|
|
4192
|
+
const NavigationButton = ({ page, disabled, children }) => {
|
|
4193
|
+
if (disabled) {
|
|
4194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
|
|
4195
|
+
}
|
|
4196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4197
|
+
Hyperlink,
|
|
4198
|
+
{
|
|
4199
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
|
|
4200
|
+
href: builder.getNewPageUrl(page),
|
|
4201
|
+
children
|
|
4202
|
+
}
|
|
4203
|
+
);
|
|
4204
|
+
};
|
|
4205
|
+
if (totalPages <= 1 && totalItems === 0) return null;
|
|
4206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "py-6 border-t bg-default", children: [
|
|
4207
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "text-sm", children: [
|
|
4209
|
+
"Showing ",
|
|
4210
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: "font-semibold", children: [
|
|
4211
|
+
startItem,
|
|
4212
|
+
"-",
|
|
4213
|
+
endItem
|
|
4214
|
+
] }),
|
|
4215
|
+
" ",
|
|
4216
|
+
"out of ",
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
|
|
4218
|
+
" results"
|
|
4219
|
+
] }),
|
|
4220
|
+
totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center space-x-1", children: [
|
|
4221
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4222
|
+
NavigationButton,
|
|
4223
|
+
{
|
|
4224
|
+
page: activePageNumber - 1,
|
|
4225
|
+
disabled: activePageNumber === 1,
|
|
4226
|
+
children: [
|
|
4227
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
|
|
4228
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-sm", children: "Prev" })
|
|
4229
|
+
]
|
|
4230
|
+
}
|
|
4231
|
+
),
|
|
4232
|
+
paginationRange.map((item, index) => {
|
|
4233
|
+
if (item === "...") {
|
|
4234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4235
|
+
"span",
|
|
4236
|
+
{
|
|
4237
|
+
className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
|
|
4238
|
+
children: "..."
|
|
4239
|
+
},
|
|
4240
|
+
`ellipsis-${index}`
|
|
4241
|
+
);
|
|
4242
|
+
}
|
|
4243
|
+
const page = item;
|
|
4244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(PageButton, { page, children: page }, page);
|
|
4245
|
+
}),
|
|
4246
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4247
|
+
NavigationButton,
|
|
4248
|
+
{
|
|
4249
|
+
page: activePageNumber + 1,
|
|
4250
|
+
disabled: activePageNumber === totalPages,
|
|
4251
|
+
children: [
|
|
4252
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-sm", children: "Next" }),
|
|
4253
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
|
|
4254
|
+
]
|
|
4255
|
+
}
|
|
4256
|
+
)
|
|
4257
|
+
] }),
|
|
4258
|
+
showJumpToPage && totalPages > 5 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
4259
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-sm", children: "Go to:" }),
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4261
|
+
"input",
|
|
4262
|
+
{
|
|
4263
|
+
type: "number",
|
|
4264
|
+
min: "1",
|
|
4265
|
+
max: totalPages,
|
|
4266
|
+
defaultValue: activePageNumber,
|
|
4267
|
+
className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
|
|
4268
|
+
onKeyDown: (e) => {
|
|
4269
|
+
if (e.key === "Enter") {
|
|
4270
|
+
const input = e.target;
|
|
4271
|
+
const page = parseInt(input.value);
|
|
4272
|
+
if (page >= 1 && page <= totalPages && page !== activePageNumber) {
|
|
4273
|
+
window.location.href = builder.getNewPageUrl(page);
|
|
4274
|
+
}
|
|
4275
|
+
}
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
) })
|
|
4279
|
+
] })
|
|
4280
|
+
] }),
|
|
4281
|
+
showPageSizeSelector && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center justify-center space-x-2", children: [
|
|
4282
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-sm", children: "Show:" }),
|
|
4283
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
4284
|
+
Hyperlink,
|
|
4285
|
+
{
|
|
4286
|
+
className: `
|
|
4287
|
+
px-3 py-1 text-sm rounded border transition-colors duration-150
|
|
4288
|
+
${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
|
|
4289
|
+
`,
|
|
4290
|
+
href: builder.getNewPageSizeUrl(size),
|
|
4291
|
+
children: size
|
|
4292
|
+
},
|
|
4293
|
+
size
|
|
4294
|
+
)) }),
|
|
4295
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-sm", children: "per page" })
|
|
4296
|
+
] }) })
|
|
4297
|
+
] });
|
|
4298
|
+
};
|
|
4299
|
+
var Pagination_default = Pagination;
|
|
4300
|
+
|
|
4301
|
+
// src/components/pageRenderingEngine/nodes/DivContainer.tsx
|
|
4302
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4303
|
+
function toCamelCase(str) {
|
|
4304
|
+
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
4305
|
+
}
|
|
4306
|
+
function convertKeysToCamelCase(obj) {
|
|
4307
|
+
if (!obj || typeof obj !== "object") return obj;
|
|
4308
|
+
if (Array.isArray(obj)) return obj.map(convertKeysToCamelCase);
|
|
4309
|
+
return Object.fromEntries(
|
|
4310
|
+
Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [
|
|
4311
|
+
toCamelCase(key),
|
|
4312
|
+
convertKeysToCamelCase(value)
|
|
4313
|
+
])
|
|
4314
|
+
);
|
|
4315
|
+
}
|
|
4316
|
+
var getNestedValue = (obj, path) => {
|
|
4317
|
+
if (!obj || !path) return void 0;
|
|
4318
|
+
return path.split(".").reduce((current, key) => {
|
|
4319
|
+
{
|
|
4320
|
+
}
|
|
4321
|
+
return current && current[key] !== void 0 ? current[key] : void 0;
|
|
4322
|
+
}, obj);
|
|
4323
|
+
};
|
|
4324
|
+
{
|
|
4325
|
+
}
|
|
4326
|
+
function generateCompleteBackgroundString(layers, apiBaseUrl) {
|
|
4327
|
+
if (!layers || !Array.isArray(layers)) return "";
|
|
4328
|
+
return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
|
|
4329
|
+
if (layer.type === "image" && typeof layer.value === "object") {
|
|
4330
|
+
const imageValue = layer.value;
|
|
4331
|
+
if (!imageValue.assetUrl) return "";
|
|
4332
|
+
const url = `url('${AssetUtility_default.resolveUrl(
|
|
4333
|
+
apiBaseUrl,
|
|
4334
|
+
imageValue.assetUrl
|
|
4335
|
+
)}')`;
|
|
4336
|
+
const repeat = layer.repeat || "no-repeat";
|
|
4337
|
+
const position = layer.position || "center";
|
|
4338
|
+
const size = layer.size || "auto";
|
|
4339
|
+
const attachment = layer.attachment || "scroll";
|
|
4340
|
+
return `${url} ${position} / ${size} ${repeat} ${attachment}`;
|
|
4341
|
+
}
|
|
4342
|
+
if (layer.type === "gradient" && typeof layer.value === "object") {
|
|
4343
|
+
const gradient = layer.value;
|
|
4344
|
+
if (!gradient.colors || !gradient.direction) return "";
|
|
4345
|
+
const colors = gradient.colors.map(
|
|
4346
|
+
(colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
|
|
4347
|
+
).join(", ");
|
|
4348
|
+
return `linear-gradient(${gradient.direction}, ${colors})`;
|
|
4349
|
+
}
|
|
4350
|
+
return "";
|
|
4351
|
+
}).filter((bg) => bg.trim() !== "").join(", ");
|
|
4352
|
+
}
|
|
4353
|
+
var generateCssString = (guid, stylesObject, mobileStylesObject) => {
|
|
4354
|
+
{
|
|
4355
|
+
}
|
|
4356
|
+
const gridColumns = stylesObject.gridTemplateColumns ? stylesObject.gridTemplateColumns.match(/\d+/g) : [];
|
|
4357
|
+
const hasGridProperties = gridColumns.length > 0;
|
|
4358
|
+
const largeCols = hasGridProperties ? parseInt(gridColumns[0]) : 4;
|
|
4359
|
+
const tabletColumns = hasGridProperties ? Math.ceil(parseInt(gridColumns[0]) / 2) : 2;
|
|
4360
|
+
const mobileColumns = 1;
|
|
4361
|
+
{
|
|
4362
|
+
}
|
|
4363
|
+
const cssRules = Object.entries(stylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
|
|
4364
|
+
const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
4365
|
+
return `${cssKey}: ${value};`;
|
|
4366
|
+
});
|
|
4367
|
+
let css = `#${guid} {
|
|
4368
|
+
${cssRules.join(
|
|
4369
|
+
"\n"
|
|
4370
|
+
)}
|
|
4371
|
+
transition: all 0.3s ease-in-out; }`;
|
|
4372
|
+
if (mobileStylesObject) {
|
|
4373
|
+
const mobileCssRules = Object.entries(mobileStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
|
|
4374
|
+
const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
4375
|
+
return `${cssKey}: ${value};`;
|
|
4376
|
+
});
|
|
4377
|
+
if (mobileCssRules.length > 0) {
|
|
4378
|
+
css += `
|
|
4379
|
+
@media (max-width: 480px) { #${guid} {
|
|
4380
|
+
${mobileCssRules.join(
|
|
4381
|
+
"\n"
|
|
4382
|
+
)}
|
|
4383
|
+
} }`;
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
if (hasGridProperties) {
|
|
4387
|
+
css += `
|
|
4388
|
+
@media (max-width: 1279px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
|
|
4389
|
+
css += `
|
|
4390
|
+
@media (max-width: 768px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
|
|
4391
|
+
css += `
|
|
4392
|
+
@media (max-width: 480px) { #${guid} { grid-template-columns: repeat(${mobileColumns}, minmax(0, 1fr)); } }`;
|
|
4393
|
+
}
|
|
4394
|
+
const output = {
|
|
4395
|
+
css,
|
|
4396
|
+
gridColsLarge: largeCols,
|
|
4397
|
+
gridColsMedium: tabletColumns,
|
|
4398
|
+
gridColsSmall: mobileColumns
|
|
4399
|
+
};
|
|
4400
|
+
return output;
|
|
4401
|
+
};
|
|
4402
|
+
var DivContainer = async (props) => {
|
|
4403
|
+
const NodeTypes2 = {
|
|
4404
|
+
paragraph: ParagraphNode_default,
|
|
4405
|
+
heading: HeadingNode_default,
|
|
4406
|
+
list: ListNode_default,
|
|
4407
|
+
quote: QuoteNode_default,
|
|
4408
|
+
code: CodeNode_default,
|
|
4409
|
+
image: ImageNode_default,
|
|
4410
|
+
horizontalrule: HorizontalRuleNode_default,
|
|
4411
|
+
widget: WidgetNode_default,
|
|
4412
|
+
embed: EmbedNode_default,
|
|
4413
|
+
"div-container": DivContainer,
|
|
4414
|
+
text: TextNode_default,
|
|
4415
|
+
datafield: DatafieldNode_default,
|
|
4416
|
+
"svg-icon": SVGIconNode_default
|
|
4417
|
+
};
|
|
4418
|
+
const styles = props.node.cssProperties;
|
|
4419
|
+
const mobileStyles = props.node.mobileCssProperties;
|
|
4420
|
+
const dataBindingProperties = props.node.dataBinding;
|
|
4421
|
+
const updatedStyles = convertKeysToCamelCase(styles);
|
|
4422
|
+
const background = generateCompleteBackgroundString(props.node.backgroundLayers, props.apiBaseUrl);
|
|
4423
|
+
let containerPaddingClass = "";
|
|
4424
|
+
if (props.node.containerPadding == "small") {
|
|
4425
|
+
containerPaddingClass = "container-small";
|
|
4426
|
+
} else if (props.node.containerPadding == "large") {
|
|
4427
|
+
containerPaddingClass = "container-large";
|
|
4428
|
+
}
|
|
4429
|
+
{
|
|
4430
|
+
}
|
|
4431
|
+
const updatedStyle = { ...updatedStyles };
|
|
4432
|
+
const backgroundStyle = background && background !== "" ? { background } : {};
|
|
4433
|
+
const combinedStyles = {
|
|
4434
|
+
...backgroundStyle
|
|
4435
|
+
};
|
|
4436
|
+
if (props.node.enableBackgroundClipText) {
|
|
4437
|
+
combinedStyles.WebkitBackgroundClip = "text";
|
|
4438
|
+
combinedStyles.backgroundClip = "text";
|
|
4439
|
+
}
|
|
4440
|
+
const guid = "css" + crypto.randomUUID().toLocaleLowerCase();
|
|
4441
|
+
const { enterAnimation, exitAnimation, hoverAnimation } = props.node;
|
|
4442
|
+
let animationCSS = "";
|
|
4443
|
+
if (enterAnimation?.name) {
|
|
4444
|
+
animationCSS += AnimationUtility_default.generateAnimationCSS(
|
|
4445
|
+
{ animation: enterAnimation.name, mode: "enter", ...enterAnimation.properties },
|
|
4446
|
+
`#${guid}`
|
|
4447
|
+
);
|
|
4448
|
+
}
|
|
4449
|
+
if (hoverAnimation?.name) {
|
|
4450
|
+
animationCSS += AnimationUtility_default.generateAnimationCSS(
|
|
4451
|
+
{ animation: hoverAnimation.name, mode: "hover", ...hoverAnimation.properties },
|
|
4452
|
+
`#${guid}`
|
|
4453
|
+
);
|
|
4454
|
+
}
|
|
4455
|
+
const shouldHideContainer = () => {
|
|
4456
|
+
if (!props.node.fieldVisibleOnTrue) return false;
|
|
4457
|
+
const fieldValue = getNestedValue(props.dataitem, props.node.fieldVisibleOnTrue);
|
|
4458
|
+
return fieldValue !== void 0 && fieldValue === false;
|
|
4459
|
+
};
|
|
4460
|
+
const isHidden = shouldHideContainer();
|
|
4461
|
+
let odataString = void 0;
|
|
4462
|
+
let endpoint = void 0;
|
|
4463
|
+
let result = null;
|
|
4464
|
+
let response = null;
|
|
4465
|
+
let childCollectionData = null;
|
|
4466
|
+
if (dataBindingProperties) {
|
|
4467
|
+
const serviceClient = new ServiceClient_default(props.apiBaseUrl, props.session);
|
|
4468
|
+
endpoint = dataBindingProperties.dataSource;
|
|
4469
|
+
{
|
|
4470
|
+
}
|
|
4471
|
+
endpoint = endpoint.replace(/\{(\w+)\}/g, (_, key) => {
|
|
4472
|
+
return props.routeParameters?.[key] ?? `{${key}}`;
|
|
4473
|
+
});
|
|
4474
|
+
if (dataBindingProperties.applyODataParams) {
|
|
4475
|
+
odataString = OdataBuilder.getOdataQueryString(props.query);
|
|
4476
|
+
if (odataString) {
|
|
4477
|
+
const separator = endpoint.includes("?") ? "&" : "?";
|
|
4478
|
+
endpoint += separator + odataString;
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
response = await serviceClient.get(endpoint);
|
|
4482
|
+
result = response?.result;
|
|
4483
|
+
if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
|
|
4484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(NoDataFound_default, {});
|
|
4485
|
+
}
|
|
4486
|
+
if (dataBindingProperties.childCollectionName && props.dataitem) {
|
|
4487
|
+
childCollectionData = getNestedValue(props.dataitem, dataBindingProperties.childCollectionName);
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
const cssResult = generateCssString(guid, updatedStyle, mobileStyles);
|
|
4491
|
+
function renderNode(node, props2, dataitem, key, href) {
|
|
4492
|
+
{
|
|
4493
|
+
}
|
|
4494
|
+
const SelectedNode = NodeTypes2[node.type];
|
|
4495
|
+
if (!SelectedNode) return null;
|
|
4496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react50.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
4497
|
+
SelectedNode,
|
|
4498
|
+
{
|
|
4499
|
+
node,
|
|
4500
|
+
parentTag: Wrapper,
|
|
4501
|
+
routeParameters: props2.routeParameters,
|
|
4502
|
+
query: props2.query,
|
|
4503
|
+
session: props2.session,
|
|
4504
|
+
host: props2.host,
|
|
4505
|
+
path: props2.path,
|
|
4506
|
+
apiBaseUrl: props2.apiBaseUrl,
|
|
4507
|
+
breadcrumb: props2.breadcrumb,
|
|
4508
|
+
dataitem,
|
|
4509
|
+
href
|
|
4510
|
+
}
|
|
4511
|
+
) }, key);
|
|
4512
|
+
}
|
|
4513
|
+
function renderChildren(nodes, props2, data, key, href) {
|
|
4514
|
+
if (!nodes) return null;
|
|
4515
|
+
const childNodes = nodes.map((node, index) => {
|
|
4516
|
+
if (node.type === "div-container" && node.dataBinding?.childCollectionName && data) {
|
|
4517
|
+
return renderNode(node, props2, data, index, href);
|
|
4518
|
+
}
|
|
4519
|
+
return renderNode(node, props2, data, index, href);
|
|
4520
|
+
});
|
|
4521
|
+
return childNodes;
|
|
4522
|
+
}
|
|
4523
|
+
function queryObjectToString(query) {
|
|
4524
|
+
if (!query) return "";
|
|
4525
|
+
return Object.entries(query).map(
|
|
4526
|
+
([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
|
|
4527
|
+
).join("&");
|
|
4528
|
+
}
|
|
4529
|
+
function resolveHrefTemplate(template, dataItem) {
|
|
4530
|
+
return template.replace(/\{([^}]+)\}/g, (match, key) => {
|
|
4531
|
+
return dataItem[key] !== void 0 ? dataItem[key] : match;
|
|
4532
|
+
});
|
|
4533
|
+
}
|
|
4534
|
+
const dataToRender = (() => {
|
|
4535
|
+
if (childCollectionData && Array.isArray(childCollectionData)) {
|
|
4536
|
+
return childCollectionData;
|
|
4537
|
+
}
|
|
4538
|
+
if (result && props.node.dataBinding?.responseType === "array") {
|
|
4539
|
+
return result;
|
|
4540
|
+
}
|
|
4541
|
+
if (result && props.node.dataBinding?.responseType === "object") {
|
|
4542
|
+
return [result];
|
|
4543
|
+
}
|
|
4544
|
+
return [props.dataitem];
|
|
4545
|
+
})();
|
|
4546
|
+
const renderLink = result && props.node.dataBinding?.responseType === "array" ? true : false;
|
|
4547
|
+
{
|
|
4548
|
+
}
|
|
4549
|
+
let Wrapper;
|
|
4550
|
+
let wrapperProps;
|
|
4551
|
+
switch (true) {
|
|
4552
|
+
case props.node.componentProperties?.type === "slider":
|
|
4553
|
+
Wrapper = Slider_default;
|
|
4554
|
+
const largeCols = props.node.componentProperties?.columns || 4;
|
|
4555
|
+
const slidesToShow = {
|
|
4556
|
+
large: largeCols,
|
|
4557
|
+
medium: Math.ceil(largeCols / 2),
|
|
4558
|
+
small: 1
|
|
4559
|
+
};
|
|
4560
|
+
wrapperProps = { ...props.node.componentProperties, "slidesToShow": slidesToShow };
|
|
4561
|
+
break;
|
|
4562
|
+
case !!(props.node.href || props.href):
|
|
4563
|
+
Wrapper = "a";
|
|
4564
|
+
let href = props.node.href || props.href;
|
|
4565
|
+
if (href?.includes("{")) {
|
|
4566
|
+
href = resolveHrefTemplate(href, props.dataitem);
|
|
4567
|
+
}
|
|
4568
|
+
const currentPath = decodeURIComponent(PathUtility_default.removeTrailingSlash(props.path) + "?" + queryObjectToString(props.query));
|
|
4569
|
+
const resolvedHref = decodeURIComponent(href || "");
|
|
4570
|
+
const isSelected = currentPath === resolvedHref;
|
|
4571
|
+
wrapperProps = { href, "data-isSelected": isSelected, "data-path": currentPath, "data-href": resolvedHref, class: "no-link-color" };
|
|
4572
|
+
break;
|
|
4573
|
+
default: {
|
|
4574
|
+
const replacementTag = props.node.replaceDivTagWith;
|
|
4575
|
+
const allowedTags = ["div", "section", "article", "details", "summary"];
|
|
4576
|
+
if (replacementTag && allowedTags.includes(replacementTag)) {
|
|
4577
|
+
{
|
|
4578
|
+
}
|
|
4579
|
+
Wrapper = replacementTag;
|
|
4580
|
+
} else {
|
|
4581
|
+
Wrapper = "div";
|
|
4582
|
+
}
|
|
4583
|
+
wrapperProps = {};
|
|
4584
|
+
break;
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4587
|
+
if (isHidden) {
|
|
4588
|
+
return null;
|
|
4589
|
+
}
|
|
4590
|
+
const classNames = [
|
|
4591
|
+
containerPaddingClass,
|
|
4592
|
+
props.node.autoFormat && "auto-format",
|
|
4593
|
+
props.node.bgClass
|
|
4594
|
+
].filter(Boolean).join(" ");
|
|
4595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_react50.default.Fragment, { children: [
|
|
4596
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("style", { dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS } }),
|
|
4597
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(EnterAnimationClient, { hasEnterAnimation: !!props.node.enterAnimation, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react50.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
4598
|
+
Wrapper,
|
|
4599
|
+
{
|
|
4600
|
+
id: guid,
|
|
4601
|
+
style: combinedStyles,
|
|
4602
|
+
className: classNames || void 0,
|
|
4603
|
+
...wrapperProps,
|
|
4604
|
+
children: dataToRender.map(
|
|
4605
|
+
(item, idx) => item?.links?.view && renderLink ? renderChildren(props.node.children, props, item, idx, props.href ? void 0 : item?.links?.view)?.map(
|
|
4606
|
+
(child, i) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react50.default.Fragment, { children: child }, i)
|
|
4607
|
+
) : renderChildren(props.node.children, props, item, idx)
|
|
4608
|
+
)
|
|
4609
|
+
}
|
|
4610
|
+
) }) }),
|
|
4611
|
+
dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Pagination_default, { path: props.path, query: props.query, dataset: response }) })
|
|
4612
|
+
] });
|
|
4613
|
+
};
|
|
4614
|
+
var DivContainer_default = DivContainer;
|
|
4615
|
+
|
|
4616
|
+
// src/components/pageRenderingEngine/PageBodyRenderer.tsx
|
|
4617
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4618
|
+
var NodeTypes = {
|
|
4619
|
+
["paragraph"]: ParagraphNode_default,
|
|
4620
|
+
["heading"]: HeadingNode_default,
|
|
4621
|
+
["list"]: ListNode_default,
|
|
4622
|
+
["quote"]: QuoteNode_default,
|
|
4623
|
+
["code"]: CodeNode_default,
|
|
4624
|
+
["image"]: ImageNode_default,
|
|
4625
|
+
["horizontalrule"]: HorizontalRuleNode_default,
|
|
4626
|
+
["widget"]: WidgetNode_default,
|
|
4627
|
+
["form-container"]: FormContainerNode_default,
|
|
4628
|
+
["div-container"]: DivContainer_default,
|
|
4629
|
+
["svg-icon"]: SVGIconNode_default,
|
|
4630
|
+
["embed"]: EmbedNode_default
|
|
4631
|
+
};
|
|
4632
|
+
var PageBodyRenderer = (props) => {
|
|
4633
|
+
let pageBodyTree;
|
|
4634
|
+
if (props.rawBody != void 0 && props.rawBody != null && props.rawBody != "") {
|
|
4635
|
+
try {
|
|
4636
|
+
pageBodyTree = JSON.parse(props.rawBody.toString());
|
|
4637
|
+
} catch (error) {
|
|
4638
|
+
}
|
|
4639
|
+
}
|
|
4640
|
+
let rootNode;
|
|
4641
|
+
if (pageBodyTree && pageBodyTree.root) {
|
|
4642
|
+
rootNode = pageBodyTree.root;
|
|
4643
|
+
}
|
|
4644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react51.default.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
|
|
4645
|
+
{
|
|
4646
|
+
}
|
|
4647
|
+
const SelectedNode = NodeTypes[node.type];
|
|
4648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react51.default.Fragment, { children: SelectedNode && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react51.default.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react51.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
4649
|
+
SelectedNode,
|
|
4650
|
+
{
|
|
4651
|
+
node,
|
|
4652
|
+
firstNode: true,
|
|
4653
|
+
routeParameters: props.routeParameters,
|
|
4654
|
+
query: props.query,
|
|
4655
|
+
session: props.session,
|
|
4656
|
+
host: props.host,
|
|
4657
|
+
path: props.path,
|
|
4658
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
4659
|
+
serviceClient: props.serviceClient,
|
|
4660
|
+
assetBaseUrl: props.assetBaseUrl
|
|
4661
|
+
}
|
|
4662
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react51.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
4663
|
+
SelectedNode,
|
|
4664
|
+
{
|
|
4665
|
+
node,
|
|
4666
|
+
routeParameters: props.routeParameters,
|
|
4667
|
+
query: props.query,
|
|
4668
|
+
session: props.session,
|
|
4669
|
+
host: props.host,
|
|
4670
|
+
path: props.path,
|
|
4671
|
+
apiBaseUrl: props.apiBaseUrl,
|
|
4672
|
+
serviceClient: props.serviceClient,
|
|
4673
|
+
assetBaseUrl: props.assetBaseUrl
|
|
4674
|
+
}
|
|
4675
|
+
) }) }) }, index);
|
|
4676
|
+
}) });
|
|
4677
|
+
};
|
|
4678
|
+
var PageBodyRenderer_default = PageBodyRenderer;
|
|
1846
4679
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1847
4680
|
0 && (module.exports = {
|
|
4681
|
+
DataList,
|
|
1848
4682
|
InputControl,
|
|
1849
4683
|
InputControlType,
|
|
4684
|
+
PageBodyRenderer,
|
|
1850
4685
|
ViewControl,
|
|
1851
|
-
ViewControlTypes
|
|
4686
|
+
ViewControlTypes,
|
|
4687
|
+
getWidget,
|
|
4688
|
+
registerWidgets
|
|
1852
4689
|
});
|