@visactor/vtable-plugins 1.18.1 → 1.18.2-alpha.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/cjs/add-row-column.d.ts +1 -0
- package/cjs/add-row-column.js +1 -1
- package/cjs/add-row-column.js.map +1 -1
- package/cjs/carousel-animation.js.map +1 -1
- package/cjs/column-series.d.ts +2 -1
- package/cjs/column-series.js +5 -4
- package/cjs/column-series.js.map +1 -1
- package/cjs/excel-edit-cell-keyboard.d.ts +1 -0
- package/cjs/excel-edit-cell-keyboard.js +3 -2
- package/cjs/excel-edit-cell-keyboard.js.map +1 -1
- package/cjs/focus-highlight.d.ts +2 -1
- package/cjs/focus-highlight.js +6 -3
- package/cjs/focus-highlight.js.map +1 -1
- package/cjs/highlight-header-when-select-cell.d.ts +2 -0
- package/cjs/highlight-header-when-select-cell.js +5 -1
- package/cjs/highlight-header-when-select-cell.js.map +1 -1
- package/cjs/row-series.d.ts +2 -1
- package/cjs/row-series.js +5 -5
- package/cjs/row-series.js.map +1 -1
- package/cjs/table-carousel-animation.d.ts +1 -0
- package/cjs/table-carousel-animation.js +3 -2
- package/cjs/table-carousel-animation.js.map +1 -1
- package/dist/vtable-plugins.js +31 -21
- package/dist/vtable-plugins.min.js +1 -1
- package/es/add-row-column.d.ts +1 -0
- package/es/add-row-column.js +1 -1
- package/es/add-row-column.js.map +1 -1
- package/es/carousel-animation.js.map +1 -1
- package/es/column-series.d.ts +2 -1
- package/es/column-series.js +5 -4
- package/es/column-series.js.map +1 -1
- package/es/excel-edit-cell-keyboard.d.ts +1 -0
- package/es/excel-edit-cell-keyboard.js +3 -2
- package/es/excel-edit-cell-keyboard.js.map +1 -1
- package/es/focus-highlight.d.ts +2 -1
- package/es/focus-highlight.js +7 -4
- package/es/focus-highlight.js.map +1 -1
- package/es/highlight-header-when-select-cell.d.ts +2 -0
- package/es/highlight-header-when-select-cell.js +5 -1
- package/es/highlight-header-when-select-cell.js.map +1 -1
- package/es/row-series.d.ts +2 -1
- package/es/row-series.js +5 -5
- package/es/row-series.js.map +1 -1
- package/es/table-carousel-animation.d.ts +1 -0
- package/es/table-carousel-animation.js +3 -2
- package/es/table-carousel-animation.js.map +1 -1
- package/package.json +5 -5
package/cjs/row-series.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ export interface RowSeriesOptions {
|
|
|
3
3
|
rowCount: number;
|
|
4
4
|
fillRowRecord?: (index: number) => any;
|
|
5
5
|
rowSeriesNumber?: TYPES.IRowSeriesNumber;
|
|
6
|
-
|
|
6
|
+
autoExtendRowTriggerKeys?: ('ArrowDown' | 'Enter')[];
|
|
7
7
|
}
|
|
8
8
|
export declare class RowSeriesPlugin implements plugins.IVTablePlugin {
|
|
9
9
|
id: string;
|
|
10
|
+
name: string;
|
|
10
11
|
runTime: ("before_keydown" | "before_init")[];
|
|
11
12
|
pluginOptions: RowSeriesOptions;
|
|
12
13
|
table: ListTable;
|
package/cjs/row-series.js
CHANGED
|
@@ -8,14 +8,13 @@ const vtable_1 = require("@visactor/vtable");
|
|
|
8
8
|
|
|
9
9
|
class RowSeriesPlugin {
|
|
10
10
|
constructor(pluginOptions) {
|
|
11
|
-
this.id =
|
|
11
|
+
this.id = `row-series-${Date.now()}`, this.name = "Row Series", this.runTime = [ vtable_1.TABLE_EVENT_TYPE.BEFORE_INIT, vtable_1.TABLE_EVENT_TYPE.BEFORE_KEYDOWN ],
|
|
12
12
|
this.pluginOptions = Object.assign({
|
|
13
|
-
rowCount: 100
|
|
14
|
-
autoExtendRow: !0
|
|
13
|
+
rowCount: 100
|
|
15
14
|
}, pluginOptions);
|
|
16
15
|
}
|
|
17
16
|
run(...args) {
|
|
18
|
-
var _a;
|
|
17
|
+
var _a, _b;
|
|
19
18
|
if (args[1] === vtable_1.TABLE_EVENT_TYPE.BEFORE_INIT) {
|
|
20
19
|
const eventArgs = args[0], table = args[2];
|
|
21
20
|
this.table = table;
|
|
@@ -26,7 +25,8 @@ class RowSeriesPlugin {
|
|
|
26
25
|
width: "auto"
|
|
27
26
|
});
|
|
28
27
|
} else if (args[1] === vtable_1.TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {
|
|
29
|
-
|
|
28
|
+
const e = args[0].event;
|
|
29
|
+
(null === (_b = this.pluginOptions.autoExtendRowTriggerKeys) || void 0 === _b ? void 0 : _b.includes(e.key)) && this.table.stateManager.select.cellPos.row === this.table.rowCount - 1 && this.table.addRecord(this.pluginOptions.fillRowRecord ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount) : {});
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
}
|
package/cjs/row-series.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["row-series.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAkBpD,MAAa,eAAe;
|
|
1
|
+
{"version":3,"sources":["row-series.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAkBpD,MAAa,eAAe;IAO1B,YAAY,aAA+B;QAN3C,OAAE,GAAG,cAAc,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAChC,SAAI,GAAG,YAAY,CAAC;QACpB,YAAO,GAAG,CAAC,yBAAgB,CAAC,WAAW,EAAE,yBAAgB,CAAC,cAAc,CAAC,CAAC;QAKxE,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;IACvE,CAAC;IACD,GAAG,CAAC,GAAG,IAAW;;QAChB,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,yBAAgB,CAAC,WAAW,EAAE;YAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,MAAM,KAAK,GAAiB,IAAI,CAAC,CAAC,CAAC,CAAC;YACpC,IAAI,CAAC,KAAK,GAAG,KAAkB,CAAC;YAChC,MAAM,OAAO,GAAgC,SAAS,CAAC,OAAO,CAAC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CAAC,aAAa,CAAC,aAAa;oBAC9B,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC;oBAC3F,CAAC,CAAC,EAAE,CACP,CAAC;aACH;SACF;IACH,CAAC;CACF;AAjDD,0CAiDC","file":"row-series.js","sourcesContent":["import { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type { TYPES, BaseTableAPI, ListTable, ListTableConstructorOptions, plugins } from '@visactor/vtable';\n/**\n * 添加行和列的插件的配置选项\n */\nexport interface RowSeriesOptions {\n rowCount: number;\n fillRowRecord?: (index: number) => any;\n rowSeriesNumber?: TYPES.IRowSeriesNumber;\n /**\n * 是否自动扩展行\n * @default true\n */\n autoExtendRowTriggerKeys?: ('ArrowDown' | 'Enter')[];\n}\n/**\n * 生成行序号标题的插件\n */\nexport class RowSeriesPlugin implements plugins.IVTablePlugin {\n id = `row-series-${Date.now()}`;\n name = 'Row Series';\n runTime = [TABLE_EVENT_TYPE.BEFORE_INIT, TABLE_EVENT_TYPE.BEFORE_KEYDOWN];\n pluginOptions: RowSeriesOptions;\n table: ListTable;\n\n constructor(pluginOptions: RowSeriesOptions) {\n this.pluginOptions = Object.assign({ rowCount: 100 }, pluginOptions);\n }\n run(...args: any[]) {\n if (args[1] === TABLE_EVENT_TYPE.BEFORE_INIT) {\n const eventArgs = args[0];\n const table: BaseTableAPI = args[2];\n this.table = table as ListTable;\n const options: ListTableConstructorOptions = eventArgs.options;\n const records = options.records ?? [];\n //用空数据将records填充到pluginOptions.rowCount\n for (let i = records.length; i < this.pluginOptions.rowCount; i++) {\n records.push(this.pluginOptions.fillRowRecord ? this.pluginOptions.fillRowRecord(i) : {});\n }\n options.records = records;\n if (this.pluginOptions.rowSeriesNumber) {\n options.rowSeriesNumber = this.pluginOptions.rowSeriesNumber;\n if (!this.pluginOptions.rowSeriesNumber.width) {\n options.rowSeriesNumber.width = 'auto';\n }\n } else if (!options.rowSeriesNumber) {\n options.rowSeriesNumber = {\n width: 'auto'\n };\n }\n } else if (args[1] === TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {\n const eventArgs = args[0];\n\n const e = eventArgs.event;\n\n if (\n this.pluginOptions.autoExtendRowTriggerKeys?.includes(e.key) &&\n this.table.stateManager.select.cellPos.row === this.table.rowCount - 1\n ) {\n (this.table as ListTable).addRecord(\n this.pluginOptions.fillRowRecord\n ? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount)\n : {}\n );\n }\n }\n }\n}\n"]}
|
|
@@ -13,8 +13,9 @@ function isInteger(value) {
|
|
|
13
13
|
class TableCarouselAnimationPlugin {
|
|
14
14
|
constructor(options = {}) {
|
|
15
15
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
16
|
-
this.id =
|
|
17
|
-
this.
|
|
16
|
+
this.id = `table-carousel-animation-${Date.now()}`, this.name = "Table Carousel Animation",
|
|
17
|
+
this.runTime = [ vtable_1.TABLE_EVENT_TYPE.INITIALIZED ], this.willUpdateRow = !1,
|
|
18
|
+
this.willUpdateCol = !1, this.rowCount = null !== (_a = null == options ? void 0 : options.rowCount) && void 0 !== _a ? _a : void 0,
|
|
18
19
|
this.colCount = null !== (_b = null == options ? void 0 : options.colCount) && void 0 !== _b ? _b : void 0,
|
|
19
20
|
this.animationDuration = null !== (_c = null == options ? void 0 : options.animationDuration) && void 0 !== _c ? _c : 500,
|
|
20
21
|
this.animationDelay = null !== (_d = null == options ? void 0 : options.animationDelay) && void 0 !== _d ? _d : 1e3,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["table-carousel-animation.ts"],"names":[],"mappings":";;;AAEA,6CAAoD;AAEpD,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC;AACrC,CAAC;AAeD,MAAa,4BAA4B;
|
|
1
|
+
{"version":3,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,aAAa,GAAG,IAAI,CAAC;QAC1B,UAAU,CACR,GAAG,EAAE;YACH,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAC3B,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,CAAC,EAED,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAC7C,CAAC;IACJ,CAAC;IACD,OAAO;IAEP,CAAC;CACF;AA7ID,oEA6IC","file":"table-carousel-animation.js","sourcesContent":["import type { EasingType } from '@visactor/vtable/es/vrender';\nimport type { BaseTableAPI } from '@visactor/vtable/es/ts-types/base-table';\nimport { TABLE_EVENT_TYPE } from '@visactor/vtable';\nimport type * as VTable from '@visactor/vtable';\nfunction isInteger(value: number) {\n return Math.floor(value) === value;\n}\n\nexport interface ITableCarouselAnimationPluginOptions {\n rowCount?: number;\n colCount?: number;\n animationDuration?: number;\n animationDelay?: number;\n animationEasing?: EasingType;\n autoPlay?: boolean;\n autoPlayDelay?: number;\n\n customDistRowFunction?: (row: number, table: BaseTableAPI) => { distRow: number; animation?: boolean } | undefined;\n customDistColFunction?: (col: number, table: BaseTableAPI) => { distCol: number; animation?: boolean } | undefined;\n}\n\nexport class TableCarouselAnimationPlugin implements VTable.plugins.IVTablePlugin {\n id = `table-carousel-animation-${Date.now()}`;\n name = 'Table Carousel Animation';\n runTime = [TABLE_EVENT_TYPE.INITIALIZED];\n table: BaseTableAPI;\n\n rowCount: number;\n colCount: number;\n animationDuration: number;\n animationDelay: number;\n animationEasing: EasingType;\n\n playing: boolean;\n row: number;\n col: number;\n willUpdateRow: boolean = false;\n willUpdateCol: boolean = false;\n autoPlay: boolean;\n autoPlayDelay: number;\n\n customDistRowFunction?: (row: number, table: BaseTableAPI) => { distRow: number; animation?: boolean } | undefined;\n customDistColFunction?: (col: number, table: BaseTableAPI) => { distCol: number; animation?: boolean } | undefined;\n constructor(options: ITableCarouselAnimationPluginOptions = {}) {\n this.rowCount = options?.rowCount ?? undefined;\n this.colCount = options?.colCount ?? undefined;\n this.animationDuration = options?.animationDuration ?? 500;\n this.animationDelay = options?.animationDelay ?? 1000;\n this.animationEasing = options?.animationEasing ?? 'linear';\n this.autoPlay = options?.autoPlay ?? false;\n this.autoPlayDelay = options?.autoPlayDelay ?? 0;\n this.customDistColFunction = options.customDistColFunction;\n this.customDistRowFunction = options.customDistRowFunction;\n }\n run(...args: any[]) {\n if (!this.table) {\n this.table = args[2] as BaseTableAPI;\n }\n this.reset();\n\n if (this.autoPlay) {\n setTimeout(() => {\n this.play();\n }, this.autoPlayDelay);\n }\n }\n\n reset() {\n this.playing = false;\n this.row = this.table.frozenRowCount;\n this.col = this.table.frozenColCount;\n }\n\n play() {\n if (!this.table) {\n throw new Error('table is not initialized');\n }\n this.playing = true;\n\n if (this.rowCount && !this.willUpdateRow) {\n this.updateRow();\n } else if (this.colCount && !this.willUpdateCol) {\n this.updateCol();\n }\n }\n\n pause() {\n this.playing = false;\n }\n\n updateRow() {\n if (!this.playing || this.table.isReleased) {\n return;\n }\n\n let animation = true;\n const customRow = this.customDistRowFunction && this.customDistRowFunction(this.row, this.table);\n if (customRow) {\n this.row = customRow.distRow;\n animation = customRow.animation ?? true;\n } else if (isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== this.row) {\n this.row = this.table.frozenRowCount;\n animation = false;\n } else if (!isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== Math.floor(this.row)) {\n this.row = this.table.frozenRowCount;\n animation = false;\n } else {\n this.row += this.rowCount;\n }\n this.table.scrollToRow(\n this.row,\n animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined\n );\n this.willUpdateRow = true;\n setTimeout(\n () => {\n this.willUpdateRow = false;\n this.updateRow();\n },\n // animation ? this.animationDuration + this.animationDelay : 0\n this.animationDuration + this.animationDelay\n );\n }\n\n updateCol() {\n if (!this.playing || this.table.isReleased) {\n return;\n }\n\n let animation = true;\n const customCol = this.customDistColFunction && this.customDistColFunction(this.col, this.table);\n if (customCol) {\n this.col = customCol.distCol;\n animation = customCol.animation ?? true;\n } else if (isInteger(this.col) && this.table.scenegraph.proxy.screenLeftCol !== this.col) {\n this.col = this.table.frozenColCount;\n animation = false;\n } else if (!isInteger(this.col) && this.table.scenegraph.proxy.screenLeftCol !== Math.floor(this.col)) {\n this.col = this.table.frozenColCount;\n animation = false;\n } else {\n this.col += this.colCount;\n }\n\n this.table.scrollToCol(\n this.col,\n animation ? { duration: this.animationDuration, easing: this.animationEasing } : undefined\n );\n\n this.willUpdateCol = true;\n setTimeout(\n () => {\n this.willUpdateCol = false;\n this.updateCol();\n },\n // animation ? this.animationDuration + this.animationDelay : 0\n this.animationDuration + this.animationDelay\n );\n }\n release() {\n // do nothing\n }\n}\n"]}
|
package/dist/vtable-plugins.js
CHANGED
|
@@ -6390,7 +6390,8 @@
|
|
|
6390
6390
|
}
|
|
6391
6391
|
|
|
6392
6392
|
class AddRowColumnPlugin {
|
|
6393
|
-
id =
|
|
6393
|
+
id = `add-row-column-${Date.now()}`;
|
|
6394
|
+
name = 'Add Row Column';
|
|
6394
6395
|
runTime = [
|
|
6395
6396
|
VTable__namespace.TABLE_EVENT_TYPE.MOUSEENTER_CELL,
|
|
6396
6397
|
VTable__namespace.TABLE_EVENT_TYPE.MOUSELEAVE_CELL,
|
|
@@ -6734,13 +6735,14 @@
|
|
|
6734
6735
|
}
|
|
6735
6736
|
|
|
6736
6737
|
class ColumnSeriesPlugin {
|
|
6737
|
-
id =
|
|
6738
|
+
id = `column-series-${Date.now()}`;
|
|
6739
|
+
name = 'Column Series';
|
|
6738
6740
|
runTime = [VTable__namespace.TABLE_EVENT_TYPE.BEFORE_INIT, VTable__namespace.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];
|
|
6739
6741
|
pluginOptions;
|
|
6740
6742
|
table;
|
|
6741
6743
|
columns = [];
|
|
6742
6744
|
constructor(pluginOptions) {
|
|
6743
|
-
this.pluginOptions = Object.assign({ columnCount: 100
|
|
6745
|
+
this.pluginOptions = Object.assign({ columnCount: 100 }, pluginOptions);
|
|
6744
6746
|
}
|
|
6745
6747
|
run(...args) {
|
|
6746
6748
|
if (args[1] === VTable__namespace.TABLE_EVENT_TYPE.BEFORE_INIT) {
|
|
@@ -6754,9 +6756,8 @@
|
|
|
6754
6756
|
else if (args[1] === VTable__namespace.TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {
|
|
6755
6757
|
const eventArgs = args[0];
|
|
6756
6758
|
const e = eventArgs.event;
|
|
6757
|
-
if (e.key
|
|
6758
|
-
if (this.
|
|
6759
|
-
this.table.stateManager.select.cellPos.col === this.table.colCount - 1) {
|
|
6759
|
+
if (this.pluginOptions.autoExtendColumnTriggerKeys?.includes(e.key)) {
|
|
6760
|
+
if (this.table.stateManager.select.cellPos.col === this.table.colCount - 1) {
|
|
6760
6761
|
this.table.addColumn(this.generateColumn(this.table.colCount - 1));
|
|
6761
6762
|
}
|
|
6762
6763
|
}
|
|
@@ -6798,12 +6799,13 @@
|
|
|
6798
6799
|
}
|
|
6799
6800
|
|
|
6800
6801
|
class RowSeriesPlugin {
|
|
6801
|
-
id =
|
|
6802
|
+
id = `row-series-${Date.now()}`;
|
|
6803
|
+
name = 'Row Series';
|
|
6802
6804
|
runTime = [VTable.TABLE_EVENT_TYPE.BEFORE_INIT, VTable.TABLE_EVENT_TYPE.BEFORE_KEYDOWN];
|
|
6803
6805
|
pluginOptions;
|
|
6804
6806
|
table;
|
|
6805
6807
|
constructor(pluginOptions) {
|
|
6806
|
-
this.pluginOptions = Object.assign({ rowCount: 100
|
|
6808
|
+
this.pluginOptions = Object.assign({ rowCount: 100 }, pluginOptions);
|
|
6807
6809
|
}
|
|
6808
6810
|
run(...args) {
|
|
6809
6811
|
if (args[1] === VTable.TABLE_EVENT_TYPE.BEFORE_INIT) {
|
|
@@ -6831,20 +6833,19 @@
|
|
|
6831
6833
|
else if (args[1] === VTable.TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {
|
|
6832
6834
|
const eventArgs = args[0];
|
|
6833
6835
|
const e = eventArgs.event;
|
|
6834
|
-
if (e.key
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
this.
|
|
6838
|
-
|
|
6839
|
-
: {});
|
|
6840
|
-
}
|
|
6836
|
+
if (this.pluginOptions.autoExtendRowTriggerKeys?.includes(e.key) &&
|
|
6837
|
+
this.table.stateManager.select.cellPos.row === this.table.rowCount - 1) {
|
|
6838
|
+
this.table.addRecord(this.pluginOptions.fillRowRecord
|
|
6839
|
+
? this.pluginOptions.fillRowRecord(this.table.rowCount - this.table.columnHeaderLevelCount)
|
|
6840
|
+
: {});
|
|
6841
6841
|
}
|
|
6842
6842
|
}
|
|
6843
6843
|
}
|
|
6844
6844
|
}
|
|
6845
6845
|
|
|
6846
6846
|
class HighlightHeaderWhenSelectCellPlugin {
|
|
6847
|
-
id =
|
|
6847
|
+
id = `highlight-header-when-select-cell-${Date.now()}`;
|
|
6848
|
+
name = 'Highlight Header When Select Cell';
|
|
6848
6849
|
runTime = [
|
|
6849
6850
|
VTable.TABLE_EVENT_TYPE.INITIALIZED,
|
|
6850
6851
|
VTable.TABLE_EVENT_TYPE.SELECTED_CLEAR,
|
|
@@ -6985,6 +6986,10 @@
|
|
|
6985
6986
|
}
|
|
6986
6987
|
}
|
|
6987
6988
|
}
|
|
6989
|
+
update() {
|
|
6990
|
+
this.registerStyle();
|
|
6991
|
+
this.updateHighlight();
|
|
6992
|
+
}
|
|
6988
6993
|
release() {
|
|
6989
6994
|
this.rowHeaderRanges = [];
|
|
6990
6995
|
this.colHeaderRanges = [];
|
|
@@ -7001,7 +7006,8 @@
|
|
|
7001
7006
|
}
|
|
7002
7007
|
|
|
7003
7008
|
class ExcelEditCellKeyboardPlugin {
|
|
7004
|
-
id =
|
|
7009
|
+
id = `excel-edit-cell-keyboard-${Date.now()}`;
|
|
7010
|
+
name = 'Excel Edit Cell Keyboard';
|
|
7005
7011
|
runTime = [VTable__namespace.TABLE_EVENT_TYPE.INITIALIZED];
|
|
7006
7012
|
table;
|
|
7007
7013
|
pluginOptions;
|
|
@@ -7093,7 +7099,7 @@
|
|
|
7093
7099
|
}
|
|
7094
7100
|
|
|
7095
7101
|
class FocusHighlightPlugin {
|
|
7096
|
-
id =
|
|
7102
|
+
id = `focus-highlight-${Date.now()}`;
|
|
7097
7103
|
name = 'Focus Highlight';
|
|
7098
7104
|
runTime = [VTable.TABLE_EVENT_TYPE.INITIALIZED, VTable.TABLE_EVENT_TYPE.SELECTED_CELL, VTable.TABLE_EVENT_TYPE.SELECTED_CLEAR];
|
|
7099
7105
|
table;
|
|
@@ -7137,7 +7143,7 @@
|
|
|
7137
7143
|
this.setFocusHighlightRange(undefined);
|
|
7138
7144
|
}
|
|
7139
7145
|
}
|
|
7140
|
-
setFocusHighlightRange(range) {
|
|
7146
|
+
setFocusHighlightRange(range, forceUpdate = false) {
|
|
7141
7147
|
let cellRange;
|
|
7142
7148
|
if (range && 'start' in range && 'end' in range) {
|
|
7143
7149
|
cellRange = range;
|
|
@@ -7148,7 +7154,7 @@
|
|
|
7148
7154
|
end: range
|
|
7149
7155
|
};
|
|
7150
7156
|
}
|
|
7151
|
-
if (isSameRange$2(this.range, cellRange)) {
|
|
7157
|
+
if (isSameRange$2(this.range, cellRange) && !forceUpdate) {
|
|
7152
7158
|
return;
|
|
7153
7159
|
}
|
|
7154
7160
|
this.range = cellRange;
|
|
@@ -7223,13 +7229,17 @@
|
|
|
7223
7229
|
}
|
|
7224
7230
|
});
|
|
7225
7231
|
}
|
|
7232
|
+
update() {
|
|
7233
|
+
this.setFocusHighlightRange(this.range, true);
|
|
7234
|
+
}
|
|
7226
7235
|
}
|
|
7227
7236
|
|
|
7228
7237
|
function isInteger(value) {
|
|
7229
7238
|
return Math.floor(value) === value;
|
|
7230
7239
|
}
|
|
7231
7240
|
class TableCarouselAnimationPlugin {
|
|
7232
|
-
id =
|
|
7241
|
+
id = `table-carousel-animation-${Date.now()}`;
|
|
7242
|
+
name = 'Table Carousel Animation';
|
|
7233
7243
|
runTime = [VTable.TABLE_EVENT_TYPE.INITIALIZED];
|
|
7234
7244
|
table;
|
|
7235
7245
|
rowCount;
|