@ai-table/grid 0.0.28 → 0.0.29
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/context-menu/context-menu.component.d.ts.map +1 -1
- package/core/types/ai-table.d.ts +6 -14
- package/core/types/ai-table.d.ts.map +1 -1
- package/core/types/core.d.ts +1 -0
- package/core/types/core.d.ts.map +1 -1
- package/core/utils/common.d.ts.map +1 -1
- package/esm2022/components/context-menu/context-menu.component.mjs +3 -10
- package/esm2022/core/types/ai-table.mjs +25 -16
- package/esm2022/core/types/core.mjs +1 -1
- package/esm2022/core/utils/common.mjs +5 -4
- package/esm2022/dom-grid.component.mjs +3 -3
- package/esm2022/grid.component.mjs +29 -6
- package/esm2022/renderer/creations/create-active-cell-border.mjs +6 -3
- package/esm2022/renderer/creations/create-cells.mjs +81 -25
- package/esm2022/renderer/renderer.component.mjs +7 -3
- package/esm2022/services/event.service.mjs +3 -2
- package/esm2022/services/match-cell.service.mjs +2 -2
- package/esm2022/services/selection.service.mjs +46 -16
- package/esm2022/types/grid.mjs +1 -1
- package/esm2022/types/index.mjs +2 -1
- package/esm2022/types/view.mjs +18 -0
- package/esm2022/utils/field/model/date.mjs +64 -0
- package/esm2022/utils/field/model/field.mjs +38 -0
- package/esm2022/utils/field/model/index.mjs +25 -0
- package/esm2022/utils/field/model/link.mjs +33 -0
- package/esm2022/utils/field/model/member.mjs +56 -0
- package/esm2022/utils/field/model/number.mjs +32 -0
- package/esm2022/utils/field/model/progress.mjs +38 -0
- package/esm2022/utils/field/model/rate.mjs +26 -0
- package/esm2022/utils/field/model/select.mjs +56 -0
- package/esm2022/utils/field/model/text.mjs +27 -0
- package/esm2022/utils/field/operate.mjs +47 -0
- package/esm2022/utils/index.mjs +3 -2
- package/fesm2022/ai-table-grid.mjs +553 -100
- package/fesm2022/ai-table-grid.mjs.map +1 -1
- package/grid.component.d.ts +4 -0
- package/grid.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/renderer/creations/create-active-cell-border.d.ts.map +1 -1
- package/renderer/creations/create-cells.d.ts.map +1 -1
- package/renderer/renderer.component.d.ts +5 -3
- package/renderer/renderer.component.d.ts.map +1 -1
- package/services/event.service.d.ts.map +1 -1
- package/services/selection.service.d.ts +3 -2
- package/services/selection.service.d.ts.map +1 -1
- package/types/grid.d.ts +5 -4
- package/types/grid.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/view.d.ts +23 -0
- package/types/view.d.ts.map +1 -0
- package/utils/field/model/date.d.ts +9 -0
- package/utils/field/model/date.d.ts.map +1 -0
- package/utils/field/model/field.d.ts +9 -0
- package/utils/field/model/field.d.ts.map +1 -0
- package/utils/field/{index.d.ts → model/index.d.ts} +1 -1
- package/utils/field/model/index.d.ts.map +1 -0
- package/utils/field/model/link.d.ts +9 -0
- package/utils/field/model/link.d.ts.map +1 -0
- package/utils/field/model/member.d.ts +9 -0
- package/utils/field/model/member.d.ts.map +1 -0
- package/utils/field/model/number.d.ts +8 -0
- package/utils/field/model/number.d.ts.map +1 -0
- package/utils/field/model/progress.d.ts +9 -0
- package/utils/field/model/progress.d.ts.map +1 -0
- package/utils/field/model/rate.d.ts +8 -0
- package/utils/field/model/rate.d.ts.map +1 -0
- package/utils/field/model/select.d.ts +9 -0
- package/utils/field/model/select.d.ts.map +1 -0
- package/utils/field/model/text.d.ts +8 -0
- package/utils/field/model/text.d.ts.map +1 -0
- package/utils/field/operate.d.ts +9 -0
- package/utils/field/operate.d.ts.map +1 -0
- package/utils/index.d.ts +2 -1
- package/utils/index.d.ts.map +1 -1
- package/esm2022/utils/field/field.mjs +0 -3
- package/esm2022/utils/field/index.mjs +0 -22
- package/esm2022/utils/field/link.mjs +0 -12
- package/esm2022/utils/field/member.mjs +0 -19
- package/esm2022/utils/field/progress.mjs +0 -12
- package/esm2022/utils/field/select.mjs +0 -16
- package/esm2022/utils/field/text.mjs +0 -12
- package/utils/field/field.d.ts +0 -5
- package/utils/field/field.d.ts.map +0 -1
- package/utils/field/index.d.ts.map +0 -1
- package/utils/field/link.d.ts +0 -6
- package/utils/field/link.d.ts.map +0 -1
- package/utils/field/member.d.ts +0 -6
- package/utils/field/member.d.ts.map +0 -1
- package/utils/field/progress.d.ts +0 -6
- package/utils/field/progress.d.ts.map +0 -1
- package/utils/field/select.d.ts +0 -6
- package/utils/field/select.d.ts.map +0 -1
- package/utils/field/text.d.ts +0 -6
- package/utils/field/text.d.ts.map +0 -1
|
@@ -6,7 +6,7 @@ import ObjectID from 'bson-objectid';
|
|
|
6
6
|
import { customAlphabet } from 'nanoid';
|
|
7
7
|
import * as _ from 'lodash';
|
|
8
8
|
import ___default, { isNumber, includes, values, isString, isNil } from 'lodash';
|
|
9
|
-
import { isUndefinedOrNull, isArray, isEmpty as isEmpty$1, isObject } from 'ngx-tethys/util';
|
|
9
|
+
import { isUndefinedOrNull, isArray, isEmpty as isEmpty$1, isObject, TinyDate, helpers } from 'ngx-tethys/util';
|
|
10
10
|
import * as i1 from '@angular/forms';
|
|
11
11
|
import { FormsModule } from '@angular/forms';
|
|
12
12
|
import { ThyDatePicker, ThyDatePickerFormatPipe } from 'ngx-tethys/date-picker';
|
|
@@ -42,6 +42,7 @@ 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';
|
|
45
46
|
import { LRUCache } from 'lru-cache';
|
|
46
47
|
import Konva from 'konva';
|
|
47
48
|
import { Shape } from 'konva/lib/Shape';
|
|
@@ -98,32 +99,41 @@ const AITable = {
|
|
|
98
99
|
return aiTable.records();
|
|
99
100
|
},
|
|
100
101
|
getActiveCell(aiTable) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
return aiTable.selection().activeCell;
|
|
103
|
+
},
|
|
104
|
+
getSelectedRecordIds(aiTable) {
|
|
105
|
+
const selectedRecords = aiTable.selection().selectedRecords;
|
|
106
|
+
const selectedCells = aiTable.selection().selectedCells;
|
|
107
|
+
let selectedRecordIds = [];
|
|
108
|
+
if (selectedRecords.size > 0) {
|
|
109
|
+
selectedRecordIds = [...selectedRecords.keys()];
|
|
110
|
+
}
|
|
111
|
+
else if (selectedCells.size > 0) {
|
|
112
|
+
selectedRecordIds = [...selectedCells].map((item) => item.split(':')[0]);
|
|
112
113
|
}
|
|
113
|
-
|
|
114
|
+
else {
|
|
115
|
+
selectedRecordIds = [];
|
|
116
|
+
}
|
|
117
|
+
return selectedRecordIds;
|
|
114
118
|
},
|
|
115
119
|
isCellVisible(aiTable, cell) {
|
|
116
120
|
const visibleRowIndexMap = aiTable.context.visibleRowsIndexMap();
|
|
117
121
|
const visibleColumnIndexMap = aiTable.context.visibleColumnsMap();
|
|
118
|
-
|
|
122
|
+
let isVisible = false;
|
|
123
|
+
if (Array.isArray(cell) && !!cell.length) {
|
|
124
|
+
const [recordId, fieldId] = cell;
|
|
125
|
+
isVisible = visibleRowIndexMap.has(recordId) && visibleColumnIndexMap.has(fieldId);
|
|
126
|
+
}
|
|
127
|
+
return isVisible;
|
|
119
128
|
},
|
|
120
129
|
getCellIndex(aiTable, cell) {
|
|
121
130
|
const visibleRowIndexMap = aiTable.context.visibleRowsIndexMap();
|
|
122
131
|
const visibleColumnIndexMap = aiTable.context.visibleColumnsMap();
|
|
123
132
|
if (AITable.isCellVisible(aiTable, cell)) {
|
|
133
|
+
const [recordId, fieldId] = cell;
|
|
124
134
|
return {
|
|
125
|
-
rowIndex: visibleRowIndexMap.get(
|
|
126
|
-
columnIndex: visibleColumnIndexMap.get(
|
|
135
|
+
rowIndex: visibleRowIndexMap.get(recordId),
|
|
136
|
+
columnIndex: visibleColumnIndexMap.get(fieldId)
|
|
127
137
|
};
|
|
128
138
|
}
|
|
129
139
|
return null;
|
|
@@ -333,6 +343,24 @@ var AITableRowType;
|
|
|
333
343
|
AITableRowType["record"] = "record";
|
|
334
344
|
})(AITableRowType || (AITableRowType = {}));
|
|
335
345
|
|
|
346
|
+
var AITableFilterOperation;
|
|
347
|
+
(function (AITableFilterOperation) {
|
|
348
|
+
AITableFilterOperation["eq"] = "eq";
|
|
349
|
+
AITableFilterOperation["gte"] = "gte";
|
|
350
|
+
AITableFilterOperation["lte"] = "lte";
|
|
351
|
+
AITableFilterOperation["gt"] = "gt";
|
|
352
|
+
AITableFilterOperation["lt"] = "lt";
|
|
353
|
+
AITableFilterOperation["in"] = "in";
|
|
354
|
+
AITableFilterOperation["contain"] = "contain";
|
|
355
|
+
AITableFilterOperation["ne"] = "ne";
|
|
356
|
+
AITableFilterOperation["nin"] = "nin";
|
|
357
|
+
AITableFilterOperation["between"] = "between";
|
|
358
|
+
AITableFilterOperation["besides"] = "besides";
|
|
359
|
+
AITableFilterOperation["empty"] = "empty";
|
|
360
|
+
AITableFilterOperation["exists"] = "exists";
|
|
361
|
+
AITableFilterOperation["notContain"] = "not_contain";
|
|
362
|
+
})(AITableFilterOperation || (AITableFilterOperation = {}));
|
|
363
|
+
|
|
336
364
|
/**
|
|
337
365
|
* 用于构建 Canvas 基础坐标系,后续的绘制工作以此为基础
|
|
338
366
|
*/
|
|
@@ -672,9 +700,10 @@ function createAITable(records, fields) {
|
|
|
672
700
|
records,
|
|
673
701
|
fields,
|
|
674
702
|
selection: signal({
|
|
675
|
-
selectedRecords: new
|
|
676
|
-
selectedFields: new
|
|
677
|
-
selectedCells: new
|
|
703
|
+
selectedRecords: new Set(),
|
|
704
|
+
selectedFields: new Set(),
|
|
705
|
+
selectedCells: new Set(),
|
|
706
|
+
activeCell: null
|
|
678
707
|
}),
|
|
679
708
|
matchedCells: signal([]),
|
|
680
709
|
recordsMap: computed(() => {
|
|
@@ -1541,37 +1570,34 @@ class AITableGridSelectionService {
|
|
|
1541
1570
|
}
|
|
1542
1571
|
clearSelection() {
|
|
1543
1572
|
this.aiTable.selection.set({
|
|
1544
|
-
selectedRecords: new
|
|
1545
|
-
selectedFields: new
|
|
1546
|
-
selectedCells: new
|
|
1573
|
+
selectedRecords: new Set(),
|
|
1574
|
+
selectedFields: new Set(),
|
|
1575
|
+
selectedCells: new Set(),
|
|
1576
|
+
activeCell: null
|
|
1547
1577
|
});
|
|
1548
1578
|
}
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
if (fields?.hasOwnProperty(fieldId)) {
|
|
1552
|
-
return;
|
|
1553
|
-
}
|
|
1554
|
-
this.clearSelection();
|
|
1555
|
-
this.aiTable.selection().selectedCells.set(recordId, { [fieldId]: true });
|
|
1579
|
+
setActiveCell(activeCell) {
|
|
1580
|
+
this.aiTable.selection().activeCell = activeCell;
|
|
1556
1581
|
}
|
|
1557
1582
|
selectField(fieldId) {
|
|
1558
1583
|
if (this.aiTable.selection().selectedFields.has(fieldId)) {
|
|
1559
1584
|
return;
|
|
1560
1585
|
}
|
|
1561
1586
|
this.clearSelection();
|
|
1562
|
-
this.aiTable.selection().selectedFields.
|
|
1587
|
+
this.aiTable.selection().selectedFields.add(fieldId);
|
|
1563
1588
|
}
|
|
1564
1589
|
selectRecord(recordId) {
|
|
1565
1590
|
if (this.aiTable.selection().selectedRecords.has(recordId)) {
|
|
1566
1591
|
this.aiTable.selection().selectedRecords.delete(recordId);
|
|
1567
1592
|
}
|
|
1568
1593
|
else {
|
|
1569
|
-
this.aiTable.selection().selectedRecords.
|
|
1594
|
+
this.aiTable.selection().selectedRecords.add(recordId);
|
|
1570
1595
|
}
|
|
1571
1596
|
this.aiTable.selection.set({
|
|
1572
1597
|
selectedRecords: this.aiTable.selection().selectedRecords,
|
|
1573
|
-
selectedFields: new
|
|
1574
|
-
selectedCells: new
|
|
1598
|
+
selectedFields: new Set(),
|
|
1599
|
+
selectedCells: new Set(),
|
|
1600
|
+
activeCell: null
|
|
1575
1601
|
});
|
|
1576
1602
|
}
|
|
1577
1603
|
toggleSelectAll(checked) {
|
|
@@ -1594,7 +1620,7 @@ class AITableGridSelectionService {
|
|
|
1594
1620
|
if (cellDom) {
|
|
1595
1621
|
const fieldId = cellDom.getAttribute('fieldId');
|
|
1596
1622
|
const recordId = cellDom.getAttribute('recordId');
|
|
1597
|
-
fieldId && recordId && this.
|
|
1623
|
+
fieldId && recordId && this.selectCells([recordId, fieldId]);
|
|
1598
1624
|
}
|
|
1599
1625
|
if (colDom && !fieldAction) {
|
|
1600
1626
|
const fieldId = colDom.getAttribute('fieldId');
|
|
@@ -1604,6 +1630,38 @@ class AITableGridSelectionService {
|
|
|
1604
1630
|
this.clearSelection();
|
|
1605
1631
|
}
|
|
1606
1632
|
}
|
|
1633
|
+
selectCells(startCell, endCell) {
|
|
1634
|
+
const [startRecordId, startFieldId] = startCell;
|
|
1635
|
+
if (!this.aiTable.context.visibleRowsIndexMap().has(startRecordId) ||
|
|
1636
|
+
!this.aiTable.context.visibleColumnsMap().has(startFieldId)) {
|
|
1637
|
+
return;
|
|
1638
|
+
}
|
|
1639
|
+
const selectedCells = new Set();
|
|
1640
|
+
if (!endCell || !endCell.length) {
|
|
1641
|
+
selectedCells.add(`${startRecordId}:${startFieldId}`);
|
|
1642
|
+
}
|
|
1643
|
+
else {
|
|
1644
|
+
const [endRecordId, endFieldId] = endCell;
|
|
1645
|
+
const startRowIndex = this.aiTable.context.visibleRowsIndexMap().get(startRecordId);
|
|
1646
|
+
const endRowIndex = this.aiTable.context.visibleRowsIndexMap().get(endRecordId);
|
|
1647
|
+
const startColIndex = this.aiTable.context.visibleColumnsMap().get(startFieldId);
|
|
1648
|
+
const endColIndex = this.aiTable.context.visibleColumnsMap().get(endFieldId);
|
|
1649
|
+
const minRowIndex = Math.min(startRowIndex, endRowIndex);
|
|
1650
|
+
const maxRowIndex = Math.max(startRowIndex, endRowIndex);
|
|
1651
|
+
const minColIndex = Math.min(startColIndex, endColIndex);
|
|
1652
|
+
const maxColIndex = Math.max(startColIndex, endColIndex);
|
|
1653
|
+
const rows = this.aiTable.context.linearRows();
|
|
1654
|
+
const fields = AITable.getVisibleFields(this.aiTable);
|
|
1655
|
+
for (let i = minRowIndex; i <= maxRowIndex; i++) {
|
|
1656
|
+
for (let j = minColIndex; j <= maxColIndex; j++) {
|
|
1657
|
+
selectedCells.add(`${rows[i]._id}:${fields[j]._id}`);
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
this.clearSelection();
|
|
1662
|
+
this.setActiveCell(startCell);
|
|
1663
|
+
this.aiTable.selection().selectedCells = selectedCells;
|
|
1664
|
+
}
|
|
1607
1665
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridSelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1608
1666
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridSelectionService }); }
|
|
1609
1667
|
}
|
|
@@ -1632,14 +1690,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1632
1690
|
type: Component,
|
|
1633
1691
|
args: [{ selector: 'ai-table-context-menu', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1634
1692
|
class: 'context-menu'
|
|
1635
|
-
}, imports: [
|
|
1636
|
-
ThyDropdownMenuComponent,
|
|
1637
|
-
ThyDropdownMenuItemDirective,
|
|
1638
|
-
ThyDropdownMenuItemNameDirective,
|
|
1639
|
-
ThyDropdownMenuItemIconDirective,
|
|
1640
|
-
ThyIcon,
|
|
1641
|
-
NgClass
|
|
1642
|
-
], 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-prohibit-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" }]
|
|
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-prohibit-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" }]
|
|
1643
1694
|
}] });
|
|
1644
1695
|
|
|
1645
1696
|
const GRID_CELL_EDITOR_MAP = {
|
|
@@ -1941,7 +1992,7 @@ class AITableGridMatchCellService {
|
|
|
1941
1992
|
this.aiTable.records().forEach((record) => {
|
|
1942
1993
|
this.aiTable.fields().forEach((field) => {
|
|
1943
1994
|
if (this.isCellMatchKeywords(this.aiTable, field, record._id, keywords, references)) {
|
|
1944
|
-
matchedCells.push(`${record._id}
|
|
1995
|
+
matchedCells.push(`${record._id}:${field._id}`);
|
|
1945
1996
|
}
|
|
1946
1997
|
});
|
|
1947
1998
|
});
|
|
@@ -2480,19 +2531,195 @@ const TextMeasure = (defaults = {}) => {
|
|
|
2480
2531
|
};
|
|
2481
2532
|
|
|
2482
2533
|
class Field {
|
|
2534
|
+
// 筛选
|
|
2535
|
+
isMeetFilter(condition, cellValue) {
|
|
2536
|
+
switch (condition.operation) {
|
|
2537
|
+
case AITableFilterOperation.empty:
|
|
2538
|
+
case AITableFilterOperation.exists: {
|
|
2539
|
+
return this.isEmptyOrNot(condition.operation, cellValue);
|
|
2540
|
+
}
|
|
2541
|
+
default: {
|
|
2542
|
+
return true;
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
// 查找
|
|
2547
|
+
cellFullText(transformValue, field, references) {
|
|
2548
|
+
let fullText = [];
|
|
2549
|
+
if (!isEmpty(transformValue)) {
|
|
2550
|
+
fullText.push(String(transformValue));
|
|
2551
|
+
}
|
|
2552
|
+
return fullText;
|
|
2553
|
+
}
|
|
2554
|
+
isEmptyOrNot(operation, cellValue) {
|
|
2555
|
+
switch (operation) {
|
|
2556
|
+
case AITableFilterOperation.empty: {
|
|
2557
|
+
return isEmpty(cellValue);
|
|
2558
|
+
}
|
|
2559
|
+
case AITableFilterOperation.exists: {
|
|
2560
|
+
return !isEmpty(cellValue);
|
|
2561
|
+
}
|
|
2562
|
+
default: {
|
|
2563
|
+
throw new Error('compare operator type error');
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
const zhIntlCollator = typeof Intl !== 'undefined' ? new Intl.Collator('zh-CN') : undefined;
|
|
2570
|
+
function compareNumber(a, b) {
|
|
2571
|
+
if (isEmpty(a) && isEmpty(b)) {
|
|
2572
|
+
return 0;
|
|
2573
|
+
}
|
|
2574
|
+
if (isEmpty(a)) {
|
|
2575
|
+
return -1;
|
|
2576
|
+
}
|
|
2577
|
+
if (isEmpty(b)) {
|
|
2578
|
+
return 1;
|
|
2579
|
+
}
|
|
2580
|
+
return a === b ? 0 : a > b ? 1 : -1;
|
|
2581
|
+
}
|
|
2582
|
+
function compareString(a, b) {
|
|
2583
|
+
if (a === b) {
|
|
2584
|
+
return 0;
|
|
2585
|
+
}
|
|
2586
|
+
if (a == null) {
|
|
2587
|
+
return -1;
|
|
2588
|
+
}
|
|
2589
|
+
if (b == null) {
|
|
2590
|
+
return 1;
|
|
2591
|
+
}
|
|
2592
|
+
// pinyin sort
|
|
2593
|
+
return a === b ? 0 : zhIntlCollator ? zhIntlCollator.compare(a, b) : a.localeCompare(b, 'zh-CN') > 0 ? 1 : -1;
|
|
2594
|
+
}
|
|
2595
|
+
function stringInclude(str, searchStr) {
|
|
2596
|
+
return str.toLowerCase().includes(searchStr.trim().toLowerCase());
|
|
2597
|
+
}
|
|
2598
|
+
/**
|
|
2599
|
+
* 两数组是否有交集
|
|
2600
|
+
*/
|
|
2601
|
+
function hasIntersect(array1, array2) {
|
|
2602
|
+
if (!Array.isArray(array1) || !Array.isArray(array2)) {
|
|
2603
|
+
return false;
|
|
2604
|
+
}
|
|
2605
|
+
const set1 = new Set(array1);
|
|
2606
|
+
const set2 = new Set(array2);
|
|
2607
|
+
for (const element of set1) {
|
|
2608
|
+
if (set2.has(element)) {
|
|
2609
|
+
return true;
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
return false;
|
|
2613
|
+
}
|
|
2614
|
+
|
|
2615
|
+
class DateField extends Field {
|
|
2616
|
+
isMeetFilter(condition, cellValue) {
|
|
2617
|
+
const [left, right] = this.getTimeRange(condition.value);
|
|
2618
|
+
switch (condition.operation) {
|
|
2619
|
+
case AITableFilterOperation.empty:
|
|
2620
|
+
return isEmpty$1(cellValue.timestamp) || cellValue.timestamp === 0;
|
|
2621
|
+
case AITableFilterOperation.exists:
|
|
2622
|
+
return !isEmpty$1(cellValue.timestamp) && cellValue.timestamp !== 0;
|
|
2623
|
+
case AITableFilterOperation.eq:
|
|
2624
|
+
return left <= cellValue.timestamp && cellValue.timestamp < right;
|
|
2625
|
+
case AITableFilterOperation.gt:
|
|
2626
|
+
return cellValue.timestamp > right;
|
|
2627
|
+
case AITableFilterOperation.lt:
|
|
2628
|
+
return cellValue.timestamp < left;
|
|
2629
|
+
case AITableFilterOperation.between:
|
|
2630
|
+
return left <= cellValue.timestamp && cellValue.timestamp < right;
|
|
2631
|
+
default:
|
|
2632
|
+
return super.isMeetFilter(condition, cellValue);
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
compare(cellValue1, cellValue2) {
|
|
2636
|
+
const value1 = cellValueToSortValue$4(cellValue1);
|
|
2637
|
+
const value2 = cellValueToSortValue$4(cellValue2);
|
|
2638
|
+
return compareNumber(value1, value2);
|
|
2639
|
+
}
|
|
2640
|
+
getTimeRange(value) {
|
|
2641
|
+
switch (value) {
|
|
2642
|
+
case 'today':
|
|
2643
|
+
return [new TinyDate(new Date()).startOfDay().getUnixTime(), new TinyDate(new Date()).endOfDay().getUnixTime()];
|
|
2644
|
+
case 'current_week':
|
|
2645
|
+
return [
|
|
2646
|
+
new TinyDate().startOfWeek({ weekStartsOn: 1 }).getUnixTime(),
|
|
2647
|
+
new TinyDate().endOfWeek({ weekStartsOn: 1 }).getUnixTime()
|
|
2648
|
+
];
|
|
2649
|
+
case 'yesterday':
|
|
2650
|
+
return [
|
|
2651
|
+
new TinyDate(subDays(new Date(), 1)).startOfDay().getUnixTime(),
|
|
2652
|
+
new TinyDate(subDays(new Date(), 1)).endOfDay().getUnixTime()
|
|
2653
|
+
];
|
|
2654
|
+
case 'current_month':
|
|
2655
|
+
return [new TinyDate().startOfMonth().getUnixTime(), new TinyDate().endOfMonth().getUnixTime()];
|
|
2656
|
+
default:
|
|
2657
|
+
if (isArray(value)) {
|
|
2658
|
+
return [
|
|
2659
|
+
new TinyDate(fromUnixTime(value[0])).startOfDay().getUnixTime(),
|
|
2660
|
+
new TinyDate(fromUnixTime(value[1])).endOfDay().getUnixTime()
|
|
2661
|
+
];
|
|
2662
|
+
}
|
|
2663
|
+
return [
|
|
2664
|
+
new TinyDate(fromUnixTime(value)).startOfDay().getUnixTime(),
|
|
2665
|
+
new TinyDate(fromUnixTime(value)).endOfDay().getUnixTime()
|
|
2666
|
+
];
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
function cellValueToSortValue$4(cellValue) {
|
|
2671
|
+
return cellValue?.timestamp;
|
|
2483
2672
|
}
|
|
2484
2673
|
|
|
2485
2674
|
class LinkField extends Field {
|
|
2486
|
-
|
|
2487
|
-
|
|
2675
|
+
isMeetFilter(condition, cellValue) {
|
|
2676
|
+
const cellTextValue = cellValue?.text;
|
|
2677
|
+
switch (condition.operation) {
|
|
2678
|
+
case AITableFilterOperation.empty:
|
|
2679
|
+
return isEmpty(cellTextValue);
|
|
2680
|
+
case AITableFilterOperation.exists:
|
|
2681
|
+
return !isEmpty(cellTextValue);
|
|
2682
|
+
case AITableFilterOperation.contain:
|
|
2683
|
+
return !isEmpty(cellTextValue) && stringInclude(cellTextValue, condition.value);
|
|
2684
|
+
default:
|
|
2685
|
+
return super.isMeetFilter(condition, cellTextValue);
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
compare(cellValue1, cellValue2) {
|
|
2689
|
+
return compareString(cellValueToSortValue$3(cellValue1), cellValueToSortValue$3(cellValue2));
|
|
2690
|
+
}
|
|
2691
|
+
cellFullText(transformValue) {
|
|
2692
|
+
let texts = [];
|
|
2488
2693
|
if (!isEmpty(transformValue?.text)) {
|
|
2489
|
-
|
|
2694
|
+
texts.push(transformValue.text);
|
|
2490
2695
|
}
|
|
2491
|
-
return
|
|
2696
|
+
return texts;
|
|
2492
2697
|
}
|
|
2493
2698
|
}
|
|
2699
|
+
function cellValueToSortValue$3(cellValue) {
|
|
2700
|
+
return (cellValue && cellValue.text && cellValue.text.trim()) || null;
|
|
2701
|
+
}
|
|
2494
2702
|
|
|
2495
2703
|
class MemberField extends Field {
|
|
2704
|
+
isMeetFilter(condition, cellValue) {
|
|
2705
|
+
switch (condition.operation) {
|
|
2706
|
+
case AITableFilterOperation.empty:
|
|
2707
|
+
return isEmpty(cellValue);
|
|
2708
|
+
case AITableFilterOperation.exists:
|
|
2709
|
+
return !isEmpty(cellValue);
|
|
2710
|
+
case AITableFilterOperation.in:
|
|
2711
|
+
return Array.isArray(condition.value) && hasIntersect(cellValue, condition.value);
|
|
2712
|
+
case AITableFilterOperation.nin:
|
|
2713
|
+
return Array.isArray(condition.value) && !hasIntersect(cellValue, condition.value);
|
|
2714
|
+
default:
|
|
2715
|
+
return super.isMeetFilter(condition, cellValue);
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
compare(cellValue1, cellValue2, field, references) {
|
|
2719
|
+
const value1 = cellValueToSortValue$2(cellValue1, field, references);
|
|
2720
|
+
const value2 = cellValueToSortValue$2(cellValue2, field, references);
|
|
2721
|
+
return compareString(value1, value2);
|
|
2722
|
+
}
|
|
2496
2723
|
cellFullText(transformValue, field, references) {
|
|
2497
2724
|
let fullText = [];
|
|
2498
2725
|
if (transformValue?.length && references) {
|
|
@@ -2509,9 +2736,77 @@ class MemberField extends Field {
|
|
|
2509
2736
|
return fullText;
|
|
2510
2737
|
}
|
|
2511
2738
|
}
|
|
2739
|
+
function cellValueToSortValue$2(cellValue, field, references) {
|
|
2740
|
+
let names = [];
|
|
2741
|
+
if (cellValue?.length && references) {
|
|
2742
|
+
for (let index = 0; index < cellValue.length; index++) {
|
|
2743
|
+
const userInfo = references?.members[cellValue[index]];
|
|
2744
|
+
if (!userInfo) {
|
|
2745
|
+
continue;
|
|
2746
|
+
}
|
|
2747
|
+
if (userInfo.display_name_pinyin) {
|
|
2748
|
+
names.push(userInfo.display_name_pinyin);
|
|
2749
|
+
}
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
return names && names.length ? names.join(', ') : null;
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
class NumberField extends Field {
|
|
2756
|
+
isMeetFilter(condition, cellValue) {
|
|
2757
|
+
switch (condition.operation) {
|
|
2758
|
+
case AITableFilterOperation.empty:
|
|
2759
|
+
return isEmpty(cellValue);
|
|
2760
|
+
case AITableFilterOperation.exists:
|
|
2761
|
+
return !isEmpty(cellValue);
|
|
2762
|
+
case AITableFilterOperation.eq:
|
|
2763
|
+
return !Number.isNaN(condition.value) && cellValue != null && cellValue !== '' && condition.value === cellValue;
|
|
2764
|
+
case AITableFilterOperation.gte:
|
|
2765
|
+
return cellValue != null && cellValue !== '' && cellValue >= condition.value;
|
|
2766
|
+
case AITableFilterOperation.lte:
|
|
2767
|
+
return cellValue != null && cellValue !== '' && cellValue <= condition.value;
|
|
2768
|
+
case AITableFilterOperation.gt:
|
|
2769
|
+
return cellValue != null && cellValue !== '' && cellValue > condition.value;
|
|
2770
|
+
case AITableFilterOperation.lt:
|
|
2771
|
+
return cellValue != null && cellValue !== '' && cellValue < condition.value;
|
|
2772
|
+
case AITableFilterOperation.ne:
|
|
2773
|
+
return cellValue == null || cellValue == '' || Number.isNaN(condition.value) || cellValue !== condition.value;
|
|
2774
|
+
default:
|
|
2775
|
+
return super.isMeetFilter(condition, cellValue);
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
compare(cellValue1, cellValue2) {
|
|
2779
|
+
return compareNumber(cellValue1, cellValue2);
|
|
2780
|
+
}
|
|
2781
|
+
}
|
|
2512
2782
|
|
|
2513
2783
|
class ProgressField extends Field {
|
|
2514
|
-
|
|
2784
|
+
isMeetFilter(condition, cellValue) {
|
|
2785
|
+
switch (condition.operation) {
|
|
2786
|
+
case AITableFilterOperation.empty:
|
|
2787
|
+
return isEmpty(cellValue);
|
|
2788
|
+
case AITableFilterOperation.exists:
|
|
2789
|
+
return !isEmpty(cellValue);
|
|
2790
|
+
case AITableFilterOperation.eq:
|
|
2791
|
+
return !Number.isNaN(condition.value) && cellValue != null && cellValue !== '' && condition.value === cellValue;
|
|
2792
|
+
case AITableFilterOperation.gte:
|
|
2793
|
+
return cellValue != null && cellValue !== '' && cellValue >= condition.value;
|
|
2794
|
+
case AITableFilterOperation.lte:
|
|
2795
|
+
return cellValue != null && cellValue !== '' && cellValue <= condition.value;
|
|
2796
|
+
case AITableFilterOperation.gt:
|
|
2797
|
+
return cellValue != null && cellValue !== '' && cellValue > condition.value;
|
|
2798
|
+
case AITableFilterOperation.lt:
|
|
2799
|
+
return cellValue != null && cellValue !== '' && cellValue < condition.value;
|
|
2800
|
+
case AITableFilterOperation.ne:
|
|
2801
|
+
return cellValue == null || cellValue == '' || Number.isNaN(condition.value) || cellValue !== condition.value;
|
|
2802
|
+
default:
|
|
2803
|
+
return super.isMeetFilter(condition, cellValue);
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
compare(cellValue1, cellValue2) {
|
|
2807
|
+
return compareNumber(cellValue1, cellValue2);
|
|
2808
|
+
}
|
|
2809
|
+
cellFullText(transformValue) {
|
|
2515
2810
|
let fullText = [];
|
|
2516
2811
|
if (!isEmpty(transformValue)) {
|
|
2517
2812
|
fullText.push(`${transformValue}%`);
|
|
@@ -2520,40 +2815,111 @@ class ProgressField extends Field {
|
|
|
2520
2815
|
}
|
|
2521
2816
|
}
|
|
2522
2817
|
|
|
2818
|
+
class RateField extends Field {
|
|
2819
|
+
isMeetFilter(condition, cellValue) {
|
|
2820
|
+
switch (condition.operation) {
|
|
2821
|
+
case AITableFilterOperation.empty:
|
|
2822
|
+
return isEmpty(cellValue);
|
|
2823
|
+
case AITableFilterOperation.exists:
|
|
2824
|
+
return !isEmpty(cellValue);
|
|
2825
|
+
case AITableFilterOperation.in:
|
|
2826
|
+
const isContain = condition.value.some((item) => String(item) === String(cellValue));
|
|
2827
|
+
return !isEmpty(cellValue) && isContain;
|
|
2828
|
+
case AITableFilterOperation.nin:
|
|
2829
|
+
const noContain = condition.value.every((item) => String(item) !== String(cellValue));
|
|
2830
|
+
return isEmpty(cellValue) || noContain;
|
|
2831
|
+
default:
|
|
2832
|
+
return super.isMeetFilter(condition, cellValue);
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
compare(cellValue1, cellValue2) {
|
|
2836
|
+
return compareNumber(cellValue1, cellValue2);
|
|
2837
|
+
}
|
|
2838
|
+
}
|
|
2839
|
+
|
|
2523
2840
|
class SelectField extends Field {
|
|
2841
|
+
isMeetFilter(condition, cellValue) {
|
|
2842
|
+
switch (condition.operation) {
|
|
2843
|
+
case AITableFilterOperation.empty:
|
|
2844
|
+
return isEmpty(cellValue);
|
|
2845
|
+
case AITableFilterOperation.exists:
|
|
2846
|
+
return !isEmpty(cellValue);
|
|
2847
|
+
case AITableFilterOperation.in:
|
|
2848
|
+
return Array.isArray(condition.value) && hasIntersect(cellValue, condition.value);
|
|
2849
|
+
case AITableFilterOperation.nin:
|
|
2850
|
+
return Array.isArray(condition.value) && !hasIntersect(cellValue, condition.value);
|
|
2851
|
+
default:
|
|
2852
|
+
return super.isMeetFilter(condition, cellValue);
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
compare(cellValue1, cellValue2, field) {
|
|
2856
|
+
const value1 = cellValueToSortValue$1(cellValue1, field);
|
|
2857
|
+
const value2 = cellValueToSortValue$1(cellValue2, field);
|
|
2858
|
+
return compareString(value1, value2);
|
|
2859
|
+
}
|
|
2524
2860
|
cellFullText(transformValue, field) {
|
|
2525
|
-
let
|
|
2861
|
+
let fullText = [];
|
|
2862
|
+
const optionsMap = helpers.keyBy(field.settings.options || [], '_id');
|
|
2526
2863
|
if (transformValue && Array.isArray(transformValue) && transformValue.length) {
|
|
2527
2864
|
transformValue.forEach((optionId) => {
|
|
2528
|
-
const
|
|
2529
|
-
if (
|
|
2530
|
-
|
|
2865
|
+
const option = optionsMap[optionId];
|
|
2866
|
+
if (option && option.text) {
|
|
2867
|
+
fullText.push(option.text);
|
|
2531
2868
|
}
|
|
2532
2869
|
});
|
|
2533
2870
|
}
|
|
2534
|
-
return
|
|
2871
|
+
return fullText;
|
|
2535
2872
|
}
|
|
2536
2873
|
}
|
|
2874
|
+
function cellValueToSortValue$1(cellValue, field) {
|
|
2875
|
+
if (!cellValue) {
|
|
2876
|
+
return null;
|
|
2877
|
+
}
|
|
2878
|
+
const texts = [];
|
|
2879
|
+
const optionsMap = helpers.keyBy(field.settings.options || [], '_id');
|
|
2880
|
+
if (cellValue && Array.isArray(cellValue) && cellValue.length) {
|
|
2881
|
+
cellValue.forEach((optionId) => {
|
|
2882
|
+
const option = optionsMap[optionId];
|
|
2883
|
+
if (option && option.text) {
|
|
2884
|
+
texts.push(option.text);
|
|
2885
|
+
}
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2888
|
+
return texts && texts.length ? texts.join(',') : null;
|
|
2889
|
+
}
|
|
2537
2890
|
|
|
2538
2891
|
class TextField extends Field {
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2892
|
+
isMeetFilter(condition, cellValue) {
|
|
2893
|
+
switch (condition.operation) {
|
|
2894
|
+
case AITableFilterOperation.empty:
|
|
2895
|
+
return isEmpty(cellValue);
|
|
2896
|
+
case AITableFilterOperation.exists:
|
|
2897
|
+
return !isEmpty(cellValue);
|
|
2898
|
+
case AITableFilterOperation.contain:
|
|
2899
|
+
return !isEmpty(cellValue) && stringInclude(cellValue, condition.value);
|
|
2900
|
+
default:
|
|
2901
|
+
return super.isMeetFilter(condition, cellValue);
|
|
2543
2902
|
}
|
|
2544
|
-
return fullText;
|
|
2545
2903
|
}
|
|
2904
|
+
compare(cellValue1, cellValue2) {
|
|
2905
|
+
const value1 = cellValueToSortValue(cellValue1);
|
|
2906
|
+
const value2 = cellValueToSortValue(cellValue2);
|
|
2907
|
+
return compareString(value1, value2);
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
function cellValueToSortValue(cellValue) {
|
|
2911
|
+
return (cellValue && cellValue.trim()) || null;
|
|
2546
2912
|
}
|
|
2547
2913
|
|
|
2548
2914
|
const ViewOperationMap = {
|
|
2549
2915
|
[AITableFieldType.text]: new TextField(),
|
|
2550
2916
|
[AITableFieldType.richText]: new TextField(),
|
|
2551
2917
|
[AITableFieldType.select]: new SelectField(),
|
|
2552
|
-
[AITableFieldType.date]: new
|
|
2553
|
-
[AITableFieldType.createdAt]: new
|
|
2554
|
-
[AITableFieldType.updatedAt]: new
|
|
2555
|
-
[AITableFieldType.number]: new
|
|
2556
|
-
[AITableFieldType.rate]: new
|
|
2918
|
+
[AITableFieldType.date]: new DateField(),
|
|
2919
|
+
[AITableFieldType.createdAt]: new DateField(),
|
|
2920
|
+
[AITableFieldType.updatedAt]: new DateField(),
|
|
2921
|
+
[AITableFieldType.number]: new NumberField(),
|
|
2922
|
+
[AITableFieldType.rate]: new RateField(),
|
|
2557
2923
|
[AITableFieldType.link]: new LinkField(),
|
|
2558
2924
|
[AITableFieldType.member]: new MemberField(),
|
|
2559
2925
|
[AITableFieldType.progress]: new ProgressField(),
|
|
@@ -2645,7 +3011,8 @@ class AITableGridEventService {
|
|
|
2645
3011
|
const { container, coordinate, recordId, fieldId, isHoverEdit } = options;
|
|
2646
3012
|
const { scrollState } = aiTable.context;
|
|
2647
3013
|
const { rowHeight, columnCount } = coordinate;
|
|
2648
|
-
const
|
|
3014
|
+
const cell = [recordId, fieldId];
|
|
3015
|
+
const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, cell);
|
|
2649
3016
|
const originX = coordinate.getColumnOffset(columnIndex);
|
|
2650
3017
|
const originY = coordinate.getRowOffset(rowIndex);
|
|
2651
3018
|
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
|
@@ -2940,7 +3307,7 @@ class AITableDomGrid extends AITableGridBase {
|
|
|
2940
3307
|
});
|
|
2941
3308
|
}
|
|
2942
3309
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
2943
|
-
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: field.width + '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 <div\n #cell\n class=\"grid-cell\"\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 [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: field.width + '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 }); }
|
|
3310
|
+
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: field.width + '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: field.width + '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 }); }
|
|
2944
3311
|
}
|
|
2945
3312
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, decorators: [{
|
|
2946
3313
|
type: Component,
|
|
@@ -2976,7 +3343,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
2976
3343
|
UserPipe,
|
|
2977
3344
|
SelectSettingPipe,
|
|
2978
3345
|
MemberSettingPipe
|
|
2979
|
-
], 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: field.width + '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 <div\n #cell\n class=\"grid-cell\"\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 [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: field.width + '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" }]
|
|
3346
|
+
], 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: field.width + '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: field.width + '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" }]
|
|
2980
3347
|
}] });
|
|
2981
3348
|
|
|
2982
3349
|
const KO_CONTAINER_TOKEN = new InjectionToken('KO_CONTAINER_TOKEN');
|
|
@@ -5391,28 +5758,9 @@ const createCells = (config) => {
|
|
|
5391
5758
|
break;
|
|
5392
5759
|
}
|
|
5393
5760
|
case AITableRowType.record: {
|
|
5394
|
-
let background = colors.white;
|
|
5395
5761
|
const fieldId = field._id;
|
|
5396
|
-
const
|
|
5397
|
-
|
|
5398
|
-
const isHoverRow = isHover && targetName !== AI_TABLE_FIELD_HEAD;
|
|
5399
|
-
const activeCell = AITable.getActiveCell(aiTable);
|
|
5400
|
-
const isSiblingActiveCell = recordId === activeCell?.recordId && fieldId !== activeCell?.fieldId;
|
|
5401
|
-
const isActiveCell = recordId === activeCell?.recordId;
|
|
5402
|
-
let matchedCellsMap = {};
|
|
5403
|
-
aiTable.matchedCells().forEach((key) => {
|
|
5404
|
-
matchedCellsMap[key] = true;
|
|
5405
|
-
});
|
|
5406
|
-
const isMatchedCell = matchedCellsMap[`${recordId}-${fieldId}`];
|
|
5407
|
-
if (isMatchedCell) {
|
|
5408
|
-
background = colors.itemMatchBgColor;
|
|
5409
|
-
}
|
|
5410
|
-
else if (isCheckedRow || isSelected || isSiblingActiveCell) {
|
|
5411
|
-
background = colors.itemActiveBgColor;
|
|
5412
|
-
}
|
|
5413
|
-
else if (isHoverRow && !isActiveCell) {
|
|
5414
|
-
background = colors.gray80;
|
|
5415
|
-
}
|
|
5762
|
+
const cell = [recordId, fieldId];
|
|
5763
|
+
let background = getCellBackground(cell, isHover, targetName, aiTable);
|
|
5416
5764
|
recordRowLayout.init({
|
|
5417
5765
|
x,
|
|
5418
5766
|
y,
|
|
@@ -5426,8 +5774,8 @@ const createCells = (config) => {
|
|
|
5426
5774
|
recordRowLayout.render({
|
|
5427
5775
|
row,
|
|
5428
5776
|
style: { fill: background },
|
|
5429
|
-
isHoverRow,
|
|
5430
|
-
isCheckedRow
|
|
5777
|
+
isHoverRow: isHoverRecord(isHover, targetName),
|
|
5778
|
+
isCheckedRow: isSelectedRecord(recordId, aiTable)
|
|
5431
5779
|
});
|
|
5432
5780
|
const { width, offset } = getCellHorizontalPosition({
|
|
5433
5781
|
columnIndex,
|
|
@@ -5450,7 +5798,7 @@ const createCells = (config) => {
|
|
|
5450
5798
|
cellValue,
|
|
5451
5799
|
transformValue,
|
|
5452
5800
|
references,
|
|
5453
|
-
isActive:
|
|
5801
|
+
isActive: isSelectedField(fieldId, aiTable),
|
|
5454
5802
|
style,
|
|
5455
5803
|
colors
|
|
5456
5804
|
};
|
|
@@ -5472,6 +5820,81 @@ const createCells = (config) => {
|
|
|
5472
5820
|
}
|
|
5473
5821
|
}
|
|
5474
5822
|
};
|
|
5823
|
+
const getCellBackground = (cell, isHover, targetName, aiTable) => {
|
|
5824
|
+
const colors = AITable.getColors();
|
|
5825
|
+
const [recordId, fieldId] = cell;
|
|
5826
|
+
let background = colors.white;
|
|
5827
|
+
const _isSelectedRecord = isSelectedRecord(recordId, aiTable);
|
|
5828
|
+
const _isSelectedField = isSelectedField(fieldId, aiTable);
|
|
5829
|
+
const _isSiblingActiveCell = isSiblingActiveCell(cell, aiTable);
|
|
5830
|
+
const _isActiveCell = isActiveCell(cell, aiTable);
|
|
5831
|
+
const _isSelectedCell = isSelectedCell(cell, aiTable);
|
|
5832
|
+
const _isMatchedCell = isMatchedCell(cell, aiTable);
|
|
5833
|
+
const _isHoverRecord = isHoverRecord(isHover, targetName);
|
|
5834
|
+
if (_isMatchedCell) {
|
|
5835
|
+
background = colors.itemMatchBgColor;
|
|
5836
|
+
}
|
|
5837
|
+
else if (_isSelectedRecord || _isSelectedField || _isSiblingActiveCell || (_isSelectedCell && !_isActiveCell)) {
|
|
5838
|
+
background = colors.itemActiveBgColor;
|
|
5839
|
+
}
|
|
5840
|
+
else if (_isHoverRecord && !_isActiveCell) {
|
|
5841
|
+
background = colors.gray80;
|
|
5842
|
+
}
|
|
5843
|
+
return background;
|
|
5844
|
+
};
|
|
5845
|
+
const isActiveCell = (cell, aiTable) => {
|
|
5846
|
+
let isActive = false;
|
|
5847
|
+
const activeCell = AITable.getActiveCell(aiTable);
|
|
5848
|
+
if (Array.isArray(activeCell) && !!activeCell.length) {
|
|
5849
|
+
const [activeCellRecordId, activeCellFieldId] = activeCell;
|
|
5850
|
+
const [recordId, fieldId] = cell;
|
|
5851
|
+
if (recordId === activeCellRecordId && fieldId === activeCellFieldId) {
|
|
5852
|
+
isActive = true;
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
return isActive;
|
|
5856
|
+
};
|
|
5857
|
+
const isSiblingActiveCell = (cell, aiTable) => {
|
|
5858
|
+
let isSiblingCell = false;
|
|
5859
|
+
const activeCell = AITable.getActiveCell(aiTable);
|
|
5860
|
+
if (Array.isArray(activeCell) && !!activeCell.length) {
|
|
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;
|
|
5871
|
+
};
|
|
5872
|
+
const isMatchedCell = (cell, aiTable) => {
|
|
5873
|
+
const [recordId, fieldId] = cell;
|
|
5874
|
+
let matchedCellsMap = {};
|
|
5875
|
+
aiTable.matchedCells().forEach((key) => {
|
|
5876
|
+
matchedCellsMap[key] = true;
|
|
5877
|
+
});
|
|
5878
|
+
const isMatchedCell = matchedCellsMap[`${recordId}:${fieldId}`];
|
|
5879
|
+
return isMatchedCell;
|
|
5880
|
+
};
|
|
5881
|
+
const isSelectedCell = (cell, aiTable) => {
|
|
5882
|
+
const [recordId, fieldId] = cell;
|
|
5883
|
+
const selectedCells = aiTable.selection().selectedCells;
|
|
5884
|
+
const isSelectedCell = selectedCells.has(`${recordId}:${fieldId}`);
|
|
5885
|
+
return isSelectedCell;
|
|
5886
|
+
};
|
|
5887
|
+
const isSelectedField = (fieldId, aiTable) => {
|
|
5888
|
+
const selectedFields = aiTable.selection().selectedFields;
|
|
5889
|
+
return selectedFields.has(fieldId);
|
|
5890
|
+
};
|
|
5891
|
+
const isSelectedRecord = (recordId, aiTable) => {
|
|
5892
|
+
const selectedRecords = aiTable.selection().selectedRecords;
|
|
5893
|
+
return selectedRecords.has(recordId);
|
|
5894
|
+
};
|
|
5895
|
+
const isHoverRecord = (isHover, targetName) => {
|
|
5896
|
+
return isHover && targetName !== AI_TABLE_FIELD_HEAD;
|
|
5897
|
+
};
|
|
5475
5898
|
|
|
5476
5899
|
class AITableCells {
|
|
5477
5900
|
constructor() {
|
|
@@ -6183,8 +6606,11 @@ const createActiveCellBorder = (config) => {
|
|
|
6183
6606
|
const totalColumnCount = visibleColumns.length;
|
|
6184
6607
|
let activeCellBorder = null;
|
|
6185
6608
|
let frozenActiveCellBorder = null;
|
|
6186
|
-
if (activeCell
|
|
6187
|
-
|
|
6609
|
+
if (Array.isArray(activeCell) &&
|
|
6610
|
+
!!activeCell.length &&
|
|
6611
|
+
aiTable.context.visibleRowsIndexMap().has(activeCell[0]) &&
|
|
6612
|
+
aiTable.context.visibleColumnsMap().has(activeCell[1])) {
|
|
6613
|
+
const fieldId = activeCell[1];
|
|
6188
6614
|
const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, activeCell);
|
|
6189
6615
|
const checkIsVisible = (rowIndex, columnIndex) => {
|
|
6190
6616
|
if (columnIndex < frozenColumnCount) {
|
|
@@ -6243,6 +6669,7 @@ class AITableRenderer {
|
|
|
6243
6669
|
this.config = input.required();
|
|
6244
6670
|
this.koMousemove = output();
|
|
6245
6671
|
this.koMousedown = output();
|
|
6672
|
+
this.koMouseup = output();
|
|
6246
6673
|
this.koContextmenu = output();
|
|
6247
6674
|
this.koWheel = output();
|
|
6248
6675
|
this.koClick = output();
|
|
@@ -6377,6 +6804,9 @@ class AITableRenderer {
|
|
|
6377
6804
|
stageMousedown(e) {
|
|
6378
6805
|
this.koMousedown.emit(e);
|
|
6379
6806
|
}
|
|
6807
|
+
stageMouseup(e) {
|
|
6808
|
+
this.koMouseup.emit(e);
|
|
6809
|
+
}
|
|
6380
6810
|
stageContextmenu(e) {
|
|
6381
6811
|
this.koContextmenu.emit(e);
|
|
6382
6812
|
}
|
|
@@ -6387,7 +6817,7 @@ class AITableRenderer {
|
|
|
6387
6817
|
this.koDblclick.emit(e);
|
|
6388
6818
|
}
|
|
6389
6819
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6390
|
-
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", koContextmenu: "koContextmenu", koWheel: "koWheel", koClick: "koClick", koDblclick: "koDblclick" }, ngImport: i0, template: "<ko-stage\n [config]=\"stageConfig()\"\n (koMousemove)=\"stageMousemove($event)\"\n (koMousedown)=\"stageMousedown($event)\"\n (koContextmenu)=\"stageContextmenu($event)\"\n (koClick)=\"stageClick($event)\"\n (koDblclick)=\"stageDblclick($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 </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 </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: 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 }); }
|
|
6820
|
+
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" }, 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>\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 </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 </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: 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 }); }
|
|
6391
6821
|
}
|
|
6392
6822
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, decorators: [{
|
|
6393
6823
|
type: Component,
|
|
@@ -6404,13 +6834,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
6404
6834
|
AITableAddField,
|
|
6405
6835
|
AITableHoverRowHeads,
|
|
6406
6836
|
AITableOtherRows
|
|
6407
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<ko-stage\n [config]=\"stageConfig()\"\n (koMousemove)=\"stageMousemove($event)\"\n (koMousedown)=\"stageMousedown($event)\"\n (koContextmenu)=\"stageContextmenu($event)\"\n (koClick)=\"stageClick($event)\"\n (koDblclick)=\"stageDblclick($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 </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 </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n" }]
|
|
6837
|
+
], 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>\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 </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 </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n" }]
|
|
6408
6838
|
}] });
|
|
6409
6839
|
|
|
6410
6840
|
class AITableGrid extends AITableGridBase {
|
|
6411
6841
|
constructor() {
|
|
6412
6842
|
super();
|
|
6413
6843
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
6844
|
+
this.isSelecting = false;
|
|
6845
|
+
this.selectionStart = null;
|
|
6414
6846
|
this.fieldHeadHeight = AI_TABLE_FIELD_HEAD_HEIGHT;
|
|
6415
6847
|
this.containerRect = signal({ width: 0, height: 0 });
|
|
6416
6848
|
this.hasContainerRect = computed(() => {
|
|
@@ -6550,6 +6982,16 @@ class AITableGrid extends AITableGridBase {
|
|
|
6550
6982
|
handleMouseStyle(curMousePosition.realTargetName, curMousePosition.areaType, this.containerElement());
|
|
6551
6983
|
context.setPointPosition(curMousePosition);
|
|
6552
6984
|
this.timer = null;
|
|
6985
|
+
if (this.isSelecting) {
|
|
6986
|
+
const { fieldId, recordId } = getDetailByTargetName(curMousePosition.realTargetName);
|
|
6987
|
+
if (fieldId && recordId) {
|
|
6988
|
+
const startCell = this.selectionStart;
|
|
6989
|
+
const endCell = [recordId, fieldId];
|
|
6990
|
+
if (startCell && !!startCell.length) {
|
|
6991
|
+
this.aiTableGridSelectionService.selectCells(startCell, endCell);
|
|
6992
|
+
}
|
|
6993
|
+
}
|
|
6994
|
+
}
|
|
6553
6995
|
});
|
|
6554
6996
|
}
|
|
6555
6997
|
stageMousedown(e) {
|
|
@@ -6559,7 +7001,7 @@ class AITableGrid extends AITableGridBase {
|
|
|
6559
7001
|
if (mouseEvent.button === AITableMouseDownType.Right &&
|
|
6560
7002
|
recordId &&
|
|
6561
7003
|
fieldId &&
|
|
6562
|
-
this.aiTable.selection().selectedRecords.has(recordId)) {
|
|
7004
|
+
(this.aiTable.selection().selectedRecords.has(recordId) || this.aiTable.selection().selectedCells.has(`${recordId}:${fieldId}`))) {
|
|
6563
7005
|
return;
|
|
6564
7006
|
}
|
|
6565
7007
|
switch (targetName) {
|
|
@@ -6573,7 +7015,9 @@ class AITableGrid extends AITableGridBase {
|
|
|
6573
7015
|
if (!recordId || !fieldId)
|
|
6574
7016
|
return;
|
|
6575
7017
|
this.aiTableGridEventService.closeCellEditor();
|
|
6576
|
-
|
|
7018
|
+
const selectionStart = [recordId, fieldId];
|
|
7019
|
+
this.dragSelectionState(true, selectionStart);
|
|
7020
|
+
this.aiTableGridSelectionService.selectCells(selectionStart);
|
|
6577
7021
|
return;
|
|
6578
7022
|
case AI_TABLE_ROW_ADD_BUTTON:
|
|
6579
7023
|
case AI_TABLE_FIELD_ADD_BUTTON:
|
|
@@ -6584,6 +7028,9 @@ class AITableGrid extends AITableGridBase {
|
|
|
6584
7028
|
this.aiTableGridSelectionService.clearSelection();
|
|
6585
7029
|
}
|
|
6586
7030
|
}
|
|
7031
|
+
stageMouseup(e) {
|
|
7032
|
+
this.dragSelectionState(false, null);
|
|
7033
|
+
}
|
|
6587
7034
|
stageContextmenu(e) {
|
|
6588
7035
|
const mouseEvent = e.event.evt;
|
|
6589
7036
|
mouseEvent.preventDefault();
|
|
@@ -6725,11 +7172,17 @@ class AITableGrid extends AITableGridBase {
|
|
|
6725
7172
|
fromEvent(document, 'mousedown', { passive: true })
|
|
6726
7173
|
.pipe(filter((e) => e.target instanceof Element &&
|
|
6727
7174
|
!this.containerElement().contains(e.target) &&
|
|
6728
|
-
!(e.target.closest(AI_TABLE_PROHIBIT_CLEAR_SELECTION_CLASS) &&
|
|
7175
|
+
!(e.target.closest(AI_TABLE_PROHIBIT_CLEAR_SELECTION_CLASS) &&
|
|
7176
|
+
AITable.getSelectedRecordIds(this.aiTable).length > 0)), takeUntilDestroyed(this.destroyRef))
|
|
6729
7177
|
.subscribe(() => {
|
|
7178
|
+
this.dragSelectionState(false, null);
|
|
6730
7179
|
this.aiTableGridSelectionService.clearSelection();
|
|
6731
7180
|
});
|
|
6732
7181
|
}
|
|
7182
|
+
dragSelectionState(isSelecting, selectionStart) {
|
|
7183
|
+
this.isSelecting = isSelecting;
|
|
7184
|
+
this.selectionStart = selectionStart;
|
|
7185
|
+
}
|
|
6733
7186
|
verticalScroll(e) {
|
|
6734
7187
|
const { scrollTop } = e.target;
|
|
6735
7188
|
this.aiTable.context.setScrollState({
|
|
@@ -6801,18 +7254,18 @@ class AITableGrid extends AITableGridBase {
|
|
|
6801
7254
|
}
|
|
6802
7255
|
}
|
|
6803
7256
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
6804
|
-
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, AITableGridMatchCellService], 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 (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", "koContextmenu", "koWheel", "koClick", "koDblclick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
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, AITableGridMatchCellService], 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 }); }
|
|
6805
7258
|
}
|
|
6806
7259
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGrid, decorators: [{
|
|
6807
7260
|
type: Component,
|
|
6808
7261
|
args: [{ selector: 'ai-table-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
6809
7262
|
class: 'ai-table-grid'
|
|
6810
|
-
}, imports: [AITableRenderer], providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService, AITableGridMatchCellService], 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 (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" }]
|
|
7263
|
+
}, imports: [AITableRenderer], providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService, AITableGridMatchCellService], 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" }]
|
|
6811
7264
|
}], ctorParameters: () => [] });
|
|
6812
7265
|
|
|
6813
7266
|
/**
|
|
6814
7267
|
* Generated bundle index. Do not edit.
|
|
6815
7268
|
*/
|
|
6816
7269
|
|
|
6817
|
-
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsMultiplePipe, AITableFieldPropertyEditor, AITableFieldType, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridMatchCellService, 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_PROGRESS_BAR_HEIGHT, AI_TABLE_PROGRESS_BAR_RADIUS, AI_TABLE_PROGRESS_TEXT_Width, AI_TABLE_PROHIBIT_CLEAR_SELECTION_CLASS, 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, createAITable, createActiveCellBorder, createCells, createDefaultField, createDefaultFieldName, generateTargetName, getAvatarBgColor, getAvatarShortName, getCellEditorBorderSpace, getCellHorizontalPosition, getColumnIndicesMap, getDefaultFieldValue, getDetailByTargetName, getEditorBoxOffset, getEditorSpace, getFieldOptionByField, getHoverEditorBoxOffset, getHoverEditorSpace, getMousePosition, getPlaceHolderCellsConfigs, getTargetName, getTextWidth, getVisibleRangeInfo, handleMouseStyle, idCreator, idsCreator, imageCache, isArrayField, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, textDataCache, transformCellValue };
|
|
7270
|
+
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsMultiplePipe, AITableFieldPropertyEditor, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridMatchCellService, 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_PROGRESS_BAR_HEIGHT, AI_TABLE_PROGRESS_BAR_RADIUS, AI_TABLE_PROGRESS_TEXT_Width, AI_TABLE_PROHIBIT_CLEAR_SELECTION_CLASS, 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, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, stringInclude, textDataCache, transformCellValue, zhIntlCollator };
|
|
6818
7271
|
//# sourceMappingURL=ai-table-grid.mjs.map
|