@fileverse-dev/fortune-core 1.3.10-yjs-2 → 1.3.10-yjs-3
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/es/modules/cell.js +12 -12
- package/es/modules/rowcol.js +5 -8
- package/lib/modules/cell.js +12 -12
- package/lib/modules/rowcol.js +5 -8
- package/package.json +1 -1
package/es/modules/cell.js
CHANGED
|
@@ -110,13 +110,12 @@ export function getCellValue(r, c, data, attr) {
|
|
|
110
110
|
return retv;
|
|
111
111
|
}
|
|
112
112
|
export function setCellValue(ctx, r, c, d, v) {
|
|
113
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
113
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
114
114
|
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
115
115
|
if (_.isNil(d)) {
|
|
116
116
|
d = getFlowdata(ctx);
|
|
117
117
|
}
|
|
118
118
|
if (!d) return;
|
|
119
|
-
var oldValue = _.cloneDeep(d[r][c]);
|
|
120
119
|
var cell = d[r][c];
|
|
121
120
|
var vupdate;
|
|
122
121
|
if (_.isPlainObject(v)) {
|
|
@@ -164,9 +163,6 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
164
163
|
cell = null;
|
|
165
164
|
}
|
|
166
165
|
d[r][c] = cell;
|
|
167
|
-
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.afterUpdateCell) {
|
|
168
|
-
ctx.hooks.afterUpdateCell(r, c, oldValue, (_b = d[r][c]) !== null && _b !== void 0 ? _b : null);
|
|
169
|
-
}
|
|
170
166
|
return;
|
|
171
167
|
}
|
|
172
168
|
if (isRealNull(cell) || (_.isString(cell) || _.isNumber(cell)) && cell === v) {
|
|
@@ -189,21 +185,21 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
189
185
|
t: "s"
|
|
190
186
|
};
|
|
191
187
|
cell.v = vupdateStr;
|
|
192
|
-
} else if (vupdateStr.toUpperCase() === "TRUE" && (_.isNil((
|
|
188
|
+
} else if (vupdateStr.toUpperCase() === "TRUE" && (_.isNil((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) || ((_b = cell.ct) === null || _b === void 0 ? void 0 : _b.fa) !== "@")) {
|
|
193
189
|
cell.m = "TRUE";
|
|
194
190
|
cell.ct = {
|
|
195
191
|
fa: "General",
|
|
196
192
|
t: "b"
|
|
197
193
|
};
|
|
198
194
|
cell.v = true;
|
|
199
|
-
} else if (vupdateStr.toUpperCase() === "FALSE" && (_.isNil((
|
|
195
|
+
} else if (vupdateStr.toUpperCase() === "FALSE" && (_.isNil((_c = cell.ct) === null || _c === void 0 ? void 0 : _c.fa) || ((_d = cell.ct) === null || _d === void 0 ? void 0 : _d.fa) !== "@")) {
|
|
200
196
|
cell.m = "FALSE";
|
|
201
197
|
cell.ct = {
|
|
202
198
|
fa: "General",
|
|
203
199
|
t: "b"
|
|
204
200
|
};
|
|
205
201
|
cell.v = false;
|
|
206
|
-
} else if (vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length - 1)) && (_.isNil((
|
|
202
|
+
} else if (vupdateStr.substr(-1) === "%" && isRealNum(vupdateStr.substring(0, vupdateStr.length - 1)) && (_.isNil((_e = cell.ct) === null || _e === void 0 ? void 0 : _e.fa) || ((_f = cell.ct) === null || _f === void 0 ? void 0 : _f.fa) !== "@")) {
|
|
207
203
|
cell.ct = {
|
|
208
204
|
fa: "0%",
|
|
209
205
|
t: "n"
|
|
@@ -233,7 +229,7 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
233
229
|
var isDigit = /^\d+$/.test(vupdate);
|
|
234
230
|
if (isDigit) {
|
|
235
231
|
var flowdata = getFlowdata(ctx);
|
|
236
|
-
var args = (
|
|
232
|
+
var args = (_g = getContentInParentheses(cell === null || cell === void 0 ? void 0 : cell.f)) === null || _g === void 0 ? void 0 : _g.split(",");
|
|
237
233
|
var cellRefs = args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
238
234
|
return arg.trim().toUpperCase();
|
|
239
235
|
});
|
|
@@ -356,9 +352,6 @@ export function setCellValue(ctx, r, c, d, v) {
|
|
|
356
352
|
}
|
|
357
353
|
}
|
|
358
354
|
d[r][c] = cell;
|
|
359
|
-
if ((_k = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _k === void 0 ? void 0 : _k.afterUpdateCell) {
|
|
360
|
-
ctx.hooks.afterUpdateCell(r, c, oldValue, (_l = d[r][c]) !== null && _l !== void 0 ? _l : null);
|
|
361
|
-
}
|
|
362
355
|
if (ctx.luckysheet_selection_range) {
|
|
363
356
|
ctx.luckysheet_selection_range = [];
|
|
364
357
|
}
|
|
@@ -866,6 +859,13 @@ export function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
866
859
|
}
|
|
867
860
|
}
|
|
868
861
|
}
|
|
862
|
+
if (ctx.hooks.afterUpdateCell) {
|
|
863
|
+
var newValue_2 = _.cloneDeep(flowdata[r][c]);
|
|
864
|
+
var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
|
|
865
|
+
setTimeout(function () {
|
|
866
|
+
afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue_1, newValue_2);
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
869
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
870
870
|
} catch (e) {
|
|
871
871
|
console.error(e);
|
package/es/modules/rowcol.js
CHANGED
|
@@ -107,10 +107,13 @@ var emitCellRangeToYdoc = function emitCellRangeToYdoc(ctx, sheetId, d, r1, r2,
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
changes.forEach(function (change) {
|
|
111
|
+
console.log("emitCellRangeToYdoc", change, __assign({}, change.value.v));
|
|
112
|
+
});
|
|
110
113
|
if (changes.length > 0) ctx.hooks.updateCellYdoc(changes);
|
|
111
114
|
};
|
|
112
115
|
export function insertRowCol(ctx, op, changeSelection) {
|
|
113
|
-
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
|
|
116
|
+
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;
|
|
114
117
|
if (changeSelection === void 0) {
|
|
115
118
|
changeSelection = true;
|
|
116
119
|
}
|
|
@@ -1085,12 +1088,9 @@ export function insertRowCol(ctx, op, changeSelection) {
|
|
|
1085
1088
|
var startC = mergeBounds ? Math.min(baseStart, mergeBounds.minC) : baseStart;
|
|
1086
1089
|
emitCellRangeToYdoc(ctx, id, d, 0, d.length - 1, startC, ((_0 = (_z = d[0]) === null || _z === void 0 ? void 0 : _z.length) !== null && _0 !== void 0 ? _0 : 1) - 1);
|
|
1087
1090
|
}
|
|
1088
|
-
if ((_1 = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _1 === void 0 ? void 0 : _1.updateAllCell) {
|
|
1089
|
-
ctx.hooks.updateAllCell(id);
|
|
1090
|
-
}
|
|
1091
1091
|
}
|
|
1092
1092
|
export function deleteRowCol(ctx, op) {
|
|
1093
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
1093
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
1094
1094
|
var type = op.type;
|
|
1095
1095
|
var start = op.start,
|
|
1096
1096
|
end = op.end,
|
|
@@ -1818,9 +1818,6 @@ export function deleteRowCol(ctx, op) {
|
|
|
1818
1818
|
var startC = mergeBounds ? Math.min(start, mergeBounds.minC) : start;
|
|
1819
1819
|
emitCellRangeToYdoc(ctx, id, d, 0, d.length - 1, startC, ((_u = (_t = d[0]) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 1) - 1);
|
|
1820
1820
|
}
|
|
1821
|
-
if ((_v = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _v === void 0 ? void 0 : _v.updateAllCell) {
|
|
1822
|
-
ctx.hooks.updateAllCell(id);
|
|
1823
|
-
}
|
|
1824
1821
|
if (file.id === ctx.currentSheetId) {
|
|
1825
1822
|
ctx.config = cfg;
|
|
1826
1823
|
} else {}
|
package/lib/modules/cell.js
CHANGED
|
@@ -143,13 +143,12 @@ function getCellValue(r, c, data, attr) {
|
|
|
143
143
|
return retv;
|
|
144
144
|
}
|
|
145
145
|
function setCellValue(ctx, r, c, d, v) {
|
|
146
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
146
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
147
147
|
if (ctx.allowEdit === false || ctx.isFlvReadOnly) return;
|
|
148
148
|
if (_lodash.default.isNil(d)) {
|
|
149
149
|
d = (0, _context.getFlowdata)(ctx);
|
|
150
150
|
}
|
|
151
151
|
if (!d) return;
|
|
152
|
-
var oldValue = _lodash.default.cloneDeep(d[r][c]);
|
|
153
152
|
var cell = d[r][c];
|
|
154
153
|
var vupdate;
|
|
155
154
|
if (_lodash.default.isPlainObject(v)) {
|
|
@@ -197,9 +196,6 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
197
196
|
cell = null;
|
|
198
197
|
}
|
|
199
198
|
d[r][c] = cell;
|
|
200
|
-
if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _a === void 0 ? void 0 : _a.afterUpdateCell) {
|
|
201
|
-
ctx.hooks.afterUpdateCell(r, c, oldValue, (_b = d[r][c]) !== null && _b !== void 0 ? _b : null);
|
|
202
|
-
}
|
|
203
199
|
return;
|
|
204
200
|
}
|
|
205
201
|
if ((0, _validation.isRealNull)(cell) || (_lodash.default.isString(cell) || _lodash.default.isNumber(cell)) && cell === v) {
|
|
@@ -222,21 +218,21 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
222
218
|
t: "s"
|
|
223
219
|
};
|
|
224
220
|
cell.v = vupdateStr;
|
|
225
|
-
} else if (vupdateStr.toUpperCase() === "TRUE" && (_lodash.default.isNil((
|
|
221
|
+
} else if (vupdateStr.toUpperCase() === "TRUE" && (_lodash.default.isNil((_a = cell.ct) === null || _a === void 0 ? void 0 : _a.fa) || ((_b = cell.ct) === null || _b === void 0 ? void 0 : _b.fa) !== "@")) {
|
|
226
222
|
cell.m = "TRUE";
|
|
227
223
|
cell.ct = {
|
|
228
224
|
fa: "General",
|
|
229
225
|
t: "b"
|
|
230
226
|
};
|
|
231
227
|
cell.v = true;
|
|
232
|
-
} else if (vupdateStr.toUpperCase() === "FALSE" && (_lodash.default.isNil((
|
|
228
|
+
} else if (vupdateStr.toUpperCase() === "FALSE" && (_lodash.default.isNil((_c = cell.ct) === null || _c === void 0 ? void 0 : _c.fa) || ((_d = cell.ct) === null || _d === void 0 ? void 0 : _d.fa) !== "@")) {
|
|
233
229
|
cell.m = "FALSE";
|
|
234
230
|
cell.ct = {
|
|
235
231
|
fa: "General",
|
|
236
232
|
t: "b"
|
|
237
233
|
};
|
|
238
234
|
cell.v = false;
|
|
239
|
-
} else if (vupdateStr.substr(-1) === "%" && (0, _validation.isRealNum)(vupdateStr.substring(0, vupdateStr.length - 1)) && (_lodash.default.isNil((
|
|
235
|
+
} else if (vupdateStr.substr(-1) === "%" && (0, _validation.isRealNum)(vupdateStr.substring(0, vupdateStr.length - 1)) && (_lodash.default.isNil((_e = cell.ct) === null || _e === void 0 ? void 0 : _e.fa) || ((_f = cell.ct) === null || _f === void 0 ? void 0 : _f.fa) !== "@")) {
|
|
240
236
|
cell.ct = {
|
|
241
237
|
fa: "0%",
|
|
242
238
|
t: "n"
|
|
@@ -266,7 +262,7 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
266
262
|
var isDigit = /^\d+$/.test(vupdate);
|
|
267
263
|
if (isDigit) {
|
|
268
264
|
var flowdata = (0, _context.getFlowdata)(ctx);
|
|
269
|
-
var args = (
|
|
265
|
+
var args = (_g = (0, _utils.getContentInParentheses)(cell === null || cell === void 0 ? void 0 : cell.f)) === null || _g === void 0 ? void 0 : _g.split(",");
|
|
270
266
|
var cellRefs = args === null || args === void 0 ? void 0 : args.map(function (arg) {
|
|
271
267
|
return arg.trim().toUpperCase();
|
|
272
268
|
});
|
|
@@ -389,9 +385,6 @@ function setCellValue(ctx, r, c, d, v) {
|
|
|
389
385
|
}
|
|
390
386
|
}
|
|
391
387
|
d[r][c] = cell;
|
|
392
|
-
if ((_k = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _k === void 0 ? void 0 : _k.afterUpdateCell) {
|
|
393
|
-
ctx.hooks.afterUpdateCell(r, c, oldValue, (_l = d[r][c]) !== null && _l !== void 0 ? _l : null);
|
|
394
|
-
}
|
|
395
388
|
if (ctx.luckysheet_selection_range) {
|
|
396
389
|
ctx.luckysheet_selection_range = [];
|
|
397
390
|
}
|
|
@@ -899,6 +892,13 @@ function updateCell(ctx, r, c, $input, value, canvas) {
|
|
|
899
892
|
}
|
|
900
893
|
}
|
|
901
894
|
}
|
|
895
|
+
if (ctx.hooks.afterUpdateCell) {
|
|
896
|
+
var newValue_2 = _lodash.default.cloneDeep(flowdata[r][c]);
|
|
897
|
+
var afterUpdateCell_1 = ctx.hooks.afterUpdateCell;
|
|
898
|
+
setTimeout(function () {
|
|
899
|
+
afterUpdateCell_1 === null || afterUpdateCell_1 === void 0 ? void 0 : afterUpdateCell_1(r, c, oldValue_1, newValue_2);
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
902
|
ctx.formulaCache.execFunctionGlobalData = null;
|
|
903
903
|
} catch (e) {
|
|
904
904
|
console.error(e);
|
package/lib/modules/rowcol.js
CHANGED
|
@@ -120,10 +120,13 @@ var emitCellRangeToYdoc = function emitCellRangeToYdoc(ctx, sheetId, d, r1, r2,
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
+
changes.forEach(function (change) {
|
|
124
|
+
console.log("emitCellRangeToYdoc", change, __assign({}, change.value.v));
|
|
125
|
+
});
|
|
123
126
|
if (changes.length > 0) ctx.hooks.updateCellYdoc(changes);
|
|
124
127
|
};
|
|
125
128
|
function insertRowCol(ctx, op, changeSelection) {
|
|
126
|
-
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
|
|
129
|
+
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;
|
|
127
130
|
if (changeSelection === void 0) {
|
|
128
131
|
changeSelection = true;
|
|
129
132
|
}
|
|
@@ -1098,12 +1101,9 @@ function insertRowCol(ctx, op, changeSelection) {
|
|
|
1098
1101
|
var startC = mergeBounds ? Math.min(baseStart, mergeBounds.minC) : baseStart;
|
|
1099
1102
|
emitCellRangeToYdoc(ctx, id, d, 0, d.length - 1, startC, ((_0 = (_z = d[0]) === null || _z === void 0 ? void 0 : _z.length) !== null && _0 !== void 0 ? _0 : 1) - 1);
|
|
1100
1103
|
}
|
|
1101
|
-
if ((_1 = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _1 === void 0 ? void 0 : _1.updateAllCell) {
|
|
1102
|
-
ctx.hooks.updateAllCell(id);
|
|
1103
|
-
}
|
|
1104
1104
|
}
|
|
1105
1105
|
function deleteRowCol(ctx, op) {
|
|
1106
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
1106
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
1107
1107
|
var type = op.type;
|
|
1108
1108
|
var start = op.start,
|
|
1109
1109
|
end = op.end,
|
|
@@ -1831,9 +1831,6 @@ function deleteRowCol(ctx, op) {
|
|
|
1831
1831
|
var startC = mergeBounds ? Math.min(start, mergeBounds.minC) : start;
|
|
1832
1832
|
emitCellRangeToYdoc(ctx, id, d, 0, d.length - 1, startC, ((_u = (_t = d[0]) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 1) - 1);
|
|
1833
1833
|
}
|
|
1834
|
-
if ((_v = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _v === void 0 ? void 0 : _v.updateAllCell) {
|
|
1835
|
-
ctx.hooks.updateAllCell(id);
|
|
1836
|
-
}
|
|
1837
1834
|
if (file.id === ctx.currentSheetId) {
|
|
1838
1835
|
ctx.config = cfg;
|
|
1839
1836
|
} else {}
|