@windoc/core 0.3.12 → 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.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var version = "0.3.
|
|
2
|
+
var version = "0.3.13";
|
|
3
3
|
|
|
4
4
|
// src/dataset/enum/Common.ts
|
|
5
5
|
var MaxHeightRatio = /* @__PURE__ */ ((MaxHeightRatio2) => {
|
|
@@ -4200,8 +4200,8 @@ var defaultSeparatorOption = {
|
|
|
4200
4200
|
|
|
4201
4201
|
// src/dataset/constant/Table.ts
|
|
4202
4202
|
var defaultTableOption = {
|
|
4203
|
-
tdPadding: [
|
|
4204
|
-
defaultTrMinHeight:
|
|
4203
|
+
tdPadding: [4, 5, 4, 5],
|
|
4204
|
+
defaultTrMinHeight: 22,
|
|
4205
4205
|
defaultColMinWidth: 40,
|
|
4206
4206
|
defaultBorderColor: "#000000",
|
|
4207
4207
|
overflow: true
|
|
@@ -9351,12 +9351,13 @@ var Position = class {
|
|
|
9351
9351
|
index++;
|
|
9352
9352
|
x += metrics.width;
|
|
9353
9353
|
if (element.type === "table" /* TABLE */ && !element.hide) {
|
|
9354
|
-
const tdPaddingWidth = tdPadding[1] + tdPadding[3];
|
|
9355
|
-
const tdPaddingHeight = tdPadding[0] + tdPadding[2];
|
|
9356
9354
|
for (let t = 0; t < element.trList.length; t++) {
|
|
9357
9355
|
const tr = element.trList[t];
|
|
9358
9356
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
9359
9357
|
const td = tr.tdList[d];
|
|
9358
|
+
const cellPadding = td.padding || tdPadding;
|
|
9359
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
9360
|
+
const cellPaddingHeight = cellPadding[0] + cellPadding[2];
|
|
9360
9361
|
td.positionList = [];
|
|
9361
9362
|
const rowList2 = td.rowList;
|
|
9362
9363
|
const drawRowResult = this.computePageRowPosition({
|
|
@@ -9365,9 +9366,9 @@ var Position = class {
|
|
|
9365
9366
|
pageNo,
|
|
9366
9367
|
startRowIndex: 0,
|
|
9367
9368
|
startIndex: 0,
|
|
9368
|
-
startX: (td.x +
|
|
9369
|
-
startY: (td.y +
|
|
9370
|
-
innerWidth: (td.width -
|
|
9369
|
+
startX: (td.x + cellPadding[3]) * scale + tablePreX + (element.translateX || 0) * scale,
|
|
9370
|
+
startY: (td.y + cellPadding[0]) * scale + tablePreY,
|
|
9371
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
9371
9372
|
isTable: true,
|
|
9372
9373
|
index: index - 1,
|
|
9373
9374
|
tdIndex: d,
|
|
@@ -9379,7 +9380,7 @@ var Position = class {
|
|
|
9379
9380
|
(pre, cur) => pre + cur.height,
|
|
9380
9381
|
0
|
|
9381
9382
|
);
|
|
9382
|
-
const blankHeight = (td.height -
|
|
9383
|
+
const blankHeight = (td.height - cellPaddingHeight) * scale - rowsHeight;
|
|
9383
9384
|
const offsetHeight = td.verticalAlign === "middle" /* MIDDLE */ ? blankHeight / 2 : blankHeight;
|
|
9384
9385
|
if (Math.floor(offsetHeight) > 0) {
|
|
9385
9386
|
td.positionList.forEach((tdPosition) => {
|
|
@@ -11673,6 +11674,10 @@ var TableParticle = class {
|
|
|
11673
11674
|
const height = td.height * scale;
|
|
11674
11675
|
const x = Math.round(td.x * scale + startX + width);
|
|
11675
11676
|
const y = Math.round(td.y * scale + startY);
|
|
11677
|
+
if (td.borderColor) {
|
|
11678
|
+
ctx.save();
|
|
11679
|
+
ctx.strokeStyle = td.borderColor;
|
|
11680
|
+
}
|
|
11676
11681
|
ctx.translate(0.5, 0.5);
|
|
11677
11682
|
ctx.beginPath();
|
|
11678
11683
|
if (td.borderTypes?.includes("top" /* TOP */)) {
|
|
@@ -11726,6 +11731,25 @@ var TableParticle = class {
|
|
|
11726
11731
|
ctx.stroke();
|
|
11727
11732
|
}
|
|
11728
11733
|
ctx.translate(-0.5, -0.5);
|
|
11734
|
+
if (td.borderColor && !isEmptyBorderType && !isExternalBorderType) {
|
|
11735
|
+
ctx.translate(0.5, 0.5);
|
|
11736
|
+
ctx.beginPath();
|
|
11737
|
+
if (td.rowIndex === 0) {
|
|
11738
|
+
ctx.moveTo(x - width, y);
|
|
11739
|
+
ctx.lineTo(x, y);
|
|
11740
|
+
}
|
|
11741
|
+
if (td.colIndex === 0) {
|
|
11742
|
+
ctx.moveTo(x - width, y);
|
|
11743
|
+
ctx.lineTo(x - width, y + height);
|
|
11744
|
+
}
|
|
11745
|
+
if (td.rowIndex === 0 || td.colIndex === 0) {
|
|
11746
|
+
ctx.stroke();
|
|
11747
|
+
}
|
|
11748
|
+
ctx.translate(-0.5, -0.5);
|
|
11749
|
+
}
|
|
11750
|
+
if (td.borderColor) {
|
|
11751
|
+
ctx.restore();
|
|
11752
|
+
}
|
|
11729
11753
|
}
|
|
11730
11754
|
}
|
|
11731
11755
|
ctx.restore();
|
|
@@ -17384,7 +17408,14 @@ var en_default = {
|
|
|
17384
17408
|
borderTdBottom: "Bottom",
|
|
17385
17409
|
borderTdLeft: "Left",
|
|
17386
17410
|
borderTdForward: "Forward",
|
|
17387
|
-
borderTdBack: "Back"
|
|
17411
|
+
borderTdBack: "Back",
|
|
17412
|
+
cellBackgroundColor: "Cell background color",
|
|
17413
|
+
tdBorderColor: "Cell border color",
|
|
17414
|
+
cellPadding: "Cell padding",
|
|
17415
|
+
cellPaddingCompact: "Compact (2px)",
|
|
17416
|
+
cellPaddingNormal: "Normal (4px)",
|
|
17417
|
+
cellPaddingComfortable: "Comfortable (8px)",
|
|
17418
|
+
cellPaddingNone: "No padding"
|
|
17388
17419
|
}
|
|
17389
17420
|
},
|
|
17390
17421
|
datePicker: {
|
|
@@ -17478,7 +17509,14 @@ var id_default = {
|
|
|
17478
17509
|
borderTdBottom: "Bawah",
|
|
17479
17510
|
borderTdLeft: "Kiri",
|
|
17480
17511
|
borderTdForward: "Maju",
|
|
17481
|
-
borderTdBack: "Mundur"
|
|
17512
|
+
borderTdBack: "Mundur",
|
|
17513
|
+
cellBackgroundColor: "Warna latar sel",
|
|
17514
|
+
tdBorderColor: "Warna garis sel",
|
|
17515
|
+
cellPadding: "Padding sel",
|
|
17516
|
+
cellPaddingCompact: "Rapat (2px)",
|
|
17517
|
+
cellPaddingNormal: "Normal (4px)",
|
|
17518
|
+
cellPaddingComfortable: "Lega (8px)",
|
|
17519
|
+
cellPaddingNone: "Tanpa padding"
|
|
17482
17520
|
}
|
|
17483
17521
|
},
|
|
17484
17522
|
datePicker: {
|
|
@@ -19819,7 +19857,7 @@ var TableOperate = class {
|
|
|
19819
19857
|
const row = rowCol[r];
|
|
19820
19858
|
for (let c = 0; c < row.length; c++) {
|
|
19821
19859
|
const col = row[c];
|
|
19822
|
-
col.backgroundColor = payload;
|
|
19860
|
+
col.backgroundColor = payload || void 0;
|
|
19823
19861
|
}
|
|
19824
19862
|
}
|
|
19825
19863
|
const { endIndex } = this.range.getRange();
|
|
@@ -19828,6 +19866,50 @@ var TableOperate = class {
|
|
|
19828
19866
|
isCompute: false
|
|
19829
19867
|
});
|
|
19830
19868
|
}
|
|
19869
|
+
tableTdBorderColor(payload) {
|
|
19870
|
+
const positionContext = this.position.getPositionContext();
|
|
19871
|
+
if (!positionContext.isTable) return;
|
|
19872
|
+
const { index } = positionContext;
|
|
19873
|
+
const originalElementList = this.draw.getOriginalElementList();
|
|
19874
|
+
const element = originalElementList[index];
|
|
19875
|
+
const rowCol = this.tableParticle.getRangeRowCol();
|
|
19876
|
+
if (!rowCol) return;
|
|
19877
|
+
const tdList = rowCol.flat();
|
|
19878
|
+
const totalCells = element.trList.reduce(
|
|
19879
|
+
(sum, tr) => sum + tr.tdList.length,
|
|
19880
|
+
0
|
|
19881
|
+
);
|
|
19882
|
+
const allSelected = tdList.length >= totalCells;
|
|
19883
|
+
if (allSelected) {
|
|
19884
|
+
element.borderColor = payload || void 0;
|
|
19885
|
+
element.trList.forEach(
|
|
19886
|
+
(tr) => tr.tdList.forEach((td) => {
|
|
19887
|
+
delete td.borderColor;
|
|
19888
|
+
})
|
|
19889
|
+
);
|
|
19890
|
+
} else {
|
|
19891
|
+
tdList.forEach((td) => {
|
|
19892
|
+
td.borderColor = payload || void 0;
|
|
19893
|
+
});
|
|
19894
|
+
}
|
|
19895
|
+
const { endIndex } = this.range.getRange();
|
|
19896
|
+
this.draw.render({
|
|
19897
|
+
curIndex: endIndex,
|
|
19898
|
+
isCompute: false
|
|
19899
|
+
});
|
|
19900
|
+
}
|
|
19901
|
+
tableTdPadding(payload) {
|
|
19902
|
+
const rowCol = this.tableParticle.getRangeRowCol();
|
|
19903
|
+
if (!rowCol) return;
|
|
19904
|
+
const tdList = rowCol.flat();
|
|
19905
|
+
tdList.forEach((td) => {
|
|
19906
|
+
td.padding = payload;
|
|
19907
|
+
});
|
|
19908
|
+
const { endIndex } = this.range.getRange();
|
|
19909
|
+
this.draw.render({
|
|
19910
|
+
curIndex: endIndex
|
|
19911
|
+
});
|
|
19912
|
+
}
|
|
19831
19913
|
tableSelectAll() {
|
|
19832
19914
|
const positionContext = this.position.getPositionContext();
|
|
19833
19915
|
const { index, tableId, isTable } = positionContext;
|
|
@@ -21310,8 +21392,6 @@ var Draw = class {
|
|
|
21310
21392
|
}
|
|
21311
21393
|
metrics.boundingBoxAscent = 0;
|
|
21312
21394
|
} else if (element.type === "table" /* TABLE */) {
|
|
21313
|
-
const tdPaddingWidth = tdPadding[1] + tdPadding[3];
|
|
21314
|
-
const tdPaddingHeight = tdPadding[0] + tdPadding[2];
|
|
21315
21395
|
if (element.pagingId) {
|
|
21316
21396
|
let tableIndex = i + 1;
|
|
21317
21397
|
let combineCount = 0;
|
|
@@ -21345,15 +21425,18 @@ var Draw = class {
|
|
|
21345
21425
|
const tr = trList[t];
|
|
21346
21426
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
21347
21427
|
const td = tr.tdList[d];
|
|
21428
|
+
const cellPadding = td.padding || tdPadding;
|
|
21429
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
21430
|
+
const cellPaddingHeight = cellPadding[0] + cellPadding[2];
|
|
21348
21431
|
const rowList2 = this.computeRowList({
|
|
21349
|
-
innerWidth: (td.width -
|
|
21432
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
21350
21433
|
elementList: td.value,
|
|
21351
21434
|
isFromTable: true,
|
|
21352
21435
|
isPagingMode
|
|
21353
21436
|
});
|
|
21354
21437
|
const rowHeight = rowList2.reduce((pre, cur) => pre + cur.height, 0);
|
|
21355
21438
|
td.rowList = rowList2;
|
|
21356
|
-
const curTdHeight = rowHeight / scale +
|
|
21439
|
+
const curTdHeight = rowHeight / scale + cellPaddingHeight;
|
|
21357
21440
|
if (td.height < curTdHeight) {
|
|
21358
21441
|
const extraHeight = curTdHeight - td.height;
|
|
21359
21442
|
const changeTr = trList[t + td.rowspan - 1];
|
|
@@ -21424,8 +21507,11 @@ var Draw = class {
|
|
|
21424
21507
|
const tr = constrainedTrList[t];
|
|
21425
21508
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
21426
21509
|
const td = tr.tdList[d];
|
|
21510
|
+
const cellPadding = td.padding || tdPadding;
|
|
21511
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
21512
|
+
const cellPaddingHeight = cellPadding[0] + cellPadding[2];
|
|
21427
21513
|
const tdRowList = this.computeRowList({
|
|
21428
|
-
innerWidth: (td.width -
|
|
21514
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
21429
21515
|
elementList: td.value,
|
|
21430
21516
|
isFromTable: true,
|
|
21431
21517
|
isPagingMode
|
|
@@ -21435,7 +21521,7 @@ var Draw = class {
|
|
|
21435
21521
|
0
|
|
21436
21522
|
);
|
|
21437
21523
|
td.rowList = tdRowList;
|
|
21438
|
-
const curTdHeight = rowHeight / scale +
|
|
21524
|
+
const curTdHeight = rowHeight / scale + cellPaddingHeight;
|
|
21439
21525
|
if (td.height < curTdHeight) {
|
|
21440
21526
|
const extraHeight = curTdHeight - td.height;
|
|
21441
21527
|
const changeTr = constrainedTrList[t + td.rowspan - 1];
|
|
@@ -22220,18 +22306,19 @@ var Draw = class {
|
|
|
22220
22306
|
}
|
|
22221
22307
|
index++;
|
|
22222
22308
|
if (element.type === "table" /* TABLE */ && !element.hide) {
|
|
22223
|
-
const tdPaddingWidth = tdPadding[1] + tdPadding[3];
|
|
22224
22309
|
for (let t = 0; t < element.trList.length; t++) {
|
|
22225
22310
|
const tr = element.trList[t];
|
|
22226
22311
|
for (let d = 0; d < tr.tdList.length; d++) {
|
|
22227
22312
|
const td = tr.tdList[d];
|
|
22313
|
+
const cellPadding = td.padding || tdPadding;
|
|
22314
|
+
const cellPaddingWidth = cellPadding[1] + cellPadding[3];
|
|
22228
22315
|
this.drawRow(ctx, {
|
|
22229
22316
|
elementList: td.value,
|
|
22230
22317
|
positionList: td.positionList,
|
|
22231
22318
|
rowList: td.rowList,
|
|
22232
22319
|
pageNo,
|
|
22233
22320
|
startIndex: 0,
|
|
22234
|
-
innerWidth: (td.width -
|
|
22321
|
+
innerWidth: (td.width - cellPaddingWidth) * scale,
|
|
22235
22322
|
zone,
|
|
22236
22323
|
isDrawLineBreak
|
|
22237
22324
|
});
|
|
@@ -22695,6 +22782,8 @@ var Command = class {
|
|
|
22695
22782
|
this.executeTableTdBorderType = adapt.tableTdBorderType.bind(adapt);
|
|
22696
22783
|
this.executeTableTdSlashType = adapt.tableTdSlashType.bind(adapt);
|
|
22697
22784
|
this.executeTableTdBackgroundColor = adapt.tableTdBackgroundColor.bind(adapt);
|
|
22785
|
+
this.executeTableTdBorderColor = adapt.tableTdBorderColor.bind(adapt);
|
|
22786
|
+
this.executeTableTdPadding = adapt.tableTdPadding.bind(adapt);
|
|
22698
22787
|
this.executeTableSelectAll = adapt.tableSelectAll.bind(adapt);
|
|
22699
22788
|
this.executeImage = adapt.image.bind(adapt);
|
|
22700
22789
|
this.executeHyperlink = adapt.hyperlink.bind(adapt);
|
|
@@ -23676,6 +23765,16 @@ var CommandAdapt = class {
|
|
|
23676
23765
|
if (isReadonly) return;
|
|
23677
23766
|
this.tableOperate.tableTdBackgroundColor(payload);
|
|
23678
23767
|
}
|
|
23768
|
+
tableTdBorderColor(payload) {
|
|
23769
|
+
const isReadonly = this.draw.isReadonly();
|
|
23770
|
+
if (isReadonly) return;
|
|
23771
|
+
this.tableOperate.tableTdBorderColor(payload);
|
|
23772
|
+
}
|
|
23773
|
+
tableTdPadding(payload) {
|
|
23774
|
+
const isReadonly = this.draw.isReadonly();
|
|
23775
|
+
if (isReadonly) return;
|
|
23776
|
+
this.tableOperate.tableTdPadding(payload);
|
|
23777
|
+
}
|
|
23679
23778
|
tableSelectAll() {
|
|
23680
23779
|
this.tableOperate.tableSelectAll();
|
|
23681
23780
|
}
|
|
@@ -25148,7 +25247,14 @@ var INTERNAL_CONTEXT_MENU_KEY = {
|
|
|
25148
25247
|
DELETE_COL: "tableDeleteCol",
|
|
25149
25248
|
DELETE_TABLE: "tableDeleteTable",
|
|
25150
25249
|
MERGE_CELL: "tableMergeCell",
|
|
25151
|
-
CANCEL_MERGE_CELL: "tableCancelMergeCell"
|
|
25250
|
+
CANCEL_MERGE_CELL: "tableCancelMergeCell",
|
|
25251
|
+
TD_BG_COLOR: "tableTdBgColor",
|
|
25252
|
+
TD_BORDER_COLOR: "tableTdBorderColor",
|
|
25253
|
+
TD_PADDING: "tableTdPadding",
|
|
25254
|
+
TD_PADDING_COMPACT: "tableTdPaddingCompact",
|
|
25255
|
+
TD_PADDING_NORMAL: "tableTdPaddingNormal",
|
|
25256
|
+
TD_PADDING_COMFORTABLE: "tableTdPaddingComfortable",
|
|
25257
|
+
TD_PADDING_NONE: "tableTdPaddingNone"
|
|
25152
25258
|
}
|
|
25153
25259
|
};
|
|
25154
25260
|
|
|
@@ -25390,6 +25496,42 @@ var imageMenus = [
|
|
|
25390
25496
|
];
|
|
25391
25497
|
|
|
25392
25498
|
// src/core/contextmenu/menus/tableMenus.ts
|
|
25499
|
+
var COLOR_PALETTE = [
|
|
25500
|
+
{ name: "Black", value: "#000000" },
|
|
25501
|
+
{ name: "Dark gray", value: "#444444" },
|
|
25502
|
+
{ name: "Gray", value: "#888888" },
|
|
25503
|
+
{ name: "Light gray", value: "#cccccc" },
|
|
25504
|
+
{ name: "White", value: "#ffffff" },
|
|
25505
|
+
{ name: "Red", value: "#ff0000" },
|
|
25506
|
+
{ name: "Orange", value: "#ff9900" },
|
|
25507
|
+
{ name: "Yellow", value: "#ffff00" },
|
|
25508
|
+
{ name: "Green", value: "#00aa00" },
|
|
25509
|
+
{ name: "Cyan", value: "#00aaff" },
|
|
25510
|
+
{ name: "Blue", value: "#0000ff" },
|
|
25511
|
+
{ name: "Purple", value: "#9900ff" },
|
|
25512
|
+
{ name: "Pink", value: "#ff00aa" },
|
|
25513
|
+
{ name: "Light red", value: "#ffcccc" },
|
|
25514
|
+
{ name: "Light orange", value: "#ffeecc" },
|
|
25515
|
+
{ name: "Light yellow", value: "#ffffcc" },
|
|
25516
|
+
{ name: "Light green", value: "#ccffcc" },
|
|
25517
|
+
{ name: "Light blue", value: "#ccecff" },
|
|
25518
|
+
{ name: "Light purple", value: "#eeccff" }
|
|
25519
|
+
];
|
|
25520
|
+
function openNativeColorPicker(defaultColor, onSelect) {
|
|
25521
|
+
const input2 = document.createElement("input");
|
|
25522
|
+
input2.type = "color";
|
|
25523
|
+
input2.value = defaultColor;
|
|
25524
|
+
input2.style.cssText = "position:fixed;opacity:0;pointer-events:none;top:0;left:0;width:0;height:0";
|
|
25525
|
+
document.body.appendChild(input2);
|
|
25526
|
+
input2.addEventListener("change", () => {
|
|
25527
|
+
onSelect(input2.value);
|
|
25528
|
+
document.body.removeChild(input2);
|
|
25529
|
+
});
|
|
25530
|
+
input2.addEventListener("cancel", () => {
|
|
25531
|
+
document.body.removeChild(input2);
|
|
25532
|
+
});
|
|
25533
|
+
input2.click();
|
|
25534
|
+
}
|
|
25393
25535
|
var {
|
|
25394
25536
|
TABLE: {
|
|
25395
25537
|
BORDER,
|
|
@@ -25419,7 +25561,14 @@ var {
|
|
|
25419
25561
|
DELETE_COL,
|
|
25420
25562
|
DELETE_TABLE,
|
|
25421
25563
|
MERGE_CELL,
|
|
25422
|
-
CANCEL_MERGE_CELL
|
|
25564
|
+
CANCEL_MERGE_CELL,
|
|
25565
|
+
TD_BG_COLOR,
|
|
25566
|
+
TD_BORDER_COLOR,
|
|
25567
|
+
TD_PADDING,
|
|
25568
|
+
TD_PADDING_COMPACT,
|
|
25569
|
+
TD_PADDING_NORMAL,
|
|
25570
|
+
TD_PADDING_COMFORTABLE,
|
|
25571
|
+
TD_PADDING_NONE
|
|
25423
25572
|
}
|
|
25424
25573
|
} = INTERNAL_CONTEXT_MENU_KEY;
|
|
25425
25574
|
var tableMenus = [
|
|
@@ -25684,6 +25833,128 @@ var tableMenus = [
|
|
|
25684
25833
|
callback: (command) => {
|
|
25685
25834
|
command.executeCancelMergeTableCell();
|
|
25686
25835
|
}
|
|
25836
|
+
},
|
|
25837
|
+
{
|
|
25838
|
+
key: TD_BG_COLOR,
|
|
25839
|
+
i18nPath: "contextmenu.table.cellBackgroundColor",
|
|
25840
|
+
icon: "td-bg-color",
|
|
25841
|
+
when: (payload) => {
|
|
25842
|
+
return !payload.isReadonly && payload.isInTable && payload.options.mode !== "form" /* FORM */;
|
|
25843
|
+
},
|
|
25844
|
+
childMenus: [
|
|
25845
|
+
...COLOR_PALETTE.map((c) => ({
|
|
25846
|
+
key: `${TD_BG_COLOR}_${c.value}`,
|
|
25847
|
+
name: c.name,
|
|
25848
|
+
color: c.value,
|
|
25849
|
+
when: () => true,
|
|
25850
|
+
callback: (command) => {
|
|
25851
|
+
command.executeTableTdBackgroundColor(c.value);
|
|
25852
|
+
}
|
|
25853
|
+
})),
|
|
25854
|
+
{
|
|
25855
|
+
isDivider: true
|
|
25856
|
+
},
|
|
25857
|
+
{
|
|
25858
|
+
key: `${TD_BG_COLOR}_custom`,
|
|
25859
|
+
name: "Custom color...",
|
|
25860
|
+
when: () => true,
|
|
25861
|
+
callback: (command) => {
|
|
25862
|
+
openNativeColorPicker("#ffffff", (color) => {
|
|
25863
|
+
command.executeTableTdBackgroundColor(color);
|
|
25864
|
+
});
|
|
25865
|
+
}
|
|
25866
|
+
},
|
|
25867
|
+
{
|
|
25868
|
+
key: `${TD_BG_COLOR}_none`,
|
|
25869
|
+
name: "No fill",
|
|
25870
|
+
when: () => true,
|
|
25871
|
+
callback: (command) => {
|
|
25872
|
+
command.executeTableTdBackgroundColor("");
|
|
25873
|
+
}
|
|
25874
|
+
}
|
|
25875
|
+
]
|
|
25876
|
+
},
|
|
25877
|
+
{
|
|
25878
|
+
key: TD_BORDER_COLOR,
|
|
25879
|
+
i18nPath: "contextmenu.table.tdBorderColor",
|
|
25880
|
+
icon: "td-border-color",
|
|
25881
|
+
when: (payload) => {
|
|
25882
|
+
return !payload.isReadonly && payload.isInTable && payload.options.mode !== "form" /* FORM */;
|
|
25883
|
+
},
|
|
25884
|
+
childMenus: [
|
|
25885
|
+
...COLOR_PALETTE.map((c) => ({
|
|
25886
|
+
key: `${TD_BORDER_COLOR}_${c.value}`,
|
|
25887
|
+
name: c.name,
|
|
25888
|
+
color: c.value,
|
|
25889
|
+
when: () => true,
|
|
25890
|
+
callback: (command) => {
|
|
25891
|
+
command.executeTableTdBorderColor(c.value);
|
|
25892
|
+
}
|
|
25893
|
+
})),
|
|
25894
|
+
{
|
|
25895
|
+
isDivider: true
|
|
25896
|
+
},
|
|
25897
|
+
{
|
|
25898
|
+
key: `${TD_BORDER_COLOR}_custom`,
|
|
25899
|
+
name: "Custom color...",
|
|
25900
|
+
when: () => true,
|
|
25901
|
+
callback: (command) => {
|
|
25902
|
+
openNativeColorPicker("#000000", (color) => {
|
|
25903
|
+
command.executeTableTdBorderColor(color);
|
|
25904
|
+
});
|
|
25905
|
+
}
|
|
25906
|
+
},
|
|
25907
|
+
{
|
|
25908
|
+
key: `${TD_BORDER_COLOR}_reset`,
|
|
25909
|
+
name: "Reset to default",
|
|
25910
|
+
when: () => true,
|
|
25911
|
+
callback: (command) => {
|
|
25912
|
+
command.executeTableTdBorderColor("");
|
|
25913
|
+
}
|
|
25914
|
+
}
|
|
25915
|
+
]
|
|
25916
|
+
},
|
|
25917
|
+
{
|
|
25918
|
+
key: TD_PADDING,
|
|
25919
|
+
i18nPath: "contextmenu.table.cellPadding",
|
|
25920
|
+
icon: "td-padding",
|
|
25921
|
+
when: (payload) => {
|
|
25922
|
+
return !payload.isReadonly && payload.isInTable && payload.options.mode !== "form" /* FORM */;
|
|
25923
|
+
},
|
|
25924
|
+
childMenus: [
|
|
25925
|
+
{
|
|
25926
|
+
key: TD_PADDING_NONE,
|
|
25927
|
+
i18nPath: "contextmenu.table.cellPaddingNone",
|
|
25928
|
+
when: () => true,
|
|
25929
|
+
callback: (command) => {
|
|
25930
|
+
command.executeTableTdPadding([0, 0, 0, 0]);
|
|
25931
|
+
}
|
|
25932
|
+
},
|
|
25933
|
+
{
|
|
25934
|
+
key: TD_PADDING_COMPACT,
|
|
25935
|
+
i18nPath: "contextmenu.table.cellPaddingCompact",
|
|
25936
|
+
when: () => true,
|
|
25937
|
+
callback: (command) => {
|
|
25938
|
+
command.executeTableTdPadding([2, 4, 2, 4]);
|
|
25939
|
+
}
|
|
25940
|
+
},
|
|
25941
|
+
{
|
|
25942
|
+
key: TD_PADDING_NORMAL,
|
|
25943
|
+
i18nPath: "contextmenu.table.cellPaddingNormal",
|
|
25944
|
+
when: () => true,
|
|
25945
|
+
callback: (command) => {
|
|
25946
|
+
command.executeTableTdPadding([4, 5, 4, 5]);
|
|
25947
|
+
}
|
|
25948
|
+
},
|
|
25949
|
+
{
|
|
25950
|
+
key: TD_PADDING_COMFORTABLE,
|
|
25951
|
+
i18nPath: "contextmenu.table.cellPaddingComfortable",
|
|
25952
|
+
when: () => true,
|
|
25953
|
+
callback: (command) => {
|
|
25954
|
+
command.executeTableTdPadding([8, 12, 8, 12]);
|
|
25955
|
+
}
|
|
25956
|
+
}
|
|
25957
|
+
]
|
|
25687
25958
|
}
|
|
25688
25959
|
];
|
|
25689
25960
|
|
|
@@ -25889,6 +26160,11 @@ var ContextMenu = class {
|
|
|
25889
26160
|
if (menu.icon) {
|
|
25890
26161
|
icon.classList.add(`${EDITOR_PREFIX}-contextmenu-${menu.icon}`);
|
|
25891
26162
|
}
|
|
26163
|
+
if (menu.color) {
|
|
26164
|
+
const swatch = document.createElement("span");
|
|
26165
|
+
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`;
|
|
26166
|
+
menuItem.append(swatch);
|
|
26167
|
+
}
|
|
25892
26168
|
const span = document.createElement("span");
|
|
25893
26169
|
const name = menu.i18nPath ? this._formatName(this.i18n.t(menu.i18nPath)) : this._formatName(menu.name || "");
|
|
25894
26170
|
span.append(document.createTextNode(name));
|