@ai-table/grid 0.1.44 → 0.1.46

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.
@@ -113,7 +113,7 @@ export declare class Coordinate {
113
113
  * 如果可以完整渲染,则返回 { isCanFullRender: true, offsetY: 0 }
114
114
  * 如果不能完整渲染,则返回 { isCanFullRender: false, offsetY: 需要偏移的 y 值 }
115
115
  */
116
- getAddRowButtonIsFullRenderInfo(aiTable: AITable): {
116
+ getAddRowButtonIsFullRenderInfo(aiTable: AITable, addRowIndex: number): {
117
117
  isCanFullRender: boolean;
118
118
  offsetY: number;
119
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"coordinate.d.ts","sourceRoot":"","sources":["../../../packages/grid/src/core/coordinate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAO/C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;GAEG;AACH,qBAAa,UAAU;IACnB,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,cAAc,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IAExB,iBAAiB,EAAE,cAAc,CAAM;IAEvC,oBAAoB,EAAE,cAAc,CAAM;IAE1C,WAAW,EAAE,MAAM,CAAC;IAEpB,cAAc,EAAE,MAAM,CAAC;IAEvB,YAAY,SAAM;IAElB,eAAe,SAAM;IACrB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAM;IACzD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAM;IAC5D,iBAAiB,EAA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,则返回 { isCanFullRender: true, offsetY: 0 }
1351
1351
  * 如果不能完整渲染,则返回 { isCanFullRender: false, offsetY: 需要偏移的 y 值 }
1352
1352
  */
1353
- getAddRowButtonIsFullRenderInfo(aiTable) {
1353
+ getAddRowButtonIsFullRenderInfo(aiTable, addRowIndex) {
1354
1354
  let offsetY = 0;
1355
- const gridData = aiTable.gridData();
1356
- const lastRowIndex = gridData.records.length - 1;
1357
- const { size: height, offset: y } = this.getCellMetaData(lastRowIndex, AITableRowColumnType.row);
1355
+ const { size: height, offset: y } = this.getCellMetaData(addRowIndex, AITableRowColumnType.row);
1358
1356
  const { scrollTop } = aiTable.context.scrollState();
1359
- const addButtonMaxY = y + height + AI_TABLE_ROW_HEIGHT;
1357
+ const addButtonMaxY = y + height;
1360
1358
  const containerMaxY = aiTable.context.containerRect().height + scrollTop - AI_TABLE_FIELD_STAT_CONTAINER_HEIGHT - AI_TABLE_CELL_LINE_BORDER * 4;
1361
1359
  if (addButtonMaxY > containerMaxY) {
1362
1360
  offsetY = addButtonMaxY - containerMaxY;
@@ -2819,11 +2817,15 @@ function toDateFieldValue(plainText, targetField, originData) {
2819
2817
  const value = texts && texts.length ? texts[0].trim() : plainText.trim();
2820
2818
  return transformDateValue(value);
2821
2819
  }
2820
+ function getTimeDay(value) {
2821
+ return new TinyDate(fromUnixTime(value)).startOfDay().getUnixTime();
2822
+ }
2822
2823
  function cellValueToSortValue$4(cellValue) {
2823
2824
  if (isUndefinedOrNull(cellValue) || !isDateValid(cellValue)) {
2824
2825
  return 0;
2825
2826
  }
2826
- return cellValue?.timestamp ?? 0;
2827
+ const value = cellValue?.timestamp ?? 0;
2828
+ return value > 0 ? getTimeDay(value) : 0;
2827
2829
  }
2828
2830
  function transformDateValue(text) {
2829
2831
  const date = isDateAndReturnDate(text);
@@ -3755,6 +3757,7 @@ const writeToAITable = async (aiTable, actions) => {
3755
3757
  const { value, newField } = getPasteValue(plainText, aiTableContent, recordIndex, fieldIndex, targetField, references);
3756
3758
  if (newField) {
3757
3759
  actions.setField(newField);
3760
+ visibleFields[targetColIndex] = newField;
3758
3761
  }
3759
3762
  if (value !== null) {
3760
3763
  try {
@@ -5674,7 +5677,7 @@ class AddRowLayout extends Layout {
5674
5677
  if (this.isFirst || this.isLast)
5675
5678
  return;
5676
5679
  this.renderCell({
5677
- width: this.columnWidth,
5680
+ width: this.columnWidth + AI_TABLE_CELL_LINE_BORDER,
5678
5681
  isHoverRow
5679
5682
  });
5680
5683
  }
@@ -6175,8 +6178,8 @@ class CellDrawer extends Drawer {
6175
6178
  }
6176
6179
  }
6177
6180
  // 单元格渲染
6178
- renderCell(render, ctx, columnWidth) {
6179
- const { field, cellValue, aiTable } = render;
6181
+ renderCell(render, ctx) {
6182
+ const { field, cellValue, aiTable, columnWidth } = render;
6180
6183
  const fieldType = field.type;
6181
6184
  const fieldMethod = FieldModelMap[fieldType];
6182
6185
  if (!fieldMethod.isValid(cellValue)) {
@@ -6642,7 +6645,7 @@ class CellDrawer extends Drawer {
6642
6645
  });
6643
6646
  }
6644
6647
  renderCellProgress(render, ctx) {
6645
- const { x, y, transformValue, columnWidth, style } = render;
6648
+ const { x, y, transformValue, columnWidth, style, isGroupFirstRender } = render;
6646
6649
  const colors = AITable.getColors();
6647
6650
  let validateTransformValue = transformValue;
6648
6651
  if (isUndefinedOrNull(validateTransformValue)) {
@@ -6654,31 +6657,41 @@ class CellDrawer extends Drawer {
6654
6657
  const offsetX = AI_TABLE_CELL_PADDING;
6655
6658
  const offsetY = (AI_TABLE_ROW_BLANK_HEIGHT - AI_TABLE_PROGRESS_BAR_HEIGHT) / 2;
6656
6659
  const textOffsetY = (AI_TABLE_ROW_BLANK_HEIGHT - textHeight) / 2;
6657
- // 绘制背景
6658
- this.rect({
6659
- x: x + offsetX,
6660
- y: y + offsetY,
6661
- width,
6662
- height,
6663
- radius: AI_TABLE_PROGRESS_BAR_RADIUS,
6664
- fill: colors.gray200
6665
- });
6666
- // 计算并绘制进度
6667
- const progressWidth = (validateTransformValue / 100) * width;
6668
- this.rect({
6669
- x: x + offsetX,
6670
- y: y + offsetY,
6671
- width: progressWidth,
6672
- height,
6673
- radius: AI_TABLE_PROGRESS_BAR_RADIUS,
6674
- fill: colors.success
6675
- });
6676
- this.text({
6677
- x: x + offsetX + width + AI_TABLE_TEXT_GAP,
6678
- y: y + textOffsetY,
6679
- text: `${validateTransformValue}%`,
6680
- fillStyle: colors.gray800
6681
- });
6660
+ if (isGroupFirstRender) {
6661
+ this.text({
6662
+ x: x + offsetX,
6663
+ y: y + textOffsetY,
6664
+ text: `${validateTransformValue}%`,
6665
+ fillStyle: colors.gray800
6666
+ });
6667
+ }
6668
+ else {
6669
+ // 绘制背景
6670
+ this.rect({
6671
+ x: x + offsetX,
6672
+ y: y + offsetY,
6673
+ width,
6674
+ height,
6675
+ radius: AI_TABLE_PROGRESS_BAR_RADIUS,
6676
+ fill: colors.gray200
6677
+ });
6678
+ // 计算并绘制进度
6679
+ const progressWidth = (validateTransformValue / 100) * width;
6680
+ this.rect({
6681
+ x: x + offsetX,
6682
+ y: y + offsetY,
6683
+ width: progressWidth,
6684
+ height,
6685
+ radius: AI_TABLE_PROGRESS_BAR_RADIUS,
6686
+ fill: colors.success
6687
+ });
6688
+ this.text({
6689
+ x: x + offsetX + width + AI_TABLE_TEXT_GAP,
6690
+ y: y + textOffsetY,
6691
+ text: `${validateTransformValue}%`,
6692
+ fillStyle: colors.gray800
6693
+ });
6694
+ }
6682
6695
  }
6683
6696
  renderCellMember(render, ctx) {
6684
6697
  const { references, x, y, field, transformValue, rowHeight, columnWidth, isActive } = render;
@@ -7008,14 +7021,14 @@ class GroupLayout extends Layout {
7008
7021
  });
7009
7022
  }
7010
7023
  const iconContainerWidth = AI_TABLE_ICON_COMMON_SIZE + AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
7011
- if (!isEmpty(groupValue) || field.type === AITableFieldType.checkbox) {
7024
+ if (!isEmpty(groupValue) || [AITableFieldType.checkbox, AITableFieldType.progress].includes(field.type)) {
7012
7025
  cellDrawer.initStyle(field, style);
7013
7026
  cellDrawer.renderCell({
7014
7027
  ...render,
7015
7028
  x: render.x + iconContainerWidth,
7016
7029
  columnWidth: render.columnWidth - iconContainerWidth,
7017
7030
  isGroupFirstRender: true
7018
- }, this.ctx, columnWidth);
7031
+ }, this.ctx);
7019
7032
  }
7020
7033
  else {
7021
7034
  const emptyGroupString = getI18nTextByKey(aiTable, AITableGridI18nKey.emptyGroup);
@@ -7199,11 +7212,11 @@ const createCells = (config) => {
7199
7212
  ctx.save();
7200
7213
  ctx.rect(realX, realY, width, rowHeight);
7201
7214
  ctx.clip();
7202
- cellDrawer.renderCell(render, ctx, columnWidth);
7215
+ cellDrawer.renderCell(render, ctx);
7203
7216
  ctx.restore();
7204
7217
  }
7205
7218
  else {
7206
- cellDrawer.renderCell(render, ctx, columnWidth);
7219
+ cellDrawer.renderCell(render, ctx);
7207
7220
  }
7208
7221
  break;
7209
7222
  }
@@ -9528,6 +9541,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
9528
9541
  class AITableGroups {
9529
9542
  constructor() {
9530
9543
  this.config = input.required();
9544
+ this.trackBy = (groupStat) => {
9545
+ return groupStat.groupRow._id + groupStat.columnIndex;
9546
+ };
9531
9547
  this.frozenColumnCount = computed(() => {
9532
9548
  const { coordinate } = this.config();
9533
9549
  return coordinate.frozenColumnCount ?? 0;
@@ -9563,7 +9579,7 @@ class AITableGroups {
9563
9579
  }
9564
9580
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AITableGroups, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9565
9581
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: AITableGroups, isStandalone: true, selector: "ai-table-groups", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
9566
- @for (groupCell of groupCells(); track $index) {
9582
+ @for (groupCell of groupCells(); track trackBy(groupCell.groupStat!)) {
9567
9583
  <ai-table-field-stat [config]="groupCell.groupStat!"></ai-table-field-stat>
9568
9584
  }
9569
9585
  `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: AITableFieldStat, selector: "ai-table-field-stat", inputs: ["config"], outputs: ["hover"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
@@ -9573,7 +9589,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
9573
9589
  args: [{
9574
9590
  selector: 'ai-table-groups',
9575
9591
  template: `
9576
- @for (groupCell of groupCells(); track $index) {
9592
+ @for (groupCell of groupCells(); track trackBy(groupCell.groupStat!)) {
9577
9593
  <ai-table-field-stat [config]="groupCell.groupStat!"></ai-table-field-stat>
9578
9594
  }
9579
9595
  `,
@@ -9796,6 +9812,7 @@ class AITableCoverCellEntry {
9796
9812
  isActive: isSelectedField(field._id, aiTable),
9797
9813
  x: renderX,
9798
9814
  y: renderY,
9815
+ groupOffset: columnWidth - width,
9799
9816
  columnWidth: width,
9800
9817
  rowHeight,
9801
9818
  cellValue,
@@ -9850,6 +9867,9 @@ class AITableFieldStats {
9850
9867
  this.config = input.required();
9851
9868
  this.hover = output();
9852
9869
  this.isHover = signal(false);
9870
+ this.trackBy = (groupStat) => {
9871
+ return groupStat.columnIndex;
9872
+ };
9853
9873
  this.statConfigs = computed(() => createFieldStats(this.config()));
9854
9874
  }
9855
9875
  onMouseenter(e) {
@@ -9861,7 +9881,7 @@ class AITableFieldStats {
9861
9881
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AITableFieldStats, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9862
9882
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: AITableFieldStats, isStandalone: true, selector: "ai-table-column-stats", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { hover: "hover" }, ngImport: i0, template: `
9863
9883
  <ko-group>
9864
- @for (config of statConfigs(); track $index) {
9884
+ @for (config of statConfigs(); track trackBy(config)) {
9865
9885
  <ai-table-field-stat [config]="config" (hover)="hover.emit($event)"></ai-table-field-stat>
9866
9886
  }
9867
9887
  </ko-group>
@@ -9873,7 +9893,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
9873
9893
  selector: 'ai-table-column-stats',
9874
9894
  template: `
9875
9895
  <ko-group>
9876
- @for (config of statConfigs(); track $index) {
9896
+ @for (config of statConfigs(); track trackBy(config)) {
9877
9897
  <ai-table-field-stat [config]="config" (hover)="hover.emit($event)"></ai-table-field-stat>
9878
9898
  }
9879
9899
  </ko-group>
@@ -9970,7 +9990,6 @@ class AITableRenderer {
9970
9990
  return {
9971
9991
  clipX: 0,
9972
9992
  clipY: AI_TABLE_FIELD_HEAD_HEIGHT,
9973
- clipWidth: this.frozenAreaWidth() + AI_TABLE_SHADOW_DEFAULT_WIDTH,
9974
9993
  clipHeight: this.gridContainerHeight()
9975
9994
  };
9976
9995
  });
@@ -10254,14 +10273,14 @@ class AITableCellRate extends CoverCellBase {
10254
10273
  this.whiteBgConfig = computed(() => {
10255
10274
  const { aiTable, render, field, recordId, coordinate } = this.config();
10256
10275
  const pointPosition = aiTable.context.pointPosition();
10257
- const { x, y } = render;
10276
+ const { x, y, groupOffset = 0 } = render;
10258
10277
  const { columnIndex } = pointPosition;
10259
10278
  const hasSelectedArea = aiTable.selection().selectedCells.size > 0 ||
10260
10279
  aiTable.selection().selectedRecords.size > 0 ||
10261
10280
  aiTable.selection().selectedFields.size > 0;
10262
10281
  const bgColor = hasSelectedArea ? null : Colors.white;
10263
10282
  return {
10264
- x: x - AI_TABLE_CELL_PADDING + AI_TABLE_CELL_BORDER,
10283
+ x: x - groupOffset - AI_TABLE_CELL_PADDING + AI_TABLE_CELL_BORDER,
10265
10284
  y: y + AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET,
10266
10285
  width: coordinate.getColumnWidth(columnIndex) - (AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET) * 2,
10267
10286
  height: AI_TABLE_ROW_BLANK_HEIGHT - (AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET),
@@ -10277,7 +10296,7 @@ class AITableCellRate extends CoverCellBase {
10277
10296
  });
10278
10297
  this.starConfigs = computed(() => {
10279
10298
  const { render, field, recordId, readonly, aiTable, coordinate } = this.config();
10280
- const { x, transformValue } = render;
10299
+ const { x, columnWidth, transformValue } = render;
10281
10300
  const max = AI_TABLE_RATE_MAX;
10282
10301
  const starY = (AI_TABLE_ROW_BLANK_HEIGHT - AI_TABLE_CELL_EMOJI_SIZE) / 2 + AI_TABLE_OFFSET;
10283
10302
  const pointPosition = aiTable.context.pointPosition();
@@ -10293,7 +10312,7 @@ class AITableCellRate extends CoverCellBase {
10293
10312
  this.pointerX() <= lastStarRightX &&
10294
10313
  this.pointerY() >= startTopY &&
10295
10314
  this.pointerY() <= startBottomY;
10296
- const renderWidth = coordinate.getColumnWidth(columnIndex) - AI_TABLE_CELL_PADDING;
10315
+ const renderWidth = columnWidth - AI_TABLE_CELL_PADDING;
10297
10316
  const starWidth = AI_TABLE_CELL_EMOJI_SIZE + AI_TABLE_CELL_EMOJI_PADDING;
10298
10317
  const maxStar = Math.min(max, Math.floor(renderWidth / starWidth));
10299
10318
  return [...Array(maxStar).keys()].map((item, index) => {
@@ -10340,7 +10359,9 @@ class AITableCellRate extends CoverCellBase {
10340
10359
  if (!pos)
10341
10360
  return;
10342
10361
  const { x, y } = pos;
10343
- this.pointerX.set(x);
10362
+ const { render } = this.config();
10363
+ const { groupOffset = 0 } = render;
10364
+ this.pointerX.set(x - groupOffset);
10344
10365
  this.pointerY.set(y);
10345
10366
  }
10346
10367
  koClick(e, index) {
@@ -10423,14 +10444,14 @@ class AITableCellProgress extends CoverCellBase {
10423
10444
  this.whiteBgConfig = computed(() => {
10424
10445
  const { aiTable, render, field, recordId, coordinate } = this.config();
10425
10446
  const pointPosition = aiTable.context.pointPosition();
10426
- const { x, y } = render;
10447
+ const { x, y, groupOffset = 0 } = render;
10427
10448
  const { columnIndex } = pointPosition;
10428
10449
  const hasSelectedArea = aiTable.selection().selectedCells.size > 0 ||
10429
10450
  aiTable.selection().selectedRecords.size > 0 ||
10430
10451
  aiTable.selection().selectedFields.size > 0;
10431
10452
  const bgColor = hasSelectedArea ? null : Colors.white;
10432
10453
  return {
10433
- x: x - AI_TABLE_CELL_PADDING + AI_TABLE_CELL_BORDER / 2,
10454
+ x: x - groupOffset - AI_TABLE_CELL_PADDING + AI_TABLE_CELL_BORDER / 2,
10434
10455
  y: y + AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET,
10435
10456
  width: coordinate.getColumnWidth(columnIndex) - (AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET) * 2 + AI_TABLE_CELL_BORDER / 2,
10436
10457
  height: AI_TABLE_ROW_BLANK_HEIGHT - (AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET),
@@ -10558,7 +10579,7 @@ class AITableCellProgress extends CoverCellBase {
10558
10579
  return;
10559
10580
  }
10560
10581
  const { render, aiTable, coordinate } = this.config();
10561
- const { x } = render;
10582
+ const { x, groupOffset = 0 } = render;
10562
10583
  const { scrollLeft } = aiTable.context.scrollState();
10563
10584
  const pointPosition = aiTable.context.pointPosition();
10564
10585
  const { columnIndex } = pointPosition;
@@ -10569,10 +10590,10 @@ class AITableCellProgress extends CoverCellBase {
10569
10590
  const point = stage.getPointerPosition();
10570
10591
  if (!point)
10571
10592
  return;
10572
- const dragX = point.x - columnLeftX - x;
10593
+ const dragX = point.x - columnLeftX - x - groupOffset;
10573
10594
  const minX = x;
10574
10595
  const maxX = x + this.railWidth();
10575
- let dragPointerX = point.x - columnLeftX;
10596
+ let dragPointerX = point.x - columnLeftX - groupOffset;
10576
10597
  if (dragPointerX < minX) {
10577
10598
  dragPointerX = minX;
10578
10599
  }
@@ -10593,7 +10614,7 @@ class AITableCellProgress extends CoverCellBase {
10593
10614
  }
10594
10615
  updateProgressValue(e) {
10595
10616
  const { render, aiTable, coordinate, actions, field, recordId } = this.config();
10596
- const { x } = render;
10617
+ const { x, groupOffset = 0 } = render;
10597
10618
  const { scrollLeft } = aiTable.context.scrollState();
10598
10619
  const pointPosition = aiTable.context.pointPosition();
10599
10620
  const { columnIndex } = pointPosition;
@@ -10604,7 +10625,7 @@ class AITableCellProgress extends CoverCellBase {
10604
10625
  const point = stage.getPointerPosition();
10605
10626
  if (!point)
10606
10627
  return;
10607
- const dragX = point.x - columnLeftX - x;
10628
+ const dragX = point.x - columnLeftX - x - groupOffset;
10608
10629
  const percentage = this.calculatePercentage(dragX);
10609
10630
  if (!this.readonly() && actions && actions.updateFieldValues) {
10610
10631
  actions.updateFieldValues([
@@ -13515,10 +13536,13 @@ class AITableGrid extends AITableGridBase {
13515
13536
  switch (targetName) {
13516
13537
  case AI_TABLE_ROW_ADD_BUTTON: {
13517
13538
  clearCoverCell(this.aiTable);
13539
+ const addRowIndex = (targetNameDetail.source
13540
+ ? this.aiTable.context.visibleRowsIndexMap().get(targetNameDetail.source)
13541
+ : this.aiTable.context.linearRows().length - 1) ?? -1;
13518
13542
  this.addRecord({
13519
13543
  forGroupId: targetNameDetail.source
13520
13544
  });
13521
- const { isCanFullRender, offsetY } = this.coordinate().getAddRowButtonIsFullRenderInfo(this.aiTable);
13545
+ const { isCanFullRender, offsetY } = this.coordinate().getAddRowButtonIsFullRenderInfo(this.aiTable, addRowIndex + 1);
13522
13546
  if (!isCanFullRender) {
13523
13547
  this.scrollAction({
13524
13548
  deltaX: 0,