@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/es/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/es/row-series.js
CHANGED
|
@@ -2,14 +2,13 @@ import { TABLE_EVENT_TYPE } from "@visactor/vtable";
|
|
|
2
2
|
|
|
3
3
|
export class RowSeriesPlugin {
|
|
4
4
|
constructor(pluginOptions) {
|
|
5
|
-
this.id =
|
|
5
|
+
this.id = `row-series-${Date.now()}`, this.name = "Row Series", this.runTime = [ TABLE_EVENT_TYPE.BEFORE_INIT, TABLE_EVENT_TYPE.BEFORE_KEYDOWN ],
|
|
6
6
|
this.pluginOptions = Object.assign({
|
|
7
|
-
rowCount: 100
|
|
8
|
-
autoExtendRow: !0
|
|
7
|
+
rowCount: 100
|
|
9
8
|
}, pluginOptions);
|
|
10
9
|
}
|
|
11
10
|
run(...args) {
|
|
12
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
13
12
|
if (args[1] === TABLE_EVENT_TYPE.BEFORE_INIT) {
|
|
14
13
|
const eventArgs = args[0], table = args[2];
|
|
15
14
|
this.table = table;
|
|
@@ -20,7 +19,8 @@ export class RowSeriesPlugin {
|
|
|
20
19
|
width: "auto"
|
|
21
20
|
});
|
|
22
21
|
} else if (args[1] === TABLE_EVENT_TYPE.BEFORE_KEYDOWN) {
|
|
23
|
-
|
|
22
|
+
const e = args[0].event;
|
|
23
|
+
(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) : {});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
package/es/row-series.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["row-series.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAkBpD,MAAM,OAAO,eAAe;
|
|
1
|
+
{"version":3,"sources":["row-series.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAkBpD,MAAM,OAAO,eAAe;IAO1B,YAAY,aAA+B;QAN3C,OAAE,GAAG,cAAc,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAChC,SAAI,GAAG,YAAY,CAAC;QACpB,YAAO,GAAG,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,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,gBAAgB,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,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CAAC,EACtE;gBACC,IAAI,CAAC,KAAmB,CAAC,SAAS,CACjC,IAAI,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","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"]}
|
|
@@ -7,8 +7,9 @@ function isInteger(value) {
|
|
|
7
7
|
export class TableCarouselAnimationPlugin {
|
|
8
8
|
constructor(options = {}) {
|
|
9
9
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
|
-
this.id =
|
|
11
|
-
this.
|
|
10
|
+
this.id = `table-carousel-animation-${Date.now()}`, this.name = "Table Carousel Animation",
|
|
11
|
+
this.runTime = [ TABLE_EVENT_TYPE.INITIALIZED ], this.willUpdateRow = !1, this.willUpdateCol = !1,
|
|
12
|
+
this.rowCount = null !== (_a = null == options ? void 0 : options.rowCount) && void 0 !== _a ? _a : void 0,
|
|
12
13
|
this.colCount = null !== (_b = null == options ? void 0 : options.colCount) && void 0 !== _b ? _b : void 0,
|
|
13
14
|
this.animationDuration = null !== (_c = null == options ? void 0 : options.animationDuration) && void 0 !== _c ? _c : 500,
|
|
14
15
|
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,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,C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,EAAE,IAAI,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAC3F,CAAC;QAEF,IAAI,CAAC,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","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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vtable-plugins",
|
|
3
|
-
"version": "1.18.1",
|
|
3
|
+
"version": "1.18.2-alpha.1",
|
|
4
4
|
"description": "The search util of VTable",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "VisActor",
|
|
@@ -33,9 +33,11 @@
|
|
|
33
33
|
"@visactor/vutils": "~0.19.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@visactor/vtable": "1.18.1"
|
|
36
|
+
"@visactor/vtable": "1.18.2-alpha.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@visactor/vtable": "1.18.2-alpha.1",
|
|
40
|
+
"@visactor/vtable-editors": "1.18.2-alpha.1",
|
|
39
41
|
"@visactor/vchart": "1.13.3-alpha.2",
|
|
40
42
|
"@rushstack/eslint-patch": "~1.1.4",
|
|
41
43
|
"react": "^18.0.0",
|
|
@@ -77,10 +79,8 @@
|
|
|
77
79
|
"axios": "^1.4.0",
|
|
78
80
|
"@types/react-is": "^17.0.3",
|
|
79
81
|
"rollup-plugin-node-resolve": "5.2.0",
|
|
80
|
-
"@visactor/vtable": "1.18.1",
|
|
81
|
-
"@visactor/vtable-editors": "1.18.1",
|
|
82
|
-
"@internal/eslint-config": "0.0.1",
|
|
83
82
|
"@internal/bundler": "0.0.1",
|
|
83
|
+
"@internal/eslint-config": "0.0.1",
|
|
84
84
|
"@internal/ts-config": "0.0.1"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|