@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.mjs
CHANGED
|
@@ -3,10 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-TXHD4F4A.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Button_default,
|
|
6
|
+
ClientButton_default,
|
|
6
7
|
ServiceClient_default,
|
|
7
8
|
ToastService_default,
|
|
8
9
|
buttonClasses
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WMUACDXV.mjs";
|
|
10
11
|
|
|
11
12
|
// src/components/controls/view/ViewControl.tsx
|
|
12
13
|
import React10 from "react";
|
|
@@ -2050,7 +2051,7 @@ function Hyperlink(props) {
|
|
|
2050
2051
|
// src/components/pageRenderingEngine/nodes/LinkNode.tsx
|
|
2051
2052
|
import dynamic2 from "next/dynamic";
|
|
2052
2053
|
import { Fragment as Fragment3, jsx as jsx33, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2053
|
-
var LinkNodeButton = dynamic2(() => import("./LinkNodeButton-
|
|
2054
|
+
var LinkNodeButton = dynamic2(() => import("./LinkNodeButton-3AK5H5ZU.mjs"), {
|
|
2054
2055
|
ssr: false
|
|
2055
2056
|
});
|
|
2056
2057
|
var LinkNode = (props) => {
|
|
@@ -4917,1790 +4918,548 @@ var DataListRenderer = ({
|
|
|
4917
4918
|
var DataListRenderer_default = DataListRenderer;
|
|
4918
4919
|
|
|
4919
4920
|
// src/components/dataForm/DataForm.tsx
|
|
4920
|
-
import {
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
"
|
|
4928
|
-
"
|
|
4929
|
-
"
|
|
4930
|
-
"
|
|
4931
|
-
"
|
|
4932
|
-
"
|
|
4933
|
-
"
|
|
4934
|
-
"
|
|
4935
|
-
"
|
|
4936
|
-
];
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
var
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
setFormTitle,
|
|
4957
|
-
entityIdParamName,
|
|
4958
|
-
setEntityIdParamName,
|
|
4959
|
-
selectedAppId,
|
|
4960
|
-
setSelectedAppId,
|
|
4961
|
-
apps,
|
|
4962
|
-
loadingApps,
|
|
4963
|
-
isEditMode,
|
|
4964
|
-
nextTempId,
|
|
4965
|
-
setNextTempId,
|
|
4966
|
-
onSave,
|
|
4967
|
-
onDelete,
|
|
4968
|
-
siteFormTypeId = 2
|
|
4969
|
-
}) {
|
|
4970
|
-
const [selectedItem, setSelectedItem] = useState10(null);
|
|
4971
|
-
const [activeTab, setActiveTab] = useState10("config");
|
|
4972
|
-
const addSection = () => {
|
|
4973
|
-
const tempId = nextTempId;
|
|
4974
|
-
setNextTempId(nextTempId - 1);
|
|
4975
|
-
const newSectionIndex = sections.length;
|
|
4976
|
-
setSections([
|
|
4977
|
-
...sections,
|
|
4978
|
-
{
|
|
4979
|
-
siteFormDataFormSectionId: tempId,
|
|
4980
|
-
sectionTitle: "New Section",
|
|
4981
|
-
sectionName: `section_${Math.abs(tempId)}`,
|
|
4982
|
-
isChildSection: false,
|
|
4983
|
-
parentSectionName: null,
|
|
4984
|
-
rows: [],
|
|
4985
|
-
isDeleted: false
|
|
4986
|
-
}
|
|
4987
|
-
]);
|
|
4988
|
-
setTimeout(() => {
|
|
4989
|
-
setSelectedItem({
|
|
4990
|
-
type: "section",
|
|
4991
|
-
sectionIndex: newSectionIndex
|
|
4992
|
-
});
|
|
4993
|
-
}, 0);
|
|
4994
|
-
};
|
|
4995
|
-
const deleteSection = (sectionIndex) => {
|
|
4996
|
-
setSections(
|
|
4997
|
-
sections.map(
|
|
4998
|
-
(section, i) => i === sectionIndex ? { ...section, isDeleted: true } : section
|
|
4999
|
-
)
|
|
5000
|
-
);
|
|
5001
|
-
if (selectedItem?.type === "section" && selectedItem.sectionIndex === sectionIndex) {
|
|
5002
|
-
setSelectedItem(null);
|
|
5003
|
-
}
|
|
5004
|
-
};
|
|
5005
|
-
const updateSectionTitle = (sectionIndex, value) => {
|
|
5006
|
-
updateSectionField(sectionIndex, "sectionTitle", value);
|
|
4921
|
+
import React48, { useCallback as useCallback5, useEffect as useEffect10, useReducer as useReducer3, useRef as useRef4 } from "react";
|
|
4922
|
+
|
|
4923
|
+
// src/components/dataForm/DataFormChildSection.tsx
|
|
4924
|
+
import React47, { useCallback as useCallback4 } from "react";
|
|
4925
|
+
|
|
4926
|
+
// src/components/dataForm/StyleTypes.tsx
|
|
4927
|
+
var StyleTypes2 = /* @__PURE__ */ ((StyleTypes3) => {
|
|
4928
|
+
StyleTypes3["Primary"] = "Primary";
|
|
4929
|
+
StyleTypes3["PrimaryHollow"] = "PrimaryHollow";
|
|
4930
|
+
StyleTypes3["Secondary"] = "Secondary";
|
|
4931
|
+
StyleTypes3["SecondaryHollow"] = "SecondaryHollow";
|
|
4932
|
+
StyleTypes3["Neutral"] = "Neutral";
|
|
4933
|
+
StyleTypes3["NeutralHollow"] = "NeutralHollow";
|
|
4934
|
+
StyleTypes3["Link"] = "Link";
|
|
4935
|
+
StyleTypes3["Ripple"] = "Ripple";
|
|
4936
|
+
StyleTypes3["Danger"] = "Danger";
|
|
4937
|
+
StyleTypes3["Light"] = "Light";
|
|
4938
|
+
return StyleTypes3;
|
|
4939
|
+
})(StyleTypes2 || {});
|
|
4940
|
+
|
|
4941
|
+
// src/components/dataForm/FormReducer.tsx
|
|
4942
|
+
var FORM_CHILD_INPUT_UPDATE = "FORM_CHILD_INPUT_UPDATE";
|
|
4943
|
+
var FORM_CHILD_ONE_TO_ONE_UPDATE = "FORM_CHILD_ONE_TO_ONE_UPDATE";
|
|
4944
|
+
var FORM_CHILD_ROW_ADD = "FORM_CHILD_ROW_ADD";
|
|
4945
|
+
|
|
4946
|
+
// src/components/dataForm/DataFormChildSection.tsx
|
|
4947
|
+
import { jsx as jsx65, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4948
|
+
var DataFormChildSection = (props) => {
|
|
4949
|
+
const { section } = props;
|
|
4950
|
+
const isOneToOne = section.relationshipType === "one-to-one";
|
|
4951
|
+
const childItems = props.childItems || [];
|
|
4952
|
+
const getChildItemsForRendering = () => {
|
|
4953
|
+
if (isOneToOne) {
|
|
4954
|
+
return [{ item: props.childItems ?? {}, originalIndex: 0 }];
|
|
4955
|
+
}
|
|
4956
|
+
return childItems.map((item, originalIndex) => ({ item, originalIndex })).filter((x) => !x.item.isDeleted) || [];
|
|
5007
4957
|
};
|
|
5008
|
-
const
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
4958
|
+
const childItemsToRender = getChildItemsForRendering();
|
|
4959
|
+
const handleChildInputChange = useCallback4(
|
|
4960
|
+
(updatedValues) => {
|
|
4961
|
+
if (isOneToOne) {
|
|
4962
|
+
props.callback({
|
|
4963
|
+
sectionName: props.section.name,
|
|
4964
|
+
actionType: FORM_CHILD_ONE_TO_ONE_UPDATE,
|
|
4965
|
+
name: updatedValues.name,
|
|
4966
|
+
value: updatedValues.value,
|
|
4967
|
+
rowIndex: -1
|
|
4968
|
+
});
|
|
4969
|
+
} else {
|
|
4970
|
+
const filteredIndex = updatedValues.index;
|
|
4971
|
+
const visibleItem = childItemsToRender[filteredIndex];
|
|
4972
|
+
if (visibleItem) {
|
|
4973
|
+
props.callback({
|
|
4974
|
+
sectionName: props.section.name,
|
|
4975
|
+
actionType: FORM_CHILD_INPUT_UPDATE,
|
|
4976
|
+
name: updatedValues.name,
|
|
4977
|
+
value: updatedValues.value,
|
|
4978
|
+
rowIndex: visibleItem.originalIndex
|
|
4979
|
+
// Use ORIGINAL index!
|
|
4980
|
+
});
|
|
5025
4981
|
}
|
|
5026
|
-
return section;
|
|
5027
4982
|
}
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
4983
|
+
},
|
|
4984
|
+
[props, isOneToOne, childItemsToRender]
|
|
4985
|
+
);
|
|
4986
|
+
const onAddRow = useCallback4(() => {
|
|
4987
|
+
props.callback({
|
|
4988
|
+
sectionName: props.section.name,
|
|
4989
|
+
actionType: FORM_CHILD_ROW_ADD,
|
|
4990
|
+
name: "all",
|
|
4991
|
+
value: null,
|
|
4992
|
+
rowIndex: -1
|
|
4993
|
+
});
|
|
4994
|
+
}, [props]);
|
|
4995
|
+
const onDeleteRow = useCallback4(
|
|
4996
|
+
(filteredIndex) => {
|
|
4997
|
+
const visibleItem = childItemsToRender[filteredIndex];
|
|
4998
|
+
if (visibleItem) {
|
|
4999
|
+
props.callback({
|
|
5000
|
+
sectionName: props.section.name,
|
|
5001
|
+
actionType: FORM_CHILD_INPUT_UPDATE,
|
|
5002
|
+
name: "isDeleted",
|
|
5003
|
+
value: true,
|
|
5004
|
+
rowIndex: visibleItem.originalIndex
|
|
5005
|
+
// Use ORIGINAL index!
|
|
5006
|
+
});
|
|
5036
5007
|
}
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5008
|
+
},
|
|
5009
|
+
[props, childItemsToRender]
|
|
5010
|
+
);
|
|
5011
|
+
console.log("Rendering Child Section:", {
|
|
5012
|
+
childItemsToRender,
|
|
5013
|
+
allChildItems: childItems
|
|
5014
|
+
});
|
|
5015
|
+
return /* @__PURE__ */ jsx65(React47.Fragment, { children: /* @__PURE__ */ jsxs37("div", { className: "rounded border-neutral-200 border px-6 py-4 mb-2", children: [
|
|
5016
|
+
section.sectionTitle && /* @__PURE__ */ jsx65("div", { className: "mb-4 text-lg font-medium text-body-950", children: section.sectionTitle }),
|
|
5017
|
+
/* @__PURE__ */ jsx65("div", { className: "flex-grow flex flex-col justify-between overflow-y-auto", children: /* @__PURE__ */ jsxs37("div", { className: "flex flex-col justify-between gap-2", children: [
|
|
5018
|
+
/* @__PURE__ */ jsx65("div", { children: /* @__PURE__ */ jsxs37("table", { className: "w-full border-separate divide-y divide-gray-200", children: [
|
|
5019
|
+
(!isOneToOne || childItemsToRender.length > 0) && /* @__PURE__ */ jsx65("thead", { className: "", children: section.sectionRows.map((sectionRow, sectionRowIndex) => {
|
|
5020
|
+
return /* @__PURE__ */ jsxs37("tr", { className: "", children: [
|
|
5021
|
+
sectionRow.elements.map((field, index) => {
|
|
5022
|
+
return /* @__PURE__ */ jsx65(
|
|
5023
|
+
"th",
|
|
5024
|
+
{
|
|
5025
|
+
className: "py-3 font-normal text-left",
|
|
5026
|
+
children: field.attributes?.label
|
|
5027
|
+
},
|
|
5028
|
+
field.name
|
|
5029
|
+
);
|
|
5030
|
+
}),
|
|
5031
|
+
!section.readonly && !isOneToOne && /* @__PURE__ */ jsx65("th", { className: "py-3 font-normal text-left", children: "Actions" })
|
|
5032
|
+
] }, sectionRowIndex);
|
|
5033
|
+
}) }),
|
|
5034
|
+
/* @__PURE__ */ jsx65("tbody", { className: "divide-y divide-gray-200", children: childItemsToRender.map((visibleItem, filteredIndex) => {
|
|
5035
|
+
const { item, originalIndex } = visibleItem;
|
|
5036
|
+
const rowKey = originalIndex;
|
|
5037
|
+
return /* @__PURE__ */ jsx65(React47.Fragment, { children: section.sectionRows.map(
|
|
5038
|
+
(sectionRow, sectionRowIndex) => {
|
|
5039
|
+
return /* @__PURE__ */ jsxs37(
|
|
5040
|
+
"tr",
|
|
5041
|
+
{
|
|
5042
|
+
className: "",
|
|
5043
|
+
children: [
|
|
5044
|
+
sectionRow.elements.map((field, index) => {
|
|
5045
|
+
return /* @__PURE__ */ jsx65("td", { children: /* @__PURE__ */ jsx65("div", { className: "flex-1", children: /* @__PURE__ */ jsx65("div", { className: "w-11/12", children: /* @__PURE__ */ jsx65(
|
|
5046
|
+
InputControl_default,
|
|
5047
|
+
{
|
|
5048
|
+
index: filteredIndex,
|
|
5049
|
+
name: field.name,
|
|
5050
|
+
controlType: field.controlType,
|
|
5051
|
+
value: item[field.name],
|
|
5052
|
+
dataset: field.dataset,
|
|
5053
|
+
dataKeyFieldName: field.dataKeyFieldName,
|
|
5054
|
+
dataTextFieldName: field.dataTextFieldName,
|
|
5055
|
+
callback: handleChildInputChange,
|
|
5056
|
+
attributes: {
|
|
5057
|
+
...field.attributes,
|
|
5058
|
+
label: ""
|
|
5059
|
+
},
|
|
5060
|
+
serviceClient: props.serviceClient,
|
|
5061
|
+
entityType: field.entityType
|
|
5062
|
+
}
|
|
5063
|
+
) }) }) }, field.name);
|
|
5064
|
+
}),
|
|
5065
|
+
!section.readonly && !isOneToOne && /* @__PURE__ */ jsx65("td", { children: /* @__PURE__ */ jsx65(
|
|
5066
|
+
ClientButton_default,
|
|
5067
|
+
{
|
|
5068
|
+
ButtonType: StyleTypes2.Hollow,
|
|
5069
|
+
onClick: () => {
|
|
5070
|
+
onDeleteRow(filteredIndex);
|
|
5071
|
+
},
|
|
5072
|
+
dataRole: "delete",
|
|
5073
|
+
tabIndex: -1,
|
|
5074
|
+
children: /* @__PURE__ */ jsx65(
|
|
5075
|
+
Icon_default,
|
|
5076
|
+
{
|
|
5077
|
+
className: "w-4 h-4",
|
|
5078
|
+
name: "delete"
|
|
5079
|
+
}
|
|
5080
|
+
)
|
|
5081
|
+
}
|
|
5082
|
+
) })
|
|
5083
|
+
]
|
|
5084
|
+
},
|
|
5085
|
+
`${rowKey}_${sectionRowIndex}`
|
|
5086
|
+
);
|
|
5087
|
+
}
|
|
5088
|
+
) }, rowKey);
|
|
5089
|
+
}) })
|
|
5090
|
+
] }) }),
|
|
5091
|
+
!section.readonly && !isOneToOne && /* @__PURE__ */ jsx65("div", { className: "ml-1", children: /* @__PURE__ */ jsx65(
|
|
5092
|
+
ClientButton_default,
|
|
5093
|
+
{
|
|
5094
|
+
ButtonType: "Link" /* Link */,
|
|
5095
|
+
onClick: onAddRow,
|
|
5096
|
+
dataRole: "add",
|
|
5097
|
+
children: "Add new"
|
|
5043
5098
|
}
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
parentSectionName
|
|
5059
|
-
};
|
|
5060
|
-
}
|
|
5061
|
-
return section;
|
|
5062
|
-
});
|
|
5099
|
+
) })
|
|
5100
|
+
] }) })
|
|
5101
|
+
] }) });
|
|
5102
|
+
};
|
|
5103
|
+
var DataFormChildSection_default = DataFormChildSection;
|
|
5104
|
+
|
|
5105
|
+
// src/components/dataForm/DataForm.tsx
|
|
5106
|
+
import { jsx as jsx66, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
5107
|
+
var DataForm2 = (props) => {
|
|
5108
|
+
const formRef = useRef4(null);
|
|
5109
|
+
console.log(props.dataItem, "dssads");
|
|
5110
|
+
const initialState = {
|
|
5111
|
+
inputValues: {},
|
|
5112
|
+
lastPropertyChanged: ""
|
|
5063
5113
|
};
|
|
5064
|
-
const
|
|
5065
|
-
|
|
5066
|
-
if (i !== sectionIndex) return section;
|
|
5067
|
-
if (field === "parentSectionName") {
|
|
5068
|
-
const parentSectionName = String(value ?? "").trim();
|
|
5069
|
-
return {
|
|
5070
|
-
...section,
|
|
5071
|
-
parentSectionName: parentSectionName || null
|
|
5072
|
-
};
|
|
5073
|
-
}
|
|
5074
|
-
if (field === "isChildSection") {
|
|
5075
|
-
const isChild = Boolean(value);
|
|
5076
|
-
return {
|
|
5077
|
-
...section,
|
|
5078
|
-
isChildSection: isChild,
|
|
5079
|
-
parentSectionName: isChild ? section.parentSectionName ?? null : null
|
|
5080
|
-
};
|
|
5081
|
-
}
|
|
5082
|
-
return { ...section, [field]: value };
|
|
5083
|
-
});
|
|
5084
|
-
setSections(normalizeSectionHierarchy(updated));
|
|
5114
|
+
const childInitialState = {
|
|
5115
|
+
inputValues: []
|
|
5085
5116
|
};
|
|
5086
|
-
const
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
sections
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
{
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5117
|
+
const [formState, dispatch] = useReducer3(FormReducer_default, initialState);
|
|
5118
|
+
console.log(props.sections, "sections");
|
|
5119
|
+
const clearHiddenChildSections = useCallback5(
|
|
5120
|
+
(changedProperty, newValues) => {
|
|
5121
|
+
if (!props.sections) return;
|
|
5122
|
+
const allChildSections = [];
|
|
5123
|
+
props.sections.forEach((section) => {
|
|
5124
|
+
if (section.childSections) {
|
|
5125
|
+
section.childSections.forEach((childSection) => {
|
|
5126
|
+
if (childSection.name) {
|
|
5127
|
+
allChildSections.push({
|
|
5128
|
+
name: childSection.name,
|
|
5129
|
+
section: childSection
|
|
5130
|
+
});
|
|
5100
5131
|
}
|
|
5101
|
-
|
|
5102
|
-
}
|
|
5103
|
-
)
|
|
5104
|
-
);
|
|
5105
|
-
setTimeout(() => {
|
|
5106
|
-
const newRowIndex = sections[sectionIndex]?.rows?.length || 0;
|
|
5107
|
-
setSelectedItem({
|
|
5108
|
-
type: "row",
|
|
5109
|
-
sectionIndex,
|
|
5110
|
-
rowIndex: newRowIndex
|
|
5132
|
+
});
|
|
5133
|
+
}
|
|
5111
5134
|
});
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5135
|
+
allChildSections.forEach(({ name, section }) => {
|
|
5136
|
+
const wasVisible = evalutateCondition(
|
|
5137
|
+
formState.inputValues,
|
|
5138
|
+
section.visible
|
|
5139
|
+
);
|
|
5140
|
+
const isNowVisible = evalutateCondition(newValues, section.visible);
|
|
5141
|
+
if (wasVisible && !isNowVisible) {
|
|
5142
|
+
const currentValue = newValues[name];
|
|
5143
|
+
if (currentValue && (Array.isArray(currentValue) && currentValue.length > 0 || typeof currentValue === "object" && Object.keys(currentValue).length > 0)) {
|
|
5144
|
+
dispatch({
|
|
5145
|
+
// @ts-ignore
|
|
5146
|
+
type: "FORM_CHILD_CLEAR",
|
|
5147
|
+
childName: name,
|
|
5148
|
+
name,
|
|
5149
|
+
value: section.relationshipType === "one-to-one" ? {} : []
|
|
5150
|
+
});
|
|
5151
|
+
}
|
|
5152
|
+
}
|
|
5153
|
+
});
|
|
5154
|
+
},
|
|
5155
|
+
[props.sections, formState.inputValues]
|
|
5156
|
+
);
|
|
5157
|
+
const handleInputChange = useCallback5(
|
|
5158
|
+
async (updatedValues) => {
|
|
5159
|
+
dispatch({
|
|
5160
|
+
type: FORM_INPUT_UPDATE,
|
|
5161
|
+
name: updatedValues.name,
|
|
5162
|
+
value: updatedValues.value
|
|
5163
|
+
});
|
|
5164
|
+
const newInputValues = {
|
|
5165
|
+
...formState.inputValues,
|
|
5166
|
+
[updatedValues.name]: updatedValues.value
|
|
5167
|
+
};
|
|
5168
|
+
clearHiddenChildSections(updatedValues.name, newInputValues);
|
|
5169
|
+
},
|
|
5170
|
+
[dispatch, formState.inputValues, clearHiddenChildSections]
|
|
5171
|
+
);
|
|
5172
|
+
const fetchData = useCallback5(async () => {
|
|
5173
|
+
if (!props.rules) return;
|
|
5174
|
+
if (Object.keys(formState.inputValues).length === 0) {
|
|
5175
|
+
return;
|
|
5126
5176
|
}
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
sections.map((section, i) => {
|
|
5131
|
-
if (i !== sectionIndex) return section;
|
|
5132
|
-
const updatedRows = section.rows?.map(
|
|
5133
|
-
(row, rIndex) => rIndex === rowIndex ? { ...row, grow } : row
|
|
5134
|
-
) ?? [];
|
|
5135
|
-
return { ...section, rows: updatedRows };
|
|
5136
|
-
})
|
|
5177
|
+
console.log("on change called");
|
|
5178
|
+
const changeRule = props.rules.onChangeRules?.find(
|
|
5179
|
+
(x) => x.name === formState.lastPropertyChanged
|
|
5137
5180
|
);
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
...row,
|
|
5148
|
-
elements: [
|
|
5149
|
-
...row.elements ?? [],
|
|
5150
|
-
{
|
|
5151
|
-
siteFormDataFormSectionRowElementId: tempId,
|
|
5152
|
-
name: "",
|
|
5153
|
-
label: "",
|
|
5154
|
-
controlTypeCode: "",
|
|
5155
|
-
dataSource: "",
|
|
5156
|
-
dataKeyFieldName: "",
|
|
5157
|
-
dataTextFieldName: "",
|
|
5158
|
-
maxLength: void 0,
|
|
5159
|
-
minLength: void 0,
|
|
5160
|
-
maxValue: void 0,
|
|
5161
|
-
minValue: void 0,
|
|
5162
|
-
readOnly: false,
|
|
5163
|
-
hintText: "",
|
|
5164
|
-
placeholder: "",
|
|
5165
|
-
required: false,
|
|
5166
|
-
errorMessage: "",
|
|
5167
|
-
helpText: "",
|
|
5168
|
-
autoFocus: false,
|
|
5169
|
-
isDeleted: false
|
|
5170
|
-
}
|
|
5171
|
-
]
|
|
5172
|
-
} : row
|
|
5173
|
-
) ?? [];
|
|
5174
|
-
return { ...section, rows: updatedRows };
|
|
5175
|
-
})
|
|
5181
|
+
if (!changeRule) return;
|
|
5182
|
+
if (changeRule.triggerCondition && !evalutateCondition(formState.inputValues, changeRule.triggerCondition)) {
|
|
5183
|
+
console.log("Trigger condition not met, skipping API call.");
|
|
5184
|
+
return;
|
|
5185
|
+
}
|
|
5186
|
+
const url = replacePlaceholders(
|
|
5187
|
+
changeRule.getApiEndpoint,
|
|
5188
|
+
formState.inputValues,
|
|
5189
|
+
props.params
|
|
5176
5190
|
);
|
|
5177
|
-
|
|
5178
|
-
const
|
|
5179
|
-
|
|
5180
|
-
type:
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5191
|
+
try {
|
|
5192
|
+
const response = await props.serviceClient.get(url);
|
|
5193
|
+
dispatch({
|
|
5194
|
+
type: FORM_INPUT_UPDATE,
|
|
5195
|
+
name: "dnsRecords",
|
|
5196
|
+
// @ts-ignore
|
|
5197
|
+
value: response?.result?.dnsRecords
|
|
5184
5198
|
});
|
|
5185
|
-
}
|
|
5186
|
-
|
|
5187
|
-
const deleteElement = (sectionIndex, rowIndex, elementIndex) => {
|
|
5188
|
-
setSections(
|
|
5189
|
-
sections.map((section, i) => {
|
|
5190
|
-
if (i !== sectionIndex) return section;
|
|
5191
|
-
const updatedRows = section.rows?.map((row, rIndex) => {
|
|
5192
|
-
if (rIndex !== rowIndex) return row;
|
|
5193
|
-
const updatedElements = row.elements?.map(
|
|
5194
|
-
(el, eIndex) => eIndex === elementIndex ? { ...el, isDeleted: true } : el
|
|
5195
|
-
) ?? [];
|
|
5196
|
-
return { ...row, elements: updatedElements };
|
|
5197
|
-
}) ?? [];
|
|
5198
|
-
return { ...section, rows: updatedRows };
|
|
5199
|
-
})
|
|
5200
|
-
);
|
|
5201
|
-
if (selectedItem?.type === "element" && selectedItem.sectionIndex === sectionIndex && selectedItem.rowIndex === rowIndex && selectedItem.elementIndex === elementIndex) {
|
|
5202
|
-
setSelectedItem(null);
|
|
5199
|
+
} catch (error) {
|
|
5200
|
+
console.error("Error fetching data:", error);
|
|
5203
5201
|
}
|
|
5204
|
-
};
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
setNextTempId(nextTempId - 1);
|
|
5223
|
-
setActions([
|
|
5224
|
-
...actions,
|
|
5225
|
-
{
|
|
5226
|
-
siteFormDataFormActionId: tempId,
|
|
5227
|
-
actionCode: "",
|
|
5228
|
-
actionTitle: "",
|
|
5229
|
-
serviceRoute: "",
|
|
5230
|
-
httpMethod: "post",
|
|
5231
|
-
returnRoute: null,
|
|
5232
|
-
isDeleted: false
|
|
5202
|
+
}, [formState.lastPropertyChanged, formState.inputValues]);
|
|
5203
|
+
useEffect10(() => {
|
|
5204
|
+
fetchData();
|
|
5205
|
+
}, [formState.inputValues, formState.lastPropertyChanged]);
|
|
5206
|
+
function replacePlaceholders(template, context, params) {
|
|
5207
|
+
console.log("from replace:");
|
|
5208
|
+
console.log(params);
|
|
5209
|
+
console.log(template);
|
|
5210
|
+
return template.replace(
|
|
5211
|
+
/\{(context|params)\.([\w]+)\}/g,
|
|
5212
|
+
(_, type, key) => {
|
|
5213
|
+
if (type === "context" && context && key in context && context[key]) {
|
|
5214
|
+
return String(context[key]);
|
|
5215
|
+
}
|
|
5216
|
+
if (type === "params" && params && key in params && params[key]) {
|
|
5217
|
+
return String(params[key]);
|
|
5218
|
+
}
|
|
5219
|
+
return "";
|
|
5233
5220
|
}
|
|
5234
|
-
]);
|
|
5235
|
-
};
|
|
5236
|
-
const deleteAction = (actionIndex) => {
|
|
5237
|
-
setActions(
|
|
5238
|
-
actions.map(
|
|
5239
|
-
(action, i) => i === actionIndex ? { ...action, isDeleted: true } : action
|
|
5240
|
-
)
|
|
5241
5221
|
);
|
|
5222
|
+
}
|
|
5223
|
+
const handleChildSectionChangeCallback = useCallback5(
|
|
5224
|
+
(params) => {
|
|
5225
|
+
dispatch({
|
|
5226
|
+
type: params.actionType,
|
|
5227
|
+
name: params.name,
|
|
5228
|
+
value: params.value,
|
|
5229
|
+
// @ts-ignore
|
|
5230
|
+
childName: params.sectionName,
|
|
5231
|
+
rowIndex: params.rowIndex
|
|
5232
|
+
});
|
|
5233
|
+
},
|
|
5234
|
+
[dispatch]
|
|
5235
|
+
);
|
|
5236
|
+
const onValidate = async () => {
|
|
5237
|
+
if (formRef.current && !formRef.current.checkValidity()) {
|
|
5238
|
+
formRef.current.classList.add("validated");
|
|
5239
|
+
return false;
|
|
5240
|
+
} else {
|
|
5241
|
+
return true;
|
|
5242
|
+
}
|
|
5242
5243
|
};
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
)
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
};
|
|
5262
|
-
return colors[type] || "bg-gray-100 text-gray-800";
|
|
5263
|
-
};
|
|
5264
|
-
const renderSidebarContent = () => {
|
|
5265
|
-
if (!selectedItem) {
|
|
5266
|
-
return /* @__PURE__ */ jsxs37("div", { className: "p-6 text-center", children: [
|
|
5267
|
-
/* @__PURE__ */ jsx65(
|
|
5268
|
-
"svg",
|
|
5269
|
-
{
|
|
5270
|
-
className: "mx-auto h-12 w-12 text-gray-400 mb-4",
|
|
5271
|
-
fill: "none",
|
|
5272
|
-
stroke: "currentColor",
|
|
5273
|
-
viewBox: "0 0 24 24",
|
|
5274
|
-
children: /* @__PURE__ */ jsx65(
|
|
5275
|
-
"path",
|
|
5276
|
-
{
|
|
5277
|
-
strokeLinecap: "round",
|
|
5278
|
-
strokeLinejoin: "round",
|
|
5279
|
-
strokeWidth: 2,
|
|
5280
|
-
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
5281
|
-
}
|
|
5282
|
-
)
|
|
5244
|
+
function normalizeChildSections(values, isEdit, sections) {
|
|
5245
|
+
if (!sections) return values;
|
|
5246
|
+
const cloned = structuredClone(values);
|
|
5247
|
+
sections.forEach((section) => {
|
|
5248
|
+
section.childSections?.forEach((child) => {
|
|
5249
|
+
const childName = child.name;
|
|
5250
|
+
const relation = child.relationshipType;
|
|
5251
|
+
const childValue = cloned[childName];
|
|
5252
|
+
if (!childValue) return;
|
|
5253
|
+
if (relation === "one-to-many" && Array.isArray(childValue)) {
|
|
5254
|
+
cloned[childName] = childValue.filter((row) => {
|
|
5255
|
+
if (isEdit) return true;
|
|
5256
|
+
return !row.isDeleted;
|
|
5257
|
+
});
|
|
5258
|
+
}
|
|
5259
|
+
if (relation === "one-to-one" && typeof childValue === "object") {
|
|
5260
|
+
if (!isEdit && childValue.isDeleted) {
|
|
5261
|
+
delete cloned[childName];
|
|
5283
5262
|
}
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
if (
|
|
5291
|
-
const
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
})
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5263
|
+
}
|
|
5264
|
+
});
|
|
5265
|
+
});
|
|
5266
|
+
return cloned;
|
|
5267
|
+
}
|
|
5268
|
+
const onClick = useCallback5(async () => {
|
|
5269
|
+
if (props.onClick) {
|
|
5270
|
+
const isEdit = props.dataItem && Object.keys(props.dataItem).length > 0;
|
|
5271
|
+
const normalizedValues = normalizeChildSections(
|
|
5272
|
+
formState.inputValues,
|
|
5273
|
+
!!isEdit,
|
|
5274
|
+
props.sections
|
|
5275
|
+
);
|
|
5276
|
+
return await props.onClick({
|
|
5277
|
+
...formState,
|
|
5278
|
+
inputValues: normalizedValues
|
|
5279
|
+
});
|
|
5280
|
+
} else {
|
|
5281
|
+
return { isSuccessful: true };
|
|
5282
|
+
}
|
|
5283
|
+
}, [formState, props]);
|
|
5284
|
+
const handleAdditionalOnClick = useCallback5(async () => {
|
|
5285
|
+
if (props.additionalActions?.onClick) {
|
|
5286
|
+
return await props.additionalActions.onClick(formState);
|
|
5287
|
+
} else {
|
|
5288
|
+
return { isSuccessful: true, message: "Action completed successfully" };
|
|
5289
|
+
}
|
|
5290
|
+
}, [formState, props]);
|
|
5291
|
+
const onDelete = useCallback5(async () => {
|
|
5292
|
+
if (props.onDelete) {
|
|
5293
|
+
return await props.onDelete(formState);
|
|
5294
|
+
} else {
|
|
5295
|
+
return { isSuccessful: true };
|
|
5296
|
+
}
|
|
5297
|
+
}, [formState, props]);
|
|
5298
|
+
useEffect10(() => {
|
|
5299
|
+
if (props.dataItem) {
|
|
5300
|
+
dispatch({
|
|
5301
|
+
type: FORM_INITIAL_UPDATE,
|
|
5302
|
+
values: props.dataItem,
|
|
5303
|
+
name: "all"
|
|
5304
|
+
});
|
|
5305
|
+
}
|
|
5306
|
+
}, [props.dataItem]);
|
|
5307
|
+
function getNestedProperty2(obj, path) {
|
|
5308
|
+
if (path.includes(".")) {
|
|
5309
|
+
return path.split(".").reduce((prev, curr) => prev ? prev[curr] : null, obj);
|
|
5310
|
+
} else {
|
|
5311
|
+
return obj[path];
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
function evalutateCondition(context, expression) {
|
|
5315
|
+
if (expression === null || expression === void 0) {
|
|
5316
|
+
return true;
|
|
5317
|
+
}
|
|
5318
|
+
try {
|
|
5319
|
+
const evaluator = new Function("context", `return ${expression};`);
|
|
5320
|
+
return evaluator(context);
|
|
5321
|
+
} catch (error) {
|
|
5322
|
+
console.error("Error evaluating expression:", error);
|
|
5323
|
+
return false;
|
|
5324
|
+
}
|
|
5325
|
+
}
|
|
5326
|
+
return /* @__PURE__ */ jsx66(React48.Fragment, { children: /* @__PURE__ */ jsxs38("div", { className: "flex-grow flex flex-col", children: [
|
|
5327
|
+
props.title && /* @__PURE__ */ jsx66("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__ */ jsxs38(
|
|
5328
|
+
"div",
|
|
5329
|
+
{
|
|
5330
|
+
className: "inline-flex items-center gap-2 cursor-pointer",
|
|
5331
|
+
onClick: () => window.history.back(),
|
|
5332
|
+
children: [
|
|
5333
|
+
/* @__PURE__ */ jsx66(Icon_default, { name: "chevronLeft", className: "w-4 h-4 text-primary-800" }),
|
|
5334
|
+
/* @__PURE__ */ jsx66("h2", { className: "text-lg font-semibold text-primary-800", children: props.title })
|
|
5335
|
+
]
|
|
5336
|
+
}
|
|
5337
|
+
) }),
|
|
5338
|
+
/* @__PURE__ */ jsx66(
|
|
5339
|
+
"form",
|
|
5340
|
+
{
|
|
5341
|
+
className: "group space-y-6 pb-6 overflow-y-auto",
|
|
5342
|
+
noValidate: true,
|
|
5343
|
+
ref: formRef,
|
|
5344
|
+
onKeyDown: (e) => {
|
|
5345
|
+
if (e.key === "Enter") {
|
|
5346
|
+
const activeElement = document.activeElement;
|
|
5347
|
+
console.log(activeElement);
|
|
5348
|
+
if (activeElement.tagName === "INPUT") {
|
|
5349
|
+
e.preventDefault();
|
|
5360
5350
|
}
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
!isFirstSection && section.isChildSection && (parentSectionOptions.length > 0 ? /* @__PURE__ */ jsx65(
|
|
5364
|
-
InputControl_default,
|
|
5365
|
-
{
|
|
5366
|
-
name: "parentSectionName",
|
|
5367
|
-
controlType: InputControlType_default.select,
|
|
5368
|
-
value: section.parentSectionName ?? "",
|
|
5369
|
-
dataset: parentSectionOptions,
|
|
5370
|
-
dataKeyFieldName: "value",
|
|
5371
|
-
dataTextFieldName: "label",
|
|
5372
|
-
callback: ({ value }) => {
|
|
5373
|
-
const parentSectionName = String(value ?? "").trim();
|
|
5374
|
-
updateSectionField(
|
|
5375
|
-
sectionIndex,
|
|
5376
|
-
"parentSectionName",
|
|
5377
|
-
parentSectionName || null
|
|
5378
|
-
);
|
|
5379
|
-
},
|
|
5380
|
-
attributes: {
|
|
5381
|
-
label: "Parent Section Name"
|
|
5382
|
-
}
|
|
5351
|
+
if (activeElement.tagName === "BUTTON" && activeElement.dataset.role === "add") {
|
|
5352
|
+
return;
|
|
5383
5353
|
}
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
] });
|
|
5387
|
-
}
|
|
5388
|
-
if (type === "row") {
|
|
5389
|
-
const row = sections[sectionIndex]?.rows?.[rowIndex];
|
|
5390
|
-
if (!row) return null;
|
|
5391
|
-
return /* @__PURE__ */ jsxs37("div", { className: "p-6 space-y-4", children: [
|
|
5392
|
-
/* @__PURE__ */ jsx65("h3", { className: "text-lg font-medium text-gray-900 border-b pb-2", children: "Edit Row" }),
|
|
5393
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-4", children: /* @__PURE__ */ jsx65(
|
|
5394
|
-
InputControl_default,
|
|
5395
|
-
{
|
|
5396
|
-
controlType: InputControlType_default.checkboxInput,
|
|
5397
|
-
name: "row.grow",
|
|
5398
|
-
value: row.grow || false,
|
|
5399
|
-
callback: ({ value }) => {
|
|
5400
|
-
updateRowGrow(sectionIndex, rowIndex, Boolean(value ?? ""));
|
|
5401
|
-
},
|
|
5402
|
-
attributes: {
|
|
5403
|
-
label: "Grow Row"
|
|
5354
|
+
if (activeElement.tagName === "BUTTON" && activeElement.dataset.role === "delete") {
|
|
5355
|
+
e.preventDefault();
|
|
5404
5356
|
}
|
|
5405
5357
|
}
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
{
|
|
5418
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5419
|
-
name: "name",
|
|
5420
|
-
value: element.name,
|
|
5421
|
-
callback: ({ value }) => {
|
|
5422
|
-
updateElementField(
|
|
5423
|
-
sectionIndex,
|
|
5424
|
-
rowIndex,
|
|
5425
|
-
elementIndex,
|
|
5426
|
-
"name",
|
|
5427
|
-
String(value ?? "")
|
|
5428
|
-
);
|
|
5429
|
-
},
|
|
5430
|
-
attributes: {
|
|
5431
|
-
label: "Name",
|
|
5432
|
-
placeholder: "Enter element name"
|
|
5433
|
-
}
|
|
5434
|
-
}
|
|
5435
|
-
),
|
|
5436
|
-
/* @__PURE__ */ jsx65(
|
|
5437
|
-
InputControl_default,
|
|
5438
|
-
{
|
|
5439
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5440
|
-
name: "label",
|
|
5441
|
-
value: element.label,
|
|
5442
|
-
callback: ({ value }) => {
|
|
5443
|
-
updateElementField(
|
|
5444
|
-
sectionIndex,
|
|
5445
|
-
rowIndex,
|
|
5446
|
-
elementIndex,
|
|
5447
|
-
"label",
|
|
5448
|
-
String(value ?? "")
|
|
5449
|
-
);
|
|
5450
|
-
},
|
|
5451
|
-
attributes: {
|
|
5452
|
-
label: "Label",
|
|
5453
|
-
placeholder: "Enter label"
|
|
5454
|
-
}
|
|
5455
|
-
}
|
|
5456
|
-
),
|
|
5457
|
-
/* @__PURE__ */ jsxs37("div", { className: "space-y-1", children: [
|
|
5458
|
-
/* @__PURE__ */ jsx65("label", { className: "block text-sm font-medium text-gray-700", children: "Control Type" }),
|
|
5459
|
-
/* @__PURE__ */ jsxs37(
|
|
5460
|
-
"select",
|
|
5461
|
-
{
|
|
5462
|
-
className: "w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",
|
|
5463
|
-
value: element.controlTypeCode,
|
|
5464
|
-
onChange: (e) => updateElementField(
|
|
5465
|
-
sectionIndex,
|
|
5466
|
-
rowIndex,
|
|
5467
|
-
elementIndex,
|
|
5468
|
-
"controlTypeCode",
|
|
5469
|
-
e.target.value
|
|
5470
|
-
),
|
|
5471
|
-
children: [
|
|
5472
|
-
/* @__PURE__ */ jsx65("option", { value: "", children: "Select Control" }),
|
|
5473
|
-
controlTypes.map((type2) => /* @__PURE__ */ jsx65("option", { value: type2, children: type2 }, type2))
|
|
5474
|
-
]
|
|
5475
|
-
}
|
|
5476
|
-
)
|
|
5477
|
-
] })
|
|
5478
|
-
] }),
|
|
5479
|
-
/* @__PURE__ */ jsxs37("div", { className: "space-y-2 pt-4 border-t", children: [
|
|
5480
|
-
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-gray-700", children: "Properties" }),
|
|
5481
|
-
/* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
5482
|
-
/* @__PURE__ */ jsx65(
|
|
5483
|
-
InputControl_default,
|
|
5484
|
-
{
|
|
5485
|
-
controlType: InputControlType_default.checkboxInput,
|
|
5486
|
-
name: "el.required",
|
|
5487
|
-
value: element.required || false,
|
|
5488
|
-
callback: ({ value }) => {
|
|
5489
|
-
updateElementField(
|
|
5490
|
-
sectionIndex,
|
|
5491
|
-
rowIndex,
|
|
5492
|
-
elementIndex,
|
|
5493
|
-
"required",
|
|
5494
|
-
Boolean(value ?? "")
|
|
5495
|
-
);
|
|
5496
|
-
},
|
|
5497
|
-
attributes: {
|
|
5498
|
-
label: "Required"
|
|
5499
|
-
}
|
|
5500
|
-
}
|
|
5501
|
-
),
|
|
5502
|
-
/* @__PURE__ */ jsx65(
|
|
5503
|
-
InputControl_default,
|
|
5504
|
-
{
|
|
5505
|
-
controlType: InputControlType_default.checkboxInput,
|
|
5506
|
-
name: "el.readonly",
|
|
5507
|
-
value: element.readOnly || false,
|
|
5508
|
-
callback: ({ value }) => {
|
|
5509
|
-
updateElementField(
|
|
5510
|
-
sectionIndex,
|
|
5511
|
-
rowIndex,
|
|
5512
|
-
elementIndex,
|
|
5513
|
-
"readOnly",
|
|
5514
|
-
Boolean(value ?? "")
|
|
5515
|
-
);
|
|
5516
|
-
},
|
|
5517
|
-
attributes: {
|
|
5518
|
-
label: "Read Only"
|
|
5519
|
-
}
|
|
5520
|
-
}
|
|
5521
|
-
),
|
|
5522
|
-
/* @__PURE__ */ jsx65(
|
|
5523
|
-
InputControl_default,
|
|
5524
|
-
{
|
|
5525
|
-
controlType: InputControlType_default.checkboxInput,
|
|
5526
|
-
name: "el.autoFocus",
|
|
5527
|
-
value: element.autoFocus || false,
|
|
5528
|
-
callback: ({ value }) => {
|
|
5529
|
-
updateElementField(
|
|
5530
|
-
sectionIndex,
|
|
5531
|
-
rowIndex,
|
|
5532
|
-
elementIndex,
|
|
5533
|
-
"autoFocus",
|
|
5534
|
-
Boolean(value ?? "")
|
|
5535
|
-
);
|
|
5536
|
-
},
|
|
5537
|
-
attributes: {
|
|
5538
|
-
label: "Auto Focus"
|
|
5539
|
-
}
|
|
5540
|
-
}
|
|
5541
|
-
)
|
|
5542
|
-
] })
|
|
5543
|
-
] }),
|
|
5544
|
-
/* @__PURE__ */ jsxs37("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
5545
|
-
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-gray-700", children: "Text Properties" }),
|
|
5546
|
-
/* @__PURE__ */ jsx65(
|
|
5547
|
-
InputControl_default,
|
|
5548
|
-
{
|
|
5549
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5550
|
-
name: "el.placeholder",
|
|
5551
|
-
value: element.placeholder,
|
|
5552
|
-
callback: ({ value }) => {
|
|
5553
|
-
updateElementField(
|
|
5554
|
-
sectionIndex,
|
|
5555
|
-
rowIndex,
|
|
5556
|
-
elementIndex,
|
|
5557
|
-
"placeholder",
|
|
5558
|
-
String(value ?? "")
|
|
5559
|
-
);
|
|
5560
|
-
},
|
|
5561
|
-
attributes: {
|
|
5562
|
-
label: "Placeholder",
|
|
5563
|
-
placeholder: "Enter placeholder"
|
|
5564
|
-
}
|
|
5565
|
-
}
|
|
5566
|
-
),
|
|
5567
|
-
/* @__PURE__ */ jsx65(
|
|
5568
|
-
InputControl_default,
|
|
5569
|
-
{
|
|
5570
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5571
|
-
name: "el.hintText",
|
|
5572
|
-
value: element.hintText || "",
|
|
5573
|
-
callback: ({ value }) => {
|
|
5574
|
-
updateElementField(
|
|
5575
|
-
sectionIndex,
|
|
5576
|
-
rowIndex,
|
|
5577
|
-
elementIndex,
|
|
5578
|
-
"hintText",
|
|
5579
|
-
String(value ?? "")
|
|
5580
|
-
);
|
|
5581
|
-
},
|
|
5582
|
-
attributes: {
|
|
5583
|
-
label: "Hint Text",
|
|
5584
|
-
placeholder: "Enter hint text"
|
|
5585
|
-
}
|
|
5586
|
-
}
|
|
5587
|
-
),
|
|
5588
|
-
/* @__PURE__ */ jsx65(
|
|
5589
|
-
InputControl_default,
|
|
5590
|
-
{
|
|
5591
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5592
|
-
name: "el.helpText",
|
|
5593
|
-
value: element.helpText || "",
|
|
5594
|
-
callback: ({ value }) => {
|
|
5595
|
-
updateElementField(
|
|
5596
|
-
sectionIndex,
|
|
5597
|
-
rowIndex,
|
|
5598
|
-
elementIndex,
|
|
5599
|
-
"helpText",
|
|
5600
|
-
String(value ?? "")
|
|
5601
|
-
);
|
|
5602
|
-
},
|
|
5603
|
-
attributes: {
|
|
5604
|
-
label: "Help Text",
|
|
5605
|
-
placeholder: "Enter help text"
|
|
5606
|
-
}
|
|
5607
|
-
}
|
|
5608
|
-
),
|
|
5609
|
-
/* @__PURE__ */ jsx65(
|
|
5610
|
-
InputControl_default,
|
|
5611
|
-
{
|
|
5612
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5613
|
-
name: "el.errorMessage",
|
|
5614
|
-
value: element.errorMessage || "",
|
|
5615
|
-
callback: ({ value }) => {
|
|
5616
|
-
updateElementField(
|
|
5617
|
-
sectionIndex,
|
|
5618
|
-
rowIndex,
|
|
5619
|
-
elementIndex,
|
|
5620
|
-
"errorMessage",
|
|
5621
|
-
String(value ?? "")
|
|
5622
|
-
);
|
|
5623
|
-
},
|
|
5624
|
-
attributes: {
|
|
5625
|
-
label: "Error Message",
|
|
5626
|
-
placeholder: "Enter error message"
|
|
5627
|
-
}
|
|
5628
|
-
}
|
|
5629
|
-
)
|
|
5630
|
-
] }),
|
|
5631
|
-
/* @__PURE__ */ jsxs37("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
5632
|
-
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-gray-700", children: "Validation" }),
|
|
5633
|
-
/* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
5634
|
-
/* @__PURE__ */ jsx65(
|
|
5635
|
-
InputControl_default,
|
|
5636
|
-
{
|
|
5637
|
-
controlType: InputControlType_default.numberInput,
|
|
5638
|
-
name: "el.minLength",
|
|
5639
|
-
value: element.minLength || "",
|
|
5640
|
-
callback: ({ value }) => {
|
|
5641
|
-
handleNumberChange(
|
|
5642
|
-
sectionIndex,
|
|
5643
|
-
rowIndex,
|
|
5644
|
-
elementIndex,
|
|
5645
|
-
"minLength",
|
|
5646
|
-
value
|
|
5647
|
-
);
|
|
5648
|
-
},
|
|
5649
|
-
attributes: {
|
|
5650
|
-
label: "Min Length",
|
|
5651
|
-
placeholder: "Min"
|
|
5652
|
-
}
|
|
5653
|
-
}
|
|
5654
|
-
),
|
|
5655
|
-
/* @__PURE__ */ jsx65(
|
|
5656
|
-
InputControl_default,
|
|
5657
|
-
{
|
|
5658
|
-
controlType: InputControlType_default.numberInput,
|
|
5659
|
-
name: "el.maxLength",
|
|
5660
|
-
value: element.maxLength || "",
|
|
5661
|
-
callback: ({ value }) => {
|
|
5662
|
-
handleNumberChange(
|
|
5663
|
-
sectionIndex,
|
|
5664
|
-
rowIndex,
|
|
5665
|
-
elementIndex,
|
|
5666
|
-
"maxLength",
|
|
5667
|
-
value
|
|
5358
|
+
},
|
|
5359
|
+
children: /* @__PURE__ */ jsx66("div", { className: "flex flex-col gap-6", children: props.sections?.map((section, sectionIndex) => {
|
|
5360
|
+
return /* @__PURE__ */ jsx66(React48.Fragment, { children: !section.isChildSection && /* @__PURE__ */ jsxs38("div", { className: " rounded-b-lg bg-white shadow border-neutral-200 border px-8 py-6 ", children: [
|
|
5361
|
+
section.sectionRows?.map(
|
|
5362
|
+
(sectionRow, sectionRowIndex) => {
|
|
5363
|
+
const elementsCount = sectionRow.elements.length;
|
|
5364
|
+
let isVisible = true;
|
|
5365
|
+
if (sectionRow.visible) {
|
|
5366
|
+
isVisible = evalutateCondition(
|
|
5367
|
+
formState.inputValues,
|
|
5368
|
+
sectionRow.visible
|
|
5668
5369
|
);
|
|
5669
|
-
},
|
|
5670
|
-
attributes: {
|
|
5671
|
-
label: "Max Length",
|
|
5672
|
-
placeholder: "Max"
|
|
5673
5370
|
}
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5371
|
+
return /* @__PURE__ */ jsx66(React48.Fragment, { children: isVisible && /* @__PURE__ */ jsx66("div", { className: "lg:flex gap-14 flex-1 mb-4 ", children: sectionRow.elements.map((field, index) => {
|
|
5372
|
+
return /* @__PURE__ */ jsx66(
|
|
5373
|
+
"div",
|
|
5374
|
+
{
|
|
5375
|
+
className: sectionRow.grow ? "grow" : "",
|
|
5376
|
+
children: /* @__PURE__ */ jsx66(
|
|
5377
|
+
InputControl_default,
|
|
5378
|
+
{
|
|
5379
|
+
name: field.name,
|
|
5380
|
+
controlType: field.controlType,
|
|
5381
|
+
value: getNestedProperty2(
|
|
5382
|
+
formState.inputValues,
|
|
5383
|
+
field.name
|
|
5384
|
+
),
|
|
5385
|
+
callback: handleInputChange,
|
|
5386
|
+
dataSourceDependsOn: field.dataSourceDependsOn,
|
|
5387
|
+
dependentValue: field.dataSourceDependsOn ? formState.inputValues[field.dataSourceDependsOn] : "",
|
|
5388
|
+
dataSource: field.dataSource,
|
|
5389
|
+
dataset: field.dataset,
|
|
5390
|
+
dataKeyFieldName: field.dataKeyFieldName,
|
|
5391
|
+
dataTextFieldName: field.dataTextFieldName,
|
|
5392
|
+
attributes: field.attributes,
|
|
5393
|
+
serviceClient: props.serviceClient,
|
|
5394
|
+
assetsUploadPath: props.dataItem ? props.dataItem["assetsUploadPath"] : null,
|
|
5395
|
+
entityType: field.entityType,
|
|
5396
|
+
uploadInSharedLocation: field.uploadInSharedLocation
|
|
5397
|
+
}
|
|
5398
|
+
)
|
|
5399
|
+
},
|
|
5400
|
+
field.name
|
|
5689
5401
|
);
|
|
5690
|
-
},
|
|
5691
|
-
attributes: {
|
|
5692
|
-
label: "Min Value",
|
|
5693
|
-
placeholder: "Min"
|
|
5694
|
-
}
|
|
5402
|
+
}) }) }, sectionRowIndex);
|
|
5695
5403
|
}
|
|
5696
5404
|
),
|
|
5697
|
-
/* @__PURE__ */
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
handleNumberChange(
|
|
5705
|
-
sectionIndex,
|
|
5706
|
-
rowIndex,
|
|
5707
|
-
elementIndex,
|
|
5708
|
-
"maxValue",
|
|
5709
|
-
value
|
|
5710
|
-
);
|
|
5711
|
-
},
|
|
5712
|
-
attributes: {
|
|
5713
|
-
label: "Max Value",
|
|
5714
|
-
placeholder: "Max"
|
|
5715
|
-
}
|
|
5716
|
-
}
|
|
5717
|
-
)
|
|
5718
|
-
] })
|
|
5719
|
-
] }),
|
|
5720
|
-
element.controlTypeCode === "select" && /* @__PURE__ */ jsxs37("div", { className: "space-y-4 pt-4 border-t", children: [
|
|
5721
|
-
/* @__PURE__ */ jsx65("h4", { className: "text-sm font-medium text-gray-700", children: "Select Options" }),
|
|
5722
|
-
/* @__PURE__ */ jsx65(
|
|
5723
|
-
InputControl_default,
|
|
5724
|
-
{
|
|
5725
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5726
|
-
name: "el.dataSource",
|
|
5727
|
-
value: element.dataSource || "",
|
|
5728
|
-
callback: ({ value }) => {
|
|
5729
|
-
updateElementField(
|
|
5730
|
-
sectionIndex,
|
|
5731
|
-
rowIndex,
|
|
5732
|
-
elementIndex,
|
|
5733
|
-
"dataSource",
|
|
5734
|
-
value
|
|
5735
|
-
);
|
|
5736
|
-
},
|
|
5737
|
-
attributes: {
|
|
5738
|
-
label: "Data Source",
|
|
5739
|
-
placeholder: "/api/endpoint"
|
|
5740
|
-
}
|
|
5741
|
-
}
|
|
5742
|
-
),
|
|
5743
|
-
/* @__PURE__ */ jsx65(
|
|
5744
|
-
InputControl_default,
|
|
5745
|
-
{
|
|
5746
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5747
|
-
name: "el.dataKeyFieldName",
|
|
5748
|
-
value: element.dataKeyFieldName || "",
|
|
5749
|
-
callback: ({ value }) => {
|
|
5750
|
-
updateElementField(
|
|
5751
|
-
sectionIndex,
|
|
5752
|
-
rowIndex,
|
|
5753
|
-
elementIndex,
|
|
5754
|
-
"dataKeyFieldName",
|
|
5755
|
-
value
|
|
5756
|
-
);
|
|
5757
|
-
},
|
|
5758
|
-
attributes: {
|
|
5759
|
-
label: "Data Key Field",
|
|
5760
|
-
placeholder: "id"
|
|
5761
|
-
}
|
|
5762
|
-
}
|
|
5763
|
-
),
|
|
5764
|
-
/* @__PURE__ */ jsx65(
|
|
5765
|
-
InputControl_default,
|
|
5766
|
-
{
|
|
5767
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5768
|
-
name: "el.dataTextFieldName",
|
|
5769
|
-
value: element.dataTextFieldName || "",
|
|
5770
|
-
callback: ({ value }) => {
|
|
5771
|
-
updateElementField(
|
|
5772
|
-
sectionIndex,
|
|
5773
|
-
rowIndex,
|
|
5774
|
-
elementIndex,
|
|
5775
|
-
"dataTextFieldName",
|
|
5776
|
-
value
|
|
5777
|
-
);
|
|
5778
|
-
},
|
|
5779
|
-
attributes: {
|
|
5780
|
-
label: "Data Text Field",
|
|
5781
|
-
placeholder: "name"
|
|
5782
|
-
}
|
|
5783
|
-
}
|
|
5784
|
-
)
|
|
5785
|
-
] })
|
|
5786
|
-
] });
|
|
5787
|
-
}
|
|
5788
|
-
return null;
|
|
5789
|
-
};
|
|
5790
|
-
return /* @__PURE__ */ jsx65("div", { className: "min-h-screen", children: /* @__PURE__ */ jsxs37("div", { className: "flex h-[calc(100vh-73px)]", children: [
|
|
5791
|
-
/* @__PURE__ */ jsxs37("div", { className: "flex-1 overflow-y-auto pe-3", children: [
|
|
5792
|
-
/* @__PURE__ */ jsx65("div", { className: "flex items-center gap-2 px-6 py-3 border border-neutral-200 bg-white shadow-sm rounded-t-md", children: /* @__PURE__ */ jsxs37(
|
|
5793
|
-
"div",
|
|
5794
|
-
{
|
|
5795
|
-
className: "inline-flex items-center gap-2 cursor-pointer",
|
|
5796
|
-
onClick: () => window.history.back(),
|
|
5797
|
-
children: [
|
|
5798
|
-
/* @__PURE__ */ jsx65(
|
|
5799
|
-
"svg",
|
|
5800
|
-
{
|
|
5801
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5802
|
-
fill: "none",
|
|
5803
|
-
viewBox: "0 0 24 24",
|
|
5804
|
-
strokeWidth: "1.5",
|
|
5805
|
-
stroke: "currentColor",
|
|
5806
|
-
className: "w-4 h-4 text-primary-800",
|
|
5807
|
-
children: /* @__PURE__ */ jsx65(
|
|
5808
|
-
"path",
|
|
5405
|
+
/* @__PURE__ */ jsx66("div", { children: section.childSections?.map(
|
|
5406
|
+
(childSection, childSectionIndex) => {
|
|
5407
|
+
return /* @__PURE__ */ jsx66("div", { children: childSection.name && evalutateCondition(
|
|
5408
|
+
formState.inputValues,
|
|
5409
|
+
childSection.visible
|
|
5410
|
+
) && /* @__PURE__ */ jsx66(
|
|
5411
|
+
DataFormChildSection_default,
|
|
5809
5412
|
{
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5413
|
+
section: childSection,
|
|
5414
|
+
childItems: formState.inputValues[childSection.name],
|
|
5415
|
+
callback: handleChildSectionChangeCallback,
|
|
5416
|
+
serviceClient: props.serviceClient
|
|
5813
5417
|
}
|
|
5814
|
-
)
|
|
5418
|
+
) }, childSectionIndex);
|
|
5815
5419
|
}
|
|
5816
|
-
)
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5420
|
+
) })
|
|
5421
|
+
] }) }, sectionIndex);
|
|
5422
|
+
}) })
|
|
5423
|
+
}
|
|
5424
|
+
),
|
|
5425
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex px-6 py-3 mt-2 mb-2 justify-end items-center gap-5", children: [
|
|
5426
|
+
/* @__PURE__ */ jsx66("div", { children: props.additionalActions && /* @__PURE__ */ jsx66(
|
|
5427
|
+
Button_default,
|
|
5428
|
+
{
|
|
5429
|
+
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
5430
|
+
onClick: handleAdditionalOnClick,
|
|
5431
|
+
children: props.additionalActions.title
|
|
5822
5432
|
}
|
|
5823
5433
|
) }),
|
|
5824
|
-
/* @__PURE__ */
|
|
5825
|
-
|
|
5434
|
+
/* @__PURE__ */ jsx66("div", { children: props.onDelete && /* @__PURE__ */ jsx66(
|
|
5435
|
+
Button_default,
|
|
5826
5436
|
{
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
onClick: () => setActiveTab("config"),
|
|
5834
|
-
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"}`,
|
|
5835
|
-
children: "Form Configuration"
|
|
5836
|
-
}
|
|
5837
|
-
),
|
|
5838
|
-
/* @__PURE__ */ jsx65(
|
|
5839
|
-
"button",
|
|
5840
|
-
{
|
|
5841
|
-
onClick: () => setActiveTab("sections"),
|
|
5842
|
-
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"}`,
|
|
5843
|
-
children: "Form Sections & Actions"
|
|
5844
|
-
}
|
|
5845
|
-
)
|
|
5846
|
-
]
|
|
5437
|
+
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
5438
|
+
onClick: onDelete,
|
|
5439
|
+
showToast: true,
|
|
5440
|
+
confirm: true,
|
|
5441
|
+
confirmationMessage: "Are you sure you want to delete this record?",
|
|
5442
|
+
children: "Delete"
|
|
5847
5443
|
}
|
|
5848
5444
|
) }),
|
|
5849
|
-
/* @__PURE__ */
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
/* @__PURE__ */ jsx65(
|
|
5861
|
-
"path",
|
|
5862
|
-
{
|
|
5863
|
-
strokeLinecap: "round",
|
|
5864
|
-
strokeLinejoin: "round",
|
|
5865
|
-
strokeWidth: 2,
|
|
5866
|
-
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"
|
|
5867
|
-
}
|
|
5868
|
-
),
|
|
5869
|
-
/* @__PURE__ */ jsx65(
|
|
5870
|
-
"path",
|
|
5871
|
-
{
|
|
5872
|
-
strokeLinecap: "round",
|
|
5873
|
-
strokeLinejoin: "round",
|
|
5874
|
-
strokeWidth: 2,
|
|
5875
|
-
d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
|
5876
|
-
}
|
|
5877
|
-
)
|
|
5878
|
-
]
|
|
5879
|
-
}
|
|
5880
|
-
),
|
|
5881
|
-
"Form Configuration"
|
|
5882
|
-
] }) }),
|
|
5883
|
-
/* @__PURE__ */ jsx65("div", { className: "p-6", children: /* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: [
|
|
5884
|
-
/* @__PURE__ */ jsxs37("div", { className: "space-y-1", children: [
|
|
5885
|
-
/* @__PURE__ */ jsx65(
|
|
5886
|
-
InputControl_default,
|
|
5887
|
-
{
|
|
5888
|
-
name: "appId",
|
|
5889
|
-
controlType: InputControlType_default.select,
|
|
5890
|
-
value: selectedAppId,
|
|
5891
|
-
dataset: apps,
|
|
5892
|
-
dataKeyFieldName: "appId",
|
|
5893
|
-
dataTextFieldName: "title",
|
|
5894
|
-
callback: ({ value }) => {
|
|
5895
|
-
const parsedAppId = Number(value);
|
|
5896
|
-
if (!Number.isNaN(parsedAppId)) {
|
|
5897
|
-
setSelectedAppId(parsedAppId);
|
|
5898
|
-
}
|
|
5899
|
-
},
|
|
5900
|
-
attributes: {
|
|
5901
|
-
label: "AppId",
|
|
5902
|
-
readOnly: isEditMode
|
|
5903
|
-
}
|
|
5904
|
-
}
|
|
5905
|
-
),
|
|
5906
|
-
!loadingApps && apps.length === 0 && /* @__PURE__ */ jsx65("p", { className: "text-red-500 text-xs mt-1", children: "No applications found" })
|
|
5907
|
-
] }),
|
|
5908
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-1", children: /* @__PURE__ */ jsx65(
|
|
5909
|
-
InputControl_default,
|
|
5910
|
-
{
|
|
5911
|
-
controlType: InputControlType_default.numberInput,
|
|
5912
|
-
name: "siteFormTypeId",
|
|
5913
|
-
value: siteFormTypeId,
|
|
5914
|
-
attributes: {
|
|
5915
|
-
readOnly: true,
|
|
5916
|
-
label: "Form Type ID"
|
|
5917
|
-
}
|
|
5918
|
-
}
|
|
5919
|
-
) }),
|
|
5920
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-1 md:col-span-2", children: /* @__PURE__ */ jsx65(
|
|
5921
|
-
InputControl_default,
|
|
5922
|
-
{
|
|
5923
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5924
|
-
name: "formTitle",
|
|
5925
|
-
value: formTitle,
|
|
5926
|
-
callback: ({ value }) => {
|
|
5927
|
-
setFormTitle(String(value ?? ""));
|
|
5928
|
-
},
|
|
5929
|
-
attributes: {
|
|
5930
|
-
label: "Form Title",
|
|
5931
|
-
placeholder: "Enter Form Title"
|
|
5932
|
-
}
|
|
5933
|
-
}
|
|
5934
|
-
) }),
|
|
5935
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-1", children: /* @__PURE__ */ jsx65(
|
|
5936
|
-
InputControl_default,
|
|
5937
|
-
{
|
|
5938
|
-
controlType: InputControlType_default.lineTextInput,
|
|
5939
|
-
name: "entityIdParamName",
|
|
5940
|
-
value: entityIdParamName,
|
|
5941
|
-
callback: ({ value }) => {
|
|
5942
|
-
setEntityIdParamName(String(value ?? ""));
|
|
5943
|
-
},
|
|
5944
|
-
attributes: {
|
|
5945
|
-
label: "Entity ID Parameter Name",
|
|
5946
|
-
placeholder: "Enter Entity Parameter Name"
|
|
5947
|
-
}
|
|
5948
|
-
}
|
|
5949
|
-
) }),
|
|
5950
|
-
formId && /* @__PURE__ */ jsx65("div", { className: "space-y-1", children: /* @__PURE__ */ jsx65(
|
|
5951
|
-
InputControl_default,
|
|
5952
|
-
{
|
|
5953
|
-
controlType: InputControlType_default.numberInput,
|
|
5954
|
-
name: "formId",
|
|
5955
|
-
value: formId,
|
|
5956
|
-
attributes: {
|
|
5957
|
-
readOnly: true,
|
|
5958
|
-
label: "Form ID"
|
|
5959
|
-
}
|
|
5960
|
-
}
|
|
5961
|
-
) })
|
|
5962
|
-
] }) })
|
|
5963
|
-
] }),
|
|
5964
|
-
activeTab === "sections" && /* @__PURE__ */ jsxs37(Fragment11, { children: [
|
|
5965
|
-
/* @__PURE__ */ jsxs37("div", { className: "mt-0.3 bg-white shadow-sm border border-gray-200 overflow-hidden", children: [
|
|
5966
|
-
/* @__PURE__ */ jsxs37("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50 flex items-center justify-between", children: [
|
|
5967
|
-
/* @__PURE__ */ jsxs37("h2", { className: "text-lg font-semibold text-gray-800 flex items-center", children: [
|
|
5968
|
-
/* @__PURE__ */ jsx65(
|
|
5969
|
-
"svg",
|
|
5970
|
-
{
|
|
5971
|
-
className: "w-5 h-5 mr-2 text-gray-600",
|
|
5972
|
-
fill: "none",
|
|
5973
|
-
stroke: "currentColor",
|
|
5974
|
-
viewBox: "0 0 24 24",
|
|
5975
|
-
children: /* @__PURE__ */ jsx65(
|
|
5976
|
-
"path",
|
|
5977
|
-
{
|
|
5978
|
-
strokeLinecap: "round",
|
|
5979
|
-
strokeLinejoin: "round",
|
|
5980
|
-
strokeWidth: 2,
|
|
5981
|
-
d: "M4 6h16M4 10h16M4 14h16M4 18h16"
|
|
5982
|
-
}
|
|
5983
|
-
)
|
|
5984
|
-
}
|
|
5985
|
-
),
|
|
5986
|
-
"Form Sections"
|
|
5987
|
-
] }),
|
|
5988
|
-
/* @__PURE__ */ jsxs37(
|
|
5989
|
-
Button_default,
|
|
5990
|
-
{
|
|
5991
|
-
ButtonType: "Primary" /* Solid */,
|
|
5992
|
-
showToast: true,
|
|
5993
|
-
onClick: async () => {
|
|
5994
|
-
addSection();
|
|
5995
|
-
return {
|
|
5996
|
-
isSuccessful: true,
|
|
5997
|
-
message: "Section added successfully"
|
|
5998
|
-
};
|
|
5999
|
-
},
|
|
6000
|
-
children: [
|
|
6001
|
-
/* @__PURE__ */ jsx65(
|
|
6002
|
-
"svg",
|
|
6003
|
-
{
|
|
6004
|
-
className: "w-4 h-4 mr-2",
|
|
6005
|
-
fill: "none",
|
|
6006
|
-
stroke: "currentColor",
|
|
6007
|
-
viewBox: "0 0 24 24",
|
|
6008
|
-
children: /* @__PURE__ */ jsx65(
|
|
6009
|
-
"path",
|
|
6010
|
-
{
|
|
6011
|
-
strokeLinecap: "round",
|
|
6012
|
-
strokeLinejoin: "round",
|
|
6013
|
-
strokeWidth: 2,
|
|
6014
|
-
d: "M12 4v16m8-8H4"
|
|
6015
|
-
}
|
|
6016
|
-
)
|
|
6017
|
-
}
|
|
6018
|
-
),
|
|
6019
|
-
/* @__PURE__ */ jsx65("span", { children: "Add Section" })
|
|
6020
|
-
]
|
|
6021
|
-
}
|
|
6022
|
-
)
|
|
6023
|
-
] }),
|
|
6024
|
-
/* @__PURE__ */ jsxs37("div", { className: "space-y-4", children: [
|
|
6025
|
-
/* @__PURE__ */ jsx65("div", { className: sections.length === 0 ? "block" : "hidden", children: /* @__PURE__ */ jsxs37("div", { className: "bg-white p-12 text-center", children: [
|
|
6026
|
-
/* @__PURE__ */ jsx65(
|
|
6027
|
-
"svg",
|
|
6028
|
-
{
|
|
6029
|
-
className: "mx-auto h-12 w-12 text-gray-400",
|
|
6030
|
-
fill: "none",
|
|
6031
|
-
stroke: "currentColor",
|
|
6032
|
-
viewBox: "0 0 24 24",
|
|
6033
|
-
children: /* @__PURE__ */ jsx65(
|
|
6034
|
-
"path",
|
|
6035
|
-
{
|
|
6036
|
-
strokeLinecap: "round",
|
|
6037
|
-
strokeLinejoin: "round",
|
|
6038
|
-
strokeWidth: 2,
|
|
6039
|
-
d: "M4 6h16M4 10h16M4 14h16M4 18h16"
|
|
6040
|
-
}
|
|
6041
|
-
)
|
|
6042
|
-
}
|
|
6043
|
-
),
|
|
6044
|
-
/* @__PURE__ */ jsx65("h3", { className: "mt-2 text-sm font-medium text-gray-900", children: "No sections" }),
|
|
6045
|
-
/* @__PURE__ */ jsx65("p", { className: "mt-1 text-sm text-gray-500", children: "Get started by adding a new section." }),
|
|
6046
|
-
/* @__PURE__ */ jsx65("div", { className: "mt-6", children: /* @__PURE__ */ jsxs37(
|
|
6047
|
-
Button_default,
|
|
6048
|
-
{
|
|
6049
|
-
ButtonType: "Primary" /* Solid */,
|
|
6050
|
-
showToast: true,
|
|
6051
|
-
onClick: async () => {
|
|
6052
|
-
addSection();
|
|
6053
|
-
return {
|
|
6054
|
-
isSuccessful: true,
|
|
6055
|
-
message: "Section added successfully"
|
|
6056
|
-
};
|
|
6057
|
-
},
|
|
6058
|
-
children: [
|
|
6059
|
-
/* @__PURE__ */ jsx65(
|
|
6060
|
-
"svg",
|
|
6061
|
-
{
|
|
6062
|
-
className: "w-4 h-4 mr-2",
|
|
6063
|
-
fill: "none",
|
|
6064
|
-
stroke: "currentColor",
|
|
6065
|
-
viewBox: "0 0 24 24",
|
|
6066
|
-
children: /* @__PURE__ */ jsx65(
|
|
6067
|
-
"path",
|
|
6068
|
-
{
|
|
6069
|
-
strokeLinecap: "round",
|
|
6070
|
-
strokeLinejoin: "round",
|
|
6071
|
-
strokeWidth: 2,
|
|
6072
|
-
d: "M12 4v16m8-8H4"
|
|
6073
|
-
}
|
|
6074
|
-
)
|
|
6075
|
-
}
|
|
6076
|
-
),
|
|
6077
|
-
"Add Section"
|
|
6078
|
-
]
|
|
6079
|
-
}
|
|
6080
|
-
) })
|
|
6081
|
-
] }) }),
|
|
6082
|
-
/* @__PURE__ */ jsx65(
|
|
6083
|
-
"div",
|
|
6084
|
-
{
|
|
6085
|
-
className: sections.length > 0 ? "block px-4" : "hidden",
|
|
6086
|
-
children: sections.map(
|
|
6087
|
-
(section, sectionIndex) => !section.isDeleted && /* @__PURE__ */ jsxs37(
|
|
6088
|
-
"div",
|
|
6089
|
-
{
|
|
6090
|
-
className: `bg-white rounded-xl shadow-sm border overflow-hidden mb-4 cursor-pointer transition-all hover:shadow-md ${selectedItem?.type === "section" && selectedItem.sectionIndex === sectionIndex ? "border-blue-500 ring-2 ring-blue-200" : "border-gray-200"}`,
|
|
6091
|
-
onClick: () => setSelectedItem({
|
|
6092
|
-
type: "section",
|
|
6093
|
-
sectionIndex
|
|
6094
|
-
}),
|
|
6095
|
-
children: [
|
|
6096
|
-
/* @__PURE__ */ jsxs37("div", { className: "px-6 py-4 bg-gray-50 border-b border-gray-200 flex items-center justify-between", children: [
|
|
6097
|
-
/* @__PURE__ */ jsx65("div", { className: "flex items-center space-x-4 flex-1", children: /* @__PURE__ */ jsx65("span", { className: "font-medium text-gray-700", children: section.sectionTitle || "Untitled Section" }) }),
|
|
6098
|
-
/* @__PURE__ */ jsxs37(
|
|
6099
|
-
"div",
|
|
6100
|
-
{
|
|
6101
|
-
className: "flex items-center space-x-2",
|
|
6102
|
-
onClick: (e) => e.stopPropagation(),
|
|
6103
|
-
children: [
|
|
6104
|
-
/* @__PURE__ */ jsxs37(
|
|
6105
|
-
Button_default,
|
|
6106
|
-
{
|
|
6107
|
-
ButtonType: "Primary" /* Solid */,
|
|
6108
|
-
showToast: true,
|
|
6109
|
-
onClick: async () => {
|
|
6110
|
-
addRow(sectionIndex);
|
|
6111
|
-
return {
|
|
6112
|
-
isSuccessful: true,
|
|
6113
|
-
message: "Row added successfully"
|
|
6114
|
-
};
|
|
6115
|
-
},
|
|
6116
|
-
children: [
|
|
6117
|
-
/* @__PURE__ */ jsx65(
|
|
6118
|
-
"svg",
|
|
6119
|
-
{
|
|
6120
|
-
className: "w-4 h-4 mr-1",
|
|
6121
|
-
fill: "none",
|
|
6122
|
-
stroke: "currentColor",
|
|
6123
|
-
viewBox: "0 0 24 24",
|
|
6124
|
-
children: /* @__PURE__ */ jsx65(
|
|
6125
|
-
"path",
|
|
6126
|
-
{
|
|
6127
|
-
strokeLinecap: "round",
|
|
6128
|
-
strokeLinejoin: "round",
|
|
6129
|
-
strokeWidth: 2,
|
|
6130
|
-
d: "M12 4v16m8-8H4"
|
|
6131
|
-
}
|
|
6132
|
-
)
|
|
6133
|
-
}
|
|
6134
|
-
),
|
|
6135
|
-
/* @__PURE__ */ jsx65("span", { children: "Add Row" })
|
|
6136
|
-
]
|
|
6137
|
-
}
|
|
6138
|
-
),
|
|
6139
|
-
/* @__PURE__ */ jsx65(
|
|
6140
|
-
Button_default,
|
|
6141
|
-
{
|
|
6142
|
-
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
6143
|
-
onClick: async () => {
|
|
6144
|
-
deleteSection(sectionIndex);
|
|
6145
|
-
return {
|
|
6146
|
-
isSuccessful: true,
|
|
6147
|
-
message: "Section deleted successfully"
|
|
6148
|
-
};
|
|
6149
|
-
},
|
|
6150
|
-
children: /* @__PURE__ */ jsx65(
|
|
6151
|
-
"svg",
|
|
6152
|
-
{
|
|
6153
|
-
className: "w-5 h-5",
|
|
6154
|
-
fill: "none",
|
|
6155
|
-
stroke: "currentColor",
|
|
6156
|
-
viewBox: "0 0 24 24",
|
|
6157
|
-
children: /* @__PURE__ */ jsx65(
|
|
6158
|
-
"path",
|
|
6159
|
-
{
|
|
6160
|
-
strokeLinecap: "round",
|
|
6161
|
-
strokeLinejoin: "round",
|
|
6162
|
-
strokeWidth: 2,
|
|
6163
|
-
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"
|
|
6164
|
-
}
|
|
6165
|
-
)
|
|
6166
|
-
}
|
|
6167
|
-
)
|
|
6168
|
-
}
|
|
6169
|
-
)
|
|
6170
|
-
]
|
|
6171
|
-
}
|
|
6172
|
-
)
|
|
6173
|
-
] }),
|
|
6174
|
-
/* @__PURE__ */ jsx65("div", { className: "p-6", children: section.rows?.length === 0 ? /* @__PURE__ */ jsx65("div", { className: "text-center py-8", children: /* @__PURE__ */ jsx65("p", { className: "text-sm text-gray-500", children: "No rows in this section" }) }) : /* @__PURE__ */ jsx65("div", { className: "space-y-4", children: section.rows?.map(
|
|
6175
|
-
(row, rowIndex) => !row.isDeleted && /* @__PURE__ */ jsxs37(
|
|
6176
|
-
"div",
|
|
6177
|
-
{
|
|
6178
|
-
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"}`,
|
|
6179
|
-
onClick: (e) => {
|
|
6180
|
-
e.stopPropagation();
|
|
6181
|
-
setSelectedItem({
|
|
6182
|
-
type: "row",
|
|
6183
|
-
sectionIndex,
|
|
6184
|
-
rowIndex
|
|
6185
|
-
});
|
|
6186
|
-
},
|
|
6187
|
-
children: [
|
|
6188
|
-
/* @__PURE__ */ jsxs37("div", { className: "px-4 py-2 bg-gray-50 border-b border-gray-200 flex items-center justify-between", children: [
|
|
6189
|
-
/* @__PURE__ */ jsxs37("div", { className: "flex items-center space-x-4", children: [
|
|
6190
|
-
/* @__PURE__ */ jsxs37("span", { className: "text-sm font-medium text-gray-700", children: [
|
|
6191
|
-
"Row ",
|
|
6192
|
-
rowIndex + 1
|
|
6193
|
-
] }),
|
|
6194
|
-
row.grow && /* @__PURE__ */ jsx65("span", { className: "px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs", children: "Grow" })
|
|
6195
|
-
] }),
|
|
6196
|
-
/* @__PURE__ */ jsxs37(
|
|
6197
|
-
"div",
|
|
6198
|
-
{
|
|
6199
|
-
className: "flex items-center space-x-2",
|
|
6200
|
-
onClick: (e) => e.stopPropagation(),
|
|
6201
|
-
children: [
|
|
6202
|
-
/* @__PURE__ */ jsxs37(
|
|
6203
|
-
Button_default,
|
|
6204
|
-
{
|
|
6205
|
-
ButtonType: "Primary" /* Solid */,
|
|
6206
|
-
onClick: async () => {
|
|
6207
|
-
addElement(
|
|
6208
|
-
sectionIndex,
|
|
6209
|
-
rowIndex
|
|
6210
|
-
);
|
|
6211
|
-
return {
|
|
6212
|
-
isSuccessful: true,
|
|
6213
|
-
message: "Element added successfully"
|
|
6214
|
-
};
|
|
6215
|
-
},
|
|
6216
|
-
children: [
|
|
6217
|
-
/* @__PURE__ */ jsx65(
|
|
6218
|
-
"svg",
|
|
6219
|
-
{
|
|
6220
|
-
className: "w-3 h-3 mr-1",
|
|
6221
|
-
fill: "none",
|
|
6222
|
-
stroke: "currentColor",
|
|
6223
|
-
viewBox: "0 0 24 24",
|
|
6224
|
-
children: /* @__PURE__ */ jsx65(
|
|
6225
|
-
"path",
|
|
6226
|
-
{
|
|
6227
|
-
strokeLinecap: "round",
|
|
6228
|
-
strokeLinejoin: "round",
|
|
6229
|
-
strokeWidth: 2,
|
|
6230
|
-
d: "M12 4v16m8-8H4"
|
|
6231
|
-
}
|
|
6232
|
-
)
|
|
6233
|
-
}
|
|
6234
|
-
),
|
|
6235
|
-
/* @__PURE__ */ jsx65("span", { children: "Add Element" })
|
|
6236
|
-
]
|
|
6237
|
-
}
|
|
6238
|
-
),
|
|
6239
|
-
/* @__PURE__ */ jsx65(
|
|
6240
|
-
Button_default,
|
|
6241
|
-
{
|
|
6242
|
-
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
6243
|
-
onClick: async () => {
|
|
6244
|
-
deleteRow(
|
|
6245
|
-
sectionIndex,
|
|
6246
|
-
rowIndex
|
|
6247
|
-
);
|
|
6248
|
-
return {
|
|
6249
|
-
isSuccessful: true,
|
|
6250
|
-
message: "Row deleted successfully"
|
|
6251
|
-
};
|
|
6252
|
-
},
|
|
6253
|
-
children: /* @__PURE__ */ jsx65(
|
|
6254
|
-
"svg",
|
|
6255
|
-
{
|
|
6256
|
-
className: "w-4 h-4",
|
|
6257
|
-
fill: "none",
|
|
6258
|
-
stroke: "currentColor",
|
|
6259
|
-
viewBox: "0 0 24 24",
|
|
6260
|
-
children: /* @__PURE__ */ jsx65(
|
|
6261
|
-
"path",
|
|
6262
|
-
{
|
|
6263
|
-
strokeLinecap: "round",
|
|
6264
|
-
strokeLinejoin: "round",
|
|
6265
|
-
strokeWidth: 2,
|
|
6266
|
-
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"
|
|
6267
|
-
}
|
|
6268
|
-
)
|
|
6269
|
-
}
|
|
6270
|
-
)
|
|
6271
|
-
}
|
|
6272
|
-
)
|
|
6273
|
-
]
|
|
6274
|
-
}
|
|
6275
|
-
)
|
|
6276
|
-
] }),
|
|
6277
|
-
/* @__PURE__ */ jsx65("div", { className: "p-4", children: row.elements?.length === 0 ? /* @__PURE__ */ jsx65("div", { className: "text-center py-4 bg-gray-50 rounded border-2 border-dashed border-gray-300", children: /* @__PURE__ */ jsx65("p", { className: "text-sm text-gray-500", children: "No elements in this row" }) }) : /* @__PURE__ */ jsx65("div", { className: "space-y-2", children: row.elements?.map(
|
|
6278
|
-
(el, elIndex) => !el.isDeleted && /* @__PURE__ */ jsxs37(
|
|
6279
|
-
"div",
|
|
6280
|
-
{
|
|
6281
|
-
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"}`,
|
|
6282
|
-
onClick: (e) => {
|
|
6283
|
-
e.stopPropagation();
|
|
6284
|
-
setSelectedItem({
|
|
6285
|
-
type: "element",
|
|
6286
|
-
sectionIndex,
|
|
6287
|
-
rowIndex,
|
|
6288
|
-
elementIndex: elIndex
|
|
6289
|
-
});
|
|
6290
|
-
},
|
|
6291
|
-
children: [
|
|
6292
|
-
/* @__PURE__ */ jsxs37("div", { className: "flex items-center space-x-3", children: [
|
|
6293
|
-
/* @__PURE__ */ jsx65("span", { className: "text-sm font-medium text-gray-700", children: el.label || "New Element" }),
|
|
6294
|
-
el.controlTypeCode && /* @__PURE__ */ jsx65(
|
|
6295
|
-
"span",
|
|
6296
|
-
{
|
|
6297
|
-
className: `px-2 py-0.5 rounded-full text-xs font-medium ${getControlTypeColor(el.controlTypeCode)}`,
|
|
6298
|
-
children: el.controlTypeCode
|
|
6299
|
-
}
|
|
6300
|
-
)
|
|
6301
|
-
] }),
|
|
6302
|
-
/* @__PURE__ */ jsx65(
|
|
6303
|
-
Button_default,
|
|
6304
|
-
{
|
|
6305
|
-
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
6306
|
-
onClick: async () => {
|
|
6307
|
-
deleteElement(
|
|
6308
|
-
sectionIndex,
|
|
6309
|
-
rowIndex,
|
|
6310
|
-
elIndex
|
|
6311
|
-
);
|
|
6312
|
-
return {
|
|
6313
|
-
isSuccessful: true,
|
|
6314
|
-
message: "Element deleted successfully"
|
|
6315
|
-
};
|
|
6316
|
-
},
|
|
6317
|
-
children: /* @__PURE__ */ jsx65(
|
|
6318
|
-
"svg",
|
|
6319
|
-
{
|
|
6320
|
-
className: "w-4 h-4",
|
|
6321
|
-
fill: "none",
|
|
6322
|
-
stroke: "currentColor",
|
|
6323
|
-
viewBox: "0 0 24 24",
|
|
6324
|
-
children: /* @__PURE__ */ jsx65(
|
|
6325
|
-
"path",
|
|
6326
|
-
{
|
|
6327
|
-
strokeLinecap: "round",
|
|
6328
|
-
strokeLinejoin: "round",
|
|
6329
|
-
strokeWidth: 2,
|
|
6330
|
-
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"
|
|
6331
|
-
}
|
|
6332
|
-
)
|
|
6333
|
-
}
|
|
6334
|
-
)
|
|
6335
|
-
}
|
|
6336
|
-
)
|
|
6337
|
-
]
|
|
6338
|
-
},
|
|
6339
|
-
el.siteFormDataFormSectionRowElementId || `${sectionIndex}-${rowIndex}-${elIndex}`
|
|
6340
|
-
)
|
|
6341
|
-
) }) })
|
|
6342
|
-
]
|
|
6343
|
-
},
|
|
6344
|
-
row.siteFormDataFormSectionRowId || `${sectionIndex}-${rowIndex}`
|
|
6345
|
-
)
|
|
6346
|
-
) }) })
|
|
6347
|
-
]
|
|
6348
|
-
},
|
|
6349
|
-
section.siteFormDataFormSectionId || sectionIndex
|
|
6350
|
-
)
|
|
6351
|
-
)
|
|
6352
|
-
}
|
|
6353
|
-
)
|
|
6354
|
-
] })
|
|
6355
|
-
] }),
|
|
6356
|
-
/* @__PURE__ */ jsxs37("div", { className: "mt-8 bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden", children: [
|
|
6357
|
-
/* @__PURE__ */ jsxs37("div", { className: "px-6 py-4 border-b border-gray-200 bg-gray-50 flex items-center justify-between", children: [
|
|
6358
|
-
/* @__PURE__ */ jsxs37("h2", { className: "text-lg font-semibold text-gray-800 flex items-center", children: [
|
|
6359
|
-
/* @__PURE__ */ jsx65(
|
|
6360
|
-
"svg",
|
|
6361
|
-
{
|
|
6362
|
-
className: "w-5 h-5 mr-2 text-gray-600",
|
|
6363
|
-
fill: "none",
|
|
6364
|
-
stroke: "currentColor",
|
|
6365
|
-
viewBox: "0 0 24 24",
|
|
6366
|
-
children: /* @__PURE__ */ jsx65(
|
|
6367
|
-
"path",
|
|
6368
|
-
{
|
|
6369
|
-
strokeLinecap: "round",
|
|
6370
|
-
strokeLinejoin: "round",
|
|
6371
|
-
strokeWidth: 2,
|
|
6372
|
-
d: "M13 10V3L4 14h7v7l9-11h-7z"
|
|
6373
|
-
}
|
|
6374
|
-
)
|
|
6375
|
-
}
|
|
6376
|
-
),
|
|
6377
|
-
"Form Actions"
|
|
6378
|
-
] }),
|
|
6379
|
-
/* @__PURE__ */ jsxs37(
|
|
6380
|
-
Button_default,
|
|
6381
|
-
{
|
|
6382
|
-
ButtonType: "Primary" /* Solid */,
|
|
6383
|
-
onClick: async () => {
|
|
6384
|
-
addAction();
|
|
6385
|
-
return {
|
|
6386
|
-
isSuccessful: true,
|
|
6387
|
-
message: "Action added successfully"
|
|
6388
|
-
};
|
|
6389
|
-
},
|
|
6390
|
-
children: [
|
|
6391
|
-
/* @__PURE__ */ jsx65(
|
|
6392
|
-
"svg",
|
|
6393
|
-
{
|
|
6394
|
-
className: "w-4 h-4 mr-2",
|
|
6395
|
-
fill: "none",
|
|
6396
|
-
stroke: "currentColor",
|
|
6397
|
-
viewBox: "0 0 24 24",
|
|
6398
|
-
children: /* @__PURE__ */ jsx65(
|
|
6399
|
-
"path",
|
|
6400
|
-
{
|
|
6401
|
-
strokeLinecap: "round",
|
|
6402
|
-
strokeLinejoin: "round",
|
|
6403
|
-
strokeWidth: 2,
|
|
6404
|
-
d: "M12 4v16m8-8H4"
|
|
6405
|
-
}
|
|
6406
|
-
)
|
|
6407
|
-
}
|
|
6408
|
-
),
|
|
6409
|
-
/* @__PURE__ */ jsx65("span", { children: "Add Action" })
|
|
6410
|
-
]
|
|
6411
|
-
}
|
|
6412
|
-
)
|
|
6413
|
-
] }),
|
|
6414
|
-
/* @__PURE__ */ jsx65("div", { className: "p-6 space-y-4", children: actions.length === 0 ? /* @__PURE__ */ jsxs37("div", { className: "text-center py-8", children: [
|
|
6415
|
-
/* @__PURE__ */ jsx65(
|
|
6416
|
-
"svg",
|
|
6417
|
-
{
|
|
6418
|
-
className: "mx-auto h-12 w-12 text-gray-400",
|
|
6419
|
-
fill: "none",
|
|
6420
|
-
stroke: "currentColor",
|
|
6421
|
-
viewBox: "0 0 24 24",
|
|
6422
|
-
children: /* @__PURE__ */ jsx65(
|
|
6423
|
-
"path",
|
|
6424
|
-
{
|
|
6425
|
-
strokeLinecap: "round",
|
|
6426
|
-
strokeLinejoin: "round",
|
|
6427
|
-
strokeWidth: 2,
|
|
6428
|
-
d: "M13 10V3L4 14h7v7l9-11h-7z"
|
|
6429
|
-
}
|
|
6430
|
-
)
|
|
6431
|
-
}
|
|
6432
|
-
),
|
|
6433
|
-
/* @__PURE__ */ jsx65("h3", { className: "mt-2 text-sm text-gray-900", children: "No actions" }),
|
|
6434
|
-
/* @__PURE__ */ jsx65("p", { className: "mt-1 text-sm text-gray-500", children: "Get started by adding actions." }),
|
|
6435
|
-
/* @__PURE__ */ jsx65("div", { className: "mt-6", children: /* @__PURE__ */ jsxs37(
|
|
6436
|
-
Button_default,
|
|
6437
|
-
{
|
|
6438
|
-
ButtonType: "Primary" /* Solid */,
|
|
6439
|
-
onClick: async () => {
|
|
6440
|
-
addAction();
|
|
6441
|
-
return {
|
|
6442
|
-
isSuccessful: true,
|
|
6443
|
-
message: "Action added successfully"
|
|
6444
|
-
};
|
|
6445
|
-
},
|
|
6446
|
-
children: [
|
|
6447
|
-
/* @__PURE__ */ jsx65(
|
|
6448
|
-
"svg",
|
|
6449
|
-
{
|
|
6450
|
-
className: "w-4 h-4 mr-2",
|
|
6451
|
-
fill: "none",
|
|
6452
|
-
stroke: "currentColor",
|
|
6453
|
-
viewBox: "0 0 24 24",
|
|
6454
|
-
children: /* @__PURE__ */ jsx65(
|
|
6455
|
-
"path",
|
|
6456
|
-
{
|
|
6457
|
-
strokeLinecap: "round",
|
|
6458
|
-
strokeLinejoin: "round",
|
|
6459
|
-
strokeWidth: 2,
|
|
6460
|
-
d: "M12 4v16m8-8H4"
|
|
6461
|
-
}
|
|
6462
|
-
)
|
|
6463
|
-
}
|
|
6464
|
-
),
|
|
6465
|
-
"Add an action"
|
|
6466
|
-
]
|
|
6467
|
-
}
|
|
6468
|
-
) })
|
|
6469
|
-
] }) : actions.map(
|
|
6470
|
-
(action, index) => !action.isDeleted && /* @__PURE__ */ jsxs37(
|
|
6471
|
-
"div",
|
|
6472
|
-
{
|
|
6473
|
-
className: "border border-gray-200 rounded-lg overflow-hidden",
|
|
6474
|
-
children: [
|
|
6475
|
-
/* @__PURE__ */ jsx65("div", { className: "p-4 bg-gray-50 border-b border-gray-200", children: /* @__PURE__ */ jsxs37("div", { className: "flex items-center justify-between", children: [
|
|
6476
|
-
/* @__PURE__ */ jsx65("h3", { className: "text-sm font-medium text-gray-700", children: action.actionTitle || "New Action" }),
|
|
6477
|
-
/* @__PURE__ */ jsx65(
|
|
6478
|
-
Button_default,
|
|
6479
|
-
{
|
|
6480
|
-
ButtonType: "Primary" /* Solid */,
|
|
6481
|
-
onClick: async () => {
|
|
6482
|
-
deleteAction(index);
|
|
6483
|
-
return {
|
|
6484
|
-
isSuccessful: true,
|
|
6485
|
-
message: "Action deleted successfully"
|
|
6486
|
-
};
|
|
6487
|
-
},
|
|
6488
|
-
children: /* @__PURE__ */ jsx65(
|
|
6489
|
-
"svg",
|
|
6490
|
-
{
|
|
6491
|
-
className: "w-4 h-4",
|
|
6492
|
-
fill: "none",
|
|
6493
|
-
stroke: "currentColor",
|
|
6494
|
-
viewBox: "0 0 24 24",
|
|
6495
|
-
children: /* @__PURE__ */ jsx65(
|
|
6496
|
-
"path",
|
|
6497
|
-
{
|
|
6498
|
-
strokeLinecap: "round",
|
|
6499
|
-
strokeLinejoin: "round",
|
|
6500
|
-
strokeWidth: 2,
|
|
6501
|
-
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"
|
|
6502
|
-
}
|
|
6503
|
-
)
|
|
6504
|
-
}
|
|
6505
|
-
)
|
|
6506
|
-
}
|
|
6507
|
-
)
|
|
6508
|
-
] }) }),
|
|
6509
|
-
/* @__PURE__ */ jsx65("div", { className: "p-4", children: /* @__PURE__ */ jsxs37("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
|
|
6510
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-1", children: /* @__PURE__ */ jsx65(
|
|
6511
|
-
InputControl_default,
|
|
6512
|
-
{
|
|
6513
|
-
name: "actionCode",
|
|
6514
|
-
controlType: InputControlType_default.select,
|
|
6515
|
-
value: action.actionCode || "",
|
|
6516
|
-
dataset: actionCode,
|
|
6517
|
-
dataKeyFieldName: "value",
|
|
6518
|
-
dataTextFieldName: "label",
|
|
6519
|
-
callback: ({ name, value }) => {
|
|
6520
|
-
updateActionField(
|
|
6521
|
-
index,
|
|
6522
|
-
"actionCode",
|
|
6523
|
-
value
|
|
6524
|
-
);
|
|
6525
|
-
},
|
|
6526
|
-
attributes: {
|
|
6527
|
-
required: true,
|
|
6528
|
-
label: "ActionCode"
|
|
6529
|
-
}
|
|
6530
|
-
}
|
|
6531
|
-
) }),
|
|
6532
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-1", children: /* @__PURE__ */ jsx65(
|
|
6533
|
-
InputControl_default,
|
|
6534
|
-
{
|
|
6535
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6536
|
-
name: "action.actionTitle",
|
|
6537
|
-
value: action.actionTitle || "",
|
|
6538
|
-
callback: ({ value }) => {
|
|
6539
|
-
updateActionField(
|
|
6540
|
-
index,
|
|
6541
|
-
"actionTitle",
|
|
6542
|
-
value
|
|
6543
|
-
);
|
|
6544
|
-
},
|
|
6545
|
-
attributes: {
|
|
6546
|
-
label: "ActionTitle",
|
|
6547
|
-
placeholder: "actionTitle"
|
|
6548
|
-
}
|
|
6549
|
-
}
|
|
6550
|
-
) }),
|
|
6551
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-1", children: /* @__PURE__ */ jsx65(
|
|
6552
|
-
InputControl_default,
|
|
6553
|
-
{
|
|
6554
|
-
controlType: InputControlType_default.lineTextInput,
|
|
6555
|
-
name: "action.serviceRoute",
|
|
6556
|
-
value: action.serviceRoute,
|
|
6557
|
-
callback: ({ value }) => {
|
|
6558
|
-
updateActionField(
|
|
6559
|
-
index,
|
|
6560
|
-
"serviceRoute",
|
|
6561
|
-
value
|
|
6562
|
-
);
|
|
6563
|
-
},
|
|
6564
|
-
attributes: {
|
|
6565
|
-
label: "ServiceRoute",
|
|
6566
|
-
placeholder: "/api/endpoint"
|
|
6567
|
-
}
|
|
6568
|
-
}
|
|
6569
|
-
) }),
|
|
6570
|
-
/* @__PURE__ */ jsx65("div", { className: "space-y-1", children: /* @__PURE__ */ jsx65(
|
|
6571
|
-
InputControl_default,
|
|
6572
|
-
{
|
|
6573
|
-
name: "httpMethod",
|
|
6574
|
-
controlType: InputControlType_default.select,
|
|
6575
|
-
value: action.httpMethod || "post",
|
|
6576
|
-
dataset: httpMethods,
|
|
6577
|
-
dataKeyFieldName: "value",
|
|
6578
|
-
dataTextFieldName: "label",
|
|
6579
|
-
callback: ({ name, value }) => {
|
|
6580
|
-
updateActionField(
|
|
6581
|
-
index,
|
|
6582
|
-
"httpMethod",
|
|
6583
|
-
value
|
|
6584
|
-
);
|
|
6585
|
-
},
|
|
6586
|
-
attributes: {
|
|
6587
|
-
label: "HTTP Method",
|
|
6588
|
-
required: true
|
|
6589
|
-
}
|
|
6590
|
-
}
|
|
6591
|
-
) })
|
|
6592
|
-
] }) })
|
|
6593
|
-
]
|
|
6594
|
-
},
|
|
6595
|
-
action.siteFormDataFormActionId || index
|
|
6596
|
-
)
|
|
6597
|
-
) })
|
|
6598
|
-
] })
|
|
6599
|
-
] }),
|
|
6600
|
-
/* @__PURE__ */ jsxs37("div", { className: "mt-8 flex justify-end space-x-4 border-t pt-6", children: [
|
|
6601
|
-
isEditMode && /* @__PURE__ */ jsxs37(
|
|
6602
|
-
Button_default,
|
|
6603
|
-
{
|
|
6604
|
-
ButtonType: "PrimaryHollow" /* Hollow */,
|
|
6605
|
-
showToast: true,
|
|
6606
|
-
onClick: async () => {
|
|
6607
|
-
const response = await onDelete();
|
|
6608
|
-
return {
|
|
6609
|
-
isSuccessful: response.isSuccessful,
|
|
6610
|
-
message: response.isSuccessful ? "Form deleted successfully!" : "Failed to delete form"
|
|
6611
|
-
};
|
|
6612
|
-
},
|
|
6613
|
-
children: [
|
|
6614
|
-
/* @__PURE__ */ jsx65(
|
|
6615
|
-
"svg",
|
|
6616
|
-
{
|
|
6617
|
-
className: "w-4 h-4 mr-2",
|
|
6618
|
-
fill: "none",
|
|
6619
|
-
stroke: "currentColor",
|
|
6620
|
-
viewBox: "0 0 24 24",
|
|
6621
|
-
children: /* @__PURE__ */ jsx65(
|
|
6622
|
-
"path",
|
|
6623
|
-
{
|
|
6624
|
-
strokeLinecap: "round",
|
|
6625
|
-
strokeLinejoin: "round",
|
|
6626
|
-
strokeWidth: 2,
|
|
6627
|
-
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"
|
|
6628
|
-
}
|
|
6629
|
-
)
|
|
6630
|
-
}
|
|
6631
|
-
),
|
|
6632
|
-
/* @__PURE__ */ jsx65("span", { children: "Delete Form" })
|
|
6633
|
-
]
|
|
6634
|
-
}
|
|
6635
|
-
),
|
|
6636
|
-
/* @__PURE__ */ jsxs37(
|
|
6637
|
-
Button_default,
|
|
6638
|
-
{
|
|
6639
|
-
ButtonType: "Primary" /* Solid */,
|
|
6640
|
-
showToast: true,
|
|
6641
|
-
onClick: async () => {
|
|
6642
|
-
const response = await onSave();
|
|
6643
|
-
return {
|
|
6644
|
-
isSuccessful: response.isSuccessful,
|
|
6645
|
-
message: response.isSuccessful ? isEditMode ? "Form updated successfully!" : "Form created successfully!" : "Failed to save form"
|
|
6646
|
-
};
|
|
6647
|
-
},
|
|
6648
|
-
children: [
|
|
6649
|
-
/* @__PURE__ */ jsx65(
|
|
6650
|
-
"svg",
|
|
6651
|
-
{
|
|
6652
|
-
className: "w-5 h-5 mr-2",
|
|
6653
|
-
fill: "none",
|
|
6654
|
-
stroke: "currentColor",
|
|
6655
|
-
viewBox: "0 0 24 24",
|
|
6656
|
-
children: /* @__PURE__ */ jsx65(
|
|
6657
|
-
"path",
|
|
6658
|
-
{
|
|
6659
|
-
strokeLinecap: "round",
|
|
6660
|
-
strokeLinejoin: "round",
|
|
6661
|
-
strokeWidth: 2,
|
|
6662
|
-
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"
|
|
6663
|
-
}
|
|
6664
|
-
)
|
|
6665
|
-
}
|
|
6666
|
-
),
|
|
6667
|
-
/* @__PURE__ */ jsx65("span", { children: loadingApps ? "Loading..." : isEditMode ? "Update Layout" : "Create Layout" })
|
|
6668
|
-
]
|
|
6669
|
-
}
|
|
6670
|
-
)
|
|
6671
|
-
] })
|
|
6672
|
-
] })
|
|
6673
|
-
] }),
|
|
6674
|
-
/* @__PURE__ */ jsxs37("div", { className: "w-96 bg-white border-l border-gray-200 overflow-y-auto", children: [
|
|
6675
|
-
/* @__PURE__ */ jsx65("div", { className: "sticky top-0 bg-white border-b border-gray-200 px-6 py-4", children: /* @__PURE__ */ jsxs37("h2", { className: "text-lg font-semibold text-gray-800 flex items-center", children: [
|
|
6676
|
-
/* @__PURE__ */ jsx65(
|
|
6677
|
-
"svg",
|
|
6678
|
-
{
|
|
6679
|
-
className: "w-5 h-5 mr-2 text-gray-600",
|
|
6680
|
-
fill: "none",
|
|
6681
|
-
stroke: "currentColor",
|
|
6682
|
-
viewBox: "0 0 24 24",
|
|
6683
|
-
children: /* @__PURE__ */ jsx65(
|
|
6684
|
-
"path",
|
|
6685
|
-
{
|
|
6686
|
-
strokeLinecap: "round",
|
|
6687
|
-
strokeLinejoin: "round",
|
|
6688
|
-
strokeWidth: 2,
|
|
6689
|
-
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"
|
|
6690
|
-
}
|
|
6691
|
-
)
|
|
6692
|
-
}
|
|
6693
|
-
),
|
|
6694
|
-
"Properties"
|
|
6695
|
-
] }) }),
|
|
6696
|
-
renderSidebarContent()
|
|
5445
|
+
/* @__PURE__ */ jsx66("div", { children: props.onClick && /* @__PURE__ */ jsx66(
|
|
5446
|
+
Button_default,
|
|
5447
|
+
{
|
|
5448
|
+
onValidate,
|
|
5449
|
+
onClick,
|
|
5450
|
+
showToast: true,
|
|
5451
|
+
ButtonType: "Primary" /* Solid */,
|
|
5452
|
+
className: "py-2 leading-6",
|
|
5453
|
+
children: props.buttonText ? `${props.buttonText}` : "Save Changes"
|
|
5454
|
+
}
|
|
5455
|
+
) })
|
|
6697
5456
|
] })
|
|
6698
5457
|
] }) });
|
|
6699
|
-
}
|
|
6700
|
-
var DataForm_default =
|
|
5458
|
+
};
|
|
5459
|
+
var DataForm_default = DataForm2;
|
|
6701
5460
|
|
|
6702
5461
|
// src/components/dataForm/DataFormRenderer.tsx
|
|
6703
|
-
import { jsx as
|
|
5462
|
+
import { jsx as jsx67, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
6704
5463
|
function getAction(actions, code) {
|
|
6705
5464
|
return actions?.find((a) => a.actionCode === code);
|
|
6706
5465
|
}
|
|
@@ -6726,9 +5485,9 @@ var DataFormRenderer = ({
|
|
|
6726
5485
|
"Delete"
|
|
6727
5486
|
);
|
|
6728
5487
|
const hasDataItem = dataItem && Object.keys(dataItem).length > 0;
|
|
6729
|
-
return /* @__PURE__ */
|
|
6730
|
-
widgetProps && /* @__PURE__ */
|
|
6731
|
-
/* @__PURE__ */
|
|
5488
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex-grow flex flex-col", children: [
|
|
5489
|
+
widgetProps && /* @__PURE__ */ jsx67(NavigationTabsV2_default, { tabs, params: widgetProps.params }),
|
|
5490
|
+
/* @__PURE__ */ jsx67(
|
|
6732
5491
|
DataForm_default,
|
|
6733
5492
|
{
|
|
6734
5493
|
title: !isAddPage ? "Edit " + formDefinition.formTitle + "- v2" : "Add " + formDefinition.formTitle + "- v2",
|