@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260424063152 → 0.8.1-dev.20260425052557
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/{LinkNodeButton-CEDMPW3R.mjs → LinkNodeButton-3AK5H5ZU.mjs} +1 -1
- package/dist/{chunk-7XWLHQXT.mjs → chunk-WMUACDXV.mjs} +1 -0
- package/dist/index.d.mts +133 -92
- package/dist/index.d.ts +133 -92
- package/dist/index.js +526 -1765
- package/dist/index.mjs +509 -1750
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6063,1793 +6063,554 @@ var DataListRenderer = ({
|
|
|
6063
6063
|
var DataListRenderer_default = DataListRenderer;
|
|
6064
6064
|
|
|
6065
6065
|
// src/components/dataForm/DataForm.tsx
|
|
6066
|
-
var
|
|
6066
|
+
var import_react56 = __toESM(require("react"));
|
|
6067
6067
|
init_Button();
|
|
6068
6068
|
init_StyleTypes();
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
"
|
|
6076
|
-
"
|
|
6077
|
-
"
|
|
6078
|
-
"
|
|
6079
|
-
"
|
|
6080
|
-
"
|
|
6081
|
-
"
|
|
6082
|
-
"
|
|
6083
|
-
"
|
|
6084
|
-
];
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
|
|
6164
|
-
|
|
6165
|
-
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
return section;
|
|
6175
|
-
}
|
|
6176
|
-
if (!section.isChildSection) {
|
|
6177
|
-
if (parentSectionName) {
|
|
6178
|
-
return {
|
|
6179
|
-
...section,
|
|
6180
|
-
parentSectionName: null
|
|
6181
|
-
};
|
|
6182
|
-
}
|
|
6183
|
-
return section;
|
|
6184
|
-
}
|
|
6185
|
-
if (!parentSectionName) {
|
|
6186
|
-
if (section.parentSectionName) {
|
|
6187
|
-
return {
|
|
6188
|
-
...section,
|
|
6189
|
-
parentSectionName: null
|
|
6190
|
-
};
|
|
6191
|
-
}
|
|
6192
|
-
return section;
|
|
6193
|
-
}
|
|
6194
|
-
const validParentIndex = sectionList.findIndex(
|
|
6195
|
-
(candidate, candidateIndex) => !candidate.isDeleted && candidateIndex < i && String(candidate.sectionName ?? "").trim() === parentSectionName
|
|
6196
|
-
);
|
|
6197
|
-
if (validParentIndex < 0) {
|
|
6198
|
-
return {
|
|
6199
|
-
...section,
|
|
6200
|
-
parentSectionName: null
|
|
6201
|
-
};
|
|
6202
|
-
}
|
|
6203
|
-
if (section.parentSectionName !== parentSectionName) {
|
|
6204
|
-
return {
|
|
6205
|
-
...section,
|
|
6206
|
-
parentSectionName
|
|
6207
|
-
};
|
|
6208
|
-
}
|
|
6209
|
-
return section;
|
|
6210
|
-
});
|
|
6211
|
-
};
|
|
6212
|
-
const updateSectionField = (sectionIndex, field, value) => {
|
|
6213
|
-
const updated = sections.map((section, i) => {
|
|
6214
|
-
if (i !== sectionIndex) return section;
|
|
6215
|
-
if (field === "parentSectionName") {
|
|
6216
|
-
const parentSectionName = String(value ?? "").trim();
|
|
6217
|
-
return {
|
|
6218
|
-
...section,
|
|
6219
|
-
parentSectionName: parentSectionName || null
|
|
6220
|
-
};
|
|
6221
|
-
}
|
|
6222
|
-
if (field === "isChildSection") {
|
|
6223
|
-
const isChild = Boolean(value);
|
|
6224
|
-
return {
|
|
6225
|
-
...section,
|
|
6226
|
-
isChildSection: isChild,
|
|
6227
|
-
parentSectionName: isChild ? section.parentSectionName ?? null : null
|
|
6228
|
-
};
|
|
6229
|
-
}
|
|
6230
|
-
return { ...section, [field]: value };
|
|
6231
|
-
});
|
|
6232
|
-
setSections(normalizeSectionHierarchy(updated));
|
|
6233
|
-
};
|
|
6234
|
-
const addRow = (sectionIndex) => {
|
|
6235
|
-
const tempId = nextTempId;
|
|
6236
|
-
setNextTempId(nextTempId - 1);
|
|
6237
|
-
setSections(
|
|
6238
|
-
sections.map(
|
|
6239
|
-
(section, i) => i === sectionIndex ? {
|
|
6240
|
-
...section,
|
|
6241
|
-
rows: [
|
|
6242
|
-
...section.rows ?? [],
|
|
6243
|
-
{
|
|
6244
|
-
siteFormDataFormSectionRowId: tempId,
|
|
6245
|
-
grow: false,
|
|
6246
|
-
elements: [],
|
|
6247
|
-
isDeleted: false
|
|
6248
|
-
}
|
|
6249
|
-
]
|
|
6250
|
-
} : section
|
|
6251
|
-
)
|
|
6252
|
-
);
|
|
6253
|
-
setTimeout(() => {
|
|
6254
|
-
const newRowIndex = sections[sectionIndex]?.rows?.length || 0;
|
|
6255
|
-
setSelectedItem({
|
|
6256
|
-
type: "row",
|
|
6257
|
-
sectionIndex,
|
|
6258
|
-
rowIndex: newRowIndex
|
|
6259
|
-
});
|
|
6260
|
-
}, 0);
|
|
6261
|
-
};
|
|
6262
|
-
const deleteRow = (sectionIndex, rowIndex) => {
|
|
6263
|
-
setSections(
|
|
6264
|
-
sections.map((section, i) => {
|
|
6265
|
-
if (i !== sectionIndex) return section;
|
|
6266
|
-
const updatedRows = section.rows?.map(
|
|
6267
|
-
(row, rIndex) => rIndex === rowIndex ? { ...row, isDeleted: true } : row
|
|
6268
|
-
) ?? [];
|
|
6269
|
-
return { ...section, rows: updatedRows };
|
|
6270
|
-
})
|
|
6271
|
-
);
|
|
6272
|
-
if (selectedItem?.type === "row" && selectedItem.sectionIndex === sectionIndex && selectedItem.rowIndex === rowIndex) {
|
|
6273
|
-
setSelectedItem(null);
|
|
6274
|
-
}
|
|
6275
|
-
};
|
|
6276
|
-
const updateRowGrow = (sectionIndex, rowIndex, grow) => {
|
|
6277
|
-
setSections(
|
|
6278
|
-
sections.map((section, i) => {
|
|
6279
|
-
if (i !== sectionIndex) return section;
|
|
6280
|
-
const updatedRows = section.rows?.map(
|
|
6281
|
-
(row, rIndex) => rIndex === rowIndex ? { ...row, grow } : row
|
|
6282
|
-
) ?? [];
|
|
6283
|
-
return { ...section, rows: updatedRows };
|
|
6284
|
-
})
|
|
6285
|
-
);
|
|
6286
|
-
};
|
|
6287
|
-
const addElement = (sectionIndex, rowIndex) => {
|
|
6288
|
-
const tempId = nextTempId;
|
|
6289
|
-
setNextTempId(nextTempId - 1);
|
|
6290
|
-
setSections(
|
|
6291
|
-
sections.map((section, i) => {
|
|
6292
|
-
if (i !== sectionIndex) return section;
|
|
6293
|
-
const updatedRows = section.rows?.map(
|
|
6294
|
-
(row, rIndex) => rIndex === rowIndex ? {
|
|
6295
|
-
...row,
|
|
6296
|
-
elements: [
|
|
6297
|
-
...row.elements ?? [],
|
|
6298
|
-
{
|
|
6299
|
-
siteFormDataFormSectionRowElementId: tempId,
|
|
6300
|
-
name: "",
|
|
6301
|
-
label: "",
|
|
6302
|
-
controlTypeCode: "",
|
|
6303
|
-
dataSource: "",
|
|
6304
|
-
dataKeyFieldName: "",
|
|
6305
|
-
dataTextFieldName: "",
|
|
6306
|
-
maxLength: void 0,
|
|
6307
|
-
minLength: void 0,
|
|
6308
|
-
maxValue: void 0,
|
|
6309
|
-
minValue: void 0,
|
|
6310
|
-
readOnly: false,
|
|
6311
|
-
hintText: "",
|
|
6312
|
-
placeholder: "",
|
|
6313
|
-
required: false,
|
|
6314
|
-
errorMessage: "",
|
|
6315
|
-
helpText: "",
|
|
6316
|
-
autoFocus: false,
|
|
6317
|
-
isDeleted: false
|
|
6318
|
-
}
|
|
6319
|
-
]
|
|
6320
|
-
} : row
|
|
6321
|
-
) ?? [];
|
|
6322
|
-
return { ...section, rows: updatedRows };
|
|
6323
|
-
})
|
|
6324
|
-
);
|
|
6325
|
-
setTimeout(() => {
|
|
6326
|
-
const newElementIndex = sections[sectionIndex]?.rows?.[rowIndex]?.elements?.length || 0;
|
|
6327
|
-
setSelectedItem({
|
|
6328
|
-
type: "element",
|
|
6329
|
-
sectionIndex,
|
|
6330
|
-
rowIndex,
|
|
6331
|
-
elementIndex: newElementIndex
|
|
6332
|
-
});
|
|
6333
|
-
}, 0);
|
|
6334
|
-
};
|
|
6335
|
-
const deleteElement = (sectionIndex, rowIndex, elementIndex) => {
|
|
6336
|
-
setSections(
|
|
6337
|
-
sections.map((section, i) => {
|
|
6338
|
-
if (i !== sectionIndex) return section;
|
|
6339
|
-
const updatedRows = section.rows?.map((row, rIndex) => {
|
|
6340
|
-
if (rIndex !== rowIndex) return row;
|
|
6341
|
-
const updatedElements = row.elements?.map(
|
|
6342
|
-
(el, eIndex) => eIndex === elementIndex ? { ...el, isDeleted: true } : el
|
|
6343
|
-
) ?? [];
|
|
6344
|
-
return { ...row, elements: updatedElements };
|
|
6345
|
-
}) ?? [];
|
|
6346
|
-
return { ...section, rows: updatedRows };
|
|
6347
|
-
})
|
|
6348
|
-
);
|
|
6349
|
-
if (selectedItem?.type === "element" && selectedItem.sectionIndex === sectionIndex && selectedItem.rowIndex === rowIndex && selectedItem.elementIndex === elementIndex) {
|
|
6350
|
-
setSelectedItem(null);
|
|
6351
|
-
}
|
|
6352
|
-
};
|
|
6353
|
-
const updateElementField = (sectionIndex, rowIndex, elementIndex, field, value) => {
|
|
6354
|
-
setSections(
|
|
6355
|
-
sections.map((section, i) => {
|
|
6356
|
-
if (i !== sectionIndex) return section;
|
|
6357
|
-
const updatedRows = section.rows?.map((row, rIndex) => {
|
|
6358
|
-
if (rIndex !== rowIndex) return row;
|
|
6359
|
-
const updatedElements = row.elements?.map(
|
|
6360
|
-
(el, eIndex) => eIndex === elementIndex ? { ...el, [field]: value } : el
|
|
6361
|
-
) ?? [];
|
|
6362
|
-
return { ...row, elements: updatedElements };
|
|
6363
|
-
}) ?? [];
|
|
6364
|
-
return { ...section, rows: updatedRows };
|
|
6365
|
-
})
|
|
6366
|
-
);
|
|
6367
|
-
};
|
|
6368
|
-
const addAction = () => {
|
|
6369
|
-
const tempId = nextTempId;
|
|
6370
|
-
setNextTempId(nextTempId - 1);
|
|
6371
|
-
setActions([
|
|
6372
|
-
...actions,
|
|
6373
|
-
{
|
|
6374
|
-
siteFormDataFormActionId: tempId,
|
|
6375
|
-
actionCode: "",
|
|
6376
|
-
actionTitle: "",
|
|
6377
|
-
serviceRoute: "",
|
|
6378
|
-
httpMethod: "post",
|
|
6379
|
-
returnRoute: null,
|
|
6380
|
-
isDeleted: false
|
|
6381
|
-
}
|
|
6382
|
-
]);
|
|
6383
|
-
};
|
|
6384
|
-
const deleteAction = (actionIndex) => {
|
|
6385
|
-
setActions(
|
|
6386
|
-
actions.map(
|
|
6387
|
-
(action, i) => i === actionIndex ? { ...action, isDeleted: true } : action
|
|
6388
|
-
)
|
|
6389
|
-
);
|
|
6390
|
-
};
|
|
6391
|
-
const updateActionField = (actionIndex, field, value) => {
|
|
6392
|
-
setActions(
|
|
6393
|
-
actions.map(
|
|
6394
|
-
(action, i) => i === actionIndex ? { ...action, [field]: value } : action
|
|
6395
|
-
)
|
|
6396
|
-
);
|
|
6397
|
-
};
|
|
6398
|
-
const handleNumberChange = (sectionIndex, rowIndex, elIndex, field, value) => {
|
|
6399
|
-
const numValue = value === "" || value === null || value === void 0 ? void 0 : parseInt(value, 10);
|
|
6400
|
-
updateElementField(sectionIndex, rowIndex, elIndex, field, numValue);
|
|
6401
|
-
};
|
|
6402
|
-
const getControlTypeColor = (type) => {
|
|
6403
|
-
const colors = {
|
|
6404
|
-
lineTextInput: "bg-blue-100 text-blue-800",
|
|
6405
|
-
multilineTextInput: "bg-purple-100 text-purple-800",
|
|
6406
|
-
numberInput: "bg-green-100 text-green-800",
|
|
6407
|
-
checkboxInput: "bg-yellow-100 text-yellow-800",
|
|
6408
|
-
select: "bg-orange-100 text-orange-800"
|
|
6409
|
-
};
|
|
6410
|
-
return colors[type] || "bg-gray-100 text-gray-800";
|
|
6411
|
-
};
|
|
6412
|
-
const renderSidebarContent = () => {
|
|
6413
|
-
if (!selectedItem) {
|
|
6414
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "p-6 text-center", children: [
|
|
6415
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6416
|
-
"svg",
|
|
6417
|
-
{
|
|
6418
|
-
className: "mx-auto h-12 w-12 text-gray-400 mb-4",
|
|
6419
|
-
fill: "none",
|
|
6420
|
-
stroke: "currentColor",
|
|
6421
|
-
viewBox: "0 0 24 24",
|
|
6422
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6423
|
-
"path",
|
|
6424
|
-
{
|
|
6425
|
-
strokeLinecap: "round",
|
|
6426
|
-
strokeLinejoin: "round",
|
|
6427
|
-
strokeWidth: 2,
|
|
6428
|
-
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
6429
|
-
}
|
|
6430
|
-
)
|
|
6431
|
-
}
|
|
6432
|
-
),
|
|
6433
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h3", { className: "text-lg font-medium text-gray-900 mb-2", children: "No Item Selected" }),
|
|
6434
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "text-sm text-gray-500", children: "Please select a section, row, or element from the form builder to edit its properties." })
|
|
6435
|
-
] });
|
|
6436
|
-
}
|
|
6437
|
-
const { type, sectionIndex, rowIndex, elementIndex } = selectedItem;
|
|
6438
|
-
if (type === "section") {
|
|
6439
|
-
const section = sections[sectionIndex];
|
|
6440
|
-
if (!section) return null;
|
|
6441
|
-
const firstActiveSectionIndex = sections.findIndex((s) => !s.isDeleted);
|
|
6442
|
-
const isFirstSection = sectionIndex === firstActiveSectionIndex;
|
|
6443
|
-
const parentSectionOptions = sections.filter(
|
|
6444
|
-
(s, i) => !s.isDeleted && i < sectionIndex && !!s.sectionName?.trim()
|
|
6445
|
-
).map((s) => ({
|
|
6446
|
-
value: s.sectionName,
|
|
6447
|
-
label: s.sectionTitle?.trim() || s.sectionName
|
|
6448
|
-
}));
|
|
6449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "p-6 space-y-4", children: [
|
|
6450
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h3", { className: "text-lg font-medium text-gray-900 border-b pb-2", children: "Edit Section" }),
|
|
6451
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-4", children: [
|
|
6452
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6453
|
-
InputControl_default,
|
|
6454
|
-
{
|
|
6455
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6456
|
-
name: "sectionTitle",
|
|
6457
|
-
value: section.sectionTitle ?? "",
|
|
6458
|
-
callback: ({ value }) => {
|
|
6459
|
-
updateSectionTitle(sectionIndex, String(value ?? ""));
|
|
6460
|
-
},
|
|
6461
|
-
attributes: {
|
|
6462
|
-
label: "Section Title",
|
|
6463
|
-
placeholder: "Enter section title"
|
|
6464
|
-
}
|
|
6465
|
-
}
|
|
6466
|
-
),
|
|
6467
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6468
|
-
InputControl_default,
|
|
6469
|
-
{
|
|
6470
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6471
|
-
name: "sectionName",
|
|
6472
|
-
value: section.sectionName ?? "",
|
|
6473
|
-
callback: ({ value }) => {
|
|
6474
|
-
updateSectionField(
|
|
6475
|
-
sectionIndex,
|
|
6476
|
-
"sectionName",
|
|
6477
|
-
String(value ?? "")
|
|
6478
|
-
);
|
|
6479
|
-
},
|
|
6480
|
-
attributes: {
|
|
6481
|
-
label: "Section Name",
|
|
6482
|
-
placeholder: "Enter section name"
|
|
6483
|
-
}
|
|
6484
|
-
}
|
|
6485
|
-
),
|
|
6486
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6487
|
-
InputControl_default,
|
|
6488
|
-
{
|
|
6489
|
-
controlType: InputControlType_default.checkboxInput,
|
|
6490
|
-
name: "isChildSection",
|
|
6491
|
-
value: isFirstSection ? false : section.isChildSection || false,
|
|
6492
|
-
callback: ({ value }) => {
|
|
6493
|
-
if (isFirstSection) {
|
|
6494
|
-
updateSectionField(sectionIndex, "isChildSection", false);
|
|
6495
|
-
updateSectionField(sectionIndex, "parentSectionName", null);
|
|
6496
|
-
return;
|
|
6497
|
-
}
|
|
6498
|
-
const isChild = Boolean(value ?? false);
|
|
6499
|
-
updateSectionField(sectionIndex, "isChildSection", isChild);
|
|
6500
|
-
if (!isChild) {
|
|
6501
|
-
updateSectionField(sectionIndex, "parentSectionName", null);
|
|
6502
|
-
}
|
|
6503
|
-
},
|
|
6504
|
-
attributes: {
|
|
6505
|
-
label: "Is Child Section",
|
|
6506
|
-
readOnly: isFirstSection
|
|
6507
|
-
}
|
|
6508
|
-
}
|
|
6509
|
-
),
|
|
6510
|
-
isFirstSection && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "text-xs text-gray-500", children: "First section cannot be child section." }),
|
|
6511
|
-
!isFirstSection && section.isChildSection && (parentSectionOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6512
|
-
InputControl_default,
|
|
6513
|
-
{
|
|
6514
|
-
name: "parentSectionName",
|
|
6515
|
-
controlType: InputControlType_default.select,
|
|
6516
|
-
value: section.parentSectionName ?? "",
|
|
6517
|
-
dataset: parentSectionOptions,
|
|
6518
|
-
dataKeyFieldName: "value",
|
|
6519
|
-
dataTextFieldName: "label",
|
|
6520
|
-
callback: ({ value }) => {
|
|
6521
|
-
const parentSectionName = String(value ?? "").trim();
|
|
6522
|
-
updateSectionField(
|
|
6523
|
-
sectionIndex,
|
|
6524
|
-
"parentSectionName",
|
|
6525
|
-
parentSectionName || null
|
|
6526
|
-
);
|
|
6527
|
-
},
|
|
6528
|
-
attributes: {
|
|
6529
|
-
label: "Parent Section Name"
|
|
6530
|
-
}
|
|
6531
|
-
}
|
|
6532
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "text-xs text-amber-700 bg-amber-50 border border-amber-200 rounded-md px-3 py-2", children: "No valid parent sections above this section." }))
|
|
6533
|
-
] })
|
|
6534
|
-
] });
|
|
6535
|
-
}
|
|
6536
|
-
if (type === "row") {
|
|
6537
|
-
const row = sections[sectionIndex]?.rows?.[rowIndex];
|
|
6538
|
-
if (!row) return null;
|
|
6539
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "p-6 space-y-4", children: [
|
|
6540
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h3", { className: "text-lg font-medium text-gray-900 border-b pb-2", children: "Edit Row" }),
|
|
6541
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6542
|
-
InputControl_default,
|
|
6543
|
-
{
|
|
6544
|
-
controlType: InputControlType_default.checkboxInput,
|
|
6545
|
-
name: "row.grow",
|
|
6546
|
-
value: row.grow || false,
|
|
6547
|
-
callback: ({ value }) => {
|
|
6548
|
-
updateRowGrow(sectionIndex, rowIndex, Boolean(value ?? ""));
|
|
6549
|
-
},
|
|
6550
|
-
attributes: {
|
|
6551
|
-
label: "Grow Row"
|
|
6552
|
-
}
|
|
6553
|
-
}
|
|
6554
|
-
) })
|
|
6555
|
-
] });
|
|
6556
|
-
}
|
|
6557
|
-
if (type === "element") {
|
|
6558
|
-
const element = sections[sectionIndex]?.rows?.[rowIndex]?.elements?.[elementIndex];
|
|
6559
|
-
if (!element) return null;
|
|
6560
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "px-6 py-2 space-y-4 overflow-y-auto", children: [
|
|
6561
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h3", { className: "text-lg font-medium text-gray-900 border-b pb-2", children: "Edit Element" }),
|
|
6562
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-4", children: [
|
|
6563
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6564
|
-
InputControl_default,
|
|
6565
|
-
{
|
|
6566
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6567
|
-
name: "name",
|
|
6568
|
-
value: element.name,
|
|
6569
|
-
callback: ({ value }) => {
|
|
6570
|
-
updateElementField(
|
|
6571
|
-
sectionIndex,
|
|
6572
|
-
rowIndex,
|
|
6573
|
-
elementIndex,
|
|
6574
|
-
"name",
|
|
6575
|
-
String(value ?? "")
|
|
6576
|
-
);
|
|
6577
|
-
},
|
|
6578
|
-
attributes: {
|
|
6579
|
-
label: "Name",
|
|
6580
|
-
placeholder: "Enter element name"
|
|
6581
|
-
}
|
|
6582
|
-
}
|
|
6583
|
-
),
|
|
6584
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6585
|
-
InputControl_default,
|
|
6586
|
-
{
|
|
6587
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6588
|
-
name: "label",
|
|
6589
|
-
value: element.label,
|
|
6590
|
-
callback: ({ value }) => {
|
|
6591
|
-
updateElementField(
|
|
6592
|
-
sectionIndex,
|
|
6593
|
-
rowIndex,
|
|
6594
|
-
elementIndex,
|
|
6595
|
-
"label",
|
|
6596
|
-
String(value ?? "")
|
|
6597
|
-
);
|
|
6598
|
-
},
|
|
6599
|
-
attributes: {
|
|
6600
|
-
label: "Label",
|
|
6601
|
-
placeholder: "Enter label"
|
|
6602
|
-
}
|
|
6603
|
-
}
|
|
6604
|
-
),
|
|
6605
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-1", children: [
|
|
6606
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("label", { className: "block text-sm font-medium text-gray-700", children: "Control Type" }),
|
|
6607
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
6608
|
-
"select",
|
|
6609
|
-
{
|
|
6610
|
-
className: "w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
6611
|
-
value: element.controlTypeCode,
|
|
6612
|
-
onChange: (e) => updateElementField(
|
|
6613
|
-
sectionIndex,
|
|
6614
|
-
rowIndex,
|
|
6615
|
-
elementIndex,
|
|
6616
|
-
"controlTypeCode",
|
|
6617
|
-
e.target.value
|
|
6618
|
-
),
|
|
6619
|
-
children: [
|
|
6620
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("option", { value: "", children: "Select Control" }),
|
|
6621
|
-
controlTypes.map((type2) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("option", { value: type2, children: type2 }, type2))
|
|
6622
|
-
]
|
|
6623
|
-
}
|
|
6624
|
-
)
|
|
6625
|
-
] })
|
|
6626
|
-
] }),
|
|
6627
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-2 pt-4 border-t", children: [
|
|
6628
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h4", { className: "text-sm font-medium text-gray-700", children: "Properties" }),
|
|
6629
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
6630
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6631
|
-
InputControl_default,
|
|
6632
|
-
{
|
|
6633
|
-
controlType: InputControlType_default.checkboxInput,
|
|
6634
|
-
name: "el.required",
|
|
6635
|
-
value: element.required || false,
|
|
6636
|
-
callback: ({ value }) => {
|
|
6637
|
-
updateElementField(
|
|
6638
|
-
sectionIndex,
|
|
6639
|
-
rowIndex,
|
|
6640
|
-
elementIndex,
|
|
6641
|
-
"required",
|
|
6642
|
-
Boolean(value ?? "")
|
|
6643
|
-
);
|
|
6644
|
-
},
|
|
6645
|
-
attributes: {
|
|
6646
|
-
label: "Required"
|
|
6647
|
-
}
|
|
6648
|
-
}
|
|
6649
|
-
),
|
|
6650
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6651
|
-
InputControl_default,
|
|
6652
|
-
{
|
|
6653
|
-
controlType: InputControlType_default.checkboxInput,
|
|
6654
|
-
name: "el.readonly",
|
|
6655
|
-
value: element.readOnly || false,
|
|
6656
|
-
callback: ({ value }) => {
|
|
6657
|
-
updateElementField(
|
|
6658
|
-
sectionIndex,
|
|
6659
|
-
rowIndex,
|
|
6660
|
-
elementIndex,
|
|
6661
|
-
"readOnly",
|
|
6662
|
-
Boolean(value ?? "")
|
|
6663
|
-
);
|
|
6664
|
-
},
|
|
6665
|
-
attributes: {
|
|
6666
|
-
label: "Read Only"
|
|
6667
|
-
}
|
|
6668
|
-
}
|
|
6669
|
-
),
|
|
6670
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6671
|
-
InputControl_default,
|
|
6672
|
-
{
|
|
6673
|
-
controlType: InputControlType_default.checkboxInput,
|
|
6674
|
-
name: "el.autoFocus",
|
|
6675
|
-
value: element.autoFocus || false,
|
|
6676
|
-
callback: ({ value }) => {
|
|
6677
|
-
updateElementField(
|
|
6678
|
-
sectionIndex,
|
|
6679
|
-
rowIndex,
|
|
6680
|
-
elementIndex,
|
|
6681
|
-
"autoFocus",
|
|
6682
|
-
Boolean(value ?? "")
|
|
6683
|
-
);
|
|
6684
|
-
},
|
|
6685
|
-
attributes: {
|
|
6686
|
-
label: "Auto Focus"
|
|
6687
|
-
}
|
|
6688
|
-
}
|
|
6689
|
-
)
|
|
6690
|
-
] })
|
|
6691
|
-
] }),
|
|
6692
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
6693
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h4", { className: "text-sm font-medium text-gray-700", children: "Text Properties" }),
|
|
6694
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6695
|
-
InputControl_default,
|
|
6696
|
-
{
|
|
6697
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6698
|
-
name: "el.placeholder",
|
|
6699
|
-
value: element.placeholder,
|
|
6700
|
-
callback: ({ value }) => {
|
|
6701
|
-
updateElementField(
|
|
6702
|
-
sectionIndex,
|
|
6703
|
-
rowIndex,
|
|
6704
|
-
elementIndex,
|
|
6705
|
-
"placeholder",
|
|
6706
|
-
String(value ?? "")
|
|
6707
|
-
);
|
|
6708
|
-
},
|
|
6709
|
-
attributes: {
|
|
6710
|
-
label: "Placeholder",
|
|
6711
|
-
placeholder: "Enter placeholder"
|
|
6712
|
-
}
|
|
6713
|
-
}
|
|
6714
|
-
),
|
|
6715
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6716
|
-
InputControl_default,
|
|
6717
|
-
{
|
|
6718
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6719
|
-
name: "el.hintText",
|
|
6720
|
-
value: element.hintText || "",
|
|
6721
|
-
callback: ({ value }) => {
|
|
6722
|
-
updateElementField(
|
|
6723
|
-
sectionIndex,
|
|
6724
|
-
rowIndex,
|
|
6725
|
-
elementIndex,
|
|
6726
|
-
"hintText",
|
|
6727
|
-
String(value ?? "")
|
|
6728
|
-
);
|
|
6729
|
-
},
|
|
6730
|
-
attributes: {
|
|
6731
|
-
label: "Hint Text",
|
|
6732
|
-
placeholder: "Enter hint text"
|
|
6733
|
-
}
|
|
6734
|
-
}
|
|
6735
|
-
),
|
|
6736
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6737
|
-
InputControl_default,
|
|
6738
|
-
{
|
|
6739
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6740
|
-
name: "el.helpText",
|
|
6741
|
-
value: element.helpText || "",
|
|
6742
|
-
callback: ({ value }) => {
|
|
6743
|
-
updateElementField(
|
|
6744
|
-
sectionIndex,
|
|
6745
|
-
rowIndex,
|
|
6746
|
-
elementIndex,
|
|
6747
|
-
"helpText",
|
|
6748
|
-
String(value ?? "")
|
|
6749
|
-
);
|
|
6750
|
-
},
|
|
6751
|
-
attributes: {
|
|
6752
|
-
label: "Help Text",
|
|
6753
|
-
placeholder: "Enter help text"
|
|
6754
|
-
}
|
|
6755
|
-
}
|
|
6756
|
-
),
|
|
6757
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6758
|
-
InputControl_default,
|
|
6759
|
-
{
|
|
6760
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6761
|
-
name: "el.errorMessage",
|
|
6762
|
-
value: element.errorMessage || "",
|
|
6763
|
-
callback: ({ value }) => {
|
|
6764
|
-
updateElementField(
|
|
6765
|
-
sectionIndex,
|
|
6766
|
-
rowIndex,
|
|
6767
|
-
elementIndex,
|
|
6768
|
-
"errorMessage",
|
|
6769
|
-
String(value ?? "")
|
|
6770
|
-
);
|
|
6771
|
-
},
|
|
6772
|
-
attributes: {
|
|
6773
|
-
label: "Error Message",
|
|
6774
|
-
placeholder: "Enter error message"
|
|
6775
|
-
}
|
|
6776
|
-
}
|
|
6777
|
-
)
|
|
6778
|
-
] }),
|
|
6779
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
6780
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h4", { className: "text-sm font-medium text-gray-700", children: "Validation" }),
|
|
6781
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
6782
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6783
|
-
InputControl_default,
|
|
6784
|
-
{
|
|
6785
|
-
controlType: InputControlType_default.numberInput,
|
|
6786
|
-
name: "el.minLength",
|
|
6787
|
-
value: element.minLength || "",
|
|
6788
|
-
callback: ({ value }) => {
|
|
6789
|
-
handleNumberChange(
|
|
6790
|
-
sectionIndex,
|
|
6791
|
-
rowIndex,
|
|
6792
|
-
elementIndex,
|
|
6793
|
-
"minLength",
|
|
6794
|
-
value
|
|
6795
|
-
);
|
|
6796
|
-
},
|
|
6797
|
-
attributes: {
|
|
6798
|
-
label: "Min Length",
|
|
6799
|
-
placeholder: "Min"
|
|
6800
|
-
}
|
|
6801
|
-
}
|
|
6802
|
-
),
|
|
6803
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6804
|
-
InputControl_default,
|
|
6805
|
-
{
|
|
6806
|
-
controlType: InputControlType_default.numberInput,
|
|
6807
|
-
name: "el.maxLength",
|
|
6808
|
-
value: element.maxLength || "",
|
|
6809
|
-
callback: ({ value }) => {
|
|
6810
|
-
handleNumberChange(
|
|
6811
|
-
sectionIndex,
|
|
6812
|
-
rowIndex,
|
|
6813
|
-
elementIndex,
|
|
6814
|
-
"maxLength",
|
|
6815
|
-
value
|
|
6816
|
-
);
|
|
6817
|
-
},
|
|
6818
|
-
attributes: {
|
|
6819
|
-
label: "Max Length",
|
|
6820
|
-
placeholder: "Max"
|
|
6821
|
-
}
|
|
6822
|
-
}
|
|
6823
|
-
),
|
|
6824
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6825
|
-
InputControl_default,
|
|
6826
|
-
{
|
|
6827
|
-
controlType: InputControlType_default.numberInput,
|
|
6828
|
-
name: "el.minValue",
|
|
6829
|
-
value: element.minValue || "",
|
|
6830
|
-
callback: ({ value }) => {
|
|
6831
|
-
handleNumberChange(
|
|
6832
|
-
sectionIndex,
|
|
6833
|
-
rowIndex,
|
|
6834
|
-
elementIndex,
|
|
6835
|
-
"minValue",
|
|
6836
|
-
value
|
|
6837
|
-
);
|
|
6838
|
-
},
|
|
6839
|
-
attributes: {
|
|
6840
|
-
label: "Min Value",
|
|
6841
|
-
placeholder: "Min"
|
|
6842
|
-
}
|
|
6843
|
-
}
|
|
6844
|
-
),
|
|
6845
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6846
|
-
InputControl_default,
|
|
6847
|
-
{
|
|
6848
|
-
controlType: InputControlType_default.numberInput,
|
|
6849
|
-
name: "el.maxValue",
|
|
6850
|
-
value: element.maxValue || "",
|
|
6851
|
-
callback: ({ value }) => {
|
|
6852
|
-
handleNumberChange(
|
|
6853
|
-
sectionIndex,
|
|
6854
|
-
rowIndex,
|
|
6855
|
-
elementIndex,
|
|
6856
|
-
"maxValue",
|
|
6857
|
-
value
|
|
6858
|
-
);
|
|
6859
|
-
},
|
|
6860
|
-
attributes: {
|
|
6861
|
-
label: "Max Value",
|
|
6862
|
-
placeholder: "Max"
|
|
6863
|
-
}
|
|
6864
|
-
}
|
|
6865
|
-
)
|
|
6866
|
-
] })
|
|
6867
|
-
] }),
|
|
6868
|
-
element.controlTypeCode === "select" && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
6869
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h4", { className: "text-sm font-medium text-gray-700", children: "Select Options" }),
|
|
6870
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6871
|
-
InputControl_default,
|
|
6872
|
-
{
|
|
6873
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6874
|
-
name: "el.dataSource",
|
|
6875
|
-
value: element.dataSource || "",
|
|
6876
|
-
callback: ({ value }) => {
|
|
6877
|
-
updateElementField(
|
|
6878
|
-
sectionIndex,
|
|
6879
|
-
rowIndex,
|
|
6880
|
-
elementIndex,
|
|
6881
|
-
"dataSource",
|
|
6882
|
-
value
|
|
6883
|
-
);
|
|
6884
|
-
},
|
|
6885
|
-
attributes: {
|
|
6886
|
-
label: "Data Source",
|
|
6887
|
-
placeholder: "/api/endpoint"
|
|
6888
|
-
}
|
|
6889
|
-
}
|
|
6890
|
-
),
|
|
6891
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6892
|
-
InputControl_default,
|
|
6893
|
-
{
|
|
6894
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6895
|
-
name: "el.dataKeyFieldName",
|
|
6896
|
-
value: element.dataKeyFieldName || "",
|
|
6897
|
-
callback: ({ value }) => {
|
|
6898
|
-
updateElementField(
|
|
6899
|
-
sectionIndex,
|
|
6900
|
-
rowIndex,
|
|
6901
|
-
elementIndex,
|
|
6902
|
-
"dataKeyFieldName",
|
|
6903
|
-
value
|
|
6904
|
-
);
|
|
6905
|
-
},
|
|
6906
|
-
attributes: {
|
|
6907
|
-
label: "Data Key Field",
|
|
6908
|
-
placeholder: "id"
|
|
6909
|
-
}
|
|
6910
|
-
}
|
|
6911
|
-
),
|
|
6912
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6913
|
-
InputControl_default,
|
|
6914
|
-
{
|
|
6915
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6916
|
-
name: "el.dataTextFieldName",
|
|
6917
|
-
value: element.dataTextFieldName || "",
|
|
6918
|
-
callback: ({ value }) => {
|
|
6919
|
-
updateElementField(
|
|
6920
|
-
sectionIndex,
|
|
6921
|
-
rowIndex,
|
|
6922
|
-
elementIndex,
|
|
6923
|
-
"dataTextFieldName",
|
|
6924
|
-
value
|
|
6925
|
-
);
|
|
6926
|
-
},
|
|
6927
|
-
attributes: {
|
|
6928
|
-
label: "Data Text Field",
|
|
6929
|
-
placeholder: "name"
|
|
6930
|
-
}
|
|
6931
|
-
}
|
|
6932
|
-
)
|
|
6933
|
-
] })
|
|
6934
|
-
] });
|
|
6935
|
-
}
|
|
6936
|
-
return null;
|
|
6937
|
-
};
|
|
6938
|
-
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex h-[calc(100vh-73px)]", children: [
|
|
6939
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex-1 overflow-y-auto pe-3", children: [
|
|
6940
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "flex items-center gap-2 px-6 py-3 border border-neutral-200 bg-white shadow-sm rounded-t-md", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
6941
|
-
"div",
|
|
6942
|
-
{
|
|
6943
|
-
className: "inline-flex items-center gap-2 cursor-pointer",
|
|
6944
|
-
onClick: () => window.history.back(),
|
|
6945
|
-
children: [
|
|
6946
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6947
|
-
"svg",
|
|
6948
|
-
{
|
|
6949
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
6950
|
-
fill: "none",
|
|
6951
|
-
viewBox: "0 0 24 24",
|
|
6952
|
-
strokeWidth: "1.5",
|
|
6953
|
-
stroke: "currentColor",
|
|
6954
|
-
className: "w-4 h-4 text-primary-800",
|
|
6955
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6956
|
-
"path",
|
|
6957
|
-
{
|
|
6958
|
-
strokeLinecap: "round",
|
|
6959
|
-
strokeLinejoin: "round",
|
|
6960
|
-
d: "M15.75 19.5L8.25 12l7.5-7.5"
|
|
6961
|
-
}
|
|
6962
|
-
)
|
|
6963
|
-
}
|
|
6964
|
-
),
|
|
6965
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("h2", { className: "text-lg font-semibold text-primary-800", children: [
|
|
6966
|
-
formId && formId > 0 ? "Edit" : "Add",
|
|
6967
|
-
" Data Form"
|
|
6968
|
-
] })
|
|
6969
|
-
]
|
|
6970
|
-
}
|
|
6971
|
-
) }),
|
|
6972
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "border-b border-gray-200 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
6973
|
-
"nav",
|
|
6974
|
-
{
|
|
6975
|
-
className: "flex -mb-px px-6 bg-white rounded-t-md",
|
|
6976
|
-
"aria-label": "Tabs",
|
|
6977
|
-
children: [
|
|
6978
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6979
|
-
"button",
|
|
6980
|
-
{
|
|
6981
|
-
onClick: () => setActiveTab("config"),
|
|
6982
|
-
className: `mr-8 py-4 px-1 border-b-2 font-medium text-sm ${activeTab === "config" ? "border-blue-500 text-blue-600" : "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,
|
|
6983
|
-
children: "Form Configuration"
|
|
6984
|
-
}
|
|
6985
|
-
),
|
|
6986
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6987
|
-
"button",
|
|
6988
|
-
{
|
|
6989
|
-
onClick: () => setActiveTab("sections"),
|
|
6990
|
-
className: `mr-8 py-4 px-1 border-b-2 font-medium text-sm ${activeTab === "sections" ? "border-blue-500 text-blue-600" : "border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,
|
|
6991
|
-
children: "Form Sections & Actions"
|
|
6992
|
-
}
|
|
6993
|
-
)
|
|
6994
|
-
]
|
|
6995
|
-
}
|
|
6996
|
-
) }),
|
|
6997
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "mx-auto py-1", children: [
|
|
6998
|
-
activeTab === "config" && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "bg-white shadow-sm border border-gray-200 mb-8 overflow-hidden", children: [
|
|
6999
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("h2", { className: "text-lg font-semibold text-gray-800 flex items-center", children: [
|
|
7000
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7001
|
-
"svg",
|
|
7002
|
-
{
|
|
7003
|
-
className: "w-5 h-5 mr-2 text-gray-600",
|
|
7004
|
-
fill: "none",
|
|
7005
|
-
stroke: "currentColor",
|
|
7006
|
-
viewBox: "0 0 24 24",
|
|
7007
|
-
children: [
|
|
7008
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7009
|
-
"path",
|
|
7010
|
-
{
|
|
7011
|
-
strokeLinecap: "round",
|
|
7012
|
-
strokeLinejoin: "round",
|
|
7013
|
-
strokeWidth: 2,
|
|
7014
|
-
d: "M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
|
|
7015
|
-
}
|
|
7016
|
-
),
|
|
7017
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7018
|
-
"path",
|
|
7019
|
-
{
|
|
7020
|
-
strokeLinecap: "round",
|
|
7021
|
-
strokeLinejoin: "round",
|
|
7022
|
-
strokeWidth: 2,
|
|
7023
|
-
d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
|
7024
|
-
}
|
|
7025
|
-
)
|
|
7026
|
-
]
|
|
7027
|
-
}
|
|
7028
|
-
),
|
|
7029
|
-
"Form Configuration"
|
|
7030
|
-
] }) }),
|
|
7031
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "p-6", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: [
|
|
7032
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-1", children: [
|
|
7033
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7034
|
-
InputControl_default,
|
|
7035
|
-
{
|
|
7036
|
-
name: "appId",
|
|
7037
|
-
controlType: InputControlType_default.select,
|
|
7038
|
-
value: selectedAppId,
|
|
7039
|
-
dataset: apps,
|
|
7040
|
-
dataKeyFieldName: "appId",
|
|
7041
|
-
dataTextFieldName: "title",
|
|
7042
|
-
callback: ({ value }) => {
|
|
7043
|
-
const parsedAppId = Number(value);
|
|
7044
|
-
if (!Number.isNaN(parsedAppId)) {
|
|
7045
|
-
setSelectedAppId(parsedAppId);
|
|
7046
|
-
}
|
|
7047
|
-
},
|
|
7048
|
-
attributes: {
|
|
7049
|
-
label: "AppId",
|
|
7050
|
-
readOnly: isEditMode
|
|
7051
|
-
}
|
|
7052
|
-
}
|
|
7053
|
-
),
|
|
7054
|
-
!loadingApps && apps.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "text-red-500 text-xs mt-1", children: "No applications found" })
|
|
7055
|
-
] }),
|
|
7056
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7057
|
-
InputControl_default,
|
|
7058
|
-
{
|
|
7059
|
-
controlType: InputControlType_default.numberInput,
|
|
7060
|
-
name: "siteFormTypeId",
|
|
7061
|
-
value: siteFormTypeId,
|
|
7062
|
-
attributes: {
|
|
7063
|
-
readOnly: true,
|
|
7064
|
-
label: "Form Type ID"
|
|
7065
|
-
}
|
|
7066
|
-
}
|
|
7067
|
-
) }),
|
|
7068
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-1 md:col-span-2", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7069
|
-
InputControl_default,
|
|
7070
|
-
{
|
|
7071
|
-
controlType: InputControlType_default.lineTextInput,
|
|
7072
|
-
name: "formTitle",
|
|
7073
|
-
value: formTitle,
|
|
7074
|
-
callback: ({ value }) => {
|
|
7075
|
-
setFormTitle(String(value ?? ""));
|
|
7076
|
-
},
|
|
7077
|
-
attributes: {
|
|
7078
|
-
label: "Form Title",
|
|
7079
|
-
placeholder: "Enter Form Title"
|
|
7080
|
-
}
|
|
7081
|
-
}
|
|
7082
|
-
) }),
|
|
7083
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7084
|
-
InputControl_default,
|
|
7085
|
-
{
|
|
7086
|
-
controlType: InputControlType_default.lineTextInput,
|
|
7087
|
-
name: "entityIdParamName",
|
|
7088
|
-
value: entityIdParamName,
|
|
7089
|
-
callback: ({ value }) => {
|
|
7090
|
-
setEntityIdParamName(String(value ?? ""));
|
|
7091
|
-
},
|
|
7092
|
-
attributes: {
|
|
7093
|
-
label: "Entity ID Parameter Name",
|
|
7094
|
-
placeholder: "Enter Entity Parameter Name"
|
|
7095
|
-
}
|
|
7096
|
-
}
|
|
7097
|
-
) }),
|
|
7098
|
-
formId && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7099
|
-
InputControl_default,
|
|
7100
|
-
{
|
|
7101
|
-
controlType: InputControlType_default.numberInput,
|
|
7102
|
-
name: "formId",
|
|
7103
|
-
value: formId,
|
|
7104
|
-
attributes: {
|
|
7105
|
-
readOnly: true,
|
|
7106
|
-
label: "Form ID"
|
|
7107
|
-
}
|
|
7108
|
-
}
|
|
7109
|
-
) })
|
|
7110
|
-
] }) })
|
|
7111
|
-
] }),
|
|
7112
|
-
activeTab === "sections" && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
7113
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "mt-0.3 bg-white shadow-sm border border-gray-200 overflow-hidden", children: [
|
|
7114
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50 flex items-center justify-between", children: [
|
|
7115
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("h2", { className: "text-lg font-semibold text-gray-800 flex items-center", children: [
|
|
7116
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7117
|
-
"svg",
|
|
7118
|
-
{
|
|
7119
|
-
className: "w-5 h-5 mr-2 text-gray-600",
|
|
7120
|
-
fill: "none",
|
|
7121
|
-
stroke: "currentColor",
|
|
7122
|
-
viewBox: "0 0 24 24",
|
|
7123
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7124
|
-
"path",
|
|
7125
|
-
{
|
|
7126
|
-
strokeLinecap: "round",
|
|
7127
|
-
strokeLinejoin: "round",
|
|
7128
|
-
strokeWidth: 2,
|
|
7129
|
-
d: "M4 6h16M4 10h16M4 14h16M4 18h16"
|
|
7130
|
-
}
|
|
7131
|
-
)
|
|
7132
|
-
}
|
|
7133
|
-
),
|
|
7134
|
-
"Form Sections"
|
|
7135
|
-
] }),
|
|
7136
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7137
|
-
Button_default,
|
|
7138
|
-
{
|
|
7139
|
-
ButtonType: "Primary" /* Solid */,
|
|
7140
|
-
showToast: true,
|
|
7141
|
-
onClick: async () => {
|
|
7142
|
-
addSection();
|
|
7143
|
-
return {
|
|
7144
|
-
isSuccessful: true,
|
|
7145
|
-
message: "Section added successfully"
|
|
7146
|
-
};
|
|
7147
|
-
},
|
|
7148
|
-
children: [
|
|
7149
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7150
|
-
"svg",
|
|
7151
|
-
{
|
|
7152
|
-
className: "w-4 h-4 mr-2",
|
|
7153
|
-
fill: "none",
|
|
7154
|
-
stroke: "currentColor",
|
|
7155
|
-
viewBox: "0 0 24 24",
|
|
7156
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7157
|
-
"path",
|
|
7158
|
-
{
|
|
7159
|
-
strokeLinecap: "round",
|
|
7160
|
-
strokeLinejoin: "round",
|
|
7161
|
-
strokeWidth: 2,
|
|
7162
|
-
d: "M12 4v16m8-8H4"
|
|
7163
|
-
}
|
|
7164
|
-
)
|
|
7165
|
-
}
|
|
7166
|
-
),
|
|
7167
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: "Add Section" })
|
|
7168
|
-
]
|
|
7169
|
-
}
|
|
7170
|
-
)
|
|
7171
|
-
] }),
|
|
7172
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "space-y-4", children: [
|
|
7173
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: sections.length === 0 ? "block" : "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "bg-white p-12 text-center", children: [
|
|
7174
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7175
|
-
"svg",
|
|
7176
|
-
{
|
|
7177
|
-
className: "mx-auto h-12 w-12 text-gray-400",
|
|
7178
|
-
fill: "none",
|
|
7179
|
-
stroke: "currentColor",
|
|
7180
|
-
viewBox: "0 0 24 24",
|
|
7181
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7182
|
-
"path",
|
|
7183
|
-
{
|
|
7184
|
-
strokeLinecap: "round",
|
|
7185
|
-
strokeLinejoin: "round",
|
|
7186
|
-
strokeWidth: 2,
|
|
7187
|
-
d: "M4 6h16M4 10h16M4 14h16M4 18h16"
|
|
7188
|
-
}
|
|
7189
|
-
)
|
|
7190
|
-
}
|
|
7191
|
-
),
|
|
7192
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h3", { className: "mt-2 text-sm font-medium text-gray-900", children: "No sections" }),
|
|
7193
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "mt-1 text-sm text-gray-500", children: "Get started by adding a new section." }),
|
|
7194
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "mt-6", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7195
|
-
Button_default,
|
|
7196
|
-
{
|
|
7197
|
-
ButtonType: "Primary" /* Solid */,
|
|
7198
|
-
showToast: true,
|
|
7199
|
-
onClick: async () => {
|
|
7200
|
-
addSection();
|
|
7201
|
-
return {
|
|
7202
|
-
isSuccessful: true,
|
|
7203
|
-
message: "Section added successfully"
|
|
7204
|
-
};
|
|
7205
|
-
},
|
|
7206
|
-
children: [
|
|
7207
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7208
|
-
"svg",
|
|
7209
|
-
{
|
|
7210
|
-
className: "w-4 h-4 mr-2",
|
|
7211
|
-
fill: "none",
|
|
7212
|
-
stroke: "currentColor",
|
|
7213
|
-
viewBox: "0 0 24 24",
|
|
7214
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7215
|
-
"path",
|
|
7216
|
-
{
|
|
7217
|
-
strokeLinecap: "round",
|
|
7218
|
-
strokeLinejoin: "round",
|
|
7219
|
-
strokeWidth: 2,
|
|
7220
|
-
d: "M12 4v16m8-8H4"
|
|
7221
|
-
}
|
|
7222
|
-
)
|
|
7223
|
-
}
|
|
7224
|
-
),
|
|
7225
|
-
"Add Section"
|
|
7226
|
-
]
|
|
7227
|
-
}
|
|
7228
|
-
) })
|
|
7229
|
-
] }) }),
|
|
7230
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7231
|
-
"div",
|
|
6069
|
+
|
|
6070
|
+
// src/components/dataForm/DataFormChildSection.tsx
|
|
6071
|
+
var import_react55 = __toESM(require("react"));
|
|
6072
|
+
|
|
6073
|
+
// src/components/dataForm/StyleTypes.tsx
|
|
6074
|
+
var StyleTypes2 = /* @__PURE__ */ ((StyleTypes3) => {
|
|
6075
|
+
StyleTypes3["Primary"] = "Primary";
|
|
6076
|
+
StyleTypes3["PrimaryHollow"] = "PrimaryHollow";
|
|
6077
|
+
StyleTypes3["Secondary"] = "Secondary";
|
|
6078
|
+
StyleTypes3["SecondaryHollow"] = "SecondaryHollow";
|
|
6079
|
+
StyleTypes3["Neutral"] = "Neutral";
|
|
6080
|
+
StyleTypes3["NeutralHollow"] = "NeutralHollow";
|
|
6081
|
+
StyleTypes3["Link"] = "Link";
|
|
6082
|
+
StyleTypes3["Ripple"] = "Ripple";
|
|
6083
|
+
StyleTypes3["Danger"] = "Danger";
|
|
6084
|
+
StyleTypes3["Light"] = "Light";
|
|
6085
|
+
return StyleTypes3;
|
|
6086
|
+
})(StyleTypes2 || {});
|
|
6087
|
+
|
|
6088
|
+
// src/components/dataForm/DataFormChildSection.tsx
|
|
6089
|
+
init_ClientButton();
|
|
6090
|
+
|
|
6091
|
+
// src/components/dataForm/FormReducer.tsx
|
|
6092
|
+
var FORM_CHILD_INPUT_UPDATE = "FORM_CHILD_INPUT_UPDATE";
|
|
6093
|
+
var FORM_CHILD_ONE_TO_ONE_UPDATE = "FORM_CHILD_ONE_TO_ONE_UPDATE";
|
|
6094
|
+
var FORM_CHILD_ROW_ADD = "FORM_CHILD_ROW_ADD";
|
|
6095
|
+
|
|
6096
|
+
// src/components/dataForm/DataFormChildSection.tsx
|
|
6097
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
6098
|
+
var DataFormChildSection = (props) => {
|
|
6099
|
+
const { section } = props;
|
|
6100
|
+
const isOneToOne = section.relationshipType === "one-to-one";
|
|
6101
|
+
const childItems = props.childItems || [];
|
|
6102
|
+
const getChildItemsForRendering = () => {
|
|
6103
|
+
if (isOneToOne) {
|
|
6104
|
+
return [{ item: props.childItems ?? {}, originalIndex: 0 }];
|
|
6105
|
+
}
|
|
6106
|
+
return childItems.map((item, originalIndex) => ({ item, originalIndex })).filter((x) => !x.item.isDeleted) || [];
|
|
6107
|
+
};
|
|
6108
|
+
const childItemsToRender = getChildItemsForRendering();
|
|
6109
|
+
const handleChildInputChange = (0, import_react55.useCallback)(
|
|
6110
|
+
(updatedValues) => {
|
|
6111
|
+
if (isOneToOne) {
|
|
6112
|
+
props.callback({
|
|
6113
|
+
sectionName: props.section.name,
|
|
6114
|
+
actionType: FORM_CHILD_ONE_TO_ONE_UPDATE,
|
|
6115
|
+
name: updatedValues.name,
|
|
6116
|
+
value: updatedValues.value,
|
|
6117
|
+
rowIndex: -1
|
|
6118
|
+
});
|
|
6119
|
+
} else {
|
|
6120
|
+
const filteredIndex = updatedValues.index;
|
|
6121
|
+
const visibleItem = childItemsToRender[filteredIndex];
|
|
6122
|
+
if (visibleItem) {
|
|
6123
|
+
props.callback({
|
|
6124
|
+
sectionName: props.section.name,
|
|
6125
|
+
actionType: FORM_CHILD_INPUT_UPDATE,
|
|
6126
|
+
name: updatedValues.name,
|
|
6127
|
+
value: updatedValues.value,
|
|
6128
|
+
rowIndex: visibleItem.originalIndex
|
|
6129
|
+
// Use ORIGINAL index!
|
|
6130
|
+
});
|
|
6131
|
+
}
|
|
6132
|
+
}
|
|
6133
|
+
},
|
|
6134
|
+
[props, isOneToOne, childItemsToRender]
|
|
6135
|
+
);
|
|
6136
|
+
const onAddRow = (0, import_react55.useCallback)(() => {
|
|
6137
|
+
props.callback({
|
|
6138
|
+
sectionName: props.section.name,
|
|
6139
|
+
actionType: FORM_CHILD_ROW_ADD,
|
|
6140
|
+
name: "all",
|
|
6141
|
+
value: null,
|
|
6142
|
+
rowIndex: -1
|
|
6143
|
+
});
|
|
6144
|
+
}, [props]);
|
|
6145
|
+
const onDeleteRow = (0, import_react55.useCallback)(
|
|
6146
|
+
(filteredIndex) => {
|
|
6147
|
+
const visibleItem = childItemsToRender[filteredIndex];
|
|
6148
|
+
if (visibleItem) {
|
|
6149
|
+
props.callback({
|
|
6150
|
+
sectionName: props.section.name,
|
|
6151
|
+
actionType: FORM_CHILD_INPUT_UPDATE,
|
|
6152
|
+
name: "isDeleted",
|
|
6153
|
+
value: true,
|
|
6154
|
+
rowIndex: visibleItem.originalIndex
|
|
6155
|
+
// Use ORIGINAL index!
|
|
6156
|
+
});
|
|
6157
|
+
}
|
|
6158
|
+
},
|
|
6159
|
+
[props, childItemsToRender]
|
|
6160
|
+
);
|
|
6161
|
+
console.log("Rendering Child Section:", {
|
|
6162
|
+
childItemsToRender,
|
|
6163
|
+
allChildItems: childItems
|
|
6164
|
+
});
|
|
6165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_react55.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "rounded border-neutral-200 border px-6 py-4 mb-2", children: [
|
|
6166
|
+
section.sectionTitle && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "mb-4 text-lg font-medium text-body-950", children: section.sectionTitle }),
|
|
6167
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "flex-grow flex flex-col justify-between overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex flex-col justify-between gap-2", children: [
|
|
6168
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("table", { className: "w-full border-separate divide-y divide-gray-200", children: [
|
|
6169
|
+
(!isOneToOne || childItemsToRender.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("thead", { className: "", children: section.sectionRows.map((sectionRow, sectionRowIndex) => {
|
|
6170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("tr", { className: "", children: [
|
|
6171
|
+
sectionRow.elements.map((field, index) => {
|
|
6172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6173
|
+
"th",
|
|
7232
6174
|
{
|
|
7233
|
-
className:
|
|
7234
|
-
children:
|
|
7235
|
-
|
|
7236
|
-
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
className: "flex items-center space-x-2",
|
|
7250
|
-
onClick: (e) => e.stopPropagation(),
|
|
7251
|
-
children: [
|
|
7252
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7253
|
-
Button_default,
|
|
7254
|
-
{
|
|
7255
|
-
ButtonType: "Primary" /* Solid */,
|
|
7256
|
-
showToast: true,
|
|
7257
|
-
onClick: async () => {
|
|
7258
|
-
addRow(sectionIndex);
|
|
7259
|
-
return {
|
|
7260
|
-
isSuccessful: true,
|
|
7261
|
-
message: "Row added successfully"
|
|
7262
|
-
};
|
|
7263
|
-
},
|
|
7264
|
-
children: [
|
|
7265
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7266
|
-
"svg",
|
|
7267
|
-
{
|
|
7268
|
-
className: "w-4 h-4 mr-1",
|
|
7269
|
-
fill: "none",
|
|
7270
|
-
stroke: "currentColor",
|
|
7271
|
-
viewBox: "0 0 24 24",
|
|
7272
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7273
|
-
"path",
|
|
7274
|
-
{
|
|
7275
|
-
strokeLinecap: "round",
|
|
7276
|
-
strokeLinejoin: "round",
|
|
7277
|
-
strokeWidth: 2,
|
|
7278
|
-
d: "M12 4v16m8-8H4"
|
|
7279
|
-
}
|
|
7280
|
-
)
|
|
7281
|
-
}
|
|
7282
|
-
),
|
|
7283
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: "Add Row" })
|
|
7284
|
-
]
|
|
7285
|
-
}
|
|
7286
|
-
),
|
|
7287
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7288
|
-
Button_default,
|
|
7289
|
-
{
|
|
7290
|
-
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
7291
|
-
onClick: async () => {
|
|
7292
|
-
deleteSection(sectionIndex);
|
|
7293
|
-
return {
|
|
7294
|
-
isSuccessful: true,
|
|
7295
|
-
message: "Section deleted successfully"
|
|
7296
|
-
};
|
|
7297
|
-
},
|
|
7298
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7299
|
-
"svg",
|
|
7300
|
-
{
|
|
7301
|
-
className: "w-5 h-5",
|
|
7302
|
-
fill: "none",
|
|
7303
|
-
stroke: "currentColor",
|
|
7304
|
-
viewBox: "0 0 24 24",
|
|
7305
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7306
|
-
"path",
|
|
7307
|
-
{
|
|
7308
|
-
strokeLinecap: "round",
|
|
7309
|
-
strokeLinejoin: "round",
|
|
7310
|
-
strokeWidth: 2,
|
|
7311
|
-
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
7312
|
-
}
|
|
7313
|
-
)
|
|
7314
|
-
}
|
|
7315
|
-
)
|
|
7316
|
-
}
|
|
7317
|
-
)
|
|
7318
|
-
]
|
|
7319
|
-
}
|
|
7320
|
-
)
|
|
7321
|
-
] }),
|
|
7322
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "p-6", children: section.rows?.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "text-sm text-gray-500", children: "No rows in this section" }) }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-4", children: section.rows?.map(
|
|
7323
|
-
(row, rowIndex) => !row.isDeleted && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7324
|
-
"div",
|
|
7325
|
-
{
|
|
7326
|
-
className: `border rounded-lg overflow-hidden cursor-pointer transition-all ${selectedItem?.type === "row" && selectedItem.sectionIndex === sectionIndex && selectedItem.rowIndex === rowIndex ? "border-blue-500 ring-2 ring-blue-200" : "border-gray-200 hover:border-gray-300"}`,
|
|
7327
|
-
onClick: (e) => {
|
|
7328
|
-
e.stopPropagation();
|
|
7329
|
-
setSelectedItem({
|
|
7330
|
-
type: "row",
|
|
7331
|
-
sectionIndex,
|
|
7332
|
-
rowIndex
|
|
7333
|
-
});
|
|
7334
|
-
},
|
|
7335
|
-
children: [
|
|
7336
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between", children: [
|
|
7337
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex items-center space-x-4", children: [
|
|
7338
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("span", { className: "text-sm font-medium text-gray-700", children: [
|
|
7339
|
-
"Row ",
|
|
7340
|
-
rowIndex + 1
|
|
7341
|
-
] }),
|
|
7342
|
-
row.grow && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs", children: "Grow" })
|
|
7343
|
-
] }),
|
|
7344
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7345
|
-
"div",
|
|
7346
|
-
{
|
|
7347
|
-
className: "flex items-center space-x-2",
|
|
7348
|
-
onClick: (e) => e.stopPropagation(),
|
|
7349
|
-
children: [
|
|
7350
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7351
|
-
Button_default,
|
|
7352
|
-
{
|
|
7353
|
-
ButtonType: "Primary" /* Solid */,
|
|
7354
|
-
onClick: async () => {
|
|
7355
|
-
addElement(
|
|
7356
|
-
sectionIndex,
|
|
7357
|
-
rowIndex
|
|
7358
|
-
);
|
|
7359
|
-
return {
|
|
7360
|
-
isSuccessful: true,
|
|
7361
|
-
message: "Element added successfully"
|
|
7362
|
-
};
|
|
7363
|
-
},
|
|
7364
|
-
children: [
|
|
7365
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7366
|
-
"svg",
|
|
7367
|
-
{
|
|
7368
|
-
className: "w-3 h-3 mr-1",
|
|
7369
|
-
fill: "none",
|
|
7370
|
-
stroke: "currentColor",
|
|
7371
|
-
viewBox: "0 0 24 24",
|
|
7372
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7373
|
-
"path",
|
|
7374
|
-
{
|
|
7375
|
-
strokeLinecap: "round",
|
|
7376
|
-
strokeLinejoin: "round",
|
|
7377
|
-
strokeWidth: 2,
|
|
7378
|
-
d: "M12 4v16m8-8H4"
|
|
7379
|
-
}
|
|
7380
|
-
)
|
|
7381
|
-
}
|
|
7382
|
-
),
|
|
7383
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: "Add Element" })
|
|
7384
|
-
]
|
|
7385
|
-
}
|
|
7386
|
-
),
|
|
7387
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7388
|
-
Button_default,
|
|
7389
|
-
{
|
|
7390
|
-
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
7391
|
-
onClick: async () => {
|
|
7392
|
-
deleteRow(
|
|
7393
|
-
sectionIndex,
|
|
7394
|
-
rowIndex
|
|
7395
|
-
);
|
|
7396
|
-
return {
|
|
7397
|
-
isSuccessful: true,
|
|
7398
|
-
message: "Row deleted successfully"
|
|
7399
|
-
};
|
|
7400
|
-
},
|
|
7401
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7402
|
-
"svg",
|
|
7403
|
-
{
|
|
7404
|
-
className: "w-4 h-4",
|
|
7405
|
-
fill: "none",
|
|
7406
|
-
stroke: "currentColor",
|
|
7407
|
-
viewBox: "0 0 24 24",
|
|
7408
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7409
|
-
"path",
|
|
7410
|
-
{
|
|
7411
|
-
strokeLinecap: "round",
|
|
7412
|
-
strokeLinejoin: "round",
|
|
7413
|
-
strokeWidth: 2,
|
|
7414
|
-
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
7415
|
-
}
|
|
7416
|
-
)
|
|
7417
|
-
}
|
|
7418
|
-
)
|
|
7419
|
-
}
|
|
7420
|
-
)
|
|
7421
|
-
]
|
|
7422
|
-
}
|
|
7423
|
-
)
|
|
7424
|
-
] }),
|
|
7425
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "p-4", children: row.elements?.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "text-center py-4 bg-gray-50 rounded border-2 border-dashed border-gray-300", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "text-sm text-gray-500", children: "No elements in this row" }) }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-2", children: row.elements?.map(
|
|
7426
|
-
(el, elIndex) => !el.isDeleted && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7427
|
-
"div",
|
|
7428
|
-
{
|
|
7429
|
-
className: `flex items-center justify-between p-3 bg-gray-50 rounded-lg border cursor-pointer transition-all ${selectedItem?.type === "element" && selectedItem.sectionIndex === sectionIndex && selectedItem.rowIndex === rowIndex && selectedItem.elementIndex === elIndex ? "border-blue-500 ring-2 ring-blue-200" : "border-gray-200 hover:border-gray-300"}`,
|
|
7430
|
-
onClick: (e) => {
|
|
7431
|
-
e.stopPropagation();
|
|
7432
|
-
setSelectedItem({
|
|
7433
|
-
type: "element",
|
|
7434
|
-
sectionIndex,
|
|
7435
|
-
rowIndex,
|
|
7436
|
-
elementIndex: elIndex
|
|
7437
|
-
});
|
|
7438
|
-
},
|
|
7439
|
-
children: [
|
|
7440
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex items-center space-x-3", children: [
|
|
7441
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "text-sm font-medium text-gray-700", children: el.label || "New Element" }),
|
|
7442
|
-
el.controlTypeCode && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7443
|
-
"span",
|
|
7444
|
-
{
|
|
7445
|
-
className: `px-2 py-0.5 rounded-full text-xs font-medium ${getControlTypeColor(el.controlTypeCode)}`,
|
|
7446
|
-
children: el.controlTypeCode
|
|
7447
|
-
}
|
|
7448
|
-
)
|
|
7449
|
-
] }),
|
|
7450
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7451
|
-
Button_default,
|
|
7452
|
-
{
|
|
7453
|
-
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
7454
|
-
onClick: async () => {
|
|
7455
|
-
deleteElement(
|
|
7456
|
-
sectionIndex,
|
|
7457
|
-
rowIndex,
|
|
7458
|
-
elIndex
|
|
7459
|
-
);
|
|
7460
|
-
return {
|
|
7461
|
-
isSuccessful: true,
|
|
7462
|
-
message: "Element deleted successfully"
|
|
7463
|
-
};
|
|
7464
|
-
},
|
|
7465
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7466
|
-
"svg",
|
|
7467
|
-
{
|
|
7468
|
-
className: "w-4 h-4",
|
|
7469
|
-
fill: "none",
|
|
7470
|
-
stroke: "currentColor",
|
|
7471
|
-
viewBox: "0 0 24 24",
|
|
7472
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7473
|
-
"path",
|
|
7474
|
-
{
|
|
7475
|
-
strokeLinecap: "round",
|
|
7476
|
-
strokeLinejoin: "round",
|
|
7477
|
-
strokeWidth: 2,
|
|
7478
|
-
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
7479
|
-
}
|
|
7480
|
-
)
|
|
7481
|
-
}
|
|
7482
|
-
)
|
|
7483
|
-
}
|
|
7484
|
-
)
|
|
7485
|
-
]
|
|
7486
|
-
},
|
|
7487
|
-
el.siteFormDataFormSectionRowElementId || `${sectionIndex}-${rowIndex}-${elIndex}`
|
|
7488
|
-
)
|
|
7489
|
-
) }) })
|
|
7490
|
-
]
|
|
7491
|
-
},
|
|
7492
|
-
row.siteFormDataFormSectionRowId || `${sectionIndex}-${rowIndex}`
|
|
7493
|
-
)
|
|
7494
|
-
) }) })
|
|
7495
|
-
]
|
|
7496
|
-
},
|
|
7497
|
-
section.siteFormDataFormSectionId || sectionIndex
|
|
7498
|
-
)
|
|
7499
|
-
)
|
|
7500
|
-
}
|
|
7501
|
-
)
|
|
7502
|
-
] })
|
|
7503
|
-
] }),
|
|
7504
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "mt-8 bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden", children: [
|
|
7505
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50 flex items-center justify-between", children: [
|
|
7506
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("h2", { className: "text-lg font-semibold text-gray-800 flex items-center", children: [
|
|
7507
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7508
|
-
"svg",
|
|
7509
|
-
{
|
|
7510
|
-
className: "w-5 h-5 mr-2 text-gray-600",
|
|
7511
|
-
fill: "none",
|
|
7512
|
-
stroke: "currentColor",
|
|
7513
|
-
viewBox: "0 0 24 24",
|
|
7514
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7515
|
-
"path",
|
|
7516
|
-
{
|
|
7517
|
-
strokeLinecap: "round",
|
|
7518
|
-
strokeLinejoin: "round",
|
|
7519
|
-
strokeWidth: 2,
|
|
7520
|
-
d: "M13 10V3L4 14h7v7l9-11h-7z"
|
|
7521
|
-
}
|
|
7522
|
-
)
|
|
7523
|
-
}
|
|
7524
|
-
),
|
|
7525
|
-
"Form Actions"
|
|
7526
|
-
] }),
|
|
7527
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7528
|
-
Button_default,
|
|
6175
|
+
className: "py-3 font-normal text-left",
|
|
6176
|
+
children: field.attributes?.label
|
|
6177
|
+
},
|
|
6178
|
+
field.name
|
|
6179
|
+
);
|
|
6180
|
+
}),
|
|
6181
|
+
!section.readonly && !isOneToOne && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("th", { className: "py-3 font-normal text-left", children: "Actions" })
|
|
6182
|
+
] }, sectionRowIndex);
|
|
6183
|
+
}) }),
|
|
6184
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("tbody", { className: "divide-y divide-gray-200", children: childItemsToRender.map((visibleItem, filteredIndex) => {
|
|
6185
|
+
const { item, originalIndex } = visibleItem;
|
|
6186
|
+
const rowKey = originalIndex;
|
|
6187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_react55.default.Fragment, { children: section.sectionRows.map(
|
|
6188
|
+
(sectionRow, sectionRowIndex) => {
|
|
6189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
6190
|
+
"tr",
|
|
7529
6191
|
{
|
|
7530
|
-
|
|
7531
|
-
onClick: async () => {
|
|
7532
|
-
addAction();
|
|
7533
|
-
return {
|
|
7534
|
-
isSuccessful: true,
|
|
7535
|
-
message: "Action added successfully"
|
|
7536
|
-
};
|
|
7537
|
-
},
|
|
6192
|
+
className: "",
|
|
7538
6193
|
children: [
|
|
7539
|
-
|
|
7540
|
-
"
|
|
6194
|
+
sectionRow.elements.map((field, index) => {
|
|
6195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "w-11/12", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6196
|
+
InputControl_default,
|
|
6197
|
+
{
|
|
6198
|
+
index: filteredIndex,
|
|
6199
|
+
name: field.name,
|
|
6200
|
+
controlType: field.controlType,
|
|
6201
|
+
value: item[field.name],
|
|
6202
|
+
dataset: field.dataset,
|
|
6203
|
+
dataKeyFieldName: field.dataKeyFieldName,
|
|
6204
|
+
dataTextFieldName: field.dataTextFieldName,
|
|
6205
|
+
callback: handleChildInputChange,
|
|
6206
|
+
attributes: {
|
|
6207
|
+
...field.attributes,
|
|
6208
|
+
label: ""
|
|
6209
|
+
},
|
|
6210
|
+
serviceClient: props.serviceClient,
|
|
6211
|
+
entityType: field.entityType
|
|
6212
|
+
}
|
|
6213
|
+
) }) }) }, field.name);
|
|
6214
|
+
}),
|
|
6215
|
+
!section.readonly && !isOneToOne && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6216
|
+
ClientButton_default,
|
|
7541
6217
|
{
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
6218
|
+
ButtonType: StyleTypes2.Hollow,
|
|
6219
|
+
onClick: () => {
|
|
6220
|
+
onDeleteRow(filteredIndex);
|
|
6221
|
+
},
|
|
6222
|
+
dataRole: "delete",
|
|
6223
|
+
tabIndex: -1,
|
|
7546
6224
|
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7547
|
-
|
|
6225
|
+
Icon_default,
|
|
7548
6226
|
{
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
strokeWidth: 2,
|
|
7552
|
-
d: "M12 4v16m8-8H4"
|
|
6227
|
+
className: "w-4 h-4",
|
|
6228
|
+
name: "delete"
|
|
7553
6229
|
}
|
|
7554
6230
|
)
|
|
7555
6231
|
}
|
|
7556
|
-
)
|
|
7557
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: "Add Action" })
|
|
6232
|
+
) })
|
|
7558
6233
|
]
|
|
6234
|
+
},
|
|
6235
|
+
`${rowKey}_${sectionRowIndex}`
|
|
6236
|
+
);
|
|
6237
|
+
}
|
|
6238
|
+
) }, rowKey);
|
|
6239
|
+
}) })
|
|
6240
|
+
] }) }),
|
|
6241
|
+
!section.readonly && !isOneToOne && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "ml-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6242
|
+
ClientButton_default,
|
|
6243
|
+
{
|
|
6244
|
+
ButtonType: "Link" /* Link */,
|
|
6245
|
+
onClick: onAddRow,
|
|
6246
|
+
dataRole: "add",
|
|
6247
|
+
children: "Add new"
|
|
6248
|
+
}
|
|
6249
|
+
) })
|
|
6250
|
+
] }) })
|
|
6251
|
+
] }) });
|
|
6252
|
+
};
|
|
6253
|
+
var DataFormChildSection_default = DataFormChildSection;
|
|
6254
|
+
|
|
6255
|
+
// src/components/dataForm/DataForm.tsx
|
|
6256
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
6257
|
+
var DataForm2 = (props) => {
|
|
6258
|
+
const formRef = (0, import_react56.useRef)(null);
|
|
6259
|
+
console.log(props.dataItem, "dssads");
|
|
6260
|
+
const initialState = {
|
|
6261
|
+
inputValues: {},
|
|
6262
|
+
lastPropertyChanged: ""
|
|
6263
|
+
};
|
|
6264
|
+
const childInitialState = {
|
|
6265
|
+
inputValues: []
|
|
6266
|
+
};
|
|
6267
|
+
const [formState, dispatch] = (0, import_react56.useReducer)(FormReducer_default, initialState);
|
|
6268
|
+
console.log(props.sections, "sections");
|
|
6269
|
+
const clearHiddenChildSections = (0, import_react56.useCallback)(
|
|
6270
|
+
(changedProperty, newValues) => {
|
|
6271
|
+
if (!props.sections) return;
|
|
6272
|
+
const allChildSections = [];
|
|
6273
|
+
props.sections.forEach((section) => {
|
|
6274
|
+
if (section.childSections) {
|
|
6275
|
+
section.childSections.forEach((childSection) => {
|
|
6276
|
+
if (childSection.name) {
|
|
6277
|
+
allChildSections.push({
|
|
6278
|
+
name: childSection.name,
|
|
6279
|
+
section: childSection
|
|
6280
|
+
});
|
|
6281
|
+
}
|
|
6282
|
+
});
|
|
6283
|
+
}
|
|
6284
|
+
});
|
|
6285
|
+
allChildSections.forEach(({ name, section }) => {
|
|
6286
|
+
const wasVisible = evalutateCondition(
|
|
6287
|
+
formState.inputValues,
|
|
6288
|
+
section.visible
|
|
6289
|
+
);
|
|
6290
|
+
const isNowVisible = evalutateCondition(newValues, section.visible);
|
|
6291
|
+
if (wasVisible && !isNowVisible) {
|
|
6292
|
+
const currentValue = newValues[name];
|
|
6293
|
+
if (currentValue && (Array.isArray(currentValue) && currentValue.length > 0 || typeof currentValue === "object" && Object.keys(currentValue).length > 0)) {
|
|
6294
|
+
dispatch({
|
|
6295
|
+
// @ts-ignore
|
|
6296
|
+
type: "FORM_CHILD_CLEAR",
|
|
6297
|
+
childName: name,
|
|
6298
|
+
name,
|
|
6299
|
+
value: section.relationshipType === "one-to-one" ? {} : []
|
|
6300
|
+
});
|
|
6301
|
+
}
|
|
6302
|
+
}
|
|
6303
|
+
});
|
|
6304
|
+
},
|
|
6305
|
+
[props.sections, formState.inputValues]
|
|
6306
|
+
);
|
|
6307
|
+
const handleInputChange = (0, import_react56.useCallback)(
|
|
6308
|
+
async (updatedValues) => {
|
|
6309
|
+
dispatch({
|
|
6310
|
+
type: FORM_INPUT_UPDATE,
|
|
6311
|
+
name: updatedValues.name,
|
|
6312
|
+
value: updatedValues.value
|
|
6313
|
+
});
|
|
6314
|
+
const newInputValues = {
|
|
6315
|
+
...formState.inputValues,
|
|
6316
|
+
[updatedValues.name]: updatedValues.value
|
|
6317
|
+
};
|
|
6318
|
+
clearHiddenChildSections(updatedValues.name, newInputValues);
|
|
6319
|
+
},
|
|
6320
|
+
[dispatch, formState.inputValues, clearHiddenChildSections]
|
|
6321
|
+
);
|
|
6322
|
+
const fetchData = (0, import_react56.useCallback)(async () => {
|
|
6323
|
+
if (!props.rules) return;
|
|
6324
|
+
if (Object.keys(formState.inputValues).length === 0) {
|
|
6325
|
+
return;
|
|
6326
|
+
}
|
|
6327
|
+
console.log("on change called");
|
|
6328
|
+
const changeRule = props.rules.onChangeRules?.find(
|
|
6329
|
+
(x) => x.name === formState.lastPropertyChanged
|
|
6330
|
+
);
|
|
6331
|
+
if (!changeRule) return;
|
|
6332
|
+
if (changeRule.triggerCondition && !evalutateCondition(formState.inputValues, changeRule.triggerCondition)) {
|
|
6333
|
+
console.log("Trigger condition not met, skipping API call.");
|
|
6334
|
+
return;
|
|
6335
|
+
}
|
|
6336
|
+
const url = replacePlaceholders(
|
|
6337
|
+
changeRule.getApiEndpoint,
|
|
6338
|
+
formState.inputValues,
|
|
6339
|
+
props.params
|
|
6340
|
+
);
|
|
6341
|
+
try {
|
|
6342
|
+
const response = await props.serviceClient.get(url);
|
|
6343
|
+
dispatch({
|
|
6344
|
+
type: FORM_INPUT_UPDATE,
|
|
6345
|
+
name: "dnsRecords",
|
|
6346
|
+
// @ts-ignore
|
|
6347
|
+
value: response?.result?.dnsRecords
|
|
6348
|
+
});
|
|
6349
|
+
} catch (error) {
|
|
6350
|
+
console.error("Error fetching data:", error);
|
|
6351
|
+
}
|
|
6352
|
+
}, [formState.lastPropertyChanged, formState.inputValues]);
|
|
6353
|
+
(0, import_react56.useEffect)(() => {
|
|
6354
|
+
fetchData();
|
|
6355
|
+
}, [formState.inputValues, formState.lastPropertyChanged]);
|
|
6356
|
+
function replacePlaceholders(template, context, params) {
|
|
6357
|
+
console.log("from replace:");
|
|
6358
|
+
console.log(params);
|
|
6359
|
+
console.log(template);
|
|
6360
|
+
return template.replace(
|
|
6361
|
+
/\{(context|params)\.([\w]+)\}/g,
|
|
6362
|
+
(_, type, key) => {
|
|
6363
|
+
if (type === "context" && context && key in context && context[key]) {
|
|
6364
|
+
return String(context[key]);
|
|
6365
|
+
}
|
|
6366
|
+
if (type === "params" && params && key in params && params[key]) {
|
|
6367
|
+
return String(params[key]);
|
|
6368
|
+
}
|
|
6369
|
+
return "";
|
|
6370
|
+
}
|
|
6371
|
+
);
|
|
6372
|
+
}
|
|
6373
|
+
const handleChildSectionChangeCallback = (0, import_react56.useCallback)(
|
|
6374
|
+
(params) => {
|
|
6375
|
+
dispatch({
|
|
6376
|
+
type: params.actionType,
|
|
6377
|
+
name: params.name,
|
|
6378
|
+
value: params.value,
|
|
6379
|
+
// @ts-ignore
|
|
6380
|
+
childName: params.sectionName,
|
|
6381
|
+
rowIndex: params.rowIndex
|
|
6382
|
+
});
|
|
6383
|
+
},
|
|
6384
|
+
[dispatch]
|
|
6385
|
+
);
|
|
6386
|
+
const onValidate = async () => {
|
|
6387
|
+
if (formRef.current && !formRef.current.checkValidity()) {
|
|
6388
|
+
formRef.current.classList.add("validated");
|
|
6389
|
+
return false;
|
|
6390
|
+
} else {
|
|
6391
|
+
return true;
|
|
6392
|
+
}
|
|
6393
|
+
};
|
|
6394
|
+
function normalizeChildSections(values, isEdit, sections) {
|
|
6395
|
+
if (!sections) return values;
|
|
6396
|
+
const cloned = structuredClone(values);
|
|
6397
|
+
sections.forEach((section) => {
|
|
6398
|
+
section.childSections?.forEach((child) => {
|
|
6399
|
+
const childName = child.name;
|
|
6400
|
+
const relation = child.relationshipType;
|
|
6401
|
+
const childValue = cloned[childName];
|
|
6402
|
+
if (!childValue) return;
|
|
6403
|
+
if (relation === "one-to-many" && Array.isArray(childValue)) {
|
|
6404
|
+
cloned[childName] = childValue.filter((row) => {
|
|
6405
|
+
if (isEdit) return true;
|
|
6406
|
+
return !row.isDeleted;
|
|
6407
|
+
});
|
|
6408
|
+
}
|
|
6409
|
+
if (relation === "one-to-one" && typeof childValue === "object") {
|
|
6410
|
+
if (!isEdit && childValue.isDeleted) {
|
|
6411
|
+
delete cloned[childName];
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
});
|
|
6415
|
+
});
|
|
6416
|
+
return cloned;
|
|
6417
|
+
}
|
|
6418
|
+
const onClick = (0, import_react56.useCallback)(async () => {
|
|
6419
|
+
if (props.onClick) {
|
|
6420
|
+
const isEdit = props.dataItem && Object.keys(props.dataItem).length > 0;
|
|
6421
|
+
const normalizedValues = normalizeChildSections(
|
|
6422
|
+
formState.inputValues,
|
|
6423
|
+
!!isEdit,
|
|
6424
|
+
props.sections
|
|
6425
|
+
);
|
|
6426
|
+
return await props.onClick({
|
|
6427
|
+
...formState,
|
|
6428
|
+
inputValues: normalizedValues
|
|
6429
|
+
});
|
|
6430
|
+
} else {
|
|
6431
|
+
return { isSuccessful: true };
|
|
6432
|
+
}
|
|
6433
|
+
}, [formState, props]);
|
|
6434
|
+
const handleAdditionalOnClick = (0, import_react56.useCallback)(async () => {
|
|
6435
|
+
if (props.additionalActions?.onClick) {
|
|
6436
|
+
return await props.additionalActions.onClick(formState);
|
|
6437
|
+
} else {
|
|
6438
|
+
return { isSuccessful: true, message: "Action completed successfully" };
|
|
6439
|
+
}
|
|
6440
|
+
}, [formState, props]);
|
|
6441
|
+
const onDelete = (0, import_react56.useCallback)(async () => {
|
|
6442
|
+
if (props.onDelete) {
|
|
6443
|
+
return await props.onDelete(formState);
|
|
6444
|
+
} else {
|
|
6445
|
+
return { isSuccessful: true };
|
|
6446
|
+
}
|
|
6447
|
+
}, [formState, props]);
|
|
6448
|
+
(0, import_react56.useEffect)(() => {
|
|
6449
|
+
if (props.dataItem) {
|
|
6450
|
+
dispatch({
|
|
6451
|
+
type: FORM_INITIAL_UPDATE,
|
|
6452
|
+
values: props.dataItem,
|
|
6453
|
+
name: "all"
|
|
6454
|
+
});
|
|
6455
|
+
}
|
|
6456
|
+
}, [props.dataItem]);
|
|
6457
|
+
function getNestedProperty2(obj, path) {
|
|
6458
|
+
if (path.includes(".")) {
|
|
6459
|
+
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
6460
|
+
} else {
|
|
6461
|
+
return obj[path];
|
|
6462
|
+
}
|
|
6463
|
+
}
|
|
6464
|
+
function evalutateCondition(context, expression) {
|
|
6465
|
+
if (expression === null || expression === void 0) {
|
|
6466
|
+
return true;
|
|
6467
|
+
}
|
|
6468
|
+
try {
|
|
6469
|
+
const evaluator = new Function("context", `return ${expression};`);
|
|
6470
|
+
return evaluator(context);
|
|
6471
|
+
} catch (error) {
|
|
6472
|
+
console.error("Error evaluating expression:", error);
|
|
6473
|
+
return false;
|
|
6474
|
+
}
|
|
6475
|
+
}
|
|
6476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react56.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "flex-grow flex flex-col", children: [
|
|
6477
|
+
props.title && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "inline-flex items-center gap-2 px-6 py-3 border border-neutral-200 bg-white shadow-sm rounded-t-md", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
6478
|
+
"div",
|
|
6479
|
+
{
|
|
6480
|
+
className: "inline-flex items-center gap-2 cursor-pointer",
|
|
6481
|
+
onClick: () => window.history.back(),
|
|
6482
|
+
children: [
|
|
6483
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Icon_default, { name: "chevronLeft", className: "w-4 h-4 text-primary-800" }),
|
|
6484
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("h2", { className: "text-lg font-semibold text-primary-800", children: props.title })
|
|
6485
|
+
]
|
|
6486
|
+
}
|
|
6487
|
+
) }),
|
|
6488
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
6489
|
+
"form",
|
|
6490
|
+
{
|
|
6491
|
+
className: "group space-y-6 pb-6 overflow-y-auto",
|
|
6492
|
+
noValidate: true,
|
|
6493
|
+
ref: formRef,
|
|
6494
|
+
onKeyDown: (e) => {
|
|
6495
|
+
if (e.key === "Enter") {
|
|
6496
|
+
const activeElement = document.activeElement;
|
|
6497
|
+
console.log(activeElement);
|
|
6498
|
+
if (activeElement.tagName === "INPUT") {
|
|
6499
|
+
e.preventDefault();
|
|
6500
|
+
}
|
|
6501
|
+
if (activeElement.tagName === "BUTTON" && activeElement.dataset.role === "add") {
|
|
6502
|
+
return;
|
|
6503
|
+
}
|
|
6504
|
+
if (activeElement.tagName === "BUTTON" && activeElement.dataset.role === "delete") {
|
|
6505
|
+
e.preventDefault();
|
|
6506
|
+
}
|
|
6507
|
+
}
|
|
6508
|
+
},
|
|
6509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "flex flex-col gap-6", children: props.sections?.map((section, sectionIndex) => {
|
|
6510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react56.default.Fragment, { children: !section.isChildSection && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: " rounded-b-lg bg-white shadow border-neutral-200 border px-8 py-6 ", children: [
|
|
6511
|
+
section.sectionRows?.map(
|
|
6512
|
+
(sectionRow, sectionRowIndex) => {
|
|
6513
|
+
const elementsCount = sectionRow.elements.length;
|
|
6514
|
+
let isVisible = true;
|
|
6515
|
+
if (sectionRow.visible) {
|
|
6516
|
+
isVisible = evalutateCondition(
|
|
6517
|
+
formState.inputValues,
|
|
6518
|
+
sectionRow.visible
|
|
6519
|
+
);
|
|
7559
6520
|
}
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7564
|
-
"svg",
|
|
7565
|
-
{
|
|
7566
|
-
className: "mx-auto h-12 w-12 text-gray-400",
|
|
7567
|
-
fill: "none",
|
|
7568
|
-
stroke: "currentColor",
|
|
7569
|
-
viewBox: "0 0 24 24",
|
|
7570
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7571
|
-
"path",
|
|
6521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_react56.default.Fragment, { children: isVisible && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "lg:flex gap-14 flex-1 mb-4 ", children: sectionRow.elements.map((field, index) => {
|
|
6522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
6523
|
+
"div",
|
|
7572
6524
|
{
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
strokeWidth: 2,
|
|
7576
|
-
d: "M13 10V3L4 14h7v7l9-11h-7z"
|
|
7577
|
-
}
|
|
7578
|
-
)
|
|
7579
|
-
}
|
|
7580
|
-
),
|
|
7581
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h3", { className: "mt-2 text-sm text-gray-900", children: "No actions" }),
|
|
7582
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("p", { className: "mt-1 text-sm text-gray-500", children: "Get started by adding actions." }),
|
|
7583
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "mt-6", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7584
|
-
Button_default,
|
|
7585
|
-
{
|
|
7586
|
-
ButtonType: "Primary" /* Solid */,
|
|
7587
|
-
onClick: async () => {
|
|
7588
|
-
addAction();
|
|
7589
|
-
return {
|
|
7590
|
-
isSuccessful: true,
|
|
7591
|
-
message: "Action added successfully"
|
|
7592
|
-
};
|
|
7593
|
-
},
|
|
7594
|
-
children: [
|
|
7595
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7596
|
-
"svg",
|
|
7597
|
-
{
|
|
7598
|
-
className: "w-4 h-4 mr-2",
|
|
7599
|
-
fill: "none",
|
|
7600
|
-
stroke: "currentColor",
|
|
7601
|
-
viewBox: "0 0 24 24",
|
|
7602
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7603
|
-
"path",
|
|
7604
|
-
{
|
|
7605
|
-
strokeLinecap: "round",
|
|
7606
|
-
strokeLinejoin: "round",
|
|
7607
|
-
strokeWidth: 2,
|
|
7608
|
-
d: "M12 4v16m8-8H4"
|
|
7609
|
-
}
|
|
7610
|
-
)
|
|
7611
|
-
}
|
|
7612
|
-
),
|
|
7613
|
-
"Add an action"
|
|
7614
|
-
]
|
|
7615
|
-
}
|
|
7616
|
-
) })
|
|
7617
|
-
] }) : actions.map(
|
|
7618
|
-
(action, index) => !action.isDeleted && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7619
|
-
"div",
|
|
7620
|
-
{
|
|
7621
|
-
className: "border border-gray-200 rounded-lg overflow-hidden",
|
|
7622
|
-
children: [
|
|
7623
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "p-4 bg-gray-50 border-b border-gray-200", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
7624
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("h3", { className: "text-sm font-medium text-gray-700", children: action.actionTitle || "New Action" }),
|
|
7625
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7626
|
-
Button_default,
|
|
7627
|
-
{
|
|
7628
|
-
ButtonType: "Primary" /* Solid */,
|
|
7629
|
-
onClick: async () => {
|
|
7630
|
-
deleteAction(index);
|
|
7631
|
-
return {
|
|
7632
|
-
isSuccessful: true,
|
|
7633
|
-
message: "Action deleted successfully"
|
|
7634
|
-
};
|
|
7635
|
-
},
|
|
7636
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7637
|
-
"svg",
|
|
7638
|
-
{
|
|
7639
|
-
className: "w-4 h-4",
|
|
7640
|
-
fill: "none",
|
|
7641
|
-
stroke: "currentColor",
|
|
7642
|
-
viewBox: "0 0 24 24",
|
|
7643
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7644
|
-
"path",
|
|
7645
|
-
{
|
|
7646
|
-
strokeLinecap: "round",
|
|
7647
|
-
strokeLinejoin: "round",
|
|
7648
|
-
strokeWidth: 2,
|
|
7649
|
-
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
7650
|
-
}
|
|
7651
|
-
)
|
|
7652
|
-
}
|
|
7653
|
-
)
|
|
7654
|
-
}
|
|
7655
|
-
)
|
|
7656
|
-
] }) }),
|
|
7657
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
|
|
7658
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7659
|
-
InputControl_default,
|
|
7660
|
-
{
|
|
7661
|
-
name: "actionCode",
|
|
7662
|
-
controlType: InputControlType_default.select,
|
|
7663
|
-
value: action.actionCode || "",
|
|
7664
|
-
dataset: actionCode,
|
|
7665
|
-
dataKeyFieldName: "value",
|
|
7666
|
-
dataTextFieldName: "label",
|
|
7667
|
-
callback: ({ name, value }) => {
|
|
7668
|
-
updateActionField(
|
|
7669
|
-
index,
|
|
7670
|
-
"actionCode",
|
|
7671
|
-
value
|
|
7672
|
-
);
|
|
7673
|
-
},
|
|
7674
|
-
attributes: {
|
|
7675
|
-
required: true,
|
|
7676
|
-
label: "ActionCode"
|
|
7677
|
-
}
|
|
7678
|
-
}
|
|
7679
|
-
) }),
|
|
7680
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7681
|
-
InputControl_default,
|
|
7682
|
-
{
|
|
7683
|
-
controlType: InputControlType_default.lineTextInput,
|
|
7684
|
-
name: "action.actionTitle",
|
|
7685
|
-
value: action.actionTitle || "",
|
|
7686
|
-
callback: ({ value }) => {
|
|
7687
|
-
updateActionField(
|
|
7688
|
-
index,
|
|
7689
|
-
"actionTitle",
|
|
7690
|
-
value
|
|
7691
|
-
);
|
|
7692
|
-
},
|
|
7693
|
-
attributes: {
|
|
7694
|
-
label: "ActionTitle",
|
|
7695
|
-
placeholder: "actionTitle"
|
|
7696
|
-
}
|
|
7697
|
-
}
|
|
7698
|
-
) }),
|
|
7699
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6525
|
+
className: sectionRow.grow ? "grow" : "",
|
|
6526
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
7700
6527
|
InputControl_default,
|
|
7701
6528
|
{
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
value:
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
{
|
|
7721
|
-
name: "httpMethod",
|
|
7722
|
-
controlType: InputControlType_default.select,
|
|
7723
|
-
value: action.httpMethod || "post",
|
|
7724
|
-
dataset: httpMethods,
|
|
7725
|
-
dataKeyFieldName: "value",
|
|
7726
|
-
dataTextFieldName: "label",
|
|
7727
|
-
callback: ({ name, value }) => {
|
|
7728
|
-
updateActionField(
|
|
7729
|
-
index,
|
|
7730
|
-
"httpMethod",
|
|
7731
|
-
value
|
|
7732
|
-
);
|
|
7733
|
-
},
|
|
7734
|
-
attributes: {
|
|
7735
|
-
label: "HTTP Method",
|
|
7736
|
-
required: true
|
|
7737
|
-
}
|
|
6529
|
+
name: field.name,
|
|
6530
|
+
controlType: field.controlType,
|
|
6531
|
+
value: getNestedProperty2(
|
|
6532
|
+
formState.inputValues,
|
|
6533
|
+
field.name
|
|
6534
|
+
),
|
|
6535
|
+
callback: handleInputChange,
|
|
6536
|
+
dataSourceDependsOn: field.dataSourceDependsOn,
|
|
6537
|
+
dependentValue: field.dataSourceDependsOn ? formState.inputValues[field.dataSourceDependsOn] : "",
|
|
6538
|
+
dataSource: field.dataSource,
|
|
6539
|
+
dataset: field.dataset,
|
|
6540
|
+
dataKeyFieldName: field.dataKeyFieldName,
|
|
6541
|
+
dataTextFieldName: field.dataTextFieldName,
|
|
6542
|
+
attributes: field.attributes,
|
|
6543
|
+
serviceClient: props.serviceClient,
|
|
6544
|
+
assetsUploadPath: props.dataItem ? props.dataItem["assetsUploadPath"] : null,
|
|
6545
|
+
entityType: field.entityType,
|
|
6546
|
+
uploadInSharedLocation: field.uploadInSharedLocation
|
|
7738
6547
|
}
|
|
7739
|
-
)
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
)
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
showToast: true,
|
|
7754
|
-
onClick: async () => {
|
|
7755
|
-
const response = await onDelete();
|
|
7756
|
-
return {
|
|
7757
|
-
isSuccessful: response.isSuccessful,
|
|
7758
|
-
message: response.isSuccessful ? "Form deleted successfully!" : "Failed to delete form"
|
|
7759
|
-
};
|
|
7760
|
-
},
|
|
7761
|
-
children: [
|
|
7762
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7763
|
-
"svg",
|
|
7764
|
-
{
|
|
7765
|
-
className: "w-4 h-4 mr-2",
|
|
7766
|
-
fill: "none",
|
|
7767
|
-
stroke: "currentColor",
|
|
7768
|
-
viewBox: "0 0 24 24",
|
|
7769
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7770
|
-
"path",
|
|
7771
|
-
{
|
|
7772
|
-
strokeLinecap: "round",
|
|
7773
|
-
strokeLinejoin: "round",
|
|
7774
|
-
strokeWidth: 2,
|
|
7775
|
-
d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
|
7776
|
-
}
|
|
7777
|
-
)
|
|
7778
|
-
}
|
|
7779
|
-
),
|
|
7780
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: "Delete Form" })
|
|
7781
|
-
]
|
|
7782
|
-
}
|
|
7783
|
-
),
|
|
7784
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
7785
|
-
Button_default,
|
|
7786
|
-
{
|
|
7787
|
-
ButtonType: "Primary" /* Solid */,
|
|
7788
|
-
showToast: true,
|
|
7789
|
-
onClick: async () => {
|
|
7790
|
-
const response = await onSave();
|
|
7791
|
-
return {
|
|
7792
|
-
isSuccessful: response.isSuccessful,
|
|
7793
|
-
message: response.isSuccessful ? isEditMode ? "Form updated successfully!" : "Form created successfully!" : "Failed to save form"
|
|
7794
|
-
};
|
|
7795
|
-
},
|
|
7796
|
-
children: [
|
|
7797
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7798
|
-
"svg",
|
|
6548
|
+
)
|
|
6549
|
+
},
|
|
6550
|
+
field.name
|
|
6551
|
+
);
|
|
6552
|
+
}) }) }, sectionRowIndex);
|
|
6553
|
+
}
|
|
6554
|
+
),
|
|
6555
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: section.childSections?.map(
|
|
6556
|
+
(childSection, childSectionIndex) => {
|
|
6557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: childSection.name && evalutateCondition(
|
|
6558
|
+
formState.inputValues,
|
|
6559
|
+
childSection.visible
|
|
6560
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
6561
|
+
DataFormChildSection_default,
|
|
7799
6562
|
{
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7805
|
-
"path",
|
|
7806
|
-
{
|
|
7807
|
-
strokeLinecap: "round",
|
|
7808
|
-
strokeLinejoin: "round",
|
|
7809
|
-
strokeWidth: 2,
|
|
7810
|
-
d: "M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4"
|
|
7811
|
-
}
|
|
7812
|
-
)
|
|
6563
|
+
section: childSection,
|
|
6564
|
+
childItems: formState.inputValues[childSection.name],
|
|
6565
|
+
callback: handleChildSectionChangeCallback,
|
|
6566
|
+
serviceClient: props.serviceClient
|
|
7813
6567
|
}
|
|
7814
|
-
),
|
|
7815
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: loadingApps ? "Loading..." : isEditMode ? "Update Layout" : "Create Layout" })
|
|
7816
|
-
]
|
|
7817
|
-
}
|
|
7818
|
-
)
|
|
7819
|
-
] })
|
|
7820
|
-
] })
|
|
7821
|
-
] }),
|
|
7822
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "w-96 bg-white border-l border-gray-200 overflow-y-auto", children: [
|
|
7823
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "sticky top-0 bg-white border-b border-gray-200 px-6 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("h2", { className: "text-lg font-semibold text-gray-800 flex items-center", children: [
|
|
7824
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7825
|
-
"svg",
|
|
7826
|
-
{
|
|
7827
|
-
className: "w-5 h-5 mr-2 text-gray-600",
|
|
7828
|
-
fill: "none",
|
|
7829
|
-
stroke: "currentColor",
|
|
7830
|
-
viewBox: "0 0 24 24",
|
|
7831
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
7832
|
-
"path",
|
|
7833
|
-
{
|
|
7834
|
-
strokeLinecap: "round",
|
|
7835
|
-
strokeLinejoin: "round",
|
|
7836
|
-
strokeWidth: 2,
|
|
7837
|
-
d: "M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"
|
|
6568
|
+
) }, childSectionIndex);
|
|
7838
6569
|
}
|
|
7839
|
-
)
|
|
7840
|
-
}
|
|
7841
|
-
)
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
6570
|
+
) })
|
|
6571
|
+
] }) }, sectionIndex);
|
|
6572
|
+
}) })
|
|
6573
|
+
}
|
|
6574
|
+
),
|
|
6575
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "flex px-6 py-3 mt-2 mb-2 justify-end items-center gap-5", children: [
|
|
6576
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: props.additionalActions && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
6577
|
+
Button_default,
|
|
6578
|
+
{
|
|
6579
|
+
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
6580
|
+
onClick: handleAdditionalOnClick,
|
|
6581
|
+
children: props.additionalActions.title
|
|
6582
|
+
}
|
|
6583
|
+
) }),
|
|
6584
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: props.onDelete && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
6585
|
+
Button_default,
|
|
6586
|
+
{
|
|
6587
|
+
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
6588
|
+
onClick: onDelete,
|
|
6589
|
+
showToast: true,
|
|
6590
|
+
confirm: true,
|
|
6591
|
+
confirmationMessage: "Are you sure you want to delete this record?",
|
|
6592
|
+
children: "Delete"
|
|
6593
|
+
}
|
|
6594
|
+
) }),
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { children: props.onClick && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
6596
|
+
Button_default,
|
|
6597
|
+
{
|
|
6598
|
+
onValidate,
|
|
6599
|
+
onClick,
|
|
6600
|
+
showToast: true,
|
|
6601
|
+
ButtonType: "Primary" /* Solid */,
|
|
6602
|
+
className: "py-2 leading-6",
|
|
6603
|
+
children: props.buttonText ? `${props.buttonText}` : "Save Changes"
|
|
6604
|
+
}
|
|
6605
|
+
) })
|
|
7845
6606
|
] })
|
|
7846
6607
|
] }) });
|
|
7847
|
-
}
|
|
7848
|
-
var DataForm_default =
|
|
6608
|
+
};
|
|
6609
|
+
var DataForm_default = DataForm2;
|
|
7849
6610
|
|
|
7850
6611
|
// src/components/dataForm/DataFormRenderer.tsx
|
|
7851
6612
|
init_ServiceClient();
|
|
7852
|
-
var
|
|
6613
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
7853
6614
|
function getAction(actions, code) {
|
|
7854
6615
|
return actions?.find((a) => a.actionCode === code);
|
|
7855
6616
|
}
|
|
@@ -7875,9 +6636,9 @@ var DataFormRenderer = ({
|
|
|
7875
6636
|
"Delete"
|
|
7876
6637
|
);
|
|
7877
6638
|
const hasDataItem = dataItem && Object.keys(dataItem).length > 0;
|
|
7878
|
-
return /* @__PURE__ */ (0,
|
|
7879
|
-
widgetProps && /* @__PURE__ */ (0,
|
|
7880
|
-
/* @__PURE__ */ (0,
|
|
6639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex-grow flex flex-col", children: [
|
|
6640
|
+
widgetProps && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(NavigationTabsV2_default, { tabs, params: widgetProps.params }),
|
|
6641
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
7881
6642
|
DataForm_default,
|
|
7882
6643
|
{
|
|
7883
6644
|
title: !isAddPage ? "Edit " + formDefinition.formTitle + "- v2" : "Add " + formDefinition.formTitle + "- v2",
|