@windoc/core 0.3.11 → 0.3.13
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/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +298 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +298 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -486,6 +486,8 @@ interface ITd {
|
|
|
486
486
|
positionList?: IElementPosition[];
|
|
487
487
|
verticalAlign?: VerticalAlign;
|
|
488
488
|
backgroundColor?: string;
|
|
489
|
+
borderColor?: string;
|
|
490
|
+
padding?: IPadding;
|
|
489
491
|
borderTypes?: TdBorder[];
|
|
490
492
|
slashTypes?: TdSlash[];
|
|
491
493
|
mainHeight?: number;
|
|
@@ -2034,6 +2036,7 @@ interface IRegisterContextMenu {
|
|
|
2034
2036
|
i18nPath?: string;
|
|
2035
2037
|
isDivider?: boolean;
|
|
2036
2038
|
icon?: string;
|
|
2039
|
+
color?: string;
|
|
2037
2040
|
name?: string;
|
|
2038
2041
|
shortCut?: string;
|
|
2039
2042
|
disable?: boolean;
|
|
@@ -2274,6 +2277,8 @@ declare class TableOperate {
|
|
|
2274
2277
|
tableTdBorderType(payload: TdBorder): void;
|
|
2275
2278
|
tableTdSlashType(payload: TdSlash): void;
|
|
2276
2279
|
tableTdBackgroundColor(payload: string): void;
|
|
2280
|
+
tableTdBorderColor(payload: string): void;
|
|
2281
|
+
tableTdPadding(payload: IPadding): void;
|
|
2277
2282
|
tableSelectAll(): void;
|
|
2278
2283
|
}
|
|
2279
2284
|
|
|
@@ -2621,6 +2626,8 @@ declare class CommandAdapt {
|
|
|
2621
2626
|
tableTdBorderType(payload: TdBorder): void;
|
|
2622
2627
|
tableTdSlashType(payload: TdSlash): void;
|
|
2623
2628
|
tableTdBackgroundColor(payload: string): void;
|
|
2629
|
+
tableTdBorderColor(payload: string): void;
|
|
2630
|
+
tableTdPadding(payload: IPadding): void;
|
|
2624
2631
|
tableSelectAll(): void;
|
|
2625
2632
|
hyperlink(payload: Pick<IElement, 'valueList' | 'hyperlinkId' | 'url'>): void;
|
|
2626
2633
|
getHyperlinkRange(): [number, number] | null;
|
|
@@ -2775,6 +2782,8 @@ declare class Command {
|
|
|
2775
2782
|
executeTableTdBorderType: CommandAdapt['tableTdBorderType'];
|
|
2776
2783
|
executeTableTdSlashType: CommandAdapt['tableTdSlashType'];
|
|
2777
2784
|
executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
|
|
2785
|
+
executeTableTdBorderColor: CommandAdapt['tableTdBorderColor'];
|
|
2786
|
+
executeTableTdPadding: CommandAdapt['tableTdPadding'];
|
|
2778
2787
|
executeTableSelectAll: CommandAdapt['tableSelectAll'];
|
|
2779
2788
|
executeImage: CommandAdapt['image'];
|
|
2780
2789
|
executeHyperlink: CommandAdapt['hyperlink'];
|
|
@@ -3096,6 +3105,13 @@ declare const INTERNAL_CONTEXT_MENU_KEY: {
|
|
|
3096
3105
|
DELETE_TABLE: string;
|
|
3097
3106
|
MERGE_CELL: string;
|
|
3098
3107
|
CANCEL_MERGE_CELL: string;
|
|
3108
|
+
TD_BG_COLOR: string;
|
|
3109
|
+
TD_BORDER_COLOR: string;
|
|
3110
|
+
TD_PADDING: string;
|
|
3111
|
+
TD_PADDING_COMPACT: string;
|
|
3112
|
+
TD_PADDING_NORMAL: string;
|
|
3113
|
+
TD_PADDING_COMFORTABLE: string;
|
|
3114
|
+
TD_PADDING_NONE: string;
|
|
3099
3115
|
};
|
|
3100
3116
|
};
|
|
3101
3117
|
|
package/dist/index.d.ts
CHANGED
|
@@ -486,6 +486,8 @@ interface ITd {
|
|
|
486
486
|
positionList?: IElementPosition[];
|
|
487
487
|
verticalAlign?: VerticalAlign;
|
|
488
488
|
backgroundColor?: string;
|
|
489
|
+
borderColor?: string;
|
|
490
|
+
padding?: IPadding;
|
|
489
491
|
borderTypes?: TdBorder[];
|
|
490
492
|
slashTypes?: TdSlash[];
|
|
491
493
|
mainHeight?: number;
|
|
@@ -2034,6 +2036,7 @@ interface IRegisterContextMenu {
|
|
|
2034
2036
|
i18nPath?: string;
|
|
2035
2037
|
isDivider?: boolean;
|
|
2036
2038
|
icon?: string;
|
|
2039
|
+
color?: string;
|
|
2037
2040
|
name?: string;
|
|
2038
2041
|
shortCut?: string;
|
|
2039
2042
|
disable?: boolean;
|
|
@@ -2274,6 +2277,8 @@ declare class TableOperate {
|
|
|
2274
2277
|
tableTdBorderType(payload: TdBorder): void;
|
|
2275
2278
|
tableTdSlashType(payload: TdSlash): void;
|
|
2276
2279
|
tableTdBackgroundColor(payload: string): void;
|
|
2280
|
+
tableTdBorderColor(payload: string): void;
|
|
2281
|
+
tableTdPadding(payload: IPadding): void;
|
|
2277
2282
|
tableSelectAll(): void;
|
|
2278
2283
|
}
|
|
2279
2284
|
|
|
@@ -2621,6 +2626,8 @@ declare class CommandAdapt {
|
|
|
2621
2626
|
tableTdBorderType(payload: TdBorder): void;
|
|
2622
2627
|
tableTdSlashType(payload: TdSlash): void;
|
|
2623
2628
|
tableTdBackgroundColor(payload: string): void;
|
|
2629
|
+
tableTdBorderColor(payload: string): void;
|
|
2630
|
+
tableTdPadding(payload: IPadding): void;
|
|
2624
2631
|
tableSelectAll(): void;
|
|
2625
2632
|
hyperlink(payload: Pick<IElement, 'valueList' | 'hyperlinkId' | 'url'>): void;
|
|
2626
2633
|
getHyperlinkRange(): [number, number] | null;
|
|
@@ -2775,6 +2782,8 @@ declare class Command {
|
|
|
2775
2782
|
executeTableTdBorderType: CommandAdapt['tableTdBorderType'];
|
|
2776
2783
|
executeTableTdSlashType: CommandAdapt['tableTdSlashType'];
|
|
2777
2784
|
executeTableTdBackgroundColor: CommandAdapt['tableTdBackgroundColor'];
|
|
2785
|
+
executeTableTdBorderColor: CommandAdapt['tableTdBorderColor'];
|
|
2786
|
+
executeTableTdPadding: CommandAdapt['tableTdPadding'];
|
|
2778
2787
|
executeTableSelectAll: CommandAdapt['tableSelectAll'];
|
|
2779
2788
|
executeImage: CommandAdapt['image'];
|
|
2780
2789
|
executeHyperlink: CommandAdapt['hyperlink'];
|
|
@@ -3096,6 +3105,13 @@ declare const INTERNAL_CONTEXT_MENU_KEY: {
|
|
|
3096
3105
|
DELETE_TABLE: string;
|
|
3097
3106
|
MERGE_CELL: string;
|
|
3098
3107
|
CANCEL_MERGE_CELL: string;
|
|
3108
|
+
TD_BG_COLOR: string;
|
|
3109
|
+
TD_BORDER_COLOR: string;
|
|
3110
|
+
TD_PADDING: string;
|
|
3111
|
+
TD_PADDING_COMPACT: string;
|
|
3112
|
+
TD_PADDING_NORMAL: string;
|
|
3113
|
+
TD_PADDING_COMFORTABLE: string;
|
|
3114
|
+
TD_PADDING_NONE: string;
|
|
3099
3115
|
};
|
|
3100
3116
|
};
|
|
3101
3117
|
|
package/dist/index.js
CHANGED
|
@@ -78,7 +78,7 @@ __export(index_exports, {
|
|
|
78
78
|
module.exports = __toCommonJS(index_exports);
|
|
79
79
|
|
|
80
80
|
// src/version.ts
|
|
81
|
-
var version = "0.3.
|
|
81
|
+
var version = "0.3.13";
|
|
82
82
|
|
|
83
83
|
// src/dataset/enum/Common.ts
|
|
84
84
|
var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
|
|
@@ -4279,8 +4279,8 @@ var defaultSeparatorOption = {
|
|
|
4279
4279
|
|
|
4280
4280
|
// src/dataset/constant/Table.ts
|
|
4281
4281
|
var defaultTableOption = {
|
|
4282
|
-
tdPadding: [
|
|
4283
|
-
defaultTrMinHeight:
|
|
4282
|
+
tdPadding: [4, 5, 4, 5],
|
|
4283
|
+
defaultTrMinHeight: 22,
|
|
4284
4284
|
defaultColMinWidth: 40,
|
|
4285
4285
|
defaultBorderColor: "#000000",
|
|
4286
4286
|
overflow: true
|
|
@@ -9430,12 +9430,13 @@ var Position = class {
|
|
|
9430
9430
|
index++;
|
|
9431
9431
|
x += metrics.width;
|
|
9432
9432
|
if (element.type === "table" /* TABLE */ && !element.hide) {
|
|
9433
|
-
const tdPaddingWidth = tdPadding[1] + tdPadding[3];
|
|
9434
|
-
const tdPaddingHeight = tdPadding[0] + tdPadding[2];
|
|
9435
9433
|
for (let t = 0; t < element.trList.length; t++) {
|
|
9436
9434
|
const tr = element.trList[t];
|
|
9437
9435
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
9438
9436
|
const td = tr.tdList[d];
|
|
9437
|
+
const cellPadding = td.padding || tdPadding;
|
|
9438
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
9439
|
+
const cellPaddingHeight = cellPadding[0] + cellPadding[2];
|
|
9439
9440
|
td.positionList = [];
|
|
9440
9441
|
const rowList2 = td.rowList;
|
|
9441
9442
|
const drawRowResult = this.computePageRowPosition({
|
|
@@ -9444,9 +9445,9 @@ var Position = class {
|
|
|
9444
9445
|
pageNo,
|
|
9445
9446
|
startRowIndex: 0,
|
|
9446
9447
|
startIndex: 0,
|
|
9447
|
-
startX: (td.x +
|
|
9448
|
-
startY: (td.y +
|
|
9449
|
-
innerWidth: (td.width -
|
|
9448
|
+
startX: (td.x + cellPadding[3]) * scale + tablePreX + (element.translateX || 0) * scale,
|
|
9449
|
+
startY: (td.y + cellPadding[0]) * scale + tablePreY,
|
|
9450
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
9450
9451
|
isTable: true,
|
|
9451
9452
|
index: index - 1,
|
|
9452
9453
|
tdIndex: d,
|
|
@@ -9458,7 +9459,7 @@ var Position = class {
|
|
|
9458
9459
|
(pre, cur) => pre + cur.height,
|
|
9459
9460
|
0
|
|
9460
9461
|
);
|
|
9461
|
-
const blankHeight = (td.height -
|
|
9462
|
+
const blankHeight = (td.height - cellPaddingHeight) * scale - rowsHeight;
|
|
9462
9463
|
const offsetHeight = td.verticalAlign === "middle" /* MIDDLE */ ? blankHeight / 2 : blankHeight;
|
|
9463
9464
|
if (Math.floor(offsetHeight) > 0) {
|
|
9464
9465
|
td.positionList.forEach((tdPosition) => {
|
|
@@ -11752,6 +11753,10 @@ var TableParticle = class {
|
|
|
11752
11753
|
const height = td.height * scale;
|
|
11753
11754
|
const x = Math.round(td.x * scale + startX + width);
|
|
11754
11755
|
const y = Math.round(td.y * scale + startY);
|
|
11756
|
+
if (td.borderColor) {
|
|
11757
|
+
ctx.save();
|
|
11758
|
+
ctx.strokeStyle = td.borderColor;
|
|
11759
|
+
}
|
|
11755
11760
|
ctx.translate(0.5, 0.5);
|
|
11756
11761
|
ctx.beginPath();
|
|
11757
11762
|
if (td.borderTypes?.includes("top" /* TOP */)) {
|
|
@@ -11805,6 +11810,25 @@ var TableParticle = class {
|
|
|
11805
11810
|
ctx.stroke();
|
|
11806
11811
|
}
|
|
11807
11812
|
ctx.translate(-0.5, -0.5);
|
|
11813
|
+
if (td.borderColor && !isEmptyBorderType && !isExternalBorderType) {
|
|
11814
|
+
ctx.translate(0.5, 0.5);
|
|
11815
|
+
ctx.beginPath();
|
|
11816
|
+
if (td.rowIndex === 0) {
|
|
11817
|
+
ctx.moveTo(x - width, y);
|
|
11818
|
+
ctx.lineTo(x, y);
|
|
11819
|
+
}
|
|
11820
|
+
if (td.colIndex === 0) {
|
|
11821
|
+
ctx.moveTo(x - width, y);
|
|
11822
|
+
ctx.lineTo(x - width, y + height);
|
|
11823
|
+
}
|
|
11824
|
+
if (td.rowIndex === 0 || td.colIndex === 0) {
|
|
11825
|
+
ctx.stroke();
|
|
11826
|
+
}
|
|
11827
|
+
ctx.translate(-0.5, -0.5);
|
|
11828
|
+
}
|
|
11829
|
+
if (td.borderColor) {
|
|
11830
|
+
ctx.restore();
|
|
11831
|
+
}
|
|
11808
11832
|
}
|
|
11809
11833
|
}
|
|
11810
11834
|
ctx.restore();
|
|
@@ -17463,7 +17487,14 @@ var en_default = {
|
|
|
17463
17487
|
borderTdBottom: "Bottom",
|
|
17464
17488
|
borderTdLeft: "Left",
|
|
17465
17489
|
borderTdForward: "Forward",
|
|
17466
|
-
borderTdBack: "Back"
|
|
17490
|
+
borderTdBack: "Back",
|
|
17491
|
+
cellBackgroundColor: "Cell background color",
|
|
17492
|
+
tdBorderColor: "Cell border color",
|
|
17493
|
+
cellPadding: "Cell padding",
|
|
17494
|
+
cellPaddingCompact: "Compact (2px)",
|
|
17495
|
+
cellPaddingNormal: "Normal (4px)",
|
|
17496
|
+
cellPaddingComfortable: "Comfortable (8px)",
|
|
17497
|
+
cellPaddingNone: "No padding"
|
|
17467
17498
|
}
|
|
17468
17499
|
},
|
|
17469
17500
|
datePicker: {
|
|
@@ -17557,7 +17588,14 @@ var id_default = {
|
|
|
17557
17588
|
borderTdBottom: "Bawah",
|
|
17558
17589
|
borderTdLeft: "Kiri",
|
|
17559
17590
|
borderTdForward: "Maju",
|
|
17560
|
-
borderTdBack: "Mundur"
|
|
17591
|
+
borderTdBack: "Mundur",
|
|
17592
|
+
cellBackgroundColor: "Warna latar sel",
|
|
17593
|
+
tdBorderColor: "Warna garis sel",
|
|
17594
|
+
cellPadding: "Padding sel",
|
|
17595
|
+
cellPaddingCompact: "Rapat (2px)",
|
|
17596
|
+
cellPaddingNormal: "Normal (4px)",
|
|
17597
|
+
cellPaddingComfortable: "Lega (8px)",
|
|
17598
|
+
cellPaddingNone: "Tanpa padding"
|
|
17561
17599
|
}
|
|
17562
17600
|
},
|
|
17563
17601
|
datePicker: {
|
|
@@ -19898,7 +19936,7 @@ var TableOperate = class {
|
|
|
19898
19936
|
const row = rowCol[r];
|
|
19899
19937
|
for (let c = 0; c < row.length; c++) {
|
|
19900
19938
|
const col = row[c];
|
|
19901
|
-
col.backgroundColor = payload;
|
|
19939
|
+
col.backgroundColor = payload || void 0;
|
|
19902
19940
|
}
|
|
19903
19941
|
}
|
|
19904
19942
|
const { endIndex } = this.range.getRange();
|
|
@@ -19907,6 +19945,50 @@ var TableOperate = class {
|
|
|
19907
19945
|
isCompute: false
|
|
19908
19946
|
});
|
|
19909
19947
|
}
|
|
19948
|
+
tableTdBorderColor(payload) {
|
|
19949
|
+
const positionContext = this.position.getPositionContext();
|
|
19950
|
+
if (!positionContext.isTable) return;
|
|
19951
|
+
const { index } = positionContext;
|
|
19952
|
+
const originalElementList = this.draw.getOriginalElementList();
|
|
19953
|
+
const element = originalElementList[index];
|
|
19954
|
+
const rowCol = this.tableParticle.getRangeRowCol();
|
|
19955
|
+
if (!rowCol) return;
|
|
19956
|
+
const tdList = rowCol.flat();
|
|
19957
|
+
const totalCells = element.trList.reduce(
|
|
19958
|
+
(sum, tr) => sum + tr.tdList.length,
|
|
19959
|
+
0
|
|
19960
|
+
);
|
|
19961
|
+
const allSelected = tdList.length >= totalCells;
|
|
19962
|
+
if (allSelected) {
|
|
19963
|
+
element.borderColor = payload || void 0;
|
|
19964
|
+
element.trList.forEach(
|
|
19965
|
+
(tr) => tr.tdList.forEach((td) => {
|
|
19966
|
+
delete td.borderColor;
|
|
19967
|
+
})
|
|
19968
|
+
);
|
|
19969
|
+
} else {
|
|
19970
|
+
tdList.forEach((td) => {
|
|
19971
|
+
td.borderColor = payload || void 0;
|
|
19972
|
+
});
|
|
19973
|
+
}
|
|
19974
|
+
const { endIndex } = this.range.getRange();
|
|
19975
|
+
this.draw.render({
|
|
19976
|
+
curIndex: endIndex,
|
|
19977
|
+
isCompute: false
|
|
19978
|
+
});
|
|
19979
|
+
}
|
|
19980
|
+
tableTdPadding(payload) {
|
|
19981
|
+
const rowCol = this.tableParticle.getRangeRowCol();
|
|
19982
|
+
if (!rowCol) return;
|
|
19983
|
+
const tdList = rowCol.flat();
|
|
19984
|
+
tdList.forEach((td) => {
|
|
19985
|
+
td.padding = payload;
|
|
19986
|
+
});
|
|
19987
|
+
const { endIndex } = this.range.getRange();
|
|
19988
|
+
this.draw.render({
|
|
19989
|
+
curIndex: endIndex
|
|
19990
|
+
});
|
|
19991
|
+
}
|
|
19910
19992
|
tableSelectAll() {
|
|
19911
19993
|
const positionContext = this.position.getPositionContext();
|
|
19912
19994
|
const { index, tableId, isTable } = positionContext;
|
|
@@ -21389,8 +21471,6 @@ var Draw = class {
|
|
|
21389
21471
|
}
|
|
21390
21472
|
metrics.boundingBoxAscent = 0;
|
|
21391
21473
|
} else if (element.type === "table" /* TABLE */) {
|
|
21392
|
-
const tdPaddingWidth = tdPadding[1] + tdPadding[3];
|
|
21393
|
-
const tdPaddingHeight = tdPadding[0] + tdPadding[2];
|
|
21394
21474
|
if (element.pagingId) {
|
|
21395
21475
|
let tableIndex = i + 1;
|
|
21396
21476
|
let combineCount = 0;
|
|
@@ -21424,15 +21504,18 @@ var Draw = class {
|
|
|
21424
21504
|
const tr = trList[t];
|
|
21425
21505
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
21426
21506
|
const td = tr.tdList[d];
|
|
21507
|
+
const cellPadding = td.padding || tdPadding;
|
|
21508
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
21509
|
+
const cellPaddingHeight = cellPadding[0] + cellPadding[2];
|
|
21427
21510
|
const rowList2 = this.computeRowList({
|
|
21428
|
-
innerWidth: (td.width -
|
|
21511
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
21429
21512
|
elementList: td.value,
|
|
21430
21513
|
isFromTable: true,
|
|
21431
21514
|
isPagingMode
|
|
21432
21515
|
});
|
|
21433
21516
|
const rowHeight = rowList2.reduce((pre, cur) => pre + cur.height, 0);
|
|
21434
21517
|
td.rowList = rowList2;
|
|
21435
|
-
const curTdHeight = rowHeight / scale +
|
|
21518
|
+
const curTdHeight = rowHeight / scale + cellPaddingHeight;
|
|
21436
21519
|
if (td.height < curTdHeight) {
|
|
21437
21520
|
const extraHeight = curTdHeight - td.height;
|
|
21438
21521
|
const changeTr = trList[t + td.rowspan - 1];
|
|
@@ -21503,8 +21586,11 @@ var Draw = class {
|
|
|
21503
21586
|
const tr = constrainedTrList[t];
|
|
21504
21587
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
21505
21588
|
const td = tr.tdList[d];
|
|
21589
|
+
const cellPadding = td.padding || tdPadding;
|
|
21590
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
21591
|
+
const cellPaddingHeight = cellPadding[0] + cellPadding[2];
|
|
21506
21592
|
const tdRowList = this.computeRowList({
|
|
21507
|
-
innerWidth: (td.width -
|
|
21593
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
21508
21594
|
elementList: td.value,
|
|
21509
21595
|
isFromTable: true,
|
|
21510
21596
|
isPagingMode
|
|
@@ -21514,7 +21600,7 @@ var Draw = class {
|
|
|
21514
21600
|
0
|
|
21515
21601
|
);
|
|
21516
21602
|
td.rowList = tdRowList;
|
|
21517
|
-
const curTdHeight = rowHeight / scale +
|
|
21603
|
+
const curTdHeight = rowHeight / scale + cellPaddingHeight;
|
|
21518
21604
|
if (td.height < curTdHeight) {
|
|
21519
21605
|
const extraHeight = curTdHeight - td.height;
|
|
21520
21606
|
const changeTr = constrainedTrList[t + td.rowspan - 1];
|
|
@@ -22299,18 +22385,19 @@ var Draw = class {
|
|
|
22299
22385
|
}
|
|
22300
22386
|
index++;
|
|
22301
22387
|
if (element.type === "table" /* TABLE */ && !element.hide) {
|
|
22302
|
-
const tdPaddingWidth = tdPadding[1] + tdPadding[3];
|
|
22303
22388
|
for (let t = 0; t < element.trList.length; t++) {
|
|
22304
22389
|
const tr = element.trList[t];
|
|
22305
22390
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
22306
22391
|
const td = tr.tdList[d];
|
|
22392
|
+
const cellPadding = td.padding || tdPadding;
|
|
22393
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
22307
22394
|
this.drawRow(ctx, {
|
|
22308
22395
|
elementList: td.value,
|
|
22309
22396
|
positionList: td.positionList,
|
|
22310
22397
|
rowList: td.rowList,
|
|
22311
22398
|
pageNo,
|
|
22312
22399
|
startIndex: 0,
|
|
22313
|
-
innerWidth: (td.width -
|
|
22400
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
22314
22401
|
zone,
|
|
22315
22402
|
isDrawLineBreak
|
|
22316
22403
|
});
|
|
@@ -22774,6 +22861,8 @@ var Command = class {
|
|
|
22774
22861
|
this.executeTableTdBorderType = adapt.tableTdBorderType.bind(adapt);
|
|
22775
22862
|
this.executeTableTdSlashType = adapt.tableTdSlashType.bind(adapt);
|
|
22776
22863
|
this.executeTableTdBackgroundColor = adapt.tableTdBackgroundColor.bind(adapt);
|
|
22864
|
+
this.executeTableTdBorderColor = adapt.tableTdBorderColor.bind(adapt);
|
|
22865
|
+
this.executeTableTdPadding = adapt.tableTdPadding.bind(adapt);
|
|
22777
22866
|
this.executeTableSelectAll = adapt.tableSelectAll.bind(adapt);
|
|
22778
22867
|
this.executeImage = adapt.image.bind(adapt);
|
|
22779
22868
|
this.executeHyperlink = adapt.hyperlink.bind(adapt);
|
|
@@ -23755,6 +23844,16 @@ var CommandAdapt = class {
|
|
|
23755
23844
|
if (isReadonly) return;
|
|
23756
23845
|
this.tableOperate.tableTdBackgroundColor(payload);
|
|
23757
23846
|
}
|
|
23847
|
+
tableTdBorderColor(payload) {
|
|
23848
|
+
const isReadonly = this.draw.isReadonly();
|
|
23849
|
+
if (isReadonly) return;
|
|
23850
|
+
this.tableOperate.tableTdBorderColor(payload);
|
|
23851
|
+
}
|
|
23852
|
+
tableTdPadding(payload) {
|
|
23853
|
+
const isReadonly = this.draw.isReadonly();
|
|
23854
|
+
if (isReadonly) return;
|
|
23855
|
+
this.tableOperate.tableTdPadding(payload);
|
|
23856
|
+
}
|
|
23758
23857
|
tableSelectAll() {
|
|
23759
23858
|
this.tableOperate.tableSelectAll();
|
|
23760
23859
|
}
|
|
@@ -25227,7 +25326,14 @@ var INTERNAL_CONTEXT_MENU_KEY = {
|
|
|
25227
25326
|
DELETE_COL: "tableDeleteCol",
|
|
25228
25327
|
DELETE_TABLE: "tableDeleteTable",
|
|
25229
25328
|
MERGE_CELL: "tableMergeCell",
|
|
25230
|
-
CANCEL_MERGE_CELL: "tableCancelMergeCell"
|
|
25329
|
+
CANCEL_MERGE_CELL: "tableCancelMergeCell",
|
|
25330
|
+
TD_BG_COLOR: "tableTdBgColor",
|
|
25331
|
+
TD_BORDER_COLOR: "tableTdBorderColor",
|
|
25332
|
+
TD_PADDING: "tableTdPadding",
|
|
25333
|
+
TD_PADDING_COMPACT: "tableTdPaddingCompact",
|
|
25334
|
+
TD_PADDING_NORMAL: "tableTdPaddingNormal",
|
|
25335
|
+
TD_PADDING_COMFORTABLE: "tableTdPaddingComfortable",
|
|
25336
|
+
TD_PADDING_NONE: "tableTdPaddingNone"
|
|
25231
25337
|
}
|
|
25232
25338
|
};
|
|
25233
25339
|
|
|
@@ -25469,6 +25575,42 @@ var imageMenus = [
|
|
|
25469
25575
|
];
|
|
25470
25576
|
|
|
25471
25577
|
// src/core/contextmenu/menus/tableMenus.ts
|
|
25578
|
+
var COLOR_PALETTE = [
|
|
25579
|
+
{ name: "Black", value: "#000000" },
|
|
25580
|
+
{ name: "Dark gray", value: "#444444" },
|
|
25581
|
+
{ name: "Gray", value: "#888888" },
|
|
25582
|
+
{ name: "Light gray", value: "#cccccc" },
|
|
25583
|
+
{ name: "White", value: "#ffffff" },
|
|
25584
|
+
{ name: "Red", value: "#ff0000" },
|
|
25585
|
+
{ name: "Orange", value: "#ff9900" },
|
|
25586
|
+
{ name: "Yellow", value: "#ffff00" },
|
|
25587
|
+
{ name: "Green", value: "#00aa00" },
|
|
25588
|
+
{ name: "Cyan", value: "#00aaff" },
|
|
25589
|
+
{ name: "Blue", value: "#0000ff" },
|
|
25590
|
+
{ name: "Purple", value: "#9900ff" },
|
|
25591
|
+
{ name: "Pink", value: "#ff00aa" },
|
|
25592
|
+
{ name: "Light red", value: "#ffcccc" },
|
|
25593
|
+
{ name: "Light orange", value: "#ffeecc" },
|
|
25594
|
+
{ name: "Light yellow", value: "#ffffcc" },
|
|
25595
|
+
{ name: "Light green", value: "#ccffcc" },
|
|
25596
|
+
{ name: "Light blue", value: "#ccecff" },
|
|
25597
|
+
{ name: "Light purple", value: "#eeccff" }
|
|
25598
|
+
];
|
|
25599
|
+
function openNativeColorPicker(defaultColor, onSelect) {
|
|
25600
|
+
const input2 = document.createElement("input");
|
|
25601
|
+
input2.type = "color";
|
|
25602
|
+
input2.value = defaultColor;
|
|
25603
|
+
input2.style.cssText = "position:fixed;opacity:0;pointer-events:none;top:0;left:0;width:0;height:0";
|
|
25604
|
+
document.body.appendChild(input2);
|
|
25605
|
+
input2.addEventListener("change", () => {
|
|
25606
|
+
onSelect(input2.value);
|
|
25607
|
+
document.body.removeChild(input2);
|
|
25608
|
+
});
|
|
25609
|
+
input2.addEventListener("cancel", () => {
|
|
25610
|
+
document.body.removeChild(input2);
|
|
25611
|
+
});
|
|
25612
|
+
input2.click();
|
|
25613
|
+
}
|
|
25472
25614
|
var {
|
|
25473
25615
|
TABLE: {
|
|
25474
25616
|
BORDER,
|
|
@@ -25498,7 +25640,14 @@ var {
|
|
|
25498
25640
|
DELETE_COL,
|
|
25499
25641
|
DELETE_TABLE,
|
|
25500
25642
|
MERGE_CELL,
|
|
25501
|
-
CANCEL_MERGE_CELL
|
|
25643
|
+
CANCEL_MERGE_CELL,
|
|
25644
|
+
TD_BG_COLOR,
|
|
25645
|
+
TD_BORDER_COLOR,
|
|
25646
|
+
TD_PADDING,
|
|
25647
|
+
TD_PADDING_COMPACT,
|
|
25648
|
+
TD_PADDING_NORMAL,
|
|
25649
|
+
TD_PADDING_COMFORTABLE,
|
|
25650
|
+
TD_PADDING_NONE
|
|
25502
25651
|
}
|
|
25503
25652
|
} = INTERNAL_CONTEXT_MENU_KEY;
|
|
25504
25653
|
var tableMenus = [
|
|
@@ -25763,6 +25912,128 @@ var tableMenus = [
|
|
|
25763
25912
|
callback: (command) => {
|
|
25764
25913
|
command.executeCancelMergeTableCell();
|
|
25765
25914
|
}
|
|
25915
|
+
},
|
|
25916
|
+
{
|
|
25917
|
+
key: TD_BG_COLOR,
|
|
25918
|
+
i18nPath: "contextmenu.table.cellBackgroundColor",
|
|
25919
|
+
icon: "td-bg-color",
|
|
25920
|
+
when: (payload) => {
|
|
25921
|
+
return !payload.isReadonly && payload.isInTable && payload.options.mode !== "form" /* FORM */;
|
|
25922
|
+
},
|
|
25923
|
+
childMenus: [
|
|
25924
|
+
...COLOR_PALETTE.map((c) => ({
|
|
25925
|
+
key: `${TD_BG_COLOR}_${c.value}`,
|
|
25926
|
+
name: c.name,
|
|
25927
|
+
color: c.value,
|
|
25928
|
+
when: () => true,
|
|
25929
|
+
callback: (command) => {
|
|
25930
|
+
command.executeTableTdBackgroundColor(c.value);
|
|
25931
|
+
}
|
|
25932
|
+
})),
|
|
25933
|
+
{
|
|
25934
|
+
isDivider: true
|
|
25935
|
+
},
|
|
25936
|
+
{
|
|
25937
|
+
key: `${TD_BG_COLOR}_custom`,
|
|
25938
|
+
name: "Custom color...",
|
|
25939
|
+
when: () => true,
|
|
25940
|
+
callback: (command) => {
|
|
25941
|
+
openNativeColorPicker("#ffffff", (color) => {
|
|
25942
|
+
command.executeTableTdBackgroundColor(color);
|
|
25943
|
+
});
|
|
25944
|
+
}
|
|
25945
|
+
},
|
|
25946
|
+
{
|
|
25947
|
+
key: `${TD_BG_COLOR}_none`,
|
|
25948
|
+
name: "No fill",
|
|
25949
|
+
when: () => true,
|
|
25950
|
+
callback: (command) => {
|
|
25951
|
+
command.executeTableTdBackgroundColor("");
|
|
25952
|
+
}
|
|
25953
|
+
}
|
|
25954
|
+
]
|
|
25955
|
+
},
|
|
25956
|
+
{
|
|
25957
|
+
key: TD_BORDER_COLOR,
|
|
25958
|
+
i18nPath: "contextmenu.table.tdBorderColor",
|
|
25959
|
+
icon: "td-border-color",
|
|
25960
|
+
when: (payload) => {
|
|
25961
|
+
return !payload.isReadonly && payload.isInTable && payload.options.mode !== "form" /* FORM */;
|
|
25962
|
+
},
|
|
25963
|
+
childMenus: [
|
|
25964
|
+
...COLOR_PALETTE.map((c) => ({
|
|
25965
|
+
key: `${TD_BORDER_COLOR}_${c.value}`,
|
|
25966
|
+
name: c.name,
|
|
25967
|
+
color: c.value,
|
|
25968
|
+
when: () => true,
|
|
25969
|
+
callback: (command) => {
|
|
25970
|
+
command.executeTableTdBorderColor(c.value);
|
|
25971
|
+
}
|
|
25972
|
+
})),
|
|
25973
|
+
{
|
|
25974
|
+
isDivider: true
|
|
25975
|
+
},
|
|
25976
|
+
{
|
|
25977
|
+
key: `${TD_BORDER_COLOR}_custom`,
|
|
25978
|
+
name: "Custom color...",
|
|
25979
|
+
when: () => true,
|
|
25980
|
+
callback: (command) => {
|
|
25981
|
+
openNativeColorPicker("#000000", (color) => {
|
|
25982
|
+
command.executeTableTdBorderColor(color);
|
|
25983
|
+
});
|
|
25984
|
+
}
|
|
25985
|
+
},
|
|
25986
|
+
{
|
|
25987
|
+
key: `${TD_BORDER_COLOR}_reset`,
|
|
25988
|
+
name: "Reset to default",
|
|
25989
|
+
when: () => true,
|
|
25990
|
+
callback: (command) => {
|
|
25991
|
+
command.executeTableTdBorderColor("");
|
|
25992
|
+
}
|
|
25993
|
+
}
|
|
25994
|
+
]
|
|
25995
|
+
},
|
|
25996
|
+
{
|
|
25997
|
+
key: TD_PADDING,
|
|
25998
|
+
i18nPath: "contextmenu.table.cellPadding",
|
|
25999
|
+
icon: "td-padding",
|
|
26000
|
+
when: (payload) => {
|
|
26001
|
+
return !payload.isReadonly && payload.isInTable && payload.options.mode !== "form" /* FORM */;
|
|
26002
|
+
},
|
|
26003
|
+
childMenus: [
|
|
26004
|
+
{
|
|
26005
|
+
key: TD_PADDING_NONE,
|
|
26006
|
+
i18nPath: "contextmenu.table.cellPaddingNone",
|
|
26007
|
+
when: () => true,
|
|
26008
|
+
callback: (command) => {
|
|
26009
|
+
command.executeTableTdPadding([0, 0, 0, 0]);
|
|
26010
|
+
}
|
|
26011
|
+
},
|
|
26012
|
+
{
|
|
26013
|
+
key: TD_PADDING_COMPACT,
|
|
26014
|
+
i18nPath: "contextmenu.table.cellPaddingCompact",
|
|
26015
|
+
when: () => true,
|
|
26016
|
+
callback: (command) => {
|
|
26017
|
+
command.executeTableTdPadding([2, 4, 2, 4]);
|
|
26018
|
+
}
|
|
26019
|
+
},
|
|
26020
|
+
{
|
|
26021
|
+
key: TD_PADDING_NORMAL,
|
|
26022
|
+
i18nPath: "contextmenu.table.cellPaddingNormal",
|
|
26023
|
+
when: () => true,
|
|
26024
|
+
callback: (command) => {
|
|
26025
|
+
command.executeTableTdPadding([4, 5, 4, 5]);
|
|
26026
|
+
}
|
|
26027
|
+
},
|
|
26028
|
+
{
|
|
26029
|
+
key: TD_PADDING_COMFORTABLE,
|
|
26030
|
+
i18nPath: "contextmenu.table.cellPaddingComfortable",
|
|
26031
|
+
when: () => true,
|
|
26032
|
+
callback: (command) => {
|
|
26033
|
+
command.executeTableTdPadding([8, 12, 8, 12]);
|
|
26034
|
+
}
|
|
26035
|
+
}
|
|
26036
|
+
]
|
|
25766
26037
|
}
|
|
25767
26038
|
];
|
|
25768
26039
|
|
|
@@ -25968,6 +26239,11 @@ var ContextMenu = class {
|
|
|
25968
26239
|
if (menu.icon) {
|
|
25969
26240
|
icon.classList.add(`${EDITOR_PREFIX}-contextmenu-${menu.icon}`);
|
|
25970
26241
|
}
|
|
26242
|
+
if (menu.color) {
|
|
26243
|
+
const swatch = document.createElement("span");
|
|
26244
|
+
swatch.style.cssText = `display:inline-block;width:12px;height:12px;border-radius:2px;background:${menu.color};border:1px solid rgba(0,0,0,0.2);margin-right:4px;vertical-align:middle;flex-shrink:0`;
|
|
26245
|
+
menuItem.append(swatch);
|
|
26246
|
+
}
|
|
25971
26247
|
const span = document.createElement("span");
|
|
25972
26248
|
const name = menu.i18nPath ? this._formatName(this.i18n.t(menu.i18nPath)) : this._formatName(menu.name || "");
|
|
25973
26249
|
span.append(document.createTextNode(name));
|