@fileverse-dev/fortune-core 1.0.11 → 1.0.12
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/context.d.ts +1 -0
- package/es/context.js +1 -0
- package/es/modules/dataVerification.js +3 -2
- package/es/modules/dropCell.js +3 -2
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +25 -0
- package/lib/context.d.ts +1 -0
- package/lib/context.js +1 -0
- package/lib/modules/dataVerification.js +2 -1
- package/lib/modules/dropCell.js +2 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +28 -1
- package/package.json +1 -1
package/es/context.d.ts
CHANGED
package/es/context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { colLocationByIndex, diff, getcellrange, getCellValue, getFlowdata, getRangeByTxt, getSheetIndex, isAllowEdit, iscelldata, isdatetime, isRealNull, isRealNum, jfrefreshgrid, mergeBorder, rowLocationByIndex, setCellValue } from "..";
|
|
1
|
+
import { colLocationByIndex, diff, getcellrange, getCellValue, getFlowdata, getRangeByTxt, getSheetIndex, isAllowEdit, isAllowEditReadOnly, iscelldata, isdatetime, isRealNull, isRealNum, jfrefreshgrid, mergeBorder, rowLocationByIndex, setCellValue } from "..";
|
|
2
2
|
export function dataRangeSelection(ctx, cache, rangT, type, value) {
|
|
3
3
|
var _a, _b;
|
|
4
4
|
ctx.rangeDialog.show = true;
|
|
@@ -496,7 +496,8 @@ export function getHintText(ctx, item) {
|
|
|
496
496
|
export function cellFocus(ctx, r, c, clickMode) {
|
|
497
497
|
var _a, _b;
|
|
498
498
|
var allowEdit = isAllowEdit(ctx);
|
|
499
|
-
|
|
499
|
+
var isReadOnly = isAllowEditReadOnly(ctx);
|
|
500
|
+
if (!allowEdit || isReadOnly) return;
|
|
500
501
|
var showHintBox = document.getElementById("luckysheet-dataVerification-showHintBox");
|
|
501
502
|
var dropDownBtn = document.getElementById("luckysheet-dataVerification-dropdown-btn");
|
|
502
503
|
ctx.dataVerificationDropDownList = false;
|
package/es/modules/dropCell.js
CHANGED
|
@@ -2,7 +2,7 @@ import _ from "lodash";
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import { getFlowdata } from "../context";
|
|
4
4
|
import { colLocation, rowLocation } from "./location";
|
|
5
|
-
import { getSheetIndex, isAllowEdit } from "../utils";
|
|
5
|
+
import { getSheetIndex, isAllowEdit, isAllowEditReadOnly } from "../utils";
|
|
6
6
|
import { getBorderInfoCompute } from "./border";
|
|
7
7
|
import { genarate, update } from "./format";
|
|
8
8
|
import * as formula from "./formula";
|
|
@@ -1766,7 +1766,8 @@ export function updateDropCell(ctx) {
|
|
|
1766
1766
|
var _e, _f, _g;
|
|
1767
1767
|
var d = getFlowdata(ctx);
|
|
1768
1768
|
var allowEdit = isAllowEdit(ctx);
|
|
1769
|
-
|
|
1769
|
+
var isReadOnly = isAllowEditReadOnly(ctx);
|
|
1770
|
+
if (allowEdit === false || d == null || isReadOnly) {
|
|
1770
1771
|
return;
|
|
1771
1772
|
}
|
|
1772
1773
|
var index = getSheetIndex(ctx, ctx.currentSheetId);
|
package/es/utils/index.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export declare function replaceHtml(temp: string, dataarry: any): string;
|
|
|
16
16
|
export declare function getRegExpStr(str: string): string;
|
|
17
17
|
export declare function chatatABC(n: number): string;
|
|
18
18
|
export declare function isAllowEdit(ctx: Context, range?: Sheet["luckysheet_select_save"]): boolean;
|
|
19
|
+
export declare function isAllowEditReadOnly(ctx: Context, range?: Sheet["luckysheet_select_save"]): boolean;
|
package/es/utils/index.js
CHANGED
|
@@ -170,4 +170,29 @@ export function isAllowEdit(ctx, range) {
|
|
|
170
170
|
}
|
|
171
171
|
return true;
|
|
172
172
|
}) && (_.isUndefined(ctx.allowEdit) ? true : ctx.allowEdit);
|
|
173
|
+
}
|
|
174
|
+
export function isAllowEditReadOnly(ctx, range) {
|
|
175
|
+
var cfg = ctx.config;
|
|
176
|
+
var judgeRange = _.isUndefined(range) ? ctx.luckysheet_select_save : range;
|
|
177
|
+
return _.every(judgeRange, function (selection) {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
180
|
+
if ((_a = cfg.rowReadOnly) === null || _a === void 0 ? void 0 : _a[r]) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
185
|
+
if ((_b = cfg.colReadOnly) === null || _b === void 0 ? void 0 : _b[c]) {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
190
|
+
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
191
|
+
if (checkCellIsLocked(ctx, r, c, ctx.currentSheetId)) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return true;
|
|
197
|
+
}) && (_.isUndefined(ctx.isFlvReadOnly) ? true : ctx.isFlvReadOnly);
|
|
173
198
|
}
|
package/lib/context.d.ts
CHANGED
package/lib/context.js
CHANGED
|
@@ -511,7 +511,8 @@ function getHintText(ctx, item) {
|
|
|
511
511
|
function cellFocus(ctx, r, c, clickMode) {
|
|
512
512
|
var _a, _b;
|
|
513
513
|
var allowEdit = (0, _.isAllowEdit)(ctx);
|
|
514
|
-
|
|
514
|
+
var isReadOnly = (0, _.isAllowEditReadOnly)(ctx);
|
|
515
|
+
if (!allowEdit || isReadOnly) return;
|
|
515
516
|
var showHintBox = document.getElementById("luckysheet-dataVerification-showHintBox");
|
|
516
517
|
var dropDownBtn = document.getElementById("luckysheet-dataVerification-dropdown-btn");
|
|
517
518
|
ctx.dataVerificationDropDownList = false;
|
package/lib/modules/dropCell.js
CHANGED
|
@@ -1782,7 +1782,8 @@ function updateDropCell(ctx) {
|
|
|
1782
1782
|
var _e, _f, _g;
|
|
1783
1783
|
var d = (0, _context.getFlowdata)(ctx);
|
|
1784
1784
|
var allowEdit = (0, _utils.isAllowEdit)(ctx);
|
|
1785
|
-
|
|
1785
|
+
var isReadOnly = (0, _utils.isAllowEditReadOnly)(ctx);
|
|
1786
|
+
if (allowEdit === false || d == null || isReadOnly) {
|
|
1786
1787
|
return;
|
|
1787
1788
|
}
|
|
1788
1789
|
var index = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export declare function replaceHtml(temp: string, dataarry: any): string;
|
|
|
16
16
|
export declare function getRegExpStr(str: string): string;
|
|
17
17
|
export declare function chatatABC(n: number): string;
|
|
18
18
|
export declare function isAllowEdit(ctx: Context, range?: Sheet["luckysheet_select_save"]): boolean;
|
|
19
|
+
export declare function isAllowEditReadOnly(ctx: Context, range?: Sheet["luckysheet_select_save"]): boolean;
|
package/lib/utils/index.js
CHANGED
|
@@ -17,7 +17,8 @@ var _exportNames = {
|
|
|
17
17
|
replaceHtml: true,
|
|
18
18
|
getRegExpStr: true,
|
|
19
19
|
chatatABC: true,
|
|
20
|
-
isAllowEdit: true
|
|
20
|
+
isAllowEdit: true,
|
|
21
|
+
isAllowEditReadOnly: true
|
|
21
22
|
};
|
|
22
23
|
exports.chatatABC = chatatABC;
|
|
23
24
|
exports.columnCharToIndex = columnCharToIndex;
|
|
@@ -31,6 +32,7 @@ exports.getSheetIdByName = getSheetIdByName;
|
|
|
31
32
|
exports.getSheetIndex = getSheetIndex;
|
|
32
33
|
exports.indexToColumnChar = indexToColumnChar;
|
|
33
34
|
exports.isAllowEdit = isAllowEdit;
|
|
35
|
+
exports.isAllowEditReadOnly = isAllowEditReadOnly;
|
|
34
36
|
exports.replaceHtml = replaceHtml;
|
|
35
37
|
exports.rgbToHex = rgbToHex;
|
|
36
38
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
@@ -228,4 +230,29 @@ function isAllowEdit(ctx, range) {
|
|
|
228
230
|
}
|
|
229
231
|
return true;
|
|
230
232
|
}) && (_lodash.default.isUndefined(ctx.allowEdit) ? true : ctx.allowEdit);
|
|
233
|
+
}
|
|
234
|
+
function isAllowEditReadOnly(ctx, range) {
|
|
235
|
+
var cfg = ctx.config;
|
|
236
|
+
var judgeRange = _lodash.default.isUndefined(range) ? ctx.luckysheet_select_save : range;
|
|
237
|
+
return _lodash.default.every(judgeRange, function (selection) {
|
|
238
|
+
var _a, _b;
|
|
239
|
+
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
240
|
+
if ((_a = cfg.rowReadOnly) === null || _a === void 0 ? void 0 : _a[r]) {
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
245
|
+
if ((_b = cfg.colReadOnly) === null || _b === void 0 ? void 0 : _b[c]) {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
for (var r = selection.row[0]; r <= selection.row[1]; r += 1) {
|
|
250
|
+
for (var c = selection.column[0]; c <= selection.column[1]; c += 1) {
|
|
251
|
+
if ((0, _modules.checkCellIsLocked)(ctx, r, c, ctx.currentSheetId)) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}) && (_lodash.default.isUndefined(ctx.isFlvReadOnly) ? true : ctx.isFlvReadOnly);
|
|
231
258
|
}
|