blixify-ui-web 1.1.19 → 1.1.20
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 +54 -51
- package/lib/components/data/dataTemplate/index.js.map +1 -1
- package/lib/components/data/dataTemplate/model.d.ts +2 -1
- package/lib/components/data/dataTemplate/model.d.ts.map +1 -1
- package/lib/components/data/updateModule.d.ts.map +1 -1
- package/lib/components/data/updateModule.js +9 -2
- package/lib/components/data/updateModule.js.map +1 -1
- package/lib/components/input/select/index.d.ts +3 -0
- package/lib/components/input/select/index.d.ts.map +1 -1
- package/lib/components/input/select/index.js +92 -7
- package/lib/components/input/select/index.js.map +1 -1
- package/lib/tail.css +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":"AAiCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ef,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAoB1B,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/data/dataTemplate/index.tsx"],"names":[],"mappings":"AAiCA,OAAO,KASN,MAAM,OAAO,CAAC;AA0Ef,OAAO,EACL,iBAAiB,EAKlB,MAAM,kBAAkB,CAAC;AAoB1B,eAAO,MAAM,YAAY,mFA4qSvB,CAAC"}
|
|
@@ -2999,13 +2999,13 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
2999
2999
|
});
|
|
3000
3000
|
}); };
|
|
3001
3001
|
var handleSubmitData = function (type, rowId, columnId, data, offlineId, isOfflineUpdate, isDraft) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3002
|
-
var selectedId_2, id, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, tempData, err_19, isExistingDoc, newRecordData_1, changedAttributeIds, offlineDataResp, tempData, selectedIndex_3, offlineData, err_20, dataToSubmit_2, changedAttributeIds, operationType, selectedIndex_4, dataId, err_21;
|
|
3002
|
+
var selectedId_2, id, createSelectedData_1, uniqueDataStructure, uniqueColumnId, res, offlineDataResp, offlineData, tempData, err_19, isExistingDoc, newRecordData_1, changedAttributeIds, baseDraftValue, hasBaseDraftChange, offlineDataResp, tempData, selectedIndex_3, offlineData, err_20, dataToSubmit_2, changedAttributeIds, baseDraftValue, hasBaseDraftChange, operationType, selectedIndex_4, dataId, err_21;
|
|
3003
3003
|
var _a, _b;
|
|
3004
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
3005
|
-
return __generator(this, function (
|
|
3006
|
-
switch (
|
|
3004
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
3005
|
+
return __generator(this, function (_t) {
|
|
3006
|
+
switch (_t.label) {
|
|
3007
3007
|
case 0:
|
|
3008
|
-
|
|
3008
|
+
_t.trys.push([0, 35, , 36]);
|
|
3009
3009
|
selectedId_2 = "";
|
|
3010
3010
|
if (type === "update")
|
|
3011
3011
|
selectedId_2 = rowId !== null && rowId !== void 0 ? rowId : "";
|
|
@@ -3035,8 +3035,8 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3035
3035
|
return [3 /*break*/, 3];
|
|
3036
3036
|
case 1: return [4 /*yield*/, handleUploadImage(id, data)];
|
|
3037
3037
|
case 2:
|
|
3038
|
-
createSelectedData_1 =
|
|
3039
|
-
|
|
3038
|
+
createSelectedData_1 = _t.sent();
|
|
3039
|
+
_t.label = 3;
|
|
3040
3040
|
case 3:
|
|
3041
3041
|
uniqueDataStructure = structure.filter(function (eachStructure) {
|
|
3042
3042
|
return eachStructure.unique;
|
|
@@ -3056,12 +3056,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3056
3056
|
if (isDraft)
|
|
3057
3057
|
createSelectedData_1["baseDraft"] = true;
|
|
3058
3058
|
if (!isOffline) return [3 /*break*/, 9];
|
|
3059
|
-
|
|
3059
|
+
_t.label = 4;
|
|
3060
3060
|
case 4:
|
|
3061
|
-
|
|
3061
|
+
_t.trys.push([4, 7, , 8]);
|
|
3062
3062
|
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
3063
3063
|
case 5:
|
|
3064
|
-
offlineDataResp =
|
|
3064
|
+
offlineDataResp = _t.sent();
|
|
3065
3065
|
offlineData = (_e = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _e !== void 0 ? _e : [];
|
|
3066
3066
|
tempData = (0, updateModule_1.handleParseOfflineWrite)(selectedData, structure);
|
|
3067
3067
|
offlineData.push(tempData);
|
|
@@ -3070,11 +3070,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3070
3070
|
type: props.collectionId,
|
|
3071
3071
|
})];
|
|
3072
3072
|
case 6:
|
|
3073
|
-
|
|
3073
|
+
_t.sent();
|
|
3074
3074
|
res = true;
|
|
3075
3075
|
return [3 /*break*/, 8];
|
|
3076
3076
|
case 7:
|
|
3077
|
-
err_19 =
|
|
3077
|
+
err_19 = _t.sent();
|
|
3078
3078
|
return [3 /*break*/, 8];
|
|
3079
3079
|
case 8: return [3 /*break*/, 15];
|
|
3080
3080
|
case 9:
|
|
@@ -3084,16 +3084,20 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3084
3084
|
loadedSelectedData.current != null;
|
|
3085
3085
|
if (isExistingDoc) {
|
|
3086
3086
|
changedAttributeIds = (0, updateModule_1.compareUpdatedFields)(loadedSelectedData.current, createSelectedData_1).changedAttributeIds;
|
|
3087
|
-
|
|
3087
|
+
baseDraftValue = isDraft ? true : false;
|
|
3088
|
+
hasBaseDraftChange = ((_j = (_h = loadedSelectedData.current) === null || _h === void 0 ? void 0 : _h["baseDraft"]) !== null && _j !== void 0 ? _j : false) !==
|
|
3089
|
+
baseDraftValue;
|
|
3090
|
+
// INFO: if nothing changed (including baseDraft), skip the write
|
|
3091
|
+
if (changedAttributeIds.length === 0 && !hasBaseDraftChange)
|
|
3088
3092
|
return [2 /*return*/, id];
|
|
3089
3093
|
newRecordData_1 = {};
|
|
3090
3094
|
changedAttributeIds.forEach(function (key) {
|
|
3091
3095
|
newRecordData_1[key] = createSelectedData_1[key];
|
|
3092
3096
|
});
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
+
// INFO: always stamp baseDraft — it is not user-edited so it may
|
|
3098
|
+
// not appear in changedAttributeIds, but clearing true→false on
|
|
3099
|
+
// final save must always be sent explicitly.
|
|
3100
|
+
newRecordData_1["baseDraft"] = baseDraftValue;
|
|
3097
3101
|
}
|
|
3098
3102
|
else {
|
|
3099
3103
|
// INFO: genuinely new record — no baseline to diff against,
|
|
@@ -3106,7 +3110,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3106
3110
|
upsert: true,
|
|
3107
3111
|
})];
|
|
3108
3112
|
case 10:
|
|
3109
|
-
res =
|
|
3113
|
+
res = _t.sent();
|
|
3110
3114
|
return [3 /*break*/, 15];
|
|
3111
3115
|
case 11:
|
|
3112
3116
|
// INFO: stepper create guard — if a create is already in-flight, queue this
|
|
@@ -3126,7 +3130,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3126
3130
|
})];
|
|
3127
3131
|
case 12:
|
|
3128
3132
|
//INFO: [CREATE] Create new data
|
|
3129
|
-
res =
|
|
3133
|
+
res = _t.sent();
|
|
3130
3134
|
if (!(selectedId_2 === "new")) return [3 /*break*/, 15];
|
|
3131
3135
|
isCreatingRef.current = false;
|
|
3132
3136
|
if (!pendingDraftSaveRef.current) return [3 /*break*/, 14];
|
|
@@ -3138,25 +3142,25 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3138
3142
|
})];
|
|
3139
3143
|
case 13:
|
|
3140
3144
|
// INFO: replay as update — inflightIdRef.current holds the real _id
|
|
3141
|
-
|
|
3142
|
-
|
|
3145
|
+
_t.sent();
|
|
3146
|
+
_t.label = 14;
|
|
3143
3147
|
case 14:
|
|
3144
3148
|
inflightIdRef.current = "";
|
|
3145
|
-
|
|
3149
|
+
_t.label = 15;
|
|
3146
3150
|
case 15: return [3 /*break*/, 24];
|
|
3147
3151
|
case 16:
|
|
3148
3152
|
if (!selectedId_2) return [3 /*break*/, 24];
|
|
3149
3153
|
if (!(isOffline && !offlineId)) return [3 /*break*/, 22];
|
|
3150
|
-
|
|
3154
|
+
_t.label = 17;
|
|
3151
3155
|
case 17:
|
|
3152
|
-
|
|
3156
|
+
_t.trys.push([17, 20, , 21]);
|
|
3153
3157
|
return [4 /*yield*/, indexedDb_1.indexedDb.getValue("local", props.collectionId)];
|
|
3154
3158
|
case 18:
|
|
3155
|
-
offlineDataResp =
|
|
3159
|
+
offlineDataResp = _t.sent();
|
|
3156
3160
|
tempData = (0, updateModule_1.handleParseOfflineWrite)(selectedData, structure);
|
|
3157
3161
|
tempData[serverId] = selectedId_2;
|
|
3158
3162
|
selectedIndex_3 = -1;
|
|
3159
|
-
offlineData = (
|
|
3163
|
+
offlineData = (_k = offlineDataResp === null || offlineDataResp === void 0 ? void 0 : offlineDataResp.data) !== null && _k !== void 0 ? _k : [];
|
|
3160
3164
|
offlineData.map(function (eachOfflineData, index) {
|
|
3161
3165
|
var offlineDataId = eachOfflineData[serverId];
|
|
3162
3166
|
if (selectedId_2 === offlineDataId)
|
|
@@ -3170,11 +3174,11 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3170
3174
|
type: props.collectionId,
|
|
3171
3175
|
})];
|
|
3172
3176
|
case 19:
|
|
3173
|
-
|
|
3177
|
+
_t.sent();
|
|
3174
3178
|
res = true;
|
|
3175
3179
|
return [3 /*break*/, 21];
|
|
3176
3180
|
case 20:
|
|
3177
|
-
err_20 =
|
|
3181
|
+
err_20 = _t.sent();
|
|
3178
3182
|
return [3 /*break*/, 21];
|
|
3179
3183
|
case 21: return [3 /*break*/, 24];
|
|
3180
3184
|
case 22:
|
|
@@ -3183,20 +3187,19 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3183
3187
|
_a[columnId] = createSelectedData_1[columnId],
|
|
3184
3188
|
_a);
|
|
3185
3189
|
}
|
|
3186
|
-
else if ((
|
|
3187
|
-
changedAttributeIds = (0, updateModule_1.compareUpdatedFields)((
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3190
|
+
else if ((_l = props.bareSettings) === null || _l === void 0 ? void 0 : _l.bareUpsertPartialUpdate) {
|
|
3191
|
+
changedAttributeIds = (0, updateModule_1.compareUpdatedFields)((_m = loadedSelectedData.current) !== null && _m !== void 0 ? _m : {}, createSelectedData_1).changedAttributeIds;
|
|
3192
|
+
baseDraftValue = isDraft ? true : false;
|
|
3193
|
+
hasBaseDraftChange = ((_p = (_o = loadedSelectedData.current) === null || _o === void 0 ? void 0 : _o["baseDraft"]) !== null && _p !== void 0 ? _p : false) !==
|
|
3194
|
+
baseDraftValue;
|
|
3195
|
+
// INFO: if nothing changed (including baseDraft), skip the write entirely
|
|
3196
|
+
if (changedAttributeIds.length === 0 && !hasBaseDraftChange)
|
|
3191
3197
|
return [2 /*return*/, id];
|
|
3192
3198
|
dataToSubmit_2 = {};
|
|
3193
3199
|
changedAttributeIds.forEach(function (key) {
|
|
3194
3200
|
dataToSubmit_2[key] = createSelectedData_1[key];
|
|
3195
3201
|
});
|
|
3196
|
-
|
|
3197
|
-
dataToSubmit_2["baseDraft"] = true;
|
|
3198
|
-
else
|
|
3199
|
-
dataToSubmit_2["baseDraft"] = false; // INFO: clear draft flag on final save
|
|
3202
|
+
dataToSubmit_2["baseDraft"] = baseDraftValue;
|
|
3200
3203
|
if (offlineId)
|
|
3201
3204
|
dataToSubmit_2[serverId] = offlineId;
|
|
3202
3205
|
}
|
|
@@ -3220,15 +3223,15 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3220
3223
|
// doesn't exist yet (covers deterministicId passed directly as props.id).
|
|
3221
3224
|
// Scoped away from offline paths: offlineId uses operationType="create"
|
|
3222
3225
|
// and isOfflineUpdate is a separate flow — upsert is not meaningful there.
|
|
3223
|
-
upsert: ((
|
|
3226
|
+
upsert: ((_q = props.bareSettings) === null || _q === void 0 ? void 0 : _q.bareUpsertPartialUpdate) &&
|
|
3224
3227
|
!offlineId &&
|
|
3225
3228
|
!isOfflineUpdate
|
|
3226
3229
|
? true
|
|
3227
3230
|
: undefined,
|
|
3228
3231
|
})];
|
|
3229
3232
|
case 23:
|
|
3230
|
-
res =
|
|
3231
|
-
|
|
3233
|
+
res = _t.sent();
|
|
3234
|
+
_t.label = 24;
|
|
3232
3235
|
case 24:
|
|
3233
3236
|
if (!(type === "update" || type === "create")) return [3 /*break*/, 32];
|
|
3234
3237
|
if (!res) return [3 /*break*/, 31];
|
|
@@ -3244,25 +3247,25 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3244
3247
|
});
|
|
3245
3248
|
return [4 /*yield*/, handleGetListData({ data: tableData[selectedIndex_4] }, "update", rowId)];
|
|
3246
3249
|
case 25:
|
|
3247
|
-
|
|
3248
|
-
|
|
3250
|
+
_t.sent();
|
|
3251
|
+
_t.label = 26;
|
|
3249
3252
|
case 26: return [3 /*break*/, 29];
|
|
3250
3253
|
case 27: return [4 /*yield*/, handleGetListData({ data: [createSelectedData_1] }, "create")];
|
|
3251
3254
|
case 28:
|
|
3252
|
-
|
|
3253
|
-
|
|
3255
|
+
_t.sent();
|
|
3256
|
+
_t.label = 29;
|
|
3254
3257
|
case 29:
|
|
3255
|
-
if (!((
|
|
3258
|
+
if (!((_r = props.bareSettings) === null || _r === void 0 ? void 0 : _r.bareUpdateHandlePostComplete)) return [3 /*break*/, 31];
|
|
3256
3259
|
return [4 /*yield*/, props.bareSettings.bareUpdateHandlePostComplete(__assign((_b = {}, _b[serverId] = id, _b), createSelectedData_1))];
|
|
3257
3260
|
case 30:
|
|
3258
|
-
|
|
3259
|
-
|
|
3261
|
+
_t.sent();
|
|
3262
|
+
_t.label = 31;
|
|
3260
3263
|
case 31: return [3 /*break*/, 34];
|
|
3261
3264
|
case 32:
|
|
3262
3265
|
createSelectedData_1[serverId] = id;
|
|
3263
3266
|
return [4 /*yield*/, handleGetListData({ data: [createSelectedData_1] }, selectedId_2 === "new" ? "create" : "update", id)];
|
|
3264
3267
|
case 33:
|
|
3265
|
-
|
|
3268
|
+
_t.sent();
|
|
3266
3269
|
setNotification({
|
|
3267
3270
|
type: true,
|
|
3268
3271
|
title: props.id === "new"
|
|
@@ -3272,12 +3275,12 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3272
3275
|
? "Data sucessfully created"
|
|
3273
3276
|
: "Data sucessfully updated",
|
|
3274
3277
|
});
|
|
3275
|
-
|
|
3278
|
+
_t.label = 34;
|
|
3276
3279
|
case 34:
|
|
3277
3280
|
dataId = res ? id : "";
|
|
3278
3281
|
return [2 /*return*/, dataId];
|
|
3279
3282
|
case 35:
|
|
3280
|
-
err_21 =
|
|
3283
|
+
err_21 = _t.sent();
|
|
3281
3284
|
console.log("error", err_21);
|
|
3282
3285
|
// INFO: clear in-flight guard on failure so the next save retries as a create
|
|
3283
3286
|
if (isCreatingRef.current) {
|
|
@@ -3286,7 +3289,7 @@ exports.DataTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
3286
3289
|
inflightIdRef.current = "";
|
|
3287
3290
|
}
|
|
3288
3291
|
if (err_21.response && err_21.response.status === 400) {
|
|
3289
|
-
if (typeof ((
|
|
3292
|
+
if (typeof ((_s = err_21.response.data) === null || _s === void 0 ? void 0 : _s.err) === "string")
|
|
3290
3293
|
setNotification({
|
|
3291
3294
|
type: false,
|
|
3292
3295
|
title: "Error",
|