@fileverse-dev/fortune-core 1.2.92-yoc-1 → 1.2.92-yoc-2
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 +9 -12
- package/lib/modules/toolbar.js +9 -12
- 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;
|
|
19
|
+
var _7;
|
|
20
20
|
console.log("updateFormatCell", row_st, row_ed, col_st, col_ed);
|
|
21
21
|
if (_.isNil(d) || _.isNil(attr)) {
|
|
22
22
|
return;
|
|
@@ -86,9 +86,6 @@ 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
|
-
}
|
|
92
89
|
}
|
|
93
90
|
} else {
|
|
94
91
|
if (attr === "ht") {
|
|
@@ -144,11 +141,11 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
144
141
|
if (value && _.isPlainObject(value)) {
|
|
145
142
|
updateInlineStringFormatOutside(value, attr, foucsStatus);
|
|
146
143
|
value[attr] = foucsStatus;
|
|
147
|
-
(
|
|
144
|
+
(_7 = ctx.luckysheetfile[sheetIndex]).config || (_7.config = {});
|
|
148
145
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
149
|
-
var cellWidth = ((
|
|
146
|
+
var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
150
147
|
if (attr === "tb" && canvas && foucsStatus === "2") {
|
|
151
|
-
var currentColWidth_1 = ((
|
|
148
|
+
var currentColWidth_1 = ((_y = cfg.columnlen) === null || _y === void 0 ? void 0 : _y[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
|
|
152
149
|
var lineCount_1 = 1;
|
|
153
150
|
var fontString_1 = "10px Arial";
|
|
154
151
|
if (value.fs) {
|
|
@@ -161,9 +158,9 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
161
158
|
lineCount_1 = getLineCount(value.m, currentColWidth_1, fontString_1);
|
|
162
159
|
var hOffset = lineCount_1 < 4 ? 1.9 : 1.7;
|
|
163
160
|
lineCount_1 = lineCount_1 * hOffset + 1;
|
|
164
|
-
} else if ((
|
|
161
|
+
} else if ((_1 = (_0 = (_z = value === null || value === void 0 ? void 0 : value.ct) === null || _z === void 0 ? void 0 : _z.s) === null || _0 === void 0 ? void 0 : _0[0]) === null || _1 === void 0 ? void 0 : _1.v) {
|
|
165
162
|
lineCount_1 -= 1;
|
|
166
|
-
var line = (
|
|
163
|
+
var line = (_4 = (_3 = (_2 = value === null || value === void 0 ? void 0 : value.ct) === null || _2 === void 0 ? void 0 : _2.s) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.v.split("\n");
|
|
167
164
|
line.forEach(function (item) {
|
|
168
165
|
var subLineCount = getLineCount(item, currentColWidth_1, fontString_1);
|
|
169
166
|
lineCount_1 += subLineCount;
|
|
@@ -183,7 +180,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
183
180
|
});
|
|
184
181
|
if (!textInfo) return "continue";
|
|
185
182
|
var rowHeight = _.round(textInfo.textHeightAll);
|
|
186
|
-
var currentRowHeight = ((
|
|
183
|
+
var currentRowHeight = ((_5 = cfg.rowlen) === null || _5 === void 0 ? void 0 : _5[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
187
184
|
if (!_.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
188
185
|
if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
189
186
|
_.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
@@ -198,7 +195,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
198
195
|
});
|
|
199
196
|
if (!textInfo) return "continue";
|
|
200
197
|
var newHeight = _.round(textInfo.textHeightAll);
|
|
201
|
-
var oldHeight = ((
|
|
198
|
+
var oldHeight = ((_6 = cfg.rowlen) === null || _6 === void 0 ? void 0 : _6[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
202
199
|
var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
|
|
203
200
|
if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
204
201
|
var padding = 12;
|
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;
|
|
52
|
+
var _7;
|
|
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,9 +119,6 @@ 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
|
-
}
|
|
125
122
|
}
|
|
126
123
|
} else {
|
|
127
124
|
if (attr === "ht") {
|
|
@@ -177,11 +174,11 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
177
174
|
if (value && _lodash.default.isPlainObject(value)) {
|
|
178
175
|
(0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
|
|
179
176
|
value[attr] = foucsStatus;
|
|
180
|
-
(
|
|
177
|
+
(_7 = ctx.luckysheetfile[sheetIndex]).config || (_7.config = {});
|
|
181
178
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
182
|
-
var cellWidth = ((
|
|
179
|
+
var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
183
180
|
if (attr === "tb" && canvas && foucsStatus === "2") {
|
|
184
|
-
var currentColWidth_1 = ((
|
|
181
|
+
var currentColWidth_1 = ((_y = cfg.columnlen) === null || _y === void 0 ? void 0 : _y[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth || 100;
|
|
185
182
|
var lineCount_1 = 1;
|
|
186
183
|
var fontString_1 = "10px Arial";
|
|
187
184
|
if (value.fs) {
|
|
@@ -194,9 +191,9 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
194
191
|
lineCount_1 = (0, _utils.getLineCount)(value.m, currentColWidth_1, fontString_1);
|
|
195
192
|
var hOffset = lineCount_1 < 4 ? 1.9 : 1.7;
|
|
196
193
|
lineCount_1 = lineCount_1 * hOffset + 1;
|
|
197
|
-
} else if ((
|
|
194
|
+
} else if ((_1 = (_0 = (_z = value === null || value === void 0 ? void 0 : value.ct) === null || _z === void 0 ? void 0 : _z.s) === null || _0 === void 0 ? void 0 : _0[0]) === null || _1 === void 0 ? void 0 : _1.v) {
|
|
198
195
|
lineCount_1 -= 1;
|
|
199
|
-
var line = (
|
|
196
|
+
var line = (_4 = (_3 = (_2 = value === null || value === void 0 ? void 0 : value.ct) === null || _2 === void 0 ? void 0 : _2.s) === null || _3 === void 0 ? void 0 : _3[0]) === null || _4 === void 0 ? void 0 : _4.v.split("\n");
|
|
200
197
|
line.forEach(function (item) {
|
|
201
198
|
var subLineCount = (0, _utils.getLineCount)(item, currentColWidth_1, fontString_1);
|
|
202
199
|
lineCount_1 += subLineCount;
|
|
@@ -216,7 +213,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
216
213
|
});
|
|
217
214
|
if (!textInfo) return "continue";
|
|
218
215
|
var rowHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
219
|
-
var currentRowHeight = ((
|
|
216
|
+
var currentRowHeight = ((_5 = cfg.rowlen) === null || _5 === void 0 ? void 0 : _5[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
220
217
|
if (!_lodash.default.isUndefined(rowHeight) && rowHeight > currentRowHeight && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
221
218
|
if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
222
219
|
_lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
@@ -231,7 +228,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
231
228
|
});
|
|
232
229
|
if (!textInfo) return "continue";
|
|
233
230
|
var newHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
234
|
-
var oldHeight = ((
|
|
231
|
+
var oldHeight = ((_6 = cfg.rowlen) === null || _6 === void 0 ? void 0 : _6[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
235
232
|
var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
|
|
236
233
|
if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
237
234
|
var padding = 12;
|