blixify-ui-web 1.2.109 → 1.2.110
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/data/dataTemplate/index.d.ts.map +1 -1
- package/lib/components/data/dataTemplate/index.js +83 -77
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/display/newTable/index.d.ts.map +1 -1
- package/lib/components/display/newTable/index.js +30 -13
- package/lib/components/display/newTable/index.js.map +1 -1
- package/lib/components/input/datePicker/index.js +1 -1
- package/lib/components/input/datePicker/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AA4D1B,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAqCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ff,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AA4D1B,eAAO,MAAM,YAAY,mFA4uZvB,CAAC"}
|
|
@@ -317,6 +317,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
317
317
|
var _93 = (0, react_1.useState)(""), lastCursor = _93[0], setLastCursor = _93[1];
|
|
318
318
|
var _94 = (0, react_1.useState)([]), tableData = _94[0], setTableData = _94[1];
|
|
319
319
|
var _95 = (0, react_1.useState)([]), spaceTableData = _95[0], setSpaceTableData = _95[1];
|
|
320
|
+
// INFO: a save resolves after later renders, so it reads the table from here —
|
|
321
|
+
// the state it closed over can predate an earlier save on the same row
|
|
322
|
+
var tableDataRef = (0, react_1.useRef)([]);
|
|
323
|
+
var spaceTableDataRef = (0, react_1.useRef)([]);
|
|
324
|
+
tableDataRef.current = tableData;
|
|
325
|
+
spaceTableDataRef.current = spaceTableData;
|
|
320
326
|
var _96 = (0, react_1.useState)(0), size = _96[0], setSize = _96[1];
|
|
321
327
|
var _97 = (0, react_1.useState)((_k = (_h = persistedState === null || persistedState === void 0 ? void 0 : persistedState.pageIndex) !== null && _h !== void 0 ? _h : (_j = props.organise) === null || _j === void 0 ? void 0 : _j.pageIndex) !== null && _k !== void 0 ? _k : 0), pageIndex = _97[0], setPageIndex = _97[1];
|
|
322
328
|
var _98 = (0, react_1.useState)([]), selectedIds = _98[0], setSelectedIds = _98[1];
|
|
@@ -2249,6 +2255,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2249
2255
|
};
|
|
2250
2256
|
var handleSetListData = function (newTableData, newSpaceTableData) {
|
|
2251
2257
|
var _a, _b, _c, _d, _e;
|
|
2258
|
+
tableDataRef.current = newTableData;
|
|
2259
|
+
spaceTableDataRef.current = newSpaceTableData;
|
|
2252
2260
|
setTableData(newTableData);
|
|
2253
2261
|
setSpaceTableData(newSpaceTableData);
|
|
2254
2262
|
var kanbanBooleanColumns = props.model
|
|
@@ -2286,8 +2294,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2286
2294
|
_l.label = 1;
|
|
2287
2295
|
case 1:
|
|
2288
2296
|
_l.trys.push([1, 7, , 8]);
|
|
2289
|
-
clonedTableData = __spreadArray([],
|
|
2290
|
-
clonedSpaceTableData = __spreadArray([],
|
|
2297
|
+
clonedTableData = __spreadArray([], tableDataRef.current, true);
|
|
2298
|
+
clonedSpaceTableData = __spreadArray([], spaceTableDataRef.current, true);
|
|
2291
2299
|
if (!(responseData === null || responseData === void 0 ? void 0 : responseData.data)) return [3 /*break*/, 6];
|
|
2292
2300
|
if (!((_a = props.bareSettings) === null || _a === void 0 ? void 0 : _a.bareOffline)) return [3 /*break*/, 3];
|
|
2293
2301
|
dummyPrettierDataList_1 = [];
|
|
@@ -4336,17 +4344,17 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4336
4344
|
});
|
|
4337
4345
|
}); };
|
|
4338
4346
|
var handleSubmitData = function (type, rowId, columnId, data, offlineId, isOfflineUpdate, isDraft) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4339
|
-
var selectedId, id, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_3, err_20, isExistingDoc, newRecordData_1, changedAttributeIds, baseDraftValue, hasBaseDraftChange, offlineDataResp, clonedForOffline, tempData, selectedIndex_4, offlineData, err_21, dataToSubmit_2, changedAttributeIds, baseDraftValue, hasBaseDraftChange, operationType,
|
|
4340
|
-
var _b, _c, _d;
|
|
4341
|
-
var
|
|
4342
|
-
return __generator(this, function (
|
|
4343
|
-
switch (
|
|
4347
|
+
var selectedId, id, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_3, err_20, isExistingDoc, newRecordData_1, changedAttributeIds, baseDraftValue, hasBaseDraftChange, offlineDataResp, clonedForOffline, tempData, selectedIndex_4, offlineData, err_21, dataToSubmit_2, changedAttributeIds, baseDraftValue, hasBaseDraftChange, operationType, currentRow, wentToServer, dataId, err_22, offlineDataResp, offlineData, clonedForOffline, tempData, selectedIndex_5, _a;
|
|
4348
|
+
var _b, _c, _d, _e;
|
|
4349
|
+
var _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
4350
|
+
return __generator(this, function (_y) {
|
|
4351
|
+
switch (_y.label) {
|
|
4344
4352
|
case 0:
|
|
4345
4353
|
selectedId = "";
|
|
4346
4354
|
id = "";
|
|
4347
|
-
|
|
4355
|
+
_y.label = 1;
|
|
4348
4356
|
case 1:
|
|
4349
|
-
|
|
4357
|
+
_y.trys.push([1, 39, , 45]);
|
|
4350
4358
|
if (type === "update")
|
|
4351
4359
|
selectedId = rowId !== null && rowId !== void 0 ? rowId : "";
|
|
4352
4360
|
else if (type === "create")
|
|
@@ -4364,7 +4372,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4364
4372
|
id = (0, uuid_1.v4)();
|
|
4365
4373
|
}
|
|
4366
4374
|
else
|
|
4367
|
-
id = (
|
|
4375
|
+
id = (_f = props.id) !== null && _f !== void 0 ? _f : "";
|
|
4368
4376
|
if (offlineId) {
|
|
4369
4377
|
selectedId = offlineId;
|
|
4370
4378
|
id = offlineId;
|
|
@@ -4376,14 +4384,14 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4376
4384
|
return [3 /*break*/, 4];
|
|
4377
4385
|
case 2: return [4 /*yield*/, handleUploadImage(id, data)];
|
|
4378
4386
|
case 3:
|
|
4379
|
-
createSelectedData_1 =
|
|
4380
|
-
|
|
4387
|
+
createSelectedData_1 = _y.sent();
|
|
4388
|
+
_y.label = 4;
|
|
4381
4389
|
case 4:
|
|
4382
4390
|
uniqueDataStructure = structure.filter(function (eachStructure) {
|
|
4383
4391
|
return eachStructure.unique;
|
|
4384
4392
|
});
|
|
4385
4393
|
uniqueColumnId = uniqueDataStructure.length > 0 ? uniqueDataStructure[0].id : undefined;
|
|
4386
|
-
if ((
|
|
4394
|
+
if ((_g = props.bareSettings) === null || _g === void 0 ? void 0 : _g.bareUpdatePrefill) {
|
|
4387
4395
|
props.bareSettings.bareUpdatePrefill(selectedData).map(function (eachField) {
|
|
4388
4396
|
var key = eachField.key, value = eachField.value;
|
|
4389
4397
|
createSelectedData_1[key] = value;
|
|
@@ -4397,13 +4405,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4397
4405
|
if (isDraft)
|
|
4398
4406
|
createSelectedData_1["baseDraft"] = true;
|
|
4399
4407
|
if (!isOffline) return [3 /*break*/, 10];
|
|
4400
|
-
|
|
4408
|
+
_y.label = 5;
|
|
4401
4409
|
case 5:
|
|
4402
|
-
|
|
4410
|
+
_y.trys.push([5, 8, , 9]);
|
|
4403
4411
|
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
4404
4412
|
case 6:
|
|
4405
|
-
offlineDataResp =
|
|
4406
|
-
offlineData = (
|
|
4413
|
+
offlineDataResp = _y.sent();
|
|
4414
|
+
offlineData = (_h = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _h !== void 0 ? _h : [];
|
|
4407
4415
|
clonedForOffline = (0, updateModule_1.handleClonedDataAttribute)(selectedData, structure, props.devSettings.server, true, showId);
|
|
4408
4416
|
tempData = (0, updateModule_1.handleParseOfflineWrite)(clonedForOffline, structure);
|
|
4409
4417
|
// INFO: Stamp the _id on the offline entry so subsequent saves can find and update it
|
|
@@ -4446,22 +4454,22 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4446
4454
|
type: props.collectionId,
|
|
4447
4455
|
})];
|
|
4448
4456
|
case 7:
|
|
4449
|
-
|
|
4457
|
+
_y.sent();
|
|
4450
4458
|
res = true;
|
|
4451
4459
|
return [3 /*break*/, 9];
|
|
4452
4460
|
case 8:
|
|
4453
|
-
err_20 =
|
|
4461
|
+
err_20 = _y.sent();
|
|
4454
4462
|
return [3 /*break*/, 9];
|
|
4455
4463
|
case 9: return [3 /*break*/, 16];
|
|
4456
4464
|
case 10:
|
|
4457
4465
|
if (!((idField && selectedData[idField]) ||
|
|
4458
|
-
((
|
|
4459
|
-
isExistingDoc = ((
|
|
4466
|
+
((_j = props.bareSettings) === null || _j === void 0 ? void 0 : _j.bareUpsertPartialUpdate))) return [3 /*break*/, 12];
|
|
4467
|
+
isExistingDoc = ((_k = props.bareSettings) === null || _k === void 0 ? void 0 : _k.bareUpsertPartialUpdate) &&
|
|
4460
4468
|
loadedSelectedData.current != null;
|
|
4461
4469
|
if (isExistingDoc) {
|
|
4462
4470
|
changedAttributeIds = (0, updateModule_1.compareUpdatedFields)(loadedSelectedData.current, createSelectedData_1).changedAttributeIds;
|
|
4463
4471
|
baseDraftValue = isDraft ? true : false;
|
|
4464
|
-
hasBaseDraftChange = ((
|
|
4472
|
+
hasBaseDraftChange = ((_m = (_l = loadedSelectedData.current) === null || _l === void 0 ? void 0 : _l["baseDraft"]) !== null && _m !== void 0 ? _m : false) !==
|
|
4465
4473
|
baseDraftValue;
|
|
4466
4474
|
// INFO: if nothing changed (including baseDraft), skip the write
|
|
4467
4475
|
if (changedAttributeIds.length === 0 && !hasBaseDraftChange)
|
|
@@ -4512,7 +4520,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4512
4520
|
upsert: true,
|
|
4513
4521
|
})];
|
|
4514
4522
|
case 11:
|
|
4515
|
-
res =
|
|
4523
|
+
res = _y.sent();
|
|
4516
4524
|
return [3 /*break*/, 16];
|
|
4517
4525
|
case 12:
|
|
4518
4526
|
// INFO: stepper create guard — if a create is already in-flight, queue this
|
|
@@ -4532,7 +4540,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4532
4540
|
})];
|
|
4533
4541
|
case 13:
|
|
4534
4542
|
//INFO: [CREATE] Create new data
|
|
4535
|
-
res =
|
|
4543
|
+
res = _y.sent();
|
|
4536
4544
|
if (!(selectedId === "new")) return [3 /*break*/, 16];
|
|
4537
4545
|
isCreatingRef.current = false;
|
|
4538
4546
|
if (!pendingDraftSaveRef.current) return [3 /*break*/, 15];
|
|
@@ -4544,23 +4552,23 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4544
4552
|
})];
|
|
4545
4553
|
case 14:
|
|
4546
4554
|
// INFO: replay as update — inflightIdRef.current holds the real _id
|
|
4547
|
-
|
|
4548
|
-
|
|
4555
|
+
_y.sent();
|
|
4556
|
+
_y.label = 15;
|
|
4549
4557
|
case 15:
|
|
4550
4558
|
inflightIdRef.current = "";
|
|
4551
|
-
|
|
4559
|
+
_y.label = 16;
|
|
4552
4560
|
case 16: return [3 /*break*/, 25];
|
|
4553
4561
|
case 17:
|
|
4554
4562
|
if (!selectedId) return [3 /*break*/, 25];
|
|
4555
4563
|
if (!(isOffline &&
|
|
4556
4564
|
!(isOfflineNetworkListener && !isNetworkOffline) &&
|
|
4557
4565
|
!offlineId)) return [3 /*break*/, 23];
|
|
4558
|
-
|
|
4566
|
+
_y.label = 18;
|
|
4559
4567
|
case 18:
|
|
4560
|
-
|
|
4568
|
+
_y.trys.push([18, 21, , 22]);
|
|
4561
4569
|
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
4562
4570
|
case 19:
|
|
4563
|
-
offlineDataResp =
|
|
4571
|
+
offlineDataResp = _y.sent();
|
|
4564
4572
|
clonedForOffline = (0, updateModule_1.handleClonedDataAttribute)(selectedData, structure, props.devSettings.server, true, showId);
|
|
4565
4573
|
tempData = (0, updateModule_1.handleParseOfflineWrite)(clonedForOffline, structure);
|
|
4566
4574
|
tempData[serverId] = selectedId;
|
|
@@ -4572,7 +4580,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4572
4580
|
tempData.syncStatus = "pending";
|
|
4573
4581
|
tempData.baseOnline = true; // INFO: existing server doc, updated offline
|
|
4574
4582
|
selectedIndex_4 = -1;
|
|
4575
|
-
offlineData = (
|
|
4583
|
+
offlineData = (_o = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _o !== void 0 ? _o : [];
|
|
4576
4584
|
offlineData.map(function (eachOfflineData, index) {
|
|
4577
4585
|
var offlineDataId = eachOfflineData[serverId];
|
|
4578
4586
|
if (selectedId === offlineDataId)
|
|
@@ -4602,11 +4610,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4602
4610
|
type: props.collectionId,
|
|
4603
4611
|
})];
|
|
4604
4612
|
case 20:
|
|
4605
|
-
|
|
4613
|
+
_y.sent();
|
|
4606
4614
|
res = true;
|
|
4607
4615
|
return [3 /*break*/, 22];
|
|
4608
4616
|
case 21:
|
|
4609
|
-
err_21 =
|
|
4617
|
+
err_21 = _y.sent();
|
|
4610
4618
|
return [3 /*break*/, 22];
|
|
4611
4619
|
case 22: return [3 /*break*/, 25];
|
|
4612
4620
|
case 23:
|
|
@@ -4615,10 +4623,10 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4615
4623
|
_b[columnId] = createSelectedData_1[columnId],
|
|
4616
4624
|
_b);
|
|
4617
4625
|
}
|
|
4618
|
-
else if ((
|
|
4619
|
-
changedAttributeIds = (0, updateModule_1.compareUpdatedFields)((
|
|
4626
|
+
else if ((_p = props.bareSettings) === null || _p === void 0 ? void 0 : _p.bareUpsertPartialUpdate) {
|
|
4627
|
+
changedAttributeIds = (0, updateModule_1.compareUpdatedFields)((_q = loadedSelectedData.current) !== null && _q !== void 0 ? _q : {}, createSelectedData_1).changedAttributeIds;
|
|
4620
4628
|
baseDraftValue = isDraft ? true : false;
|
|
4621
|
-
hasBaseDraftChange = ((
|
|
4629
|
+
hasBaseDraftChange = ((_s = (_r = loadedSelectedData.current) === null || _r === void 0 ? void 0 : _r["baseDraft"]) !== null && _s !== void 0 ? _s : false) !==
|
|
4622
4630
|
baseDraftValue;
|
|
4623
4631
|
// INFO: if nothing changed (including baseDraft), skip the write entirely
|
|
4624
4632
|
if (changedAttributeIds.length === 0 && !hasBaseDraftChange)
|
|
@@ -4687,58 +4695,56 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4687
4695
|
// doesn't exist yet (covers deterministicId passed directly as props.id).
|
|
4688
4696
|
// Also applies to offline upload path so the doc is created if it was
|
|
4689
4697
|
// deleted between the existence check and the write call.
|
|
4690
|
-
upsert: ((
|
|
4698
|
+
upsert: ((_t = props.bareSettings) === null || _t === void 0 ? void 0 : _t.bareUpsertPartialUpdate) && !isOfflineUpdate
|
|
4691
4699
|
? true
|
|
4692
4700
|
: undefined,
|
|
4693
4701
|
})];
|
|
4694
4702
|
case 24:
|
|
4695
|
-
res =
|
|
4696
|
-
|
|
4703
|
+
res = _y.sent();
|
|
4704
|
+
_y.label = 25;
|
|
4697
4705
|
case 25:
|
|
4698
4706
|
if (!(type === "update" || type === "create")) return [3 /*break*/, 33];
|
|
4699
4707
|
if (!res) return [3 /*break*/, 32];
|
|
4700
4708
|
if (!(type === "update")) return [3 /*break*/, 28];
|
|
4701
4709
|
if (!columnId) return [3 /*break*/, 27];
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
});
|
|
4710
|
-
return [4 /*yield*/, handleGetListData({ data: tableData[selectedIndex_5] }, "update", rowId)];
|
|
4710
|
+
currentRow = tableDataRef.current.find(function (eachData) { return eachData.id === rowId || eachData._id === rowId; });
|
|
4711
|
+
if (!currentRow) return [3 /*break*/, 27];
|
|
4712
|
+
return [4 /*yield*/, handleGetListData({
|
|
4713
|
+
data: [
|
|
4714
|
+
__assign(__assign({}, currentRow), (_c = {}, _c[columnId] = createSelectedData_1[columnId], _c)),
|
|
4715
|
+
],
|
|
4716
|
+
}, "update", rowId)];
|
|
4711
4717
|
case 26:
|
|
4712
|
-
|
|
4713
|
-
|
|
4718
|
+
_y.sent();
|
|
4719
|
+
_y.label = 27;
|
|
4714
4720
|
case 27: return [3 /*break*/, 30];
|
|
4715
4721
|
case 28: return [4 /*yield*/, handleGetListData({ data: [createSelectedData_1] }, "create")];
|
|
4716
4722
|
case 29:
|
|
4717
|
-
|
|
4718
|
-
|
|
4723
|
+
_y.sent();
|
|
4724
|
+
_y.label = 30;
|
|
4719
4725
|
case 30:
|
|
4720
|
-
if (!((
|
|
4721
|
-
return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((
|
|
4726
|
+
if (!((_u = props.bareSettings) === null || _u === void 0 ? void 0 : _u.bareUpdateHandlePostComplete)) return [3 /*break*/, 32];
|
|
4727
|
+
return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((_d = {}, _d[serverId] = id, _d), createSelectedData_1))];
|
|
4722
4728
|
case 31:
|
|
4723
|
-
|
|
4724
|
-
|
|
4729
|
+
_y.sent();
|
|
4730
|
+
_y.label = 32;
|
|
4725
4731
|
case 32: return [3 /*break*/, 38];
|
|
4726
4732
|
case 33:
|
|
4727
4733
|
createSelectedData_1[serverId] = id;
|
|
4728
4734
|
if (!!isOffline) return [3 /*break*/, 35];
|
|
4729
4735
|
return [4 /*yield*/, handleGetListData({ data: [createSelectedData_1] }, selectedId === "new" ? "create" : "update", id)];
|
|
4730
4736
|
case 34:
|
|
4731
|
-
|
|
4732
|
-
|
|
4737
|
+
_y.sent();
|
|
4738
|
+
_y.label = 35;
|
|
4733
4739
|
case 35:
|
|
4734
4740
|
wentToServer = res &&
|
|
4735
4741
|
!offlineId &&
|
|
4736
4742
|
(!isOffline || (isOfflineNetworkListener && !isNetworkOffline));
|
|
4737
|
-
if (!(wentToServer && ((
|
|
4738
|
-
return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((
|
|
4743
|
+
if (!(wentToServer && ((_v = props.bareSettings) === null || _v === void 0 ? void 0 : _v.bareUpdateHandlePostComplete))) return [3 /*break*/, 37];
|
|
4744
|
+
return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((_e = {}, _e[serverId] = id, _e), createSelectedData_1))];
|
|
4739
4745
|
case 36:
|
|
4740
|
-
|
|
4741
|
-
|
|
4746
|
+
_y.sent();
|
|
4747
|
+
_y.label = 37;
|
|
4742
4748
|
case 37:
|
|
4743
4749
|
// INFO: a draft save announces itself (or stays silent on a step
|
|
4744
4750
|
// change) further up — this toast is for a real update only
|
|
@@ -4753,12 +4759,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4753
4759
|
: "Data sucessfully updated",
|
|
4754
4760
|
});
|
|
4755
4761
|
}
|
|
4756
|
-
|
|
4762
|
+
_y.label = 38;
|
|
4757
4763
|
case 38:
|
|
4758
4764
|
dataId = res ? id : "";
|
|
4759
4765
|
return [2 /*return*/, dataId];
|
|
4760
4766
|
case 39:
|
|
4761
|
-
err_22 =
|
|
4767
|
+
err_22 = _y.sent();
|
|
4762
4768
|
console.log("error", err_22);
|
|
4763
4769
|
// INFO: clear in-flight guard on failure so the next save retries as a create
|
|
4764
4770
|
if (isCreatingRef.current) {
|
|
@@ -4766,18 +4772,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4766
4772
|
pendingDraftSaveRef.current = false;
|
|
4767
4773
|
inflightIdRef.current = "";
|
|
4768
4774
|
}
|
|
4769
|
-
if (!(((
|
|
4775
|
+
if (!(((_w = props.bareSettings) === null || _w === void 0 ? void 0 : _w.bareOffline) &&
|
|
4770
4776
|
id &&
|
|
4771
4777
|
!offlineId &&
|
|
4772
4778
|
!isOfflineUpdate &&
|
|
4773
4779
|
!err_22.response)) return [3 /*break*/, 44];
|
|
4774
|
-
|
|
4780
|
+
_y.label = 40;
|
|
4775
4781
|
case 40:
|
|
4776
|
-
|
|
4782
|
+
_y.trys.push([40, 43, , 44]);
|
|
4777
4783
|
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
4778
4784
|
case 41:
|
|
4779
|
-
offlineDataResp =
|
|
4780
|
-
offlineData = (
|
|
4785
|
+
offlineDataResp = _y.sent();
|
|
4786
|
+
offlineData = (_x = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _x !== void 0 ? _x : [];
|
|
4781
4787
|
clonedForOffline = (0, updateModule_1.handleClonedDataAttribute)(selectedData, structure, props.devSettings.server, true, showId);
|
|
4782
4788
|
tempData = (0, updateModule_1.handleParseOfflineWrite)(clonedForOffline, structure);
|
|
4783
4789
|
if (!tempData[serverId])
|
|
@@ -4793,18 +4799,18 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4793
4799
|
? JSON.parse(JSON.stringify(loadedSelectedData.current))
|
|
4794
4800
|
: null;
|
|
4795
4801
|
}
|
|
4796
|
-
|
|
4802
|
+
selectedIndex_5 = -1;
|
|
4797
4803
|
offlineData.forEach(function (d, i) {
|
|
4798
4804
|
if (d[serverId] === id)
|
|
4799
|
-
|
|
4805
|
+
selectedIndex_5 = i;
|
|
4800
4806
|
});
|
|
4801
|
-
if (
|
|
4807
|
+
if (selectedIndex_5 >= 0) {
|
|
4802
4808
|
if (!tempData.__offlineBaseline &&
|
|
4803
|
-
offlineData[
|
|
4809
|
+
offlineData[selectedIndex_5].__offlineBaseline) {
|
|
4804
4810
|
tempData.__offlineBaseline =
|
|
4805
|
-
offlineData[
|
|
4811
|
+
offlineData[selectedIndex_5].__offlineBaseline;
|
|
4806
4812
|
}
|
|
4807
|
-
offlineData[
|
|
4813
|
+
offlineData[selectedIndex_5] = tempData;
|
|
4808
4814
|
}
|
|
4809
4815
|
else {
|
|
4810
4816
|
offlineData.push(tempData);
|
|
@@ -4814,7 +4820,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4814
4820
|
type: props.collectionId,
|
|
4815
4821
|
})];
|
|
4816
4822
|
case 42:
|
|
4817
|
-
|
|
4823
|
+
_y.sent();
|
|
4818
4824
|
setNotification({
|
|
4819
4825
|
type: false,
|
|
4820
4826
|
title: selectedId === "new"
|
|
@@ -4826,7 +4832,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
4826
4832
|
// INFO: return id so handleSubmit can navigate as if the save succeeded
|
|
4827
4833
|
return [2 /*return*/, id];
|
|
4828
4834
|
case 43:
|
|
4829
|
-
_a =
|
|
4835
|
+
_a = _y.sent();
|
|
4830
4836
|
return [3 /*break*/, 44];
|
|
4831
4837
|
case 44:
|
|
4832
4838
|
if (err_22.response) {
|