@ai-table/grid 0.0.54 → 0.0.55

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.
Files changed (52) hide show
  1. package/components/cell-editors/cell-editor.scss +1 -2
  2. package/components/index.d.ts +0 -1
  3. package/components/index.d.ts.map +1 -1
  4. package/constants/editor.d.ts.map +1 -1
  5. package/constants/grid.d.ts.map +1 -1
  6. package/constants/table.d.ts +1 -0
  7. package/constants/table.d.ts.map +1 -1
  8. package/esm2022/components/index.mjs +1 -2
  9. package/esm2022/constants/editor.mjs +2 -3
  10. package/esm2022/constants/grid.mjs +2 -2
  11. package/esm2022/constants/table.mjs +2 -1
  12. package/esm2022/grid-base.component.mjs +2 -2
  13. package/esm2022/grid.component.mjs +7 -2
  14. package/esm2022/renderer/components/cells/index.mjs +2 -1
  15. package/esm2022/renderer/components/cells/rate.component.mjs +150 -0
  16. package/esm2022/renderer/components/hover-cell.component.mjs +6 -5
  17. package/esm2022/renderer/creations/create-active-cell-border.mjs +3 -3
  18. package/esm2022/renderer/creations/create-cells.mjs +2 -2
  19. package/esm2022/renderer/drawers/cell-drawer.mjs +5 -6
  20. package/esm2022/renderer/interfaces/hover-cell.mjs +1 -1
  21. package/esm2022/renderer/renderer.component.mjs +6 -6
  22. package/esm2022/types/cell.mjs +1 -1
  23. package/esm2022/types/component-config.mjs +1 -1
  24. package/esm2022/types/grid.mjs +1 -1
  25. package/fesm2022/ai-table-grid.mjs +1231 -1100
  26. package/fesm2022/ai-table-grid.mjs.map +1 -1
  27. package/grid-base.component.d.ts +1 -1
  28. package/grid-base.component.d.ts.map +1 -1
  29. package/grid.component.d.ts.map +1 -1
  30. package/package.json +1 -1
  31. package/renderer/components/cells/index.d.ts +1 -0
  32. package/renderer/components/cells/index.d.ts.map +1 -1
  33. package/renderer/components/cells/rate.component.d.ts +38 -0
  34. package/renderer/components/cells/rate.component.d.ts.map +1 -0
  35. package/renderer/components/hover-cell.component.d.ts +2 -2
  36. package/renderer/components/hover-cell.component.d.ts.map +1 -1
  37. package/renderer/creations/create-cells.d.ts +2 -1
  38. package/renderer/creations/create-cells.d.ts.map +1 -1
  39. package/renderer/drawers/cell-drawer.d.ts.map +1 -1
  40. package/renderer/interfaces/hover-cell.d.ts.map +1 -1
  41. package/renderer/renderer.component.d.ts +4 -12
  42. package/renderer/renderer.component.d.ts.map +1 -1
  43. package/types/cell.d.ts +5 -2
  44. package/types/cell.d.ts.map +1 -1
  45. package/types/component-config.d.ts +5 -2
  46. package/types/component-config.d.ts.map +1 -1
  47. package/types/grid.d.ts +4 -1
  48. package/types/grid.d.ts.map +1 -1
  49. package/components/cell-editors/rating/rating-editor.component.d.ts +0 -7
  50. package/components/cell-editors/rating/rating-editor.component.d.ts.map +0 -1
  51. package/components/cell-editors/rating/rating-editor.component.scss +0 -10
  52. package/esm2022/components/cell-editors/rating/rating-editor.component.mjs +0 -24
@@ -47,7 +47,6 @@ import { ThyFormSubmitDirective, ThyFormModule, ThyUniqueCheckValidator } from '
47
47
  import { ThyNotifyService } from 'ngx-tethys/notify';
48
48
  import { ThyInputNumber } from 'ngx-tethys/input-number';
49
49
  import { ThySlider } from 'ngx-tethys/slider';
50
- import { ThyRate } from 'ngx-tethys/rate';
51
50
  import * as i1$2 from '@angular/common';
52
51
  import { CommonModule, NgClass, NgTemplateOutlet, NgComponentOutlet } from '@angular/common';
53
52
  import { ThyEmptyModule } from 'ngx-tethys/empty';
@@ -64,6 +63,7 @@ import { ThyAvatarModule } from 'ngx-tethys/avatar';
64
63
  import * as i3$1 from 'ngx-tethys/checkbox';
65
64
  import { ThyCheckboxModule } from 'ngx-tethys/checkbox';
66
65
  import { ThyProgress } from 'ngx-tethys/progress';
66
+ import { ThyRate } from 'ngx-tethys/rate';
67
67
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
68
68
  import { LRUCache } from 'lru-cache';
69
69
  import { fromUnixTime, subDays } from 'date-fns';
@@ -1804,24 +1804,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
1804
1804
  args: ['mousedown', ['$event']]
1805
1805
  }] } });
1806
1806
 
1807
- class RatingCellEditorComponent extends AbstractEditCellEditor {
1808
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RatingCellEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
1809
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: RatingCellEditorComponent, isStandalone: true, selector: "rating-cell-editor", host: { classAttribute: "d-flex align-items-center h-100 rating-cell-editor" }, usesInheritance: true, ngImport: i0, template: ` <thy-rate [(ngModel)]="modelValue" (ngModelChange)="update()"></thy-rate> `, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ThyRate, selector: "thy-rate", inputs: ["thyCount", "thyDisabled", "thyAllowHalf", "thyAllowClear", "thyTooltips", "thyIconTemplate"], outputs: ["thyItemHoverChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1810
- }
1811
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: RatingCellEditorComponent, decorators: [{
1812
- type: Component,
1813
- args: [{
1814
- selector: 'rating-cell-editor',
1815
- template: ` <thy-rate [(ngModel)]="modelValue" (ngModelChange)="update()"></thy-rate> `,
1816
- standalone: true,
1817
- changeDetection: ChangeDetectionStrategy.OnPush,
1818
- imports: [FormsModule, ThyRate],
1819
- host: {
1820
- class: 'd-flex align-items-center h-100 rating-cell-editor'
1821
- }
1822
- }]
1823
- }] });
1824
-
1825
1807
  class SelectOptionComponent {
1826
1808
  constructor() {
1827
1809
  this.field = input.required();
@@ -2383,7 +2365,6 @@ const GRID_CELL_EDITOR_MAP = {
2383
2365
  [AITableFieldType.select]: SelectCellEditorComponent,
2384
2366
  [AITableFieldType.number]: NumberCellEditorComponent,
2385
2367
  [AITableFieldType.date]: DateCellEditorComponent,
2386
- [AITableFieldType.rate]: RatingCellEditorComponent,
2387
2368
  [AITableFieldType.link]: LinkCellEditorComponent,
2388
2369
  [AITableFieldType.progress]: ProgressEditorComponent
2389
2370
  };
@@ -2460,6 +2441,7 @@ const AI_TABLE_PROGRESS_BAR_HEIGHT = 10;
2460
2441
  const AI_TABLE_PROGRESS_BAR_RADIUS = 5;
2461
2442
  const AI_TABLE_PROGRESS_TEXT_Width = 46;
2462
2443
  const AI_TABLE_POPOVER_LEFT_OFFSET = 4;
2444
+ const AI_TABLE_RATE_MAX = 5;
2463
2445
 
2464
2446
  const MIN_COLUMN_WIDTH = 80;
2465
2447
  const DBL_CLICK_EDIT_TYPE = [
@@ -2470,7 +2452,7 @@ const DBL_CLICK_EDIT_TYPE = [
2470
2452
  AITableFieldType.member,
2471
2453
  AITableFieldType.link
2472
2454
  ];
2473
- const MOUSEOVER_EDIT_TYPE = [AITableFieldType.progress, AITableFieldType.rate];
2455
+ const MOUSEOVER_EDIT_TYPE = [AITableFieldType.progress];
2474
2456
  const RowHeight = {
2475
2457
  Short: 32,
2476
2458
  Medium: 57,
@@ -6281,761 +6263,189 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
6281
6263
  }]
6282
6264
  }] });
6283
6265
 
6284
- // TODO: components下的cells组件考虑移出 components ,这些组件都属于
6285
-
6286
- var cellComponents = /*#__PURE__*/Object.freeze({
6287
- __proto__: null,
6288
- AITableCellAttachment: AITableCellAttachment,
6289
- AITableCellLink: AITableCellLink,
6290
- AITableCellRichtext: AITableCellRichtext
6291
- });
6292
-
6293
- const componentMap = {};
6294
- Object.values(cellComponents).forEach((cellComponent) => {
6295
- componentMap[cellComponent.fieldType] = cellComponent;
6296
- });
6297
-
6298
- function getHoverCell(aiTable) {
6299
- const pointPosition = aiTable.context.pointPosition();
6300
- const { fieldId, recordId } = getDetailByTargetName(pointPosition.realTargetName) ?? {};
6301
- if (!recordId || !fieldId) {
6302
- return;
6303
- }
6304
- const record = aiTable.recordsMap()[recordId];
6305
- const field = aiTable.fieldsMap()[fieldId];
6306
- if (!record || !field || !recordId || !fieldId) {
6307
- return;
6308
- }
6309
- const renderComponentDefinition = componentMap[field?.type];
6310
- if (!renderComponentDefinition) {
6311
- return;
6266
+ const createActiveCellBorder = (config) => {
6267
+ const { aiTable, coordinate, columnStartIndex, columnStopIndex, rowStartIndex, rowStopIndex } = config;
6268
+ const { linearRows } = aiTable.context;
6269
+ const { rowHeight, frozenColumnCount } = coordinate;
6270
+ const colors = AITable.getColors();
6271
+ const visibleColumns = AITable.getVisibleFields(aiTable);
6272
+ const activeCell = AITable.getActiveCell(aiTable);
6273
+ const totalColumnCount = visibleColumns.length;
6274
+ let activeCellBorder = null;
6275
+ let frozenActiveCellBorder = null;
6276
+ if (Array.isArray(activeCell) &&
6277
+ !!activeCell.length &&
6278
+ aiTable.context.visibleRowsIndexMap().has(activeCell[0]) &&
6279
+ aiTable.context.visibleColumnsIndexMap().has(activeCell[1])) {
6280
+ const fieldId = activeCell[1];
6281
+ const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, activeCell);
6282
+ const checkIsVisible = (rowIndex, columnIndex) => {
6283
+ if (columnIndex < frozenColumnCount) {
6284
+ return true;
6285
+ }
6286
+ return (rowIndex >= rowStartIndex && rowIndex <= rowStopIndex && columnIndex >= columnStartIndex && columnIndex <= columnStopIndex);
6287
+ };
6288
+ if (rowIndex != null && columnIndex != null && checkIsVisible(rowIndex, columnIndex)) {
6289
+ const { type } = linearRows()[rowIndex];
6290
+ if (type === AITableRowType.record) {
6291
+ const activeField = visibleColumns.find((field) => field._id === fieldId);
6292
+ if (activeField == null) {
6293
+ return {
6294
+ activeCellBorder,
6295
+ frozenActiveCellBorder
6296
+ };
6297
+ }
6298
+ const x = coordinate.getColumnOffset(columnIndex);
6299
+ const y = coordinate.getRowOffset(rowIndex);
6300
+ const columnWidth = coordinate.getColumnWidth(columnIndex);
6301
+ const isFrozenColumn = columnIndex < frozenColumnCount;
6302
+ const { offset, width } = getCellHorizontalPosition({
6303
+ columnWidth,
6304
+ columnIndex,
6305
+ columnCount: totalColumnCount
6306
+ });
6307
+ const currentConfig = {
6308
+ x: x + offset + AI_TABLE_OFFSET,
6309
+ y: y + AI_TABLE_OFFSET,
6310
+ width: width - AI_TABLE_OFFSET,
6311
+ height: rowHeight - AI_TABLE_OFFSET,
6312
+ strokeWidth: AI_TABLE_CELL_BORDER,
6313
+ stroke: colors.primary,
6314
+ fillEnabled: false,
6315
+ listening: false
6316
+ };
6317
+ if (isFrozenColumn) {
6318
+ frozenActiveCellBorder = currentConfig;
6319
+ }
6320
+ else {
6321
+ activeCellBorder = currentConfig;
6322
+ }
6323
+ }
6324
+ }
6312
6325
  }
6313
6326
  return {
6314
- field,
6315
- recordId,
6316
- fieldId,
6317
- renderComponentDefinition
6327
+ activeCellBorder,
6328
+ frozenActiveCellBorder
6318
6329
  };
6319
- }
6330
+ };
6320
6331
 
6321
- class AITableGridEventService {
6332
+ /**
6333
+ * 用于处理表格行或单元格的布局和绘制。
6334
+ * 它提供了基本的布局信息(如位置、大小等),并定义了常用的绘图方法(如渲染缩进区域、添加新字段的空白区域等)。
6335
+ * 该类继承自 Drawer,并被其他更具体的布局类(如 RecordRowLayout)扩展和使用
6336
+ */
6337
+ class Layout extends Drawer {
6322
6338
  constructor() {
6323
- this.dblClickEvent$ = new Subject();
6324
- this.mousedownEvent$ = new Subject();
6325
- this.mouseoverEvent$ = new Subject();
6326
- this.globalMouseoverEvent$ = new Subject();
6327
- this.globalMousedownEvent$ = new Subject();
6328
- this.destroyRef = inject(DestroyRef);
6329
- this.thyPopover = inject(ThyPopover);
6339
+ super(...arguments);
6340
+ // 定义当前单元格或行的位置
6341
+ this.x = 0;
6342
+ this.y = 0;
6343
+ // 行高
6344
+ this.rowHeight = 0;
6345
+ // 列宽
6346
+ this.columnWidth = 0;
6347
+ // 行索引
6348
+ this.rowIndex = 0;
6349
+ // 列索引
6350
+ this.columnIndex = 0;
6351
+ // 列数
6352
+ this.columnCount = 0;
6353
+ this.containerWidth = 0;
6330
6354
  }
6331
- initialize(aiTable, aiFieldRenderers) {
6332
- this.aiTable = aiTable;
6333
- this.aiFieldRenderers = aiFieldRenderers;
6355
+ // 用于初始化或重置布局的基本属性。这个方法通常在每次渲染新的一行或单元格时调用,确保布局信息是最新的
6356
+ init({ x, y, rowIndex, columnIndex, rowHeight, columnWidth, columnCount, containerWidth }) {
6357
+ this.x = x;
6358
+ this.y = y;
6359
+ this.rowIndex = rowIndex;
6360
+ this.columnIndex = columnIndex;
6361
+ this.rowHeight = rowHeight;
6362
+ this.columnWidth = columnWidth;
6363
+ this.columnCount = columnCount;
6364
+ this.containerWidth = containerWidth;
6334
6365
  }
6335
- registerEvents(element) {
6336
- fromEvent(element, 'dblclick', { passive: true })
6337
- .pipe(takeUntilDestroyed(this.destroyRef))
6338
- .subscribe((event) => {
6339
- this.dblClickEvent$.next(event);
6366
+ // 当前单元格是否是行的第一列
6367
+ get isFirst() {
6368
+ return this.columnIndex === 0;
6369
+ }
6370
+ // 当前单元格是否是行的最后一列
6371
+ get isLast() {
6372
+ return this.columnIndex === this.columnCount - 1;
6373
+ }
6374
+ renderAddFieldBlank({ isHoverRow, isCheckedRow }) {
6375
+ const rowHeight = this.rowHeight;
6376
+ const fill = isCheckedRow ? this.colors.itemActiveBgColor : isHoverRow ? this.colors.gray80 : this.colors.transparent;
6377
+ const addFieldBlankX = this.x + this.columnWidth + AI_TABLE_OFFSET;
6378
+ this.rect({
6379
+ x: addFieldBlankX,
6380
+ y: this.y + AI_TABLE_OFFSET,
6381
+ width: this.containerWidth - addFieldBlankX < AI_TABLE_FIELD_ADD_BUTTON_WIDTH
6382
+ ? AI_TABLE_FIELD_ADD_BUTTON_WIDTH
6383
+ : this.containerWidth - addFieldBlankX,
6384
+ height: rowHeight,
6385
+ fill
6340
6386
  });
6341
- fromEvent(element, 'mouseover', { passive: true })
6342
- .pipe(debounceTime(80), takeUntilDestroyed(this.destroyRef))
6343
- .subscribe((event) => {
6344
- this.mouseoverEvent$.next(event);
6387
+ }
6388
+ }
6389
+
6390
+ class AddRowLayout extends Layout {
6391
+ renderAddFieldBlank({ isHoverRow, isCheckedRow }) {
6392
+ super.renderAddFieldBlank({ isHoverRow, isCheckedRow });
6393
+ const rowHeight = this.rowHeight;
6394
+ const defaultWidth = AI_TABLE_FIELD_ADD_BUTTON_WIDTH;
6395
+ const width = this.containerWidth - this.x < defaultWidth ? defaultWidth : this.containerWidth - this.x;
6396
+ this.line({
6397
+ x: this.x + this.columnWidth,
6398
+ y: this.y,
6399
+ points: [0, rowHeight, width, rowHeight],
6400
+ stroke: this.colors.gray200
6345
6401
  });
6346
- fromEvent(document, 'mouseover', { passive: true })
6347
- .pipe(takeUntilDestroyed(this.destroyRef))
6348
- .subscribe((event) => {
6349
- this.globalMouseoverEvent$.next(event);
6402
+ }
6403
+ renderCell({ width, isHoverRow }) {
6404
+ const x = this.x;
6405
+ const y = this.y;
6406
+ const rowHeight = this.rowHeight;
6407
+ const fill = isHoverRow ? this.colors.gray80 : this.colors.transparent;
6408
+ this.rect({
6409
+ x,
6410
+ y: y + AI_TABLE_OFFSET,
6411
+ width: width,
6412
+ height: rowHeight,
6413
+ fill
6350
6414
  });
6351
- fromEvent(element, 'mousedown', { passive: true })
6352
- .pipe(takeUntilDestroyed(this.destroyRef))
6353
- .subscribe((event) => {
6354
- this.mousedownEvent$.next(event);
6415
+ this.line({
6416
+ x,
6417
+ y: y + rowHeight,
6418
+ points: [0, 0, width, 0],
6419
+ stroke: this.colors.gray200
6355
6420
  });
6356
- fromEvent(document, 'mousedown', { passive: true })
6357
- .pipe(takeUntilDestroyed(this.destroyRef))
6358
- .subscribe((event) => {
6359
- this.globalMousedownEvent$.next(event);
6360
- });
6361
- }
6362
- getEditorComponent(type) {
6363
- const filedRenderSchema = this.aiFieldRenderers && this.aiFieldRenderers[type];
6364
- if (filedRenderSchema && filedRenderSchema.editor) {
6365
- return {
6366
- component: filedRenderSchema.editor,
6367
- isInternalComponent: false
6368
- };
6369
- }
6370
- return {
6371
- component: GRID_CELL_EDITOR_MAP[type],
6372
- isInternalComponent: true
6373
- };
6374
- }
6375
- openEdit(cellDom) {
6376
- const { x, y, width, height } = cellDom.getBoundingClientRect();
6377
- const fieldId = cellDom.getAttribute('fieldId');
6378
- const recordId = cellDom.getAttribute('recordId');
6379
- const { component } = this.getEditorComponent(this.aiTable.fieldsMap()[fieldId].type);
6380
- const ref = this.thyPopover.open(component, {
6381
- origin: cellDom,
6382
- originPosition: {
6383
- x: x - 1,
6384
- y: y + 1,
6385
- width: width + 2,
6386
- height: height + 2
6387
- },
6388
- width: width + 1 + 'px',
6389
- height: height + 2 + 'px',
6390
- placement: 'top',
6391
- offset: -(height + 4),
6392
- minWidth: width,
6393
- initialState: {
6394
- fieldId: fieldId,
6395
- recordId: recordId,
6396
- aiTable: this.aiTable
6397
- },
6398
- panelClass: 'grid-cell-editor',
6399
- outsideClosable: false,
6400
- hasBackdrop: false,
6401
- manualClosure: true,
6402
- animationDisabled: true,
6403
- autoAdaptive: true
6404
- });
6405
- return ref;
6406
- }
6407
- getOriginPosition(aiTable, options) {
6408
- const { container, coordinate, recordId, fieldId, isHoverEdit } = options;
6409
- const { scrollState } = aiTable.context;
6410
- const { rowHeight, columnCount } = coordinate;
6411
- const cell = [recordId, fieldId];
6412
- const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, cell);
6413
- const originX = coordinate.getColumnOffset(columnIndex);
6414
- const originY = coordinate.getRowOffset(rowIndex);
6415
- const columnWidth = coordinate.getColumnWidth(columnIndex);
6416
- const { width: originWidth, offset: originOffset } = getCellHorizontalPosition({
6417
- columnWidth,
6418
- columnIndex,
6419
- columnCount
6420
- });
6421
- const originRect = container.getBoundingClientRect();
6422
- const isFrozenColumn = AITable.isFrozenColumn(aiTable, columnIndex);
6423
- const scrollLeft = isFrozenColumn ? 0 : scrollState().scrollLeft;
6424
- const scrollTop = scrollState().scrollTop;
6425
- const originPosition = {
6426
- x: originX + originOffset - scrollLeft + originRect.x,
6427
- y: originY - scrollTop + originRect.y,
6428
- width: originWidth,
6429
- height: rowHeight
6430
- };
6431
- let x = originPosition.x + getEditorBoxOffset();
6432
- let y = originPosition.y + getEditorBoxOffset();
6433
- let width = getEditorSpace(originPosition.width);
6434
- let height = getEditorSpace(originPosition.height);
6435
- // hover 编辑组件无边框
6436
- if (isHoverEdit) {
6437
- x = originPosition.x + getHoverEditorBoxOffset();
6438
- y = originPosition.y + getHoverEditorBoxOffset();
6439
- width = getHoverEditorSpace(originPosition.width);
6440
- height = getHoverEditorSpace(originPosition.height);
6441
- }
6442
- return {
6443
- ...originPosition,
6444
- x: x,
6445
- y: y,
6446
- width: width,
6447
- height: height
6448
- };
6449
- }
6450
- openCellEditor(aiTable, options) {
6451
- const { container, recordId, fieldId, isHoverEdit, references } = options;
6452
- const { component, isInternalComponent } = this.getEditorComponent(this.aiTable.fieldsMap()[fieldId].type);
6453
- const offsetOriginPosition = this.getOriginPosition(aiTable, options);
6454
- this.cellEditorPopoverRef = this.thyPopover.open(component, {
6455
- viewContainerRef: isInternalComponent ? undefined : options?.viewContainerRef,
6456
- origin: container,
6457
- originPosition: offsetOriginPosition,
6458
- width: offsetOriginPosition.width + 'px',
6459
- height: offsetOriginPosition.height + 'px',
6460
- minWidth: offsetOriginPosition.width + 'px',
6461
- placement: 'bottom',
6462
- offset: -offsetOriginPosition.height,
6463
- initialState: {
6464
- fieldId: fieldId,
6465
- recordId: recordId,
6466
- references,
6467
- aiTable: aiTable
6468
- },
6469
- panelClass: 'grid-cell-editor',
6470
- outsideClosable: true,
6471
- hasBackdrop: false,
6472
- manualClosure: true,
6473
- animationDisabled: true,
6474
- autoAdaptive: true
6475
- });
6476
- if (this.cellEditorPopoverRef) {
6477
- const wheelEvent = fromEvent(this.cellEditorPopoverRef.componentInstance.elementRef.nativeElement, 'wheel').subscribe((event) => {
6478
- const field = aiTable.fieldsMap()[fieldId];
6479
- if (field.type === AITableFieldType.text || field.type === AITableFieldType.richText) {
6480
- return;
6481
- }
6482
- event.preventDefault();
6483
- this.aiTable.context?.scrollAction({
6484
- deltaX: event.deltaX,
6485
- deltaY: event.deltaY,
6486
- shiftKey: event.shiftKey,
6487
- callback: () => {
6488
- const originPosition = this.getOriginPosition(aiTable, options);
6489
- const positionStrategy = this.cellEditorPopoverRef
6490
- .getOverlayRef()
6491
- .getConfig().positionStrategy;
6492
- positionStrategy.setOrigin(originPosition);
6493
- positionStrategy.apply();
6494
- }
6495
- });
6496
- });
6497
- this.cellEditorPopoverRef.afterClosed().subscribe(() => {
6498
- wheelEvent.unsubscribe();
6499
- this.cellEditorPopoverRef = null;
6500
- });
6501
- this.cellEditorPopoverRef.componentInstance.updateFieldValue.subscribe((value) => {
6502
- options.updateFieldValue(value);
6503
- });
6504
- }
6505
- return this.cellEditorPopoverRef;
6506
- }
6507
- closeCellEditor() {
6508
- if (this.cellEditorPopoverRef) {
6509
- this.cellEditorPopoverRef.close();
6510
- this.cellEditorPopoverRef = null;
6511
- }
6512
- }
6513
- getCurrentEditCell() {
6514
- if (this.cellEditorPopoverRef) {
6515
- const recordId = this.cellEditorPopoverRef.componentInstance?.recordId;
6516
- const fieldId = this.cellEditorPopoverRef.componentInstance?.fieldId;
6517
- if (recordId && fieldId) {
6518
- return {
6519
- recordId,
6520
- fieldId
6521
- };
6522
- }
6523
- return null;
6524
- }
6525
- return null;
6526
- }
6527
- openContextMenu(aiTable, options) {
6528
- const { origin, position, menuItems, targetName, viewContainerRef } = options;
6529
- const ref = this.thyPopover.open(AITableContextMenu, {
6530
- origin: origin,
6531
- originPosition: position,
6532
- placement: 'bottomLeft',
6533
- insideClosable: true,
6534
- viewContainerRef,
6535
- initialState: {
6536
- aiTable,
6537
- menuItems,
6538
- targetName,
6539
- position
6540
- }
6541
- });
6542
- return ref;
6543
- }
6544
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6545
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService }); }
6546
- }
6547
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, decorators: [{
6548
- type: Injectable
6549
- }] });
6550
-
6551
- class AITableGridBase {
6552
- constructor() {
6553
- this.aiRecords = model.required();
6554
- this.aiFields = model.required();
6555
- this.aiFieldsSizeMap = model.required();
6556
- this.aiContextMenuItems = input();
6557
- this.aiFieldConfig = input();
6558
- this.aiReadonly = input();
6559
- this.aiPlugins = input();
6560
- this.aiReferences = input.required();
6561
- this.aiBuildRenderDataFn = input();
6562
- this.aiGetI18nTextByKey = input();
6563
- this.aiKeywords = input();
6564
- this.AITableFieldType = AITableFieldType;
6565
- this.AITableSelectOptionStyle = AITableSelectOptionStyle;
6566
- this.isSelectedAll = computed(() => {
6567
- return this.aiTable.selection().selectedRecords.size === this.aiRecords().length;
6568
- });
6569
- this.aiTableInitialized = output();
6570
- this.aiAddRecord = output();
6571
- this.aiAddField = output();
6572
- this.aiMoveField = output();
6573
- this.aiUpdateFieldValue = output();
6574
- this.aiSetField = output();
6575
- this.aiSetFieldWidth = output();
6576
- this.aiClick = output();
6577
- this.aiDbClick = output();
6578
- this.fieldMenus = computed(() => {
6579
- const fieldMenusFn = this.aiFieldConfig()?.fieldMenus;
6580
- if (fieldMenusFn && this.aiTable) {
6581
- return fieldMenusFn(this.aiTable);
6582
- }
6583
- return [];
6584
- });
6585
- this.gridData = computed(() => {
6586
- if (this.aiBuildRenderDataFn && this.aiBuildRenderDataFn() && this.aiTable) {
6587
- return this.aiBuildRenderDataFn()(this.aiTable);
6588
- }
6589
- return {
6590
- records: this.aiRecords(),
6591
- fields: this.aiFields(),
6592
- fieldsSizeMap: this.aiFieldsSizeMap()
6593
- };
6594
- });
6595
- this.ngZone = inject(NgZone);
6596
- this.elementRef = inject(ElementRef);
6597
- this.destroyRef = inject(DestroyRef);
6598
- this.aiTableGridFieldService = inject(AITableGridFieldService);
6599
- this.aiTableGridEventService = inject(AITableGridEventService);
6600
- this.aiTableGridSelectionService = inject(AITableGridSelectionService);
6601
- }
6602
- ngOnInit() {
6603
- this.initAITable();
6604
- this.initService();
6605
- }
6606
- initAITable() {
6607
- this.aiTable = createAITable(this.aiRecords, this.aiFields, this.gridData);
6608
- if (this.aiGetI18nTextByKey()) {
6609
- this.aiTable.getI18nTextByKey = this.aiGetI18nTextByKey();
6610
- }
6611
- this.aiPlugins()?.forEach((plugin) => {
6612
- this.aiTable = plugin(this.aiTable);
6613
- });
6614
- this.aiTableInitialized.emit(this.aiTable);
6615
- }
6616
- initService() {
6617
- this.aiTableGridEventService.initialize(this.aiTable, this.aiFieldConfig()?.fieldRenderers);
6618
- this.aiTableGridSelectionService.initialize(this.aiTable);
6619
- this.aiTableGridEventService.registerEvents(this.elementRef.nativeElement);
6620
- this.aiTableGridFieldService.initAIFieldConfig(this.aiFieldConfig());
6621
- AI_TABLE_GRID_FIELD_SERVICE_MAP.set(this.aiTable, this.aiTableGridFieldService);
6622
- }
6623
- addRecord() {
6624
- const records = this.aiRecords();
6625
- const recordCount = records.length;
6626
- this.aiAddRecord.emit({
6627
- originId: recordCount > 0 ? records[records.length - 1]._id : ''
6628
- });
6629
- }
6630
- selectRecord(recordId) {
6631
- this.aiTableGridSelectionService.selectRecord(recordId);
6632
- }
6633
- toggleSelectAll(checked) {
6634
- this.aiTableGridSelectionService.toggleSelectAll(checked);
6635
- }
6636
- addField(gridColumnBlank, position) {
6637
- const field = createDefaultField(this.aiTable, AITableFieldType.text);
6638
- const popoverRef = this.aiTableGridFieldService.editFieldProperty(this.aiTable, {
6639
- field,
6640
- isUpdate: false,
6641
- origin: gridColumnBlank,
6642
- position
6643
- });
6644
- if (popoverRef && !this.aiFieldConfig()?.fieldSettingComponent) {
6645
- popoverRef.componentInstance.addField.subscribe((defaultValue) => {
6646
- const fields = this.gridData().fields;
6647
- const fieldCount = fields.length;
6648
- this.aiAddField.emit({
6649
- originId: fieldCount > 0 ? fields[fields.length - 1]._id : '',
6650
- defaultValue
6651
- });
6652
- });
6653
- }
6654
- }
6655
- subscribeEvents() {
6656
- this.ngZone.runOutsideAngular(() => {
6657
- this.aiTableGridEventService.dblClickEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
6658
- this.dblClick(event);
6659
- });
6660
- this.aiTableGridEventService.mousedownEvent$
6661
- .pipe(mergeWith(this.aiTableGridEventService.globalMousedownEvent$), takeUntilDestroyed(this.destroyRef))
6662
- .subscribe((event) => {
6663
- this.aiTableGridSelectionService.updateSelect(event);
6664
- });
6665
- this.aiTableGridEventService.mouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
6666
- this.mouseoverHandle(event);
6667
- });
6668
- this.aiTableGridEventService.globalMouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
6669
- this.closeHoverCellEditor(event);
6670
- });
6671
- });
6672
- }
6673
- dblClick(event) {
6674
- const cellDom = event.target.closest('.grid-cell');
6675
- const type = cellDom && cellDom.getAttribute('type');
6676
- if (type && DBL_CLICK_EDIT_TYPE.includes(type)) {
6677
- this.aiTableGridEventService.openEdit(cellDom);
6678
- }
6679
- }
6680
- mouseoverHandle(event) {
6681
- if (this.mouseoverRef) {
6682
- this.mouseoverRef?.close();
6683
- }
6684
- const cellDom = event.target.closest('.grid-cell');
6685
- const type = cellDom && cellDom.getAttribute('type');
6686
- if (type && MOUSEOVER_EDIT_TYPE.includes(type)) {
6687
- this.mouseoverRef = this.aiTableGridEventService.openEdit(cellDom);
6688
- }
6689
- }
6690
- closeHoverCellEditor(e) {
6691
- if (this.mouseoverRef) {
6692
- const hasGrid = e.target && e.target.closest('.ai-table-grid');
6693
- const hasCellEditor = e.target && e.target.closest('.grid-cell-editor');
6694
- if (!hasGrid && !hasCellEditor) {
6695
- this.mouseoverRef.close();
6696
- }
6697
- }
6698
- }
6699
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6700
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableGridBase, isStandalone: true, selector: "ai-table-grid-base", inputs: { aiRecords: { classPropertyName: "aiRecords", publicName: "aiRecords", isSignal: true, isRequired: true, transformFunction: null }, aiFields: { classPropertyName: "aiFields", publicName: "aiFields", isSignal: true, isRequired: true, transformFunction: null }, aiFieldsSizeMap: { classPropertyName: "aiFieldsSizeMap", publicName: "aiFieldsSizeMap", isSignal: true, isRequired: true, transformFunction: null }, aiContextMenuItems: { classPropertyName: "aiContextMenuItems", publicName: "aiContextMenuItems", isSignal: true, isRequired: false, transformFunction: null }, aiFieldConfig: { classPropertyName: "aiFieldConfig", publicName: "aiFieldConfig", isSignal: true, isRequired: false, transformFunction: null }, aiReadonly: { classPropertyName: "aiReadonly", publicName: "aiReadonly", isSignal: true, isRequired: false, transformFunction: null }, aiPlugins: { classPropertyName: "aiPlugins", publicName: "aiPlugins", isSignal: true, isRequired: false, transformFunction: null }, aiReferences: { classPropertyName: "aiReferences", publicName: "aiReferences", isSignal: true, isRequired: true, transformFunction: null }, aiBuildRenderDataFn: { classPropertyName: "aiBuildRenderDataFn", publicName: "aiBuildRenderDataFn", isSignal: true, isRequired: false, transformFunction: null }, aiGetI18nTextByKey: { classPropertyName: "aiGetI18nTextByKey", publicName: "aiGetI18nTextByKey", isSignal: true, isRequired: false, transformFunction: null }, aiKeywords: { classPropertyName: "aiKeywords", publicName: "aiKeywords", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { aiRecords: "aiRecordsChange", aiFields: "aiFieldsChange", aiFieldsSizeMap: "aiFieldsSizeMapChange", aiTableInitialized: "aiTableInitialized", aiAddRecord: "aiAddRecord", aiAddField: "aiAddField", aiMoveField: "aiMoveField", aiUpdateFieldValue: "aiUpdateFieldValue", aiSetField: "aiSetField", aiSetFieldWidth: "aiSetFieldWidth", aiClick: "aiClick", aiDbClick: "aiDbClick" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6701
- }
6702
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, decorators: [{
6703
- type: Component,
6704
- args: [{
6705
- selector: 'ai-table-grid-base',
6706
- template: '',
6707
- standalone: true,
6708
- changeDetection: ChangeDetectionStrategy.OnPush
6709
- }]
6710
- }] });
6711
-
6712
- class AITableDomGrid extends AITableGridBase {
6713
- ngOnInit() {
6714
- super.ngOnInit();
6715
- this.subscribeEvents();
6716
- }
6717
- openFieldMenu(e, field, fieldAction) {
6718
- const moreBtn = e.target.closest('.grid-field-action');
6719
- this.aiTableGridFieldService.openFieldMenu(this.aiTable, {
6720
- origin: moreBtn,
6721
- editOrigin: fieldAction,
6722
- fieldId: field._id,
6723
- fieldMenus: this.fieldMenus()
6724
- });
6725
- }
6726
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
6727
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableDomGrid, isStandalone: true, selector: "ai-table-dom-grid", host: { classAttribute: "ai-table-grid ai-table-dom-grid" }, providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], usesInheritance: true, ngImport: i0, template: "<div class=\"grid-header d-flex\">\n <div class=\"grid-column-checkbox grid-cell grid-checkbox\">\n <label thyCheckbox thyLabelText=\"\" [ngModel]=\"isSelectedAll()\" (ngModelChange)=\"toggleSelectAll($event)\"></label>\n </div>\n @for (field of gridData().fields; track field._id) {\n <div\n class=\"grid-cell grid-field\"\n #fieldAction\n [attr.fieldId]=\"field._id\"\n [ngClass]=\"{ highlight: aiTable.selection().selectedFields.has(field._id) }\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n <span class=\"text-truncate\">\n <thy-icon [thyIconName]=\"field.icon!\" class=\"mr-2 text-muted\"></thy-icon>\n <span>{{ field.name }}</span>\n </span>\n <a\n href=\"javascript:;\"\n class=\"grid-field-action\"\n thyAction\n thyIcon=\"more-vertical\"\n (click)=\"openFieldMenu($event, field, fieldAction)\"\n >\n </a>\n </div>\n }\n <div class=\"grid-column-blank cursor-pointer\" #gridColumnBlank (click)=\"addField(gridColumnBlank)\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n<div class=\"grid-body d-flex\">\n @for (record of gridData().records; track record._id; let index = $index) {\n <div class=\"grid-row d-flex\" [ngClass]=\"{ highlight: (record._id | isSelectRecord: aiTable.selection()) }\">\n <div class=\"grid-row-index grid-checkbox\">\n <label\n [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'checked-box' : 'unchecked-box'\"\n thyCheckbox\n thyLabelText=\"\"\n [ngModel]=\"record._id | isSelectRecord: aiTable.selection()\"\n (ngModelChange)=\"selectRecord(record._id)\"\n ></label>\n <span [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'grid-row-no-number' : 'grid-row-number'\">\n {{ index + 1 }}\n </span>\n </div>\n @for (field of gridData().fields; track field._id) {\n <!-- [ngClass]=\"{\n highlight: aiTable.selection().selectedCells.has(record._id) || aiTable.selection().selectedFields.has(field._id),\n selected: aiTable.selection().selectedCells.get(record._id)?.hasOwnProperty(field._id)\n }\" -->\n <div\n #cell\n class=\"grid-cell\"\n [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n @switch (field.type) {\n @case (AITableFieldType.select) {\n @let fieldValue = record.values[field._id];\n @let settings = field.settings! | selectSetting;\n @let options = settings['options'];\n @let optionStyle = settings['option_style'] || AITableSelectOptionStyle.tag;\n @let isTagStyle = optionStyle === AITableSelectOptionStyle.tag;\n\n @if (!settings['is_multiple'] && fieldValue | selectOption: options; as selectedOption) {\n @if (isTagStyle) {\n <select-option class=\"mb-1 mr-1\" [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n </div>\n }\n } @else {\n @let maxShowCount = 2;\n\n <div class=\"d-flex\">\n @if (fieldValue | selectOptions: options; as selectedOptions) {\n @for (option of selectedOptions; track option!._id; let i = $index) {\n @if (i + 1 <= maxShowCount) {\n @if (isTagStyle) {\n <select-option\n class=\"mb-1 mr-1\"\n [field]=\"field\"\n [displayOption]=\"option!\"\n ></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"option!\"></select-option>\n </div>\n }\n }\n }\n\n @let selectedLength = selectedOptions.length || 0;\n @if (selectedOptions && maxShowCount < selectedLength) {\n @let shape = isTagStyle ? 'pill' : 'rectangle';\n @let isHidden = maxShowCount >= selectedLength;\n\n <thy-tag\n class=\"cursor-pointer\"\n [class.multi-property-value-hidden]=\"isHidden\"\n [thyShape]=\"shape\"\n >\n <span class=\"text-truncate\"> +{{ selectedLength - maxShowCount }} </span>\n </thy-tag>\n }\n }\n </div>\n }\n }\n @case (AITableFieldType.date) {\n {{ record.values[field._id].timestamp | thyDatePickerFormat }}\n }\n @case (AITableFieldType.updatedAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.createdAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.rate) {\n <thy-rate [ngModel]=\"record.values[field._id]\"></thy-rate>\n }\n @case (AITableFieldType.link) {\n <a\n class=\"d-block\"\n target=\"_blank\"\n [href]=\"record.values[field._id]?.url\"\n thyStopPropagation\n thyFlexibleText\n [thyTooltipContent]=\"record.values[field._id]?.text\"\n >\n {{ record.values[field._id]?.text }}\n </a>\n }\n @case (AITableFieldType.progress) {\n <thy-progress\n class=\"w-100\"\n [thyValue]=\"record.values[field._id] || 0\"\n [thySize]=\"record.values[field._id]?.config?.size || 'md'\"\n [thyMax]=\"record.values[field._id]?.config?.max || 100\"\n [thyType]=\"record.values[field._id]?.config?.progressType || 'success'\"\n >\n <span> {{ record.values[field._id] || 0 }}{{ record.values[field._id]?.config?.suffix || '%' }} </span>\n </thy-progress>\n }\n @case (AITableFieldType.member) {\n @let settings = field.settings! | memberSetting;\n\n @if (!settings!['is_multiple']) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n } @else {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n <thy-avatar-list thyAvatarSize=\"xs\">\n @for (item of recordValues; track $index) {\n <thy-avatar [thyName]=\"item.display_name!\" [thySrc]=\"item.avatar!\"></thy-avatar>\n }\n </thy-avatar-list>\n }\n }\n @case (AITableFieldType.createdBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @case (AITableFieldType.updatedBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @default {\n <span class=\"text-truncate\"> {{ record.values[field._id] }}</span>\n }\n }\n <div class=\"autofill-container\"></div>\n </div>\n }\n <div class=\"grid-column-blank\"></div>\n </div>\n }\n <div class=\"grid-row-insert grid-row cursor-pointer\" (click)=\"addRecord()\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n\n<div #activeBorder class=\"active-border\"></div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: SelectOptionPipe, name: "selectOption" }, { kind: "pipe", type: SelectOptionsPipe, name: "selectOptions" }, { kind: "component", type: ThyTag, selector: "thy-tag,[thyTag]", inputs: ["thyTag", "thyShape", "thyColor", "thyTheme", "thySize", "thyHoverable"] }, { kind: "ngmodule", type: ThyPopoverModule }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "component", type: ThyRate, selector: "thy-rate", inputs: ["thyCount", "thyDisabled", "thyAllowHalf", "thyAllowClear", "thyTooltips", "thyIconTemplate"], outputs: ["thyItemHoverChange"] }, { kind: "component", type: ThyProgress, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips", "thyShape", "thyGapDegree", "thyGapPosition", "thyStrokeWidth"] }, { kind: "pipe", type: ThyDatePickerFormatPipe, name: "thyDatePickerFormat" }, { kind: "component", type: ThyFlexibleText, selector: "thy-flexible-text,[thyFlexibleText]", inputs: ["thyTooltipTrigger", "thyContainerClass", "thyTooltipContent", "thyTooltipPlacement", "thyTooltipOffset"], exportAs: ["thyFlexibleText"] }, { kind: "directive", type: ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "ngmodule", type: ThyCheckboxModule }, { kind: "component", type: i3$1.ThyCheckbox, selector: "thy-checkbox,[thy-checkbox],[thyCheckbox]", inputs: ["thyIndeterminate"] }, { kind: "ngmodule", type: ThyAvatarModule }, { kind: "component", type: i4.ThyAvatar, selector: "thy-avatar", inputs: ["thyShowName", "thySrc", "thyName", "thySize", "thyShowRemove", "thyRemovable", "thyImgClass", "thyDisabled", "thyLoading", "thyFetchPriority"], outputs: ["thyOnRemove", "thyRemove", "thyError"] }, { kind: "component", type: i4.ThyAvatarList, selector: "thy-avatar-list", inputs: ["thyMode", "thyAvatarSize"] }, { kind: "pipe", type: IsSelectRecordPipe, name: "isSelectRecord" }, { kind: "component", type: SelectOptionComponent, selector: "select-option", inputs: ["field", "displayOption"] }, { kind: "pipe", type: UserPipe, name: "user" }, { kind: "pipe", type: SelectSettingPipe, name: "selectSetting" }, { kind: "pipe", type: MemberSettingPipe, name: "memberSetting" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6728
- }
6729
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, decorators: [{
6730
- type: Component,
6731
- args: [{ selector: 'ai-table-dom-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
6732
- class: 'ai-table-grid ai-table-dom-grid'
6733
- }, imports: [
6734
- NgClass,
6735
- NgComponentOutlet,
6736
- CommonModule,
6737
- FormsModule,
6738
- SelectOptionPipe,
6739
- SelectOptionsPipe,
6740
- ThyTag,
6741
- ThyPopoverModule,
6742
- ThyIcon,
6743
- ThyRate,
6744
- ThyProgress,
6745
- AITableFieldSetting,
6746
- ThyDatePickerFormatPipe,
6747
- ThyFlexibleText,
6748
- ThyStopPropagationDirective,
6749
- AITableFieldMenu,
6750
- ThyAction,
6751
- ThyDropdownDirective,
6752
- ThyDropdownMenuComponent,
6753
- ThyCheckboxModule,
6754
- ProgressEditorComponent,
6755
- ThyAvatarModule,
6756
- NgTemplateOutlet,
6757
- IsSelectRecordPipe,
6758
- ProgressEditorComponent,
6759
- SelectOptionComponent,
6760
- UserPipe,
6761
- SelectSettingPipe,
6762
- MemberSettingPipe
6763
- ], providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], template: "<div class=\"grid-header d-flex\">\n <div class=\"grid-column-checkbox grid-cell grid-checkbox\">\n <label thyCheckbox thyLabelText=\"\" [ngModel]=\"isSelectedAll()\" (ngModelChange)=\"toggleSelectAll($event)\"></label>\n </div>\n @for (field of gridData().fields; track field._id) {\n <div\n class=\"grid-cell grid-field\"\n #fieldAction\n [attr.fieldId]=\"field._id\"\n [ngClass]=\"{ highlight: aiTable.selection().selectedFields.has(field._id) }\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n <span class=\"text-truncate\">\n <thy-icon [thyIconName]=\"field.icon!\" class=\"mr-2 text-muted\"></thy-icon>\n <span>{{ field.name }}</span>\n </span>\n <a\n href=\"javascript:;\"\n class=\"grid-field-action\"\n thyAction\n thyIcon=\"more-vertical\"\n (click)=\"openFieldMenu($event, field, fieldAction)\"\n >\n </a>\n </div>\n }\n <div class=\"grid-column-blank cursor-pointer\" #gridColumnBlank (click)=\"addField(gridColumnBlank)\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n<div class=\"grid-body d-flex\">\n @for (record of gridData().records; track record._id; let index = $index) {\n <div class=\"grid-row d-flex\" [ngClass]=\"{ highlight: (record._id | isSelectRecord: aiTable.selection()) }\">\n <div class=\"grid-row-index grid-checkbox\">\n <label\n [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'checked-box' : 'unchecked-box'\"\n thyCheckbox\n thyLabelText=\"\"\n [ngModel]=\"record._id | isSelectRecord: aiTable.selection()\"\n (ngModelChange)=\"selectRecord(record._id)\"\n ></label>\n <span [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'grid-row-no-number' : 'grid-row-number'\">\n {{ index + 1 }}\n </span>\n </div>\n @for (field of gridData().fields; track field._id) {\n <!-- [ngClass]=\"{\n highlight: aiTable.selection().selectedCells.has(record._id) || aiTable.selection().selectedFields.has(field._id),\n selected: aiTable.selection().selectedCells.get(record._id)?.hasOwnProperty(field._id)\n }\" -->\n <div\n #cell\n class=\"grid-cell\"\n [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n @switch (field.type) {\n @case (AITableFieldType.select) {\n @let fieldValue = record.values[field._id];\n @let settings = field.settings! | selectSetting;\n @let options = settings['options'];\n @let optionStyle = settings['option_style'] || AITableSelectOptionStyle.tag;\n @let isTagStyle = optionStyle === AITableSelectOptionStyle.tag;\n\n @if (!settings['is_multiple'] && fieldValue | selectOption: options; as selectedOption) {\n @if (isTagStyle) {\n <select-option class=\"mb-1 mr-1\" [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n </div>\n }\n } @else {\n @let maxShowCount = 2;\n\n <div class=\"d-flex\">\n @if (fieldValue | selectOptions: options; as selectedOptions) {\n @for (option of selectedOptions; track option!._id; let i = $index) {\n @if (i + 1 <= maxShowCount) {\n @if (isTagStyle) {\n <select-option\n class=\"mb-1 mr-1\"\n [field]=\"field\"\n [displayOption]=\"option!\"\n ></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"option!\"></select-option>\n </div>\n }\n }\n }\n\n @let selectedLength = selectedOptions.length || 0;\n @if (selectedOptions && maxShowCount < selectedLength) {\n @let shape = isTagStyle ? 'pill' : 'rectangle';\n @let isHidden = maxShowCount >= selectedLength;\n\n <thy-tag\n class=\"cursor-pointer\"\n [class.multi-property-value-hidden]=\"isHidden\"\n [thyShape]=\"shape\"\n >\n <span class=\"text-truncate\"> +{{ selectedLength - maxShowCount }} </span>\n </thy-tag>\n }\n }\n </div>\n }\n }\n @case (AITableFieldType.date) {\n {{ record.values[field._id].timestamp | thyDatePickerFormat }}\n }\n @case (AITableFieldType.updatedAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.createdAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.rate) {\n <thy-rate [ngModel]=\"record.values[field._id]\"></thy-rate>\n }\n @case (AITableFieldType.link) {\n <a\n class=\"d-block\"\n target=\"_blank\"\n [href]=\"record.values[field._id]?.url\"\n thyStopPropagation\n thyFlexibleText\n [thyTooltipContent]=\"record.values[field._id]?.text\"\n >\n {{ record.values[field._id]?.text }}\n </a>\n }\n @case (AITableFieldType.progress) {\n <thy-progress\n class=\"w-100\"\n [thyValue]=\"record.values[field._id] || 0\"\n [thySize]=\"record.values[field._id]?.config?.size || 'md'\"\n [thyMax]=\"record.values[field._id]?.config?.max || 100\"\n [thyType]=\"record.values[field._id]?.config?.progressType || 'success'\"\n >\n <span> {{ record.values[field._id] || 0 }}{{ record.values[field._id]?.config?.suffix || '%' }} </span>\n </thy-progress>\n }\n @case (AITableFieldType.member) {\n @let settings = field.settings! | memberSetting;\n\n @if (!settings!['is_multiple']) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n } @else {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n <thy-avatar-list thyAvatarSize=\"xs\">\n @for (item of recordValues; track $index) {\n <thy-avatar [thyName]=\"item.display_name!\" [thySrc]=\"item.avatar!\"></thy-avatar>\n }\n </thy-avatar-list>\n }\n }\n @case (AITableFieldType.createdBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @case (AITableFieldType.updatedBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @default {\n <span class=\"text-truncate\"> {{ record.values[field._id] }}</span>\n }\n }\n <div class=\"autofill-container\"></div>\n </div>\n }\n <div class=\"grid-column-blank\"></div>\n </div>\n }\n <div class=\"grid-row-insert grid-row cursor-pointer\" (click)=\"addRecord()\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n\n<div #activeBorder class=\"active-border\"></div>\n" }]
6764
- }] });
6765
-
6766
- class AITableIcon {
6767
- constructor() {
6768
- this.config = input.required();
6769
- this.groupConfig = computed(() => {
6770
- const { x, y, listening } = this.config();
6771
- return { x, y, listening };
6772
- });
6773
- this.squareShapeConfig = computed(() => {
6774
- const { name, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, strokeWidth = 1, background, cornerRadius, opacity } = this.config();
6775
- return {
6776
- name,
6777
- width: backgroundWidth || size,
6778
- height: backgroundHeight || size,
6779
- strokeWidth: strokeWidth,
6780
- fill: background || Colors.transparent,
6781
- cornerRadius,
6782
- opacity
6783
- };
6784
- });
6785
- this.iconConfig = computed(() => {
6786
- const { type, data, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, stroke, strokeWidth = 1, scaleX, scaleY, offsetX, offsetY, rotation, fill = Colors.gray600, transformsEnabled = 'position' } = this.config();
6787
- let pathData = data;
6788
- switch (type) {
6789
- case AITableCheckType.checked:
6790
- pathData = Check;
6791
- break;
6792
- case AITableCheckType.unchecked:
6793
- pathData = Unchecked;
6794
- break;
6795
- }
6796
- return {
6797
- x: backgroundWidth && (backgroundWidth - size * (scaleX || 1)) / 2,
6798
- y: backgroundHeight && (backgroundHeight - size * (scaleY || 1)) / 2,
6799
- data: pathData,
6800
- width: size,
6801
- height: size,
6802
- fill,
6803
- offsetX,
6804
- offsetY,
6805
- scaleX,
6806
- scaleY,
6807
- rotation,
6808
- stroke,
6809
- strokeWidth,
6810
- transformsEnabled,
6811
- perfectDrawEnabled: false,
6812
- listening: false
6813
- };
6814
- });
6815
- }
6816
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableIcon, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6817
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableIcon, isStandalone: true, selector: "ai-table-icon", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
6818
- <ko-group [config]="groupConfig()">
6819
- <ko-rect [config]="squareShapeConfig()"></ko-rect>
6820
- <ko-path [config]="iconConfig()"></ko-path>
6821
- </ko-group>
6822
- `, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6823
- }
6824
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableIcon, decorators: [{
6825
- type: Component,
6826
- args: [{
6827
- selector: 'ai-table-icon',
6828
- template: `
6829
- <ko-group [config]="groupConfig()">
6830
- <ko-rect [config]="squareShapeConfig()"></ko-rect>
6831
- <ko-path [config]="iconConfig()"></ko-path>
6832
- </ko-group>
6833
- `,
6834
- standalone: true,
6835
- imports: [KoContainer, KoShape],
6836
- changeDetection: ChangeDetectionStrategy.OnPush
6837
- }]
6838
- }] });
6839
-
6840
- class AITableAddField {
6841
- constructor() {
6842
- this.config = input.required();
6843
- this.btnWidth = AI_TABLE_FIELD_ADD_BUTTON_WIDTH;
6844
- this.x = computed(() => {
6845
- const lastColumnWidth = this.config().coordinate.getColumnWidth(this.config().columnStopIndex);
6846
- const lastColumnOffset = this.config().coordinate.getColumnOffset(this.config().columnStopIndex);
6847
- return lastColumnWidth + lastColumnOffset;
6848
- });
6849
- this.rectConfig = computed(() => {
6850
- const { pointPosition: { targetName }, readonly } = this.config();
6851
- const fill = targetName === AI_TABLE_FIELD_ADD_BUTTON ? Colors.gray80 : Colors.white;
6852
- const fields = this.config().fields || [];
6853
- const index = this.config().columnStopIndex;
6854
- const fieldId = fields.length && index < fields.length ? fields[index]._id : '';
6855
- return {
6856
- name: generateTargetName({
6857
- targetName: AI_TABLE_FIELD_ADD_BUTTON,
6858
- fieldId,
6859
- mouseStyle: readonly ? 'default' : 'pointer'
6860
- }),
6861
- x: AI_TABLE_OFFSET,
6862
- y: AI_TABLE_OFFSET,
6863
- width: this.config().coordinate.containerWidth - this.x() < this.btnWidth
6864
- ? this.btnWidth
6865
- : this.config().coordinate.containerWidth - this.x(),
6866
- height: this.config().coordinate.rowInitSize,
6867
- stroke: Colors.gray200,
6868
- strokeWidth: 1,
6869
- listening: true,
6870
- fill
6871
- };
6872
- });
6873
- this.addIconConfig = computed(() => {
6874
- const { readonly } = this.config();
6875
- const offsetY = (this.config().coordinate.rowInitSize - AI_TABLE_ICON_COMMON_SIZE) / 2;
6876
- return {
6877
- x: AI_TABLE_CELL_PADDING,
6878
- y: offsetY,
6879
- data: AddOutlinedPath,
6880
- fill: Colors.gray600,
6881
- listening: false,
6882
- visible: isNil(readonly) ? true : !readonly
6883
- };
6884
- });
6885
- }
6886
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6887
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableAddField, isStandalone: true, selector: "ai-table-add-field", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
6888
- <ko-group [config]="{ x: x() }">
6889
- <ko-group>
6890
- <ko-rect [config]="rectConfig()"></ko-rect>
6891
- </ko-group>
6892
- <ko-group>
6893
- @if (addIconConfig().visible) {
6894
- <ai-table-icon [config]="addIconConfig()"></ai-table-icon>
6895
- }
6896
- </ko-group>
6897
- </ko-group>
6898
- `, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableIcon, selector: "ai-table-icon", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
6899
- }
6900
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, decorators: [{
6901
- type: Component,
6902
- args: [{
6903
- selector: 'ai-table-add-field',
6904
- template: `
6905
- <ko-group [config]="{ x: x() }">
6906
- <ko-group>
6907
- <ko-rect [config]="rectConfig()"></ko-rect>
6908
- </ko-group>
6909
- <ko-group>
6910
- @if (addIconConfig().visible) {
6911
- <ai-table-icon [config]="addIconConfig()"></ai-table-icon>
6912
- }
6913
- </ko-group>
6914
- </ko-group>
6915
- `,
6916
- standalone: true,
6917
- imports: [KoContainer, KoShape, AITableIcon],
6918
- changeDetection: ChangeDetectionStrategy.OnPush
6919
- }]
6920
- }] });
6921
-
6922
- /**
6923
- * 用于处理表格行或单元格的布局和绘制。
6924
- * 它提供了基本的布局信息(如位置、大小等),并定义了常用的绘图方法(如渲染缩进区域、添加新字段的空白区域等)。
6925
- * 该类继承自 Drawer,并被其他更具体的布局类(如 RecordRowLayout)扩展和使用
6926
- */
6927
- class Layout extends Drawer {
6928
- constructor() {
6929
- super(...arguments);
6930
- // 定义当前单元格或行的位置
6931
- this.x = 0;
6932
- this.y = 0;
6933
- // 行高
6934
- this.rowHeight = 0;
6935
- // 列宽
6936
- this.columnWidth = 0;
6937
- // 行索引
6938
- this.rowIndex = 0;
6939
- // 列索引
6940
- this.columnIndex = 0;
6941
- // 列数
6942
- this.columnCount = 0;
6943
- this.containerWidth = 0;
6944
- }
6945
- // 用于初始化或重置布局的基本属性。这个方法通常在每次渲染新的一行或单元格时调用,确保布局信息是最新的
6946
- init({ x, y, rowIndex, columnIndex, rowHeight, columnWidth, columnCount, containerWidth }) {
6947
- this.x = x;
6948
- this.y = y;
6949
- this.rowIndex = rowIndex;
6950
- this.columnIndex = columnIndex;
6951
- this.rowHeight = rowHeight;
6952
- this.columnWidth = columnWidth;
6953
- this.columnCount = columnCount;
6954
- this.containerWidth = containerWidth;
6955
- }
6956
- // 当前单元格是否是行的第一列
6957
- get isFirst() {
6958
- return this.columnIndex === 0;
6959
- }
6960
- // 当前单元格是否是行的最后一列
6961
- get isLast() {
6962
- return this.columnIndex === this.columnCount - 1;
6963
- }
6964
- renderAddFieldBlank({ isHoverRow, isCheckedRow }) {
6965
- const rowHeight = this.rowHeight;
6966
- const fill = isCheckedRow ? this.colors.itemActiveBgColor : isHoverRow ? this.colors.gray80 : this.colors.transparent;
6967
- const addFieldBlankX = this.x + this.columnWidth + AI_TABLE_OFFSET;
6968
- this.rect({
6969
- x: addFieldBlankX,
6970
- y: this.y + AI_TABLE_OFFSET,
6971
- width: this.containerWidth - addFieldBlankX < AI_TABLE_FIELD_ADD_BUTTON_WIDTH
6972
- ? AI_TABLE_FIELD_ADD_BUTTON_WIDTH
6973
- : this.containerWidth - addFieldBlankX,
6974
- height: rowHeight,
6975
- fill
6976
- });
6977
- }
6978
- }
6979
-
6980
- class AddRowLayout extends Layout {
6981
- renderAddFieldBlank({ isHoverRow, isCheckedRow }) {
6982
- super.renderAddFieldBlank({ isHoverRow, isCheckedRow });
6983
- const rowHeight = this.rowHeight;
6984
- const defaultWidth = AI_TABLE_FIELD_ADD_BUTTON_WIDTH;
6985
- const width = this.containerWidth - this.x < defaultWidth ? defaultWidth : this.containerWidth - this.x;
6986
- this.line({
6987
- x: this.x + this.columnWidth,
6988
- y: this.y,
6989
- points: [0, rowHeight, width, rowHeight],
6990
- stroke: this.colors.gray200
6991
- });
6992
- }
6993
- renderCell({ width, isHoverRow }) {
6994
- const x = this.x;
6995
- const y = this.y;
6996
- const rowHeight = this.rowHeight;
6997
- const fill = isHoverRow ? this.colors.gray80 : this.colors.transparent;
6998
- this.rect({
6999
- x,
7000
- y: y + AI_TABLE_OFFSET,
7001
- width: width,
7002
- height: rowHeight,
7003
- fill
7004
- });
7005
- this.line({
7006
- x,
7007
- y: y + rowHeight,
7008
- points: [0, 0, width, 0],
7009
- stroke: this.colors.gray200
7010
- });
7011
- }
7012
- renderFirstCell({ isHoverRow }) {
7013
- if (!this.isFirst)
7014
- return;
7015
- const y = this.y;
7016
- const rowHeight = this.rowHeight;
7017
- const columnWidth = this.columnWidth;
7018
- const frozenOffset = AI_TABLE_OFFSET;
7019
- const fill = isHoverRow ? this.colors.gray80 : this.colors.transparent;
7020
- this.rect({
7021
- x: frozenOffset,
7022
- y: y + AI_TABLE_OFFSET,
7023
- width: columnWidth + AI_TABLE_ROW_HEAD_WIDTH - frozenOffset + 1,
7024
- height: rowHeight,
7025
- fill
7026
- });
7027
- this.line({
7028
- x: frozenOffset,
7029
- y,
7030
- points: [0, rowHeight, columnWidth + AI_TABLE_ROW_HEAD_WIDTH - frozenOffset + 1, rowHeight],
7031
- stroke: this.colors.gray200
7032
- });
7033
- this.path({
7034
- x: AI_TABLE_CELL_PADDING,
7035
- y: y + (rowHeight - AI_TABLE_ICON_COMMON_SIZE) / 2 - AI_TABLE_OFFSET,
7036
- data: AddOutlinedPath,
7037
- size: AI_TABLE_ROW_HEAD_SIZE,
7038
- fill: this.colors.gray600
6421
+ }
6422
+ renderFirstCell({ isHoverRow }) {
6423
+ if (!this.isFirst)
6424
+ return;
6425
+ const y = this.y;
6426
+ const rowHeight = this.rowHeight;
6427
+ const columnWidth = this.columnWidth;
6428
+ const frozenOffset = AI_TABLE_OFFSET;
6429
+ const fill = isHoverRow ? this.colors.gray80 : this.colors.transparent;
6430
+ this.rect({
6431
+ x: frozenOffset,
6432
+ y: y + AI_TABLE_OFFSET,
6433
+ width: columnWidth + AI_TABLE_ROW_HEAD_WIDTH - frozenOffset + 1,
6434
+ height: rowHeight,
6435
+ fill
6436
+ });
6437
+ this.line({
6438
+ x: frozenOffset,
6439
+ y,
6440
+ points: [0, rowHeight, columnWidth + AI_TABLE_ROW_HEAD_WIDTH - frozenOffset + 1, rowHeight],
6441
+ stroke: this.colors.gray200
6442
+ });
6443
+ this.path({
6444
+ x: AI_TABLE_CELL_PADDING,
6445
+ y: y + (rowHeight - AI_TABLE_ICON_COMMON_SIZE) / 2 - AI_TABLE_OFFSET,
6446
+ data: AddOutlinedPath,
6447
+ size: AI_TABLE_ROW_HEAD_SIZE,
6448
+ fill: this.colors.gray600
7039
6449
  });
7040
6450
  }
7041
6451
  renderLastCell({ isHoverRow, isCheckedRow }) {
@@ -7515,22 +6925,21 @@ class CellDrawer extends Drawer {
7515
6925
  }
7516
6926
  renderCellRate(render, ctx) {
7517
6927
  const { x, y, transformValue: _cellValue } = render;
7518
- const max = 5;
6928
+ const max = AI_TABLE_RATE_MAX;
7519
6929
  const cellValue = _cellValue;
7520
6930
  const size = AI_TABLE_CELL_EMOJI_SIZE;
7521
- const isEmpty = isNil(cellValue);
7522
6931
  return [...Array(max).keys()].map((item, index) => {
7523
6932
  const value = index + 1;
7524
6933
  const checked = value <= cellValue;
7525
6934
  const iconX = index * size + AI_TABLE_CELL_PADDING + index * AI_TABLE_CELL_EMOJI_PADDING;
7526
6935
  const iconY = (AI_TABLE_ROW_BLANK_HEIGHT - size) / 2;
7527
- if (ctx && (checked || isEmpty)) {
6936
+ if (ctx) {
7528
6937
  this.path({
7529
6938
  x: x + iconX,
7530
6939
  y: y + iconY,
7531
6940
  size: 22,
7532
6941
  data: StarFill,
7533
- fill: isEmpty ? this.colors.gray100 : this.colors.waring,
6942
+ fill: checked ? this.colors.waring : this.colors.gray100,
7534
6943
  scaleX: 1.14,
7535
6944
  scaleY: 1.14
7536
6945
  });
@@ -8045,6 +7454,162 @@ const isHoverRecord = (isHover, targetName) => {
8045
7454
  return isHover && targetName !== AI_TABLE_FIELD_HEAD;
8046
7455
  };
8047
7456
 
7457
+ class AITableIcon {
7458
+ constructor() {
7459
+ this.config = input.required();
7460
+ this.groupConfig = computed(() => {
7461
+ const { x, y, listening } = this.config();
7462
+ return { x, y, listening };
7463
+ });
7464
+ this.squareShapeConfig = computed(() => {
7465
+ const { name, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, strokeWidth = 1, background, cornerRadius, opacity } = this.config();
7466
+ return {
7467
+ name,
7468
+ width: backgroundWidth || size,
7469
+ height: backgroundHeight || size,
7470
+ strokeWidth: strokeWidth,
7471
+ fill: background || Colors.transparent,
7472
+ cornerRadius,
7473
+ opacity
7474
+ };
7475
+ });
7476
+ this.iconConfig = computed(() => {
7477
+ const { type, data, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, stroke, strokeWidth = 1, scaleX, scaleY, offsetX, offsetY, rotation, fill = Colors.gray600, transformsEnabled = 'position' } = this.config();
7478
+ let pathData = data;
7479
+ switch (type) {
7480
+ case AITableCheckType.checked:
7481
+ pathData = Check;
7482
+ break;
7483
+ case AITableCheckType.unchecked:
7484
+ pathData = Unchecked;
7485
+ break;
7486
+ }
7487
+ return {
7488
+ x: backgroundWidth && (backgroundWidth - size * (scaleX || 1)) / 2,
7489
+ y: backgroundHeight && (backgroundHeight - size * (scaleY || 1)) / 2,
7490
+ data: pathData,
7491
+ width: size,
7492
+ height: size,
7493
+ fill,
7494
+ offsetX,
7495
+ offsetY,
7496
+ scaleX,
7497
+ scaleY,
7498
+ rotation,
7499
+ stroke,
7500
+ strokeWidth,
7501
+ transformsEnabled,
7502
+ perfectDrawEnabled: false,
7503
+ listening: false
7504
+ };
7505
+ });
7506
+ }
7507
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableIcon, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7508
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableIcon, isStandalone: true, selector: "ai-table-icon", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
7509
+ <ko-group [config]="groupConfig()">
7510
+ <ko-rect [config]="squareShapeConfig()"></ko-rect>
7511
+ <ko-path [config]="iconConfig()"></ko-path>
7512
+ </ko-group>
7513
+ `, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7514
+ }
7515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableIcon, decorators: [{
7516
+ type: Component,
7517
+ args: [{
7518
+ selector: 'ai-table-icon',
7519
+ template: `
7520
+ <ko-group [config]="groupConfig()">
7521
+ <ko-rect [config]="squareShapeConfig()"></ko-rect>
7522
+ <ko-path [config]="iconConfig()"></ko-path>
7523
+ </ko-group>
7524
+ `,
7525
+ standalone: true,
7526
+ imports: [KoContainer, KoShape],
7527
+ changeDetection: ChangeDetectionStrategy.OnPush
7528
+ }]
7529
+ }] });
7530
+
7531
+ class AITableAddField {
7532
+ constructor() {
7533
+ this.config = input.required();
7534
+ this.btnWidth = AI_TABLE_FIELD_ADD_BUTTON_WIDTH;
7535
+ this.x = computed(() => {
7536
+ const lastColumnWidth = this.config().coordinate.getColumnWidth(this.config().columnStopIndex);
7537
+ const lastColumnOffset = this.config().coordinate.getColumnOffset(this.config().columnStopIndex);
7538
+ return lastColumnWidth + lastColumnOffset;
7539
+ });
7540
+ this.rectConfig = computed(() => {
7541
+ const { pointPosition: { targetName }, readonly } = this.config();
7542
+ const fill = targetName === AI_TABLE_FIELD_ADD_BUTTON ? Colors.gray80 : Colors.white;
7543
+ const fields = this.config().fields || [];
7544
+ const index = this.config().columnStopIndex;
7545
+ const fieldId = fields.length && index < fields.length ? fields[index]._id : '';
7546
+ return {
7547
+ name: generateTargetName({
7548
+ targetName: AI_TABLE_FIELD_ADD_BUTTON,
7549
+ fieldId,
7550
+ mouseStyle: readonly ? 'default' : 'pointer'
7551
+ }),
7552
+ x: AI_TABLE_OFFSET,
7553
+ y: AI_TABLE_OFFSET,
7554
+ width: this.config().coordinate.containerWidth - this.x() < this.btnWidth
7555
+ ? this.btnWidth
7556
+ : this.config().coordinate.containerWidth - this.x(),
7557
+ height: this.config().coordinate.rowInitSize,
7558
+ stroke: Colors.gray200,
7559
+ strokeWidth: 1,
7560
+ listening: true,
7561
+ fill
7562
+ };
7563
+ });
7564
+ this.addIconConfig = computed(() => {
7565
+ const { readonly } = this.config();
7566
+ const offsetY = (this.config().coordinate.rowInitSize - AI_TABLE_ICON_COMMON_SIZE) / 2;
7567
+ return {
7568
+ x: AI_TABLE_CELL_PADDING,
7569
+ y: offsetY,
7570
+ data: AddOutlinedPath,
7571
+ fill: Colors.gray600,
7572
+ listening: false,
7573
+ visible: isNil(readonly) ? true : !readonly
7574
+ };
7575
+ });
7576
+ }
7577
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7578
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableAddField, isStandalone: true, selector: "ai-table-add-field", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
7579
+ <ko-group [config]="{ x: x() }">
7580
+ <ko-group>
7581
+ <ko-rect [config]="rectConfig()"></ko-rect>
7582
+ </ko-group>
7583
+ <ko-group>
7584
+ @if (addIconConfig().visible) {
7585
+ <ai-table-icon [config]="addIconConfig()"></ai-table-icon>
7586
+ }
7587
+ </ko-group>
7588
+ </ko-group>
7589
+ `, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableIcon, selector: "ai-table-icon", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
7590
+ }
7591
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, decorators: [{
7592
+ type: Component,
7593
+ args: [{
7594
+ selector: 'ai-table-add-field',
7595
+ template: `
7596
+ <ko-group [config]="{ x: x() }">
7597
+ <ko-group>
7598
+ <ko-rect [config]="rectConfig()"></ko-rect>
7599
+ </ko-group>
7600
+ <ko-group>
7601
+ @if (addIconConfig().visible) {
7602
+ <ai-table-icon [config]="addIconConfig()"></ai-table-icon>
7603
+ }
7604
+ </ko-group>
7605
+ </ko-group>
7606
+ `,
7607
+ standalone: true,
7608
+ imports: [KoContainer, KoShape, AITableIcon],
7609
+ changeDetection: ChangeDetectionStrategy.OnPush
7610
+ }]
7611
+ }] });
7612
+
8048
7613
  class AITableCells {
8049
7614
  constructor() {
8050
7615
  this.config = input.required();
@@ -8680,50 +8245,468 @@ class AITableOtherRows {
8680
8245
  @case (AITableRowType.add) {
8681
8246
  <ko-rect [config]="config.addBtnConfig"></ko-rect>
8682
8247
  }
8683
- }
8248
+ }
8249
+ }
8250
+ `, isInline: true, dependencies: [{ kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8251
+ }
8252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableOtherRows, decorators: [{
8253
+ type: Component,
8254
+ args: [{
8255
+ selector: 'ai-table-other-rows',
8256
+ template: `
8257
+ @for (config of otherConfigs(); track $index) {
8258
+ @switch (config.type) {
8259
+ @case (AITableRowType.add) {
8260
+ <ko-rect [config]="config.addBtnConfig"></ko-rect>
8261
+ }
8262
+ }
8263
+ }
8264
+ `,
8265
+ standalone: true,
8266
+ imports: [KoShape],
8267
+ changeDetection: ChangeDetectionStrategy.OnPush
8268
+ }]
8269
+ }] });
8270
+
8271
+ class AITablePlaceholderCells {
8272
+ constructor() {
8273
+ this.config = input.required();
8274
+ this.frozenPlaceHolderCellsConfig = computed(() => {
8275
+ return getPlaceHolderCellsConfigs(this.config());
8276
+ });
8277
+ }
8278
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITablePlaceholderCells, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8279
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITablePlaceholderCells, isStandalone: true, selector: "ai-table-placeholder-cells", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
8280
+ @for (item of frozenPlaceHolderCellsConfig(); track $index) {
8281
+ <ko-rect [config]="item"></ko-rect>
8282
+ }
8283
+ `, isInline: true, dependencies: [{ kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8284
+ }
8285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITablePlaceholderCells, decorators: [{
8286
+ type: Component,
8287
+ args: [{
8288
+ selector: 'ai-table-placeholder-cells',
8289
+ template: `
8290
+ @for (item of frozenPlaceHolderCellsConfig(); track $index) {
8291
+ <ko-rect [config]="item"></ko-rect>
8292
+ }
8293
+ `,
8294
+ standalone: true,
8295
+ imports: [KoShape],
8296
+ changeDetection: ChangeDetectionStrategy.OnPush
8297
+ }]
8298
+ }] });
8299
+
8300
+ class AITableHoverCells {
8301
+ constructor() {
8302
+ this.config = input.required();
8303
+ this.componentMap = {};
8304
+ this.groupConfig = computed(() => {
8305
+ return {
8306
+ x: this.hoverCellConfig()?.x,
8307
+ y: this.hoverCellConfig()?.y
8308
+ };
8309
+ });
8310
+ this.hoverCellConfig = computed(() => {
8311
+ const { aiTable, coordinate, references, readonly, actions } = this.config();
8312
+ const pointPosition = aiTable.context.pointPosition();
8313
+ const hoverCell = this.hoverCell();
8314
+ if (!hoverCell) {
8315
+ return;
8316
+ }
8317
+ const { field, recordId } = hoverCell;
8318
+ const cellValue = AITableQueries.getFieldValue(aiTable, [recordId, field._id]);
8319
+ const transformValue = transformCellValue(aiTable, field, cellValue);
8320
+ const { rowHeight, columnCount, rowCount } = coordinate;
8321
+ const columnIndex = pointPosition.columnIndex;
8322
+ const rowIndex = pointPosition.rowIndex;
8323
+ const x = coordinate.getColumnOffset(columnIndex) + AI_TABLE_OFFSET;
8324
+ const columnWidth = coordinate.getColumnWidth(columnIndex);
8325
+ const y = coordinate.getRowOffset(rowIndex) + AI_TABLE_OFFSET;
8326
+ const { width } = getCellHorizontalPosition({
8327
+ columnWidth,
8328
+ columnIndex,
8329
+ columnCount
8330
+ });
8331
+ const style = {
8332
+ textAlign: DEFAULT_TEXT_ALIGN_LEFT
8333
+ };
8334
+ const textAlign = style.textAlign;
8335
+ const renderX = textAlign === DEFAULT_TEXT_ALIGN_RIGHT
8336
+ ? columnWidth - AI_TABLE_CELL_PADDING + AI_TABLE_OFFSET
8337
+ : AI_TABLE_CELL_PADDING + AI_TABLE_OFFSET;
8338
+ const renderY = 0 - AI_TABLE_OFFSET * 2;
8339
+ const result = {
8340
+ field,
8341
+ recordId,
8342
+ aiTable,
8343
+ coordinate,
8344
+ x,
8345
+ y,
8346
+ readonly,
8347
+ actions,
8348
+ render: {
8349
+ aiTable,
8350
+ recordId,
8351
+ field,
8352
+ isActive: isSelectedField(field._id, aiTable),
8353
+ x: renderX,
8354
+ y: renderY,
8355
+ columnWidth: width,
8356
+ rowHeight,
8357
+ cellValue,
8358
+ transformValue,
8359
+ style,
8360
+ references
8361
+ }
8362
+ };
8363
+ return result;
8364
+ });
8365
+ this.hoverCell = computed(() => getHoverCell(this.config().aiTable));
8366
+ }
8367
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableHoverCells, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8368
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableHoverCells, isStandalone: true, selector: "ai-table-hover-cell", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
8369
+ @if (hoverCell()) {
8370
+ <ko-group [config]="groupConfig()">
8371
+ <ng-container *ngComponentOutlet="hoverCell()!.renderComponentDefinition; inputs: { config: hoverCellConfig() }">
8372
+ </ng-container>
8373
+ </ko-group>
8684
8374
  }
8685
- `, isInline: true, dependencies: [{ kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8375
+ `, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8686
8376
  }
8687
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableOtherRows, decorators: [{
8377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableHoverCells, decorators: [{
8688
8378
  type: Component,
8689
8379
  args: [{
8690
- selector: 'ai-table-other-rows',
8380
+ selector: 'ai-table-hover-cell',
8691
8381
  template: `
8692
- @for (config of otherConfigs(); track $index) {
8693
- @switch (config.type) {
8694
- @case (AITableRowType.add) {
8695
- <ko-rect [config]="config.addBtnConfig"></ko-rect>
8696
- }
8697
- }
8382
+ @if (hoverCell()) {
8383
+ <ko-group [config]="groupConfig()">
8384
+ <ng-container *ngComponentOutlet="hoverCell()!.renderComponentDefinition; inputs: { config: hoverCellConfig() }">
8385
+ </ng-container>
8386
+ </ko-group>
8698
8387
  }
8699
8388
  `,
8700
8389
  standalone: true,
8701
- imports: [KoShape],
8390
+ imports: [KoContainer, CommonModule],
8702
8391
  changeDetection: ChangeDetectionStrategy.OnPush
8703
8392
  }]
8704
8393
  }] });
8705
8394
 
8706
- class AITablePlaceholderCells {
8395
+ Konva.pixelRatio = 2;
8396
+ class AITableRenderer {
8707
8397
  constructor() {
8708
8398
  this.config = input.required();
8709
- this.frozenPlaceHolderCellsConfig = computed(() => {
8710
- return getPlaceHolderCellsConfigs(this.config());
8399
+ this.koMousemove = output();
8400
+ this.koMousedown = output();
8401
+ this.koMouseup = output();
8402
+ this.koContextmenu = output();
8403
+ this.koWheel = output();
8404
+ this.koClick = output();
8405
+ this.koDblclick = output();
8406
+ this.koMouseleave = output();
8407
+ this.fields = computed(() => {
8408
+ return AITable.getVisibleFields(this.config().aiTable);
8409
+ });
8410
+ this.readonly = computed(() => {
8411
+ return this.config()?.readonly;
8412
+ });
8413
+ this.coordinate = computed(() => {
8414
+ return this.config()?.coordinate;
8415
+ });
8416
+ this.containerWidth = computed(() => {
8417
+ return this.config().containerWidth;
8418
+ });
8419
+ this.containerHeight = computed(() => {
8420
+ return this.config().containerHeight;
8421
+ });
8422
+ this.scrollState = computed(() => {
8423
+ return this.config()?.aiTable.context.scrollState();
8424
+ });
8425
+ this.visibleRangeInfo = computed(() => {
8426
+ return getVisibleRangeInfo(this.coordinate(), this.scrollState());
8427
+ });
8428
+ this.frozenAreaWidth = computed(() => {
8429
+ return AI_TABLE_ROW_HEAD_WIDTH + this.coordinate().frozenColumnWidth;
8430
+ });
8431
+ this.lastColumnWidth = computed(() => {
8432
+ return this.coordinate().getColumnWidth(this.visibleRangeInfo().columnStopIndex);
8433
+ });
8434
+ this.lastColumnOffset = computed(() => {
8435
+ return this.coordinate().getColumnOffset(this.visibleRangeInfo().columnStopIndex);
8436
+ });
8437
+ this.cellGroupClipWidth = computed(() => {
8438
+ return this.containerWidth() - this.frozenAreaWidth();
8439
+ });
8440
+ this.stageConfig = computed(() => {
8441
+ const { isScrolling } = this.scrollState();
8442
+ return {
8443
+ width: this.containerWidth(),
8444
+ height: this.containerHeight(),
8445
+ listening: isScrolling ? false : true
8446
+ };
8447
+ });
8448
+ this.gridGroupConfig = computed(() => {
8449
+ return {
8450
+ clipX: 0,
8451
+ clipY: 0,
8452
+ clipWidth: this.containerWidth(),
8453
+ clipHeight: this.containerHeight()
8454
+ };
8455
+ });
8456
+ this.commonGroupConfig = computed(() => {
8457
+ return {
8458
+ clipX: this.frozenAreaWidth() + 1,
8459
+ clipY: 0,
8460
+ clipWidth: this.cellGroupClipWidth(),
8461
+ clipHeight: this.containerHeight()
8462
+ };
8463
+ });
8464
+ this.attachGroupConfig = computed(() => {
8465
+ return {
8466
+ clipX: this.frozenAreaWidth() - 1,
8467
+ clipY: this.coordinate().rowInitSize - 1,
8468
+ clipWidth: this.containerWidth() - this.frozenAreaWidth(),
8469
+ clipHeight: this.containerHeight() - this.coordinate().rowInitSize
8470
+ };
8471
+ });
8472
+ this.frozenAttachGroupConfig = computed(() => {
8473
+ return {
8474
+ clipX: 0,
8475
+ clipY: this.coordinate().rowInitSize - 1,
8476
+ clipWidth: this.frozenAreaWidth() + 4,
8477
+ clipHeight: this.containerHeight() - this.coordinate().rowInitSize
8478
+ };
8479
+ });
8480
+ this.offsetYConfig = computed(() => {
8481
+ const { scrollTop } = this.scrollState();
8482
+ return {
8483
+ offsetY: scrollTop
8484
+ };
8485
+ });
8486
+ this.offsetXConfig = computed(() => {
8487
+ const { scrollLeft } = this.scrollState();
8488
+ return {
8489
+ offsetX: scrollLeft
8490
+ };
8491
+ });
8492
+ this.offsetConfig = computed(() => {
8493
+ const { scrollLeft, scrollTop } = this.scrollState();
8494
+ return {
8495
+ offsetX: scrollLeft,
8496
+ offsetY: scrollTop
8497
+ };
8498
+ });
8499
+ this.columnHeadOrAddFieldConfig = computed(() => {
8500
+ const { columnStartIndex, columnStopIndex } = this.visibleRangeInfo();
8501
+ const { aiTable, coordinate, readonly } = this.config();
8502
+ const { pointPosition } = aiTable.context;
8503
+ const fields = this.fields();
8504
+ return {
8505
+ aiTable,
8506
+ coordinate,
8507
+ fields,
8508
+ columnStartIndex,
8509
+ columnStopIndex,
8510
+ pointPosition: pointPosition(),
8511
+ readonly
8512
+ };
8513
+ });
8514
+ this.cellsConfig = computed(() => {
8515
+ const { aiTable, readonly, coordinate, references, actions } = this.config();
8516
+ const { rowStartIndex, rowStopIndex, columnStartIndex, columnStopIndex } = this.visibleRangeInfo();
8517
+ return {
8518
+ aiTable,
8519
+ readonly,
8520
+ coordinate,
8521
+ references,
8522
+ rowStartIndex,
8523
+ rowStopIndex,
8524
+ columnStartIndex,
8525
+ columnStopIndex,
8526
+ actions
8527
+ };
8528
+ });
8529
+ this.activeCellBorderConfig = computed(() => {
8530
+ return createActiveCellBorder(this.cellsConfig());
8531
+ });
8532
+ }
8533
+ stageMousemove(e) {
8534
+ this.koMousemove.emit(e);
8535
+ }
8536
+ stageMousedown(e) {
8537
+ this.koMousedown.emit(e);
8538
+ }
8539
+ stageMouseup(e) {
8540
+ this.koMouseup.emit(e);
8541
+ }
8542
+ stageContextmenu(e) {
8543
+ this.koContextmenu.emit(e);
8544
+ }
8545
+ stageClick(e) {
8546
+ this.koClick.emit(e);
8547
+ }
8548
+ stageDblclick(e) {
8549
+ this.koDblclick.emit(e);
8550
+ }
8551
+ stageMouseleave(e) {
8552
+ this.koMouseleave.emit(e);
8553
+ }
8554
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8555
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableRenderer, isStandalone: true, selector: "ai-table-renderer", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { koMousemove: "koMousemove", koMousedown: "koMousedown", koMouseup: "koMouseup", koContextmenu: "koContextmenu", koWheel: "koWheel", koClick: "koClick", koDblclick: "koDblclick", koMouseleave: "koMouseleave" }, ngImport: i0, template: "<ko-stage\n [config]=\"stageConfig()\"\n (koMousemove)=\"stageMousemove($event)\"\n (koMousedown)=\"stageMousedown($event)\"\n (koMouseup)=\"stageMouseup($event)\"\n (koContextmenu)=\"stageContextmenu($event)\"\n (koClick)=\"stageClick($event)\"\n (koDblclick)=\"stageDblclick($event)\"\n (koMouseleave)=\"stageMouseleave($event)\"\n>\n <ko-layer>\n <ko-group [config]=\"gridGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n <ai-table-frozen-cells [config]=\"cellsConfig()\"></ai-table-frozen-cells>\n <ai-table-other-rows [config]=\"cellsConfig()\"></ai-table-other-rows>\n <ai-table-hover-row-heads [config]=\"cellsConfig()\"></ai-table-hover-row-heads>\n <ai-table-frozen-placeholder-cells [config]=\"cellsConfig()\"></ai-table-frozen-placeholder-cells>\n </ko-group>\n\n <ko-group>\n <ai-table-frozen-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-frozen-column-heads>\n </ko-group>\n\n <ko-group [config]=\"commonGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-cells [config]=\"cellsConfig()\"></ai-table-cells>\n </ko-group>\n\n <ko-group [config]=\"offsetXConfig()\">\n <ai-table-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-column-heads>\n <ai-table-add-field [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-add-field>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"attachGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-placeholder-cells [config]=\"cellsConfig()\"></ai-table-placeholder-cells>\n @if (activeCellBorderConfig().activeCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().activeCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"frozenAttachGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n @if (activeCellBorderConfig().frozenActiveCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().frozenActiveCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoStage, selector: "ko-stage", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableColumnHeads, selector: "ai-table-column-heads", inputs: ["config"] }, { kind: "component", type: AITableFrozenColumnHeads, selector: "ai-table-frozen-column-heads", inputs: ["config"] }, { kind: "component", type: AITableCells, selector: "ai-table-cells", inputs: ["config"] }, { kind: "component", type: AITableFrozenCells, selector: "ai-table-frozen-cells", inputs: ["config"] }, { kind: "component", type: AITableFrozenPlaceholderCells, selector: "ai-table-frozen-placeholder-cells", inputs: ["config"] }, { kind: "component", type: AITableHoverCells, selector: "ai-table-hover-cell", inputs: ["config"] }, { kind: "component", type: AITablePlaceholderCells, selector: "ai-table-placeholder-cells", inputs: ["config"] }, { kind: "component", type: AITableAddField, selector: "ai-table-add-field", inputs: ["config"] }, { kind: "component", type: AITableHoverRowHeads, selector: "ai-table-hover-row-heads", inputs: ["config"] }, { kind: "component", type: AITableOtherRows, selector: "ai-table-other-rows", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8556
+ }
8557
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, decorators: [{
8558
+ type: Component,
8559
+ args: [{ selector: 'ai-table-renderer', standalone: true, imports: [
8560
+ KoContainer,
8561
+ KoStage,
8562
+ KoShape,
8563
+ AITableColumnHeads,
8564
+ AITableFrozenColumnHeads,
8565
+ AITableCells,
8566
+ AITableFrozenCells,
8567
+ AITableFrozenPlaceholderCells,
8568
+ AITableHoverCells,
8569
+ AITablePlaceholderCells,
8570
+ AITableAddField,
8571
+ AITableHoverRowHeads,
8572
+ AITableOtherRows
8573
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ko-stage\n [config]=\"stageConfig()\"\n (koMousemove)=\"stageMousemove($event)\"\n (koMousedown)=\"stageMousedown($event)\"\n (koMouseup)=\"stageMouseup($event)\"\n (koContextmenu)=\"stageContextmenu($event)\"\n (koClick)=\"stageClick($event)\"\n (koDblclick)=\"stageDblclick($event)\"\n (koMouseleave)=\"stageMouseleave($event)\"\n>\n <ko-layer>\n <ko-group [config]=\"gridGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n <ai-table-frozen-cells [config]=\"cellsConfig()\"></ai-table-frozen-cells>\n <ai-table-other-rows [config]=\"cellsConfig()\"></ai-table-other-rows>\n <ai-table-hover-row-heads [config]=\"cellsConfig()\"></ai-table-hover-row-heads>\n <ai-table-frozen-placeholder-cells [config]=\"cellsConfig()\"></ai-table-frozen-placeholder-cells>\n </ko-group>\n\n <ko-group>\n <ai-table-frozen-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-frozen-column-heads>\n </ko-group>\n\n <ko-group [config]=\"commonGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-cells [config]=\"cellsConfig()\"></ai-table-cells>\n </ko-group>\n\n <ko-group [config]=\"offsetXConfig()\">\n <ai-table-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-column-heads>\n <ai-table-add-field [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-add-field>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"attachGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-placeholder-cells [config]=\"cellsConfig()\"></ai-table-placeholder-cells>\n @if (activeCellBorderConfig().activeCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().activeCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"frozenAttachGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n @if (activeCellBorderConfig().frozenActiveCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().frozenActiveCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n" }]
8574
+ }] });
8575
+
8576
+ class AITableCellRate {
8577
+ constructor() {
8578
+ this.pointerX = signal(0);
8579
+ this.pointerY = signal(0);
8580
+ this.resetStatus = signal(false);
8581
+ this.config = input();
8582
+ this.readonly = computed(() => {
8583
+ return this.config()?.readonly;
8584
+ });
8585
+ this.whiteBgConfig = computed(() => {
8586
+ const { aiTable, render, field, recordId, coordinate } = this.config();
8587
+ const pointPosition = aiTable.context.pointPosition();
8588
+ const { x, y } = render;
8589
+ const { columnIndex } = pointPosition;
8590
+ const isActive = isActiveCell([recordId, field._id], aiTable);
8591
+ return {
8592
+ x: x - AI_TABLE_CELL_PADDING + AI_TABLE_CELL_BORDER,
8593
+ y: y + AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET,
8594
+ width: coordinate.getColumnWidth(columnIndex) - (AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET) * 2,
8595
+ height: AI_TABLE_ROW_BLANK_HEIGHT - (AI_TABLE_CELL_BORDER + AI_TABLE_OFFSET),
8596
+ fill: Colors.white,
8597
+ stroke: isActive ? null : Colors.white,
8598
+ zIndex: 0,
8599
+ name: generateTargetName({
8600
+ targetName: AI_TABLE_CELL,
8601
+ fieldId: field._id,
8602
+ recordId
8603
+ })
8604
+ };
8605
+ });
8606
+ this.starConfigs = computed(() => {
8607
+ const { render, field, recordId, readonly, aiTable, coordinate } = this.config();
8608
+ const { x, transformValue } = render;
8609
+ const max = AI_TABLE_RATE_MAX;
8610
+ const starY = (AI_TABLE_ROW_BLANK_HEIGHT - AI_TABLE_CELL_EMOJI_SIZE) / 2 + AI_TABLE_OFFSET;
8611
+ const pointPosition = aiTable.context.pointPosition();
8612
+ const { rowIndex, columnIndex } = pointPosition;
8613
+ const { scrollLeft, scrollTop } = aiTable.context.scrollState();
8614
+ const columnLeftX = coordinate.getColumnOffset(columnIndex) - scrollLeft + AI_TABLE_OFFSET;
8615
+ const columnTopY = coordinate.getRowOffset(rowIndex) - scrollTop + AI_TABLE_OFFSET;
8616
+ const firstStarLeftX = columnLeftX + AI_TABLE_CELL_PADDING;
8617
+ const lastStarRightX = columnLeftX + AI_TABLE_CELL_PADDING + max * AI_TABLE_CELL_EMOJI_SIZE + (max - 1) * AI_TABLE_CELL_EMOJI_PADDING;
8618
+ const startTopY = columnTopY + starY;
8619
+ const startBottomY = columnTopY + starY + AI_TABLE_CELL_EMOJI_SIZE;
8620
+ const isHoverStar = this.pointerX() >= firstStarLeftX &&
8621
+ this.pointerX() <= lastStarRightX &&
8622
+ this.pointerY() >= startTopY &&
8623
+ this.pointerY() <= startBottomY;
8624
+ return [...Array(max).keys()].map((item, index) => {
8625
+ const value = index + 1;
8626
+ const checked = value <= transformValue;
8627
+ const starX = x + index * (AI_TABLE_CELL_EMOJI_SIZE + AI_TABLE_CELL_EMOJI_PADDING);
8628
+ let fill = null;
8629
+ if (this.resetStatus()) {
8630
+ fill = Colors.gray100;
8631
+ }
8632
+ else {
8633
+ if (isHoverStar) {
8634
+ fill = columnLeftX + starX <= this.pointerX() ? Colors.waring : Colors.gray100;
8635
+ }
8636
+ else {
8637
+ fill = checked ? Colors.waring : Colors.gray100;
8638
+ }
8639
+ }
8640
+ return {
8641
+ x: starX,
8642
+ y: starY,
8643
+ size: 22,
8644
+ data: StarFill,
8645
+ fill,
8646
+ scaleX: 1.14,
8647
+ scaleY: 1.14,
8648
+ name: generateTargetName({
8649
+ targetName: AI_TABLE_CELL,
8650
+ fieldId: field._id,
8651
+ recordId,
8652
+ mouseStyle: readonly ? 'default' : 'pointer'
8653
+ })
8654
+ };
8655
+ });
8711
8656
  });
8712
8657
  }
8713
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITablePlaceholderCells, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8714
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITablePlaceholderCells, isStandalone: true, selector: "ai-table-placeholder-cells", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
8715
- @for (item of frozenPlaceHolderCellsConfig(); track $index) {
8716
- <ko-rect [config]="item"></ko-rect>
8658
+ static { this.fieldType = AITableFieldType.rate; }
8659
+ koMousemove(e) {
8660
+ if (this.readonly()) {
8661
+ return;
8662
+ }
8663
+ this.resetStatus.set(false);
8664
+ const pos = e.event.target.getStage()?.getPointerPosition();
8665
+ if (!pos)
8666
+ return;
8667
+ const { x, y } = pos;
8668
+ this.pointerX.set(x);
8669
+ this.pointerY.set(y);
8670
+ }
8671
+ koClick(e, index) {
8672
+ if (this.readonly()) {
8673
+ return;
8674
+ }
8675
+ this.resetStatus.set(false);
8676
+ const { render, readonly, field, recordId, actions } = this.config();
8677
+ const { transformValue } = render;
8678
+ let value = index + 1;
8679
+ if (transformValue === value) {
8680
+ value = 0;
8681
+ this.resetStatus.set(true);
8682
+ }
8683
+ if (!readonly && actions && actions.updateFieldValue) {
8684
+ actions.updateFieldValue({
8685
+ value,
8686
+ path: [recordId, field._id]
8687
+ });
8688
+ }
8689
+ }
8690
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableCellRate, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8691
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableCellRate, isStandalone: true, selector: "ai-table-rate", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
8692
+ @if (!readonly()) {
8693
+ <ko-rect [config]="whiteBgConfig()" (koMousemove)="koMousemove($event)"></ko-rect>
8694
+ }
8695
+ @for (config of starConfigs(); let index = $index; track $index) {
8696
+ <ko-path [config]="config" (koClick)="koClick($event, index)"></ko-path>
8717
8697
  }
8718
8698
  `, isInline: true, dependencies: [{ kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8719
8699
  }
8720
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITablePlaceholderCells, decorators: [{
8700
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableCellRate, decorators: [{
8721
8701
  type: Component,
8722
8702
  args: [{
8723
- selector: 'ai-table-placeholder-cells',
8703
+ selector: 'ai-table-rate',
8724
8704
  template: `
8725
- @for (item of frozenPlaceHolderCellsConfig(); track $index) {
8726
- <ko-rect [config]="item"></ko-rect>
8705
+ @if (!readonly()) {
8706
+ <ko-rect [config]="whiteBgConfig()" (koMousemove)="koMousemove($event)"></ko-rect>
8707
+ }
8708
+ @for (config of starConfigs(); let index = $index; track $index) {
8709
+ <ko-path [config]="config" (koClick)="koClick($event, index)"></ko-path>
8727
8710
  }
8728
8711
  `,
8729
8712
  standalone: true,
@@ -8732,344 +8715,487 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
8732
8715
  }]
8733
8716
  }] });
8734
8717
 
8735
- const createActiveCellBorder = (config) => {
8736
- const { aiTable, coordinate, columnStartIndex, columnStopIndex, rowStartIndex, rowStopIndex } = config;
8737
- const { linearRows } = aiTable.context;
8738
- const { rowHeight, frozenColumnCount } = coordinate;
8739
- const colors = AITable.getColors();
8740
- const visibleColumns = AITable.getVisibleFields(aiTable);
8741
- const activeCell = AITable.getActiveCell(aiTable);
8742
- const totalColumnCount = visibleColumns.length;
8743
- let activeCellBorder = null;
8744
- let frozenActiveCellBorder = null;
8745
- if (Array.isArray(activeCell) &&
8746
- !!activeCell.length &&
8747
- aiTable.context.visibleRowsIndexMap().has(activeCell[0]) &&
8748
- aiTable.context.visibleColumnsIndexMap().has(activeCell[1])) {
8749
- const fieldId = activeCell[1];
8750
- const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, activeCell);
8751
- const checkIsVisible = (rowIndex, columnIndex) => {
8752
- if (columnIndex < frozenColumnCount) {
8753
- return true;
8754
- }
8755
- return (rowIndex >= rowStartIndex && rowIndex <= rowStopIndex && columnIndex >= columnStartIndex && columnIndex <= columnStopIndex);
8718
+ // TODO: components下的cells组件考虑移出 components ,这些组件都属于
8719
+
8720
+ var cellComponents = /*#__PURE__*/Object.freeze({
8721
+ __proto__: null,
8722
+ AITableCellAttachment: AITableCellAttachment,
8723
+ AITableCellLink: AITableCellLink,
8724
+ AITableCellRate: AITableCellRate,
8725
+ AITableCellRichtext: AITableCellRichtext
8726
+ });
8727
+
8728
+ const componentMap = {};
8729
+ Object.values(cellComponents).forEach((cellComponent) => {
8730
+ componentMap[cellComponent.fieldType] = cellComponent;
8731
+ });
8732
+
8733
+ function getHoverCell(aiTable) {
8734
+ const pointPosition = aiTable.context.pointPosition();
8735
+ const { fieldId, recordId } = getDetailByTargetName(pointPosition.realTargetName) ?? {};
8736
+ if (!recordId || !fieldId) {
8737
+ return;
8738
+ }
8739
+ const record = aiTable.recordsMap()[recordId];
8740
+ const field = aiTable.fieldsMap()[fieldId];
8741
+ if (!record || !field || !recordId || !fieldId) {
8742
+ return;
8743
+ }
8744
+ const renderComponentDefinition = componentMap[field?.type];
8745
+ if (!renderComponentDefinition) {
8746
+ return;
8747
+ }
8748
+ return {
8749
+ field,
8750
+ recordId,
8751
+ fieldId,
8752
+ renderComponentDefinition
8753
+ };
8754
+ }
8755
+
8756
+ class AITableGridEventService {
8757
+ constructor() {
8758
+ this.dblClickEvent$ = new Subject();
8759
+ this.mousedownEvent$ = new Subject();
8760
+ this.mouseoverEvent$ = new Subject();
8761
+ this.globalMouseoverEvent$ = new Subject();
8762
+ this.globalMousedownEvent$ = new Subject();
8763
+ this.destroyRef = inject(DestroyRef);
8764
+ this.thyPopover = inject(ThyPopover);
8765
+ }
8766
+ initialize(aiTable, aiFieldRenderers) {
8767
+ this.aiTable = aiTable;
8768
+ this.aiFieldRenderers = aiFieldRenderers;
8769
+ }
8770
+ registerEvents(element) {
8771
+ fromEvent(element, 'dblclick', { passive: true })
8772
+ .pipe(takeUntilDestroyed(this.destroyRef))
8773
+ .subscribe((event) => {
8774
+ this.dblClickEvent$.next(event);
8775
+ });
8776
+ fromEvent(element, 'mouseover', { passive: true })
8777
+ .pipe(debounceTime(80), takeUntilDestroyed(this.destroyRef))
8778
+ .subscribe((event) => {
8779
+ this.mouseoverEvent$.next(event);
8780
+ });
8781
+ fromEvent(document, 'mouseover', { passive: true })
8782
+ .pipe(takeUntilDestroyed(this.destroyRef))
8783
+ .subscribe((event) => {
8784
+ this.globalMouseoverEvent$.next(event);
8785
+ });
8786
+ fromEvent(element, 'mousedown', { passive: true })
8787
+ .pipe(takeUntilDestroyed(this.destroyRef))
8788
+ .subscribe((event) => {
8789
+ this.mousedownEvent$.next(event);
8790
+ });
8791
+ fromEvent(document, 'mousedown', { passive: true })
8792
+ .pipe(takeUntilDestroyed(this.destroyRef))
8793
+ .subscribe((event) => {
8794
+ this.globalMousedownEvent$.next(event);
8795
+ });
8796
+ }
8797
+ getEditorComponent(type) {
8798
+ const filedRenderSchema = this.aiFieldRenderers && this.aiFieldRenderers[type];
8799
+ if (filedRenderSchema && filedRenderSchema.editor) {
8800
+ return {
8801
+ component: filedRenderSchema.editor,
8802
+ isInternalComponent: false
8803
+ };
8804
+ }
8805
+ return {
8806
+ component: GRID_CELL_EDITOR_MAP[type],
8807
+ isInternalComponent: true
8756
8808
  };
8757
- if (rowIndex != null && columnIndex != null && checkIsVisible(rowIndex, columnIndex)) {
8758
- const { type } = linearRows()[rowIndex];
8759
- if (type === AITableRowType.record) {
8760
- const activeField = visibleColumns.find((field) => field._id === fieldId);
8761
- if (activeField == null) {
8762
- return {
8763
- activeCellBorder,
8764
- frozenActiveCellBorder
8765
- };
8809
+ }
8810
+ openEdit(cellDom) {
8811
+ const { x, y, width, height } = cellDom.getBoundingClientRect();
8812
+ const fieldId = cellDom.getAttribute('fieldId');
8813
+ const recordId = cellDom.getAttribute('recordId');
8814
+ const { component } = this.getEditorComponent(this.aiTable.fieldsMap()[fieldId].type);
8815
+ const ref = this.thyPopover.open(component, {
8816
+ origin: cellDom,
8817
+ originPosition: {
8818
+ x: x - 1,
8819
+ y: y + 1,
8820
+ width: width + 2,
8821
+ height: height + 2
8822
+ },
8823
+ width: width + 1 + 'px',
8824
+ height: height + 2 + 'px',
8825
+ placement: 'top',
8826
+ offset: -(height + 4),
8827
+ minWidth: width,
8828
+ initialState: {
8829
+ fieldId: fieldId,
8830
+ recordId: recordId,
8831
+ aiTable: this.aiTable
8832
+ },
8833
+ panelClass: 'grid-cell-editor',
8834
+ outsideClosable: false,
8835
+ hasBackdrop: false,
8836
+ manualClosure: true,
8837
+ animationDisabled: true,
8838
+ autoAdaptive: true
8839
+ });
8840
+ return ref;
8841
+ }
8842
+ getOriginPosition(aiTable, options) {
8843
+ const { container, coordinate, recordId, fieldId, isHoverEdit } = options;
8844
+ const { scrollState } = aiTable.context;
8845
+ const { rowHeight, columnCount } = coordinate;
8846
+ const cell = [recordId, fieldId];
8847
+ const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, cell);
8848
+ const originX = coordinate.getColumnOffset(columnIndex);
8849
+ const originY = coordinate.getRowOffset(rowIndex);
8850
+ const columnWidth = coordinate.getColumnWidth(columnIndex);
8851
+ const { width: originWidth, offset: originOffset } = getCellHorizontalPosition({
8852
+ columnWidth,
8853
+ columnIndex,
8854
+ columnCount
8855
+ });
8856
+ const originRect = container.getBoundingClientRect();
8857
+ const isFrozenColumn = AITable.isFrozenColumn(aiTable, columnIndex);
8858
+ const scrollLeft = isFrozenColumn ? 0 : scrollState().scrollLeft;
8859
+ const scrollTop = scrollState().scrollTop;
8860
+ const originPosition = {
8861
+ x: originX + originOffset - scrollLeft + originRect.x,
8862
+ y: originY - scrollTop + originRect.y,
8863
+ width: originWidth,
8864
+ height: rowHeight
8865
+ };
8866
+ let x = originPosition.x + getEditorBoxOffset();
8867
+ let y = originPosition.y + getEditorBoxOffset();
8868
+ let width = getEditorSpace(originPosition.width);
8869
+ let height = getEditorSpace(originPosition.height);
8870
+ // hover 编辑组件无边框
8871
+ if (isHoverEdit) {
8872
+ x = originPosition.x + getHoverEditorBoxOffset();
8873
+ y = originPosition.y + getHoverEditorBoxOffset();
8874
+ width = getHoverEditorSpace(originPosition.width);
8875
+ height = getHoverEditorSpace(originPosition.height);
8876
+ }
8877
+ return {
8878
+ ...originPosition,
8879
+ x: x,
8880
+ y: y,
8881
+ width: width,
8882
+ height: height
8883
+ };
8884
+ }
8885
+ openCellEditor(aiTable, options) {
8886
+ const { container, recordId, fieldId, isHoverEdit, references } = options;
8887
+ const { component, isInternalComponent } = this.getEditorComponent(this.aiTable.fieldsMap()[fieldId].type);
8888
+ const offsetOriginPosition = this.getOriginPosition(aiTable, options);
8889
+ this.cellEditorPopoverRef = this.thyPopover.open(component, {
8890
+ viewContainerRef: isInternalComponent ? undefined : options?.viewContainerRef,
8891
+ origin: container,
8892
+ originPosition: offsetOriginPosition,
8893
+ width: offsetOriginPosition.width + 'px',
8894
+ height: offsetOriginPosition.height + 'px',
8895
+ minWidth: offsetOriginPosition.width + 'px',
8896
+ placement: 'bottom',
8897
+ offset: -offsetOriginPosition.height,
8898
+ initialState: {
8899
+ fieldId: fieldId,
8900
+ recordId: recordId,
8901
+ references,
8902
+ aiTable: aiTable
8903
+ },
8904
+ panelClass: 'grid-cell-editor',
8905
+ outsideClosable: true,
8906
+ hasBackdrop: false,
8907
+ manualClosure: true,
8908
+ animationDisabled: true,
8909
+ autoAdaptive: true
8910
+ });
8911
+ if (this.cellEditorPopoverRef) {
8912
+ const wheelEvent = fromEvent(this.cellEditorPopoverRef.componentInstance.elementRef.nativeElement, 'wheel').subscribe((event) => {
8913
+ const field = aiTable.fieldsMap()[fieldId];
8914
+ if (field.type === AITableFieldType.text || field.type === AITableFieldType.richText) {
8915
+ return;
8766
8916
  }
8767
- const x = coordinate.getColumnOffset(columnIndex);
8768
- const y = coordinate.getRowOffset(rowIndex);
8769
- const columnWidth = coordinate.getColumnWidth(columnIndex);
8770
- const isFrozenColumn = columnIndex < frozenColumnCount;
8771
- const { offset, width } = getCellHorizontalPosition({
8772
- columnWidth,
8773
- columnIndex,
8774
- columnCount: totalColumnCount
8917
+ event.preventDefault();
8918
+ this.aiTable.context?.scrollAction({
8919
+ deltaX: event.deltaX,
8920
+ deltaY: event.deltaY,
8921
+ shiftKey: event.shiftKey,
8922
+ callback: () => {
8923
+ const originPosition = this.getOriginPosition(aiTable, options);
8924
+ const positionStrategy = this.cellEditorPopoverRef
8925
+ .getOverlayRef()
8926
+ .getConfig().positionStrategy;
8927
+ positionStrategy.setOrigin(originPosition);
8928
+ positionStrategy.apply();
8929
+ }
8775
8930
  });
8776
- const currentConfig = {
8777
- x: x + offset + AI_TABLE_OFFSET,
8778
- y: y + AI_TABLE_OFFSET,
8779
- width: width - AI_TABLE_CELL_BORDER / 2,
8780
- height: rowHeight - AI_TABLE_CELL_BORDER / 2,
8781
- strokeWidth: AI_TABLE_CELL_BORDER,
8782
- stroke: colors.primary,
8783
- fillEnabled: false,
8784
- listening: false
8931
+ });
8932
+ this.cellEditorPopoverRef.afterClosed().subscribe(() => {
8933
+ wheelEvent.unsubscribe();
8934
+ this.cellEditorPopoverRef = null;
8935
+ });
8936
+ this.cellEditorPopoverRef.componentInstance.updateFieldValue.subscribe((value) => {
8937
+ options.updateFieldValue(value);
8938
+ });
8939
+ }
8940
+ return this.cellEditorPopoverRef;
8941
+ }
8942
+ closeCellEditor() {
8943
+ if (this.cellEditorPopoverRef) {
8944
+ this.cellEditorPopoverRef.close();
8945
+ this.cellEditorPopoverRef = null;
8946
+ }
8947
+ }
8948
+ getCurrentEditCell() {
8949
+ if (this.cellEditorPopoverRef) {
8950
+ const recordId = this.cellEditorPopoverRef.componentInstance?.recordId;
8951
+ const fieldId = this.cellEditorPopoverRef.componentInstance?.fieldId;
8952
+ if (recordId && fieldId) {
8953
+ return {
8954
+ recordId,
8955
+ fieldId
8785
8956
  };
8786
- if (isFrozenColumn) {
8787
- frozenActiveCellBorder = currentConfig;
8788
- }
8789
- else {
8790
- activeCellBorder = currentConfig;
8791
- }
8792
8957
  }
8958
+ return null;
8793
8959
  }
8960
+ return null;
8794
8961
  }
8795
- return {
8796
- activeCellBorder,
8797
- frozenActiveCellBorder
8798
- };
8799
- };
8800
-
8801
- class AITableHoverCells {
8802
- constructor() {
8803
- this.config = input.required();
8804
- this.componentMap = {};
8805
- this.groupConfig = computed(() => {
8806
- return {
8807
- x: this.hoverCellConfig()?.x,
8808
- y: this.hoverCellConfig()?.y
8809
- };
8810
- });
8811
- this.hoverCellConfig = computed(() => {
8812
- const { aiTable, coordinate, references, readonly } = this.config();
8813
- const pointPosition = aiTable.context.pointPosition();
8814
- const hoverCell = this.hoverCell();
8815
- if (!hoverCell) {
8816
- return;
8817
- }
8818
- const { field, recordId, fieldId, renderComponentDefinition } = hoverCell;
8819
- const cellValue = AITableQueries.getFieldValue(aiTable, [recordId, field._id]);
8820
- const transformValue = transformCellValue(aiTable, field, cellValue);
8821
- const { rowHeight, columnCount, rowCount } = coordinate;
8822
- const columnIndex = pointPosition.columnIndex;
8823
- const rowIndex = pointPosition.rowIndex;
8824
- const x = coordinate.getColumnOffset(columnIndex) + AI_TABLE_OFFSET;
8825
- const columnWidth = coordinate.getColumnWidth(columnIndex);
8826
- const y = coordinate.getRowOffset(rowIndex) + AI_TABLE_OFFSET;
8827
- const { width } = getCellHorizontalPosition({
8828
- columnWidth,
8829
- columnIndex,
8830
- columnCount
8831
- });
8832
- const style = {
8833
- textAlign: DEFAULT_TEXT_ALIGN_LEFT
8834
- };
8835
- const textAlign = style.textAlign;
8836
- const renderX = textAlign === DEFAULT_TEXT_ALIGN_RIGHT
8837
- ? columnWidth - AI_TABLE_CELL_PADDING + AI_TABLE_OFFSET
8838
- : AI_TABLE_CELL_PADDING + AI_TABLE_OFFSET;
8839
- const renderY = 0 - AI_TABLE_OFFSET * 2;
8840
- const result = {
8841
- field,
8842
- recordId,
8962
+ openContextMenu(aiTable, options) {
8963
+ const { origin, position, menuItems, targetName, viewContainerRef } = options;
8964
+ const ref = this.thyPopover.open(AITableContextMenu, {
8965
+ origin: origin,
8966
+ originPosition: position,
8967
+ placement: 'bottomLeft',
8968
+ insideClosable: true,
8969
+ viewContainerRef,
8970
+ initialState: {
8843
8971
  aiTable,
8844
- coordinate,
8845
- x,
8846
- y,
8847
- readonly,
8848
- render: {
8849
- aiTable,
8850
- recordId,
8851
- field,
8852
- isActive: isSelectedField(field._id, aiTable),
8853
- x: renderX,
8854
- y: renderY,
8855
- columnWidth: width,
8856
- rowHeight,
8857
- cellValue,
8858
- transformValue,
8859
- style,
8860
- references
8861
- }
8862
- };
8863
- return result;
8972
+ menuItems,
8973
+ targetName,
8974
+ position
8975
+ }
8864
8976
  });
8865
- this.hoverCell = computed(() => getHoverCell(this.config().aiTable));
8977
+ return ref;
8866
8978
  }
8867
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableHoverCells, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
8868
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableHoverCells, isStandalone: true, selector: "ai-table-hover-cell", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
8869
- @if (hoverCell()) {
8870
- <ko-group [config]="groupConfig()">
8871
- <ng-container *ngComponentOutlet="hoverCell()!.renderComponentDefinition; inputs: { config: hoverCellConfig() }">
8872
- </ng-container>
8873
- </ko-group>
8874
- }
8875
- `, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
8979
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
8980
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService }); }
8876
8981
  }
8877
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableHoverCells, decorators: [{
8878
- type: Component,
8879
- args: [{
8880
- selector: 'ai-table-hover-cell',
8881
- template: `
8882
- @if (hoverCell()) {
8883
- <ko-group [config]="groupConfig()">
8884
- <ng-container *ngComponentOutlet="hoverCell()!.renderComponentDefinition; inputs: { config: hoverCellConfig() }">
8885
- </ng-container>
8886
- </ko-group>
8887
- }
8888
- `,
8889
- standalone: true,
8890
- imports: [KoShape, KoContainer, CommonModule],
8891
- changeDetection: ChangeDetectionStrategy.OnPush
8892
- }]
8982
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, decorators: [{
8983
+ type: Injectable
8893
8984
  }] });
8894
8985
 
8895
- Konva.pixelRatio = 2;
8896
- class AITableRenderer {
8986
+ class AITableGridBase {
8897
8987
  constructor() {
8898
- this.config = input.required();
8899
- this.koMousemove = output();
8900
- this.koMousedown = output();
8901
- this.koMouseup = output();
8902
- this.koContextmenu = output();
8903
- this.koWheel = output();
8904
- this.koClick = output();
8905
- this.koDblclick = output();
8906
- this.koMouseleave = output();
8907
- this.fields = computed(() => {
8908
- return AITable.getVisibleFields(this.config().aiTable);
8909
- });
8910
- this.readonly = computed(() => {
8911
- return this.config()?.readonly;
8912
- });
8913
- this.coordinate = computed(() => {
8914
- return this.config()?.coordinate;
8915
- });
8916
- this.containerWidth = computed(() => {
8917
- return this.config().containerWidth;
8918
- });
8919
- this.containerHeight = computed(() => {
8920
- return this.config().containerHeight;
8921
- });
8922
- this.scrollState = computed(() => {
8923
- return this.config()?.aiTable.context.scrollState();
8924
- });
8925
- this.visibleRangeInfo = computed(() => {
8926
- return getVisibleRangeInfo(this.coordinate(), this.scrollState());
8927
- });
8928
- this.frozenAreaWidth = computed(() => {
8929
- return AI_TABLE_ROW_HEAD_WIDTH + this.coordinate().frozenColumnWidth;
8930
- });
8931
- this.lastColumnWidth = computed(() => {
8932
- return this.coordinate().getColumnWidth(this.visibleRangeInfo().columnStopIndex);
8933
- });
8934
- this.lastColumnOffset = computed(() => {
8935
- return this.coordinate().getColumnOffset(this.visibleRangeInfo().columnStopIndex);
8936
- });
8937
- this.cellGroupClipWidth = computed(() => {
8938
- return this.containerWidth() - this.frozenAreaWidth();
8939
- });
8940
- this.stageConfig = computed(() => {
8941
- const { isScrolling } = this.scrollState();
8942
- return {
8943
- width: this.containerWidth(),
8944
- height: this.containerHeight(),
8945
- listening: isScrolling ? false : true
8946
- };
8947
- });
8948
- this.gridGroupConfig = computed(() => {
8949
- return {
8950
- clipX: 0,
8951
- clipY: 0,
8952
- clipWidth: this.containerWidth(),
8953
- clipHeight: this.containerHeight()
8954
- };
8955
- });
8956
- this.commonGroupConfig = computed(() => {
8957
- return {
8958
- clipX: this.frozenAreaWidth() + 1,
8959
- clipY: 0,
8960
- clipWidth: this.cellGroupClipWidth(),
8961
- clipHeight: this.containerHeight()
8962
- };
8963
- });
8964
- this.attachGroupConfig = computed(() => {
8965
- return {
8966
- clipX: this.frozenAreaWidth() - 1,
8967
- clipY: this.coordinate().rowInitSize - 1,
8968
- clipWidth: this.containerWidth() - this.frozenAreaWidth(),
8969
- clipHeight: this.containerHeight() - this.coordinate().rowInitSize
8970
- };
8971
- });
8972
- this.frozenAttachGroupConfig = computed(() => {
8973
- return {
8974
- clipX: 0,
8975
- clipY: this.coordinate().rowInitSize - 1,
8976
- clipWidth: this.frozenAreaWidth() + 4,
8977
- clipHeight: this.containerHeight() - this.coordinate().rowInitSize
8978
- };
8979
- });
8980
- this.offsetYConfig = computed(() => {
8981
- const { scrollTop } = this.scrollState();
8982
- return {
8983
- offsetY: scrollTop
8984
- };
8985
- });
8986
- this.offsetXConfig = computed(() => {
8987
- const { scrollLeft } = this.scrollState();
8988
- return {
8989
- offsetX: scrollLeft
8990
- };
8988
+ this.aiRecords = model.required();
8989
+ this.aiFields = model.required();
8990
+ this.aiFieldsSizeMap = model.required();
8991
+ this.aiContextMenuItems = input();
8992
+ this.aiFieldConfig = input();
8993
+ this.aiReadonly = input(false);
8994
+ this.aiPlugins = input();
8995
+ this.aiReferences = input.required();
8996
+ this.aiBuildRenderDataFn = input();
8997
+ this.aiGetI18nTextByKey = input();
8998
+ this.aiKeywords = input();
8999
+ this.AITableFieldType = AITableFieldType;
9000
+ this.AITableSelectOptionStyle = AITableSelectOptionStyle;
9001
+ this.isSelectedAll = computed(() => {
9002
+ return this.aiTable.selection().selectedRecords.size === this.aiRecords().length;
8991
9003
  });
8992
- this.offsetConfig = computed(() => {
8993
- const { scrollLeft, scrollTop } = this.scrollState();
8994
- return {
8995
- offsetX: scrollLeft,
8996
- offsetY: scrollTop
8997
- };
9004
+ this.aiTableInitialized = output();
9005
+ this.aiAddRecord = output();
9006
+ this.aiAddField = output();
9007
+ this.aiMoveField = output();
9008
+ this.aiUpdateFieldValue = output();
9009
+ this.aiSetField = output();
9010
+ this.aiSetFieldWidth = output();
9011
+ this.aiClick = output();
9012
+ this.aiDbClick = output();
9013
+ this.fieldMenus = computed(() => {
9014
+ const fieldMenusFn = this.aiFieldConfig()?.fieldMenus;
9015
+ if (fieldMenusFn && this.aiTable) {
9016
+ return fieldMenusFn(this.aiTable);
9017
+ }
9018
+ return [];
8998
9019
  });
8999
- this.columnHeadOrAddFieldConfig = computed(() => {
9000
- const { columnStartIndex, columnStopIndex } = this.visibleRangeInfo();
9001
- const { aiTable, coordinate, readonly } = this.config();
9002
- const { pointPosition } = aiTable.context;
9003
- const fields = this.fields();
9020
+ this.gridData = computed(() => {
9021
+ if (this.aiBuildRenderDataFn && this.aiBuildRenderDataFn() && this.aiTable) {
9022
+ return this.aiBuildRenderDataFn()(this.aiTable);
9023
+ }
9004
9024
  return {
9005
- aiTable,
9006
- coordinate,
9007
- fields,
9008
- columnStartIndex,
9009
- columnStopIndex,
9010
- pointPosition: pointPosition(),
9011
- readonly
9025
+ records: this.aiRecords(),
9026
+ fields: this.aiFields(),
9027
+ fieldsSizeMap: this.aiFieldsSizeMap()
9012
9028
  };
9013
9029
  });
9014
- this.cellsConfig = computed(() => {
9015
- const { aiTable, coordinate, references } = this.config();
9016
- const { rowStartIndex, rowStopIndex, columnStartIndex, columnStopIndex } = this.visibleRangeInfo();
9017
- return {
9018
- aiTable,
9019
- coordinate,
9020
- references,
9021
- rowStartIndex,
9022
- rowStopIndex,
9023
- columnStartIndex,
9024
- columnStopIndex
9025
- };
9030
+ this.ngZone = inject(NgZone);
9031
+ this.elementRef = inject(ElementRef);
9032
+ this.destroyRef = inject(DestroyRef);
9033
+ this.aiTableGridFieldService = inject(AITableGridFieldService);
9034
+ this.aiTableGridEventService = inject(AITableGridEventService);
9035
+ this.aiTableGridSelectionService = inject(AITableGridSelectionService);
9036
+ }
9037
+ ngOnInit() {
9038
+ this.initAITable();
9039
+ this.initService();
9040
+ }
9041
+ initAITable() {
9042
+ this.aiTable = createAITable(this.aiRecords, this.aiFields, this.gridData);
9043
+ if (this.aiGetI18nTextByKey()) {
9044
+ this.aiTable.getI18nTextByKey = this.aiGetI18nTextByKey();
9045
+ }
9046
+ this.aiPlugins()?.forEach((plugin) => {
9047
+ this.aiTable = plugin(this.aiTable);
9026
9048
  });
9027
- this.activeCellBorderConfig = computed(() => {
9028
- return createActiveCellBorder(this.cellsConfig());
9049
+ this.aiTableInitialized.emit(this.aiTable);
9050
+ }
9051
+ initService() {
9052
+ this.aiTableGridEventService.initialize(this.aiTable, this.aiFieldConfig()?.fieldRenderers);
9053
+ this.aiTableGridSelectionService.initialize(this.aiTable);
9054
+ this.aiTableGridEventService.registerEvents(this.elementRef.nativeElement);
9055
+ this.aiTableGridFieldService.initAIFieldConfig(this.aiFieldConfig());
9056
+ AI_TABLE_GRID_FIELD_SERVICE_MAP.set(this.aiTable, this.aiTableGridFieldService);
9057
+ }
9058
+ addRecord() {
9059
+ const records = this.aiRecords();
9060
+ const recordCount = records.length;
9061
+ this.aiAddRecord.emit({
9062
+ originId: recordCount > 0 ? records[records.length - 1]._id : ''
9029
9063
  });
9030
9064
  }
9031
- stageMousemove(e) {
9032
- this.koMousemove.emit(e);
9065
+ selectRecord(recordId) {
9066
+ this.aiTableGridSelectionService.selectRecord(recordId);
9033
9067
  }
9034
- stageMousedown(e) {
9035
- this.koMousedown.emit(e);
9068
+ toggleSelectAll(checked) {
9069
+ this.aiTableGridSelectionService.toggleSelectAll(checked);
9036
9070
  }
9037
- stageMouseup(e) {
9038
- this.koMouseup.emit(e);
9071
+ addField(gridColumnBlank, position) {
9072
+ const field = createDefaultField(this.aiTable, AITableFieldType.text);
9073
+ const popoverRef = this.aiTableGridFieldService.editFieldProperty(this.aiTable, {
9074
+ field,
9075
+ isUpdate: false,
9076
+ origin: gridColumnBlank,
9077
+ position
9078
+ });
9079
+ if (popoverRef && !this.aiFieldConfig()?.fieldSettingComponent) {
9080
+ popoverRef.componentInstance.addField.subscribe((defaultValue) => {
9081
+ const fields = this.gridData().fields;
9082
+ const fieldCount = fields.length;
9083
+ this.aiAddField.emit({
9084
+ originId: fieldCount > 0 ? fields[fields.length - 1]._id : '',
9085
+ defaultValue
9086
+ });
9087
+ });
9088
+ }
9039
9089
  }
9040
- stageContextmenu(e) {
9041
- this.koContextmenu.emit(e);
9090
+ subscribeEvents() {
9091
+ this.ngZone.runOutsideAngular(() => {
9092
+ this.aiTableGridEventService.dblClickEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
9093
+ this.dblClick(event);
9094
+ });
9095
+ this.aiTableGridEventService.mousedownEvent$
9096
+ .pipe(mergeWith(this.aiTableGridEventService.globalMousedownEvent$), takeUntilDestroyed(this.destroyRef))
9097
+ .subscribe((event) => {
9098
+ this.aiTableGridSelectionService.updateSelect(event);
9099
+ });
9100
+ this.aiTableGridEventService.mouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
9101
+ this.mouseoverHandle(event);
9102
+ });
9103
+ this.aiTableGridEventService.globalMouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
9104
+ this.closeHoverCellEditor(event);
9105
+ });
9106
+ });
9042
9107
  }
9043
- stageClick(e) {
9044
- this.koClick.emit(e);
9108
+ dblClick(event) {
9109
+ const cellDom = event.target.closest('.grid-cell');
9110
+ const type = cellDom && cellDom.getAttribute('type');
9111
+ if (type && DBL_CLICK_EDIT_TYPE.includes(type)) {
9112
+ this.aiTableGridEventService.openEdit(cellDom);
9113
+ }
9045
9114
  }
9046
- stageDblclick(e) {
9047
- this.koDblclick.emit(e);
9115
+ mouseoverHandle(event) {
9116
+ if (this.mouseoverRef) {
9117
+ this.mouseoverRef?.close();
9118
+ }
9119
+ const cellDom = event.target.closest('.grid-cell');
9120
+ const type = cellDom && cellDom.getAttribute('type');
9121
+ if (type && MOUSEOVER_EDIT_TYPE.includes(type)) {
9122
+ this.mouseoverRef = this.aiTableGridEventService.openEdit(cellDom);
9123
+ }
9048
9124
  }
9049
- stageMouseleave(e) {
9050
- this.koMouseleave.emit(e);
9125
+ closeHoverCellEditor(e) {
9126
+ if (this.mouseoverRef) {
9127
+ const hasGrid = e.target && e.target.closest('.ai-table-grid');
9128
+ const hasCellEditor = e.target && e.target.closest('.grid-cell-editor');
9129
+ if (!hasGrid && !hasCellEditor) {
9130
+ this.mouseoverRef.close();
9131
+ }
9132
+ }
9051
9133
  }
9052
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9053
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableRenderer, isStandalone: true, selector: "ai-table-renderer", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { koMousemove: "koMousemove", koMousedown: "koMousedown", koMouseup: "koMouseup", koContextmenu: "koContextmenu", koWheel: "koWheel", koClick: "koClick", koDblclick: "koDblclick", koMouseleave: "koMouseleave" }, ngImport: i0, template: "<ko-stage\n [config]=\"stageConfig()\"\n (koMousemove)=\"stageMousemove($event)\"\n (koMousedown)=\"stageMousedown($event)\"\n (koMouseup)=\"stageMouseup($event)\"\n (koContextmenu)=\"stageContextmenu($event)\"\n (koClick)=\"stageClick($event)\"\n (koDblclick)=\"stageDblclick($event)\"\n (koMouseleave)=\"stageMouseleave($event)\"\n>\n <ko-layer>\n <ko-group [config]=\"gridGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n <ai-table-frozen-cells [config]=\"cellsConfig()\"></ai-table-frozen-cells>\n <ai-table-other-rows [config]=\"cellsConfig()\"></ai-table-other-rows>\n <ai-table-hover-row-heads [config]=\"cellsConfig()\"></ai-table-hover-row-heads>\n <ai-table-frozen-placeholder-cells [config]=\"cellsConfig()\"></ai-table-frozen-placeholder-cells>\n </ko-group>\n\n <ko-group>\n <ai-table-frozen-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-frozen-column-heads>\n </ko-group>\n\n <ko-group [config]=\"commonGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-cells [config]=\"cellsConfig()\"></ai-table-cells>\n </ko-group>\n\n <ko-group [config]=\"offsetXConfig()\">\n <ai-table-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-column-heads>\n <ai-table-add-field [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-add-field>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"attachGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-placeholder-cells [config]=\"cellsConfig()\"></ai-table-placeholder-cells>\n @if (activeCellBorderConfig().activeCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().activeCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"frozenAttachGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n @if (activeCellBorderConfig().frozenActiveCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().frozenActiveCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoStage, selector: "ko-stage", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableColumnHeads, selector: "ai-table-column-heads", inputs: ["config"] }, { kind: "component", type: AITableFrozenColumnHeads, selector: "ai-table-frozen-column-heads", inputs: ["config"] }, { kind: "component", type: AITableCells, selector: "ai-table-cells", inputs: ["config"] }, { kind: "component", type: AITableFrozenCells, selector: "ai-table-frozen-cells", inputs: ["config"] }, { kind: "component", type: AITableFrozenPlaceholderCells, selector: "ai-table-frozen-placeholder-cells", inputs: ["config"] }, { kind: "component", type: AITableHoverCells, selector: "ai-table-hover-cell", inputs: ["config"] }, { kind: "component", type: AITablePlaceholderCells, selector: "ai-table-placeholder-cells", inputs: ["config"] }, { kind: "component", type: AITableAddField, selector: "ai-table-add-field", inputs: ["config"] }, { kind: "component", type: AITableHoverRowHeads, selector: "ai-table-hover-row-heads", inputs: ["config"] }, { kind: "component", type: AITableOtherRows, selector: "ai-table-other-rows", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9134
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9135
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableGridBase, isStandalone: true, selector: "ai-table-grid-base", inputs: { aiRecords: { classPropertyName: "aiRecords", publicName: "aiRecords", isSignal: true, isRequired: true, transformFunction: null }, aiFields: { classPropertyName: "aiFields", publicName: "aiFields", isSignal: true, isRequired: true, transformFunction: null }, aiFieldsSizeMap: { classPropertyName: "aiFieldsSizeMap", publicName: "aiFieldsSizeMap", isSignal: true, isRequired: true, transformFunction: null }, aiContextMenuItems: { classPropertyName: "aiContextMenuItems", publicName: "aiContextMenuItems", isSignal: true, isRequired: false, transformFunction: null }, aiFieldConfig: { classPropertyName: "aiFieldConfig", publicName: "aiFieldConfig", isSignal: true, isRequired: false, transformFunction: null }, aiReadonly: { classPropertyName: "aiReadonly", publicName: "aiReadonly", isSignal: true, isRequired: false, transformFunction: null }, aiPlugins: { classPropertyName: "aiPlugins", publicName: "aiPlugins", isSignal: true, isRequired: false, transformFunction: null }, aiReferences: { classPropertyName: "aiReferences", publicName: "aiReferences", isSignal: true, isRequired: true, transformFunction: null }, aiBuildRenderDataFn: { classPropertyName: "aiBuildRenderDataFn", publicName: "aiBuildRenderDataFn", isSignal: true, isRequired: false, transformFunction: null }, aiGetI18nTextByKey: { classPropertyName: "aiGetI18nTextByKey", publicName: "aiGetI18nTextByKey", isSignal: true, isRequired: false, transformFunction: null }, aiKeywords: { classPropertyName: "aiKeywords", publicName: "aiKeywords", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { aiRecords: "aiRecordsChange", aiFields: "aiFieldsChange", aiFieldsSizeMap: "aiFieldsSizeMapChange", aiTableInitialized: "aiTableInitialized", aiAddRecord: "aiAddRecord", aiAddField: "aiAddField", aiMoveField: "aiMoveField", aiUpdateFieldValue: "aiUpdateFieldValue", aiSetField: "aiSetField", aiSetFieldWidth: "aiSetFieldWidth", aiClick: "aiClick", aiDbClick: "aiDbClick" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9054
9136
  }
9055
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, decorators: [{
9137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, decorators: [{
9056
9138
  type: Component,
9057
- args: [{ selector: 'ai-table-renderer', standalone: true, imports: [
9058
- KoContainer,
9059
- KoStage,
9060
- KoShape,
9061
- AITableColumnHeads,
9062
- AITableFrozenColumnHeads,
9063
- AITableCells,
9064
- AITableFrozenCells,
9065
- AITableFrozenPlaceholderCells,
9066
- AITableHoverCells,
9067
- AITablePlaceholderCells,
9068
- AITableAddField,
9069
- AITableHoverRowHeads,
9070
- AITableOtherRows,
9071
- AITableCellLink
9072
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ko-stage\n [config]=\"stageConfig()\"\n (koMousemove)=\"stageMousemove($event)\"\n (koMousedown)=\"stageMousedown($event)\"\n (koMouseup)=\"stageMouseup($event)\"\n (koContextmenu)=\"stageContextmenu($event)\"\n (koClick)=\"stageClick($event)\"\n (koDblclick)=\"stageDblclick($event)\"\n (koMouseleave)=\"stageMouseleave($event)\"\n>\n <ko-layer>\n <ko-group [config]=\"gridGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n <ai-table-frozen-cells [config]=\"cellsConfig()\"></ai-table-frozen-cells>\n <ai-table-other-rows [config]=\"cellsConfig()\"></ai-table-other-rows>\n <ai-table-hover-row-heads [config]=\"cellsConfig()\"></ai-table-hover-row-heads>\n <ai-table-frozen-placeholder-cells [config]=\"cellsConfig()\"></ai-table-frozen-placeholder-cells>\n </ko-group>\n\n <ko-group>\n <ai-table-frozen-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-frozen-column-heads>\n </ko-group>\n\n <ko-group [config]=\"commonGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-cells [config]=\"cellsConfig()\"></ai-table-cells>\n </ko-group>\n\n <ko-group [config]=\"offsetXConfig()\">\n <ai-table-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-column-heads>\n <ai-table-add-field [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-add-field>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"attachGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-placeholder-cells [config]=\"cellsConfig()\"></ai-table-placeholder-cells>\n @if (activeCellBorderConfig().activeCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().activeCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"frozenAttachGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n @if (activeCellBorderConfig().frozenActiveCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().frozenActiveCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n" }]
9139
+ args: [{
9140
+ selector: 'ai-table-grid-base',
9141
+ template: '',
9142
+ standalone: true,
9143
+ changeDetection: ChangeDetectionStrategy.OnPush
9144
+ }]
9145
+ }] });
9146
+
9147
+ class AITableDomGrid extends AITableGridBase {
9148
+ ngOnInit() {
9149
+ super.ngOnInit();
9150
+ this.subscribeEvents();
9151
+ }
9152
+ openFieldMenu(e, field, fieldAction) {
9153
+ const moreBtn = e.target.closest('.grid-field-action');
9154
+ this.aiTableGridFieldService.openFieldMenu(this.aiTable, {
9155
+ origin: moreBtn,
9156
+ editOrigin: fieldAction,
9157
+ fieldId: field._id,
9158
+ fieldMenus: this.fieldMenus()
9159
+ });
9160
+ }
9161
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
9162
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableDomGrid, isStandalone: true, selector: "ai-table-dom-grid", host: { classAttribute: "ai-table-grid ai-table-dom-grid" }, providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], usesInheritance: true, ngImport: i0, template: "<div class=\"grid-header d-flex\">\n <div class=\"grid-column-checkbox grid-cell grid-checkbox\">\n <label thyCheckbox thyLabelText=\"\" [ngModel]=\"isSelectedAll()\" (ngModelChange)=\"toggleSelectAll($event)\"></label>\n </div>\n @for (field of gridData().fields; track field._id) {\n <div\n class=\"grid-cell grid-field\"\n #fieldAction\n [attr.fieldId]=\"field._id\"\n [ngClass]=\"{ highlight: aiTable.selection().selectedFields.has(field._id) }\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n <span class=\"text-truncate\">\n <thy-icon [thyIconName]=\"field.icon!\" class=\"mr-2 text-muted\"></thy-icon>\n <span>{{ field.name }}</span>\n </span>\n <a\n href=\"javascript:;\"\n class=\"grid-field-action\"\n thyAction\n thyIcon=\"more-vertical\"\n (click)=\"openFieldMenu($event, field, fieldAction)\"\n >\n </a>\n </div>\n }\n <div class=\"grid-column-blank cursor-pointer\" #gridColumnBlank (click)=\"addField(gridColumnBlank)\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n<div class=\"grid-body d-flex\">\n @for (record of gridData().records; track record._id; let index = $index) {\n <div class=\"grid-row d-flex\" [ngClass]=\"{ highlight: (record._id | isSelectRecord: aiTable.selection()) }\">\n <div class=\"grid-row-index grid-checkbox\">\n <label\n [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'checked-box' : 'unchecked-box'\"\n thyCheckbox\n thyLabelText=\"\"\n [ngModel]=\"record._id | isSelectRecord: aiTable.selection()\"\n (ngModelChange)=\"selectRecord(record._id)\"\n ></label>\n <span [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'grid-row-no-number' : 'grid-row-number'\">\n {{ index + 1 }}\n </span>\n </div>\n @for (field of gridData().fields; track field._id) {\n <!-- [ngClass]=\"{\n highlight: aiTable.selection().selectedCells.has(record._id) || aiTable.selection().selectedFields.has(field._id),\n selected: aiTable.selection().selectedCells.get(record._id)?.hasOwnProperty(field._id)\n }\" -->\n <div\n #cell\n class=\"grid-cell\"\n [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n @switch (field.type) {\n @case (AITableFieldType.select) {\n @let fieldValue = record.values[field._id];\n @let settings = field.settings! | selectSetting;\n @let options = settings['options'];\n @let optionStyle = settings['option_style'] || AITableSelectOptionStyle.tag;\n @let isTagStyle = optionStyle === AITableSelectOptionStyle.tag;\n\n @if (!settings['is_multiple'] && fieldValue | selectOption: options; as selectedOption) {\n @if (isTagStyle) {\n <select-option class=\"mb-1 mr-1\" [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n </div>\n }\n } @else {\n @let maxShowCount = 2;\n\n <div class=\"d-flex\">\n @if (fieldValue | selectOptions: options; as selectedOptions) {\n @for (option of selectedOptions; track option!._id; let i = $index) {\n @if (i + 1 <= maxShowCount) {\n @if (isTagStyle) {\n <select-option\n class=\"mb-1 mr-1\"\n [field]=\"field\"\n [displayOption]=\"option!\"\n ></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"option!\"></select-option>\n </div>\n }\n }\n }\n\n @let selectedLength = selectedOptions.length || 0;\n @if (selectedOptions && maxShowCount < selectedLength) {\n @let shape = isTagStyle ? 'pill' : 'rectangle';\n @let isHidden = maxShowCount >= selectedLength;\n\n <thy-tag\n class=\"cursor-pointer\"\n [class.multi-property-value-hidden]=\"isHidden\"\n [thyShape]=\"shape\"\n >\n <span class=\"text-truncate\"> +{{ selectedLength - maxShowCount }} </span>\n </thy-tag>\n }\n }\n </div>\n }\n }\n @case (AITableFieldType.date) {\n {{ record.values[field._id].timestamp | thyDatePickerFormat }}\n }\n @case (AITableFieldType.updatedAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.createdAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.rate) {\n <thy-rate [ngModel]=\"record.values[field._id]\"></thy-rate>\n }\n @case (AITableFieldType.link) {\n <a\n class=\"d-block\"\n target=\"_blank\"\n [href]=\"record.values[field._id]?.url\"\n thyStopPropagation\n thyFlexibleText\n [thyTooltipContent]=\"record.values[field._id]?.text\"\n >\n {{ record.values[field._id]?.text }}\n </a>\n }\n @case (AITableFieldType.progress) {\n <thy-progress\n class=\"w-100\"\n [thyValue]=\"record.values[field._id] || 0\"\n [thySize]=\"record.values[field._id]?.config?.size || 'md'\"\n [thyMax]=\"record.values[field._id]?.config?.max || 100\"\n [thyType]=\"record.values[field._id]?.config?.progressType || 'success'\"\n >\n <span> {{ record.values[field._id] || 0 }}{{ record.values[field._id]?.config?.suffix || '%' }} </span>\n </thy-progress>\n }\n @case (AITableFieldType.member) {\n @let settings = field.settings! | memberSetting;\n\n @if (!settings!['is_multiple']) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n } @else {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n <thy-avatar-list thyAvatarSize=\"xs\">\n @for (item of recordValues; track $index) {\n <thy-avatar [thyName]=\"item.display_name!\" [thySrc]=\"item.avatar!\"></thy-avatar>\n }\n </thy-avatar-list>\n }\n }\n @case (AITableFieldType.createdBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @case (AITableFieldType.updatedBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @default {\n <span class=\"text-truncate\"> {{ record.values[field._id] }}</span>\n }\n }\n <div class=\"autofill-container\"></div>\n </div>\n }\n <div class=\"grid-column-blank\"></div>\n </div>\n }\n <div class=\"grid-row-insert grid-row cursor-pointer\" (click)=\"addRecord()\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n\n<div #activeBorder class=\"active-border\"></div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: SelectOptionPipe, name: "selectOption" }, { kind: "pipe", type: SelectOptionsPipe, name: "selectOptions" }, { kind: "component", type: ThyTag, selector: "thy-tag,[thyTag]", inputs: ["thyTag", "thyShape", "thyColor", "thyTheme", "thySize", "thyHoverable"] }, { kind: "ngmodule", type: ThyPopoverModule }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "component", type: ThyRate, selector: "thy-rate", inputs: ["thyCount", "thyDisabled", "thyAllowHalf", "thyAllowClear", "thyTooltips", "thyIconTemplate"], outputs: ["thyItemHoverChange"] }, { kind: "component", type: ThyProgress, selector: "thy-progress", inputs: ["thyType", "thySize", "thyValue", "thyMax", "thyTips", "thyShape", "thyGapDegree", "thyGapPosition", "thyStrokeWidth"] }, { kind: "pipe", type: ThyDatePickerFormatPipe, name: "thyDatePickerFormat" }, { kind: "component", type: ThyFlexibleText, selector: "thy-flexible-text,[thyFlexibleText]", inputs: ["thyTooltipTrigger", "thyContainerClass", "thyTooltipContent", "thyTooltipPlacement", "thyTooltipOffset"], exportAs: ["thyFlexibleText"] }, { kind: "directive", type: ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "ngmodule", type: ThyCheckboxModule }, { kind: "component", type: i3$1.ThyCheckbox, selector: "thy-checkbox,[thy-checkbox],[thyCheckbox]", inputs: ["thyIndeterminate"] }, { kind: "ngmodule", type: ThyAvatarModule }, { kind: "component", type: i4.ThyAvatar, selector: "thy-avatar", inputs: ["thyShowName", "thySrc", "thyName", "thySize", "thyShowRemove", "thyRemovable", "thyImgClass", "thyDisabled", "thyLoading", "thyFetchPriority"], outputs: ["thyOnRemove", "thyRemove", "thyError"] }, { kind: "component", type: i4.ThyAvatarList, selector: "thy-avatar-list", inputs: ["thyMode", "thyAvatarSize"] }, { kind: "pipe", type: IsSelectRecordPipe, name: "isSelectRecord" }, { kind: "component", type: SelectOptionComponent, selector: "select-option", inputs: ["field", "displayOption"] }, { kind: "pipe", type: UserPipe, name: "user" }, { kind: "pipe", type: SelectSettingPipe, name: "selectSetting" }, { kind: "pipe", type: MemberSettingPipe, name: "memberSetting" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
9163
+ }
9164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, decorators: [{
9165
+ type: Component,
9166
+ args: [{ selector: 'ai-table-dom-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
9167
+ class: 'ai-table-grid ai-table-dom-grid'
9168
+ }, imports: [
9169
+ NgClass,
9170
+ NgComponentOutlet,
9171
+ CommonModule,
9172
+ FormsModule,
9173
+ SelectOptionPipe,
9174
+ SelectOptionsPipe,
9175
+ ThyTag,
9176
+ ThyPopoverModule,
9177
+ ThyIcon,
9178
+ ThyRate,
9179
+ ThyProgress,
9180
+ AITableFieldSetting,
9181
+ ThyDatePickerFormatPipe,
9182
+ ThyFlexibleText,
9183
+ ThyStopPropagationDirective,
9184
+ AITableFieldMenu,
9185
+ ThyAction,
9186
+ ThyDropdownDirective,
9187
+ ThyDropdownMenuComponent,
9188
+ ThyCheckboxModule,
9189
+ ProgressEditorComponent,
9190
+ ThyAvatarModule,
9191
+ NgTemplateOutlet,
9192
+ IsSelectRecordPipe,
9193
+ ProgressEditorComponent,
9194
+ SelectOptionComponent,
9195
+ UserPipe,
9196
+ SelectSettingPipe,
9197
+ MemberSettingPipe
9198
+ ], providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], template: "<div class=\"grid-header d-flex\">\n <div class=\"grid-column-checkbox grid-cell grid-checkbox\">\n <label thyCheckbox thyLabelText=\"\" [ngModel]=\"isSelectedAll()\" (ngModelChange)=\"toggleSelectAll($event)\"></label>\n </div>\n @for (field of gridData().fields; track field._id) {\n <div\n class=\"grid-cell grid-field\"\n #fieldAction\n [attr.fieldId]=\"field._id\"\n [ngClass]=\"{ highlight: aiTable.selection().selectedFields.has(field._id) }\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n <span class=\"text-truncate\">\n <thy-icon [thyIconName]=\"field.icon!\" class=\"mr-2 text-muted\"></thy-icon>\n <span>{{ field.name }}</span>\n </span>\n <a\n href=\"javascript:;\"\n class=\"grid-field-action\"\n thyAction\n thyIcon=\"more-vertical\"\n (click)=\"openFieldMenu($event, field, fieldAction)\"\n >\n </a>\n </div>\n }\n <div class=\"grid-column-blank cursor-pointer\" #gridColumnBlank (click)=\"addField(gridColumnBlank)\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n<div class=\"grid-body d-flex\">\n @for (record of gridData().records; track record._id; let index = $index) {\n <div class=\"grid-row d-flex\" [ngClass]=\"{ highlight: (record._id | isSelectRecord: aiTable.selection()) }\">\n <div class=\"grid-row-index grid-checkbox\">\n <label\n [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'checked-box' : 'unchecked-box'\"\n thyCheckbox\n thyLabelText=\"\"\n [ngModel]=\"record._id | isSelectRecord: aiTable.selection()\"\n (ngModelChange)=\"selectRecord(record._id)\"\n ></label>\n <span [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'grid-row-no-number' : 'grid-row-number'\">\n {{ index + 1 }}\n </span>\n </div>\n @for (field of gridData().fields; track field._id) {\n <!-- [ngClass]=\"{\n highlight: aiTable.selection().selectedCells.has(record._id) || aiTable.selection().selectedFields.has(field._id),\n selected: aiTable.selection().selectedCells.get(record._id)?.hasOwnProperty(field._id)\n }\" -->\n <div\n #cell\n class=\"grid-cell\"\n [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: gridData().fieldsSizeMap[field._id] + 'px' }\"\n >\n @switch (field.type) {\n @case (AITableFieldType.select) {\n @let fieldValue = record.values[field._id];\n @let settings = field.settings! | selectSetting;\n @let options = settings['options'];\n @let optionStyle = settings['option_style'] || AITableSelectOptionStyle.tag;\n @let isTagStyle = optionStyle === AITableSelectOptionStyle.tag;\n\n @if (!settings['is_multiple'] && fieldValue | selectOption: options; as selectedOption) {\n @if (isTagStyle) {\n <select-option class=\"mb-1 mr-1\" [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"selectedOption\"></select-option>\n </div>\n }\n } @else {\n @let maxShowCount = 2;\n\n <div class=\"d-flex\">\n @if (fieldValue | selectOptions: options; as selectedOptions) {\n @for (option of selectedOptions; track option!._id; let i = $index) {\n @if (i + 1 <= maxShowCount) {\n @if (isTagStyle) {\n <select-option\n class=\"mb-1 mr-1\"\n [field]=\"field\"\n [displayOption]=\"option!\"\n ></select-option>\n } @else {\n <div thyTag class=\"mb-1 mr-1\">\n <select-option [field]=\"field\" [displayOption]=\"option!\"></select-option>\n </div>\n }\n }\n }\n\n @let selectedLength = selectedOptions.length || 0;\n @if (selectedOptions && maxShowCount < selectedLength) {\n @let shape = isTagStyle ? 'pill' : 'rectangle';\n @let isHidden = maxShowCount >= selectedLength;\n\n <thy-tag\n class=\"cursor-pointer\"\n [class.multi-property-value-hidden]=\"isHidden\"\n [thyShape]=\"shape\"\n >\n <span class=\"text-truncate\"> +{{ selectedLength - maxShowCount }} </span>\n </thy-tag>\n }\n }\n </div>\n }\n }\n @case (AITableFieldType.date) {\n {{ record.values[field._id].timestamp | thyDatePickerFormat }}\n }\n @case (AITableFieldType.updatedAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.createdAt) {\n <div class=\"d-block user-select-none\">\n <span class=\"text-truncate\">\n {{ record.values[field._id] | thyDatePickerFormat: 'yyyy-MM-dd HH:mm' }}\n </span>\n </div>\n }\n @case (AITableFieldType.rate) {\n <thy-rate [ngModel]=\"record.values[field._id]\"></thy-rate>\n }\n @case (AITableFieldType.link) {\n <a\n class=\"d-block\"\n target=\"_blank\"\n [href]=\"record.values[field._id]?.url\"\n thyStopPropagation\n thyFlexibleText\n [thyTooltipContent]=\"record.values[field._id]?.text\"\n >\n {{ record.values[field._id]?.text }}\n </a>\n }\n @case (AITableFieldType.progress) {\n <thy-progress\n class=\"w-100\"\n [thyValue]=\"record.values[field._id] || 0\"\n [thySize]=\"record.values[field._id]?.config?.size || 'md'\"\n [thyMax]=\"record.values[field._id]?.config?.max || 100\"\n [thyType]=\"record.values[field._id]?.config?.progressType || 'success'\"\n >\n <span> {{ record.values[field._id] || 0 }}{{ record.values[field._id]?.config?.suffix || '%' }} </span>\n </thy-progress>\n }\n @case (AITableFieldType.member) {\n @let settings = field.settings! | memberSetting;\n\n @if (!settings!['is_multiple']) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n } @else {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n <thy-avatar-list thyAvatarSize=\"xs\">\n @for (item of recordValues; track $index) {\n <thy-avatar [thyName]=\"item.display_name!\" [thySrc]=\"item.avatar!\"></thy-avatar>\n }\n </thy-avatar-list>\n }\n }\n @case (AITableFieldType.createdBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @case (AITableFieldType.updatedBy) {\n @let recordValues = record.values[field._id] | user: aiReferences()!;\n\n @if (recordValues && recordValues.length) {\n <thy-avatar\n [thyName]=\"recordValues[0].display_name!\"\n [thySrc]=\"recordValues[0].avatar!\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n }\n @default {\n <span class=\"text-truncate\"> {{ record.values[field._id] }}</span>\n }\n }\n <div class=\"autofill-container\"></div>\n </div>\n }\n <div class=\"grid-column-blank\"></div>\n </div>\n }\n <div class=\"grid-row-insert grid-row cursor-pointer\" (click)=\"addRecord()\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n\n<div #activeBorder class=\"active-border\"></div>\n" }]
9073
9199
  }] });
9074
9200
 
9075
9201
  class AITableDragComponent {
@@ -9358,7 +9484,12 @@ class AITableGrid extends AITableGridBase {
9358
9484
  containerWidth: this.containerRect().width,
9359
9485
  containerHeight: this.containerRect().height,
9360
9486
  references: this.aiReferences(),
9361
- readonly: this.aiReadonly()
9487
+ readonly: this.aiReadonly(),
9488
+ actions: {
9489
+ updateFieldValue: (options) => {
9490
+ this.aiUpdateFieldValue.emit(options);
9491
+ }
9492
+ }
9362
9493
  };
9363
9494
  });
9364
9495
  this.coordinate = computed(() => {
@@ -9911,5 +10042,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
9911
10042
  * Generated bundle index. Do not edit.
9912
10043
  */
9913
10044
 
9914
- export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsSameOptionPipe, AITableFieldSetting, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridI18nKey, AITableGridSelectionService, AITableMemberType, AITableMouseDownType, AITableQueries, AITableRenderer, AITableRowColumnType, AITableRowType, AITableSelectAllState, AITableSelectOptionStyle, AITableStatType, AI_TABLE_ACTION_COMMON_RADIUS, AI_TABLE_ACTION_COMMON_RIGHT_PADDING, AI_TABLE_ACTION_COMMON_SIZE, AI_TABLE_BLANK, AI_TABLE_CELL, AI_TABLE_CELL_ACTIVE_BORDER_WIDTH, AI_TABLE_CELL_ADD_ITEM_BUTTON_SIZE, AI_TABLE_CELL_ATTACHMENT_ADD, AI_TABLE_CELL_ATTACHMENT_FILE, AI_TABLE_CELL_BORDER, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE_OFFSET, AI_TABLE_CELL_EDIT, AI_TABLE_CELL_EMOJI_PADDING, AI_TABLE_CELL_EMOJI_SIZE, AI_TABLE_CELL_FIELD_ITEM_HEIGHT, AI_TABLE_CELL_MAX_ROW_COUNT, AI_TABLE_CELL_MEMBER_ITEM_HEIGHT, AI_TABLE_CELL_MEMBER_ITEM_PADDING, AI_TABLE_CELL_MEMBER_MAX_HEIGHT, AI_TABLE_CELL_MULTI_DOT_RADIUS, AI_TABLE_CELL_MULTI_ITEM_MARGIN_LEFT, AI_TABLE_CELL_MULTI_ITEM_MARGIN_TOP, AI_TABLE_CELL_MULTI_ITEM_MIN_WIDTH, AI_TABLE_CELL_MULTI_PADDING_LEFT, AI_TABLE_CELL_MULTI_PADDING_TOP, AI_TABLE_CELL_PADDING, AI_TABLE_COMMON_FONT_SIZE, AI_TABLE_DEFAULT_COLUMN_WIDTH, AI_TABLE_DOT_RADIUS, AI_TABLE_FIELD_ADD_BUTTON, AI_TABLE_FIELD_ADD_BUTTON_WIDTH, AI_TABLE_FIELD_HEAD, AI_TABLE_FIELD_HEAD_HEIGHT, AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE, AI_TABLE_FIELD_HEAD_MORE, AI_TABLE_FIELD_HEAD_OPACITY_LINE, AI_TABLE_FIELD_HEAD_SELECT_CHECKBOX, AI_TABLE_FIELD_HEAD_TEXT_MIN_WIDTH, AI_TABLE_FIELD_ITEM_MARGIN_RIGHT, AI_TABLE_FIELD_MAX_WIDTH, AI_TABLE_FIELD_MIDDLE_WIDTH, AI_TABLE_FIELD_MINI_WIDTH, AI_TABLE_FIELD_MIN_WIDTH, AI_TABLE_FILE_ICON_ITEM_HEIGHT, AI_TABLE_FILE_ICON_SIZE, AI_TABLE_GRID_FIELD_SERVICE_MAP, AI_TABLE_ICON_COMMON_SIZE, AI_TABLE_MEMBER_AVATAR_SIZE, AI_TABLE_MEMBER_ITEM_AVATAR_MARGIN_RIGHT, AI_TABLE_MEMBER_ITEM_PADDING_RIGHT, AI_TABLE_MIN_TEXT_WIDTH, AI_TABLE_OFFSET, AI_TABLE_OPTION_ITEM_FONT_SIZE, AI_TABLE_OPTION_ITEM_HEIGHT, AI_TABLE_OPTION_ITEM_PADDING, AI_TABLE_OPTION_ITEM_RADIUS, AI_TABLE_PIECE_RADIUS, AI_TABLE_PIECE_WIDTH, AI_TABLE_POPOVER_LEFT_OFFSET, AI_TABLE_PREVENT_CLEAR_SELECTION_CLASS, AI_TABLE_PROGRESS_BAR_HEIGHT, AI_TABLE_PROGRESS_BAR_RADIUS, AI_TABLE_PROGRESS_TEXT_Width, AI_TABLE_ROW_ADD_BUTTON, AI_TABLE_ROW_BLANK_HEIGHT, AI_TABLE_ROW_HEAD, AI_TABLE_ROW_HEAD_SIZE, AI_TABLE_ROW_HEAD_WIDTH, AI_TABLE_ROW_HEIGHT, AI_TABLE_ROW_SELECT_CHECKBOX, AI_TABLE_SCROLL_BAR_PADDING, AI_TABLE_TAG_FONT_SIZE, AI_TABLE_TAG_PADDING, AI_TABLE_TEXT_GAP, AbstractEditCellEditor, AddOutlinedPath, AttachmentPath, Check, Colors, ColumnCalendarFilledPath, ColumnLinkOutlinedPath, ColumnMemberFilledPath, ColumnMultipleFillPath, ColumnNumberFilledPath, ColumnProgressFilledPath, ColumnRatingFilledPath, ColumnRichTextFilledPath, ColumnSelectFilledPath, ColumnTextFilledPath, Coordinate, DBL_CLICK_EDIT_TYPE, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FONT_STYLE, DEFAULT_FONT_WEIGHT, DEFAULT_ICON_SHAPE, DEFAULT_ICON_SIZE, DEFAULT_POINT_POSITION, DEFAULT_SCROLL_STATE, DEFAULT_TEXT_ALIGN_CENTER, DEFAULT_TEXT_ALIGN_LEFT, DEFAULT_TEXT_ALIGN_RIGHT, DEFAULT_TEXT_DECORATION, DEFAULT_TEXT_ELLIPSIS, DEFAULT_TEXT_FILL, DEFAULT_TEXT_LINE_HEIGHT, DEFAULT_TEXT_LISTENING, DEFAULT_TEXT_MAX_CACHE, DEFAULT_TEXT_MAX_HEIGHT, DEFAULT_TEXT_SCALE, DEFAULT_TEXT_TRANSFORMS_ENABLED, DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE, DEFAULT_TEXT_VERTICAL_ALIGN_TOP, DEFAULT_TEXT_WRAP, DEFAULT_WRAP_TEXT_MAX_ROW, DateCellEditorComponent, DepartmentOutlinedPath, Direction, DragType, EditPath, FONT_SIZE_SM, FieldModelMap, GRID_CELL_EDITOR_MAP, IsSelectRecordPipe, KO_CONTAINER_TOKEN, KoComponent, KoContainer, KoShape, KoShapeTypes, KoStage, LinkCellEditorComponent, MIN_COLUMN_WIDTH, MOUSEOVER_EDIT_TYPE, MemberSettingPipe, MoreStandOutlinedPath, NumberCellEditorComponent, ProgressEditorComponent, RatingCellEditorComponent, RendererContext, RowHeight, SelectCellEditorComponent, SelectOptionComponent, SelectOptionPipe, SelectOptionsPipe, SelectSettingPipe, StarFill, TextCellEditorComponent, TextMeasure, Unchecked, UserPipe, WebOutlinedPath, aiTableFragmentAttribute, applyNodeProps, buildClipboardData, buildGridData, buildGridLinearRows, castToString, compareNumber, compareString, createAITable, createActiveCellBorder, createCells, createDefaultField, createDefaultFieldName, createListener, extractLinkUrl, extractText, generateNewName, generateTargetName, getAvatarBgColor, getAvatarShortName, getCellEditorBorderSpace, getCellHorizontalPosition, getColumnIndicesSizeMap, getDefaultFieldValue, getDefaultI18nTextByKey, getDetailByTargetName, getEditorBoxOffset, getEditorSpace, getFieldOptionByField, getFieldOptions, getFieldValue, getHoverCell, getHoverEditorBoxOffset, getHoverEditorSpace, getI18nTextByKey, getMousePosition, getName, getPlaceHolderCellsConfigs, getSystemFieldValue, getTargetName, getTextWidth, getVisibleRangeInfo, handleMouseStyle, hasIntersect, idCreator, idsCreator, imageCache, isArrayField, isCellMatchKeywords, isClipboardReadSupported, isClipboardReadTextSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isDateFiled, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSelectedField, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, readFromClipboard, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, stringInclude, textDataCache, transformCellValue, updatePicture, writeToAITable, writeToClipboard, zhIntlCollator };
10045
+ export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsSameOptionPipe, AITableFieldSetting, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridI18nKey, AITableGridSelectionService, AITableMemberType, AITableMouseDownType, AITableQueries, AITableRenderer, AITableRowColumnType, AITableRowType, AITableSelectAllState, AITableSelectOptionStyle, AITableStatType, AI_TABLE_ACTION_COMMON_RADIUS, AI_TABLE_ACTION_COMMON_RIGHT_PADDING, AI_TABLE_ACTION_COMMON_SIZE, AI_TABLE_BLANK, AI_TABLE_CELL, AI_TABLE_CELL_ACTIVE_BORDER_WIDTH, AI_TABLE_CELL_ADD_ITEM_BUTTON_SIZE, AI_TABLE_CELL_ATTACHMENT_ADD, AI_TABLE_CELL_ATTACHMENT_FILE, AI_TABLE_CELL_BORDER, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE_OFFSET, AI_TABLE_CELL_EDIT, AI_TABLE_CELL_EMOJI_PADDING, AI_TABLE_CELL_EMOJI_SIZE, AI_TABLE_CELL_FIELD_ITEM_HEIGHT, AI_TABLE_CELL_MAX_ROW_COUNT, AI_TABLE_CELL_MEMBER_ITEM_HEIGHT, AI_TABLE_CELL_MEMBER_ITEM_PADDING, AI_TABLE_CELL_MEMBER_MAX_HEIGHT, AI_TABLE_CELL_MULTI_DOT_RADIUS, AI_TABLE_CELL_MULTI_ITEM_MARGIN_LEFT, AI_TABLE_CELL_MULTI_ITEM_MARGIN_TOP, AI_TABLE_CELL_MULTI_ITEM_MIN_WIDTH, AI_TABLE_CELL_MULTI_PADDING_LEFT, AI_TABLE_CELL_MULTI_PADDING_TOP, AI_TABLE_CELL_PADDING, AI_TABLE_COMMON_FONT_SIZE, AI_TABLE_DEFAULT_COLUMN_WIDTH, AI_TABLE_DOT_RADIUS, AI_TABLE_FIELD_ADD_BUTTON, AI_TABLE_FIELD_ADD_BUTTON_WIDTH, AI_TABLE_FIELD_HEAD, AI_TABLE_FIELD_HEAD_HEIGHT, AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE, AI_TABLE_FIELD_HEAD_MORE, AI_TABLE_FIELD_HEAD_OPACITY_LINE, AI_TABLE_FIELD_HEAD_SELECT_CHECKBOX, AI_TABLE_FIELD_HEAD_TEXT_MIN_WIDTH, AI_TABLE_FIELD_ITEM_MARGIN_RIGHT, AI_TABLE_FIELD_MAX_WIDTH, AI_TABLE_FIELD_MIDDLE_WIDTH, AI_TABLE_FIELD_MINI_WIDTH, AI_TABLE_FIELD_MIN_WIDTH, AI_TABLE_FILE_ICON_ITEM_HEIGHT, AI_TABLE_FILE_ICON_SIZE, AI_TABLE_GRID_FIELD_SERVICE_MAP, AI_TABLE_ICON_COMMON_SIZE, AI_TABLE_MEMBER_AVATAR_SIZE, AI_TABLE_MEMBER_ITEM_AVATAR_MARGIN_RIGHT, AI_TABLE_MEMBER_ITEM_PADDING_RIGHT, AI_TABLE_MIN_TEXT_WIDTH, AI_TABLE_OFFSET, AI_TABLE_OPTION_ITEM_FONT_SIZE, AI_TABLE_OPTION_ITEM_HEIGHT, AI_TABLE_OPTION_ITEM_PADDING, AI_TABLE_OPTION_ITEM_RADIUS, AI_TABLE_PIECE_RADIUS, AI_TABLE_PIECE_WIDTH, AI_TABLE_POPOVER_LEFT_OFFSET, AI_TABLE_PREVENT_CLEAR_SELECTION_CLASS, AI_TABLE_PROGRESS_BAR_HEIGHT, AI_TABLE_PROGRESS_BAR_RADIUS, AI_TABLE_PROGRESS_TEXT_Width, AI_TABLE_RATE_MAX, AI_TABLE_ROW_ADD_BUTTON, AI_TABLE_ROW_BLANK_HEIGHT, AI_TABLE_ROW_HEAD, AI_TABLE_ROW_HEAD_SIZE, AI_TABLE_ROW_HEAD_WIDTH, AI_TABLE_ROW_HEIGHT, AI_TABLE_ROW_SELECT_CHECKBOX, AI_TABLE_SCROLL_BAR_PADDING, AI_TABLE_TAG_FONT_SIZE, AI_TABLE_TAG_PADDING, AI_TABLE_TEXT_GAP, AbstractEditCellEditor, AddOutlinedPath, AttachmentPath, Check, Colors, ColumnCalendarFilledPath, ColumnLinkOutlinedPath, ColumnMemberFilledPath, ColumnMultipleFillPath, ColumnNumberFilledPath, ColumnProgressFilledPath, ColumnRatingFilledPath, ColumnRichTextFilledPath, ColumnSelectFilledPath, ColumnTextFilledPath, Coordinate, DBL_CLICK_EDIT_TYPE, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FONT_STYLE, DEFAULT_FONT_WEIGHT, DEFAULT_ICON_SHAPE, DEFAULT_ICON_SIZE, DEFAULT_POINT_POSITION, DEFAULT_SCROLL_STATE, DEFAULT_TEXT_ALIGN_CENTER, DEFAULT_TEXT_ALIGN_LEFT, DEFAULT_TEXT_ALIGN_RIGHT, DEFAULT_TEXT_DECORATION, DEFAULT_TEXT_ELLIPSIS, DEFAULT_TEXT_FILL, DEFAULT_TEXT_LINE_HEIGHT, DEFAULT_TEXT_LISTENING, DEFAULT_TEXT_MAX_CACHE, DEFAULT_TEXT_MAX_HEIGHT, DEFAULT_TEXT_SCALE, DEFAULT_TEXT_TRANSFORMS_ENABLED, DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE, DEFAULT_TEXT_VERTICAL_ALIGN_TOP, DEFAULT_TEXT_WRAP, DEFAULT_WRAP_TEXT_MAX_ROW, DateCellEditorComponent, DepartmentOutlinedPath, Direction, DragType, EditPath, FONT_SIZE_SM, FieldModelMap, GRID_CELL_EDITOR_MAP, IsSelectRecordPipe, KO_CONTAINER_TOKEN, KoComponent, KoContainer, KoShape, KoShapeTypes, KoStage, LinkCellEditorComponent, MIN_COLUMN_WIDTH, MOUSEOVER_EDIT_TYPE, MemberSettingPipe, MoreStandOutlinedPath, NumberCellEditorComponent, ProgressEditorComponent, RendererContext, RowHeight, SelectCellEditorComponent, SelectOptionComponent, SelectOptionPipe, SelectOptionsPipe, SelectSettingPipe, StarFill, TextCellEditorComponent, TextMeasure, Unchecked, UserPipe, WebOutlinedPath, aiTableFragmentAttribute, applyNodeProps, buildClipboardData, buildGridData, buildGridLinearRows, castToString, compareNumber, compareString, createAITable, createActiveCellBorder, createCells, createDefaultField, createDefaultFieldName, createListener, extractLinkUrl, extractText, generateNewName, generateTargetName, getAvatarBgColor, getAvatarShortName, getCellEditorBorderSpace, getCellHorizontalPosition, getColumnIndicesSizeMap, getDefaultFieldValue, getDefaultI18nTextByKey, getDetailByTargetName, getEditorBoxOffset, getEditorSpace, getFieldOptionByField, getFieldOptions, getFieldValue, getHoverCell, getHoverEditorBoxOffset, getHoverEditorSpace, getI18nTextByKey, getMousePosition, getName, getPlaceHolderCellsConfigs, getSystemFieldValue, getTargetName, getTextWidth, getVisibleRangeInfo, handleMouseStyle, hasIntersect, idCreator, idsCreator, imageCache, isActiveCell, isArrayField, isCellMatchKeywords, isClipboardReadSupported, isClipboardReadTextSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isDateFiled, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSelectedField, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, readFromClipboard, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, stringInclude, textDataCache, transformCellValue, updatePicture, writeToAITable, writeToClipboard, zhIntlCollator };
9915
10046
  //# sourceMappingURL=ai-table-grid.mjs.map