@fileverse-dev/fortune-core 1.3.0 → 1.3.1-paint-1

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 CHANGED
@@ -53,6 +53,11 @@ export type Context = {
53
53
  optionLabel_es: any;
54
54
  optionLabel_hi: any;
55
55
  dataRegulation?: DataRegulationProps;
56
+ updateScope?: "current" | "all";
57
+ sourceCell?: {
58
+ row: number;
59
+ col: number;
60
+ };
56
61
  };
57
62
  dataVerificationDropDownList?: boolean;
58
63
  conditionRules: ConditionRulesProps;
@@ -12,6 +12,7 @@ export declare function fixPositionOnFrozenCells(freeze: Freezen | undefined, x:
12
12
  export declare function handleCellAreaMouseDown(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null, canvas?: CanvasRenderingContext2D): void;
13
13
  export declare function handleCellAreaDoubleClick(ctx: Context, globalCache: GlobalCache, settings: Settings, e: MouseEvent, container: HTMLElement): void;
14
14
  export declare function handleContextMenu(ctx: Context, settings: Settings, e: MouseEvent, workbookContainer: HTMLDivElement, container: HTMLDivElement, area: "cell" | "rowHeader" | "columnHeader"): void;
15
+ export declare function mouseRender(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, scrollX: HTMLDivElement, scrollY: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
15
16
  export declare function handleOverlayMouseMove(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, scrollX: HTMLDivElement, scrollY: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
16
17
  export declare function handleOverlayMouseUp(ctx: Context, globalCache: GlobalCache, settings: Settings, e: MouseEvent, scrollbarX: HTMLDivElement, scrollbarY: HTMLDivElement, container: HTMLDivElement, cellInput: HTMLDivElement | null, fxInput: HTMLDivElement | null): void;
17
18
  export declare function handleRowHeaderMouseDown(ctx: Context, globalCache: GlobalCache, e: MouseEvent, container: HTMLDivElement, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null): void;
@@ -696,7 +696,7 @@ export function handleContextMenu(ctx, settings, e, workbookContainer, container
696
696
  });
697
697
  }
698
698
  }
699
- function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container, fxInput) {
699
+ export function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container, fxInput) {
700
700
  var _a, _b, _c, _d;
701
701
  var rect = container.getBoundingClientRect();
702
702
  if (ctx.luckysheet_scroll_status && !ctx.luckysheet_cols_change_size && !ctx.luckysheet_rows_change_size) {
@@ -733,6 +733,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
733
733
  return;
734
734
  }
735
735
  if (ctx.luckysheet_select_status) {
736
+ console.log("ctx.scrollLeft", ctx.scrollLeft);
736
737
  var mouseX = e.pageX - rect.left - window.scrollX;
737
738
  var mouseY = e.pageY - rect.top - window.scrollY;
738
739
  var _x = mouseX - ctx.rowHeaderWidth + ctx.scrollLeft;
@@ -180,6 +180,8 @@ export function selectTitlesRange(map) {
180
180
  return rangeArr;
181
181
  }
182
182
  export function pasteHandlerOfPaintModel(ctx, copyRange) {
183
+ var _a;
184
+ console.log("pasteHandlerOfPaintModel", ctx, copyRange);
183
185
  var cfg = ctx.config;
184
186
  if (cfg.merge == null) {
185
187
  cfg.merge = {};
@@ -369,36 +371,40 @@ export function pasteHandlerOfPaintModel(ctx, copyRange) {
369
371
  }
370
372
  var currFile = ctx.luckysheetfile[getSheetIndex(ctx, ctx.currentSheetId)];
371
373
  currFile.config = cfg;
372
- currFile.dataVerification = dataVerification;
373
- var cdformat = null;
374
+ if (dataVerification != null) {
375
+ currFile.dataVerification = dataVerification;
376
+ }
374
377
  var copyIndex = getSheetIndex(ctx, copySheetIndex);
375
- if (!copyIndex) return;
376
- var ruleArr = _.cloneDeep(ctx.luckysheetfile[copyIndex].luckysheet_conditionformat_save);
377
- if (!_.isNil(ruleArr) && ruleArr.length > 0) {
378
- var currentIndex = getSheetIndex(ctx, ctx.currentSheetId);
379
- cdformat = _.cloneDeep(ctx.luckysheetfile[currentIndex].luckysheet_conditionformat_save);
380
- for (var i = 0; i < ruleArr.length; i += 1) {
381
- var cdformat_cellrange = ruleArr[i].cellrange;
382
- var emptyRange = [];
383
- for (var j = 0; j < cdformat_cellrange.length; j += 1) {
384
- var range = CFSplitRange(cdformat_cellrange[j], {
385
- row: [c_r1, c_r2],
386
- column: [c_c1, c_c2]
387
- }, {
388
- row: [minh, maxh],
389
- column: [minc, maxc]
390
- }, "operatePart");
391
- if (range.length > 0) {
392
- emptyRange = emptyRange.concat(range);
378
+ if (copyIndex != null) {
379
+ var ruleArr = _.cloneDeep(ctx.luckysheetfile[copyIndex].luckysheet_conditionformat_save);
380
+ if (!_.isNil(ruleArr) && ruleArr.length > 0) {
381
+ var currentIndex = getSheetIndex(ctx, ctx.currentSheetId);
382
+ var existingCf = ctx.luckysheetfile[currentIndex].luckysheet_conditionformat_save;
383
+ var cdformat = (_a = _.cloneDeep(existingCf)) !== null && _a !== void 0 ? _a : [];
384
+ for (var i = 0; i < ruleArr.length; i += 1) {
385
+ var cdformat_cellrange = ruleArr[i].cellrange;
386
+ var emptyRange = [];
387
+ for (var j = 0; j < cdformat_cellrange.length; j += 1) {
388
+ var range = CFSplitRange(cdformat_cellrange[j], {
389
+ row: [c_r1, c_r2],
390
+ column: [c_c1, c_c2]
391
+ }, {
392
+ row: [minh, maxh],
393
+ column: [minc, maxc]
394
+ }, "operatePart");
395
+ if (range.length > 0) {
396
+ emptyRange = emptyRange.concat(range);
397
+ }
398
+ }
399
+ if (emptyRange.length > 0) {
400
+ ruleArr[i].cellrange = [{
401
+ row: [minh, maxh],
402
+ column: [minc, maxc]
403
+ }];
404
+ cdformat.push(ruleArr[i]);
393
405
  }
394
406
  }
395
- if (emptyRange.length > 0) {
396
- ruleArr[i].cellrange = [{
397
- row: [minh, maxh],
398
- column: [minc, maxc]
399
- }];
400
- cdformat.push(ruleArr[i]);
401
- }
407
+ currFile.luckysheet_conditionformat_save = cdformat;
402
408
  }
403
409
  }
404
410
  }
@@ -727,6 +727,7 @@ export function handleVerticalAlign(ctx, cellInput, value) {
727
727
  setAttr(ctx, cellInput, "vt", value);
728
728
  }
729
729
  export function handleFormatPainter(ctx) {
730
+ console.log("handleFormatPainter", ctx);
730
731
  var allowEdit = isAllowEdit(ctx);
731
732
  if (!allowEdit) return;
732
733
  if (ctx.luckysheet_select_save == null || ctx.luckysheet_select_save.length === 0) {
package/lib/context.d.ts CHANGED
@@ -53,6 +53,11 @@ export type Context = {
53
53
  optionLabel_es: any;
54
54
  optionLabel_hi: any;
55
55
  dataRegulation?: DataRegulationProps;
56
+ updateScope?: "current" | "all";
57
+ sourceCell?: {
58
+ row: number;
59
+ col: number;
60
+ };
56
61
  };
57
62
  dataVerificationDropDownList?: boolean;
58
63
  conditionRules: ConditionRulesProps;
@@ -12,6 +12,7 @@ export declare function fixPositionOnFrozenCells(freeze: Freezen | undefined, x:
12
12
  export declare function handleCellAreaMouseDown(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null, canvas?: CanvasRenderingContext2D): void;
13
13
  export declare function handleCellAreaDoubleClick(ctx: Context, globalCache: GlobalCache, settings: Settings, e: MouseEvent, container: HTMLElement): void;
14
14
  export declare function handleContextMenu(ctx: Context, settings: Settings, e: MouseEvent, workbookContainer: HTMLDivElement, container: HTMLDivElement, area: "cell" | "rowHeader" | "columnHeader"): void;
15
+ export declare function mouseRender(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, scrollX: HTMLDivElement, scrollY: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
15
16
  export declare function handleOverlayMouseMove(ctx: Context, globalCache: GlobalCache, e: MouseEvent, cellInput: HTMLDivElement, scrollX: HTMLDivElement, scrollY: HTMLDivElement, container: HTMLDivElement, fxInput?: HTMLDivElement | null): void;
16
17
  export declare function handleOverlayMouseUp(ctx: Context, globalCache: GlobalCache, settings: Settings, e: MouseEvent, scrollbarX: HTMLDivElement, scrollbarY: HTMLDivElement, container: HTMLDivElement, cellInput: HTMLDivElement | null, fxInput: HTMLDivElement | null): void;
17
18
  export declare function handleRowHeaderMouseDown(ctx: Context, globalCache: GlobalCache, e: MouseEvent, container: HTMLDivElement, cellInput: HTMLDivElement, fxInput: HTMLDivElement | null): void;
@@ -16,6 +16,7 @@ exports.handleOverlayMouseUp = handleOverlayMouseUp;
16
16
  exports.handleRowFreezeHandleMouseDown = handleRowFreezeHandleMouseDown;
17
17
  exports.handleRowHeaderMouseDown = handleRowHeaderMouseDown;
18
18
  exports.handleRowSizeHandleMouseDown = handleRowSizeHandleMouseDown;
19
+ exports.mouseRender = mouseRender;
19
20
  var _lodash = _interopRequireDefault(require("lodash"));
20
21
  var _context = require("../context");
21
22
  var _modules = require("../modules");
@@ -752,6 +753,7 @@ function mouseRender(ctx, globalCache, e, cellInput, scrollX, scrollY, container
752
753
  return;
753
754
  }
754
755
  if (ctx.luckysheet_select_status) {
756
+ console.log("ctx.scrollLeft", ctx.scrollLeft);
755
757
  var mouseX = e.pageX - rect.left - window.scrollX;
756
758
  var mouseY = e.pageY - rect.top - window.scrollY;
757
759
  var _x = mouseX - ctx.rowHeaderWidth + ctx.scrollLeft;
@@ -215,6 +215,8 @@ function selectTitlesRange(map) {
215
215
  return rangeArr;
216
216
  }
217
217
  function pasteHandlerOfPaintModel(ctx, copyRange) {
218
+ var _a;
219
+ console.log("pasteHandlerOfPaintModel", ctx, copyRange);
218
220
  var cfg = ctx.config;
219
221
  if (cfg.merge == null) {
220
222
  cfg.merge = {};
@@ -404,36 +406,40 @@ function pasteHandlerOfPaintModel(ctx, copyRange) {
404
406
  }
405
407
  var currFile = ctx.luckysheetfile[(0, _utils.getSheetIndex)(ctx, ctx.currentSheetId)];
406
408
  currFile.config = cfg;
407
- currFile.dataVerification = dataVerification;
408
- var cdformat = null;
409
+ if (dataVerification != null) {
410
+ currFile.dataVerification = dataVerification;
411
+ }
409
412
  var copyIndex = (0, _utils.getSheetIndex)(ctx, copySheetIndex);
410
- if (!copyIndex) return;
411
- var ruleArr = _lodash.default.cloneDeep(ctx.luckysheetfile[copyIndex].luckysheet_conditionformat_save);
412
- if (!_lodash.default.isNil(ruleArr) && ruleArr.length > 0) {
413
- var currentIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
414
- cdformat = _lodash.default.cloneDeep(ctx.luckysheetfile[currentIndex].luckysheet_conditionformat_save);
415
- for (var i = 0; i < ruleArr.length; i += 1) {
416
- var cdformat_cellrange = ruleArr[i].cellrange;
417
- var emptyRange = [];
418
- for (var j = 0; j < cdformat_cellrange.length; j += 1) {
419
- var range = (0, _ConditionFormat.CFSplitRange)(cdformat_cellrange[j], {
420
- row: [c_r1, c_r2],
421
- column: [c_c1, c_c2]
422
- }, {
423
- row: [minh, maxh],
424
- column: [minc, maxc]
425
- }, "operatePart");
426
- if (range.length > 0) {
427
- emptyRange = emptyRange.concat(range);
413
+ if (copyIndex != null) {
414
+ var ruleArr = _lodash.default.cloneDeep(ctx.luckysheetfile[copyIndex].luckysheet_conditionformat_save);
415
+ if (!_lodash.default.isNil(ruleArr) && ruleArr.length > 0) {
416
+ var currentIndex = (0, _utils.getSheetIndex)(ctx, ctx.currentSheetId);
417
+ var existingCf = ctx.luckysheetfile[currentIndex].luckysheet_conditionformat_save;
418
+ var cdformat = (_a = _lodash.default.cloneDeep(existingCf)) !== null && _a !== void 0 ? _a : [];
419
+ for (var i = 0; i < ruleArr.length; i += 1) {
420
+ var cdformat_cellrange = ruleArr[i].cellrange;
421
+ var emptyRange = [];
422
+ for (var j = 0; j < cdformat_cellrange.length; j += 1) {
423
+ var range = (0, _ConditionFormat.CFSplitRange)(cdformat_cellrange[j], {
424
+ row: [c_r1, c_r2],
425
+ column: [c_c1, c_c2]
426
+ }, {
427
+ row: [minh, maxh],
428
+ column: [minc, maxc]
429
+ }, "operatePart");
430
+ if (range.length > 0) {
431
+ emptyRange = emptyRange.concat(range);
432
+ }
433
+ }
434
+ if (emptyRange.length > 0) {
435
+ ruleArr[i].cellrange = [{
436
+ row: [minh, maxh],
437
+ column: [minc, maxc]
438
+ }];
439
+ cdformat.push(ruleArr[i]);
428
440
  }
429
441
  }
430
- if (emptyRange.length > 0) {
431
- ruleArr[i].cellrange = [{
432
- row: [minh, maxh],
433
- column: [minc, maxc]
434
- }];
435
- cdformat.push(ruleArr[i]);
436
- }
442
+ currFile.luckysheet_conditionformat_save = cdformat;
437
443
  }
438
444
  }
439
445
  }
@@ -760,6 +760,7 @@ function handleVerticalAlign(ctx, cellInput, value) {
760
760
  setAttr(ctx, cellInput, "vt", value);
761
761
  }
762
762
  function handleFormatPainter(ctx) {
763
+ console.log("handleFormatPainter", ctx);
763
764
  var allowEdit = (0, _utils.isAllowEdit)(ctx);
764
765
  if (!allowEdit) return;
765
766
  if (ctx.luckysheet_select_save == null || ctx.luckysheet_select_save.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-core",
3
- "version": "1.3.0",
3
+ "version": "1.3.1-paint-1",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "typings": "lib/index.d.ts",