@fileverse-dev/fortune-core 1.2.92-yoc-2 → 1.2.92-yoc-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/toolbar.js +15 -9
- package/lib/modules/toolbar.js +15 -9
- package/package.json +1 -1
package/es/modules/toolbar.js
CHANGED
|
@@ -15,8 +15,8 @@ import { showLinkCard } from "./hyperlink";
|
|
|
15
15
|
import { cfSplitRange } from "./conditionalFormat";
|
|
16
16
|
import { clearMeasureTextCache, getCellTextInfo } from "./text";
|
|
17
17
|
export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
|
|
18
|
-
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;
|
|
19
|
-
var
|
|
18
|
+
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;
|
|
19
|
+
var _11;
|
|
20
20
|
console.log("updateFormatCell", row_st, row_ed, col_st, col_ed);
|
|
21
21
|
if (_.isNil(d) || _.isNil(attr)) {
|
|
22
22
|
return;
|
|
@@ -86,6 +86,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
86
86
|
type: "update"
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
+
if ((_x = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _x === void 0 ? void 0 : _x.updateCellYdoc) {
|
|
90
|
+
(_y = ctx.hooks) === null || _y === void 0 ? void 0 : _y.updateCellYdoc(changes);
|
|
91
|
+
}
|
|
89
92
|
}
|
|
90
93
|
} else {
|
|
91
94
|
if (attr === "ht") {
|
|
@@ -141,11 +144,11 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
141
144
|
if (value && _.isPlainObject(value)) {
|
|
142
145
|
updateInlineStringFormatOutside(value, attr, foucsStatus);
|
|
143
146
|
value[attr] = foucsStatus;
|
|
144
|
-
(
|
|
147
|
+
(_11 = ctx.luckysheetfile[sheetIndex]).config || (_11.config = {});
|
|
145
148
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
146
|
-
var cellWidth = ((
|
|
149
|
+
var cellWidth = ((_z = cfg.columnlen) === null || _z === void 0 ? void 0 : _z[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
147
150
|
if (attr === "tb" && canvas && foucsStatus === "2") {
|
|
148
|
-
var currentColWidth_1 = ((
|
|
151
|
+
var currentColWidth_1 = ((_0 = cfg.columnlen) === null || _0 === void 0 ? void 0 : _0[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
|
|
149
152
|
var lineCount_1 = 1;
|
|
150
153
|
var fontString_1 = "10px Arial";
|
|
151
154
|
if (value.fs) {
|
|
@@ -158,9 +161,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
158
161
|
lineCount_1 = getLineCount(value.m, currentColWidth_1, fontString_1);
|
|
159
162
|
var hOffset = lineCount_1 < 4 ? 1.9 : 1.7;
|
|
160
163
|
lineCount_1 = lineCount_1 * hOffset + 1;
|
|
161
|
-
} else if ((
|
|
164
|
+
} else if ((_3 = (_2 = (_1 = value === null || value === void 0 ? void 0 : value.ct) === null || _1 === void 0 ? void 0 : _1.s) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.v) {
|
|
162
165
|
lineCount_1 -= 1;
|
|
163
|
-
var line = (
|
|
166
|
+
var line = (_6 = (_5 = (_4 = value === null || value === void 0 ? void 0 : value.ct) === null || _4 === void 0 ? void 0 : _4.s) === null || _5 === void 0 ? void 0 : _5[0]) === null || _6 === void 0 ? void 0 : _6.v.split("\n");
|
|
164
167
|
line.forEach(function (item) {
|
|
165
168
|
var subLineCount = getLineCount(item, currentColWidth_1, fontString_1);
|
|
166
169
|
lineCount_1 += subLineCount;
|
|
@@ -180,7 +183,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
180
183
|
});
|
|
181
184
|
if (!textInfo) return "continue";
|
|
182
185
|
var rowHeight = _.round(textInfo.textHeightAll);
|
|
183
|
-
var currentRowHeight = ((
|
|
186
|
+
var currentRowHeight = ((_7 = cfg.rowlen) === null || _7 === void 0 ? void 0 : _7[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
184
187
|
if (!_.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
185
188
|
if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
186
189
|
_.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
@@ -195,7 +198,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
195
198
|
});
|
|
196
199
|
if (!textInfo) return "continue";
|
|
197
200
|
var newHeight = _.round(textInfo.textHeightAll);
|
|
198
|
-
var oldHeight = ((
|
|
201
|
+
var oldHeight = ((_8 = cfg.rowlen) === null || _8 === void 0 ? void 0 : _8[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
199
202
|
var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
|
|
200
203
|
if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
201
204
|
var padding = 12;
|
|
@@ -226,6 +229,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
226
229
|
_loop_1(c);
|
|
227
230
|
}
|
|
228
231
|
}
|
|
232
|
+
if ((_9 = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _9 === void 0 ? void 0 : _9.updateCellYdoc) {
|
|
233
|
+
(_10 = ctx.hooks) === null || _10 === void 0 ? void 0 : _10.updateCellYdoc(changes);
|
|
234
|
+
}
|
|
229
235
|
}
|
|
230
236
|
}
|
|
231
237
|
export function updateFormat(ctx, $input, d, attr, foucsStatus, canvas) {
|
package/lib/modules/toolbar.js
CHANGED
|
@@ -48,8 +48,8 @@ var _conditionalFormat = require("./conditionalFormat");
|
|
|
48
48
|
var _text = require("./text");
|
|
49
49
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
50
50
|
function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col_ed, canvas) {
|
|
51
|
-
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;
|
|
52
|
-
var
|
|
51
|
+
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;
|
|
52
|
+
var _11;
|
|
53
53
|
console.log("updateFormatCell", row_st, row_ed, col_st, col_ed);
|
|
54
54
|
if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
|
|
55
55
|
return;
|
|
@@ -119,6 +119,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
119
119
|
type: "update"
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
+
if ((_x = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _x === void 0 ? void 0 : _x.updateCellYdoc) {
|
|
123
|
+
(_y = ctx.hooks) === null || _y === void 0 ? void 0 : _y.updateCellYdoc(changes);
|
|
124
|
+
}
|
|
122
125
|
}
|
|
123
126
|
} else {
|
|
124
127
|
if (attr === "ht") {
|
|
@@ -174,11 +177,11 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
174
177
|
if (value && _lodash.default.isPlainObject(value)) {
|
|
175
178
|
(0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
|
|
176
179
|
value[attr] = foucsStatus;
|
|
177
|
-
(
|
|
180
|
+
(_11 = ctx.luckysheetfile[sheetIndex]).config || (_11.config = {});
|
|
178
181
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
179
|
-
var cellWidth = ((
|
|
182
|
+
var cellWidth = ((_z = cfg.columnlen) === null || _z === void 0 ? void 0 : _z[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
180
183
|
if (attr === "tb" && canvas && foucsStatus === "2") {
|
|
181
|
-
var currentColWidth_1 = ((
|
|
184
|
+
var currentColWidth_1 = ((_0 = cfg.columnlen) === null || _0 === void 0 ? void 0 : _0[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
|
|
182
185
|
var lineCount_1 = 1;
|
|
183
186
|
var fontString_1 = "10px Arial";
|
|
184
187
|
if (value.fs) {
|
|
@@ -191,9 +194,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
191
194
|
lineCount_1 = (0, _utils.getLineCount)(value.m, currentColWidth_1, fontString_1);
|
|
192
195
|
var hOffset = lineCount_1 < 4 ? 1.9 : 1.7;
|
|
193
196
|
lineCount_1 = lineCount_1 * hOffset + 1;
|
|
194
|
-
} else if ((
|
|
197
|
+
} else if ((_3 = (_2 = (_1 = value === null || value === void 0 ? void 0 : value.ct) === null || _1 === void 0 ? void 0 : _1.s) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.v) {
|
|
195
198
|
lineCount_1 -= 1;
|
|
196
|
-
var line = (
|
|
199
|
+
var line = (_6 = (_5 = (_4 = value === null || value === void 0 ? void 0 : value.ct) === null || _4 === void 0 ? void 0 : _4.s) === null || _5 === void 0 ? void 0 : _5[0]) === null || _6 === void 0 ? void 0 : _6.v.split("\n");
|
|
197
200
|
line.forEach(function (item) {
|
|
198
201
|
var subLineCount = (0, _utils.getLineCount)(item, currentColWidth_1, fontString_1);
|
|
199
202
|
lineCount_1 += subLineCount;
|
|
@@ -213,7 +216,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
213
216
|
});
|
|
214
217
|
if (!textInfo) return "continue";
|
|
215
218
|
var rowHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
216
|
-
var currentRowHeight = ((
|
|
219
|
+
var currentRowHeight = ((_7 = cfg.rowlen) === null || _7 === void 0 ? void 0 : _7[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
217
220
|
if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
218
221
|
if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
219
222
|
_lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
@@ -228,7 +231,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
228
231
|
});
|
|
229
232
|
if (!textInfo) return "continue";
|
|
230
233
|
var newHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
231
|
-
var oldHeight = ((
|
|
234
|
+
var oldHeight = ((_8 = cfg.rowlen) === null || _8 === void 0 ? void 0 : _8[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
232
235
|
var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
|
|
233
236
|
if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
234
237
|
var padding = 12;
|
|
@@ -259,6 +262,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
259
262
|
_loop_1(c);
|
|
260
263
|
}
|
|
261
264
|
}
|
|
265
|
+
if ((_9 = ctx === null || ctx === void 0 ? void 0 : ctx.hooks) === null || _9 === void 0 ? void 0 : _9.updateCellYdoc) {
|
|
266
|
+
(_10 = ctx.hooks) === null || _10 === void 0 ? void 0 : _10.updateCellYdoc(changes);
|
|
267
|
+
}
|
|
262
268
|
}
|
|
263
269
|
}
|
|
264
270
|
function updateFormat(ctx, $input, d, attr, foucsStatus, canvas) {
|