@ai-table/grid 0.0.35 → 0.0.36
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/esm2022/components/cell-editors/link/link-editor.component.mjs +3 -3
- package/esm2022/renderer/components/cells/cells.mjs +6 -0
- package/esm2022/renderer/components/cells/index.mjs +2 -0
- package/esm2022/renderer/components/cells/link.component.mjs +90 -0
- package/esm2022/renderer/components/field-head.component.mjs +2 -2
- package/esm2022/renderer/components/hover-cell.component.mjs +103 -0
- package/esm2022/renderer/components/index.mjs +2 -1
- package/esm2022/renderer/components/text.component.mjs +13 -4
- package/esm2022/renderer/creations/create-cells.mjs +9 -3
- package/esm2022/renderer/drawers/cell-drawer.mjs +22 -6
- package/esm2022/renderer/interfaces/hover-cell.mjs +4 -0
- package/esm2022/renderer/interfaces/index.mjs +2 -0
- package/esm2022/renderer/renderer.component.mjs +8 -4
- package/esm2022/types/cell.mjs +1 -1
- package/esm2022/types/component-config.mjs +1 -1
- package/esm2022/utils/get-placeholder-cells.mjs +5 -5
- package/esm2022/utils/hover-cell.mjs +31 -0
- package/esm2022/utils/index.mjs +2 -1
- package/fesm2022/ai-table-grid.mjs +1187 -942
- package/fesm2022/ai-table-grid.mjs.map +1 -1
- package/package.json +1 -1
- package/renderer/components/cells/cells.d.ts +5 -0
- package/renderer/components/cells/cells.d.ts.map +1 -0
- package/renderer/components/cells/index.d.ts +2 -0
- package/renderer/components/cells/index.d.ts.map +1 -0
- package/renderer/components/cells/link.component.d.ts +23 -0
- package/renderer/components/cells/link.component.d.ts.map +1 -0
- package/renderer/components/hover-cell.component.d.ts +23 -0
- package/renderer/components/hover-cell.component.d.ts.map +1 -0
- package/renderer/components/index.d.ts +1 -0
- package/renderer/components/index.d.ts.map +1 -1
- package/renderer/components/text.component.d.ts +6 -1
- package/renderer/components/text.component.d.ts.map +1 -1
- package/renderer/creations/create-cells.d.ts +2 -0
- package/renderer/creations/create-cells.d.ts.map +1 -1
- package/renderer/drawers/cell-drawer.d.ts.map +1 -1
- package/renderer/interfaces/hover-cell.d.ts +8 -0
- package/renderer/interfaces/hover-cell.d.ts.map +1 -0
- package/renderer/interfaces/index.d.ts +2 -0
- package/renderer/interfaces/index.d.ts.map +1 -0
- package/renderer/renderer.component.d.ts.map +1 -1
- package/types/cell.d.ts +1 -0
- package/types/cell.d.ts.map +1 -1
- package/types/component-config.d.ts +10 -0
- package/types/component-config.d.ts.map +1 -1
- package/utils/hover-cell.d.ts +8 -0
- package/utils/hover-cell.d.ts.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.d.ts.map +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { signal, computed, output, inject, ElementRef, Component, ChangeDetectionStrategy, Input, EventEmitter, Output, ChangeDetectorRef, ViewChild, HostListener, Pipe, input, Renderer2, model, booleanAttribute, Injectable,
|
2
|
+
import { signal, computed, output, inject, ElementRef, Component, ChangeDetectionStrategy, Input, EventEmitter, Output, ChangeDetectorRef, ViewChild, HostListener, Pipe, input, Renderer2, model, booleanAttribute, Injectable, InjectionToken, effect, DestroyRef, NgZone, ViewContainerRef, viewChild, afterNextRender, untracked } from '@angular/core';
|
3
3
|
import * as i1$1 from 'ngx-tethys/popover';
|
4
4
|
import { ThyPopoverRef, ThyPopover, ThyPopoverModule } from 'ngx-tethys/popover';
|
5
5
|
import ObjectID from 'bson-objectid';
|
@@ -47,6 +47,7 @@ import { fromUnixTime, subDays } from 'date-fns';
|
|
47
47
|
import Konva from 'konva';
|
48
48
|
import { Shape } from 'konva/lib/Shape';
|
49
49
|
import { Sprite } from 'konva/lib/shapes/Sprite';
|
50
|
+
import GraphemeSplitter from 'grapheme-splitter';
|
50
51
|
import { Stage } from 'konva/lib/Stage';
|
51
52
|
import { FastLayer } from 'konva/lib/FastLayer';
|
52
53
|
import { Group } from 'konva/lib/Group';
|
@@ -67,7 +68,6 @@ import { Text } from 'konva/lib/shapes/Text';
|
|
67
68
|
import { TextPath } from 'konva/lib/shapes/TextPath';
|
68
69
|
import { Transformer } from 'konva/lib/shapes/Transformer';
|
69
70
|
import { Wedge } from 'konva/lib/shapes/Wedge';
|
70
|
-
import GraphemeSplitter from 'grapheme-splitter';
|
71
71
|
|
72
72
|
const Colors = {
|
73
73
|
primary: '#6698FF',
|
@@ -1056,8 +1056,8 @@ class LinkCellEditorComponent extends AbstractEditCellEditor {
|
|
1056
1056
|
ngOnInit() {
|
1057
1057
|
super.ngOnInit();
|
1058
1058
|
this.originValue = this.modelValue;
|
1059
|
-
this.text = this.modelValue
|
1060
|
-
this.url = this.modelValue
|
1059
|
+
this.text = this.modelValue?.text ?? '';
|
1060
|
+
this.url = this.modelValue?.url ?? '';
|
1061
1061
|
}
|
1062
1062
|
updateValue() {
|
1063
1063
|
if (!this.isValidLink({ text: this.text, url: this.url ?? '' })) {
|
@@ -2150,7 +2150,7 @@ function getPlaceHolderCellsConfigs(options) {
|
|
2150
2150
|
return [];
|
2151
2151
|
}
|
2152
2152
|
// 当前列的 X 轴偏移量和列宽度
|
2153
|
-
const x = coordinate.getColumnOffset(columnIndex) + AI_TABLE_OFFSET;
|
2153
|
+
const x = coordinate.getColumnOffset(columnIndex) + AI_TABLE_OFFSET * 2;
|
2154
2154
|
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
2155
2155
|
for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
|
2156
2156
|
// 当前行索引是否超出总行数范围,超出则退出循环
|
@@ -2163,13 +2163,13 @@ function getPlaceHolderCellsConfigs(options) {
|
|
2163
2163
|
continue;
|
2164
2164
|
}
|
2165
2165
|
// 当前行的 Y 轴偏移量,并根据列宽和列索引获取单元格的水平位置(宽度和偏移量)
|
2166
|
-
const y = coordinate.getRowOffset(rowIndex) + AI_TABLE_OFFSET;
|
2166
|
+
const y = coordinate.getRowOffset(rowIndex) + AI_TABLE_OFFSET * 2;
|
2167
2167
|
const { width, offset } = getCellHorizontalPosition({
|
2168
2168
|
columnWidth,
|
2169
2169
|
columnIndex,
|
2170
2170
|
columnCount
|
2171
2171
|
});
|
2172
|
-
const height = rowHeight;
|
2172
|
+
const height = rowHeight - AI_TABLE_OFFSET * 4;
|
2173
2173
|
configs.unshift({
|
2174
2174
|
key: `placeholder-cell-${fieldId}-${recordId}`,
|
2175
2175
|
name: generateTargetName({
|
@@ -2179,7 +2179,7 @@ function getPlaceHolderCellsConfigs(options) {
|
|
2179
2179
|
}),
|
2180
2180
|
x: x + offset,
|
2181
2181
|
y,
|
2182
|
-
width,
|
2182
|
+
width: width - AI_TABLE_OFFSET * 4,
|
2183
2183
|
height,
|
2184
2184
|
fill: Colors.transparent,
|
2185
2185
|
strokeEnabled: false,
|
@@ -2922,613 +2922,190 @@ const isCellMatchKeywords = (aiTable, field, recordId, keywords, references) =>
|
|
2922
2922
|
return keywords && cellFullText.length && cellFullText.some((text) => text.toLowerCase().includes(keywords.toLowerCase()));
|
2923
2923
|
};
|
2924
2924
|
|
2925
|
-
|
2926
|
-
|
2927
|
-
|
2928
|
-
|
2929
|
-
this.mouseoverEvent$ = new Subject();
|
2930
|
-
this.globalMouseoverEvent$ = new Subject();
|
2931
|
-
this.globalMousedownEvent$ = new Subject();
|
2932
|
-
this.destroyRef = inject(DestroyRef);
|
2933
|
-
this.thyPopover = inject(ThyPopover);
|
2934
|
-
}
|
2935
|
-
initialize(aiTable, aiFieldRenderers) {
|
2936
|
-
this.aiTable = aiTable;
|
2937
|
-
this.aiFieldRenderers = aiFieldRenderers;
|
2925
|
+
function updatePicture(node) {
|
2926
|
+
const drawingNode = node.getLayer() || node.getStage();
|
2927
|
+
if (drawingNode) {
|
2928
|
+
drawingNode.batchDraw();
|
2938
2929
|
}
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
.pipe(debounceTime(80), takeUntilDestroyed(this.destroyRef))
|
2947
|
-
.subscribe((event) => {
|
2948
|
-
this.mouseoverEvent$.next(event);
|
2949
|
-
});
|
2950
|
-
fromEvent(document, 'mouseover', { passive: true })
|
2951
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
2952
|
-
.subscribe((event) => {
|
2953
|
-
this.globalMouseoverEvent$.next(event);
|
2954
|
-
});
|
2955
|
-
fromEvent(element, 'mousedown', { passive: true })
|
2956
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
2957
|
-
.subscribe((event) => {
|
2958
|
-
this.mousedownEvent$.next(event);
|
2959
|
-
});
|
2960
|
-
fromEvent(document, 'mousedown', { passive: true })
|
2961
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
2962
|
-
.subscribe((event) => {
|
2963
|
-
this.globalMousedownEvent$.next(event);
|
2964
|
-
});
|
2930
|
+
}
|
2931
|
+
|
2932
|
+
// adapted FROM: https://github.com/lavrton/react-konva/blob/master/src/react-konva-fiber.js
|
2933
|
+
function applyNodeProps(component, props = {}, oldProps = {}) {
|
2934
|
+
if ('id' in props) {
|
2935
|
+
const message = `You are using "id" attribute for Konva node. In some very rare cases it may produce bugs. Currently we recommend not to use it and use "name" attribute instead.`;
|
2936
|
+
console.warn(message);
|
2965
2937
|
}
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2938
|
+
const instance = component.getNode();
|
2939
|
+
const updatedProps = {};
|
2940
|
+
let hasUpdates = false;
|
2941
|
+
Object.keys(oldProps).forEach((key) => {
|
2942
|
+
const isEvent = key.slice(0, 2) === 'ko';
|
2943
|
+
const propChanged = oldProps[key] !== props[key];
|
2944
|
+
if (isEvent && propChanged) {
|
2945
|
+
let eventName = key.slice(2).toLowerCase();
|
2946
|
+
if (eventName.slice(0, 7) === 'content') {
|
2947
|
+
eventName = 'content' + eventName.slice(7, 8).toUpperCase() + eventName.slice(8);
|
2948
|
+
}
|
2949
|
+
instance.off(eventName, oldProps[key]);
|
2970
2950
|
}
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
const { x, y, width, height } = cellDom.getBoundingClientRect();
|
2975
|
-
const fieldId = cellDom.getAttribute('fieldId');
|
2976
|
-
const recordId = cellDom.getAttribute('recordId');
|
2977
|
-
const component = this.getEditorComponent(this.aiTable.fieldsMap()[fieldId].type);
|
2978
|
-
const ref = this.thyPopover.open(component, {
|
2979
|
-
origin: cellDom,
|
2980
|
-
originPosition: {
|
2981
|
-
x: x - 1,
|
2982
|
-
y: y + 1,
|
2983
|
-
width: width + 2,
|
2984
|
-
height: height + 2
|
2985
|
-
},
|
2986
|
-
width: width + 1 + 'px',
|
2987
|
-
height: height + 2 + 'px',
|
2988
|
-
placement: 'top',
|
2989
|
-
offset: -(height + 4),
|
2990
|
-
minWidth: width,
|
2991
|
-
initialState: {
|
2992
|
-
fieldId: fieldId,
|
2993
|
-
recordId: recordId,
|
2994
|
-
aiTable: this.aiTable
|
2995
|
-
},
|
2996
|
-
panelClass: 'grid-cell-editor',
|
2997
|
-
outsideClosable: false,
|
2998
|
-
hasBackdrop: false,
|
2999
|
-
manualClosure: true,
|
3000
|
-
animationDisabled: true,
|
3001
|
-
autoAdaptive: true
|
3002
|
-
});
|
3003
|
-
return ref;
|
3004
|
-
}
|
3005
|
-
getOriginPosition(aiTable, options) {
|
3006
|
-
const { container, coordinate, recordId, fieldId, isHoverEdit } = options;
|
3007
|
-
const { scrollState } = aiTable.context;
|
3008
|
-
const { rowHeight, columnCount } = coordinate;
|
3009
|
-
const cell = [recordId, fieldId];
|
3010
|
-
const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, cell);
|
3011
|
-
const originX = coordinate.getColumnOffset(columnIndex);
|
3012
|
-
const originY = coordinate.getRowOffset(rowIndex);
|
3013
|
-
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
3014
|
-
const { width: originWidth, offset: originOffset } = getCellHorizontalPosition({
|
3015
|
-
columnWidth,
|
3016
|
-
columnIndex,
|
3017
|
-
columnCount
|
3018
|
-
});
|
3019
|
-
const originRect = container.getBoundingClientRect();
|
3020
|
-
const isFrozenColumn = AITable.isFrozenColumn(aiTable, columnIndex);
|
3021
|
-
const scrollLeft = isFrozenColumn ? 0 : scrollState().scrollLeft;
|
3022
|
-
const scrollTop = scrollState().scrollTop;
|
3023
|
-
const originPosition = {
|
3024
|
-
x: originX + originOffset - scrollLeft + originRect.x,
|
3025
|
-
y: originY - scrollTop + originRect.y,
|
3026
|
-
width: originWidth,
|
3027
|
-
height: rowHeight
|
3028
|
-
};
|
3029
|
-
let x = originPosition.x + getEditorBoxOffset();
|
3030
|
-
let y = originPosition.y + getEditorBoxOffset();
|
3031
|
-
let width = getEditorSpace(originPosition.width);
|
3032
|
-
let height = getEditorSpace(originPosition.height);
|
3033
|
-
// hover 编辑组件无边框
|
3034
|
-
if (isHoverEdit) {
|
3035
|
-
x = originPosition.x + getHoverEditorBoxOffset();
|
3036
|
-
y = originPosition.y + getHoverEditorBoxOffset();
|
3037
|
-
width = getHoverEditorSpace(originPosition.width);
|
3038
|
-
height = getHoverEditorSpace(originPosition.height);
|
2951
|
+
const toRemove = !Object.hasOwn(props, key);
|
2952
|
+
if (toRemove) {
|
2953
|
+
instance.setAttr(key, undefined);
|
3039
2954
|
}
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
|
3045
|
-
|
3046
|
-
|
3047
|
-
|
3048
|
-
|
3049
|
-
|
3050
|
-
|
3051
|
-
|
3052
|
-
|
3053
|
-
|
3054
|
-
|
3055
|
-
|
3056
|
-
height: offsetOriginPosition.height + 'px',
|
3057
|
-
minWidth: offsetOriginPosition.width + 'px',
|
3058
|
-
placement: 'bottom',
|
3059
|
-
offset: -offsetOriginPosition.height,
|
3060
|
-
initialState: {
|
3061
|
-
fieldId: fieldId,
|
3062
|
-
recordId: recordId,
|
3063
|
-
references,
|
3064
|
-
aiTable: aiTable
|
3065
|
-
},
|
3066
|
-
panelClass: 'grid-cell-editor',
|
3067
|
-
outsideClosable: false,
|
3068
|
-
hasBackdrop: false,
|
3069
|
-
manualClosure: true,
|
3070
|
-
animationDisabled: true,
|
3071
|
-
autoAdaptive: true
|
3072
|
-
});
|
3073
|
-
if (this.cellEditorPopoverRef) {
|
3074
|
-
const wheelEvent = fromEvent(this.cellEditorPopoverRef.componentInstance.elementRef.nativeElement, 'wheel').subscribe((event) => {
|
3075
|
-
const field = aiTable.fieldsMap()[fieldId];
|
3076
|
-
if (field.type === AITableFieldType.text || field.type === AITableFieldType.richText) {
|
3077
|
-
return;
|
3078
|
-
}
|
3079
|
-
event.preventDefault();
|
3080
|
-
this.aiTable.context?.scrollAction({
|
3081
|
-
deltaX: event.deltaX,
|
3082
|
-
deltaY: event.deltaY,
|
3083
|
-
shiftKey: event.shiftKey,
|
3084
|
-
callback: () => {
|
3085
|
-
const originPosition = this.getOriginPosition(aiTable, options);
|
3086
|
-
const positionStrategy = this.cellEditorPopoverRef
|
3087
|
-
.getOverlayRef()
|
3088
|
-
.getConfig().positionStrategy;
|
3089
|
-
positionStrategy.setOrigin(originPosition);
|
3090
|
-
positionStrategy.apply();
|
3091
|
-
}
|
2955
|
+
});
|
2956
|
+
Object.keys(props).forEach((key) => {
|
2957
|
+
const isEvent = key.slice(0, 2) === 'ko';
|
2958
|
+
const toAdd = oldProps[key] !== props[key];
|
2959
|
+
if (isEvent && toAdd) {
|
2960
|
+
let eventName = key.slice(2).toLowerCase();
|
2961
|
+
if (eventName.slice(0, 7) === 'content') {
|
2962
|
+
eventName = 'content' + eventName.slice(7, 8).toUpperCase() + eventName.slice(8);
|
2963
|
+
}
|
2964
|
+
if (props[key]) {
|
2965
|
+
instance.off(eventName);
|
2966
|
+
instance.on(eventName, (event) => {
|
2967
|
+
props[key]({
|
2968
|
+
angularComponent: component,
|
2969
|
+
event
|
2970
|
+
});
|
3092
2971
|
});
|
3093
|
-
}
|
3094
|
-
this.cellEditorPopoverRef.afterClosed().subscribe(() => {
|
3095
|
-
wheelEvent.unsubscribe();
|
3096
|
-
this.cellEditorPopoverRef = null;
|
3097
|
-
});
|
3098
|
-
this.cellEditorPopoverRef.componentInstance.updateFieldValue.subscribe((value) => {
|
3099
|
-
options.updateFieldValue(value);
|
3100
|
-
});
|
2972
|
+
}
|
3101
2973
|
}
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
if (this.cellEditorPopoverRef) {
|
3106
|
-
this.cellEditorPopoverRef.close();
|
3107
|
-
this.cellEditorPopoverRef = null;
|
2974
|
+
if (!isEvent && (props[key] !== oldProps[key] || props[key] !== instance.getAttr(key))) {
|
2975
|
+
hasUpdates = true;
|
2976
|
+
updatedProps[key] = props[key];
|
3108
2977
|
}
|
3109
|
-
}
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
openContextMenu(aiTable, options) {
|
3125
|
-
const { origin, position, menuItems, targetName, viewContainerRef } = options;
|
3126
|
-
const ref = this.thyPopover.open(AITableContextMenu, {
|
3127
|
-
origin: origin,
|
3128
|
-
originPosition: position,
|
3129
|
-
placement: 'bottomLeft',
|
3130
|
-
insideClosable: true,
|
3131
|
-
viewContainerRef,
|
3132
|
-
initialState: {
|
3133
|
-
aiTable,
|
3134
|
-
menuItems,
|
3135
|
-
targetName,
|
3136
|
-
position
|
2978
|
+
});
|
2979
|
+
if (hasUpdates) {
|
2980
|
+
instance.setAttrs(updatedProps);
|
2981
|
+
updatePicture(instance);
|
2982
|
+
let val;
|
2983
|
+
Object.keys(updatedProps).forEach((prop) => {
|
2984
|
+
val = updatedProps[prop];
|
2985
|
+
if (val instanceof Image && !val.complete) {
|
2986
|
+
const node = instance;
|
2987
|
+
val.addEventListener('load', function () {
|
2988
|
+
const layer = node.getLayer();
|
2989
|
+
if (layer) {
|
2990
|
+
layer.batchDraw();
|
2991
|
+
}
|
2992
|
+
});
|
3137
2993
|
}
|
3138
2994
|
});
|
3139
|
-
return ref;
|
3140
2995
|
}
|
3141
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
3142
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService }); }
|
3143
2996
|
}
|
3144
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, decorators: [{
|
3145
|
-
type: Injectable
|
3146
|
-
}] });
|
3147
2997
|
|
3148
|
-
|
2998
|
+
function camelize(str) {
|
2999
|
+
return str
|
3000
|
+
.replace(/^\w|[A-Z]|\b\w/g, function (letter, index) {
|
3001
|
+
return index == 0 ? letter.toLowerCase() : letter.toUpperCase();
|
3002
|
+
})
|
3003
|
+
.replace(/\s+/g, '');
|
3004
|
+
}
|
3005
|
+
function capitalizeFirstLetter(string) {
|
3006
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
3007
|
+
}
|
3008
|
+
function getName(componentTag) {
|
3009
|
+
return capitalizeFirstLetter(camelize(componentTag.slice(3).replace('-', ' ')));
|
3010
|
+
}
|
3011
|
+
function createListener(instance) {
|
3012
|
+
const output = {};
|
3013
|
+
[
|
3014
|
+
'koMouseover',
|
3015
|
+
'koMousemove',
|
3016
|
+
'koMouseout',
|
3017
|
+
'koMouseenter',
|
3018
|
+
'koMouseleave',
|
3019
|
+
'koMousedown',
|
3020
|
+
'koMouseup',
|
3021
|
+
'koWheel',
|
3022
|
+
'koContextmenu',
|
3023
|
+
'koClick',
|
3024
|
+
'koDblclick',
|
3025
|
+
'koTouchstart',
|
3026
|
+
'koTouchmove',
|
3027
|
+
'koTouchend',
|
3028
|
+
'koTap',
|
3029
|
+
'koDbltap',
|
3030
|
+
'koDragstart',
|
3031
|
+
'koDragmove',
|
3032
|
+
'koDragend'
|
3033
|
+
].forEach((eventName) => {
|
3034
|
+
const name = eventName;
|
3035
|
+
const eventEmitter = instance[name];
|
3036
|
+
if (eventEmitter.observed) {
|
3037
|
+
output[eventName] = eventEmitter.emit.bind(eventEmitter);
|
3038
|
+
}
|
3039
|
+
});
|
3040
|
+
return output;
|
3041
|
+
}
|
3042
|
+
|
3043
|
+
const KO_CONTAINER_TOKEN = new InjectionToken('KO_CONTAINER_TOKEN');
|
3044
|
+
|
3045
|
+
class KoShape {
|
3149
3046
|
constructor() {
|
3150
|
-
this.
|
3151
|
-
this.
|
3152
|
-
this.
|
3153
|
-
this.
|
3154
|
-
this.
|
3155
|
-
this.
|
3156
|
-
this.
|
3157
|
-
this.
|
3158
|
-
this.
|
3159
|
-
this.
|
3160
|
-
this.
|
3161
|
-
this.
|
3162
|
-
|
3163
|
-
|
3164
|
-
this.
|
3165
|
-
this.
|
3166
|
-
this.
|
3167
|
-
this.
|
3168
|
-
this.
|
3169
|
-
|
3170
|
-
|
3171
|
-
this.
|
3172
|
-
|
3173
|
-
|
3047
|
+
this.config = input();
|
3048
|
+
this.koMouseover = new EventEmitter();
|
3049
|
+
this.koMousemove = new EventEmitter();
|
3050
|
+
this.koMouseout = new EventEmitter();
|
3051
|
+
this.koMouseenter = new EventEmitter();
|
3052
|
+
this.koMouseleave = new EventEmitter();
|
3053
|
+
this.koMousedown = new EventEmitter();
|
3054
|
+
this.koMouseup = new EventEmitter();
|
3055
|
+
this.koWheel = new EventEmitter();
|
3056
|
+
this.koContextmenu = new EventEmitter();
|
3057
|
+
this.koClick = new EventEmitter();
|
3058
|
+
this.koDblclick = new EventEmitter();
|
3059
|
+
this.koTouchstart = new EventEmitter();
|
3060
|
+
this.koTouchmove = new EventEmitter();
|
3061
|
+
this.koTouchend = new EventEmitter();
|
3062
|
+
this.koTap = new EventEmitter();
|
3063
|
+
this.koDbltap = new EventEmitter();
|
3064
|
+
this.koDragstart = new EventEmitter();
|
3065
|
+
this.koDragmove = new EventEmitter();
|
3066
|
+
this.koDragend = new EventEmitter();
|
3067
|
+
this.elementRef = inject((ElementRef));
|
3068
|
+
this.container = inject(KO_CONTAINER_TOKEN, { skipSelf: true });
|
3069
|
+
this.cacheProps = {};
|
3070
|
+
this.nameNode = getName(this.elementRef.nativeElement.localName);
|
3071
|
+
effect(() => {
|
3072
|
+
if (this.config()) {
|
3073
|
+
this.updateNode(this.config());
|
3174
3074
|
}
|
3175
|
-
return {
|
3176
|
-
records: this.aiRecords(),
|
3177
|
-
fields: this.aiFields()
|
3178
|
-
};
|
3179
|
-
});
|
3180
|
-
this.ngZone = inject(NgZone);
|
3181
|
-
this.elementRef = inject(ElementRef);
|
3182
|
-
this.destroyRef = inject(DestroyRef);
|
3183
|
-
this.aiTableGridFieldService = inject(AITableGridFieldService);
|
3184
|
-
this.aiTableGridEventService = inject(AITableGridEventService);
|
3185
|
-
this.aiTableGridSelectionService = inject(AITableGridSelectionService);
|
3186
|
-
}
|
3187
|
-
ngOnInit() {
|
3188
|
-
this.initAITable();
|
3189
|
-
this.initService();
|
3190
|
-
}
|
3191
|
-
initAITable() {
|
3192
|
-
this.aiTable = createAITable(this.aiRecords, this.aiFields);
|
3193
|
-
this.aiPlugins()?.forEach((plugin) => {
|
3194
|
-
this.aiTable = plugin(this.aiTable);
|
3195
|
-
});
|
3196
|
-
this.aiTableInitialized.emit(this.aiTable);
|
3197
|
-
}
|
3198
|
-
initService() {
|
3199
|
-
this.aiTableGridEventService.initialize(this.aiTable, this.aiFieldConfig()?.fieldRenderers);
|
3200
|
-
this.aiTableGridSelectionService.initialize(this.aiTable);
|
3201
|
-
this.aiTableGridEventService.registerEvents(this.elementRef.nativeElement);
|
3202
|
-
this.aiTableGridFieldService.initAIFieldConfig(this.aiFieldConfig());
|
3203
|
-
AI_TABLE_GRID_FIELD_SERVICE_MAP.set(this.aiTable, this.aiTableGridFieldService);
|
3204
|
-
}
|
3205
|
-
addRecord() {
|
3206
|
-
const records = this.gridData().records;
|
3207
|
-
const recordCount = records.length;
|
3208
|
-
this.aiAddRecord.emit({
|
3209
|
-
originId: recordCount > 0 ? records[records.length - 1]._id : ''
|
3210
3075
|
});
|
3211
3076
|
}
|
3212
|
-
|
3213
|
-
this.
|
3077
|
+
getNode() {
|
3078
|
+
return this._node;
|
3214
3079
|
}
|
3215
|
-
|
3216
|
-
this.
|
3080
|
+
ngOnInit() {
|
3081
|
+
this.initKonva();
|
3217
3082
|
}
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
field,
|
3222
|
-
isUpdate: false,
|
3223
|
-
origin: gridColumnBlank,
|
3224
|
-
position
|
3225
|
-
});
|
3226
|
-
if (popoverRef && !this.aiFieldConfig()?.fieldSettingComponent) {
|
3227
|
-
popoverRef.componentInstance.addField.subscribe((defaultValue) => {
|
3228
|
-
const fields = this.gridData().fields;
|
3229
|
-
const fieldCount = fields.length;
|
3230
|
-
this.aiAddField.emit({
|
3231
|
-
originId: fieldCount > 0 ? fields[fields.length - 1]._id : '',
|
3232
|
-
defaultValue
|
3233
|
-
});
|
3234
|
-
});
|
3083
|
+
initKonva() {
|
3084
|
+
if (!this._node) {
|
3085
|
+
this._node = new Shape();
|
3235
3086
|
}
|
3236
|
-
|
3237
|
-
|
3238
|
-
this.ngZone.runOutsideAngular(() => {
|
3239
|
-
this.aiTableGridEventService.dblClickEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
3240
|
-
this.dblClick(event);
|
3241
|
-
});
|
3242
|
-
this.aiTableGridEventService.mousedownEvent$
|
3243
|
-
.pipe(mergeWith(this.aiTableGridEventService.globalMousedownEvent$), takeUntilDestroyed(this.destroyRef))
|
3244
|
-
.subscribe((event) => {
|
3245
|
-
this.aiTableGridSelectionService.updateSelect(event);
|
3246
|
-
});
|
3247
|
-
this.aiTableGridEventService.mouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
3248
|
-
this.mouseoverHandle(event);
|
3249
|
-
});
|
3250
|
-
this.aiTableGridEventService.globalMouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
3251
|
-
this.closeHoverCellEditor(event);
|
3252
|
-
});
|
3253
|
-
});
|
3254
|
-
}
|
3255
|
-
dblClick(event) {
|
3256
|
-
const cellDom = event.target.closest('.grid-cell');
|
3257
|
-
const type = cellDom && cellDom.getAttribute('type');
|
3258
|
-
if (type && DBL_CLICK_EDIT_TYPE.includes(type)) {
|
3259
|
-
this.aiTableGridEventService.openEdit(cellDom);
|
3087
|
+
if (this.nameNode === 'Shape') {
|
3088
|
+
this._node = new Shape();
|
3260
3089
|
}
|
3261
|
-
|
3262
|
-
|
3263
|
-
if (this.mouseoverRef) {
|
3264
|
-
this.mouseoverRef?.close();
|
3090
|
+
else if (this.nameNode === 'Sprite') {
|
3091
|
+
this._node = new Sprite(this.config());
|
3265
3092
|
}
|
3266
|
-
|
3267
|
-
|
3268
|
-
if (type && MOUSEOVER_EDIT_TYPE.includes(type)) {
|
3269
|
-
this.mouseoverRef = this.aiTableGridEventService.openEdit(cellDom);
|
3093
|
+
else {
|
3094
|
+
this._node = new Konva[this.nameNode](undefined);
|
3270
3095
|
}
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, decorators: [{
|
3285
|
-
type: Component,
|
3286
|
-
args: [{
|
3287
|
-
selector: 'ai-table-grid-base',
|
3288
|
-
template: '',
|
3289
|
-
standalone: true,
|
3290
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
3291
|
-
}]
|
3292
|
-
}] });
|
3293
|
-
|
3294
|
-
class AITableDomGrid extends AITableGridBase {
|
3295
|
-
ngOnInit() {
|
3296
|
-
super.ngOnInit();
|
3297
|
-
this.subscribeEvents();
|
3298
|
-
}
|
3299
|
-
openFieldMenu(e, field, fieldAction) {
|
3300
|
-
const moreBtn = e.target.closest('.grid-field-action');
|
3301
|
-
this.aiTableGridFieldService.openFieldMenu(this.aiTable, {
|
3302
|
-
origin: moreBtn,
|
3303
|
-
editOrigin: fieldAction,
|
3304
|
-
fieldId: field._id,
|
3305
|
-
fieldMenus: this.fieldMenus()
|
3306
|
-
});
|
3307
|
-
}
|
3308
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
3309
|
-
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 }); }
|
3310
|
-
}
|
3311
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, decorators: [{
|
3312
|
-
type: Component,
|
3313
|
-
args: [{ selector: 'ai-table-dom-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
3314
|
-
class: 'ai-table-grid ai-table-dom-grid'
|
3315
|
-
}, imports: [
|
3316
|
-
NgClass,
|
3317
|
-
NgComponentOutlet,
|
3318
|
-
CommonModule,
|
3319
|
-
FormsModule,
|
3320
|
-
SelectOptionPipe,
|
3321
|
-
SelectOptionsPipe,
|
3322
|
-
ThyTag,
|
3323
|
-
ThyPopoverModule,
|
3324
|
-
ThyIcon,
|
3325
|
-
ThyRate,
|
3326
|
-
ThyProgress,
|
3327
|
-
AITableFieldSetting,
|
3328
|
-
ThyDatePickerFormatPipe,
|
3329
|
-
ThyFlexibleText,
|
3330
|
-
ThyStopPropagationDirective,
|
3331
|
-
AITableFieldMenu,
|
3332
|
-
ThyAction,
|
3333
|
-
ThyDropdownDirective,
|
3334
|
-
ThyDropdownMenuComponent,
|
3335
|
-
ThyCheckboxModule,
|
3336
|
-
ProgressEditorComponent,
|
3337
|
-
ThyAvatarModule,
|
3338
|
-
NgTemplateOutlet,
|
3339
|
-
IsSelectRecordPipe,
|
3340
|
-
ProgressEditorComponent,
|
3341
|
-
SelectOptionComponent,
|
3342
|
-
UserPipe,
|
3343
|
-
SelectSettingPipe,
|
3344
|
-
MemberSettingPipe
|
3345
|
-
], 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" }]
|
3346
|
-
}] });
|
3347
|
-
|
3348
|
-
const KO_CONTAINER_TOKEN = new InjectionToken('KO_CONTAINER_TOKEN');
|
3349
|
-
|
3350
|
-
function updatePicture(node) {
|
3351
|
-
const drawingNode = node.getLayer() || node.getStage();
|
3352
|
-
if (drawingNode) {
|
3353
|
-
drawingNode.batchDraw();
|
3354
|
-
}
|
3355
|
-
}
|
3356
|
-
|
3357
|
-
// adapted FROM: https://github.com/lavrton/react-konva/blob/master/src/react-konva-fiber.js
|
3358
|
-
function applyNodeProps(component, props = {}, oldProps = {}) {
|
3359
|
-
if ('id' in props) {
|
3360
|
-
const message = `You are using "id" attribute for Konva node. In some very rare cases it may produce bugs. Currently we recommend not to use it and use "name" attribute instead.`;
|
3361
|
-
console.warn(message);
|
3362
|
-
}
|
3363
|
-
const instance = component.getNode();
|
3364
|
-
const updatedProps = {};
|
3365
|
-
let hasUpdates = false;
|
3366
|
-
Object.keys(oldProps).forEach((key) => {
|
3367
|
-
const isEvent = key.slice(0, 2) === 'ko';
|
3368
|
-
const propChanged = oldProps[key] !== props[key];
|
3369
|
-
if (isEvent && propChanged) {
|
3370
|
-
let eventName = key.slice(2).toLowerCase();
|
3371
|
-
if (eventName.slice(0, 7) === 'content') {
|
3372
|
-
eventName = 'content' + eventName.slice(7, 8).toUpperCase() + eventName.slice(8);
|
3373
|
-
}
|
3374
|
-
instance.off(eventName, oldProps[key]);
|
3375
|
-
}
|
3376
|
-
const toRemove = !Object.hasOwn(props, key);
|
3377
|
-
if (toRemove) {
|
3378
|
-
instance.setAttr(key, undefined);
|
3379
|
-
}
|
3380
|
-
});
|
3381
|
-
Object.keys(props).forEach((key) => {
|
3382
|
-
const isEvent = key.slice(0, 2) === 'ko';
|
3383
|
-
const toAdd = oldProps[key] !== props[key];
|
3384
|
-
if (isEvent && toAdd) {
|
3385
|
-
let eventName = key.slice(2).toLowerCase();
|
3386
|
-
if (eventName.slice(0, 7) === 'content') {
|
3387
|
-
eventName = 'content' + eventName.slice(7, 8).toUpperCase() + eventName.slice(8);
|
3388
|
-
}
|
3389
|
-
if (props[key]) {
|
3390
|
-
instance.off(eventName);
|
3391
|
-
instance.on(eventName, (event) => {
|
3392
|
-
props[key]({
|
3393
|
-
angularComponent: component,
|
3394
|
-
event
|
3395
|
-
});
|
3396
|
-
});
|
3397
|
-
}
|
3398
|
-
}
|
3399
|
-
if (!isEvent && (props[key] !== oldProps[key] || props[key] !== instance.getAttr(key))) {
|
3400
|
-
hasUpdates = true;
|
3401
|
-
updatedProps[key] = props[key];
|
3402
|
-
}
|
3403
|
-
});
|
3404
|
-
if (hasUpdates) {
|
3405
|
-
instance.setAttrs(updatedProps);
|
3406
|
-
updatePicture(instance);
|
3407
|
-
let val;
|
3408
|
-
Object.keys(updatedProps).forEach((prop) => {
|
3409
|
-
val = updatedProps[prop];
|
3410
|
-
if (val instanceof Image && !val.complete) {
|
3411
|
-
const node = instance;
|
3412
|
-
val.addEventListener('load', function () {
|
3413
|
-
const layer = node.getLayer();
|
3414
|
-
if (layer) {
|
3415
|
-
layer.batchDraw();
|
3416
|
-
}
|
3417
|
-
});
|
3418
|
-
}
|
3419
|
-
});
|
3420
|
-
}
|
3421
|
-
}
|
3422
|
-
|
3423
|
-
function camelize(str) {
|
3424
|
-
return str
|
3425
|
-
.replace(/^\w|[A-Z]|\b\w/g, function (letter, index) {
|
3426
|
-
return index == 0 ? letter.toLowerCase() : letter.toUpperCase();
|
3427
|
-
})
|
3428
|
-
.replace(/\s+/g, '');
|
3429
|
-
}
|
3430
|
-
function capitalizeFirstLetter(string) {
|
3431
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
3432
|
-
}
|
3433
|
-
function getName(componentTag) {
|
3434
|
-
return capitalizeFirstLetter(camelize(componentTag.slice(3).replace('-', ' ')));
|
3435
|
-
}
|
3436
|
-
function createListener(instance) {
|
3437
|
-
const output = {};
|
3438
|
-
[
|
3439
|
-
'koMouseover',
|
3440
|
-
'koMousemove',
|
3441
|
-
'koMouseout',
|
3442
|
-
'koMouseenter',
|
3443
|
-
'koMouseleave',
|
3444
|
-
'koMousedown',
|
3445
|
-
'koMouseup',
|
3446
|
-
'koWheel',
|
3447
|
-
'koContextmenu',
|
3448
|
-
'koClick',
|
3449
|
-
'koDblclick',
|
3450
|
-
'koTouchstart',
|
3451
|
-
'koTouchmove',
|
3452
|
-
'koTouchend',
|
3453
|
-
'koTap',
|
3454
|
-
'koDbltap',
|
3455
|
-
'koDragstart',
|
3456
|
-
'koDragmove',
|
3457
|
-
'koDragend'
|
3458
|
-
].forEach((eventName) => {
|
3459
|
-
const name = eventName;
|
3460
|
-
const eventEmitter = instance[name];
|
3461
|
-
if (eventEmitter.observed) {
|
3462
|
-
output[eventName] = eventEmitter.emit.bind(eventEmitter);
|
3463
|
-
}
|
3464
|
-
});
|
3465
|
-
return output;
|
3466
|
-
}
|
3467
|
-
|
3468
|
-
class KoShape {
|
3469
|
-
constructor() {
|
3470
|
-
this.config = input();
|
3471
|
-
this.koMouseover = new EventEmitter();
|
3472
|
-
this.koMousemove = new EventEmitter();
|
3473
|
-
this.koMouseout = new EventEmitter();
|
3474
|
-
this.koMouseenter = new EventEmitter();
|
3475
|
-
this.koMouseleave = new EventEmitter();
|
3476
|
-
this.koMousedown = new EventEmitter();
|
3477
|
-
this.koMouseup = new EventEmitter();
|
3478
|
-
this.koWheel = new EventEmitter();
|
3479
|
-
this.koContextmenu = new EventEmitter();
|
3480
|
-
this.koClick = new EventEmitter();
|
3481
|
-
this.koDblclick = new EventEmitter();
|
3482
|
-
this.koTouchstart = new EventEmitter();
|
3483
|
-
this.koTouchmove = new EventEmitter();
|
3484
|
-
this.koTouchend = new EventEmitter();
|
3485
|
-
this.koTap = new EventEmitter();
|
3486
|
-
this.koDbltap = new EventEmitter();
|
3487
|
-
this.koDragstart = new EventEmitter();
|
3488
|
-
this.koDragmove = new EventEmitter();
|
3489
|
-
this.koDragend = new EventEmitter();
|
3490
|
-
this.elementRef = inject((ElementRef));
|
3491
|
-
this.container = inject(KO_CONTAINER_TOKEN, { skipSelf: true });
|
3492
|
-
this.cacheProps = {};
|
3493
|
-
this.nameNode = getName(this.elementRef.nativeElement.localName);
|
3494
|
-
effect(() => {
|
3495
|
-
if (this.config()) {
|
3496
|
-
this.updateNode(this.config());
|
3497
|
-
}
|
3498
|
-
});
|
3499
|
-
}
|
3500
|
-
getNode() {
|
3501
|
-
return this._node;
|
3502
|
-
}
|
3503
|
-
ngOnInit() {
|
3504
|
-
this.initKonva();
|
3505
|
-
}
|
3506
|
-
initKonva() {
|
3507
|
-
if (!this._node) {
|
3508
|
-
this._node = new Shape();
|
3509
|
-
}
|
3510
|
-
if (this.nameNode === 'Shape') {
|
3511
|
-
this._node = new Shape();
|
3512
|
-
}
|
3513
|
-
else if (this.nameNode === 'Sprite') {
|
3514
|
-
this._node = new Sprite(this.config());
|
3515
|
-
}
|
3516
|
-
else {
|
3517
|
-
this._node = new Konva[this.nameNode](undefined);
|
3518
|
-
}
|
3519
|
-
const animationStage = this._node.to.bind(this._node);
|
3520
|
-
this._node.to = (newConfig) => {
|
3521
|
-
animationStage(newConfig);
|
3522
|
-
setTimeout(() => {
|
3523
|
-
Object.keys(this._node.attrs).forEach((key) => {
|
3524
|
-
if (typeof this._node.attrs[key] !== 'function') {
|
3525
|
-
this.config()[key] = this._node.attrs[key];
|
3526
|
-
}
|
3527
|
-
});
|
3528
|
-
}, 200);
|
3529
|
-
};
|
3530
|
-
if (this.config()) {
|
3531
|
-
this.updateNode(this.config());
|
3096
|
+
const animationStage = this._node.to.bind(this._node);
|
3097
|
+
this._node.to = (newConfig) => {
|
3098
|
+
animationStage(newConfig);
|
3099
|
+
setTimeout(() => {
|
3100
|
+
Object.keys(this._node.attrs).forEach((key) => {
|
3101
|
+
if (typeof this._node.attrs[key] !== 'function') {
|
3102
|
+
this.config()[key] = this._node.attrs[key];
|
3103
|
+
}
|
3104
|
+
});
|
3105
|
+
}, 200);
|
3106
|
+
};
|
3107
|
+
if (this.config()) {
|
3108
|
+
this.updateNode(this.config());
|
3532
3109
|
}
|
3533
3110
|
}
|
3534
3111
|
updateNode(config) {
|
@@ -3625,309 +3202,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
3625
3202
|
}]
|
3626
3203
|
}] });
|
3627
3204
|
|
3628
|
-
class
|
3629
|
-
constructor() {
|
3630
|
-
this.config = input();
|
3631
|
-
this.koMouseover = new EventEmitter();
|
3632
|
-
this.koMousemove = new EventEmitter();
|
3633
|
-
this.koMouseout = new EventEmitter();
|
3634
|
-
this.koMouseenter = new EventEmitter();
|
3635
|
-
this.koMouseleave = new EventEmitter();
|
3636
|
-
this.koMousedown = new EventEmitter();
|
3637
|
-
this.koMouseup = new EventEmitter();
|
3638
|
-
this.koWheel = new EventEmitter();
|
3639
|
-
this.koContextmenu = new EventEmitter();
|
3640
|
-
this.koClick = new EventEmitter();
|
3641
|
-
this.koDblclick = new EventEmitter();
|
3642
|
-
this.koTouchstart = new EventEmitter();
|
3643
|
-
this.koTouchmove = new EventEmitter();
|
3644
|
-
this.koTouchend = new EventEmitter();
|
3645
|
-
this.koTap = new EventEmitter();
|
3646
|
-
this.koDbltap = new EventEmitter();
|
3647
|
-
this.koDragstart = new EventEmitter();
|
3648
|
-
this.koDragmove = new EventEmitter();
|
3649
|
-
this.koDragend = new EventEmitter();
|
3650
|
-
this.cacheProps = {};
|
3651
|
-
this.nodeContainer = inject(ElementRef).nativeElement;
|
3652
|
-
effect(() => {
|
3653
|
-
if (this.config()) {
|
3654
|
-
if (!this._stage) {
|
3655
|
-
this.initStage();
|
3656
|
-
}
|
3657
|
-
this.updateNode(this.config());
|
3658
|
-
}
|
3659
|
-
});
|
3660
|
-
}
|
3661
|
-
ngOnInit() {
|
3662
|
-
this.initStage();
|
3663
|
-
}
|
3664
|
-
getNode() {
|
3665
|
-
return this._stage;
|
3666
|
-
}
|
3667
|
-
initStage() {
|
3668
|
-
this._stage = new Stage({
|
3669
|
-
...this.config(),
|
3670
|
-
container: this.nodeContainer
|
3671
|
-
});
|
3672
|
-
}
|
3673
|
-
updateNode(config) {
|
3674
|
-
const props = {
|
3675
|
-
...config,
|
3676
|
-
...createListener(this)
|
3677
|
-
};
|
3678
|
-
applyNodeProps(this, props, this.cacheProps);
|
3679
|
-
this.cacheProps = props;
|
3680
|
-
}
|
3681
|
-
ngOnDestroy() {
|
3682
|
-
this._stage?.destroy();
|
3683
|
-
}
|
3684
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: KoStage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
3685
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: KoStage, isStandalone: true, selector: "ko-stage", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { koMouseover: "koMouseover", koMousemove: "koMousemove", koMouseout: "koMouseout", koMouseenter: "koMouseenter", koMouseleave: "koMouseleave", koMousedown: "koMousedown", koMouseup: "koMouseup", koWheel: "koWheel", koContextmenu: "koContextmenu", koClick: "koClick", koDblclick: "koDblclick", koTouchstart: "koTouchstart", koTouchmove: "koTouchmove", koTouchend: "koTouchend", koTap: "koTap", koDbltap: "koDbltap", koDragstart: "koDragstart", koDragmove: "koDragmove", koDragend: "koDragend" }, providers: [
|
3686
|
-
{
|
3687
|
-
provide: KO_CONTAINER_TOKEN,
|
3688
|
-
useExisting: KoStage
|
3689
|
-
}
|
3690
|
-
], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
3691
|
-
}
|
3692
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: KoStage, decorators: [{
|
3693
|
-
type: Component,
|
3694
|
-
args: [{
|
3695
|
-
selector: 'ko-stage',
|
3696
|
-
standalone: true,
|
3697
|
-
template: `<ng-content></ng-content>`,
|
3698
|
-
providers: [
|
3699
|
-
{
|
3700
|
-
provide: KO_CONTAINER_TOKEN,
|
3701
|
-
useExisting: KoStage
|
3702
|
-
}
|
3703
|
-
],
|
3704
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
3705
|
-
}]
|
3706
|
-
}], ctorParameters: () => [], propDecorators: { koMouseover: [{
|
3707
|
-
type: Output
|
3708
|
-
}], koMousemove: [{
|
3709
|
-
type: Output
|
3710
|
-
}], koMouseout: [{
|
3711
|
-
type: Output
|
3712
|
-
}], koMouseenter: [{
|
3713
|
-
type: Output
|
3714
|
-
}], koMouseleave: [{
|
3715
|
-
type: Output
|
3716
|
-
}], koMousedown: [{
|
3717
|
-
type: Output
|
3718
|
-
}], koMouseup: [{
|
3719
|
-
type: Output
|
3720
|
-
}], koWheel: [{
|
3721
|
-
type: Output
|
3722
|
-
}], koContextmenu: [{
|
3723
|
-
type: Output
|
3724
|
-
}], koClick: [{
|
3725
|
-
type: Output
|
3726
|
-
}], koDblclick: [{
|
3727
|
-
type: Output
|
3728
|
-
}], koTouchstart: [{
|
3729
|
-
type: Output
|
3730
|
-
}], koTouchmove: [{
|
3731
|
-
type: Output
|
3732
|
-
}], koTouchend: [{
|
3733
|
-
type: Output
|
3734
|
-
}], koTap: [{
|
3735
|
-
type: Output
|
3736
|
-
}], koDbltap: [{
|
3737
|
-
type: Output
|
3738
|
-
}], koDragstart: [{
|
3739
|
-
type: Output
|
3740
|
-
}], koDragmove: [{
|
3741
|
-
type: Output
|
3742
|
-
}], koDragend: [{
|
3743
|
-
type: Output
|
3744
|
-
}] } });
|
3745
|
-
|
3746
|
-
class KoComponent extends Component {
|
3747
|
-
}
|
3748
|
-
|
3749
|
-
const KoShapeTypes = {
|
3750
|
-
Arc,
|
3751
|
-
Arrow,
|
3752
|
-
Circle,
|
3753
|
-
Ellipse,
|
3754
|
-
Image: Image$1,
|
3755
|
-
Label,
|
3756
|
-
Tag,
|
3757
|
-
Line,
|
3758
|
-
Path,
|
3759
|
-
Rect,
|
3760
|
-
RegularPolygon,
|
3761
|
-
Ring,
|
3762
|
-
Star,
|
3763
|
-
Text,
|
3764
|
-
TextPath,
|
3765
|
-
Transformer,
|
3766
|
-
Wedge,
|
3767
|
-
Group,
|
3768
|
-
Layer,
|
3769
|
-
FastLayer
|
3770
|
-
};
|
3771
|
-
|
3772
|
-
class AITableIcon {
|
3205
|
+
class AITableText {
|
3773
3206
|
constructor() {
|
3774
3207
|
this.config = input.required();
|
3775
|
-
|
3776
|
-
|
3777
|
-
|
3778
|
-
|
3779
|
-
|
3780
|
-
const { name, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, strokeWidth = 1, background, cornerRadius, opacity } = this.config();
|
3781
|
-
return {
|
3782
|
-
name,
|
3783
|
-
width: backgroundWidth || size,
|
3784
|
-
height: backgroundHeight || size,
|
3785
|
-
strokeWidth: strokeWidth,
|
3786
|
-
fill: background || Colors.transparent,
|
3787
|
-
cornerRadius,
|
3788
|
-
opacity
|
3789
|
-
};
|
3790
|
-
});
|
3791
|
-
this.iconConfig = computed(() => {
|
3792
|
-
const { type, data, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, stroke, strokeWidth = 1, scaleX, scaleY, offsetX, offsetY, rotation, fill = Colors.gray600, transformsEnabled = 'position' } = this.config();
|
3793
|
-
let pathData = data;
|
3794
|
-
switch (type) {
|
3795
|
-
case AITableCheckType.checked:
|
3796
|
-
pathData = Check;
|
3797
|
-
break;
|
3798
|
-
case AITableCheckType.unchecked:
|
3799
|
-
pathData = Unchecked;
|
3800
|
-
break;
|
3801
|
-
}
|
3208
|
+
// @Output() koClick = new EventEmitter<KoEventObject<MouseEvent>>();
|
3209
|
+
this.koClick = output();
|
3210
|
+
this.koMouseMove = output();
|
3211
|
+
this.textConfig = computed(() => {
|
3212
|
+
const { x, y, width, height, text, padding, align = DEFAULT_TEXT_ALIGN_LEFT, verticalAlign = DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE, fill = DEFAULT_TEXT_FILL, textDecoration, fontSize = DEFAULT_FONT_SIZE, fontStyle = DEFAULT_FONT_STYLE, ellipsis = DEFAULT_TEXT_ELLIPSIS, wrap = DEFAULT_TEXT_WRAP, transformsEnabled = DEFAULT_TEXT_TRANSFORMS_ENABLED, listening = DEFAULT_TEXT_LISTENING, fontFamily = DEFAULT_FONT_FAMILY, ...rest } = this.config();
|
3802
3213
|
return {
|
3803
|
-
x
|
3804
|
-
y
|
3805
|
-
|
3806
|
-
|
3807
|
-
|
3214
|
+
x,
|
3215
|
+
y,
|
3216
|
+
width,
|
3217
|
+
height,
|
3218
|
+
text,
|
3219
|
+
padding,
|
3220
|
+
align,
|
3221
|
+
verticalAlign,
|
3808
3222
|
fill,
|
3809
|
-
|
3810
|
-
|
3811
|
-
|
3812
|
-
|
3813
|
-
|
3814
|
-
stroke,
|
3815
|
-
strokeWidth,
|
3223
|
+
textDecoration,
|
3224
|
+
fontSize,
|
3225
|
+
fontStyle,
|
3226
|
+
ellipsis,
|
3227
|
+
wrap,
|
3816
3228
|
transformsEnabled,
|
3817
|
-
|
3818
|
-
|
3229
|
+
listening,
|
3230
|
+
fontFamily,
|
3231
|
+
...rest
|
3819
3232
|
};
|
3820
3233
|
});
|
3821
3234
|
}
|
3822
|
-
|
3823
|
-
|
3824
|
-
|
3825
|
-
|
3826
|
-
|
3827
|
-
|
3828
|
-
|
3235
|
+
onClick(e) {
|
3236
|
+
this.koClick.emit(e);
|
3237
|
+
}
|
3238
|
+
onMousemove(e) {
|
3239
|
+
this.koMouseMove.emit(e);
|
3240
|
+
}
|
3241
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableText, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
3242
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableText, isStandalone: true, selector: "ai-table-text", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { koClick: "koClick", koMouseMove: "koMouseMove" }, ngImport: i0, template: ` <ko-text [config]="textConfig()" (koClick)="onClick($event)" (koMousemove)="onMousemove($event)"></ko-text> `, isInline: true, dependencies: [{ kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
3829
3243
|
}
|
3830
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type:
|
3244
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableText, decorators: [{
|
3831
3245
|
type: Component,
|
3832
3246
|
args: [{
|
3833
|
-
selector: 'ai-table-
|
3834
|
-
template: `
|
3835
|
-
<ko-group [config]="groupConfig()">
|
3836
|
-
<ko-rect [config]="squareShapeConfig()"></ko-rect>
|
3837
|
-
<ko-path [config]="iconConfig()"></ko-path>
|
3838
|
-
</ko-group>
|
3839
|
-
`,
|
3247
|
+
selector: 'ai-table-text',
|
3248
|
+
template: ` <ko-text [config]="textConfig()" (koClick)="onClick($event)" (koMousemove)="onMousemove($event)"></ko-text> `,
|
3840
3249
|
standalone: true,
|
3841
|
-
imports: [
|
3250
|
+
imports: [KoShape],
|
3842
3251
|
changeDetection: ChangeDetectionStrategy.OnPush
|
3843
3252
|
}]
|
3844
3253
|
}] });
|
3845
3254
|
|
3846
|
-
|
3847
|
-
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
const lastColumnOffset = this.config().coordinate.getColumnOffset(this.config().columnStopIndex);
|
3853
|
-
return lastColumnWidth + lastColumnOffset;
|
3854
|
-
});
|
3855
|
-
this.rectConfig = computed(() => {
|
3856
|
-
const { pointPosition: { targetName }, readonly } = this.config();
|
3857
|
-
const fill = targetName === AI_TABLE_FIELD_ADD_BUTTON ? Colors.gray80 : Colors.white;
|
3858
|
-
return {
|
3859
|
-
name: generateTargetName({
|
3860
|
-
targetName: AI_TABLE_FIELD_ADD_BUTTON,
|
3861
|
-
fieldId: this.config().fields[this.config().columnStopIndex]._id,
|
3862
|
-
mouseStyle: readonly ? 'default' : 'pointer'
|
3863
|
-
}),
|
3864
|
-
x: AI_TABLE_OFFSET,
|
3865
|
-
y: AI_TABLE_OFFSET,
|
3866
|
-
width: this.config().coordinate.containerWidth - this.x() < this.btnWidth
|
3867
|
-
? this.btnWidth
|
3868
|
-
: this.config().coordinate.containerWidth - this.x(),
|
3869
|
-
height: this.config().coordinate.rowInitSize,
|
3870
|
-
stroke: Colors.gray200,
|
3871
|
-
strokeWidth: 1,
|
3872
|
-
listening: true,
|
3873
|
-
fill
|
3874
|
-
};
|
3875
|
-
});
|
3876
|
-
this.addIconConfig = computed(() => {
|
3877
|
-
const { readonly } = this.config();
|
3878
|
-
const offsetY = (this.config().coordinate.rowInitSize - AI_TABLE_ICON_COMMON_SIZE) / 2;
|
3879
|
-
return {
|
3880
|
-
x: AI_TABLE_CELL_PADDING,
|
3881
|
-
y: offsetY,
|
3882
|
-
data: AddOutlinedPath,
|
3883
|
-
fill: Colors.gray600,
|
3884
|
-
listening: false,
|
3885
|
-
visible: isNil(readonly) ? true : !readonly
|
3886
|
-
};
|
3887
|
-
});
|
3888
|
-
}
|
3889
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
3890
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableAddField, isStandalone: true, selector: "ai-table-add-field", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
3891
|
-
<ko-group [config]="{ x: x() }">
|
3892
|
-
<ko-group>
|
3893
|
-
<ko-rect [config]="rectConfig()"></ko-rect>
|
3894
|
-
</ko-group>
|
3895
|
-
<ko-group>
|
3896
|
-
@if (addIconConfig().visible) {
|
3897
|
-
<ai-table-icon [config]="addIconConfig()"></ai-table-icon>
|
3898
|
-
}
|
3899
|
-
</ko-group>
|
3900
|
-
</ko-group>
|
3901
|
-
`, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableIcon, selector: "ai-table-icon", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
3902
|
-
}
|
3903
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, decorators: [{
|
3904
|
-
type: Component,
|
3905
|
-
args: [{
|
3906
|
-
selector: 'ai-table-add-field',
|
3907
|
-
template: `
|
3908
|
-
<ko-group [config]="{ x: x() }">
|
3909
|
-
<ko-group>
|
3910
|
-
<ko-rect [config]="rectConfig()"></ko-rect>
|
3911
|
-
</ko-group>
|
3912
|
-
<ko-group>
|
3913
|
-
@if (addIconConfig().visible) {
|
3914
|
-
<ai-table-icon [config]="addIconConfig()"></ai-table-icon>
|
3915
|
-
}
|
3916
|
-
</ko-group>
|
3917
|
-
</ko-group>
|
3918
|
-
`,
|
3919
|
-
standalone: true,
|
3920
|
-
imports: [KoContainer, KoShape, AITableIcon],
|
3921
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
3922
|
-
}]
|
3923
|
-
}] });
|
3924
|
-
|
3925
|
-
// 用于正确地分割字符串,包括表情符号
|
3926
|
-
const graphemeSplitter = new GraphemeSplitter();
|
3927
|
-
/**
|
3928
|
-
* 用于在 Canvas 上进行的各种绘图操作,包含了文本绘制、矩形绘制、路径绘制以及一些几何计算等功能
|
3929
|
-
*/
|
3930
|
-
class Drawer {
|
3255
|
+
// 用于正确地分割字符串,包括表情符号
|
3256
|
+
const graphemeSplitter = new GraphemeSplitter();
|
3257
|
+
/**
|
3258
|
+
* 用于在 Canvas 上进行的各种绘图操作,包含了文本绘制、矩形绘制、路径绘制以及一些几何计算等功能
|
3259
|
+
*/
|
3260
|
+
class Drawer {
|
3931
3261
|
constructor() {
|
3932
3262
|
this.ctx = TextMeasure().context;
|
3933
3263
|
this.needDraw = false;
|
@@ -4838,22 +4168,860 @@ class Drawer {
|
|
4838
4168
|
this.ctx.rotate(-psi);
|
4839
4169
|
this.ctx.translate(-cx, -cy);
|
4840
4170
|
break;
|
4841
|
-
case 'z':
|
4842
|
-
isClosed = true;
|
4843
|
-
this.ctx.closePath();
|
4171
|
+
case 'z':
|
4172
|
+
isClosed = true;
|
4173
|
+
this.ctx.closePath();
|
4174
|
+
break;
|
4175
|
+
}
|
4176
|
+
}
|
4177
|
+
if (!isClosed) {
|
4178
|
+
this.ctx.stroke();
|
4179
|
+
}
|
4180
|
+
else {
|
4181
|
+
this.ctx.fill();
|
4182
|
+
}
|
4183
|
+
this.ctx.restore();
|
4184
|
+
}
|
4185
|
+
}
|
4186
|
+
const drawer = new Drawer();
|
4187
|
+
|
4188
|
+
class AITableCellLink {
|
4189
|
+
constructor() {
|
4190
|
+
this.config = input();
|
4191
|
+
this.textOffset = AI_TABLE_CELL_PADDING + AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE;
|
4192
|
+
this.render = computed(() => this.config()?.render);
|
4193
|
+
this.transformValue = computed(() => this.render()?.transformValue);
|
4194
|
+
this.showLink = computed(() => !!this.transformValue()?.text);
|
4195
|
+
this.textConfig = computed(() => {
|
4196
|
+
const render = this.config()?.render;
|
4197
|
+
if (render) {
|
4198
|
+
const { x, y, transformValue, field, columnWidth, rowHeight, style, zIndex } = render;
|
4199
|
+
let textRender = transformValue.text;
|
4200
|
+
if (textRender == null) {
|
4201
|
+
return;
|
4202
|
+
}
|
4203
|
+
textRender = textRender.replace(/\r|\n/g, ' ');
|
4204
|
+
const fontWeight = style?.fontWeight;
|
4205
|
+
const textMaxWidth = columnWidth - 2 * AI_TABLE_CELL_PADDING;
|
4206
|
+
const { text, textWidth } = drawer.textEllipsis({
|
4207
|
+
text: textRender,
|
4208
|
+
maxWidth: textMaxWidth,
|
4209
|
+
fontWeight
|
4210
|
+
});
|
4211
|
+
return {
|
4212
|
+
x,
|
4213
|
+
y,
|
4214
|
+
text,
|
4215
|
+
wrap: 'none',
|
4216
|
+
width: textWidth,
|
4217
|
+
fillStyle: Colors.primary,
|
4218
|
+
fill: Colors.primary,
|
4219
|
+
height: rowHeight + 2,
|
4220
|
+
lineHeight: 1.84,
|
4221
|
+
listening: true,
|
4222
|
+
ellipsis: true,
|
4223
|
+
zIndex
|
4224
|
+
};
|
4225
|
+
}
|
4226
|
+
return;
|
4227
|
+
});
|
4228
|
+
}
|
4229
|
+
static { this.fieldType = AITableFieldType.link; }
|
4230
|
+
linkClick(e) {
|
4231
|
+
e.event.cancelBubble = true;
|
4232
|
+
window.open(this.transformValue().url, '_blank', 'noopener,noreferrer');
|
4233
|
+
}
|
4234
|
+
linkMouseMove(e) {
|
4235
|
+
e.event.cancelBubble = true;
|
4236
|
+
const { aiTable, coordinate } = this.config();
|
4237
|
+
const targetName = e.event.target.name();
|
4238
|
+
const gridStage = e.event.currentTarget.getStage();
|
4239
|
+
const pos = gridStage?.getPointerPosition();
|
4240
|
+
if (pos == null)
|
4241
|
+
return;
|
4242
|
+
const { context } = aiTable;
|
4243
|
+
const { x, y } = pos;
|
4244
|
+
const curMousePosition = getMousePosition(x, y, coordinate, AITable.getVisibleFields(aiTable), context, targetName);
|
4245
|
+
handleMouseStyle(AI_TABLE_FIELD_HEAD_MORE, curMousePosition.areaType, coordinate.container);
|
4246
|
+
}
|
4247
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableCellLink, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
4248
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableCellLink, isStandalone: true, selector: "ai-table-link", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
|
4249
|
+
@if (showLink()) {
|
4250
|
+
<ai-table-text [config]="textConfig()!" (koClick)="linkClick($event)" (koMouseMove)="linkMouseMove($event)"></ai-table-text>
|
4251
|
+
}
|
4252
|
+
`, isInline: true, dependencies: [{ kind: "component", type: AITableText, selector: "ai-table-text", inputs: ["config"], outputs: ["koClick", "koMouseMove"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
4253
|
+
}
|
4254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableCellLink, decorators: [{
|
4255
|
+
type: Component,
|
4256
|
+
args: [{
|
4257
|
+
selector: 'ai-table-link',
|
4258
|
+
template: `
|
4259
|
+
@if (showLink()) {
|
4260
|
+
<ai-table-text [config]="textConfig()!" (koClick)="linkClick($event)" (koMouseMove)="linkMouseMove($event)"></ai-table-text>
|
4261
|
+
}
|
4262
|
+
`,
|
4263
|
+
standalone: true,
|
4264
|
+
imports: [KoContainer, KoShape, AITableText],
|
4265
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
4266
|
+
}]
|
4267
|
+
}] });
|
4268
|
+
|
4269
|
+
var cellComponents = /*#__PURE__*/Object.freeze({
|
4270
|
+
__proto__: null,
|
4271
|
+
AITableCellLink: AITableCellLink
|
4272
|
+
});
|
4273
|
+
|
4274
|
+
const componentMap = {};
|
4275
|
+
Object.values(cellComponents).forEach((cellComponent) => {
|
4276
|
+
componentMap[cellComponent.fieldType] = cellComponent;
|
4277
|
+
});
|
4278
|
+
|
4279
|
+
function getHoverCell(aiTable) {
|
4280
|
+
const pointPosition = aiTable.context.pointPosition();
|
4281
|
+
const { fieldId, recordId } = getDetailByTargetName(pointPosition.realTargetName) ?? {};
|
4282
|
+
if (!recordId || !fieldId) {
|
4283
|
+
return;
|
4284
|
+
}
|
4285
|
+
const field = aiTable.fieldsMap()[fieldId];
|
4286
|
+
if (!field || !recordId || !fieldId) {
|
4287
|
+
return;
|
4288
|
+
}
|
4289
|
+
const cellValue = AITableQueries.getFieldValue(aiTable, [recordId, fieldId]);
|
4290
|
+
const transformValue = transformCellValue(aiTable, field, cellValue) || {};
|
4291
|
+
if (Object.keys(transformValue).length === 0) {
|
4292
|
+
return;
|
4293
|
+
}
|
4294
|
+
const renderComponentDefinition = componentMap[field?.type];
|
4295
|
+
if (!renderComponentDefinition) {
|
4296
|
+
return;
|
4297
|
+
}
|
4298
|
+
return {
|
4299
|
+
field,
|
4300
|
+
recordId,
|
4301
|
+
fieldId,
|
4302
|
+
renderComponentDefinition
|
4303
|
+
};
|
4304
|
+
}
|
4305
|
+
|
4306
|
+
class AITableGridEventService {
|
4307
|
+
constructor() {
|
4308
|
+
this.dblClickEvent$ = new Subject();
|
4309
|
+
this.mousedownEvent$ = new Subject();
|
4310
|
+
this.mouseoverEvent$ = new Subject();
|
4311
|
+
this.globalMouseoverEvent$ = new Subject();
|
4312
|
+
this.globalMousedownEvent$ = new Subject();
|
4313
|
+
this.destroyRef = inject(DestroyRef);
|
4314
|
+
this.thyPopover = inject(ThyPopover);
|
4315
|
+
}
|
4316
|
+
initialize(aiTable, aiFieldRenderers) {
|
4317
|
+
this.aiTable = aiTable;
|
4318
|
+
this.aiFieldRenderers = aiFieldRenderers;
|
4319
|
+
}
|
4320
|
+
registerEvents(element) {
|
4321
|
+
fromEvent(element, 'dblclick', { passive: true })
|
4322
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
4323
|
+
.subscribe((event) => {
|
4324
|
+
this.dblClickEvent$.next(event);
|
4325
|
+
});
|
4326
|
+
fromEvent(element, 'mouseover', { passive: true })
|
4327
|
+
.pipe(debounceTime(80), takeUntilDestroyed(this.destroyRef))
|
4328
|
+
.subscribe((event) => {
|
4329
|
+
this.mouseoverEvent$.next(event);
|
4330
|
+
});
|
4331
|
+
fromEvent(document, 'mouseover', { passive: true })
|
4332
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
4333
|
+
.subscribe((event) => {
|
4334
|
+
this.globalMouseoverEvent$.next(event);
|
4335
|
+
});
|
4336
|
+
fromEvent(element, 'mousedown', { passive: true })
|
4337
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
4338
|
+
.subscribe((event) => {
|
4339
|
+
this.mousedownEvent$.next(event);
|
4340
|
+
});
|
4341
|
+
fromEvent(document, 'mousedown', { passive: true })
|
4342
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
4343
|
+
.subscribe((event) => {
|
4344
|
+
this.globalMousedownEvent$.next(event);
|
4345
|
+
});
|
4346
|
+
}
|
4347
|
+
getEditorComponent(type) {
|
4348
|
+
const filedRenderSchema = this.aiFieldRenderers && this.aiFieldRenderers[type];
|
4349
|
+
if (filedRenderSchema && filedRenderSchema.editor) {
|
4350
|
+
return filedRenderSchema.editor;
|
4351
|
+
}
|
4352
|
+
return GRID_CELL_EDITOR_MAP[type];
|
4353
|
+
}
|
4354
|
+
openEdit(cellDom) {
|
4355
|
+
const { x, y, width, height } = cellDom.getBoundingClientRect();
|
4356
|
+
const fieldId = cellDom.getAttribute('fieldId');
|
4357
|
+
const recordId = cellDom.getAttribute('recordId');
|
4358
|
+
const component = this.getEditorComponent(this.aiTable.fieldsMap()[fieldId].type);
|
4359
|
+
const ref = this.thyPopover.open(component, {
|
4360
|
+
origin: cellDom,
|
4361
|
+
originPosition: {
|
4362
|
+
x: x - 1,
|
4363
|
+
y: y + 1,
|
4364
|
+
width: width + 2,
|
4365
|
+
height: height + 2
|
4366
|
+
},
|
4367
|
+
width: width + 1 + 'px',
|
4368
|
+
height: height + 2 + 'px',
|
4369
|
+
placement: 'top',
|
4370
|
+
offset: -(height + 4),
|
4371
|
+
minWidth: width,
|
4372
|
+
initialState: {
|
4373
|
+
fieldId: fieldId,
|
4374
|
+
recordId: recordId,
|
4375
|
+
aiTable: this.aiTable
|
4376
|
+
},
|
4377
|
+
panelClass: 'grid-cell-editor',
|
4378
|
+
outsideClosable: false,
|
4379
|
+
hasBackdrop: false,
|
4380
|
+
manualClosure: true,
|
4381
|
+
animationDisabled: true,
|
4382
|
+
autoAdaptive: true
|
4383
|
+
});
|
4384
|
+
return ref;
|
4385
|
+
}
|
4386
|
+
getOriginPosition(aiTable, options) {
|
4387
|
+
const { container, coordinate, recordId, fieldId, isHoverEdit } = options;
|
4388
|
+
const { scrollState } = aiTable.context;
|
4389
|
+
const { rowHeight, columnCount } = coordinate;
|
4390
|
+
const cell = [recordId, fieldId];
|
4391
|
+
const { rowIndex, columnIndex } = AITable.getCellIndex(aiTable, cell);
|
4392
|
+
const originX = coordinate.getColumnOffset(columnIndex);
|
4393
|
+
const originY = coordinate.getRowOffset(rowIndex);
|
4394
|
+
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
4395
|
+
const { width: originWidth, offset: originOffset } = getCellHorizontalPosition({
|
4396
|
+
columnWidth,
|
4397
|
+
columnIndex,
|
4398
|
+
columnCount
|
4399
|
+
});
|
4400
|
+
const originRect = container.getBoundingClientRect();
|
4401
|
+
const isFrozenColumn = AITable.isFrozenColumn(aiTable, columnIndex);
|
4402
|
+
const scrollLeft = isFrozenColumn ? 0 : scrollState().scrollLeft;
|
4403
|
+
const scrollTop = scrollState().scrollTop;
|
4404
|
+
const originPosition = {
|
4405
|
+
x: originX + originOffset - scrollLeft + originRect.x,
|
4406
|
+
y: originY - scrollTop + originRect.y,
|
4407
|
+
width: originWidth,
|
4408
|
+
height: rowHeight
|
4409
|
+
};
|
4410
|
+
let x = originPosition.x + getEditorBoxOffset();
|
4411
|
+
let y = originPosition.y + getEditorBoxOffset();
|
4412
|
+
let width = getEditorSpace(originPosition.width);
|
4413
|
+
let height = getEditorSpace(originPosition.height);
|
4414
|
+
// hover 编辑组件无边框
|
4415
|
+
if (isHoverEdit) {
|
4416
|
+
x = originPosition.x + getHoverEditorBoxOffset();
|
4417
|
+
y = originPosition.y + getHoverEditorBoxOffset();
|
4418
|
+
width = getHoverEditorSpace(originPosition.width);
|
4419
|
+
height = getHoverEditorSpace(originPosition.height);
|
4420
|
+
}
|
4421
|
+
return {
|
4422
|
+
...originPosition,
|
4423
|
+
x: x,
|
4424
|
+
y: y,
|
4425
|
+
width: width,
|
4426
|
+
height: height
|
4427
|
+
};
|
4428
|
+
}
|
4429
|
+
openCellEditor(aiTable, options) {
|
4430
|
+
const { container, recordId, fieldId, isHoverEdit, references } = options;
|
4431
|
+
const component = this.getEditorComponent(this.aiTable.fieldsMap()[fieldId].type);
|
4432
|
+
const offsetOriginPosition = this.getOriginPosition(aiTable, options);
|
4433
|
+
this.cellEditorPopoverRef = this.thyPopover.open(component, {
|
4434
|
+
origin: container,
|
4435
|
+
originPosition: offsetOriginPosition,
|
4436
|
+
width: offsetOriginPosition.width + 'px',
|
4437
|
+
height: offsetOriginPosition.height + 'px',
|
4438
|
+
minWidth: offsetOriginPosition.width + 'px',
|
4439
|
+
placement: 'bottom',
|
4440
|
+
offset: -offsetOriginPosition.height,
|
4441
|
+
initialState: {
|
4442
|
+
fieldId: fieldId,
|
4443
|
+
recordId: recordId,
|
4444
|
+
references,
|
4445
|
+
aiTable: aiTable
|
4446
|
+
},
|
4447
|
+
panelClass: 'grid-cell-editor',
|
4448
|
+
outsideClosable: false,
|
4449
|
+
hasBackdrop: false,
|
4450
|
+
manualClosure: true,
|
4451
|
+
animationDisabled: true,
|
4452
|
+
autoAdaptive: true
|
4453
|
+
});
|
4454
|
+
if (this.cellEditorPopoverRef) {
|
4455
|
+
const wheelEvent = fromEvent(this.cellEditorPopoverRef.componentInstance.elementRef.nativeElement, 'wheel').subscribe((event) => {
|
4456
|
+
const field = aiTable.fieldsMap()[fieldId];
|
4457
|
+
if (field.type === AITableFieldType.text || field.type === AITableFieldType.richText) {
|
4458
|
+
return;
|
4459
|
+
}
|
4460
|
+
event.preventDefault();
|
4461
|
+
this.aiTable.context?.scrollAction({
|
4462
|
+
deltaX: event.deltaX,
|
4463
|
+
deltaY: event.deltaY,
|
4464
|
+
shiftKey: event.shiftKey,
|
4465
|
+
callback: () => {
|
4466
|
+
const originPosition = this.getOriginPosition(aiTable, options);
|
4467
|
+
const positionStrategy = this.cellEditorPopoverRef
|
4468
|
+
.getOverlayRef()
|
4469
|
+
.getConfig().positionStrategy;
|
4470
|
+
positionStrategy.setOrigin(originPosition);
|
4471
|
+
positionStrategy.apply();
|
4472
|
+
}
|
4473
|
+
});
|
4474
|
+
});
|
4475
|
+
this.cellEditorPopoverRef.afterClosed().subscribe(() => {
|
4476
|
+
wheelEvent.unsubscribe();
|
4477
|
+
this.cellEditorPopoverRef = null;
|
4478
|
+
});
|
4479
|
+
this.cellEditorPopoverRef.componentInstance.updateFieldValue.subscribe((value) => {
|
4480
|
+
options.updateFieldValue(value);
|
4481
|
+
});
|
4482
|
+
}
|
4483
|
+
return this.cellEditorPopoverRef;
|
4484
|
+
}
|
4485
|
+
closeCellEditor() {
|
4486
|
+
if (this.cellEditorPopoverRef) {
|
4487
|
+
this.cellEditorPopoverRef.close();
|
4488
|
+
this.cellEditorPopoverRef = null;
|
4489
|
+
}
|
4490
|
+
}
|
4491
|
+
getCurrentEditCell() {
|
4492
|
+
if (this.cellEditorPopoverRef) {
|
4493
|
+
const recordId = this.cellEditorPopoverRef.componentInstance?.recordId;
|
4494
|
+
const fieldId = this.cellEditorPopoverRef.componentInstance?.fieldId;
|
4495
|
+
if (recordId && fieldId) {
|
4496
|
+
return {
|
4497
|
+
recordId,
|
4498
|
+
fieldId
|
4499
|
+
};
|
4500
|
+
}
|
4501
|
+
return null;
|
4502
|
+
}
|
4503
|
+
return null;
|
4504
|
+
}
|
4505
|
+
openContextMenu(aiTable, options) {
|
4506
|
+
const { origin, position, menuItems, targetName, viewContainerRef } = options;
|
4507
|
+
const ref = this.thyPopover.open(AITableContextMenu, {
|
4508
|
+
origin: origin,
|
4509
|
+
originPosition: position,
|
4510
|
+
placement: 'bottomLeft',
|
4511
|
+
insideClosable: true,
|
4512
|
+
viewContainerRef,
|
4513
|
+
initialState: {
|
4514
|
+
aiTable,
|
4515
|
+
menuItems,
|
4516
|
+
targetName,
|
4517
|
+
position
|
4518
|
+
}
|
4519
|
+
});
|
4520
|
+
return ref;
|
4521
|
+
}
|
4522
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
4523
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService }); }
|
4524
|
+
}
|
4525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridEventService, decorators: [{
|
4526
|
+
type: Injectable
|
4527
|
+
}] });
|
4528
|
+
|
4529
|
+
class AITableGridBase {
|
4530
|
+
constructor() {
|
4531
|
+
this.aiRecords = model.required();
|
4532
|
+
this.aiFields = model.required();
|
4533
|
+
this.aiContextMenuItems = input([]);
|
4534
|
+
this.aiFieldConfig = input();
|
4535
|
+
this.aiReadonly = input();
|
4536
|
+
this.aiPlugins = input();
|
4537
|
+
this.aiReferences = input.required();
|
4538
|
+
this.aiBuildRenderDataFn = input();
|
4539
|
+
this.aiKeywords = input();
|
4540
|
+
this.AITableFieldType = AITableFieldType;
|
4541
|
+
this.AITableSelectOptionStyle = AITableSelectOptionStyle;
|
4542
|
+
this.isSelectedAll = computed(() => {
|
4543
|
+
return this.aiTable.selection().selectedRecords.size === this.aiRecords().length;
|
4544
|
+
});
|
4545
|
+
this.aiTableInitialized = output();
|
4546
|
+
this.aiAddRecord = output();
|
4547
|
+
this.aiAddField = output();
|
4548
|
+
this.aiUpdateFieldValue = output();
|
4549
|
+
this.fieldMenus = computed(() => {
|
4550
|
+
return this.aiFieldConfig()?.fieldMenus || [];
|
4551
|
+
});
|
4552
|
+
this.gridData = computed(() => {
|
4553
|
+
if (this.aiBuildRenderDataFn && this.aiBuildRenderDataFn() && this.aiTable) {
|
4554
|
+
return this.aiBuildRenderDataFn()(this.aiTable);
|
4555
|
+
}
|
4556
|
+
return {
|
4557
|
+
records: this.aiRecords(),
|
4558
|
+
fields: this.aiFields()
|
4559
|
+
};
|
4560
|
+
});
|
4561
|
+
this.ngZone = inject(NgZone);
|
4562
|
+
this.elementRef = inject(ElementRef);
|
4563
|
+
this.destroyRef = inject(DestroyRef);
|
4564
|
+
this.aiTableGridFieldService = inject(AITableGridFieldService);
|
4565
|
+
this.aiTableGridEventService = inject(AITableGridEventService);
|
4566
|
+
this.aiTableGridSelectionService = inject(AITableGridSelectionService);
|
4567
|
+
}
|
4568
|
+
ngOnInit() {
|
4569
|
+
this.initAITable();
|
4570
|
+
this.initService();
|
4571
|
+
}
|
4572
|
+
initAITable() {
|
4573
|
+
this.aiTable = createAITable(this.aiRecords, this.aiFields);
|
4574
|
+
this.aiPlugins()?.forEach((plugin) => {
|
4575
|
+
this.aiTable = plugin(this.aiTable);
|
4576
|
+
});
|
4577
|
+
this.aiTableInitialized.emit(this.aiTable);
|
4578
|
+
}
|
4579
|
+
initService() {
|
4580
|
+
this.aiTableGridEventService.initialize(this.aiTable, this.aiFieldConfig()?.fieldRenderers);
|
4581
|
+
this.aiTableGridSelectionService.initialize(this.aiTable);
|
4582
|
+
this.aiTableGridEventService.registerEvents(this.elementRef.nativeElement);
|
4583
|
+
this.aiTableGridFieldService.initAIFieldConfig(this.aiFieldConfig());
|
4584
|
+
AI_TABLE_GRID_FIELD_SERVICE_MAP.set(this.aiTable, this.aiTableGridFieldService);
|
4585
|
+
}
|
4586
|
+
addRecord() {
|
4587
|
+
const records = this.gridData().records;
|
4588
|
+
const recordCount = records.length;
|
4589
|
+
this.aiAddRecord.emit({
|
4590
|
+
originId: recordCount > 0 ? records[records.length - 1]._id : ''
|
4591
|
+
});
|
4592
|
+
}
|
4593
|
+
selectRecord(recordId) {
|
4594
|
+
this.aiTableGridSelectionService.selectRecord(recordId);
|
4595
|
+
}
|
4596
|
+
toggleSelectAll(checked) {
|
4597
|
+
this.aiTableGridSelectionService.toggleSelectAll(checked);
|
4598
|
+
}
|
4599
|
+
addField(gridColumnBlank, position) {
|
4600
|
+
const field = createDefaultField(this.aiTable, AITableFieldType.text);
|
4601
|
+
const popoverRef = this.aiTableGridFieldService.editFieldProperty(this.aiTable, {
|
4602
|
+
field,
|
4603
|
+
isUpdate: false,
|
4604
|
+
origin: gridColumnBlank,
|
4605
|
+
position
|
4606
|
+
});
|
4607
|
+
if (popoverRef && !this.aiFieldConfig()?.fieldSettingComponent) {
|
4608
|
+
popoverRef.componentInstance.addField.subscribe((defaultValue) => {
|
4609
|
+
const fields = this.gridData().fields;
|
4610
|
+
const fieldCount = fields.length;
|
4611
|
+
this.aiAddField.emit({
|
4612
|
+
originId: fieldCount > 0 ? fields[fields.length - 1]._id : '',
|
4613
|
+
defaultValue
|
4614
|
+
});
|
4615
|
+
});
|
4616
|
+
}
|
4617
|
+
}
|
4618
|
+
subscribeEvents() {
|
4619
|
+
this.ngZone.runOutsideAngular(() => {
|
4620
|
+
this.aiTableGridEventService.dblClickEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
4621
|
+
this.dblClick(event);
|
4622
|
+
});
|
4623
|
+
this.aiTableGridEventService.mousedownEvent$
|
4624
|
+
.pipe(mergeWith(this.aiTableGridEventService.globalMousedownEvent$), takeUntilDestroyed(this.destroyRef))
|
4625
|
+
.subscribe((event) => {
|
4626
|
+
this.aiTableGridSelectionService.updateSelect(event);
|
4627
|
+
});
|
4628
|
+
this.aiTableGridEventService.mouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
4629
|
+
this.mouseoverHandle(event);
|
4630
|
+
});
|
4631
|
+
this.aiTableGridEventService.globalMouseoverEvent$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((event) => {
|
4632
|
+
this.closeHoverCellEditor(event);
|
4633
|
+
});
|
4634
|
+
});
|
4635
|
+
}
|
4636
|
+
dblClick(event) {
|
4637
|
+
const cellDom = event.target.closest('.grid-cell');
|
4638
|
+
const type = cellDom && cellDom.getAttribute('type');
|
4639
|
+
if (type && DBL_CLICK_EDIT_TYPE.includes(type)) {
|
4640
|
+
this.aiTableGridEventService.openEdit(cellDom);
|
4641
|
+
}
|
4642
|
+
}
|
4643
|
+
mouseoverHandle(event) {
|
4644
|
+
if (this.mouseoverRef) {
|
4645
|
+
this.mouseoverRef?.close();
|
4646
|
+
}
|
4647
|
+
const cellDom = event.target.closest('.grid-cell');
|
4648
|
+
const type = cellDom && cellDom.getAttribute('type');
|
4649
|
+
if (type && MOUSEOVER_EDIT_TYPE.includes(type)) {
|
4650
|
+
this.mouseoverRef = this.aiTableGridEventService.openEdit(cellDom);
|
4651
|
+
}
|
4652
|
+
}
|
4653
|
+
closeHoverCellEditor(e) {
|
4654
|
+
if (this.mouseoverRef) {
|
4655
|
+
const hasGrid = e.target && e.target.closest('.ai-table-grid');
|
4656
|
+
const hasCellEditor = e.target && e.target.closest('.grid-cell-editor');
|
4657
|
+
if (!hasGrid && !hasCellEditor) {
|
4658
|
+
this.mouseoverRef.close();
|
4659
|
+
}
|
4660
|
+
}
|
4661
|
+
}
|
4662
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
4663
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableGridBase, isStandalone: true, selector: "ai-table-grid-base", inputs: { aiRecords: { classPropertyName: "aiRecords", publicName: "aiRecords", isSignal: true, isRequired: true, transformFunction: null }, aiFields: { classPropertyName: "aiFields", publicName: "aiFields", isSignal: true, isRequired: true, transformFunction: null }, aiContextMenuItems: { classPropertyName: "aiContextMenuItems", publicName: "aiContextMenuItems", isSignal: true, isRequired: false, transformFunction: null }, aiFieldConfig: { classPropertyName: "aiFieldConfig", publicName: "aiFieldConfig", isSignal: true, isRequired: false, transformFunction: null }, aiReadonly: { classPropertyName: "aiReadonly", publicName: "aiReadonly", isSignal: true, isRequired: false, transformFunction: null }, aiPlugins: { classPropertyName: "aiPlugins", publicName: "aiPlugins", isSignal: true, isRequired: false, transformFunction: null }, aiReferences: { classPropertyName: "aiReferences", publicName: "aiReferences", isSignal: true, isRequired: true, transformFunction: null }, aiBuildRenderDataFn: { classPropertyName: "aiBuildRenderDataFn", publicName: "aiBuildRenderDataFn", isSignal: true, isRequired: false, transformFunction: null }, aiKeywords: { classPropertyName: "aiKeywords", publicName: "aiKeywords", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { aiRecords: "aiRecordsChange", aiFields: "aiFieldsChange", aiTableInitialized: "aiTableInitialized", aiAddRecord: "aiAddRecord", aiAddField: "aiAddField", aiUpdateFieldValue: "aiUpdateFieldValue" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
4664
|
+
}
|
4665
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, decorators: [{
|
4666
|
+
type: Component,
|
4667
|
+
args: [{
|
4668
|
+
selector: 'ai-table-grid-base',
|
4669
|
+
template: '',
|
4670
|
+
standalone: true,
|
4671
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
4672
|
+
}]
|
4673
|
+
}] });
|
4674
|
+
|
4675
|
+
class AITableDomGrid extends AITableGridBase {
|
4676
|
+
ngOnInit() {
|
4677
|
+
super.ngOnInit();
|
4678
|
+
this.subscribeEvents();
|
4679
|
+
}
|
4680
|
+
openFieldMenu(e, field, fieldAction) {
|
4681
|
+
const moreBtn = e.target.closest('.grid-field-action');
|
4682
|
+
this.aiTableGridFieldService.openFieldMenu(this.aiTable, {
|
4683
|
+
origin: moreBtn,
|
4684
|
+
editOrigin: fieldAction,
|
4685
|
+
fieldId: field._id,
|
4686
|
+
fieldMenus: this.fieldMenus()
|
4687
|
+
});
|
4688
|
+
}
|
4689
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
4690
|
+
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 }); }
|
4691
|
+
}
|
4692
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDomGrid, decorators: [{
|
4693
|
+
type: Component,
|
4694
|
+
args: [{ selector: 'ai-table-dom-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
4695
|
+
class: 'ai-table-grid ai-table-dom-grid'
|
4696
|
+
}, imports: [
|
4697
|
+
NgClass,
|
4698
|
+
NgComponentOutlet,
|
4699
|
+
CommonModule,
|
4700
|
+
FormsModule,
|
4701
|
+
SelectOptionPipe,
|
4702
|
+
SelectOptionsPipe,
|
4703
|
+
ThyTag,
|
4704
|
+
ThyPopoverModule,
|
4705
|
+
ThyIcon,
|
4706
|
+
ThyRate,
|
4707
|
+
ThyProgress,
|
4708
|
+
AITableFieldSetting,
|
4709
|
+
ThyDatePickerFormatPipe,
|
4710
|
+
ThyFlexibleText,
|
4711
|
+
ThyStopPropagationDirective,
|
4712
|
+
AITableFieldMenu,
|
4713
|
+
ThyAction,
|
4714
|
+
ThyDropdownDirective,
|
4715
|
+
ThyDropdownMenuComponent,
|
4716
|
+
ThyCheckboxModule,
|
4717
|
+
ProgressEditorComponent,
|
4718
|
+
ThyAvatarModule,
|
4719
|
+
NgTemplateOutlet,
|
4720
|
+
IsSelectRecordPipe,
|
4721
|
+
ProgressEditorComponent,
|
4722
|
+
SelectOptionComponent,
|
4723
|
+
UserPipe,
|
4724
|
+
SelectSettingPipe,
|
4725
|
+
MemberSettingPipe
|
4726
|
+
], 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" }]
|
4727
|
+
}] });
|
4728
|
+
|
4729
|
+
class KoStage {
|
4730
|
+
constructor() {
|
4731
|
+
this.config = input();
|
4732
|
+
this.koMouseover = new EventEmitter();
|
4733
|
+
this.koMousemove = new EventEmitter();
|
4734
|
+
this.koMouseout = new EventEmitter();
|
4735
|
+
this.koMouseenter = new EventEmitter();
|
4736
|
+
this.koMouseleave = new EventEmitter();
|
4737
|
+
this.koMousedown = new EventEmitter();
|
4738
|
+
this.koMouseup = new EventEmitter();
|
4739
|
+
this.koWheel = new EventEmitter();
|
4740
|
+
this.koContextmenu = new EventEmitter();
|
4741
|
+
this.koClick = new EventEmitter();
|
4742
|
+
this.koDblclick = new EventEmitter();
|
4743
|
+
this.koTouchstart = new EventEmitter();
|
4744
|
+
this.koTouchmove = new EventEmitter();
|
4745
|
+
this.koTouchend = new EventEmitter();
|
4746
|
+
this.koTap = new EventEmitter();
|
4747
|
+
this.koDbltap = new EventEmitter();
|
4748
|
+
this.koDragstart = new EventEmitter();
|
4749
|
+
this.koDragmove = new EventEmitter();
|
4750
|
+
this.koDragend = new EventEmitter();
|
4751
|
+
this.cacheProps = {};
|
4752
|
+
this.nodeContainer = inject(ElementRef).nativeElement;
|
4753
|
+
effect(() => {
|
4754
|
+
if (this.config()) {
|
4755
|
+
if (!this._stage) {
|
4756
|
+
this.initStage();
|
4757
|
+
}
|
4758
|
+
this.updateNode(this.config());
|
4759
|
+
}
|
4760
|
+
});
|
4761
|
+
}
|
4762
|
+
ngOnInit() {
|
4763
|
+
this.initStage();
|
4764
|
+
}
|
4765
|
+
getNode() {
|
4766
|
+
return this._stage;
|
4767
|
+
}
|
4768
|
+
initStage() {
|
4769
|
+
this._stage = new Stage({
|
4770
|
+
...this.config(),
|
4771
|
+
container: this.nodeContainer
|
4772
|
+
});
|
4773
|
+
}
|
4774
|
+
updateNode(config) {
|
4775
|
+
const props = {
|
4776
|
+
...config,
|
4777
|
+
...createListener(this)
|
4778
|
+
};
|
4779
|
+
applyNodeProps(this, props, this.cacheProps);
|
4780
|
+
this.cacheProps = props;
|
4781
|
+
}
|
4782
|
+
ngOnDestroy() {
|
4783
|
+
this._stage?.destroy();
|
4784
|
+
}
|
4785
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: KoStage, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
4786
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: KoStage, isStandalone: true, selector: "ko-stage", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { koMouseover: "koMouseover", koMousemove: "koMousemove", koMouseout: "koMouseout", koMouseenter: "koMouseenter", koMouseleave: "koMouseleave", koMousedown: "koMousedown", koMouseup: "koMouseup", koWheel: "koWheel", koContextmenu: "koContextmenu", koClick: "koClick", koDblclick: "koDblclick", koTouchstart: "koTouchstart", koTouchmove: "koTouchmove", koTouchend: "koTouchend", koTap: "koTap", koDbltap: "koDbltap", koDragstart: "koDragstart", koDragmove: "koDragmove", koDragend: "koDragend" }, providers: [
|
4787
|
+
{
|
4788
|
+
provide: KO_CONTAINER_TOKEN,
|
4789
|
+
useExisting: KoStage
|
4790
|
+
}
|
4791
|
+
], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
4792
|
+
}
|
4793
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: KoStage, decorators: [{
|
4794
|
+
type: Component,
|
4795
|
+
args: [{
|
4796
|
+
selector: 'ko-stage',
|
4797
|
+
standalone: true,
|
4798
|
+
template: `<ng-content></ng-content>`,
|
4799
|
+
providers: [
|
4800
|
+
{
|
4801
|
+
provide: KO_CONTAINER_TOKEN,
|
4802
|
+
useExisting: KoStage
|
4803
|
+
}
|
4804
|
+
],
|
4805
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
4806
|
+
}]
|
4807
|
+
}], ctorParameters: () => [], propDecorators: { koMouseover: [{
|
4808
|
+
type: Output
|
4809
|
+
}], koMousemove: [{
|
4810
|
+
type: Output
|
4811
|
+
}], koMouseout: [{
|
4812
|
+
type: Output
|
4813
|
+
}], koMouseenter: [{
|
4814
|
+
type: Output
|
4815
|
+
}], koMouseleave: [{
|
4816
|
+
type: Output
|
4817
|
+
}], koMousedown: [{
|
4818
|
+
type: Output
|
4819
|
+
}], koMouseup: [{
|
4820
|
+
type: Output
|
4821
|
+
}], koWheel: [{
|
4822
|
+
type: Output
|
4823
|
+
}], koContextmenu: [{
|
4824
|
+
type: Output
|
4825
|
+
}], koClick: [{
|
4826
|
+
type: Output
|
4827
|
+
}], koDblclick: [{
|
4828
|
+
type: Output
|
4829
|
+
}], koTouchstart: [{
|
4830
|
+
type: Output
|
4831
|
+
}], koTouchmove: [{
|
4832
|
+
type: Output
|
4833
|
+
}], koTouchend: [{
|
4834
|
+
type: Output
|
4835
|
+
}], koTap: [{
|
4836
|
+
type: Output
|
4837
|
+
}], koDbltap: [{
|
4838
|
+
type: Output
|
4839
|
+
}], koDragstart: [{
|
4840
|
+
type: Output
|
4841
|
+
}], koDragmove: [{
|
4842
|
+
type: Output
|
4843
|
+
}], koDragend: [{
|
4844
|
+
type: Output
|
4845
|
+
}] } });
|
4846
|
+
|
4847
|
+
class KoComponent extends Component {
|
4848
|
+
}
|
4849
|
+
|
4850
|
+
const KoShapeTypes = {
|
4851
|
+
Arc,
|
4852
|
+
Arrow,
|
4853
|
+
Circle,
|
4854
|
+
Ellipse,
|
4855
|
+
Image: Image$1,
|
4856
|
+
Label,
|
4857
|
+
Tag,
|
4858
|
+
Line,
|
4859
|
+
Path,
|
4860
|
+
Rect,
|
4861
|
+
RegularPolygon,
|
4862
|
+
Ring,
|
4863
|
+
Star,
|
4864
|
+
Text,
|
4865
|
+
TextPath,
|
4866
|
+
Transformer,
|
4867
|
+
Wedge,
|
4868
|
+
Group,
|
4869
|
+
Layer,
|
4870
|
+
FastLayer
|
4871
|
+
};
|
4872
|
+
|
4873
|
+
class AITableIcon {
|
4874
|
+
constructor() {
|
4875
|
+
this.config = input.required();
|
4876
|
+
this.groupConfig = computed(() => {
|
4877
|
+
const { x, y, listening } = this.config();
|
4878
|
+
return { x, y, listening };
|
4879
|
+
});
|
4880
|
+
this.squareShapeConfig = computed(() => {
|
4881
|
+
const { name, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, strokeWidth = 1, background, cornerRadius, opacity } = this.config();
|
4882
|
+
return {
|
4883
|
+
name,
|
4884
|
+
width: backgroundWidth || size,
|
4885
|
+
height: backgroundHeight || size,
|
4886
|
+
strokeWidth: strokeWidth,
|
4887
|
+
fill: background || Colors.transparent,
|
4888
|
+
cornerRadius,
|
4889
|
+
opacity
|
4890
|
+
};
|
4891
|
+
});
|
4892
|
+
this.iconConfig = computed(() => {
|
4893
|
+
const { type, data, backgroundWidth, backgroundHeight, size = DEFAULT_ICON_SIZE, stroke, strokeWidth = 1, scaleX, scaleY, offsetX, offsetY, rotation, fill = Colors.gray600, transformsEnabled = 'position' } = this.config();
|
4894
|
+
let pathData = data;
|
4895
|
+
switch (type) {
|
4896
|
+
case AITableCheckType.checked:
|
4897
|
+
pathData = Check;
|
4898
|
+
break;
|
4899
|
+
case AITableCheckType.unchecked:
|
4900
|
+
pathData = Unchecked;
|
4844
4901
|
break;
|
4845
4902
|
}
|
4846
|
-
|
4847
|
-
|
4848
|
-
|
4849
|
-
|
4850
|
-
|
4851
|
-
|
4852
|
-
|
4853
|
-
|
4903
|
+
return {
|
4904
|
+
x: backgroundWidth && (backgroundWidth - size * (scaleX || 1)) / 2,
|
4905
|
+
y: backgroundHeight && (backgroundHeight - size * (scaleY || 1)) / 2,
|
4906
|
+
data: pathData,
|
4907
|
+
width: size,
|
4908
|
+
height: size,
|
4909
|
+
fill,
|
4910
|
+
offsetX,
|
4911
|
+
offsetY,
|
4912
|
+
scaleX,
|
4913
|
+
scaleY,
|
4914
|
+
rotation,
|
4915
|
+
stroke,
|
4916
|
+
strokeWidth,
|
4917
|
+
transformsEnabled,
|
4918
|
+
perfectDrawEnabled: false,
|
4919
|
+
listening: false
|
4920
|
+
};
|
4921
|
+
});
|
4854
4922
|
}
|
4923
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableIcon, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
4924
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableIcon, isStandalone: true, selector: "ai-table-icon", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
4925
|
+
<ko-group [config]="groupConfig()">
|
4926
|
+
<ko-rect [config]="squareShapeConfig()"></ko-rect>
|
4927
|
+
<ko-path [config]="iconConfig()"></ko-path>
|
4928
|
+
</ko-group>
|
4929
|
+
`, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
4855
4930
|
}
|
4856
|
-
|
4931
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableIcon, decorators: [{
|
4932
|
+
type: Component,
|
4933
|
+
args: [{
|
4934
|
+
selector: 'ai-table-icon',
|
4935
|
+
template: `
|
4936
|
+
<ko-group [config]="groupConfig()">
|
4937
|
+
<ko-rect [config]="squareShapeConfig()"></ko-rect>
|
4938
|
+
<ko-path [config]="iconConfig()"></ko-path>
|
4939
|
+
</ko-group>
|
4940
|
+
`,
|
4941
|
+
standalone: true,
|
4942
|
+
imports: [KoContainer, KoShape],
|
4943
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
4944
|
+
}]
|
4945
|
+
}] });
|
4946
|
+
|
4947
|
+
class AITableAddField {
|
4948
|
+
constructor() {
|
4949
|
+
this.config = input.required();
|
4950
|
+
this.btnWidth = AI_TABLE_FIELD_ADD_BUTTON_WIDTH;
|
4951
|
+
this.x = computed(() => {
|
4952
|
+
const lastColumnWidth = this.config().coordinate.getColumnWidth(this.config().columnStopIndex);
|
4953
|
+
const lastColumnOffset = this.config().coordinate.getColumnOffset(this.config().columnStopIndex);
|
4954
|
+
return lastColumnWidth + lastColumnOffset;
|
4955
|
+
});
|
4956
|
+
this.rectConfig = computed(() => {
|
4957
|
+
const { pointPosition: { targetName }, readonly } = this.config();
|
4958
|
+
const fill = targetName === AI_TABLE_FIELD_ADD_BUTTON ? Colors.gray80 : Colors.white;
|
4959
|
+
return {
|
4960
|
+
name: generateTargetName({
|
4961
|
+
targetName: AI_TABLE_FIELD_ADD_BUTTON,
|
4962
|
+
fieldId: this.config().fields[this.config().columnStopIndex]._id,
|
4963
|
+
mouseStyle: readonly ? 'default' : 'pointer'
|
4964
|
+
}),
|
4965
|
+
x: AI_TABLE_OFFSET,
|
4966
|
+
y: AI_TABLE_OFFSET,
|
4967
|
+
width: this.config().coordinate.containerWidth - this.x() < this.btnWidth
|
4968
|
+
? this.btnWidth
|
4969
|
+
: this.config().coordinate.containerWidth - this.x(),
|
4970
|
+
height: this.config().coordinate.rowInitSize,
|
4971
|
+
stroke: Colors.gray200,
|
4972
|
+
strokeWidth: 1,
|
4973
|
+
listening: true,
|
4974
|
+
fill
|
4975
|
+
};
|
4976
|
+
});
|
4977
|
+
this.addIconConfig = computed(() => {
|
4978
|
+
const { readonly } = this.config();
|
4979
|
+
const offsetY = (this.config().coordinate.rowInitSize - AI_TABLE_ICON_COMMON_SIZE) / 2;
|
4980
|
+
return {
|
4981
|
+
x: AI_TABLE_CELL_PADDING,
|
4982
|
+
y: offsetY,
|
4983
|
+
data: AddOutlinedPath,
|
4984
|
+
fill: Colors.gray600,
|
4985
|
+
listening: false,
|
4986
|
+
visible: isNil(readonly) ? true : !readonly
|
4987
|
+
};
|
4988
|
+
});
|
4989
|
+
}
|
4990
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
4991
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableAddField, isStandalone: true, selector: "ai-table-add-field", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
4992
|
+
<ko-group [config]="{ x: x() }">
|
4993
|
+
<ko-group>
|
4994
|
+
<ko-rect [config]="rectConfig()"></ko-rect>
|
4995
|
+
</ko-group>
|
4996
|
+
<ko-group>
|
4997
|
+
@if (addIconConfig().visible) {
|
4998
|
+
<ai-table-icon [config]="addIconConfig()"></ai-table-icon>
|
4999
|
+
}
|
5000
|
+
</ko-group>
|
5001
|
+
</ko-group>
|
5002
|
+
`, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableIcon, selector: "ai-table-icon", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
5003
|
+
}
|
5004
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableAddField, decorators: [{
|
5005
|
+
type: Component,
|
5006
|
+
args: [{
|
5007
|
+
selector: 'ai-table-add-field',
|
5008
|
+
template: `
|
5009
|
+
<ko-group [config]="{ x: x() }">
|
5010
|
+
<ko-group>
|
5011
|
+
<ko-rect [config]="rectConfig()"></ko-rect>
|
5012
|
+
</ko-group>
|
5013
|
+
<ko-group>
|
5014
|
+
@if (addIconConfig().visible) {
|
5015
|
+
<ai-table-icon [config]="addIconConfig()"></ai-table-icon>
|
5016
|
+
}
|
5017
|
+
</ko-group>
|
5018
|
+
</ko-group>
|
5019
|
+
`,
|
5020
|
+
standalone: true,
|
5021
|
+
imports: [KoContainer, KoShape, AITableIcon],
|
5022
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
5023
|
+
}]
|
5024
|
+
}] });
|
4857
5025
|
|
4858
5026
|
/**
|
4859
5027
|
* 用于处理表格行或单元格的布局和绘制。
|
@@ -5062,7 +5230,7 @@ class CellDrawer extends Drawer {
|
|
5062
5230
|
renderCellText(render, ctx) {
|
5063
5231
|
const { x, y, transformValue, field, columnWidth, style } = render;
|
5064
5232
|
const fieldType = field.type;
|
5065
|
-
let renderText = fieldType === AITableFieldType.link ? transformValue
|
5233
|
+
let renderText = fieldType === AITableFieldType.link ? transformValue?.text : transformValue;
|
5066
5234
|
if (renderText == null) {
|
5067
5235
|
return;
|
5068
5236
|
}
|
@@ -5511,10 +5679,10 @@ class CellDrawer extends Drawer {
|
|
5511
5679
|
const avatarSize = AI_TABLE_MEMBER_AVATAR_SIZE;
|
5512
5680
|
const itemHeight = AI_TABLE_CELL_MEMBER_ITEM_HEIGHT;
|
5513
5681
|
const isOperating = isActive;
|
5514
|
-
const
|
5682
|
+
const isMultiple = settings?.is_multiple;
|
5515
5683
|
let currentX = AI_TABLE_CELL_PADDING;
|
5516
5684
|
let currentY = (AI_TABLE_ROW_BLANK_HEIGHT - avatarSize) / 2;
|
5517
|
-
const itemOtherWidth = avatarSize +
|
5685
|
+
const itemOtherWidth = avatarSize + AI_TABLE_MEMBER_ITEM_AVATAR_MARGIN_RIGHT;
|
5518
5686
|
const maxHeight = isActive ? 130 - AI_TABLE_CELL_MULTI_PADDING_TOP : rowHeight - AI_TABLE_CELL_MULTI_PADDING_TOP;
|
5519
5687
|
const maxTextWidth = isOperating
|
5520
5688
|
? columnWidth - 2 * AI_TABLE_CELL_PADDING - itemOtherWidth - AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE - 12
|
@@ -5526,7 +5694,7 @@ class CellDrawer extends Drawer {
|
|
5526
5694
|
if (!userInfo)
|
5527
5695
|
continue;
|
5528
5696
|
const { uid, display_name, avatar } = userInfo;
|
5529
|
-
const itemWidth = AITableAvatarSize.size24 + (
|
5697
|
+
const itemWidth = AITableAvatarSize.size24 + (isMultiple ? AI_TABLE_CELL_MEMBER_ITEM_PADDING : 0);
|
5530
5698
|
currentX = AI_TABLE_CELL_PADDING + index * itemWidth;
|
5531
5699
|
let realMaxTextWidth = maxTextWidth < 0 ? 0 : maxTextWidth;
|
5532
5700
|
if (index === 0 && isOperating) {
|
@@ -5569,6 +5737,22 @@ class CellDrawer extends Drawer {
|
|
5569
5737
|
type: AITableAvatarType.member,
|
5570
5738
|
size: AITableAvatarSize.size24
|
5571
5739
|
});
|
5740
|
+
// 在非多选模式下显示名称
|
5741
|
+
if (!isMultiple) {
|
5742
|
+
const textX = x + currentX + AITableAvatarSize.size24 + AI_TABLE_MEMBER_ITEM_AVATAR_MARGIN_RIGHT;
|
5743
|
+
this.text({
|
5744
|
+
x: textX,
|
5745
|
+
y: y + AI_TABLE_ROW_BLANK_HEIGHT / 2,
|
5746
|
+
text: this.textEllipsis({
|
5747
|
+
text: display_name || '',
|
5748
|
+
maxWidth: maxTextWidth,
|
5749
|
+
fontSize: AI_TABLE_COMMON_FONT_SIZE
|
5750
|
+
}).text,
|
5751
|
+
fillStyle: this.colors.gray800,
|
5752
|
+
fontSize: AI_TABLE_COMMON_FONT_SIZE,
|
5753
|
+
verticalAlign: DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE
|
5754
|
+
});
|
5755
|
+
}
|
5572
5756
|
if (isMore) {
|
5573
5757
|
ctx.save();
|
5574
5758
|
ctx.globalAlpha = 0.3;
|
@@ -5722,6 +5906,7 @@ const createCells = (config) => {
|
|
5722
5906
|
cellDrawer.initCtx(ctx);
|
5723
5907
|
addRowLayout.initCtx(ctx);
|
5724
5908
|
recordRowLayout.initCtx(ctx);
|
5909
|
+
const hoverCell = getHoverCell(aiTable);
|
5725
5910
|
// 遍历列, 确定在哪些列上绘制单元格
|
5726
5911
|
for (let columnIndex = columnStartIndex; columnIndex <= columnStopIndex; columnIndex++) {
|
5727
5912
|
if (columnIndex > columnCount - 1)
|
@@ -5811,6 +5996,11 @@ const createCells = (config) => {
|
|
5811
5996
|
style,
|
5812
5997
|
colors
|
5813
5998
|
};
|
5999
|
+
// hover 组件渲染时,底层的 cell 渲染为空
|
6000
|
+
if (hoverCell && hoverCell.recordId === recordId && hoverCell.fieldId === fieldId) {
|
6001
|
+
render.cellValue = '';
|
6002
|
+
render.transformValue = '';
|
6003
|
+
}
|
5814
6004
|
cellDrawer.initStyle(field, style);
|
5815
6005
|
// 最后一列,且单元格内容存在,需要裁剪内容,以防止文本溢出单元格边界
|
5816
6006
|
// 然后,根据计算好的样式和布局绘制单元格内容
|
@@ -5971,47 +6161,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
5971
6161
|
}]
|
5972
6162
|
}] });
|
5973
6163
|
|
5974
|
-
class AITableText {
|
5975
|
-
constructor() {
|
5976
|
-
this.config = input.required();
|
5977
|
-
this.textConfig = computed(() => {
|
5978
|
-
const { x, y, width, height, text, padding, align = DEFAULT_TEXT_ALIGN_LEFT, verticalAlign = DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE, fill = DEFAULT_TEXT_FILL, textDecoration, fontSize = DEFAULT_FONT_SIZE, fontStyle = DEFAULT_FONT_STYLE, ellipsis = DEFAULT_TEXT_ELLIPSIS, wrap = DEFAULT_TEXT_WRAP, transformsEnabled = DEFAULT_TEXT_TRANSFORMS_ENABLED, listening = DEFAULT_TEXT_LISTENING, fontFamily = DEFAULT_FONT_FAMILY, ...rest } = this.config();
|
5979
|
-
return {
|
5980
|
-
x,
|
5981
|
-
y,
|
5982
|
-
width,
|
5983
|
-
height,
|
5984
|
-
text,
|
5985
|
-
padding,
|
5986
|
-
align,
|
5987
|
-
verticalAlign,
|
5988
|
-
fill,
|
5989
|
-
textDecoration,
|
5990
|
-
fontSize,
|
5991
|
-
fontStyle,
|
5992
|
-
ellipsis,
|
5993
|
-
wrap,
|
5994
|
-
transformsEnabled,
|
5995
|
-
listening,
|
5996
|
-
fontFamily,
|
5997
|
-
...rest
|
5998
|
-
};
|
5999
|
-
});
|
6000
|
-
}
|
6001
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableText, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
6002
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: AITableText, isStandalone: true, selector: "ai-table-text", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: ` <ko-text [config]="textConfig()"></ko-text> `, isInline: true, dependencies: [{ kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
6003
|
-
}
|
6004
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableText, decorators: [{
|
6005
|
-
type: Component,
|
6006
|
-
args: [{
|
6007
|
-
selector: 'ai-table-text',
|
6008
|
-
template: ` <ko-text [config]="textConfig()"></ko-text> `,
|
6009
|
-
standalone: true,
|
6010
|
-
imports: [KoShape],
|
6011
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
6012
|
-
}]
|
6013
|
-
}] });
|
6014
|
-
|
6015
6164
|
class AITableFieldHead {
|
6016
6165
|
constructor() {
|
6017
6166
|
this.config = input.required();
|
@@ -6110,7 +6259,7 @@ class AITableFieldHead {
|
|
6110
6259
|
}
|
6111
6260
|
</ko-group>
|
6112
6261
|
</ko-group>
|
6113
|
-
`, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableFieldIcon, selector: "ai-table-field-icon", inputs: ["config"] }, { kind: "component", type: AITableText, selector: "ai-table-text", inputs: ["config"] }, { kind: "component", type: AITableIcon, selector: "ai-table-icon", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
6262
|
+
`, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableFieldIcon, selector: "ai-table-field-icon", inputs: ["config"] }, { kind: "component", type: AITableText, selector: "ai-table-text", inputs: ["config"], outputs: ["koClick", "koMouseMove"] }, { kind: "component", type: AITableIcon, selector: "ai-table-icon", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
6114
6263
|
}
|
6115
6264
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableFieldHead, decorators: [{
|
6116
6265
|
type: Component,
|
@@ -6651,6 +6800,100 @@ const createActiveCellBorder = (config) => {
|
|
6651
6800
|
};
|
6652
6801
|
};
|
6653
6802
|
|
6803
|
+
class AITableHoverCells {
|
6804
|
+
constructor() {
|
6805
|
+
this.config = input.required();
|
6806
|
+
this.componentMap = {};
|
6807
|
+
this.groupConfig = computed(() => {
|
6808
|
+
return {
|
6809
|
+
x: this.hoverCellConfig()?.x,
|
6810
|
+
y: this.hoverCellConfig()?.y
|
6811
|
+
};
|
6812
|
+
});
|
6813
|
+
this.hoverCellConfig = computed(() => {
|
6814
|
+
const { aiTable, coordinate } = this.config();
|
6815
|
+
const pointPosition = aiTable.context.pointPosition();
|
6816
|
+
const hoverCell = this.hoverCell();
|
6817
|
+
if (!hoverCell) {
|
6818
|
+
return;
|
6819
|
+
}
|
6820
|
+
const { field, recordId, fieldId, renderComponentDefinition } = hoverCell;
|
6821
|
+
const cellValue = AITableQueries.getFieldValue(aiTable, [recordId, field._id]);
|
6822
|
+
const transformValue = transformCellValue(aiTable, field, cellValue) || {};
|
6823
|
+
if (Object.keys(transformValue).length === 0) {
|
6824
|
+
return;
|
6825
|
+
}
|
6826
|
+
const { rowHeight, columnCount, rowCount } = coordinate;
|
6827
|
+
const columnIndex = pointPosition.columnIndex;
|
6828
|
+
const rowIndex = pointPosition.rowIndex;
|
6829
|
+
const x = coordinate.getColumnOffset(columnIndex) + AI_TABLE_OFFSET;
|
6830
|
+
const columnWidth = coordinate.getColumnWidth(columnIndex);
|
6831
|
+
const y = coordinate.getRowOffset(rowIndex) + AI_TABLE_OFFSET;
|
6832
|
+
const { width } = getCellHorizontalPosition({
|
6833
|
+
columnWidth,
|
6834
|
+
columnIndex,
|
6835
|
+
columnCount
|
6836
|
+
});
|
6837
|
+
const style = {
|
6838
|
+
textAlign: DEFAULT_TEXT_ALIGN_LEFT
|
6839
|
+
};
|
6840
|
+
const textAlign = style.textAlign;
|
6841
|
+
const renderX = textAlign === DEFAULT_TEXT_ALIGN_RIGHT
|
6842
|
+
? columnWidth - AI_TABLE_CELL_PADDING + AI_TABLE_OFFSET
|
6843
|
+
: AI_TABLE_CELL_PADDING + AI_TABLE_OFFSET;
|
6844
|
+
const renderY = 0 - AI_TABLE_OFFSET * 2;
|
6845
|
+
const result = {
|
6846
|
+
field,
|
6847
|
+
aiTable,
|
6848
|
+
coordinate,
|
6849
|
+
x,
|
6850
|
+
y,
|
6851
|
+
render: {
|
6852
|
+
aiTable,
|
6853
|
+
recordId,
|
6854
|
+
field,
|
6855
|
+
isActive: isSelectedField(field._id, aiTable),
|
6856
|
+
x: renderX,
|
6857
|
+
y: renderY,
|
6858
|
+
columnWidth: width,
|
6859
|
+
rowHeight,
|
6860
|
+
cellValue,
|
6861
|
+
transformValue,
|
6862
|
+
style
|
6863
|
+
}
|
6864
|
+
};
|
6865
|
+
return result;
|
6866
|
+
});
|
6867
|
+
this.hoverCell = computed(() => getHoverCell(this.config().aiTable));
|
6868
|
+
}
|
6869
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableHoverCells, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
6870
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableHoverCells, isStandalone: true, selector: "ai-table-hover-cell", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: `
|
6871
|
+
@if (hoverCell()) {
|
6872
|
+
<ko-group [config]="groupConfig()">
|
6873
|
+
<ng-container *ngComponentOutlet="hoverCell()!.renderComponentDefinition; inputs: { config: hoverCellConfig() }">
|
6874
|
+
</ng-container>
|
6875
|
+
</ko-group>
|
6876
|
+
}
|
6877
|
+
`, isInline: true, dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
6878
|
+
}
|
6879
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableHoverCells, decorators: [{
|
6880
|
+
type: Component,
|
6881
|
+
args: [{
|
6882
|
+
selector: 'ai-table-hover-cell',
|
6883
|
+
template: `
|
6884
|
+
@if (hoverCell()) {
|
6885
|
+
<ko-group [config]="groupConfig()">
|
6886
|
+
<ng-container *ngComponentOutlet="hoverCell()!.renderComponentDefinition; inputs: { config: hoverCellConfig() }">
|
6887
|
+
</ng-container>
|
6888
|
+
</ko-group>
|
6889
|
+
}
|
6890
|
+
`,
|
6891
|
+
standalone: true,
|
6892
|
+
imports: [KoShape, KoContainer, CommonModule],
|
6893
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
6894
|
+
}]
|
6895
|
+
}] });
|
6896
|
+
|
6654
6897
|
Konva.pixelRatio = 2;
|
6655
6898
|
class AITableRenderer {
|
6656
6899
|
constructor() {
|
@@ -6805,7 +7048,7 @@ class AITableRenderer {
|
|
6805
7048
|
this.koDblclick.emit(e);
|
6806
7049
|
}
|
6807
7050
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
6808
|
-
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 }); }
|
7051
|
+
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 <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n\n <ko-group>\n <ai-table-frozen-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-frozen-column-heads>\n </ko-group>\n\n <ko-group [config]=\"commonGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-cells [config]=\"cellsConfig()\"></ai-table-cells>\n </ko-group>\n\n <ko-group [config]=\"offsetXConfig()\">\n <ai-table-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-column-heads>\n <ai-table-add-field [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-add-field>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"attachGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-placeholder-cells [config]=\"cellsConfig()\"></ai-table-placeholder-cells>\n @if (activeCellBorderConfig().activeCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().activeCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"frozenAttachGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n @if (activeCellBorderConfig().frozenActiveCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().frozenActiveCellBorder!\"></ko-rect>\n }\n </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: KoContainer, selector: "ko-layer, ko-fastlayer, ko-group" }, { kind: "component", type: KoStage, selector: "ko-stage", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: KoShape, selector: "ko-shape, ko-circle, ko-label, ko-rect, ko-ellipse, ko-wedge, ko-line, ko-sprite, ko-image, ko-text, ko-text-path, ko-star, ko-ring, ko-arc, ko-tag, ko-path, ko-regular-polygon, ko-arrow, ko-transformer", inputs: ["config"], outputs: ["koMouseover", "koMousemove", "koMouseout", "koMouseenter", "koMouseleave", "koMousedown", "koMouseup", "koWheel", "koContextmenu", "koClick", "koDblclick", "koTouchstart", "koTouchmove", "koTouchend", "koTap", "koDbltap", "koDragstart", "koDragmove", "koDragend"] }, { kind: "component", type: AITableColumnHeads, selector: "ai-table-column-heads", inputs: ["config"] }, { kind: "component", type: AITableFrozenColumnHeads, selector: "ai-table-frozen-column-heads", inputs: ["config"] }, { kind: "component", type: AITableCells, selector: "ai-table-cells", inputs: ["config"] }, { kind: "component", type: AITableFrozenCells, selector: "ai-table-frozen-cells", inputs: ["config"] }, { kind: "component", type: AITableFrozenPlaceholderCells, selector: "ai-table-frozen-placeholder-cells", inputs: ["config"] }, { kind: "component", type: AITableHoverCells, selector: "ai-table-hover-cell", inputs: ["config"] }, { kind: "component", type: AITablePlaceholderCells, selector: "ai-table-placeholder-cells", inputs: ["config"] }, { kind: "component", type: AITableAddField, selector: "ai-table-add-field", inputs: ["config"] }, { kind: "component", type: AITableHoverRowHeads, selector: "ai-table-hover-row-heads", inputs: ["config"] }, { kind: "component", type: AITableOtherRows, selector: "ai-table-other-rows", inputs: ["config"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
6809
7052
|
}
|
6810
7053
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableRenderer, decorators: [{
|
6811
7054
|
type: Component,
|
@@ -6818,11 +7061,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
6818
7061
|
AITableCells,
|
6819
7062
|
AITableFrozenCells,
|
6820
7063
|
AITableFrozenPlaceholderCells,
|
7064
|
+
AITableHoverCells,
|
6821
7065
|
AITablePlaceholderCells,
|
6822
7066
|
AITableAddField,
|
6823
7067
|
AITableHoverRowHeads,
|
6824
|
-
AITableOtherRows
|
6825
|
-
|
7068
|
+
AITableOtherRows,
|
7069
|
+
AITableCellLink
|
7070
|
+
], 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 <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n\n <ko-group>\n <ai-table-frozen-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-frozen-column-heads>\n </ko-group>\n\n <ko-group [config]=\"commonGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-cells [config]=\"cellsConfig()\"></ai-table-cells>\n </ko-group>\n\n <ko-group [config]=\"offsetXConfig()\">\n <ai-table-column-heads [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-column-heads>\n <ai-table-add-field [config]=\"columnHeadOrAddFieldConfig()\"></ai-table-add-field>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"attachGroupConfig()\">\n <ko-group [config]=\"offsetConfig()\">\n <ai-table-placeholder-cells [config]=\"cellsConfig()\"></ai-table-placeholder-cells>\n @if (activeCellBorderConfig().activeCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().activeCellBorder!\"></ko-rect>\n }\n <ai-table-hover-cell [config]=\"cellsConfig()\"></ai-table-hover-cell>\n </ko-group>\n </ko-group>\n\n <ko-group [config]=\"frozenAttachGroupConfig()\">\n <ko-group [config]=\"offsetYConfig()\">\n @if (activeCellBorderConfig().frozenActiveCellBorder) {\n <ko-rect [config]=\"activeCellBorderConfig().frozenActiveCellBorder!\"></ko-rect>\n }\n </ko-group>\n </ko-group>\n </ko-group>\n </ko-layer>\n</ko-stage>\n\n<ng-content></ng-content>\n" }]
|
6826
7071
|
}] });
|
6827
7072
|
|
6828
7073
|
class AITableGrid extends AITableGridBase {
|
@@ -7290,5 +7535,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
7290
7535
|
* Generated bundle index. Do not edit.
|
7291
7536
|
*/
|
7292
7537
|
|
7293
|
-
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsMultiplePipe, AITableFieldSetting, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridSelectionService, AITableMemberType, AITableMouseDownType, AITableQueries, AITableRenderer, AITableRowColumnType, AITableRowType, AITableSelectAllState, AITableSelectOptionStyle, AITableStatType, AI_TABLE_ACTION_COMMON_SIZE, AI_TABLE_BLANK, AI_TABLE_CELL, AI_TABLE_CELL_ACTIVE_BORDER_WIDTH, AI_TABLE_CELL_ADD_ITEM_BUTTON_SIZE, AI_TABLE_CELL_BORDER, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE_OFFSET, AI_TABLE_CELL_EMOJI_PADDING, AI_TABLE_CELL_EMOJI_SIZE, AI_TABLE_CELL_MAX_ROW_COUNT, AI_TABLE_CELL_MEMBER_ITEM_HEIGHT, AI_TABLE_CELL_MEMBER_ITEM_PADDING, AI_TABLE_CELL_MEMBER_MAX_HEIGHT, AI_TABLE_CELL_MULTI_DOT_RADIUS, AI_TABLE_CELL_MULTI_ITEM_MARGIN_LEFT, AI_TABLE_CELL_MULTI_ITEM_MARGIN_TOP, AI_TABLE_CELL_MULTI_ITEM_MIN_WIDTH, AI_TABLE_CELL_MULTI_PADDING_LEFT, AI_TABLE_CELL_MULTI_PADDING_TOP, AI_TABLE_CELL_PADDING, AI_TABLE_COMMON_FONT_SIZE, AI_TABLE_DEFAULT_COLUMN_WIDTH, AI_TABLE_DOT_RADIUS, AI_TABLE_FIELD_ADD_BUTTON, AI_TABLE_FIELD_ADD_BUTTON_WIDTH, AI_TABLE_FIELD_HEAD, AI_TABLE_FIELD_HEAD_HEIGHT, AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE, AI_TABLE_FIELD_HEAD_MORE, AI_TABLE_FIELD_HEAD_SELECT_CHECKBOX, AI_TABLE_FIELD_HEAD_TEXT_MIN_WIDTH, AI_TABLE_GRID_FIELD_SERVICE_MAP, AI_TABLE_ICON_COMMON_SIZE, AI_TABLE_MEMBER_AVATAR_SIZE, AI_TABLE_MEMBER_ITEM_AVATAR_MARGIN_RIGHT, AI_TABLE_MEMBER_ITEM_PADDING_RIGHT, AI_TABLE_MIN_TEXT_WIDTH, AI_TABLE_OFFSET, AI_TABLE_OPTION_ITEM_FONT_SIZE, AI_TABLE_OPTION_ITEM_HEIGHT, AI_TABLE_OPTION_ITEM_PADDING, AI_TABLE_OPTION_ITEM_RADIUS, AI_TABLE_PIECE_RADIUS, AI_TABLE_PIECE_WIDTH, AI_TABLE_POPOVER_LEFT_OFFSET, AI_TABLE_PREVENT_CLEAR_SELECTION_CLASS, AI_TABLE_PROGRESS_BAR_HEIGHT, AI_TABLE_PROGRESS_BAR_RADIUS, AI_TABLE_PROGRESS_TEXT_Width, AI_TABLE_ROW_ADD_BUTTON, AI_TABLE_ROW_BLANK_HEIGHT, AI_TABLE_ROW_HEAD, AI_TABLE_ROW_HEAD_SIZE, AI_TABLE_ROW_HEAD_WIDTH, AI_TABLE_ROW_HEIGHT, AI_TABLE_ROW_SELECT_CHECKBOX, AI_TABLE_SCROLL_BAR_PADDING, AI_TABLE_TAG_FONT_SIZE, AI_TABLE_TAG_PADDING, AI_TABLE_TEXT_GAP, AbstractEditCellEditor, AddOutlinedPath, Check, Colors, ColumnCalendarFilledPath, ColumnLinkOutlinedPath, ColumnMemberFilledPath, ColumnMultipleFillPath, ColumnNumberFilledPath, ColumnProgressFilledPath, ColumnRatingFilledPath, ColumnSelectFilledPath, ColumnTextFilledPath, Coordinate, DBL_CLICK_EDIT_TYPE, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FONT_STYLE, DEFAULT_FONT_WEIGHT, DEFAULT_ICON_SHAPE, DEFAULT_ICON_SIZE, DEFAULT_POINT_POSITION, DEFAULT_SCROLL_STATE, DEFAULT_TEXT_ALIGN_CENTER, DEFAULT_TEXT_ALIGN_LEFT, DEFAULT_TEXT_ALIGN_RIGHT, DEFAULT_TEXT_DECORATION, DEFAULT_TEXT_ELLIPSIS, DEFAULT_TEXT_FILL, DEFAULT_TEXT_LINE_HEIGHT, DEFAULT_TEXT_LISTENING, DEFAULT_TEXT_MAX_CACHE, DEFAULT_TEXT_MAX_HEIGHT, DEFAULT_TEXT_SCALE, DEFAULT_TEXT_TRANSFORMS_ENABLED, DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE, DEFAULT_TEXT_VERTICAL_ALIGN_TOP, DEFAULT_TEXT_WRAP, DEFAULT_WRAP_TEXT_MAX_ROW, DateCellEditorComponent, DepartmentOutlinedPath, Direction, FONT_SIZE_SM, FieldOptions, GRID_CELL_EDITOR_MAP, IsSelectRecordPipe, LinkCellEditorComponent, MIN_COLUMN_WIDTH, MOUSEOVER_EDIT_TYPE, MemberSettingPipe, MoreStandOutlinedPath, NumberCellEditorComponent, ProgressEditorComponent, RatingCellEditorComponent, RendererContext, RowHeight, SelectCellEditorComponent, SelectOptionComponent, SelectOptionPipe, SelectOptionsPipe, SelectSettingPipe, StarFill, TextCellEditorComponent, TextMeasure, Unchecked, UserPipe, ViewOperationMap, WebOutlinedPath, buildGridData, buildGridLinearRows, castToString, compareNumber, compareString, createAITable, createActiveCellBorder, createCells, createDefaultField, createDefaultFieldName, generateTargetName, getAvatarBgColor, getAvatarShortName, getCellEditorBorderSpace, getCellHorizontalPosition, getColumnIndicesSizeMap, getDefaultFieldValue, getDetailByTargetName, getEditorBoxOffset, getEditorSpace, getFieldOptionByField, getHoverEditorBoxOffset, getHoverEditorSpace, getMousePosition, getPlaceHolderCellsConfigs, getTargetName, getTextWidth, getVisibleRangeInfo, handleMouseStyle, hasIntersect, idCreator, idsCreator, imageCache, isArrayField, isCellMatchKeywords, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, stringInclude, textDataCache, transformCellValue, zhIntlCollator };
|
7538
|
+
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsMultiplePipe, AITableFieldSetting, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridSelectionService, AITableMemberType, AITableMouseDownType, AITableQueries, AITableRenderer, AITableRowColumnType, AITableRowType, AITableSelectAllState, AITableSelectOptionStyle, AITableStatType, AI_TABLE_ACTION_COMMON_SIZE, AI_TABLE_BLANK, AI_TABLE_CELL, AI_TABLE_CELL_ACTIVE_BORDER_WIDTH, AI_TABLE_CELL_ADD_ITEM_BUTTON_SIZE, AI_TABLE_CELL_BORDER, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE, AI_TABLE_CELL_DELETE_ITEM_BUTTON_SIZE_OFFSET, AI_TABLE_CELL_EMOJI_PADDING, AI_TABLE_CELL_EMOJI_SIZE, AI_TABLE_CELL_MAX_ROW_COUNT, AI_TABLE_CELL_MEMBER_ITEM_HEIGHT, AI_TABLE_CELL_MEMBER_ITEM_PADDING, AI_TABLE_CELL_MEMBER_MAX_HEIGHT, AI_TABLE_CELL_MULTI_DOT_RADIUS, AI_TABLE_CELL_MULTI_ITEM_MARGIN_LEFT, AI_TABLE_CELL_MULTI_ITEM_MARGIN_TOP, AI_TABLE_CELL_MULTI_ITEM_MIN_WIDTH, AI_TABLE_CELL_MULTI_PADDING_LEFT, AI_TABLE_CELL_MULTI_PADDING_TOP, AI_TABLE_CELL_PADDING, AI_TABLE_COMMON_FONT_SIZE, AI_TABLE_DEFAULT_COLUMN_WIDTH, AI_TABLE_DOT_RADIUS, AI_TABLE_FIELD_ADD_BUTTON, AI_TABLE_FIELD_ADD_BUTTON_WIDTH, AI_TABLE_FIELD_HEAD, AI_TABLE_FIELD_HEAD_HEIGHT, AI_TABLE_FIELD_HEAD_ICON_GAP_SIZE, AI_TABLE_FIELD_HEAD_MORE, AI_TABLE_FIELD_HEAD_SELECT_CHECKBOX, AI_TABLE_FIELD_HEAD_TEXT_MIN_WIDTH, AI_TABLE_GRID_FIELD_SERVICE_MAP, AI_TABLE_ICON_COMMON_SIZE, AI_TABLE_MEMBER_AVATAR_SIZE, AI_TABLE_MEMBER_ITEM_AVATAR_MARGIN_RIGHT, AI_TABLE_MEMBER_ITEM_PADDING_RIGHT, AI_TABLE_MIN_TEXT_WIDTH, AI_TABLE_OFFSET, AI_TABLE_OPTION_ITEM_FONT_SIZE, AI_TABLE_OPTION_ITEM_HEIGHT, AI_TABLE_OPTION_ITEM_PADDING, AI_TABLE_OPTION_ITEM_RADIUS, AI_TABLE_PIECE_RADIUS, AI_TABLE_PIECE_WIDTH, AI_TABLE_POPOVER_LEFT_OFFSET, AI_TABLE_PREVENT_CLEAR_SELECTION_CLASS, AI_TABLE_PROGRESS_BAR_HEIGHT, AI_TABLE_PROGRESS_BAR_RADIUS, AI_TABLE_PROGRESS_TEXT_Width, AI_TABLE_ROW_ADD_BUTTON, AI_TABLE_ROW_BLANK_HEIGHT, AI_TABLE_ROW_HEAD, AI_TABLE_ROW_HEAD_SIZE, AI_TABLE_ROW_HEAD_WIDTH, AI_TABLE_ROW_HEIGHT, AI_TABLE_ROW_SELECT_CHECKBOX, AI_TABLE_SCROLL_BAR_PADDING, AI_TABLE_TAG_FONT_SIZE, AI_TABLE_TAG_PADDING, AI_TABLE_TEXT_GAP, AbstractEditCellEditor, AddOutlinedPath, Check, Colors, ColumnCalendarFilledPath, ColumnLinkOutlinedPath, ColumnMemberFilledPath, ColumnMultipleFillPath, ColumnNumberFilledPath, ColumnProgressFilledPath, ColumnRatingFilledPath, ColumnSelectFilledPath, ColumnTextFilledPath, Coordinate, DBL_CLICK_EDIT_TYPE, DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE, DEFAULT_FONT_STYLE, DEFAULT_FONT_WEIGHT, DEFAULT_ICON_SHAPE, DEFAULT_ICON_SIZE, DEFAULT_POINT_POSITION, DEFAULT_SCROLL_STATE, DEFAULT_TEXT_ALIGN_CENTER, DEFAULT_TEXT_ALIGN_LEFT, DEFAULT_TEXT_ALIGN_RIGHT, DEFAULT_TEXT_DECORATION, DEFAULT_TEXT_ELLIPSIS, DEFAULT_TEXT_FILL, DEFAULT_TEXT_LINE_HEIGHT, DEFAULT_TEXT_LISTENING, DEFAULT_TEXT_MAX_CACHE, DEFAULT_TEXT_MAX_HEIGHT, DEFAULT_TEXT_SCALE, DEFAULT_TEXT_TRANSFORMS_ENABLED, DEFAULT_TEXT_VERTICAL_ALIGN_MIDDLE, DEFAULT_TEXT_VERTICAL_ALIGN_TOP, DEFAULT_TEXT_WRAP, DEFAULT_WRAP_TEXT_MAX_ROW, DateCellEditorComponent, DepartmentOutlinedPath, Direction, FONT_SIZE_SM, FieldOptions, GRID_CELL_EDITOR_MAP, IsSelectRecordPipe, LinkCellEditorComponent, MIN_COLUMN_WIDTH, MOUSEOVER_EDIT_TYPE, MemberSettingPipe, MoreStandOutlinedPath, NumberCellEditorComponent, ProgressEditorComponent, RatingCellEditorComponent, RendererContext, RowHeight, SelectCellEditorComponent, SelectOptionComponent, SelectOptionPipe, SelectOptionsPipe, SelectSettingPipe, StarFill, TextCellEditorComponent, TextMeasure, Unchecked, UserPipe, ViewOperationMap, WebOutlinedPath, buildGridData, buildGridLinearRows, castToString, compareNumber, compareString, createAITable, createActiveCellBorder, createCells, createDefaultField, createDefaultFieldName, generateTargetName, getAvatarBgColor, getAvatarShortName, getCellEditorBorderSpace, getCellHorizontalPosition, getColumnIndicesSizeMap, getDefaultFieldValue, getDetailByTargetName, getEditorBoxOffset, getEditorSpace, getFieldOptionByField, getHoverCell, getHoverEditorBoxOffset, getHoverEditorSpace, getMousePosition, getPlaceHolderCellsConfigs, getTargetName, getTextWidth, getVisibleRangeInfo, handleMouseStyle, hasIntersect, idCreator, idsCreator, imageCache, isArrayField, isCellMatchKeywords, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSelectedField, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, stringInclude, textDataCache, transformCellValue, zhIntlCollator };
|
7294
7539
|
//# sourceMappingURL=ai-table-grid.mjs.map
|