blixify-ui-web 0.4.207 → 0.4.209
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/lib/components/action/button/index.d.ts +1 -0
- package/lib/components/action/button/index.d.ts.map +1 -1
- package/lib/components/action/button/index.js +18 -2
- package/lib/components/action/button/index.js.map +1 -1
- package/lib/components/action/textButton/index.d.ts +1 -0
- package/lib/components/action/textButton/index.d.ts.map +1 -1
- package/lib/components/action/textButton/index.js +18 -2
- package/lib/components/action/textButton/index.js.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.d.ts +18 -0
- package/lib/components/data/dataTemplate/dataStateModel.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/dataStateModel.js.map +1 -1
- package/lib/components/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +447 -115
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +2 -0
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/components/data/listModule.d.ts.map +1 -1
- package/lib/components/data/listModule.js +14 -2
- package/lib/components/data/listModule.js.map +1 -1
- package/lib/components/data/updateModule.d.ts.map +1 -1
- package/lib/components/data/updateModule.js +249 -11
- package/lib/components/data/updateModule.js.map +1 -1
- package/lib/components/data/utils.d.ts.map +1 -1
- package/lib/components/data/utils.js +3 -0
- package/lib/components/data/utils.js.map +1 -1
- package/lib/components/input/canvas/index.d.ts +19 -2
- package/lib/components/input/canvas/index.d.ts.map +1 -1
- package/lib/components/input/canvas/index.js +258 -61
- package/lib/components/input/canvas/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -108,6 +108,15 @@ var additionalSelect = (react_1.default.createElement("div", { className: "flex
|
|
|
108
108
|
//=====================================================================================
|
|
109
109
|
//SECTION: Update Feature used across Data Components
|
|
110
110
|
//=====================================================================================
|
|
111
|
+
// Blob URL cache to prevent memory leaks from creating new URLs on every render
|
|
112
|
+
var blobUrlCache = new WeakMap();
|
|
113
|
+
var getBlobUrlForFile = function (file) {
|
|
114
|
+
if (!blobUrlCache.has(file)) {
|
|
115
|
+
var blobUrl = URL.createObjectURL(file);
|
|
116
|
+
blobUrlCache.set(file, blobUrl);
|
|
117
|
+
}
|
|
118
|
+
return blobUrlCache.get(file);
|
|
119
|
+
};
|
|
111
120
|
var handleCastDataAttribute = function (model, value, clonedSelectedData, server, force) {
|
|
112
121
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
113
122
|
switch (model.type) {
|
|
@@ -304,10 +313,33 @@ var handleCastDataAttribute = function (model, value, clonedSelectedData, server
|
|
|
304
313
|
clonedSelectedData[model.id] = value[model.id].filter(function (eachVal) { return eachVal !== "others"; });
|
|
305
314
|
break;
|
|
306
315
|
case "canvas":
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
316
|
+
var canvasValue = value[model.id];
|
|
317
|
+
var useNewFormat = model.enableDraw || model.enableImageUpload;
|
|
318
|
+
if (useNewFormat) {
|
|
319
|
+
// New format: normalize to { texts: [], drawings: [], backgroundImage?: { fileName, token } }
|
|
320
|
+
if (model.defaultValue) {
|
|
321
|
+
var defaultValue = model.defaultValue;
|
|
322
|
+
clonedSelectedData[model.id] =
|
|
323
|
+
Array.isArray(defaultValue) || !defaultValue
|
|
324
|
+
? { texts: defaultValue !== null && defaultValue !== void 0 ? defaultValue : [], drawings: [] }
|
|
325
|
+
: defaultValue;
|
|
326
|
+
}
|
|
327
|
+
else if (canvasValue) {
|
|
328
|
+
clonedSelectedData[model.id] = Array.isArray(canvasValue)
|
|
329
|
+
? { texts: canvasValue, drawings: [] }
|
|
330
|
+
: canvasValue;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
clonedSelectedData[model.id] = { texts: [], drawings: [] };
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
// Old format: keep as texts[] array
|
|
338
|
+
if (model.defaultValue)
|
|
339
|
+
clonedSelectedData[model.id] = (_2 = value[model.id]) !== null && _2 !== void 0 ? _2 : model.defaultValue;
|
|
340
|
+
else
|
|
341
|
+
clonedSelectedData[model.id] = value[model.id];
|
|
342
|
+
}
|
|
311
343
|
break;
|
|
312
344
|
case "ganttchart":
|
|
313
345
|
if (model.defaultValue)
|
|
@@ -761,7 +793,7 @@ var renderEachListObject = function (type, selectedModelId, model, selectedData,
|
|
|
761
793
|
title: eachObj.name,
|
|
762
794
|
}); })) !== null && _d !== void 0 ? _d : [];
|
|
763
795
|
clonedSelectedData[selectedModelId].map(function (eachObject) {
|
|
764
|
-
var _a, _b;
|
|
796
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
765
797
|
var eachNewList = {
|
|
766
798
|
id: "",
|
|
767
799
|
title: "",
|
|
@@ -917,6 +949,59 @@ var renderEachListObject = function (type, selectedModelId, model, selectedData,
|
|
|
917
949
|
eachNewTable[eachKey] = (react_1.default.createElement("div", { className: "mt-2 prose prose-sm [&>p]:leading-normal [&>p]:mb-0 [&>p]:mt-0", dangerouslySetInnerHTML: { __html: renderedHtml } }));
|
|
918
950
|
}
|
|
919
951
|
break;
|
|
952
|
+
case "canvas":
|
|
953
|
+
// Render Canvas component for listObject items
|
|
954
|
+
var canvasValue = eachValue;
|
|
955
|
+
var useNewFormat = (model_1 === null || model_1 === void 0 ? void 0 : model_1.enableDraw) || (model_1 === null || model_1 === void 0 ? void 0 : model_1.enableImageUpload);
|
|
956
|
+
// Normalize canvas data structure
|
|
957
|
+
var normalizedTexts = [];
|
|
958
|
+
var normalizedDrawings = [];
|
|
959
|
+
var backgroundImageUrl = undefined;
|
|
960
|
+
if (useNewFormat) {
|
|
961
|
+
// New format: expect { texts: [], drawings: [], backgroundImage?: { fileName, token } }
|
|
962
|
+
if (Array.isArray(canvasValue) || !canvasValue) {
|
|
963
|
+
normalizedTexts = canvasValue !== null && canvasValue !== void 0 ? canvasValue : [];
|
|
964
|
+
normalizedDrawings = [];
|
|
965
|
+
}
|
|
966
|
+
else {
|
|
967
|
+
normalizedTexts = (_c = canvasValue.texts) !== null && _c !== void 0 ? _c : [];
|
|
968
|
+
normalizedDrawings = (_d = canvasValue.drawings) !== null && _d !== void 0 ? _d : [];
|
|
969
|
+
// Build backgroundImageUrl if token exists, or create blob URL if file exists
|
|
970
|
+
// Skip if _cleared flag is set (was cleared via "Clear All")
|
|
971
|
+
if ((model_1 === null || model_1 === void 0 ? void 0 : model_1.enableImageUpload) &&
|
|
972
|
+
canvasValue.backgroundImage &&
|
|
973
|
+
!canvasValue.backgroundImage._cleared) {
|
|
974
|
+
if (canvasValue.backgroundImage.token) {
|
|
975
|
+
// Image has been uploaded - use token to construct URL
|
|
976
|
+
backgroundImageUrl = (0, blobModule_1.renderImageUrlFromPath)(devSettings.imageEndpoint, model_1.imageCollectionName + "%2F" + dataId, selectedModelId +
|
|
977
|
+
"%2F" +
|
|
978
|
+
eachObject.id +
|
|
979
|
+
"%2F" +
|
|
980
|
+
model_1.id, canvasValue.backgroundImage.fileName, canvasValue.backgroundImage.token, devSettings.bucketName);
|
|
981
|
+
}
|
|
982
|
+
else if (canvasValue.backgroundImage.file &&
|
|
983
|
+
canvasValue.backgroundImage.file instanceof File) {
|
|
984
|
+
// Image hasn't been uploaded yet - use cached blob URL from File object
|
|
985
|
+
backgroundImageUrl = getBlobUrlForFile(canvasValue.backgroundImage.file);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
// Old format: expect texts[] array
|
|
992
|
+
normalizedTexts = Array.isArray(canvasValue)
|
|
993
|
+
? canvasValue
|
|
994
|
+
: (_e = canvasValue === null || canvasValue === void 0 ? void 0 : canvasValue.texts) !== null && _e !== void 0 ? _e : [];
|
|
995
|
+
normalizedDrawings = [];
|
|
996
|
+
}
|
|
997
|
+
// For listObject, canvas in list/table view should always be readOnly
|
|
998
|
+
// (editing happens in Modal, not in the list/table view)
|
|
999
|
+
// Use pointer cursor since the entire listObject item is clickable
|
|
1000
|
+
eachNewList[eachKey] = (react_1.default.createElement("div", { className: "w-full my-2" },
|
|
1001
|
+
react_1.default.createElement(canvas_1.Canvas, { label: (_f = model_1 === null || model_1 === void 0 ? void 0 : model_1.name) !== null && _f !== void 0 ? _f : "", texts: normalizedTexts, drawings: normalizedDrawings, backgroundImageUrl: backgroundImageUrl, enableDraw: false, enableImageUpload: false, readOnly: true, cursor: "pointer" })));
|
|
1002
|
+
eachNewTable[eachKey] = (react_1.default.createElement("div", { className: "w-full my-2" },
|
|
1003
|
+
react_1.default.createElement(canvas_1.Canvas, { label: (_g = model_1 === null || model_1 === void 0 ? void 0 : model_1.name) !== null && _g !== void 0 ? _g : "", texts: normalizedTexts, drawings: normalizedDrawings, backgroundImageUrl: backgroundImageUrl, enableDraw: false, enableImageUpload: false, readOnly: true, cursor: "pointer" })));
|
|
1004
|
+
break;
|
|
920
1005
|
case "address":
|
|
921
1006
|
case "object":
|
|
922
1007
|
break;
|
|
@@ -933,8 +1018,8 @@ var renderEachListObject = function (type, selectedModelId, model, selectedData,
|
|
|
933
1018
|
}
|
|
934
1019
|
}
|
|
935
1020
|
};
|
|
936
|
-
for (var _i = 0,
|
|
937
|
-
var
|
|
1021
|
+
for (var _i = 0, _h = Object.entries(eachObject); _i < _h.length; _i++) {
|
|
1022
|
+
var _j = _h[_i], eachKey = _j[0], eachValue = _j[1];
|
|
938
1023
|
_loop_1(eachKey, eachValue);
|
|
939
1024
|
}
|
|
940
1025
|
if (!checkIdExists_1) {
|
|
@@ -1064,7 +1149,7 @@ var renderDataTemplateForm = function (data, model, formInputRef, updateMethod,
|
|
|
1064
1149
|
});
|
|
1065
1150
|
var clonedSelectedData = (0, exports.handleClonedDataAttribute)(data, model, (_d = (_c = referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.devSettings) === null || _c === void 0 ? void 0 : _c.server) !== null && _d !== void 0 ? _d : "mongoServer", false, isRemainId);
|
|
1066
1151
|
filteredModel.forEach(function (eachAttribute, index) {
|
|
1067
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29;
|
|
1152
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36;
|
|
1068
1153
|
var shouldShow = (0, exports.renderShowCondition)(eachAttribute, clonedSelectedData, isForm);
|
|
1069
1154
|
if (!shouldShow)
|
|
1070
1155
|
return;
|
|
@@ -1552,14 +1637,167 @@ var renderDataTemplateForm = function (data, model, formInputRef, updateMethod,
|
|
|
1552
1637
|
}
|
|
1553
1638
|
break;
|
|
1554
1639
|
case "canvas":
|
|
1640
|
+
// Normalize canvas data structure based on enableDraw or enableImageUpload
|
|
1641
|
+
var canvasData = clonedSelectedData[eachAttribute.id];
|
|
1642
|
+
var useNewFormat = eachAttribute.enableDraw || eachAttribute.enableImageUpload;
|
|
1643
|
+
var normalizedTexts = [];
|
|
1644
|
+
var normalizedDrawings = [];
|
|
1645
|
+
if (useNewFormat) {
|
|
1646
|
+
// New format: expect { texts: [], drawings: [], backgroundImage?: { fileName, token } } or normalize from old format
|
|
1647
|
+
if (Array.isArray(canvasData) || !canvasData) {
|
|
1648
|
+
normalizedTexts = canvasData !== null && canvasData !== void 0 ? canvasData : [];
|
|
1649
|
+
normalizedDrawings = [];
|
|
1650
|
+
}
|
|
1651
|
+
else {
|
|
1652
|
+
normalizedTexts = (_27 = canvasData.texts) !== null && _27 !== void 0 ? _27 : [];
|
|
1653
|
+
normalizedDrawings = (_28 = canvasData.drawings) !== null && _28 !== void 0 ? _28 : [];
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
else {
|
|
1657
|
+
// Old format: expect texts[] array
|
|
1658
|
+
normalizedTexts = Array.isArray(canvasData)
|
|
1659
|
+
? canvasData
|
|
1660
|
+
: (_29 = canvasData === null || canvasData === void 0 ? void 0 : canvasData.texts) !== null && _29 !== void 0 ? _29 : [];
|
|
1661
|
+
normalizedDrawings = [];
|
|
1662
|
+
}
|
|
1555
1663
|
inputList[groupId].push(react_1.default.createElement(canvas_1.Canvas, { ref: eachAttribute.optional
|
|
1556
1664
|
? null
|
|
1557
|
-
: formInputRef[(
|
|
1558
|
-
|
|
1665
|
+
: formInputRef[(_30 = eachAttribute.refIndex) !== null && _30 !== void 0 ? _30 : index], id: eachAttribute.id, label: label, labelExtra: labelExtra, infoElement: (cellInput === null || cellInput === void 0 ? void 0 : cellInput.active) ? undefined : infoElement, optional: eachAttribute.optional, enableDraw: (props === null || props === void 0 ? void 0 : props.type) === "update" ? eachAttribute.enableDraw : false, enableImageUpload: (props === null || props === void 0 ? void 0 : props.type) === "update" ? eachAttribute.enableImageUpload : false, readOnly: (props === null || props === void 0 ? void 0 : props.type) !== "update", texts: normalizedTexts, drawings: normalizedDrawings, backgroundImageUrl: eachAttribute.enableImageUpload &&
|
|
1666
|
+
canvasData &&
|
|
1667
|
+
!Array.isArray(canvasData) &&
|
|
1668
|
+
canvasData.backgroundImage
|
|
1669
|
+
? // If backgroundImage has token, construct URL from token and fileName
|
|
1670
|
+
// If it has file but no token, create blob URL from File object
|
|
1671
|
+
canvasData.backgroundImage.token
|
|
1672
|
+
? (props === null || props === void 0 ? void 0 : props.isObjectList)
|
|
1673
|
+
? (0, blobModule_1.renderImageUrlFromPath)((_31 = fileProps === null || fileProps === void 0 ? void 0 : fileProps.imageEndpoint) !== null && _31 !== void 0 ? _31 : "", eachAttribute.imageCollectionName + "%2F" + props.id, (objectProps === null || objectProps === void 0 ? void 0 : objectProps.selectedObjectStructureId) +
|
|
1674
|
+
"%2F" +
|
|
1675
|
+
(objectProps === null || objectProps === void 0 ? void 0 : objectProps.selectedObjectId) +
|
|
1676
|
+
"%2F" +
|
|
1677
|
+
eachAttribute.id, canvasData.backgroundImage.fileName, canvasData.backgroundImage.token, fileProps === null || fileProps === void 0 ? void 0 : fileProps.imageBucketName)
|
|
1678
|
+
: (props === null || props === void 0 ? void 0 : props.isObject)
|
|
1679
|
+
? (0, blobModule_1.renderImageUrlFromPath)((_32 = fileProps === null || fileProps === void 0 ? void 0 : fileProps.imageEndpoint) !== null && _32 !== void 0 ? _32 : "", eachAttribute.imageCollectionName + "%2F" + props.id, (objectProps === null || objectProps === void 0 ? void 0 : objectProps.selectedObjectStructureId) +
|
|
1680
|
+
"%2F" +
|
|
1681
|
+
eachAttribute.id +
|
|
1682
|
+
"%2FbaseCanvas", canvasData.backgroundImage.fileName, canvasData.backgroundImage.token, fileProps === null || fileProps === void 0 ? void 0 : fileProps.imageBucketName)
|
|
1683
|
+
: (0, blobModule_1.renderImageUrlFromPath)((_33 = fileProps === null || fileProps === void 0 ? void 0 : fileProps.imageEndpoint) !== null && _33 !== void 0 ? _33 : "", (_34 = eachAttribute.imageCollectionName) !== null && _34 !== void 0 ? _34 : "", ((_35 = props === null || props === void 0 ? void 0 : props.id) !== null && _35 !== void 0 ? _35 : "") + "%2FbaseCanvas", canvasData.backgroundImage.fileName, canvasData.backgroundImage.token, fileProps === null || fileProps === void 0 ? void 0 : fileProps.imageBucketName)
|
|
1684
|
+
: canvasData.backgroundImage.file &&
|
|
1685
|
+
canvasData.backgroundImage.file instanceof File
|
|
1686
|
+
? // Image hasn't been uploaded yet - use cached blob URL from File object
|
|
1687
|
+
getBlobUrlForFile(canvasData.backgroundImage.file)
|
|
1688
|
+
: undefined
|
|
1689
|
+
: eachAttribute.canvasImage, onChange: function (texts) {
|
|
1690
|
+
var _a, _b, _c;
|
|
1691
|
+
var useNewFormat = eachAttribute.enableDraw || eachAttribute.enableImageUpload;
|
|
1692
|
+
if (useNewFormat) {
|
|
1693
|
+
// New format: save as object with texts, drawings, and optionally backgroundImage
|
|
1694
|
+
var currentData = clonedSelectedData[eachAttribute.id];
|
|
1695
|
+
// Build base canvas data
|
|
1696
|
+
var baseCanvasData = Array.isArray(currentData) || !currentData
|
|
1697
|
+
? {
|
|
1698
|
+
texts: currentData !== null && currentData !== void 0 ? currentData : [],
|
|
1699
|
+
drawings: [],
|
|
1700
|
+
}
|
|
1701
|
+
: {
|
|
1702
|
+
texts: (_a = currentData.texts) !== null && _a !== void 0 ? _a : [],
|
|
1703
|
+
drawings: (_b = currentData.drawings) !== null && _b !== void 0 ? _b : [],
|
|
1704
|
+
};
|
|
1705
|
+
// Only include backgroundImage if enableImageUpload is true
|
|
1706
|
+
var currentCanvasData = eachAttribute.enableImageUpload
|
|
1707
|
+
? __assign(__assign({}, baseCanvasData), { backgroundImage: currentData && !Array.isArray(currentData)
|
|
1708
|
+
? (_c = currentData.backgroundImage) !== null && _c !== void 0 ? _c : null
|
|
1709
|
+
: null }) : baseCanvasData;
|
|
1710
|
+
updateMethod.handleOnChangeSelect(eachAttribute.id, __assign(__assign({}, currentCanvasData), { texts: texts }));
|
|
1711
|
+
}
|
|
1712
|
+
else {
|
|
1713
|
+
// Old format: save as just texts array
|
|
1714
|
+
updateMethod.handleOnChangeSelect(eachAttribute.id, texts);
|
|
1715
|
+
}
|
|
1716
|
+
}, onDrawingsChange: function (drawings) {
|
|
1717
|
+
var _a, _b, _c;
|
|
1718
|
+
if (eachAttribute.enableDraw) {
|
|
1719
|
+
// New format: save as object with texts, drawings, and optionally backgroundImage
|
|
1720
|
+
var currentData = clonedSelectedData[eachAttribute.id];
|
|
1721
|
+
// Build base canvas data
|
|
1722
|
+
var baseCanvasData = Array.isArray(currentData) || !currentData
|
|
1723
|
+
? {
|
|
1724
|
+
texts: currentData !== null && currentData !== void 0 ? currentData : [],
|
|
1725
|
+
drawings: [],
|
|
1726
|
+
}
|
|
1727
|
+
: {
|
|
1728
|
+
texts: (_a = currentData.texts) !== null && _a !== void 0 ? _a : [],
|
|
1729
|
+
drawings: (_b = currentData.drawings) !== null && _b !== void 0 ? _b : [],
|
|
1730
|
+
};
|
|
1731
|
+
// Only include backgroundImage if enableImageUpload is true
|
|
1732
|
+
var currentCanvasData = eachAttribute.enableImageUpload
|
|
1733
|
+
? __assign(__assign({}, baseCanvasData), { backgroundImage: currentData && !Array.isArray(currentData)
|
|
1734
|
+
? (_c = currentData.backgroundImage) !== null && _c !== void 0 ? _c : null
|
|
1735
|
+
: null }) : baseCanvasData;
|
|
1736
|
+
updateMethod.handleOnChangeSelect(eachAttribute.id, __assign(__assign({}, currentCanvasData), { drawings: drawings }));
|
|
1737
|
+
}
|
|
1738
|
+
// If enableDraw is false, drawings are not tracked, so do nothing
|
|
1739
|
+
}, onBackgroundImageChange: function (imageFile) {
|
|
1740
|
+
var _a, _b;
|
|
1741
|
+
if (eachAttribute.enableImageUpload) {
|
|
1742
|
+
// New format: save backgroundImage with fileName and token
|
|
1743
|
+
// For now, store the File object - upload will happen during submission
|
|
1744
|
+
// The File will be uploaded and replaced with { fileName, token } during form submission
|
|
1745
|
+
var currentData = clonedSelectedData[eachAttribute.id];
|
|
1746
|
+
var useNewFormat_1 = eachAttribute.enableDraw || eachAttribute.enableImageUpload;
|
|
1747
|
+
var currentCanvasData = useNewFormat_1
|
|
1748
|
+
? Array.isArray(currentData) || !currentData
|
|
1749
|
+
? {
|
|
1750
|
+
texts: currentData !== null && currentData !== void 0 ? currentData : [],
|
|
1751
|
+
drawings: [],
|
|
1752
|
+
}
|
|
1753
|
+
: {
|
|
1754
|
+
texts: (_a = currentData.texts) !== null && _a !== void 0 ? _a : [],
|
|
1755
|
+
drawings: (_b = currentData.drawings) !== null && _b !== void 0 ? _b : [],
|
|
1756
|
+
}
|
|
1757
|
+
: { texts: currentData !== null && currentData !== void 0 ? currentData : [], drawings: [] };
|
|
1758
|
+
// Store the File temporarily - will be uploaded during submission
|
|
1759
|
+
// If imageFile is null (unselected), preserve the existing File object temporarily
|
|
1760
|
+
// so it can be reselected without losing the data
|
|
1761
|
+
// However, we mark it as "unselected" by storing it with a special flag
|
|
1762
|
+
var existingData = clonedSelectedData[eachAttribute.id];
|
|
1763
|
+
var existingBackgroundImage = existingData &&
|
|
1764
|
+
!Array.isArray(existingData) &&
|
|
1765
|
+
existingData.backgroundImage
|
|
1766
|
+
? existingData.backgroundImage
|
|
1767
|
+
: null;
|
|
1768
|
+
if (imageFile) {
|
|
1769
|
+
// New file selected or reselected - store it normally (removes _unselected flag)
|
|
1770
|
+
updateMethod.handleOnChangeSelect(eachAttribute.id, __assign(__assign({}, currentCanvasData), { backgroundImage: {
|
|
1771
|
+
fileName: imageFile.name,
|
|
1772
|
+
file: imageFile,
|
|
1773
|
+
} }));
|
|
1774
|
+
}
|
|
1775
|
+
else {
|
|
1776
|
+
// imageFile is null - this happens when:
|
|
1777
|
+
// 1. User unselects image (clicks image in grid to toggle) - should preserve File
|
|
1778
|
+
// 2. User clicks "Clear All" - should clear File
|
|
1779
|
+
//
|
|
1780
|
+
// We can't distinguish these cases from here, so we preserve the File with flags
|
|
1781
|
+
// The cleanup in handleSubmitObjectDataType will clear it if still unselected/cleared
|
|
1782
|
+
if (existingBackgroundImage && existingBackgroundImage.file) {
|
|
1783
|
+
updateMethod.handleOnChangeSelect(eachAttribute.id, __assign(__assign({}, currentCanvasData), { backgroundImage: {
|
|
1784
|
+
fileName: existingBackgroundImage.fileName,
|
|
1785
|
+
file: existingBackgroundImage.file,
|
|
1786
|
+
_unselected: true, // Flag to indicate it was unselected
|
|
1787
|
+
_cleared: true, // Flag to indicate it was cleared (via Clear All or unselect)
|
|
1788
|
+
} }));
|
|
1789
|
+
}
|
|
1790
|
+
else {
|
|
1791
|
+
// No existing file to preserve
|
|
1792
|
+
updateMethod.handleOnChangeSelect(eachAttribute.id, __assign(__assign({}, currentCanvasData), { backgroundImage: null }));
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
// If enableImageUpload is false, background image is not tracked
|
|
1559
1797
|
} }));
|
|
1560
1798
|
break;
|
|
1561
1799
|
case "ganttchart":
|
|
1562
|
-
inputList[groupId].push(react_1.default.createElement(ganttChart_1.GanttChart, { id: eachAttribute.id, title: label, label: label, labelExtra: labelExtra, infoElement: (cellInput === null || cellInput === void 0 ? void 0 : cellInput.active) ? undefined : infoElement, tasks: (
|
|
1800
|
+
inputList[groupId].push(react_1.default.createElement(ganttChart_1.GanttChart, { id: eachAttribute.id, title: label, label: label, labelExtra: labelExtra, infoElement: (cellInput === null || cellInput === void 0 ? void 0 : cellInput.active) ? undefined : infoElement, tasks: (_36 = clonedSelectedData[eachAttribute.id]) !== null && _36 !== void 0 ? _36 : [], onTaskChange: function (tasks) {
|
|
1563
1801
|
updateMethod.handleOnChangeSelect(eachAttribute.id, tasks);
|
|
1564
1802
|
}, mode: "write", chartOnly: true }));
|
|
1565
1803
|
break;
|