@ai-table/grid 0.1.43 → 0.1.44
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/cell-editors/date/date-editor.component.d.ts +1 -1
- package/components/cell-editors/date/date-editor.component.d.ts.map +1 -1
- package/fesm2022/ai-table-grid.mjs +48 -25
- package/fesm2022/ai-table-grid.mjs.map +1 -1
- package/grid.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/renderer/components/cover-cell.component.d.ts.map +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/creations/create-groups.d.ts.map +1 -1
- package/renderer/drawers/cell-drawer.d.ts.map +1 -1
- package/renderer/drawers/group-layout.d.ts.map +1 -1
- package/services/event.service.d.ts.map +1 -1
- package/types/cell.d.ts +1 -0
- package/types/cell.d.ts.map +1 -1
- package/utils/cell.d.ts +5 -0
- package/utils/cell.d.ts.map +1 -1
- package/utils/get-placeholder-cells.d.ts.map +1 -1
@@ -4,7 +4,7 @@ import * as i0 from "@angular/core";
|
|
4
4
|
export declare class DateCellEditorComponent extends AbstractEditCellEditor<DateFieldValue> {
|
5
5
|
placeholder: string;
|
6
6
|
ngOnInit(): void;
|
7
|
-
updateValue(
|
7
|
+
updateValue(timestamp: number): void;
|
8
8
|
thyOpenChange(isOpen: Boolean): void;
|
9
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<DateCellEditorComponent, never>;
|
10
10
|
static ɵcmp: i0.ɵɵComponentDeclaration<DateCellEditorComponent, "date-cell-editor", never, {}, {}, never, never, true, never>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"date-editor.component.d.ts","sourceRoot":"","sources":["../../../../../packages/grid/src/components/cell-editors/date/date-editor.component.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAI3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;;AAEjD,qBAyBa,uBAAwB,SAAQ,sBAAsB,CAAC,cAAc,CAAC;IAC/E,WAAW,SAAM;IAER,QAAQ,IAAI,IAAI;IAazB,WAAW,CAAC,
|
1
|
+
{"version":3,"file":"date-editor.component.d.ts","sourceRoot":"","sources":["../../../../../packages/grid/src/components/cell-editors/date/date-editor.component.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAI3E,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;;AAEjD,qBAyBa,uBAAwB,SAAQ,sBAAsB,CAAC,cAAc,CAAC;IAC/E,WAAW,SAAM;IAER,QAAQ,IAAI,IAAI;IAazB,WAAW,CAAC,SAAS,EAAE,MAAM;IAW7B,aAAa,CAAC,MAAM,EAAE,OAAO;yCA3BpB,uBAAuB;2CAAvB,uBAAuB;CAgCnC"}
|
@@ -1731,10 +1731,11 @@ class DateCellEditorComponent extends AbstractEditCellEditor {
|
|
1731
1731
|
})();
|
1732
1732
|
this.placeholder = getI18nTextByKey(this.aiTable, AITableGridI18nKey.dataPickerPlaceholder);
|
1733
1733
|
}
|
1734
|
-
updateValue(
|
1734
|
+
updateValue(timestamp) {
|
1735
|
+
const value = timestamp ? { timestamp: timestamp } : null;
|
1735
1736
|
this.updateFieldValues.emit([
|
1736
1737
|
{
|
1737
|
-
value
|
1738
|
+
value,
|
1738
1739
|
path: [this.record()._id, this.field()._id]
|
1739
1740
|
}
|
1740
1741
|
]);
|
@@ -2018,16 +2019,19 @@ function getColumnIndicesSizeMap(aiTable, fields) {
|
|
2018
2019
|
*/
|
2019
2020
|
function getCellHorizontalPosition(options) {
|
2020
2021
|
let { columnWidth, columnIndex, columnCount, depth = 0 } = options;
|
2022
|
+
const isGroupAndFirstColumn = depth > 0 && columnIndex === 0;
|
2023
|
+
columnWidth = isGroupAndFirstColumn ? columnWidth - AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE : columnWidth;
|
2021
2024
|
depth += 1;
|
2022
2025
|
if (!depth)
|
2023
2026
|
return { width: columnWidth, offset: 0 };
|
2024
2027
|
const firstIndent = columnIndex === 0 && depth;
|
2025
2028
|
const lastIndent = columnIndex === columnCount - 1 && depth === 3;
|
2026
|
-
|
2029
|
+
let offset = firstIndent ? (depth - 1) * AI_TABLE_ROW_GROUP_OFFSET + 0.5 : 0;
|
2027
2030
|
const width = lastIndent && !firstIndent ? columnWidth - AI_TABLE_ROW_GROUP_OFFSET : columnWidth - offset;
|
2028
2031
|
return {
|
2029
2032
|
width,
|
2030
|
-
offset
|
2033
|
+
offset,
|
2034
|
+
isGroupAndFirstColumn
|
2031
2035
|
};
|
2032
2036
|
}
|
2033
2037
|
function transformToCellText(cellValue, options) {
|
@@ -2282,12 +2286,15 @@ function getPlaceHolderCellsConfigs(options) {
|
|
2282
2286
|
}
|
2283
2287
|
// 当前行的 Y 轴偏移量,并根据列宽和列索引获取单元格的水平位置(宽度和偏移量)
|
2284
2288
|
const y = coordinate.getRowOffset(rowIndex) + AI_TABLE_OFFSET * 2;
|
2285
|
-
|
2289
|
+
let { width, offset, isGroupAndFirstColumn } = getCellHorizontalPosition({
|
2286
2290
|
columnWidth,
|
2287
2291
|
columnIndex,
|
2288
2292
|
columnCount,
|
2289
2293
|
depth
|
2290
2294
|
});
|
2295
|
+
if (isGroupAndFirstColumn) {
|
2296
|
+
offset += AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
|
2297
|
+
}
|
2291
2298
|
const height = rowHeight - AI_TABLE_OFFSET * 4;
|
2292
2299
|
configs.unshift({
|
2293
2300
|
key: `placeholder-cell-${fieldId}-${recordId}`,
|
@@ -5457,11 +5464,17 @@ const createActiveCellBorder = (config) => {
|
|
5457
5464
|
const y = coordinate.getRowOffset(rowIndex);
|
5458
5465
|
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
5459
5466
|
const isFrozenColumn = columnIndex < frozenColumnCount;
|
5460
|
-
const
|
5467
|
+
const row = aiTable.context?.linearRows()[rowIndex];
|
5468
|
+
const depth = row?.depth ?? 0;
|
5469
|
+
let { offset, width, isGroupAndFirstColumn } = getCellHorizontalPosition({
|
5461
5470
|
columnWidth,
|
5462
5471
|
columnIndex,
|
5463
|
-
columnCount: totalColumnCount
|
5472
|
+
columnCount: totalColumnCount,
|
5473
|
+
depth
|
5464
5474
|
});
|
5475
|
+
if (isGroupAndFirstColumn) {
|
5476
|
+
offset += AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
|
5477
|
+
}
|
5465
5478
|
const currentConfig = {
|
5466
5479
|
x: x + offset + AI_TABLE_OFFSET,
|
5467
5480
|
y: y + AI_TABLE_OFFSET,
|
@@ -6202,13 +6215,13 @@ class CellDrawer extends Drawer {
|
|
6202
6215
|
}
|
6203
6216
|
}
|
6204
6217
|
renderCellCheckbox(render, ctx) {
|
6205
|
-
const { x, y, field, columnWidth, transformValue, isCoverCell } = render;
|
6218
|
+
const { x, y, field, columnWidth, transformValue, isCoverCell, isGroupFirstRender } = render;
|
6206
6219
|
if (isCoverCell) {
|
6207
6220
|
return;
|
6208
6221
|
}
|
6209
6222
|
const isChecked = !isEmpty(transformValue) && !!transformValue;
|
6210
6223
|
const checkboxSize = AI_TABLE_ICON_COMMON_SIZE;
|
6211
|
-
const checkboxX = x + (columnWidth - checkboxSize) / 2;
|
6224
|
+
const checkboxX = isGroupFirstRender ? x + AI_TABLE_CELL_PADDING : x + (columnWidth - checkboxSize) / 2;
|
6212
6225
|
const checkboxY = y + (AI_TABLE_ROW_BLANK_HEIGHT - checkboxSize) / 2;
|
6213
6226
|
this.path({
|
6214
6227
|
x: checkboxX,
|
@@ -6219,7 +6232,7 @@ class CellDrawer extends Drawer {
|
|
6219
6232
|
});
|
6220
6233
|
}
|
6221
6234
|
renderCellText(render, ctx) {
|
6222
|
-
const { x, y, transformValue, field, columnWidth, style } = render;
|
6235
|
+
const { x, y, transformValue, field, columnWidth, style, isGroupFirstRender } = render;
|
6223
6236
|
if (isUndefinedOrNull(transformValue)) {
|
6224
6237
|
return;
|
6225
6238
|
}
|
@@ -6273,7 +6286,7 @@ class CellDrawer extends Drawer {
|
|
6273
6286
|
lineHeight: DEFAULT_TEXT_LINE_HEIGHT,
|
6274
6287
|
textAlign,
|
6275
6288
|
verticalAlign: DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE,
|
6276
|
-
fillStyle: fieldType === AITableFieldType.link ? Colors.primary : color,
|
6289
|
+
fillStyle: fieldType === AITableFieldType.link && !isGroupFirstRender ? Colors.primary : color,
|
6277
6290
|
fontWeight,
|
6278
6291
|
textDecoration,
|
6279
6292
|
fieldType,
|
@@ -6995,12 +7008,13 @@ class GroupLayout extends Layout {
|
|
6995
7008
|
});
|
6996
7009
|
}
|
6997
7010
|
const iconContainerWidth = AI_TABLE_ICON_COMMON_SIZE + AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
|
6998
|
-
if (!isEmpty(groupValue)) {
|
7011
|
+
if (!isEmpty(groupValue) || field.type === AITableFieldType.checkbox) {
|
6999
7012
|
cellDrawer.initStyle(field, style);
|
7000
7013
|
cellDrawer.renderCell({
|
7001
7014
|
...render,
|
7002
7015
|
x: render.x + iconContainerWidth,
|
7003
|
-
columnWidth: render.columnWidth - iconContainerWidth
|
7016
|
+
columnWidth: render.columnWidth - iconContainerWidth,
|
7017
|
+
isGroupFirstRender: true
|
7004
7018
|
}, this.ctx, columnWidth);
|
7005
7019
|
}
|
7006
7020
|
else {
|
@@ -7141,10 +7155,9 @@ const createCells = (config) => {
|
|
7141
7155
|
isHoverRow: isHoverRecord(isHover, targetName),
|
7142
7156
|
isCheckedRow: isSelectedRecord(recordId, aiTable)
|
7143
7157
|
});
|
7144
|
-
const
|
7145
|
-
const { width, offset } = getCellHorizontalPosition({
|
7158
|
+
const { width, offset, isGroupAndFirstColumn } = getCellHorizontalPosition({
|
7146
7159
|
columnIndex,
|
7147
|
-
columnWidth
|
7160
|
+
columnWidth,
|
7148
7161
|
columnCount,
|
7149
7162
|
depth
|
7150
7163
|
});
|
@@ -7213,12 +7226,15 @@ const createCells = (config) => {
|
|
7213
7226
|
frozenColumnCount,
|
7214
7227
|
xIsScroll
|
7215
7228
|
});
|
7216
|
-
|
7229
|
+
let { width, offset, isGroupAndFirstColumn } = getCellHorizontalPosition({
|
7217
7230
|
columnIndex,
|
7218
7231
|
columnWidth,
|
7219
7232
|
columnCount,
|
7220
7233
|
depth
|
7221
7234
|
});
|
7235
|
+
if (isGroupAndFirstColumn) {
|
7236
|
+
width += AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
|
7237
|
+
}
|
7222
7238
|
const realX = x + offset + AI_TABLE_OFFSET;
|
7223
7239
|
const realY = y + AI_TABLE_OFFSET;
|
7224
7240
|
const style = { fontWeight: DEFAULT_FONT_STYLE };
|
@@ -8969,10 +8985,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
8969
8985
|
const createGroupCells = (config) => {
|
8970
8986
|
const { coordinate, rowStartIndex, rowStopIndex, columnStartIndex, columnStopIndex, aiTable, actions, readonly } = config;
|
8971
8987
|
const linearRows = aiTable.context?.linearRows();
|
8972
|
-
const { columnCount } = coordinate;
|
8988
|
+
const { rowCount, columnCount } = coordinate;
|
8973
8989
|
const groups = [];
|
8974
8990
|
for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
|
8975
|
-
if (rowIndex >
|
8991
|
+
if (rowIndex > rowCount - 1)
|
8976
8992
|
break;
|
8977
8993
|
if (rowIndex < 0)
|
8978
8994
|
continue;
|
@@ -9745,10 +9761,9 @@ class AITableCoverCellEntry {
|
|
9745
9761
|
const x = coordinate.getColumnOffset(columnIndex) + AI_TABLE_OFFSET;
|
9746
9762
|
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
9747
9763
|
const y = coordinate.getRowOffset(rowIndex) + AI_TABLE_OFFSET;
|
9748
|
-
const
|
9749
|
-
const { width, offset } = getCellHorizontalPosition({
|
9764
|
+
const { width, offset, isGroupAndFirstColumn } = getCellHorizontalPosition({
|
9750
9765
|
columnIndex,
|
9751
|
-
columnWidth
|
9766
|
+
columnWidth,
|
9752
9767
|
columnCount,
|
9753
9768
|
depth
|
9754
9769
|
});
|
@@ -11889,11 +11904,18 @@ class AITableGridEventService {
|
|
11889
11904
|
const originX = coordinate.getColumnOffset(columnIndex);
|
11890
11905
|
const originY = coordinate.getRowOffset(rowIndex);
|
11891
11906
|
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
11892
|
-
const
|
11907
|
+
const row = aiTable.context?.linearRows()[rowIndex];
|
11908
|
+
const depth = row?.depth ?? 0;
|
11909
|
+
const isGroupAndFirstColumn = depth > 0 && columnIndex === 0;
|
11910
|
+
let { width: originWidth, offset: originOffset } = getCellHorizontalPosition({
|
11893
11911
|
columnWidth,
|
11894
11912
|
columnIndex,
|
11895
|
-
columnCount
|
11913
|
+
columnCount,
|
11914
|
+
depth
|
11896
11915
|
});
|
11916
|
+
if (isGroupAndFirstColumn) {
|
11917
|
+
originOffset += AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
|
11918
|
+
}
|
11897
11919
|
const originRect = container.getBoundingClientRect();
|
11898
11920
|
const isFrozenColumn = AITable.isFrozenColumn(aiTable, columnIndex);
|
11899
11921
|
const scrollLeft = isFrozenColumn ? 0 : scrollState().scrollLeft;
|
@@ -12996,8 +13018,9 @@ class AITableGrid extends AITableGridBase {
|
|
12996
13018
|
const scrollTop = this.aiTable.context.scrollState().scrollTop;
|
12997
13019
|
const rowIndices = this.toolTipRowIndices();
|
12998
13020
|
return rowIndices.map((rowIndex) => {
|
13021
|
+
const offset = this.coordinate().getRowOffset(rowIndex);
|
12999
13022
|
return {
|
13000
|
-
top:
|
13023
|
+
top: offset - scrollTop - AI_TABLE_FIELD_HEAD_HEIGHT,
|
13001
13024
|
left: 0
|
13002
13025
|
};
|
13003
13026
|
});
|