@ai-table/grid 0.0.29 → 0.0.31
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/constants/table.d.ts +1 -1
- package/constants/table.d.ts.map +1 -1
- package/core/types/ai-table.d.ts +6 -6
- package/core/types/ai-table.d.ts.map +1 -1
- package/core/types/core.d.ts +3 -4
- package/core/types/core.d.ts.map +1 -1
- package/core/utils/queries.d.ts +2 -2
- package/core/utils/queries.d.ts.map +1 -1
- package/esm2022/components/context-menu/context-menu.component.mjs +3 -3
- package/esm2022/constants/table.mjs +2 -2
- package/esm2022/core/types/ai-table.mjs +4 -7
- package/esm2022/core/types/core.mjs +1 -1
- package/esm2022/core/utils/common.mjs +2 -2
- package/esm2022/core/utils/queries.mjs +1 -1
- package/esm2022/grid-base.component.mjs +1 -4
- package/esm2022/grid.component.mjs +34 -21
- package/esm2022/renderer/creations/create-cells.mjs +18 -44
- package/esm2022/services/event.service.mjs +1 -1
- package/esm2022/services/index.mjs +1 -2
- package/esm2022/services/selection.service.mjs +9 -14
- package/esm2022/types/grid.mjs +1 -1
- package/esm2022/utils/field/model/field.mjs +1 -1
- package/esm2022/utils/field/model/member.mjs +10 -9
- package/esm2022/utils/index.mjs +2 -1
- package/esm2022/utils/match-keywords.mjs +11 -0
- package/fesm2022/ai-table-grid.mjs +82 -135
- package/fesm2022/ai-table-grid.mjs.map +1 -1
- package/grid-base.component.d.ts +0 -2
- package/grid-base.component.d.ts.map +1 -1
- package/grid.component.d.ts +4 -3
- package/grid.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/services/event.service.d.ts.map +1 -1
- package/services/index.d.ts +0 -1
- package/services/index.d.ts.map +1 -1
- package/services/selection.service.d.ts +3 -3
- package/services/selection.service.d.ts.map +1 -1
- package/types/grid.d.ts +3 -3
- package/types/grid.d.ts.map +1 -1
- package/utils/field/model/field.d.ts +1 -1
- package/utils/field/model/field.d.ts.map +1 -1
- package/utils/field/model/member.d.ts +1 -1
- package/utils/field/model/member.d.ts.map +1 -1
- package/utils/index.d.ts +1 -0
- package/utils/index.d.ts.map +1 -1
- package/utils/match-keywords.d.ts +4 -0
- package/utils/match-keywords.d.ts.map +1 -0
- package/esm2022/services/match-cell.service.mjs +0 -45
- package/services/match-cell.service.d.ts +0 -13
- package/services/match-cell.service.d.ts.map +0 -1
@@ -42,8 +42,8 @@ import { ThyCheckboxModule } from 'ngx-tethys/checkbox';
|
|
42
42
|
import { ThyProgress } from 'ngx-tethys/progress';
|
43
43
|
import { ThyDivider } from 'ngx-tethys/divider';
|
44
44
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
45
|
-
import { fromUnixTime, subDays } from 'date-fns';
|
46
45
|
import { LRUCache } from 'lru-cache';
|
46
|
+
import { fromUnixTime, subDays } from 'date-fns';
|
47
47
|
import Konva from 'konva';
|
48
48
|
import { Shape } from 'konva/lib/Shape';
|
49
49
|
import { Sprite } from 'konva/lib/shapes/Sprite';
|
@@ -101,7 +101,7 @@ const AITable = {
|
|
101
101
|
getActiveCell(aiTable) {
|
102
102
|
return aiTable.selection().activeCell;
|
103
103
|
},
|
104
|
-
|
104
|
+
getActiveRecordIds(aiTable) {
|
105
105
|
const selectedRecords = aiTable.selection().selectedRecords;
|
106
106
|
const selectedCells = aiTable.selection().selectedCells;
|
107
107
|
let selectedRecordIds = [];
|
@@ -119,11 +119,8 @@ const AITable = {
|
|
119
119
|
isCellVisible(aiTable, cell) {
|
120
120
|
const visibleRowIndexMap = aiTable.context.visibleRowsIndexMap();
|
121
121
|
const visibleColumnIndexMap = aiTable.context.visibleColumnsMap();
|
122
|
-
|
123
|
-
|
124
|
-
const [recordId, fieldId] = cell;
|
125
|
-
isVisible = visibleRowIndexMap.has(recordId) && visibleColumnIndexMap.has(fieldId);
|
126
|
-
}
|
122
|
+
const [recordId, fieldId] = cell || [];
|
123
|
+
const isVisible = visibleRowIndexMap.has(recordId) && visibleColumnIndexMap.has(fieldId);
|
127
124
|
return isVisible;
|
128
125
|
},
|
129
126
|
getCellIndex(aiTable, cell) {
|
@@ -705,7 +702,7 @@ function createAITable(records, fields) {
|
|
705
702
|
selectedCells: new Set(),
|
706
703
|
activeCell: null
|
707
704
|
}),
|
708
|
-
|
705
|
+
keywordsMatchedCells: signal(new Set()),
|
709
706
|
recordsMap: computed(() => {
|
710
707
|
return records().reduce((object, item) => {
|
711
708
|
object[item._id] = item;
|
@@ -1632,29 +1629,25 @@ class AITableGridSelectionService {
|
|
1632
1629
|
}
|
1633
1630
|
selectCells(startCell, endCell) {
|
1634
1631
|
const [startRecordId, startFieldId] = startCell;
|
1635
|
-
|
1636
|
-
|
1637
|
-
return;
|
1638
|
-
}
|
1632
|
+
const records = this.aiTable.records();
|
1633
|
+
const fields = this.aiTable.fields();
|
1639
1634
|
const selectedCells = new Set();
|
1640
|
-
if (!endCell
|
1635
|
+
if (!endCell) {
|
1641
1636
|
selectedCells.add(`${startRecordId}:${startFieldId}`);
|
1642
1637
|
}
|
1643
1638
|
else {
|
1644
1639
|
const [endRecordId, endFieldId] = endCell;
|
1645
|
-
const startRowIndex =
|
1646
|
-
const endRowIndex =
|
1647
|
-
const startColIndex =
|
1648
|
-
const endColIndex =
|
1640
|
+
const startRowIndex = records.findIndex((record) => record._id === startRecordId);
|
1641
|
+
const endRowIndex = records.findIndex((record) => record._id === endRecordId);
|
1642
|
+
const startColIndex = fields.findIndex((field) => field._id === startFieldId);
|
1643
|
+
const endColIndex = fields.findIndex((field) => field._id === endFieldId);
|
1649
1644
|
const minRowIndex = Math.min(startRowIndex, endRowIndex);
|
1650
1645
|
const maxRowIndex = Math.max(startRowIndex, endRowIndex);
|
1651
1646
|
const minColIndex = Math.min(startColIndex, endColIndex);
|
1652
1647
|
const maxColIndex = Math.max(startColIndex, endColIndex);
|
1653
|
-
const rows = this.aiTable.context.linearRows();
|
1654
|
-
const fields = AITable.getVisibleFields(this.aiTable);
|
1655
1648
|
for (let i = minRowIndex; i <= maxRowIndex; i++) {
|
1656
1649
|
for (let j = minColIndex; j <= maxColIndex; j++) {
|
1657
|
-
selectedCells.add(`${
|
1650
|
+
selectedCells.add(`${records[i]._id}:${fields[j]._id}`);
|
1658
1651
|
}
|
1659
1652
|
}
|
1660
1653
|
}
|
@@ -1684,13 +1677,13 @@ class AITableContextMenu extends ThyDropdownAbstractMenu {
|
|
1684
1677
|
}
|
1685
1678
|
}
|
1686
1679
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableContextMenu, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
1687
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableContextMenu, isStandalone: true, selector: "ai-table-context-menu", inputs: { aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: true, isRequired: true, transformFunction: null }, menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, targetName: { classPropertyName: "targetName", publicName: "targetName", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "context-menu" }, usesInheritance: true, ngImport: i0, template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{ 'ai-table-
|
1680
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableContextMenu, isStandalone: true, selector: "ai-table-context-menu", inputs: { aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: true, isRequired: true, transformFunction: null }, menuItems: { classPropertyName: "menuItems", publicName: "menuItems", isSignal: true, isRequired: true, transformFunction: null }, targetName: { classPropertyName: "targetName", publicName: "targetName", isSignal: true, isRequired: true, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "context-menu" }, usesInheritance: true, ngImport: i0, template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{ 'ai-table-prevent-clear-selection remove-record': !disabled }\"\n (click)=\"execute(menu)\"\n [thyDisabled]=\"disabled\"\n >\n <thy-icon [thyIconName]=\"menu.icon!\"></thy-icon>\n <span>{{ menu.name }}</span>\n </a>\n }\n}\n", dependencies: [{ kind: "directive", type: ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1688
1681
|
}
|
1689
1682
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableContextMenu, decorators: [{
|
1690
1683
|
type: Component,
|
1691
1684
|
args: [{ selector: 'ai-table-context-menu', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
1692
1685
|
class: 'context-menu'
|
1693
|
-
}, imports: [ThyDropdownMenuItemDirective, ThyIcon, NgClass], template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{ 'ai-table-
|
1686
|
+
}, imports: [ThyDropdownMenuItemDirective, ThyIcon, NgClass], template: "@for (menu of menuItems(); track $index) {\n @if ((menu.hidden && !menu.hidden(aiTable(), targetName(), position())) || !menu.hidden) {\n @let disabled = !!(menu.disabled && menu.disabled(aiTable(), targetName(), position()));\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{ 'ai-table-prevent-clear-selection remove-record': !disabled }\"\n (click)=\"execute(menu)\"\n [thyDisabled]=\"disabled\"\n >\n <thy-icon [thyIconName]=\"menu.icon!\"></thy-icon>\n <span>{{ menu.name }}</span>\n </a>\n }\n}\n" }]
|
1694
1687
|
}] });
|
1695
1688
|
|
1696
1689
|
const GRID_CELL_EDITOR_MAP = {
|
@@ -1726,7 +1719,7 @@ const AI_TABLE_FIELD_ADD_BUTTON = 'AI_TABLE_FIELD_ADD_BUTTON'; // 添加列名
|
|
1726
1719
|
const AI_TABLE_FIELD_ADD_BUTTON_WIDTH = 100; // 添加列宽度
|
1727
1720
|
const AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE = 8; // 字段表列头图标的间距
|
1728
1721
|
const AI_TABLE_FIELD_HEAD_MORE = 'AI_TABLE_FIELD_HEAD_MORE'; // 更多图标名称
|
1729
|
-
const
|
1722
|
+
const AI_TABLE_PREVENT_CLEAR_SELECTION_CLASS = '.ai-table-prevent-clear-selection';
|
1730
1723
|
const AI_TABLE_ICON_COMMON_SIZE = 16; // 表格图标的通用尺寸
|
1731
1724
|
const AI_TABLE_CELL = 'AI_TABLE_CELL'; // 单元格标识
|
1732
1725
|
// 因为 dom 的边距 12 是不包含 边框的,所以加上边框 2px 才能跟 编辑里面的内容对其;
|
@@ -1979,47 +1972,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
1979
1972
|
type: Injectable
|
1980
1973
|
}], ctorParameters: () => [{ type: i1$1.ThyPopover }] });
|
1981
1974
|
|
1982
|
-
class AITableGridMatchCellService {
|
1983
|
-
initialize(aiTable) {
|
1984
|
-
this.aiTable = aiTable;
|
1985
|
-
}
|
1986
|
-
findMatchedCells(keywords, references) {
|
1987
|
-
if (!keywords) {
|
1988
|
-
this.clearMatchedCells();
|
1989
|
-
return;
|
1990
|
-
}
|
1991
|
-
let matchedCells = [];
|
1992
|
-
this.aiTable.records().forEach((record) => {
|
1993
|
-
this.aiTable.fields().forEach((field) => {
|
1994
|
-
if (this.isCellMatchKeywords(this.aiTable, field, record._id, keywords, references)) {
|
1995
|
-
matchedCells.push(`${record._id}:${field._id}`);
|
1996
|
-
}
|
1997
|
-
});
|
1998
|
-
});
|
1999
|
-
this.aiTable.matchedCells.set([...matchedCells]);
|
2000
|
-
}
|
2001
|
-
clearMatchedCells() {
|
2002
|
-
this.aiTable.matchedCells.set([]);
|
2003
|
-
}
|
2004
|
-
isCellMatchKeywords(aiTable, field, recordId, keywords, references) {
|
2005
|
-
const cellValue = AITableQueries.getFieldValue(aiTable, [recordId, field._id]);
|
2006
|
-
const transformValue = transformCellValue(aiTable, field, cellValue);
|
2007
|
-
const fieldMethod = ViewOperationMap[field.type];
|
2008
|
-
let cellFullText = fieldMethod.cellFullText(transformValue, field, references);
|
2009
|
-
try {
|
2010
|
-
return keywords && cellFullText.length && cellFullText.some((item) => item.toLowerCase().includes(keywords.toLowerCase()));
|
2011
|
-
}
|
2012
|
-
catch (error) {
|
2013
|
-
return false;
|
2014
|
-
}
|
2015
|
-
}
|
2016
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridMatchCellService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2017
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridMatchCellService }); }
|
2018
|
-
}
|
2019
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridMatchCellService, decorators: [{
|
2020
|
-
type: Injectable
|
2021
|
-
}] });
|
2022
|
-
|
2023
1975
|
function getColumnIndicesMap(fields) {
|
2024
1976
|
const columnIndicesMap = {};
|
2025
1977
|
fields?.forEach((field, index) => {
|
@@ -2715,9 +2667,9 @@ class MemberField extends Field {
|
|
2715
2667
|
return super.isMeetFilter(condition, cellValue);
|
2716
2668
|
}
|
2717
2669
|
}
|
2718
|
-
compare(cellValue1, cellValue2, field, references) {
|
2719
|
-
const value1 = cellValueToSortValue$2(cellValue1, field, references);
|
2720
|
-
const value2 = cellValueToSortValue$2(cellValue2, field, references);
|
2670
|
+
compare(cellValue1, cellValue2, field, references, sortKey) {
|
2671
|
+
const value1 = cellValueToSortValue$2(cellValue1, field, references, sortKey);
|
2672
|
+
const value2 = cellValueToSortValue$2(cellValue2, field, references, sortKey);
|
2721
2673
|
return compareString(value1, value2);
|
2722
2674
|
}
|
2723
2675
|
cellFullText(transformValue, field, references) {
|
@@ -2736,20 +2688,21 @@ class MemberField extends Field {
|
|
2736
2688
|
return fullText;
|
2737
2689
|
}
|
2738
2690
|
}
|
2739
|
-
function cellValueToSortValue$2(cellValue, field, references) {
|
2740
|
-
let
|
2691
|
+
function cellValueToSortValue$2(cellValue, field, references, sortKey = 'display_name') {
|
2692
|
+
let values = [];
|
2741
2693
|
if (cellValue?.length && references) {
|
2742
2694
|
for (let index = 0; index < cellValue.length; index++) {
|
2743
2695
|
const userInfo = references?.members[cellValue[index]];
|
2744
2696
|
if (!userInfo) {
|
2745
2697
|
continue;
|
2746
2698
|
}
|
2747
|
-
|
2748
|
-
|
2699
|
+
const value = userInfo[sortKey];
|
2700
|
+
if (value) {
|
2701
|
+
values.push(value);
|
2749
2702
|
}
|
2750
2703
|
}
|
2751
2704
|
}
|
2752
|
-
return
|
2705
|
+
return values && values.length ? values.join(', ') : null;
|
2753
2706
|
}
|
2754
2707
|
|
2755
2708
|
class NumberField extends Field {
|
@@ -2927,6 +2880,14 @@ const ViewOperationMap = {
|
|
2927
2880
|
[AITableFieldType.updatedBy]: new MemberField()
|
2928
2881
|
};
|
2929
2882
|
|
2883
|
+
const isCellMatchKeywords = (aiTable, field, recordId, keywords, references) => {
|
2884
|
+
const cellValue = AITableQueries.getFieldValue(aiTable, [recordId, field._id]);
|
2885
|
+
const transformValue = transformCellValue(aiTable, field, cellValue);
|
2886
|
+
const fieldMethod = ViewOperationMap[field.type];
|
2887
|
+
let cellFullText = fieldMethod.cellFullText(transformValue, field, references);
|
2888
|
+
return keywords && cellFullText.length && cellFullText.some((text) => text.toLowerCase().includes(keywords.toLowerCase()));
|
2889
|
+
};
|
2890
|
+
|
2930
2891
|
class AITableGridEventService {
|
2931
2892
|
constructor() {
|
2932
2893
|
this.dblClickEvent$ = new Subject();
|
@@ -3181,7 +3142,6 @@ class AITableGridBase {
|
|
3181
3142
|
this.aiTableGridFieldService = inject(AITableGridFieldService);
|
3182
3143
|
this.aiTableGridEventService = inject(AITableGridEventService);
|
3183
3144
|
this.aiTableGridSelectionService = inject(AITableGridSelectionService);
|
3184
|
-
this.aiTableGridMatchCellService = inject(AITableGridMatchCellService);
|
3185
3145
|
}
|
3186
3146
|
ngOnInit() {
|
3187
3147
|
this.initAITable();
|
@@ -3197,7 +3157,6 @@ class AITableGridBase {
|
|
3197
3157
|
initService() {
|
3198
3158
|
this.aiTableGridEventService.initialize(this.aiTable, this.aiFieldConfig()?.fieldRenderers);
|
3199
3159
|
this.aiTableGridSelectionService.initialize(this.aiTable);
|
3200
|
-
this.aiTableGridMatchCellService.initialize(this.aiTable);
|
3201
3160
|
this.aiTableGridEventService.registerEvents(this.elementRef.nativeElement);
|
3202
3161
|
this.aiTableGridFieldService.initAIFieldConfig(this.aiFieldConfig());
|
3203
3162
|
this.aiTable.references.set(this.aiReferences());
|
@@ -5824,17 +5783,17 @@ const getCellBackground = (cell, isHover, targetName, aiTable) => {
|
|
5824
5783
|
const colors = AITable.getColors();
|
5825
5784
|
const [recordId, fieldId] = cell;
|
5826
5785
|
let background = colors.white;
|
5786
|
+
const _isHoverRecord = isHoverRecord(isHover, targetName);
|
5827
5787
|
const _isSelectedRecord = isSelectedRecord(recordId, aiTable);
|
5828
5788
|
const _isSelectedField = isSelectedField(fieldId, aiTable);
|
5829
|
-
const
|
5789
|
+
const _isSiblingCell = isSiblingCell(cell, aiTable);
|
5830
5790
|
const _isActiveCell = isActiveCell(cell, aiTable);
|
5831
5791
|
const _isSelectedCell = isSelectedCell(cell, aiTable);
|
5832
|
-
const
|
5833
|
-
|
5834
|
-
if (_isMatchedCell) {
|
5792
|
+
const _isKeywordsMatchedCell = isKeywordsMatchedCell(cell, aiTable);
|
5793
|
+
if (_isKeywordsMatchedCell) {
|
5835
5794
|
background = colors.itemMatchBgColor;
|
5836
5795
|
}
|
5837
|
-
else if (_isSelectedRecord || _isSelectedField ||
|
5796
|
+
else if (_isSelectedRecord || _isSelectedField || _isSiblingCell || (_isSelectedCell && !_isActiveCell)) {
|
5838
5797
|
background = colors.itemActiveBgColor;
|
5839
5798
|
}
|
5840
5799
|
else if (_isHoverRecord && !_isActiveCell) {
|
@@ -5843,54 +5802,28 @@ const getCellBackground = (cell, isHover, targetName, aiTable) => {
|
|
5843
5802
|
return background;
|
5844
5803
|
};
|
5845
5804
|
const isActiveCell = (cell, aiTable) => {
|
5846
|
-
|
5847
|
-
const
|
5848
|
-
|
5849
|
-
const [activeCellRecordId, activeCellFieldId] = activeCell;
|
5850
|
-
const [recordId, fieldId] = cell;
|
5851
|
-
if (recordId === activeCellRecordId && fieldId === activeCellFieldId) {
|
5852
|
-
isActive = true;
|
5853
|
-
}
|
5854
|
-
}
|
5855
|
-
return isActive;
|
5805
|
+
const [recordId, fieldId] = cell;
|
5806
|
+
const [activeRecordId, activeFieldId] = AITable.getActiveCell(aiTable) || [];
|
5807
|
+
return recordId === activeRecordId && fieldId === activeFieldId;
|
5856
5808
|
};
|
5857
|
-
const
|
5858
|
-
|
5859
|
-
const
|
5860
|
-
|
5861
|
-
const [recordId, fieldId] = cell;
|
5862
|
-
const [activeCellRecordId, activeCellFieldId] = activeCell;
|
5863
|
-
const selectedCells = aiTable.selection().selectedCells;
|
5864
|
-
isSiblingCell =
|
5865
|
-
selectedCells.size === 1 &&
|
5866
|
-
selectedCells.has(`${activeCellRecordId}:${activeCellFieldId}`) &&
|
5867
|
-
recordId === activeCellRecordId &&
|
5868
|
-
fieldId !== activeCellFieldId;
|
5869
|
-
}
|
5870
|
-
return isSiblingCell;
|
5809
|
+
const isSiblingCell = (cell, aiTable) => {
|
5810
|
+
const [recordId, fieldId] = cell;
|
5811
|
+
const [activeRecordId, activeFieldId] = AITable.getActiveCell(aiTable) || [];
|
5812
|
+
return AITable.getActiveRecordIds(aiTable).length === 1 && recordId === activeRecordId && fieldId !== activeFieldId;
|
5871
5813
|
};
|
5872
|
-
const
|
5814
|
+
const isKeywordsMatchedCell = (cell, aiTable) => {
|
5873
5815
|
const [recordId, fieldId] = cell;
|
5874
|
-
|
5875
|
-
aiTable.matchedCells().forEach((key) => {
|
5876
|
-
matchedCellsMap[key] = true;
|
5877
|
-
});
|
5878
|
-
const isMatchedCell = matchedCellsMap[`${recordId}:${fieldId}`];
|
5879
|
-
return isMatchedCell;
|
5816
|
+
return aiTable.keywordsMatchedCells().has(`${recordId}:${fieldId}`);
|
5880
5817
|
};
|
5881
5818
|
const isSelectedCell = (cell, aiTable) => {
|
5882
5819
|
const [recordId, fieldId] = cell;
|
5883
|
-
|
5884
|
-
const isSelectedCell = selectedCells.has(`${recordId}:${fieldId}`);
|
5885
|
-
return isSelectedCell;
|
5820
|
+
return aiTable.selection().selectedCells.has(`${recordId}:${fieldId}`);
|
5886
5821
|
};
|
5887
5822
|
const isSelectedField = (fieldId, aiTable) => {
|
5888
|
-
|
5889
|
-
return selectedFields.has(fieldId);
|
5823
|
+
return aiTable.selection().selectedFields.has(fieldId);
|
5890
5824
|
};
|
5891
5825
|
const isSelectedRecord = (recordId, aiTable) => {
|
5892
|
-
|
5893
|
-
return selectedRecords.has(recordId);
|
5826
|
+
return aiTable.selection().selectedRecords.has(recordId);
|
5894
5827
|
};
|
5895
5828
|
const isHoverRecord = (isHover, targetName) => {
|
5896
5829
|
return isHover && targetName !== AI_TABLE_FIELD_HEAD;
|
@@ -6841,8 +6774,8 @@ class AITableGrid extends AITableGridBase {
|
|
6841
6774
|
constructor() {
|
6842
6775
|
super();
|
6843
6776
|
this.viewContainerRef = inject(ViewContainerRef);
|
6844
|
-
this.
|
6845
|
-
this.
|
6777
|
+
this.isDragSelecting = false;
|
6778
|
+
this.dragSelectionStart = null;
|
6846
6779
|
this.fieldHeadHeight = AI_TABLE_FIELD_HEAD_HEIGHT;
|
6847
6780
|
this.containerRect = signal({ width: 0, height: 0 });
|
6848
6781
|
this.hasContainerRect = computed(() => {
|
@@ -6946,7 +6879,7 @@ class AITableGrid extends AITableGridBase {
|
|
6946
6879
|
}
|
6947
6880
|
});
|
6948
6881
|
effect(() => {
|
6949
|
-
this.
|
6882
|
+
this.setKeywordsMatchedCells();
|
6950
6883
|
}, { allowSignalWrites: true });
|
6951
6884
|
}
|
6952
6885
|
ngOnInit() {
|
@@ -6966,6 +6899,21 @@ class AITableGrid extends AITableGridBase {
|
|
6966
6899
|
scrollAction: this.scrollAction
|
6967
6900
|
});
|
6968
6901
|
}
|
6902
|
+
setKeywordsMatchedCells() {
|
6903
|
+
const keywords = this.aiKeywords();
|
6904
|
+
let matchedCells = new Set();
|
6905
|
+
if (keywords) {
|
6906
|
+
const references = this.aiReferences();
|
6907
|
+
this.aiTable.records().forEach((record) => {
|
6908
|
+
this.aiTable.fields().forEach((field) => {
|
6909
|
+
if (isCellMatchKeywords(this.aiTable, field, record._id, keywords, references)) {
|
6910
|
+
matchedCells.add(`${record._id}:${field._id}`);
|
6911
|
+
}
|
6912
|
+
});
|
6913
|
+
});
|
6914
|
+
}
|
6915
|
+
this.aiTable.keywordsMatchedCells.set(matchedCells);
|
6916
|
+
}
|
6969
6917
|
stageMousemove(e) {
|
6970
6918
|
if (this.timer) {
|
6971
6919
|
cancelAnimationFrame(this.timer);
|
@@ -6982,10 +6930,10 @@ class AITableGrid extends AITableGridBase {
|
|
6982
6930
|
handleMouseStyle(curMousePosition.realTargetName, curMousePosition.areaType, this.containerElement());
|
6983
6931
|
context.setPointPosition(curMousePosition);
|
6984
6932
|
this.timer = null;
|
6985
|
-
if (this.
|
6933
|
+
if (this.isDragSelecting) {
|
6986
6934
|
const { fieldId, recordId } = getDetailByTargetName(curMousePosition.realTargetName);
|
6987
6935
|
if (fieldId && recordId) {
|
6988
|
-
const startCell = this.
|
6936
|
+
const startCell = this.dragSelectionStart;
|
6989
6937
|
const endCell = [recordId, fieldId];
|
6990
6938
|
if (startCell && !!startCell.length) {
|
6991
6939
|
this.aiTableGridSelectionService.selectCells(startCell, endCell);
|
@@ -7015,9 +6963,9 @@ class AITableGrid extends AITableGridBase {
|
|
7015
6963
|
if (!recordId || !fieldId)
|
7016
6964
|
return;
|
7017
6965
|
this.aiTableGridEventService.closeCellEditor();
|
7018
|
-
const
|
7019
|
-
this.
|
7020
|
-
this.aiTableGridSelectionService.selectCells(
|
6966
|
+
const dragSelectionStart = [recordId, fieldId];
|
6967
|
+
this.updateDragSelectionState(true, dragSelectionStart);
|
6968
|
+
this.aiTableGridSelectionService.selectCells(dragSelectionStart);
|
7021
6969
|
return;
|
7022
6970
|
case AI_TABLE_ROW_ADD_BUTTON:
|
7023
6971
|
case AI_TABLE_FIELD_ADD_BUTTON:
|
@@ -7029,7 +6977,7 @@ class AITableGrid extends AITableGridBase {
|
|
7029
6977
|
}
|
7030
6978
|
}
|
7031
6979
|
stageMouseup(e) {
|
7032
|
-
this.
|
6980
|
+
this.updateDragSelectionState(false, null);
|
7033
6981
|
}
|
7034
6982
|
stageContextmenu(e) {
|
7035
6983
|
const mouseEvent = e.event.evt;
|
@@ -7172,16 +7120,15 @@ class AITableGrid extends AITableGridBase {
|
|
7172
7120
|
fromEvent(document, 'mousedown', { passive: true })
|
7173
7121
|
.pipe(filter((e) => e.target instanceof Element &&
|
7174
7122
|
!this.containerElement().contains(e.target) &&
|
7175
|
-
!
|
7176
|
-
AITable.getSelectedRecordIds(this.aiTable).length > 0)), takeUntilDestroyed(this.destroyRef))
|
7123
|
+
!e.target.closest(AI_TABLE_PREVENT_CLEAR_SELECTION_CLASS)), takeUntilDestroyed(this.destroyRef))
|
7177
7124
|
.subscribe(() => {
|
7178
|
-
this.
|
7125
|
+
this.updateDragSelectionState(false, null);
|
7179
7126
|
this.aiTableGridSelectionService.clearSelection();
|
7180
7127
|
});
|
7181
7128
|
}
|
7182
|
-
|
7183
|
-
this.
|
7184
|
-
this.
|
7129
|
+
updateDragSelectionState(isDragSelecting, dragSelectionStart) {
|
7130
|
+
this.isDragSelecting = isDragSelecting;
|
7131
|
+
this.dragSelectionStart = dragSelectionStart;
|
7185
7132
|
}
|
7186
7133
|
verticalScroll(e) {
|
7187
7134
|
const { scrollTop } = e.target;
|
@@ -7254,18 +7201,18 @@ class AITableGrid extends AITableGridBase {
|
|
7254
7201
|
}
|
7255
7202
|
}
|
7256
7203
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
7257
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableGrid, isStandalone: true, selector: "ai-table-grid", host: { classAttribute: "ai-table-grid" }, providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService
|
7204
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableGrid, isStandalone: true, selector: "ai-table-grid", host: { classAttribute: "ai-table-grid" }, providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, isSignal: true }, { propertyName: "verticalBarRef", first: true, predicate: ["verticalBar"], descendants: true, isSignal: true }, { propertyName: "horizontalBarRef", first: true, predicate: ["horizontalBar"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div #container class=\"ai-table-grid-view\">\n @if (hasContainerRect()) {\n <ai-table-renderer\n [config]=\"rendererConfig()\"\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 >\n <div #horizontalBar class=\"ai-table-horizontal-scroll-bar-wrapper\" [style.width.px]=\"containerRect().width\">\n <div class=\"ai-table-scroll-bar-inner\" [style.width.px]=\"scrollbarWidth()\"></div>\n </div>\n <div\n #verticalBar\n class=\"ai-table-vertical-scroll-bar-wrapper\"\n [style.height.px]=\"containerRect().height - fieldHeadHeight\"\n [style.top.px]=\"fieldHeadHeight\"\n >\n <div class=\"ai-table-scroll-bar-inner\" [style.height.px]=\"scrollTotalHeight()\"></div>\n </div>\n </ai-table-renderer>\n }\n</div>\n", dependencies: [{ kind: "component", type: AITableRenderer, selector: "ai-table-renderer", inputs: ["config"], outputs: ["koMousemove", "koMousedown", "koMouseup", "koContextmenu", "koWheel", "koClick", "koDblclick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
7258
7205
|
}
|
7259
7206
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGrid, decorators: [{
|
7260
7207
|
type: Component,
|
7261
7208
|
args: [{ selector: 'ai-table-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
7262
7209
|
class: 'ai-table-grid'
|
7263
|
-
}, imports: [AITableRenderer], providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService
|
7210
|
+
}, imports: [AITableRenderer], providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], template: "<div #container class=\"ai-table-grid-view\">\n @if (hasContainerRect()) {\n <ai-table-renderer\n [config]=\"rendererConfig()\"\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 >\n <div #horizontalBar class=\"ai-table-horizontal-scroll-bar-wrapper\" [style.width.px]=\"containerRect().width\">\n <div class=\"ai-table-scroll-bar-inner\" [style.width.px]=\"scrollbarWidth()\"></div>\n </div>\n <div\n #verticalBar\n class=\"ai-table-vertical-scroll-bar-wrapper\"\n [style.height.px]=\"containerRect().height - fieldHeadHeight\"\n [style.top.px]=\"fieldHeadHeight\"\n >\n <div class=\"ai-table-scroll-bar-inner\" [style.height.px]=\"scrollTotalHeight()\"></div>\n </div>\n </ai-table-renderer>\n }\n</div>\n" }]
|
7264
7211
|
}], ctorParameters: () => [] });
|
7265
7212
|
|
7266
7213
|
/**
|
7267
7214
|
* Generated bundle index. Do not edit.
|
7268
7215
|
*/
|
7269
7216
|
|
7270
|
-
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsMultiplePipe, AITableFieldPropertyEditor, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService,
|
7217
|
+
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsMultiplePipe, AITableFieldPropertyEditor, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridSelectionService, AITableMemberType, AITableMouseDownType, AITableQueries, AITableRenderer, AITableRowColumnType, AITableRowType, AITableSelectOptionStyle, AITableStatType, 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_BORDER, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE_OFFSET, AI_TABLE_CELL_EMOJI_PADDING, AI_TABLE_CELL_EMOJI_SIZE, 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_SELECT_CHECKBOX, AI_TABLE_FIELD_HEAD_TEXT_MIN_WIDTH, 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, Check, Colors, ColumnCalendarFilledPath, ColumnLinkOutlinedPath, ColumnMemberFilledPath, ColumnMultipleFillPath, ColumnNumberFilledPath, ColumnProgressFilledPath, ColumnRatingFilledPath, 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, FONT_SIZE_SM, FieldOptions, GRID_CELL_EDITOR_MAP, IsSelectRecordPipe, LinkCellEditorComponent, MIN_COLUMN_WIDTH, MOUSEOVER_EDIT_TYPE, MemberSettingPipe, MoreStandOutlinedPath, NumberCellEditorComponent, ProgressEditorComponent, RatingCellEditorComponent, RendererContext, RowHeight, SelectCellEditorComponent, SelectOptionComponent, SelectOptionPipe, SelectOptionsPipe, SelectSettingPipe, StarFill, TextCellEditorComponent, TextMeasure, Unchecked, UserPipe, ViewOperationMap, WebOutlinedPath, buildGridData, buildGridLinearRows, castToString, compareNumber, compareString, createAITable, createActiveCellBorder, createCells, createDefaultField, createDefaultFieldName, generateTargetName, getAvatarBgColor, getAvatarShortName, getCellEditorBorderSpace, getCellHorizontalPosition, getColumnIndicesMap, getDefaultFieldValue, getDetailByTargetName, getEditorBoxOffset, getEditorSpace, getFieldOptionByField, getHoverEditorBoxOffset, getHoverEditorSpace, getMousePosition, getPlaceHolderCellsConfigs, getTargetName, getTextWidth, getVisibleRangeInfo, handleMouseStyle, hasIntersect, idCreator, idsCreator, imageCache, isArrayField, isCellMatchKeywords, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, stringInclude, textDataCache, transformCellValue, zhIntlCollator };
|
7271
7218
|
//# sourceMappingURL=ai-table-grid.mjs.map
|