@ai-table/grid 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/drag/drag.component.d.ts +1 -0
- package/components/drag/drag.component.d.ts.map +1 -1
- package/constants/field-stat.d.ts.map +1 -1
- package/fesm2022/ai-table-grid.mjs +127 -108
- package/fesm2022/ai-table-grid.mjs.map +1 -1
- package/grid.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/renderer/components/field-stat/stat.component.d.ts +1 -0
- package/renderer/components/field-stat/stat.component.d.ts.map +1 -1
@@ -37,6 +37,7 @@ export declare class AITableDragComponent implements OnInit, OnDestroy {
|
|
37
37
|
private movingColumnWidth;
|
38
38
|
private movingRecord;
|
39
39
|
private setMovingRecordDragData;
|
40
|
+
private setMovingFieldDragData;
|
40
41
|
private handleDragEnd;
|
41
42
|
private clearDragState;
|
42
43
|
private calculateDragWidth;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"drag.component.d.ts","sourceRoot":"","sources":["../../../../packages/grid/src/components/drag/drag.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,UAAU,EAIV,SAAS,EACT,MAAM,EAIT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAiB,WAAW,EAAY,MAAM,iBAAiB,CAAC;;AAiBvE,qBAQa,oBAAqB,YAAW,MAAM,EAAE,SAAS;IAC1D,aAAa,2EAAgD;IAE7D,WAAW,2EAAgD;IAE3D,OAAO,wDAAyB;IAEhC,OAAO,CAAC,uBAAuB,CAAmC;IAElE,OAAO,CAAC,OAAO,CAAqB;IAEpC,OAAO,CAAC,uBAAuB,CAA0C;IAEzE,UAAU,EAAE,UAAU,CAAC,WAAW,CAAC,CAAmC;IAEtE,OAAO,CAAC,IAAI,CAAe;IAE3B,OAAO,CAAC,aAAa,CAAe;IAEpC,OAAO,CAAC,WAAW,CAA4B;IAE/C,OAAO,CAAC,sBAAsB,CAA4C;IAE1E,OAAO,CAAC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sourceRoot":"","sources":["../../../packages/grid/src/constants/field-stat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,eAAe,EAAgB,MAAM,iBAAiB,CAAC;AAI9F,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,4BAA4B,CAAC,CAyB9F,CAAC"}
|
@@ -48,7 +48,7 @@ import { ThyNotifyService } from 'ngx-tethys/notify';
|
|
48
48
|
import { ThyInputNumber } from 'ngx-tethys/input-number';
|
49
49
|
import { isKeyHotkey } from 'is-hotkey';
|
50
50
|
import { LRUCache } from 'lru-cache';
|
51
|
-
import {
|
51
|
+
import { differenceInDays, fromUnixTime, differenceInMonths, subDays } from 'date-fns';
|
52
52
|
import { isArray, TinyDate, helpers, hexToRgb } from 'ngx-tethys/util';
|
53
53
|
import { DEFAULT_COLORS } from 'ngx-tethys/color-picker';
|
54
54
|
import GraphemeSplitter from 'grapheme-splitter';
|
@@ -1589,7 +1589,7 @@ const AITableQueries = {
|
|
1589
1589
|
if (!path) {
|
1590
1590
|
throw new Error(`path does not exist as path [${path}]`);
|
1591
1591
|
}
|
1592
|
-
return aiTable.
|
1592
|
+
return aiTable.fieldsMap()[path[0]];
|
1593
1593
|
},
|
1594
1594
|
getRecord(aiTable, path) {
|
1595
1595
|
if (!aiTable) {
|
@@ -2105,7 +2105,7 @@ function expandCell(aiTable, cellPath) {
|
|
2105
2105
|
setExpandCellInfo(aiTable, { path: cellPath });
|
2106
2106
|
}
|
2107
2107
|
function closeExpendCell(aiTable) {
|
2108
|
-
setExpandCellInfo(aiTable, { path: null
|
2108
|
+
setExpandCellInfo(aiTable, { path: null });
|
2109
2109
|
}
|
2110
2110
|
function setSelection(aiTable, selection) {
|
2111
2111
|
aiTable.selection.set({
|
@@ -2277,7 +2277,7 @@ function getPlaceHolderCellsConfigs(options) {
|
|
2277
2277
|
if (isGroupAndFirstColumn) {
|
2278
2278
|
offset += AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
|
2279
2279
|
}
|
2280
|
-
const height = rowHeight
|
2280
|
+
const height = rowHeight;
|
2281
2281
|
configs.unshift({
|
2282
2282
|
key: `placeholder-cell-${fieldId}-${recordId}`,
|
2283
2283
|
name: generateTargetName({
|
@@ -2287,7 +2287,7 @@ function getPlaceHolderCellsConfigs(options) {
|
|
2287
2287
|
}),
|
2288
2288
|
x: x + offset,
|
2289
2289
|
y,
|
2290
|
-
width
|
2290
|
+
width,
|
2291
2291
|
height,
|
2292
2292
|
fill: Colors.transparent,
|
2293
2293
|
strokeEnabled: false,
|
@@ -2681,6 +2681,62 @@ function cellValueToSortValue$5(cellValue, field, references, sortKey = 'title')
|
|
2681
2681
|
return values && values.length ? values.join(', ') : null;
|
2682
2682
|
}
|
2683
2683
|
|
2684
|
+
function getDateFieldValues(records, options, filterNull = false) {
|
2685
|
+
const { aiTable, field } = options;
|
2686
|
+
const result = ___default.map(records, (record) => {
|
2687
|
+
const cellValue = AITableQueries.getFieldValue(aiTable, [record._id, field._id]);
|
2688
|
+
return cellValue;
|
2689
|
+
});
|
2690
|
+
if (filterNull) {
|
2691
|
+
return result.filter((value) => value !== null);
|
2692
|
+
}
|
2693
|
+
return result;
|
2694
|
+
}
|
2695
|
+
function statEarliestTime(records, options) {
|
2696
|
+
const values = getDateFieldValues(records, options, true);
|
2697
|
+
const result = ___default.minBy(values, (value) => {
|
2698
|
+
return value.timestamp;
|
2699
|
+
});
|
2700
|
+
return transformToCellText(result, options);
|
2701
|
+
}
|
2702
|
+
function statLatestTime(records, options) {
|
2703
|
+
const { field } = options;
|
2704
|
+
const values = getDateFieldValues(records, options, true);
|
2705
|
+
const result = ___default.maxBy(values, (value) => {
|
2706
|
+
return value.timestamp;
|
2707
|
+
});
|
2708
|
+
return transformToCellText(result, options);
|
2709
|
+
}
|
2710
|
+
function statDateRangeOfDays(records, options) {
|
2711
|
+
const { field } = options;
|
2712
|
+
const values = getDateFieldValues(records, options, true);
|
2713
|
+
const start = ___default.minBy(values, (value) => {
|
2714
|
+
return value.timestamp;
|
2715
|
+
});
|
2716
|
+
const end = ___default.maxBy(values, (value) => {
|
2717
|
+
return value.timestamp;
|
2718
|
+
});
|
2719
|
+
if (start && end) {
|
2720
|
+
const days = differenceInDays(fromUnixTime(end.timestamp), fromUnixTime(start.timestamp));
|
2721
|
+
return days;
|
2722
|
+
}
|
2723
|
+
return 0;
|
2724
|
+
}
|
2725
|
+
function statDateRangeOfMonths(records, options) {
|
2726
|
+
const values = getDateFieldValues(records, options, true);
|
2727
|
+
const start = ___default.minBy(values, (value) => {
|
2728
|
+
return value.timestamp;
|
2729
|
+
});
|
2730
|
+
const end = ___default.maxBy(values, (value) => {
|
2731
|
+
return value.timestamp;
|
2732
|
+
});
|
2733
|
+
if (start && end) {
|
2734
|
+
const months = differenceInMonths(fromUnixTime(end.timestamp), fromUnixTime(start.timestamp));
|
2735
|
+
return months;
|
2736
|
+
}
|
2737
|
+
return 0;
|
2738
|
+
}
|
2739
|
+
|
2684
2740
|
const FIELD_STAT_TYPE_MAP = {
|
2685
2741
|
[AITableStatType.EarliestTime]: {
|
2686
2742
|
name: AITableGridI18nKey.earliestTime,
|
@@ -9210,15 +9266,6 @@ class AITableFieldStat {
|
|
9210
9266
|
config.strokeWidth = AI_TABLE_CELL_LINE_BORDER;
|
9211
9267
|
}
|
9212
9268
|
}
|
9213
|
-
if (isGroupStat && this.isFirstColumn()) {
|
9214
|
-
const groupStatContainerWidthMap = this.groupStatContainerWidthMap();
|
9215
|
-
const groupStatCellKey = `${groupRow.groupId}:${field._id}`;
|
9216
|
-
const originGroupStatContainerWidth = groupStatContainerWidthMap.get(groupStatCellKey);
|
9217
|
-
const width = this.renderTexts() ? config.width : 0;
|
9218
|
-
if (!originGroupStatContainerWidth || originGroupStatContainerWidth !== width) {
|
9219
|
-
groupStatContainerWidthMap.set(groupStatCellKey, width);
|
9220
|
-
}
|
9221
|
-
}
|
9222
9269
|
return config;
|
9223
9270
|
});
|
9224
9271
|
this.field = computed(() => {
|
@@ -9449,6 +9496,32 @@ class AITableFieldStat {
|
|
9449
9496
|
listening: false
|
9450
9497
|
};
|
9451
9498
|
});
|
9499
|
+
effect(() => {
|
9500
|
+
const isGroupStat = this.isGroupStat();
|
9501
|
+
const bgConfigWidth = this.bgConfig().width;
|
9502
|
+
const renderTexts = this.renderTexts();
|
9503
|
+
untracked(() => {
|
9504
|
+
if (isGroupStat && this.isFirstColumn()) {
|
9505
|
+
const config = this.config();
|
9506
|
+
const { aiTable, groupRow, field } = config;
|
9507
|
+
const groupStatContainerWidthMap = this.groupStatContainerWidthMap();
|
9508
|
+
const groupStatCellKey = `${groupRow.groupId}:${groupRow.fieldId}`;
|
9509
|
+
const originGroupStatContainerWidth = groupStatContainerWidthMap.get(groupStatCellKey);
|
9510
|
+
// 计算新的宽度
|
9511
|
+
const groupStatContainerWidth = renderTexts ? bgConfigWidth : 0;
|
9512
|
+
// 只有当值发生变化时才更新
|
9513
|
+
if (originGroupStatContainerWidth !== groupStatContainerWidth) {
|
9514
|
+
if (groupStatContainerWidth > 0) {
|
9515
|
+
groupStatContainerWidthMap.set(groupStatCellKey, groupStatContainerWidth);
|
9516
|
+
}
|
9517
|
+
else {
|
9518
|
+
groupStatContainerWidthMap.delete(groupStatCellKey);
|
9519
|
+
}
|
9520
|
+
aiTable.context?.groupStatContainerWidthMap.set(groupStatContainerWidthMap);
|
9521
|
+
}
|
9522
|
+
}
|
9523
|
+
});
|
9524
|
+
});
|
9452
9525
|
}
|
9453
9526
|
onHoverChange(isHover) {
|
9454
9527
|
this.isHover.set(isHover);
|
@@ -9465,7 +9538,9 @@ class AITableFieldStat {
|
|
9465
9538
|
const containerRect = coordinate.container.getBoundingClientRect();
|
9466
9539
|
const position = {
|
9467
9540
|
x: containerRect.x + statRect.x,
|
9468
|
-
y: containerRect.y + statRect.y + statRect.height - 50
|
9541
|
+
y: containerRect.y + statRect.y + statRect.height - 50,
|
9542
|
+
width: this.containerBoxWidth(),
|
9543
|
+
height: this.containerBoxHeight() + 10
|
9469
9544
|
};
|
9470
9545
|
const editFieldPosition = {
|
9471
9546
|
x: containerRect.x + fieldGroupRect.x - AI_TABLE_CELL_PADDING,
|
@@ -9550,7 +9625,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
9550
9625
|
imports: [KoContainer, AITableTextComponent, AITableIcon, AITableBackground],
|
9551
9626
|
changeDetection: ChangeDetectionStrategy.OnPush
|
9552
9627
|
}]
|
9553
|
-
}] });
|
9628
|
+
}], ctorParameters: () => [] });
|
9554
9629
|
|
9555
9630
|
class AITableGroups {
|
9556
9631
|
constructor() {
|
@@ -11082,62 +11157,6 @@ function aiTableRectConfigToKonvaConfig(rectConfig, options) {
|
|
11082
11157
|
return result;
|
11083
11158
|
}
|
11084
11159
|
|
11085
|
-
function getDateFieldValues(records, options, filterNull = false) {
|
11086
|
-
const { aiTable, field } = options;
|
11087
|
-
const result = ___default.map(records, (record) => {
|
11088
|
-
const cellValue = AITableQueries.getFieldValue(aiTable, [record._id, field._id]);
|
11089
|
-
return cellValue;
|
11090
|
-
});
|
11091
|
-
if (filterNull) {
|
11092
|
-
return result.filter((value) => value !== null);
|
11093
|
-
}
|
11094
|
-
return result;
|
11095
|
-
}
|
11096
|
-
function statEarliestTime(records, options) {
|
11097
|
-
const values = getDateFieldValues(records, options, true);
|
11098
|
-
const result = ___default.minBy(values, (value) => {
|
11099
|
-
return value.timestamp;
|
11100
|
-
});
|
11101
|
-
return transformToCellText(result, options);
|
11102
|
-
}
|
11103
|
-
function statLatestTime(records, options) {
|
11104
|
-
const { field } = options;
|
11105
|
-
const values = getDateFieldValues(records, options, true);
|
11106
|
-
const result = ___default.maxBy(values, (value) => {
|
11107
|
-
return value.timestamp;
|
11108
|
-
});
|
11109
|
-
return transformToCellText(result, options);
|
11110
|
-
}
|
11111
|
-
function statDateRangeOfDays(records, options) {
|
11112
|
-
const { field } = options;
|
11113
|
-
const values = getDateFieldValues(records, options, true);
|
11114
|
-
const start = ___default.minBy(values, (value) => {
|
11115
|
-
return value.timestamp;
|
11116
|
-
});
|
11117
|
-
const end = ___default.maxBy(values, (value) => {
|
11118
|
-
return value.timestamp;
|
11119
|
-
});
|
11120
|
-
if (start && end) {
|
11121
|
-
const days = differenceInDays(fromUnixTime(end.timestamp), fromUnixTime(start.timestamp));
|
11122
|
-
return days;
|
11123
|
-
}
|
11124
|
-
return 0;
|
11125
|
-
}
|
11126
|
-
function statDateRangeOfMonths(records, options) {
|
11127
|
-
const values = getDateFieldValues(records, options, true);
|
11128
|
-
const start = ___default.minBy(values, (value) => {
|
11129
|
-
return value.timestamp;
|
11130
|
-
});
|
11131
|
-
const end = ___default.maxBy(values, (value) => {
|
11132
|
-
return value.timestamp;
|
11133
|
-
});
|
11134
|
-
if (start && end) {
|
11135
|
-
const months = differenceInMonths(fromUnixTime(end.timestamp), fromUnixTime(start.timestamp));
|
11136
|
-
return months;
|
11137
|
-
}
|
11138
|
-
return 0;
|
11139
|
-
}
|
11140
|
-
|
11141
11160
|
function getFillDirection(aiTable, sourceCells, mouseUpRecordId) {
|
11142
11161
|
const { startCell: sourceStartCell, endCell: sourceEndCell } = getStartAndEndCell(sourceCells);
|
11143
11162
|
const currentRowIndex = aiTable.context.visibleRowsIndexMap().get(mouseUpRecordId);
|
@@ -12715,17 +12734,15 @@ class AITableDragComponent {
|
|
12715
12734
|
top: '0',
|
12716
12735
|
left: `${currentRectLeft}px`
|
12717
12736
|
});
|
12718
|
-
|
12719
|
-
|
12720
|
-
|
12721
|
-
|
12722
|
-
|
12723
|
-
|
12724
|
-
? -AI_TABLE_AUTO_SCROLL_LEFT_THRESHOLD
|
12725
|
-
: AI_TABLE_AUTO_SCROLL_LEFT_THRESHOLD);
|
12737
|
+
const currentRectLeftIsInFrozenArea = currentRectLeft <
|
12738
|
+
frozenColumnWidth +
|
12739
|
+
rowHeadWidth +
|
12740
|
+
(direction === DragDirection.left || direction === DragDirection.none
|
12741
|
+
? -AI_TABLE_AUTO_SCROLL_LEFT_THRESHOLD
|
12742
|
+
: AI_TABLE_AUTO_SCROLL_LEFT_THRESHOLD);
|
12726
12743
|
// 计算目标列和辅助线
|
12727
12744
|
const updateTargetAndLine = (rectLeft, scrollPosition) => {
|
12728
|
-
if (
|
12745
|
+
if (currentRectLeftIsInFrozenArea) {
|
12729
12746
|
// 冻结列区域内滚动,清空滚动位置
|
12730
12747
|
scrollPosition.x = 0;
|
12731
12748
|
}
|
@@ -12745,20 +12762,14 @@ class AITableDragComponent {
|
|
12745
12762
|
isLastColumn) {
|
12746
12763
|
let lineLeft = targetColumnStartX - scrollPosition.x;
|
12747
12764
|
const lineForFrozenX = lineLeft - frozenColumnWidth - rowHeadWidth;
|
12748
|
-
const rectDistanceFrozenX = rectLeft - frozenColumnWidth - rowHeadWidth;
|
12749
12765
|
if (lineForFrozenX < 0) {
|
12750
|
-
if (
|
12751
|
-
//
|
12766
|
+
if (!currentRectLeftIsInFrozenArea && lineLeft < frozenColumnWidth + rowHeadWidth) {
|
12767
|
+
// 非冻结区拖拽需要控制辅助线不要显示到冻结区,需要保持在上个位置
|
12752
12768
|
const nextColumnStartX = coordinate.getColumnOffset(targetColumnIndex + 1);
|
12753
12769
|
this.setAuxiliaryLineStyles({
|
12754
12770
|
left: `${nextColumnStartX - scrollPosition.x}px`
|
12755
12771
|
});
|
12756
|
-
this.
|
12757
|
-
type: DragType.field,
|
12758
|
-
targetIndex: targetColumnIndex + 1,
|
12759
|
-
fieldIds: drag.sourceIds,
|
12760
|
-
fieldsIndex: Array.from(drag.sourceIds).map((id) => visibleColumnIndexMap.get(id) || 0)
|
12761
|
-
};
|
12772
|
+
this.setMovingFieldDragData(DragType.field, drag.sourceIds, targetColumnIndex + 1);
|
12762
12773
|
return;
|
12763
12774
|
}
|
12764
12775
|
}
|
@@ -12768,16 +12779,7 @@ class AITableDragComponent {
|
|
12768
12779
|
top: 0,
|
12769
12780
|
left: `${lineLeft}px`
|
12770
12781
|
});
|
12771
|
-
|
12772
|
-
if (targetColumnIndex > sourceColumnIndex) {
|
12773
|
-
targetColumnIndex -= 1;
|
12774
|
-
}
|
12775
|
-
this.draggedData = {
|
12776
|
-
type: DragType.field,
|
12777
|
-
targetIndex: targetColumnIndex,
|
12778
|
-
fieldIds: drag.sourceIds,
|
12779
|
-
fieldsIndex: Array.from(drag.sourceIds).map((id) => visibleColumnIndexMap.get(id) || 0)
|
12780
|
-
};
|
12782
|
+
this.setMovingFieldDragData(DragType.field, drag.sourceIds, targetColumnIndex);
|
12781
12783
|
}
|
12782
12784
|
else {
|
12783
12785
|
this.resetAuxiliaryLine();
|
@@ -12785,7 +12787,7 @@ class AITableDragComponent {
|
|
12785
12787
|
}
|
12786
12788
|
};
|
12787
12789
|
updateTargetAndLine(currentRectLeft, newScrollPosition);
|
12788
|
-
if (
|
12790
|
+
if (currentRectLeftIsInFrozenArea) {
|
12789
12791
|
// 冻结列区域内拖拽取消滚动
|
12790
12792
|
this.scrollControllerService.stopAutoScroll();
|
12791
12793
|
return;
|
@@ -12957,6 +12959,24 @@ class AITableDragComponent {
|
|
12957
12959
|
}
|
12958
12960
|
}
|
12959
12961
|
}
|
12962
|
+
setMovingFieldDragData(type, sourceIds, targetIndex) {
|
12963
|
+
const aiTable = this.aiTableGridEventService.aiTable;
|
12964
|
+
const fields = aiTable.gridData().fields;
|
12965
|
+
this.draggedData = {
|
12966
|
+
type,
|
12967
|
+
fieldIds: sourceIds,
|
12968
|
+
targetIndex
|
12969
|
+
};
|
12970
|
+
if (targetIndex === 0) {
|
12971
|
+
this.draggedData.beforeFieldId = fields[0]._id;
|
12972
|
+
}
|
12973
|
+
else if (targetIndex >= fields.length) {
|
12974
|
+
this.draggedData.afterFieldId = fields[fields.length - 1]._id;
|
12975
|
+
}
|
12976
|
+
else {
|
12977
|
+
this.draggedData.afterFieldId = fields[targetIndex - 1]._id;
|
12978
|
+
}
|
12979
|
+
}
|
12960
12980
|
handleDragEnd() {
|
12961
12981
|
if (this.draggedData) {
|
12962
12982
|
this.dragEnd.emit({ ...this.draggedData });
|
@@ -13979,13 +13999,12 @@ class AITableGrid extends AITableGridBase {
|
|
13979
13999
|
dragEnd(data) {
|
13980
14000
|
switch (data.type) {
|
13981
14001
|
case DragType.field:
|
13982
|
-
if (data.
|
13983
|
-
|
13984
|
-
|
13985
|
-
|
13986
|
-
|
13987
|
-
|
13988
|
-
}
|
14002
|
+
if (data.fieldIds && (data.beforeFieldId || data.afterFieldId)) {
|
14003
|
+
this.aiMoveField.emit({
|
14004
|
+
fieldIds: Array.from(data.fieldIds),
|
14005
|
+
beforeFieldId: data.beforeFieldId,
|
14006
|
+
afterFieldId: data.afterFieldId
|
14007
|
+
});
|
13989
14008
|
}
|
13990
14009
|
break;
|
13991
14010
|
case DragType.columnWidth:
|