@fileverse-dev/fortune-core 1.2.24 → 1.2.26
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 +22 -4
- package/es/settings.d.ts +3 -1
- package/es/utils/index.js +1 -1
- package/lib/modules/toolbar.js +21 -3
- package/lib/settings.d.ts +3 -1
- package/lib/utils/index.js +1 -1
- package/package.json +2 -2
package/es/modules/toolbar.js
CHANGED
|
@@ -13,10 +13,10 @@ import { sortSelection } from "./sort";
|
|
|
13
13
|
import { hasPartMC, isdatatypemulti, isRealNull, isRealNum } from "./validation";
|
|
14
14
|
import { showLinkCard } from "./hyperlink";
|
|
15
15
|
import { cfSplitRange } from "./conditionalFormat";
|
|
16
|
-
import { getCellTextInfo } from "./text";
|
|
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;
|
|
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;
|
|
19
|
+
var _0;
|
|
20
20
|
if (_.isNil(d) || _.isNil(attr)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
@@ -127,7 +127,7 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
127
127
|
if (value && _.isPlainObject(value)) {
|
|
128
128
|
updateInlineStringFormatOutside(value, attr, foucsStatus);
|
|
129
129
|
value[attr] = foucsStatus;
|
|
130
|
-
(
|
|
130
|
+
(_0 = ctx.luckysheetfile[sheetIndex]).config || (_0.config = {});
|
|
131
131
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
132
132
|
var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
133
133
|
if (attr === "fs" && canvas) {
|
|
@@ -144,6 +144,24 @@ export function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_
|
|
|
144
144
|
_.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
+
if (attr === "tb" && canvas) {
|
|
148
|
+
clearMeasureTextCache();
|
|
149
|
+
var textInfo = getCellTextInfo(d[r][c], canvas, ctx, {
|
|
150
|
+
r: r,
|
|
151
|
+
c: c,
|
|
152
|
+
cellWidth: cellWidth || 104
|
|
153
|
+
});
|
|
154
|
+
if (!textInfo) continue;
|
|
155
|
+
var newHeight = _.round(textInfo.textHeightAll);
|
|
156
|
+
var oldHeight = ((_z = cfg.rowlen) === null || _z === void 0 ? void 0 : _z[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
157
|
+
var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
|
|
158
|
+
if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
159
|
+
var padding = 12;
|
|
160
|
+
var height = newHeight + padding;
|
|
161
|
+
if (_.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
162
|
+
_.set(cfg, "rowlen.".concat(r), height);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
147
165
|
} else {
|
|
148
166
|
d[r][c] = {
|
|
149
167
|
v: value
|
package/es/settings.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export type Hooks = {
|
|
|
57
57
|
beforeUpdateSheetName?: (id: string, oldName: string, newName: string) => boolean;
|
|
58
58
|
afterUpdateSheetName?: (id: string, oldName: string, newName: string) => void;
|
|
59
59
|
};
|
|
60
|
+
type CommentUIDragFn = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
60
61
|
export type Settings = {
|
|
61
62
|
column?: number;
|
|
62
63
|
row?: number;
|
|
@@ -80,7 +81,7 @@ export type Settings = {
|
|
|
80
81
|
headerContextMenu?: string[];
|
|
81
82
|
sheetTabContextMenu?: string[];
|
|
82
83
|
filterContextMenu?: string[];
|
|
83
|
-
getCommentCellUI?: ((row: number, column: number) => React.ReactNode) | null;
|
|
84
|
+
getCommentCellUI?: ((row: number, column: number, dragHandler: CommentUIDragFn) => React.ReactNode) | null;
|
|
84
85
|
generateSheetId?: () => string;
|
|
85
86
|
hooks?: Hooks;
|
|
86
87
|
customToolbarItems?: {
|
|
@@ -98,3 +99,4 @@ export type Settings = {
|
|
|
98
99
|
isFlvReadOnly?: boolean;
|
|
99
100
|
};
|
|
100
101
|
export declare const defaultSettings: Required<Settings>;
|
|
102
|
+
export {};
|
package/es/utils/index.js
CHANGED
|
@@ -169,7 +169,7 @@ export function isAllowEdit(ctx, range) {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
return true;
|
|
172
|
-
}) && (_.isUndefined(ctx.allowEdit) ? true : ctx.allowEdit);
|
|
172
|
+
}) && (_.isUndefined(ctx.allowEdit) ? true : ctx.allowEdit) && !ctx.isFlvReadOnly;
|
|
173
173
|
}
|
|
174
174
|
export function isAllowEditReadOnly(ctx, range) {
|
|
175
175
|
var cfg = ctx.config;
|
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;
|
|
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;
|
|
52
|
+
var _0;
|
|
53
53
|
if (_lodash.default.isNil(d) || _lodash.default.isNil(attr)) {
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
@@ -160,7 +160,7 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
160
160
|
if (value && _lodash.default.isPlainObject(value)) {
|
|
161
161
|
(0, _inlineString.updateInlineStringFormatOutside)(value, attr, foucsStatus);
|
|
162
162
|
value[attr] = foucsStatus;
|
|
163
|
-
(
|
|
163
|
+
(_0 = ctx.luckysheetfile[sheetIndex]).config || (_0.config = {});
|
|
164
164
|
var cfg = ctx.luckysheetfile[sheetIndex].config;
|
|
165
165
|
var cellWidth = ((_x = cfg.columnlen) === null || _x === void 0 ? void 0 : _x[c]) || ctx.luckysheetfile[sheetIndex].defaultColWidth;
|
|
166
166
|
if (attr === "fs" && canvas) {
|
|
@@ -177,6 +177,24 @@ function updateFormatCell(ctx, d, attr, foucsStatus, row_st, row_ed, col_st, col
|
|
|
177
177
|
_lodash.default.set(cfg, "rowlen.".concat(r), rowHeight);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
+
if (attr === "tb" && canvas) {
|
|
181
|
+
(0, _text.clearMeasureTextCache)();
|
|
182
|
+
var textInfo = (0, _text.getCellTextInfo)(d[r][c], canvas, ctx, {
|
|
183
|
+
r: r,
|
|
184
|
+
c: c,
|
|
185
|
+
cellWidth: cellWidth || 104
|
|
186
|
+
});
|
|
187
|
+
if (!textInfo) continue;
|
|
188
|
+
var newHeight = _lodash.default.round(textInfo.textHeightAll);
|
|
189
|
+
var oldHeight = ((_z = cfg.rowlen) === null || _z === void 0 ? void 0 : _z[r]) || ctx.luckysheetfile[sheetIndex].defaultRowHeight || 19;
|
|
190
|
+
var shouldResize = foucsStatus === "2" ? newHeight > oldHeight : true;
|
|
191
|
+
if (shouldResize && (!cfg.customHeight || cfg.customHeight[r] !== 1)) {
|
|
192
|
+
var padding = 12;
|
|
193
|
+
var height = newHeight + padding;
|
|
194
|
+
if (_lodash.default.isUndefined(cfg.rowlen)) cfg.rowlen = {};
|
|
195
|
+
_lodash.default.set(cfg, "rowlen.".concat(r), height);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
180
198
|
} else {
|
|
181
199
|
d[r][c] = {
|
|
182
200
|
v: value
|
package/lib/settings.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export type Hooks = {
|
|
|
57
57
|
beforeUpdateSheetName?: (id: string, oldName: string, newName: string) => boolean;
|
|
58
58
|
afterUpdateSheetName?: (id: string, oldName: string, newName: string) => void;
|
|
59
59
|
};
|
|
60
|
+
type CommentUIDragFn = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
|
|
60
61
|
export type Settings = {
|
|
61
62
|
column?: number;
|
|
62
63
|
row?: number;
|
|
@@ -80,7 +81,7 @@ export type Settings = {
|
|
|
80
81
|
headerContextMenu?: string[];
|
|
81
82
|
sheetTabContextMenu?: string[];
|
|
82
83
|
filterContextMenu?: string[];
|
|
83
|
-
getCommentCellUI?: ((row: number, column: number) => React.ReactNode) | null;
|
|
84
|
+
getCommentCellUI?: ((row: number, column: number, dragHandler: CommentUIDragFn) => React.ReactNode) | null;
|
|
84
85
|
generateSheetId?: () => string;
|
|
85
86
|
hooks?: Hooks;
|
|
86
87
|
customToolbarItems?: {
|
|
@@ -98,3 +99,4 @@ export type Settings = {
|
|
|
98
99
|
isFlvReadOnly?: boolean;
|
|
99
100
|
};
|
|
100
101
|
export declare const defaultSettings: Required<Settings>;
|
|
102
|
+
export {};
|
package/lib/utils/index.js
CHANGED
|
@@ -241,7 +241,7 @@ function isAllowEdit(ctx, range) {
|
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
return true;
|
|
244
|
-
}) && (_lodash.default.isUndefined(ctx.allowEdit) ? true : ctx.allowEdit);
|
|
244
|
+
}) && (_lodash.default.isUndefined(ctx.allowEdit) ? true : ctx.allowEdit) && !ctx.isFlvReadOnly;
|
|
245
245
|
}
|
|
246
246
|
function isAllowEditReadOnly(ctx, range) {
|
|
247
247
|
var cfg = ctx.config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fileverse-dev/fortune-core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.26",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dev": "father-build --watch"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@fileverse-dev/formula-parser": "0.2.
|
|
18
|
+
"@fileverse-dev/formula-parser": "0.2.81",
|
|
19
19
|
"dayjs": "^1.11.0",
|
|
20
20
|
"immer": "^9.0.12",
|
|
21
21
|
"lodash": "^4.17.21",
|