@visactor/vtable-plugins 1.18.4-alpha.0 → 1.18.4-alpha.2

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.
@@ -44,9 +44,9 @@ class TableCarouselAnimationPlugin {
44
44
  var _a;
45
45
  if (!this.playing || this.table.isReleased) return;
46
46
  let animation = !0;
47
- const customRow = this.customDistRowFunction && this.customDistRowFunction(this.row, this.table);
48
- customRow ? (this.row = customRow.distRow, animation = null === (_a = customRow.animation) || void 0 === _a || _a) : isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== this.row ? (this.row = this.table.frozenRowCount,
49
- animation = !1) : isInteger(this.row) || this.table.scenegraph.proxy.screenTopRow === Math.floor(this.row) ? this.row += this.rowCount : (this.row = this.table.frozenRowCount,
47
+ const screenTopRow = Math.max(this.table.scenegraph.proxy.screenTopRow, this.table.frozenRowCount), customRow = this.customDistRowFunction && this.customDistRowFunction(this.row, this.table);
48
+ customRow ? (this.row = customRow.distRow, animation = null === (_a = customRow.animation) || void 0 === _a || _a) : isInteger(this.row) && screenTopRow !== this.row ? (this.row = this.table.frozenRowCount,
49
+ animation = !1) : isInteger(this.row) || screenTopRow === Math.floor(this.row) ? this.row += this.rowCount : (this.row = this.table.frozenRowCount,
50
50
  animation = !1), this.table.scrollToRow(this.row, animation ? {
51
51
  duration: this.animationDuration,
52
52
  easing: this.animationEasing
@@ -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;AAgBD,MAAa,4BAA4B;IAsBvC,YAAY,UAAgD,EAAE;;QArB9D,OAAE,GAAG,4BAA4B,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAC9C,SAAI,GAAG,0BAA0B,CAAC;QAClC,YAAO,GAAG,CAAC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;AA9ID,oEA8IC","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 id?: string;\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.id = options.id ?? this.id;\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"]}
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;AAgBD,MAAa,4BAA4B;IAsBvC,YAAY,UAAgD,EAAE;;QArB9D,OAAE,GAAG,4BAA4B,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAC9C,SAAI,GAAG,0BAA0B,CAAC;QAClC,YAAO,GAAG,CAAC,yBAAgB,CAAC,WAAW,CAAC,CAAC;QAYzC,kBAAa,GAAY,KAAK,CAAC;QAC/B,kBAAa,GAAY,KAAK,CAAC;QAO7B,IAAI,CAAC,EAAE,GAAG,MAAA,OAAO,CAAC,EAAE,mCAAI,IAAI,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,SAAS,CAAC;QAC/C,IAAI,CAAC,QAAQ,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,mCAAI,SAAS,CAAC;QAC/C,IAAI,CAAC,iBAAiB,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,iBAAiB,mCAAI,GAAG,CAAC;QAC3D,IAAI,CAAC,cAAc,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,mCAAI,IAAI,CAAC;QACtD,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eA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G,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;YACrC,SAAS,GAAG,KAAK,CAAC;SACnB;aAAM;YACL,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC;SAC3B;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,CACpB,IAAI,CAAC,GAAG,EACR,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,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;AA/ID,oEA+IC","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 id?: string;\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.id = options.id ?? this.id;\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 screenTopRow = Math.max(this.table.scenegraph.proxy.screenTopRow, this.table.frozenRowCount);\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) && screenTopRow !== this.row) {\n this.row = this.table.frozenRowCount;\n animation = false;\n } else if (!isInteger(this.row) && 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"]}
@@ -17334,16 +17334,17 @@
17334
17334
  return;
17335
17335
  }
17336
17336
  let animation = true;
17337
+ const screenTopRow = Math.max(this.table.scenegraph.proxy.screenTopRow, this.table.frozenRowCount);
17337
17338
  const customRow = this.customDistRowFunction && this.customDistRowFunction(this.row, this.table);
17338
17339
  if (customRow) {
17339
17340
  this.row = customRow.distRow;
17340
17341
  animation = customRow.animation ?? true;
17341
17342
  }
17342
- else if (isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== this.row) {
17343
+ else if (isInteger(this.row) && screenTopRow !== this.row) {
17343
17344
  this.row = this.table.frozenRowCount;
17344
17345
  animation = false;
17345
17346
  }
17346
- else if (!isInteger(this.row) && this.table.scenegraph.proxy.screenTopRow !== Math.floor(this.row)) {
17347
+ else if (!isInteger(this.row) && screenTopRow !== Math.floor(this.row)) {
17347
17348
  this.row = this.table.frozenRowCount;
17348
17349
  animation = false;
17349
17350
  }