@ai-table/grid 0.0.44 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cell-editors/date/date-editor.component.d.ts +1 -0
- package/components/cell-editors/date/date-editor.component.d.ts.map +1 -1
- package/components/cell-editors/link/edit-link/edit-link.component.d.ts +13 -3
- package/components/cell-editors/link/edit-link/edit-link.component.d.ts.map +1 -1
- package/components/cell-editors/link/link-editor.component.d.ts +1 -0
- package/components/cell-editors/link/link-editor.component.d.ts.map +1 -1
- package/components/drag/drag.component.d.ts +10 -1
- package/components/drag/drag.component.d.ts.map +1 -1
- package/components/drag/drag.component.scss +1 -1
- package/components/field-setting/field-setting.component.d.ts +17 -3
- package/components/field-setting/field-setting.component.d.ts.map +1 -1
- package/core/constants/field.d.ts +2 -2
- package/core/constants/field.d.ts.map +1 -1
- package/core/types/ai-table.d.ts +2 -0
- package/core/types/ai-table.d.ts.map +1 -1
- package/core/types/core.d.ts +4 -4
- package/core/types/core.d.ts.map +1 -1
- package/core/utils/common.d.ts +1 -0
- package/core/utils/common.d.ts.map +1 -1
- package/core/utils/field.d.ts +1 -1
- package/core/utils/field.d.ts.map +1 -1
- package/core/utils/{shoft-id.d.ts → short-id.d.ts} +1 -1
- package/core/utils/{shoft-id.d.ts.map → short-id.d.ts.map} +1 -1
- package/esm2022/components/cell-editors/date/date-editor.component.mjs +9 -3
- package/esm2022/components/cell-editors/link/edit-link/edit-link.component.mjs +27 -12
- package/esm2022/components/cell-editors/link/link-editor.component.mjs +12 -8
- package/esm2022/components/drag/drag.component.mjs +107 -79
- package/esm2022/components/field-setting/field-setting.component.mjs +28 -14
- package/esm2022/core/constants/field.mjs +95 -95
- package/esm2022/core/types/ai-table.mjs +1 -1
- package/esm2022/core/types/core.mjs +1 -2
- package/esm2022/core/utils/common.mjs +13 -1
- package/esm2022/core/utils/field.mjs +13 -8
- package/esm2022/core/utils/id-creator.mjs +2 -2
- package/esm2022/core/utils/{shoft-id.mjs → short-id.mjs} +1 -1
- package/esm2022/grid-base.component.mjs +12 -4
- package/esm2022/grid.component.mjs +17 -8
- package/esm2022/renderer/components/cells/link.component.mjs +2 -2
- package/esm2022/renderer/creations/create-active-cell-border.mjs +1 -2
- package/esm2022/renderer/creations/create-heads.mjs +3 -2
- package/esm2022/types/grid.mjs +1 -1
- package/esm2022/utils/build.mjs +5 -4
- package/esm2022/utils/cell.mjs +3 -3
- package/esm2022/utils/clipboard/paste.mjs +4 -3
- package/esm2022/utils/i18n.mjs +85 -0
- package/esm2022/utils/index.mjs +2 -1
- package/esm2022/utils/position.mjs +3 -3
- package/esm2022/utils/visible-range.mjs +3 -3
- package/fesm2022/ai-table-grid.mjs +445 -263
- package/fesm2022/ai-table-grid.mjs.map +1 -1
- package/grid-base.component.d.ts +4 -2
- package/grid-base.component.d.ts.map +1 -1
- package/grid.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/renderer/creations/create-active-cell-border.d.ts.map +1 -1
- package/renderer/creations/create-heads.d.ts.map +1 -1
- package/types/grid.d.ts +1 -1
- package/types/grid.d.ts.map +1 -1
- package/utils/build.d.ts +2 -2
- package/utils/build.d.ts.map +1 -1
- package/utils/cell.d.ts +1 -1
- package/utils/cell.d.ts.map +1 -1
- package/utils/clipboard/paste.d.ts +2 -2
- package/utils/clipboard/paste.d.ts.map +1 -1
- package/utils/i18n.d.ts +39 -0
- package/utils/i18n.d.ts.map +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.d.ts.map +1 -1
- package/utils/position.d.ts +2 -2
- package/utils/position.d.ts.map +1 -1
- package/utils/visible-range.d.ts +2 -2
- package/utils/visible-range.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,
|
2
|
+
import { signal, computed, output, inject, ElementRef, Component, ChangeDetectionStrategy, Input, input, EventEmitter, Output, ChangeDetectorRef, ViewChild, HostListener, Renderer2, Pipe, 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';
|
@@ -152,7 +152,6 @@ var AITableFieldType;
|
|
152
152
|
AITableFieldType["number"] = "number";
|
153
153
|
AITableFieldType["date"] = "date";
|
154
154
|
AITableFieldType["member"] = "member";
|
155
|
-
// cascadeSelect = 'cascade_select', // 包含单选和多选,参数复杂后续再进行设计
|
156
155
|
AITableFieldType["progress"] = "progress";
|
157
156
|
AITableFieldType["rate"] = "rate";
|
158
157
|
AITableFieldType["link"] = "link";
|
@@ -203,105 +202,189 @@ var DragType;
|
|
203
202
|
DragType["none"] = "none";
|
204
203
|
})(DragType || (DragType = {}));
|
205
204
|
|
205
|
+
var AITableGridI18nKey;
|
206
|
+
(function (AITableGridI18nKey) {
|
207
|
+
AITableGridI18nKey["dataPickerPlaceholder"] = "dataPickerPlaceholder";
|
208
|
+
AITableGridI18nKey["linkTooltip"] = "linkTooltip";
|
209
|
+
AITableGridI18nKey["invalidLinkFormat"] = "invalidLinkFormat";
|
210
|
+
AITableGridI18nKey["linkRequired"] = "linkRequired";
|
211
|
+
AITableGridI18nKey["linkText"] = "linkText";
|
212
|
+
AITableGridI18nKey["linkUrl"] = "linkUrl";
|
213
|
+
AITableGridI18nKey["inputText"] = "inputText";
|
214
|
+
AITableGridI18nKey["inputUrl"] = "inputUrl";
|
215
|
+
AITableGridI18nKey["fieldColumnName"] = "fieldColumnName";
|
216
|
+
AITableGridI18nKey["fieldColumnNamePlaceholder"] = "fieldColumnNamePlaceholder";
|
217
|
+
AITableGridI18nKey["fieldType"] = "fieldType";
|
218
|
+
AITableGridI18nKey["allowMultipleMembers"] = "allowMultipleMembers";
|
219
|
+
AITableGridI18nKey["cancel"] = "cancel";
|
220
|
+
AITableGridI18nKey["apply"] = "apply";
|
221
|
+
AITableGridI18nKey["fieldNameRequired"] = "fieldNameRequired";
|
222
|
+
AITableGridI18nKey["fieldNameDuplicate"] = "fieldNameDuplicate";
|
223
|
+
AITableGridI18nKey["confirm"] = "confirm";
|
224
|
+
AITableGridI18nKey["copiedCells"] = "copiedCells";
|
225
|
+
AITableGridI18nKey["invalidPasteContent"] = "invalidPasteContent";
|
226
|
+
AITableGridI18nKey["fieldTypeText"] = "fieldTypeText";
|
227
|
+
AITableGridI18nKey["fieldTypeSelect"] = "fieldTypeSelect";
|
228
|
+
AITableGridI18nKey["fieldTypeMultiSelect"] = "fieldTypeMultiSelect";
|
229
|
+
AITableGridI18nKey["fieldTypeNumber"] = "fieldTypeNumber";
|
230
|
+
AITableGridI18nKey["fieldTypeDate"] = "fieldTypeDate";
|
231
|
+
AITableGridI18nKey["fieldTypeMember"] = "fieldTypeMember";
|
232
|
+
AITableGridI18nKey["fieldTypeProgress"] = "fieldTypeProgress";
|
233
|
+
AITableGridI18nKey["fieldTypeRate"] = "fieldTypeRate";
|
234
|
+
AITableGridI18nKey["fieldTypeLink"] = "fieldTypeLink";
|
235
|
+
AITableGridI18nKey["fieldTypeAttachment"] = "fieldTypeAttachment";
|
236
|
+
AITableGridI18nKey["fieldTypeCreatedBy"] = "fieldTypeCreatedBy";
|
237
|
+
AITableGridI18nKey["fieldTypeCreatedAt"] = "fieldTypeCreatedAt";
|
238
|
+
AITableGridI18nKey["fieldTypeUpdatedBy"] = "fieldTypeUpdatedBy";
|
239
|
+
AITableGridI18nKey["fieldTypeUpdatedAt"] = "fieldTypeUpdatedAt";
|
240
|
+
})(AITableGridI18nKey || (AITableGridI18nKey = {}));
|
241
|
+
const AITableI18nText = {
|
242
|
+
[AITableGridI18nKey.dataPickerPlaceholder]: '选择日期',
|
243
|
+
[AITableGridI18nKey.linkTooltip]: '链接',
|
244
|
+
[AITableGridI18nKey.invalidLinkFormat]: '链接格式不正确',
|
245
|
+
[AITableGridI18nKey.linkRequired]: '链接不能为空',
|
246
|
+
[AITableGridI18nKey.linkText]: '文本',
|
247
|
+
[AITableGridI18nKey.linkUrl]: '链接',
|
248
|
+
[AITableGridI18nKey.inputText]: '输入文本',
|
249
|
+
[AITableGridI18nKey.inputUrl]: '输入链接',
|
250
|
+
[AITableGridI18nKey.fieldColumnName]: '表格列名',
|
251
|
+
[AITableGridI18nKey.fieldColumnNamePlaceholder]: '输入列名称',
|
252
|
+
[AITableGridI18nKey.fieldType]: '列类型',
|
253
|
+
[AITableGridI18nKey.allowMultipleMembers]: '允许选择多个成员',
|
254
|
+
[AITableGridI18nKey.cancel]: '取消',
|
255
|
+
[AITableGridI18nKey.apply]: '应用',
|
256
|
+
[AITableGridI18nKey.fieldNameRequired]: '列名不能为空',
|
257
|
+
[AITableGridI18nKey.fieldNameDuplicate]: '列名已存在',
|
258
|
+
[AITableGridI18nKey.confirm]: '确定',
|
259
|
+
[AITableGridI18nKey.copiedCells]: '已复制 {count} 个单元格',
|
260
|
+
[AITableGridI18nKey.invalidPasteContent]: '粘贴内容不符合当前类型', // 新增
|
261
|
+
[AITableGridI18nKey.fieldTypeText]: '单行文本',
|
262
|
+
[AITableGridI18nKey.fieldTypeSelect]: '单选',
|
263
|
+
[AITableGridI18nKey.fieldTypeMultiSelect]: '多选',
|
264
|
+
[AITableGridI18nKey.fieldTypeNumber]: '数字',
|
265
|
+
[AITableGridI18nKey.fieldTypeDate]: '日期',
|
266
|
+
[AITableGridI18nKey.fieldTypeMember]: '成员',
|
267
|
+
[AITableGridI18nKey.fieldTypeProgress]: '进度',
|
268
|
+
[AITableGridI18nKey.fieldTypeRate]: '评分',
|
269
|
+
[AITableGridI18nKey.fieldTypeLink]: '链接',
|
270
|
+
[AITableGridI18nKey.fieldTypeAttachment]: '附件',
|
271
|
+
[AITableGridI18nKey.fieldTypeCreatedBy]: '创建人',
|
272
|
+
[AITableGridI18nKey.fieldTypeCreatedAt]: '创建时间',
|
273
|
+
[AITableGridI18nKey.fieldTypeUpdatedBy]: '更新人',
|
274
|
+
[AITableGridI18nKey.fieldTypeUpdatedAt]: '更新时间'
|
275
|
+
};
|
276
|
+
const getDefaultI18nTextByKey = (key) => {
|
277
|
+
return AITableI18nText[key] || key;
|
278
|
+
};
|
279
|
+
const getI18nTextByKey = (aiTable, key) => {
|
280
|
+
if (aiTable.getI18nTextByKey) {
|
281
|
+
const customText = aiTable.getI18nTextByKey(key);
|
282
|
+
if (customText) {
|
283
|
+
return customText;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
const defaultText = getDefaultI18nTextByKey(key);
|
287
|
+
return defaultText;
|
288
|
+
};
|
289
|
+
|
206
290
|
const AI_TABLE_FIELD_MINI_WIDTH = 140;
|
207
291
|
const AI_TABLE_FIELD_MIN_WIDTH = 160;
|
208
292
|
const AI_TABLE_FIELD_MIDDLE_WIDTH = 200;
|
209
293
|
const AI_TABLE_FIELD_MAX_WIDTH = 300;
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
];
|
294
|
+
function getFieldOptions(aiTable) {
|
295
|
+
return [
|
296
|
+
{
|
297
|
+
type: AITableFieldType.text,
|
298
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeText),
|
299
|
+
icon: 'font',
|
300
|
+
width: AI_TABLE_FIELD_MAX_WIDTH
|
301
|
+
},
|
302
|
+
{
|
303
|
+
type: AITableFieldType.select,
|
304
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeSelect),
|
305
|
+
icon: 'check-circle',
|
306
|
+
width: AI_TABLE_FIELD_MIN_WIDTH
|
307
|
+
},
|
308
|
+
{
|
309
|
+
type: AITableFieldType.select,
|
310
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeMultiSelect),
|
311
|
+
icon: 'list-check',
|
312
|
+
width: AI_TABLE_FIELD_MIDDLE_WIDTH,
|
313
|
+
settings: {
|
314
|
+
is_multiple: true
|
315
|
+
}
|
316
|
+
},
|
317
|
+
{
|
318
|
+
type: AITableFieldType.number,
|
319
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeNumber),
|
320
|
+
icon: 'hashtag',
|
321
|
+
width: AI_TABLE_FIELD_MINI_WIDTH
|
322
|
+
},
|
323
|
+
{
|
324
|
+
type: AITableFieldType.date,
|
325
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeDate),
|
326
|
+
icon: 'calendar',
|
327
|
+
width: AI_TABLE_FIELD_MIDDLE_WIDTH
|
328
|
+
},
|
329
|
+
{
|
330
|
+
type: AITableFieldType.member,
|
331
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeMember),
|
332
|
+
icon: 'user',
|
333
|
+
width: AI_TABLE_FIELD_MIN_WIDTH,
|
334
|
+
settings: {
|
335
|
+
is_multiple: false
|
336
|
+
}
|
337
|
+
},
|
338
|
+
{
|
339
|
+
type: AITableFieldType.progress,
|
340
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeProgress),
|
341
|
+
icon: 'progress',
|
342
|
+
width: AI_TABLE_FIELD_MIDDLE_WIDTH
|
343
|
+
},
|
344
|
+
{
|
345
|
+
type: AITableFieldType.rate,
|
346
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeRate),
|
347
|
+
icon: 'star-circle',
|
348
|
+
width: AI_TABLE_FIELD_MIN_WIDTH
|
349
|
+
},
|
350
|
+
{
|
351
|
+
type: AITableFieldType.link,
|
352
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeLink),
|
353
|
+
icon: 'link-insert',
|
354
|
+
width: AI_TABLE_FIELD_MIDDLE_WIDTH
|
355
|
+
},
|
356
|
+
{
|
357
|
+
type: AITableFieldType.attachment,
|
358
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeAttachment),
|
359
|
+
icon: 'attachment',
|
360
|
+
width: AI_TABLE_FIELD_MIDDLE_WIDTH
|
361
|
+
},
|
362
|
+
{
|
363
|
+
type: AITableFieldType.createdBy,
|
364
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeCreatedBy),
|
365
|
+
icon: 'user',
|
366
|
+
width: AI_TABLE_FIELD_MIN_WIDTH
|
367
|
+
},
|
368
|
+
{
|
369
|
+
type: AITableFieldType.createdAt,
|
370
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeCreatedAt),
|
371
|
+
icon: 'calendar',
|
372
|
+
width: AI_TABLE_FIELD_MIDDLE_WIDTH
|
373
|
+
},
|
374
|
+
{
|
375
|
+
type: AITableFieldType.updatedBy,
|
376
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeUpdatedBy),
|
377
|
+
icon: 'user',
|
378
|
+
width: AI_TABLE_FIELD_MIN_WIDTH
|
379
|
+
},
|
380
|
+
{
|
381
|
+
type: AITableFieldType.updatedAt,
|
382
|
+
name: getI18nTextByKey(aiTable, AITableGridI18nKey.fieldTypeUpdatedAt),
|
383
|
+
icon: 'calendar',
|
384
|
+
width: AI_TABLE_FIELD_MIDDLE_WIDTH
|
385
|
+
}
|
386
|
+
];
|
387
|
+
}
|
305
388
|
|
306
389
|
var AITableAvatarSize;
|
307
390
|
(function (AITableAvatarSize) {
|
@@ -674,6 +757,49 @@ function shortIdsCreator(count) {
|
|
674
757
|
return shortId(undefined, 8, count);
|
675
758
|
}
|
676
759
|
|
760
|
+
function createAITable(records, fields, gridData) {
|
761
|
+
const aiTable = {
|
762
|
+
records,
|
763
|
+
fields,
|
764
|
+
gridData,
|
765
|
+
selection: signal({
|
766
|
+
selectedRecords: new Set(),
|
767
|
+
selectedFields: new Set(),
|
768
|
+
selectedCells: new Set(),
|
769
|
+
activeCell: null,
|
770
|
+
selectAllState: AITableSelectAllState.none
|
771
|
+
}),
|
772
|
+
keywordsMatchedCells: signal(new Set()),
|
773
|
+
recordsMap: computed(() => {
|
774
|
+
return records().reduce((object, item) => {
|
775
|
+
object[item._id] = item;
|
776
|
+
return object;
|
777
|
+
}, {});
|
778
|
+
}),
|
779
|
+
fieldsMap: computed(() => {
|
780
|
+
return fields().reduce((object, item) => {
|
781
|
+
object[item._id] = item;
|
782
|
+
return object;
|
783
|
+
}, {});
|
784
|
+
}),
|
785
|
+
recordsWillHidden: signal([]),
|
786
|
+
recordsWillMove: signal([])
|
787
|
+
};
|
788
|
+
return aiTable;
|
789
|
+
}
|
790
|
+
function generateNewName(existNames, count, name) {
|
791
|
+
let newName = name;
|
792
|
+
let suffix = count;
|
793
|
+
if (count > 1) {
|
794
|
+
newName = `${name} ${suffix}`;
|
795
|
+
}
|
796
|
+
while (existNames.includes(newName)) {
|
797
|
+
suffix++;
|
798
|
+
newName = `${name} ${suffix}`;
|
799
|
+
}
|
800
|
+
return newName;
|
801
|
+
}
|
802
|
+
|
677
803
|
const isArrayField = (field) => {
|
678
804
|
return [
|
679
805
|
AITableFieldType.member,
|
@@ -699,17 +825,20 @@ function getDefaultFieldValue(field) {
|
|
699
825
|
return '';
|
700
826
|
}
|
701
827
|
function createDefaultFieldName(aiTable, field) {
|
702
|
-
const fieldOption = getFieldOptionByField(field);
|
828
|
+
const fieldOption = getFieldOptionByField(aiTable, field);
|
703
829
|
if (fieldOption) {
|
830
|
+
const allNames = aiTable.fields().map((item) => item.name);
|
704
831
|
const count = aiTable.fields().filter((item) => {
|
705
832
|
return isSameFieldOption(field, item);
|
706
833
|
}).length;
|
707
|
-
return count
|
834
|
+
return generateNewName(allNames, count, fieldOption.name);
|
708
835
|
}
|
709
|
-
|
836
|
+
const fieldOptions = getFieldOptions(aiTable);
|
837
|
+
return fieldOptions[0].name;
|
710
838
|
}
|
711
|
-
function getFieldOptionByField(field) {
|
712
|
-
|
839
|
+
function getFieldOptionByField(aiTable, field) {
|
840
|
+
const fieldOptions = getFieldOptions(aiTable);
|
841
|
+
let fieldOption = fieldOptions.find((item) => isSameFieldOption(item, field));
|
713
842
|
if (fieldOption && field.type === AITableFieldType.member && field.settings?.is_multiple) {
|
714
843
|
fieldOption.width = AI_TABLE_FIELD_MIDDLE_WIDTH;
|
715
844
|
}
|
@@ -722,41 +851,11 @@ function isSameFieldOption(fieldOption, field) {
|
|
722
851
|
: true));
|
723
852
|
}
|
724
853
|
function createDefaultField(aiTable, type = AITableFieldType.text) {
|
725
|
-
const
|
854
|
+
const fieldOptions = getFieldOptions(aiTable);
|
855
|
+
const fieldOption = fieldOptions.find((item) => item.type === type);
|
726
856
|
return { _id: idCreator(), type, name: createDefaultFieldName(aiTable, fieldOption) };
|
727
857
|
}
|
728
858
|
|
729
|
-
function createAITable(records, fields, gridData) {
|
730
|
-
const aiTable = {
|
731
|
-
records,
|
732
|
-
fields,
|
733
|
-
gridData,
|
734
|
-
selection: signal({
|
735
|
-
selectedRecords: new Set(),
|
736
|
-
selectedFields: new Set(),
|
737
|
-
selectedCells: new Set(),
|
738
|
-
activeCell: null,
|
739
|
-
selectAllState: AITableSelectAllState.none
|
740
|
-
}),
|
741
|
-
keywordsMatchedCells: signal(new Set()),
|
742
|
-
recordsMap: computed(() => {
|
743
|
-
return records().reduce((object, item) => {
|
744
|
-
object[item._id] = item;
|
745
|
-
return object;
|
746
|
-
}, {});
|
747
|
-
}),
|
748
|
-
fieldsMap: computed(() => {
|
749
|
-
return fields().reduce((object, item) => {
|
750
|
-
object[item._id] = item;
|
751
|
-
return object;
|
752
|
-
}, {});
|
753
|
-
}),
|
754
|
-
recordsWillHidden: signal([]),
|
755
|
-
recordsWillMove: signal([])
|
756
|
-
};
|
757
|
-
return aiTable;
|
758
|
-
}
|
759
|
-
|
760
859
|
function getFieldValue(record, field) {
|
761
860
|
if (isSystemField(field)) {
|
762
861
|
return getSystemFieldValue(record, field.type);
|
@@ -917,6 +1016,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
917
1016
|
}] } });
|
918
1017
|
|
919
1018
|
class DateCellEditorComponent extends AbstractEditCellEditor {
|
1019
|
+
constructor() {
|
1020
|
+
super(...arguments);
|
1021
|
+
this.placeholder = '';
|
1022
|
+
}
|
920
1023
|
ngOnInit() {
|
921
1024
|
this.modelValue = computed(() => {
|
922
1025
|
const value = AITableQueries.getFieldValue(this.aiTable, [this.record()._id, this.field()._id]);
|
@@ -927,6 +1030,7 @@ class DateCellEditorComponent extends AbstractEditCellEditor {
|
|
927
1030
|
}
|
928
1031
|
return value;
|
929
1032
|
})();
|
1033
|
+
this.placeholder = getI18nTextByKey(this.aiTable, AITableGridI18nKey.dataPickerPlaceholder);
|
930
1034
|
}
|
931
1035
|
updateValue(value) {
|
932
1036
|
this.updateFieldValue.emit({
|
@@ -945,7 +1049,7 @@ class DateCellEditorComponent extends AbstractEditCellEditor {
|
|
945
1049
|
<thy-date-picker
|
946
1050
|
class="h-100"
|
947
1051
|
thyTimestampPrecision="seconds"
|
948
|
-
thyPlaceHolder="
|
1052
|
+
[thyPlaceHolder]="placeholder"
|
949
1053
|
[ngModel]="modelValue.timestamp"
|
950
1054
|
(ngModelChange)="updateValue($event)"
|
951
1055
|
(thyOpenChange)="thyOpenChange($event)"
|
@@ -967,7 +1071,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
967
1071
|
<thy-date-picker
|
968
1072
|
class="h-100"
|
969
1073
|
thyTimestampPrecision="seconds"
|
970
|
-
thyPlaceHolder="
|
1074
|
+
[thyPlaceHolder]="placeholder"
|
971
1075
|
[ngModel]="modelValue.timestamp"
|
972
1076
|
(ngModelChange)="updateValue($event)"
|
973
1077
|
(thyOpenChange)="thyOpenChange($event)"
|
@@ -998,23 +1102,37 @@ class LinkEditComponent {
|
|
998
1102
|
this.thyPopoverRef = thyPopoverRef;
|
999
1103
|
this.url = '';
|
1000
1104
|
this.text = '';
|
1105
|
+
this.aiTable = input();
|
1001
1106
|
this.confirm = new EventEmitter();
|
1002
1107
|
this.URLRegex = LINK_URL_REGEX;
|
1003
|
-
this.
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1108
|
+
this.i18nTexts = computed(() => {
|
1109
|
+
return {
|
1110
|
+
linkText: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.linkText),
|
1111
|
+
textPlaceholder: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.inputText),
|
1112
|
+
urlLabel: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.linkUrl),
|
1113
|
+
urlPlaceholder: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.inputUrl),
|
1114
|
+
cancel: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.cancel),
|
1115
|
+
apply: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.apply)
|
1116
|
+
};
|
1117
|
+
});
|
1118
|
+
this.validatorConfig = computed(() => {
|
1119
|
+
return {
|
1120
|
+
validationMessages: {
|
1121
|
+
url: {
|
1122
|
+
pattern: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.invalidLinkFormat)
|
1123
|
+
}
|
1007
1124
|
}
|
1008
|
-
}
|
1009
|
-
};
|
1125
|
+
};
|
1126
|
+
});
|
1127
|
+
}
|
1128
|
+
ngOnInit() {
|
1010
1129
|
}
|
1011
|
-
ngOnInit() { }
|
1012
1130
|
close() {
|
1013
1131
|
this.thyPopoverRef.close();
|
1014
1132
|
}
|
1015
1133
|
apply(form) {
|
1016
1134
|
if (this.text && !this.url) {
|
1017
|
-
form.validator.setElementErrorMessage('url',
|
1135
|
+
form.validator.setElementErrorMessage('url', getI18nTextByKey(this.aiTable(), AITableGridI18nKey.linkRequired));
|
1018
1136
|
return;
|
1019
1137
|
}
|
1020
1138
|
this.close();
|
@@ -1024,7 +1142,7 @@ class LinkEditComponent {
|
|
1024
1142
|
this.confirm.emit(link);
|
1025
1143
|
}
|
1026
1144
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LinkEditComponent, deps: [{ token: i1$1.ThyPopoverRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
1027
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
1145
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.2.13", type: LinkEditComponent, isStandalone: true, selector: "link-edit", inputs: { url: { classPropertyName: "url", publicName: "url", isSignal: false, isRequired: false, transformFunction: null }, text: { classPropertyName: "text", publicName: "text", isSignal: false, isRequired: false, transformFunction: null }, aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { confirm: "confirm" }, ngImport: i0, template: "<form\n thyLayout=\"vertical\"\n thyStopPropagation\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig()\"\n name=\"linkForm\"\n class=\"p-5\"\n>\n <thy-form-group [thyLabelText]=\"i18nTexts().linkText\">\n <input thyInput [placeholder]=\"i18nTexts().textPlaceholder\" />\n </thy-form-group>\n <thy-form-group [thyLabelText]=\"i18nTexts().urlLabel\">\n <input name=\"url\" thyInput [placeholder]=\"i18nTexts().urlPlaceholder\" [pattern]=\"URLRegex\" type=\"text\" [(ngModel)]=\"url\" />\n </thy-form-group>\n <thy-form-group-footer thyAlign=\"right\">\n <div class=\"btn-pair\">\n <button thyStopPropagation thyButton=\"link-secondary\" thySize=\"sm\" (click)=\"close()\">{{i18nTexts().cancel}}</button>\n <button thyStopPropagation thyButton=\"primary\" thySize=\"sm\" (thyFormSubmit)=\"apply(linkForm)\">{{i18nTexts().apply}}</button>\n </div>\n </thy-form-group-footer>\n</form>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "directive", type: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "component", type: ThyButton, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thyBlock"] }, { kind: "directive", type: ThyFormSubmitDirective, selector: "[thyFormSubmit],[thy-form-submit]", outputs: ["thyFormSubmit"] }, { kind: "ngmodule", type: ThyFormModule }, { kind: "directive", type: i2.ThyFormDirective, selector: "[thyForm],[thy-form]", inputs: ["thyLayout", "thyEnterKeyMode", "thyFormValidatorConfig"], exportAs: ["thyForm"] }, { kind: "component", type: i2.ThyFormGroup, selector: "thy-form-group", inputs: ["thyLabelText", "thyLabelTextTranslateKey", "thyLabelRequired", "thyLabelPaddingTopClear", "thyFeedbackIcon", "thyTipsMode", "thyTips", "thyTipsTranslateKey", "thyRowFill"] }, { kind: "component", type: i2.ThyFormGroupFooter, selector: "thy-form-group-footer", inputs: ["thyAlign"] }] }); }
|
1028
1146
|
}
|
1029
1147
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LinkEditComponent, decorators: [{
|
1030
1148
|
type: Component,
|
@@ -1036,7 +1154,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
1036
1154
|
ThyButton,
|
1037
1155
|
ThyFormSubmitDirective,
|
1038
1156
|
ThyFormModule
|
1039
|
-
], template: "<form\n thyLayout=\"vertical\"\n thyStopPropagation\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig\"\n name=\"linkForm\"\n class=\"p-5\"\n>\n <thy-form-group thyLabelText=\"\
|
1157
|
+
], template: "<form\n thyLayout=\"vertical\"\n thyStopPropagation\n thyForm\n #linkForm=\"thyForm\"\n [thyFormValidatorConfig]=\"validatorConfig()\"\n name=\"linkForm\"\n class=\"p-5\"\n>\n <thy-form-group [thyLabelText]=\"i18nTexts().linkText\">\n <input thyInput [placeholder]=\"i18nTexts().textPlaceholder\" />\n </thy-form-group>\n <thy-form-group [thyLabelText]=\"i18nTexts().urlLabel\">\n <input name=\"url\" thyInput [placeholder]=\"i18nTexts().urlPlaceholder\" [pattern]=\"URLRegex\" type=\"text\" [(ngModel)]=\"url\" />\n </thy-form-group>\n <thy-form-group-footer thyAlign=\"right\">\n <div class=\"btn-pair\">\n <button thyStopPropagation thyButton=\"link-secondary\" thySize=\"sm\" (click)=\"close()\">{{i18nTexts().cancel}}</button>\n <button thyStopPropagation thyButton=\"primary\" thySize=\"sm\" (thyFormSubmit)=\"apply(linkForm)\">{{i18nTexts().apply}}</button>\n </div>\n </thy-form-group-footer>\n</form>\n" }]
|
1040
1158
|
}], ctorParameters: () => [{ type: i1$1.ThyPopoverRef }], propDecorators: { url: [{
|
1041
1159
|
type: Input
|
1042
1160
|
}], text: [{
|
@@ -1055,6 +1173,9 @@ class LinkCellEditorComponent extends AbstractEditCellEditor {
|
|
1055
1173
|
this.cdr = inject(ChangeDetectorRef);
|
1056
1174
|
this.notifyService = inject(ThyNotifyService);
|
1057
1175
|
this.isOpened = false;
|
1176
|
+
this.linkTooltip = computed(() => {
|
1177
|
+
return getI18nTextByKey(this.aiTable, AITableGridI18nKey.linkTooltip);
|
1178
|
+
});
|
1058
1179
|
}
|
1059
1180
|
isValidLink(link) {
|
1060
1181
|
if (!link?.text?.trim()) {
|
@@ -1089,7 +1210,7 @@ class LinkCellEditorComponent extends AbstractEditCellEditor {
|
|
1089
1210
|
}
|
1090
1211
|
updateValue() {
|
1091
1212
|
if (!this.isValidLink({ text: this.text, url: this.url ?? '' })) {
|
1092
|
-
this.notifyService.error(
|
1213
|
+
this.notifyService.error(getI18nTextByKey(this.aiTable, AITableGridI18nKey.invalidLinkFormat));
|
1093
1214
|
return;
|
1094
1215
|
}
|
1095
1216
|
this.modelValue = this.createLinkValue({ text: this.text, url: this.url ?? '' });
|
@@ -1108,7 +1229,8 @@ class LinkCellEditorComponent extends AbstractEditCellEditor {
|
|
1108
1229
|
width: this.elementRef.nativeElement.clientWidth + 'px',
|
1109
1230
|
initialState: {
|
1110
1231
|
url: this.url ?? '',
|
1111
|
-
text: this.text ?? ''
|
1232
|
+
text: this.text ?? '',
|
1233
|
+
aiTable: this.aiTable
|
1112
1234
|
}
|
1113
1235
|
});
|
1114
1236
|
if (popoverRef) {
|
@@ -1124,7 +1246,7 @@ class LinkCellEditorComponent extends AbstractEditCellEditor {
|
|
1124
1246
|
}
|
1125
1247
|
}
|
1126
1248
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LinkCellEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
1127
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: LinkCellEditorComponent, isStandalone: true, selector: "link-cell-editor", host: { classAttribute: "ai-table-link-editor" }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<thy-input-group class=\"link-input-group h-100\" thySize=\"lg\">\n <input\n #inputElement\n class=\"h-100\"\n class=\"link-input\"\n thyInput\n thySize=\"md\"\n [thyAutofocus]=\"true\"\n [(ngModel)]=\"text\"\n (blur)=\"blur($event)\"\n (thyEnter)=\"updateValue()\"\n />\n <ng-template #suffix>\n <a\n thyAction\n thyIcon=\"link-insert\"\n thyTooltip=\"\
|
1249
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: LinkCellEditorComponent, isStandalone: true, selector: "link-cell-editor", host: { classAttribute: "ai-table-link-editor" }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<thy-input-group class=\"link-input-group h-100\" thySize=\"lg\">\n <input\n #inputElement\n class=\"h-100\"\n class=\"link-input\"\n thyInput\n thySize=\"md\"\n [thyAutofocus]=\"true\"\n [(ngModel)]=\"text\"\n (blur)=\"blur($event)\"\n (thyEnter)=\"updateValue()\"\n />\n <ng-template #suffix>\n <a\n thyAction\n thyIcon=\"link-insert\"\n [thyTooltip]=\"linkTooltip()\"\n class=\"font-size-base edit-icon\"\n [class.active]=\"isOpened\"\n href=\"javascript:;\"\n (click)=\"openEdit()\"\n ></a>\n </ng-template>\n</thy-input-group>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { 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: "directive", type: ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutofocus", "thyAutoSelect"] }, { kind: "directive", type: ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "component", type: ThyInputGroup, selector: "thy-input-group", inputs: ["thyAppendText", "thyAppendTextTranslateKey", "thyPrependText", "thyPrependTextTranslateKey", "thySize"] }, { kind: "ngmodule", type: ThyTooltipModule }, { kind: "directive", type: i2$1.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "ngmodule", type: ThyInputModule }, { kind: "directive", type: i3.ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "ngmodule", type: ThyFlexibleTextModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1128
1250
|
}
|
1129
1251
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LinkCellEditorComponent, decorators: [{
|
1130
1252
|
type: Component,
|
@@ -1136,11 +1258,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
1136
1258
|
ThyTooltipModule,
|
1137
1259
|
ThyAction,
|
1138
1260
|
ThyInputModule,
|
1139
|
-
ThyFlexibleTextModule
|
1140
|
-
LinkEditComponent
|
1261
|
+
ThyFlexibleTextModule
|
1141
1262
|
], host: {
|
1142
1263
|
class: 'ai-table-link-editor'
|
1143
|
-
}, template: "<thy-input-group class=\"link-input-group h-100\" thySize=\"lg\">\n <input\n #inputElement\n class=\"h-100\"\n class=\"link-input\"\n thyInput\n thySize=\"md\"\n [thyAutofocus]=\"true\"\n [(ngModel)]=\"text\"\n (blur)=\"blur($event)\"\n (thyEnter)=\"updateValue()\"\n />\n <ng-template #suffix>\n <a\n thyAction\n thyIcon=\"link-insert\"\n thyTooltip=\"\
|
1264
|
+
}, template: "<thy-input-group class=\"link-input-group h-100\" thySize=\"lg\">\n <input\n #inputElement\n class=\"h-100\"\n class=\"link-input\"\n thyInput\n thySize=\"md\"\n [thyAutofocus]=\"true\"\n [(ngModel)]=\"text\"\n (blur)=\"blur($event)\"\n (thyEnter)=\"updateValue()\"\n />\n <ng-template #suffix>\n <a\n thyAction\n thyIcon=\"link-insert\"\n [thyTooltip]=\"linkTooltip()\"\n class=\"font-size-base edit-icon\"\n [class.active]=\"isOpened\"\n href=\"javascript:;\"\n (click)=\"openEdit()\"\n ></a>\n </ng-template>\n</thy-input-group>\n" }]
|
1144
1265
|
}], propDecorators: { inputElement: [{
|
1145
1266
|
type: ViewChild,
|
1146
1267
|
args: ['inputElement', { static: false }]
|
@@ -1529,18 +1650,22 @@ class AITableFieldSetting {
|
|
1529
1650
|
this.addField = output();
|
1530
1651
|
this.setField = output();
|
1531
1652
|
this.selectedFieldOption = computed(() => {
|
1532
|
-
return getFieldOptionByField(this.aiEditField());
|
1653
|
+
return getFieldOptionByField(this.aiTable(), this.aiEditField());
|
1533
1654
|
});
|
1534
1655
|
this.fieldMaxLength = 32;
|
1535
|
-
this.validatorConfig = {
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1656
|
+
this.validatorConfig = computed(() => {
|
1657
|
+
return {
|
1658
|
+
validationMessages: {
|
1659
|
+
fieldName: {
|
1660
|
+
required: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.fieldNameRequired),
|
1661
|
+
thyUniqueCheck: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.fieldNameDuplicate)
|
1662
|
+
}
|
1540
1663
|
}
|
1541
|
-
}
|
1542
|
-
};
|
1543
|
-
this.fieldOptions =
|
1664
|
+
};
|
1665
|
+
});
|
1666
|
+
this.fieldOptions = computed(() => {
|
1667
|
+
return getFieldOptions(this.aiTable());
|
1668
|
+
});
|
1544
1669
|
this.aITableFieldType = AITableFieldType;
|
1545
1670
|
this.isMultipleMember = false;
|
1546
1671
|
this.thyPopoverRef = inject((ThyPopoverRef));
|
@@ -1550,6 +1675,16 @@ class AITableFieldSetting {
|
|
1550
1675
|
.fields()
|
1551
1676
|
?.find((field) => field.name === fieldName && this.aiEditField()?._id !== field._id));
|
1552
1677
|
};
|
1678
|
+
this.i18nTexts = computed(() => {
|
1679
|
+
return {
|
1680
|
+
columnName: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.fieldColumnName),
|
1681
|
+
columnNamePlaceholder: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.fieldColumnNamePlaceholder),
|
1682
|
+
fieldType: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.fieldType),
|
1683
|
+
allowMultipleMembers: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.allowMultipleMembers),
|
1684
|
+
cancel: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.cancel),
|
1685
|
+
confirm: getI18nTextByKey(this.aiTable(), AITableGridI18nKey.confirm)
|
1686
|
+
};
|
1687
|
+
});
|
1553
1688
|
}
|
1554
1689
|
ngOnInit() {
|
1555
1690
|
this.isMultipleMember =
|
@@ -1595,7 +1730,7 @@ class AITableFieldSetting {
|
|
1595
1730
|
this.thyPopoverRef.close();
|
1596
1731
|
}
|
1597
1732
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableFieldSetting, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1598
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableFieldSetting, isStandalone: true, selector: "ai-table-field-setting", inputs: { aiEditField: { classPropertyName: "aiEditField", publicName: "aiEditField", isSignal: true, isRequired: true, transformFunction: null }, aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: true, isRequired: true, transformFunction: null }, aiExternalTemplate: { classPropertyName: "aiExternalTemplate", publicName: "aiExternalTemplate", isSignal: true, isRequired: false, transformFunction: null }, isUpdate: { classPropertyName: "isUpdate", publicName: "isUpdate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { aiEditField: "aiEditFieldChange", addField: "addField", setField: "setField" }, host: { classAttribute: "field-setting d-block pl-5 pr-5 pb-5 pt-4" }, ngImport: i0, template: "<form thyForm name=\"createPropertyForm\" [thyFormValidatorConfig]=\"validatorConfig\" thyLayout=\"vertical\">\n <thy-form-group thyLabelRequired thyLabelText=\"\
|
1733
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: AITableFieldSetting, isStandalone: true, selector: "ai-table-field-setting", inputs: { aiEditField: { classPropertyName: "aiEditField", publicName: "aiEditField", isSignal: true, isRequired: true, transformFunction: null }, aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: true, isRequired: true, transformFunction: null }, aiExternalTemplate: { classPropertyName: "aiExternalTemplate", publicName: "aiExternalTemplate", isSignal: true, isRequired: false, transformFunction: null }, isUpdate: { classPropertyName: "isUpdate", publicName: "isUpdate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { aiEditField: "aiEditFieldChange", addField: "addField", setField: "setField" }, host: { classAttribute: "field-setting d-block pl-5 pr-5 pb-5 pt-4" }, ngImport: i0, template: "<form thyForm name=\"createPropertyForm\" [thyFormValidatorConfig]=\"validatorConfig()\" thyLayout=\"vertical\">\n <thy-form-group thyLabelRequired [thyLabelText]=\"i18nTexts().columnName\">\n <thy-input-group>\n <input\n thyInput\n [thyAutofocus]=\"true\"\n name=\"fieldName\"\n [maxlength]=\"fieldMaxLength\"\n [(ngModel)]=\"aiEditField().name\"\n required\n [placeholder]=\"i18nTexts().columnNamePlaceholder\"\n [thyUniqueCheck]=\"checkUniqueName\"\n />\n <ng-template #suffix>\n <thy-input-count></thy-input-count>\n </ng-template>\n </thy-input-group>\n </thy-form-group>\n <thy-form-group [thyLabelText]=\"i18nTexts().fieldType\">\n <div class=\"thy-dropdown-menu py-0\">\n <div class=\"ml-n5 mr-n5\">\n <span\n thyDropdownMenuItem\n [thyDropdown]=\"menu\"\n [thyDisabled]=\"isUpdate()\"\n thyTrigger=\"hover\"\n thyPlacement=\"right\"\n (click)=\"fieldTypeClick($event)\"\n >\n <thy-icon thyDropdownMenuItemIcon [thyIconName]=\"selectedFieldOption().icon\"></thy-icon>\n <span thyDropdownMenuItemName>{{ selectedFieldOption().name }}</span>\n <thy-icon thyDropdownMenuItemExtendIcon thyIconName=\"angle-right\" class=\"text-desc\"></thy-icon>\n </span>\n </div>\n </div>\n\n @if (selectedFieldOption().type === aITableFieldType.member) {\n <div class=\"d-flex justify-content-between mt-3\">\n {{i18nTexts().allowMultipleMembers}}\n <thy-switch\n name=\"isMultipleMember\"\n [thyDisabled]=\"isUpdate()\"\n [(ngModel)]=\"isMultipleMember\"\n (ngModelChange)=\"multipleMemberChange()\"\n thySize=\"sm\"\n ></thy-switch>\n </div>\n }\n </thy-form-group>\n @if (aiExternalTemplate()) {\n <ng-container *ngTemplateOutlet=\"aiExternalTemplate()\"></ng-container>\n }\n <thy-form-group-footer thyAlign=\"right\">\n <button thyButton=\"link-secondary\" (click)=\"cancel()\" thySize=\"sm\">{{i18nTexts().cancel}}</button>\n <button thyButton=\"primary\" (thyFormSubmit)=\"editFieldProperty()\" thySize=\"sm\">{{i18nTexts().confirm}}</button>\n </thy-form-group-footer>\n</form>\n\n<thy-dropdown-menu #menu>\n @for (item of fieldOptions(); track $index) {\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{\n active: (item | fieldIsSameOption: aiEditField())\n }\"\n (click)=\"selectFieldType(item)\"\n >\n <thy-icon [thyIconName]=\"item.icon!\"></thy-icon>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n </a>\n }\n</thy-dropdown-menu>\n", styles: [":host{width:350px}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "component", type: ThyInputGroup, selector: "thy-input-group", inputs: ["thyAppendText", "thyAppendTextTranslateKey", "thyPrependText", "thyPrependTextTranslateKey", "thySize"] }, { kind: "component", type: ThyInputCount, selector: "thy-input-count", inputs: ["thyInput"] }, { kind: "directive", type: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "directive", type: ThyUniqueCheckValidator, selector: "[thyUniqueCheck]", inputs: ["thyUniqueCheck"] }, { kind: "component", type: ThyDropdownMenuComponent, selector: "thy-dropdown-menu", inputs: ["thyWidth", "thyImmediateRender"] }, { kind: "directive", type: ThyDropdownDirective, selector: "[thyDropdown]", inputs: ["thyDropdownMenu", "thyDropdown", "thyTrigger", "thyShowDelay", "thyHideDelay", "thyActiveClass", "thyPopoverOptions", "thyPlacement", "thyMenuInsideClosable", "thyPanelClass"], outputs: ["thyActiveChange"] }, { kind: "directive", type: ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: ThyDropdownMenuItemIconDirective, selector: "[thyDropdownMenuItemIcon]" }, { kind: "directive", type: ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "directive", type: ThyDropdownMenuItemExtendIconDirective, selector: "[thyDropdownMenuItemExtendIcon]" }, { kind: "component", type: ThyButton, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thyBlock"] }, { kind: "component", type: ThySwitch, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled", "thyLoading"], outputs: ["thyChange"] }, { kind: "ngmodule", type: ThyFormModule }, { kind: "directive", type: i2.ThyFormDirective, selector: "[thyForm],[thy-form]", inputs: ["thyLayout", "thyEnterKeyMode", "thyFormValidatorConfig"], exportAs: ["thyForm"] }, { kind: "component", type: i2.ThyFormGroup, selector: "thy-form-group", inputs: ["thyLabelText", "thyLabelTextTranslateKey", "thyLabelRequired", "thyLabelPaddingTopClear", "thyFeedbackIcon", "thyTipsMode", "thyTips", "thyTipsTranslateKey", "thyRowFill"] }, { kind: "directive", type: i2.ThyFormSubmitDirective, selector: "[thyFormSubmit],[thy-form-submit]", outputs: ["thyFormSubmit"] }, { kind: "component", type: i2.ThyFormGroupFooter, selector: "thy-form-group-footer", inputs: ["thyAlign"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutofocus", "thyAutoSelect"] }, { kind: "pipe", type: AITableFieldIsSameOptionPipe, name: "fieldIsSameOption" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1599
1734
|
}
|
1600
1735
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableFieldSetting, decorators: [{
|
1601
1736
|
type: Component,
|
@@ -1621,7 +1756,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
1621
1756
|
AITableFieldIsSameOptionPipe
|
1622
1757
|
], host: {
|
1623
1758
|
class: 'field-setting d-block pl-5 pr-5 pb-5 pt-4'
|
1624
|
-
}, template: "<form thyForm name=\"createPropertyForm\" [thyFormValidatorConfig]=\"validatorConfig\" thyLayout=\"vertical\">\n <thy-form-group thyLabelRequired thyLabelText=\"\
|
1759
|
+
}, template: "<form thyForm name=\"createPropertyForm\" [thyFormValidatorConfig]=\"validatorConfig()\" thyLayout=\"vertical\">\n <thy-form-group thyLabelRequired [thyLabelText]=\"i18nTexts().columnName\">\n <thy-input-group>\n <input\n thyInput\n [thyAutofocus]=\"true\"\n name=\"fieldName\"\n [maxlength]=\"fieldMaxLength\"\n [(ngModel)]=\"aiEditField().name\"\n required\n [placeholder]=\"i18nTexts().columnNamePlaceholder\"\n [thyUniqueCheck]=\"checkUniqueName\"\n />\n <ng-template #suffix>\n <thy-input-count></thy-input-count>\n </ng-template>\n </thy-input-group>\n </thy-form-group>\n <thy-form-group [thyLabelText]=\"i18nTexts().fieldType\">\n <div class=\"thy-dropdown-menu py-0\">\n <div class=\"ml-n5 mr-n5\">\n <span\n thyDropdownMenuItem\n [thyDropdown]=\"menu\"\n [thyDisabled]=\"isUpdate()\"\n thyTrigger=\"hover\"\n thyPlacement=\"right\"\n (click)=\"fieldTypeClick($event)\"\n >\n <thy-icon thyDropdownMenuItemIcon [thyIconName]=\"selectedFieldOption().icon\"></thy-icon>\n <span thyDropdownMenuItemName>{{ selectedFieldOption().name }}</span>\n <thy-icon thyDropdownMenuItemExtendIcon thyIconName=\"angle-right\" class=\"text-desc\"></thy-icon>\n </span>\n </div>\n </div>\n\n @if (selectedFieldOption().type === aITableFieldType.member) {\n <div class=\"d-flex justify-content-between mt-3\">\n {{i18nTexts().allowMultipleMembers}}\n <thy-switch\n name=\"isMultipleMember\"\n [thyDisabled]=\"isUpdate()\"\n [(ngModel)]=\"isMultipleMember\"\n (ngModelChange)=\"multipleMemberChange()\"\n thySize=\"sm\"\n ></thy-switch>\n </div>\n }\n </thy-form-group>\n @if (aiExternalTemplate()) {\n <ng-container *ngTemplateOutlet=\"aiExternalTemplate()\"></ng-container>\n }\n <thy-form-group-footer thyAlign=\"right\">\n <button thyButton=\"link-secondary\" (click)=\"cancel()\" thySize=\"sm\">{{i18nTexts().cancel}}</button>\n <button thyButton=\"primary\" (thyFormSubmit)=\"editFieldProperty()\" thySize=\"sm\">{{i18nTexts().confirm}}</button>\n </thy-form-group-footer>\n</form>\n\n<thy-dropdown-menu #menu>\n @for (item of fieldOptions(); track $index) {\n <a\n thyDropdownMenuItem\n href=\"javascript:;\"\n [ngClass]=\"{\n active: (item | fieldIsSameOption: aiEditField())\n }\"\n (click)=\"selectFieldType(item)\"\n >\n <thy-icon [thyIconName]=\"item.icon!\"></thy-icon>\n <span thyDropdownMenuItemName>{{ item.name }}</span>\n </a>\n }\n</thy-dropdown-menu>\n", styles: [":host{width:350px}\n"] }]
|
1625
1760
|
}] });
|
1626
1761
|
|
1627
1762
|
class AITableGridSelectionService {
|
@@ -2027,9 +2162,10 @@ const buildGridLinearRows = (visibleRecords, isAddingVisible = true) => {
|
|
2027
2162
|
});
|
2028
2163
|
return linearRows;
|
2029
2164
|
};
|
2030
|
-
const buildGridData = (recordValue, fieldsValue) => {
|
2165
|
+
const buildGridData = (aiTable, recordValue, fieldsValue) => {
|
2166
|
+
const fieldOptions = getFieldOptions(aiTable);
|
2031
2167
|
const fields = fieldsValue.map((value) => {
|
2032
|
-
const fieldOption =
|
2168
|
+
const fieldOption = fieldOptions.find((item) => item.type === value.type);
|
2033
2169
|
return {
|
2034
2170
|
...value,
|
2035
2171
|
icon: value.icon || fieldOption.icon,
|
@@ -2094,10 +2230,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
2094
2230
|
type: Injectable
|
2095
2231
|
}], ctorParameters: () => [{ type: i1$1.ThyPopover }] });
|
2096
2232
|
|
2097
|
-
function getColumnIndicesSizeMap(fields) {
|
2233
|
+
function getColumnIndicesSizeMap(aiTable, fields) {
|
2098
2234
|
const columnIndicesSizeMap = {};
|
2099
2235
|
fields?.forEach((field, index) => {
|
2100
|
-
columnIndicesSizeMap[index] = field.width ?? getFieldOptionByField(field).width;
|
2236
|
+
columnIndicesSizeMap[index] = field.width ?? getFieldOptionByField(aiTable, field).width;
|
2101
2237
|
});
|
2102
2238
|
return columnIndicesSizeMap;
|
2103
2239
|
}
|
@@ -3457,9 +3593,10 @@ function appendField(aiTable, originField, actions) {
|
|
3457
3593
|
const lastFieldId = fields.length > 0 ? fields[fields.length - 1]._id : '';
|
3458
3594
|
let defaultFieldValue;
|
3459
3595
|
if (originField) {
|
3596
|
+
const fieldOptions = getFieldOptions(aiTable);
|
3460
3597
|
defaultFieldValue = {
|
3461
3598
|
...originField,
|
3462
|
-
name: createDefaultFieldName(aiTable,
|
3599
|
+
name: createDefaultFieldName(aiTable, fieldOptions.find((item) => item.type === originField.type)),
|
3463
3600
|
_id: idCreator()
|
3464
3601
|
};
|
3465
3602
|
}
|
@@ -3550,15 +3687,15 @@ const getVisibleRangeInfo = (coordinate, scrollState) => {
|
|
3550
3687
|
columnStopIndex
|
3551
3688
|
};
|
3552
3689
|
};
|
3553
|
-
const scrollMax = (coordinate, visibleColumns) => {
|
3554
|
-
const scrollMaxWidth = visibleColumns.reduce((pre, cur) => pre + getFieldOptionByField(cur)?.width, AI_TABLE_ROW_HEAD_WIDTH);
|
3690
|
+
const scrollMax = (aiTable, coordinate, visibleColumns) => {
|
3691
|
+
const scrollMaxWidth = visibleColumns.reduce((pre, cur) => pre + getFieldOptionByField(aiTable, cur)?.width, AI_TABLE_ROW_HEAD_WIDTH);
|
3555
3692
|
const scrollMaxHeight = coordinate.getRowOffset(coordinate.rowCount - 1) + 32;
|
3556
3693
|
return { scrollMaxWidth, scrollMaxHeight };
|
3557
3694
|
};
|
3558
3695
|
|
3559
|
-
const getMousePosition = (x, y, coordinate, fields, context, _targetName) => {
|
3696
|
+
const getMousePosition = (aiTable, x, y, coordinate, fields, context, _targetName) => {
|
3560
3697
|
const { scrollTop, scrollLeft } = context.scrollState();
|
3561
|
-
const { scrollMaxWidth, scrollMaxHeight } = scrollMax(coordinate, fields);
|
3698
|
+
const { scrollMaxWidth, scrollMaxHeight } = scrollMax(aiTable, coordinate, fields);
|
3562
3699
|
const offsetTop = scrollTop + y;
|
3563
3700
|
const rowIndex = coordinate.getRowStartIndex(offsetTop);
|
3564
3701
|
const offsetLeft = isWithinFrozenColumnBoundary(x, coordinate.frozenColumnWidth) ? x : scrollLeft + x;
|
@@ -5091,7 +5228,7 @@ class AITableCellLink {
|
|
5091
5228
|
return;
|
5092
5229
|
const { context } = aiTable;
|
5093
5230
|
const { x, y } = pos;
|
5094
|
-
const curMousePosition = getMousePosition(x, y, coordinate, AITable.getVisibleFields(aiTable), context, targetName);
|
5231
|
+
const curMousePosition = getMousePosition(aiTable, x, y, coordinate, AITable.getVisibleFields(aiTable), context, targetName);
|
5095
5232
|
handleMouseStyle(AI_TABLE_FIELD_HEAD_MORE, curMousePosition.areaType, coordinate.container);
|
5096
5233
|
}
|
5097
5234
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableCellLink, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
@@ -6205,12 +6342,13 @@ class AITableGridBase {
|
|
6205
6342
|
constructor() {
|
6206
6343
|
this.aiRecords = model.required();
|
6207
6344
|
this.aiFields = model.required();
|
6208
|
-
this.aiContextMenuItems = input(
|
6345
|
+
this.aiContextMenuItems = input();
|
6209
6346
|
this.aiFieldConfig = input();
|
6210
6347
|
this.aiReadonly = input();
|
6211
6348
|
this.aiPlugins = input();
|
6212
6349
|
this.aiReferences = input.required();
|
6213
6350
|
this.aiBuildRenderDataFn = input();
|
6351
|
+
this.aiGetI18nTextByKey = input();
|
6214
6352
|
this.aiKeywords = input();
|
6215
6353
|
this.AITableFieldType = AITableFieldType;
|
6216
6354
|
this.AITableSelectOptionStyle = AITableSelectOptionStyle;
|
@@ -6226,7 +6364,11 @@ class AITableGridBase {
|
|
6226
6364
|
this.aiClick = output();
|
6227
6365
|
this.aiDbClick = output();
|
6228
6366
|
this.fieldMenus = computed(() => {
|
6229
|
-
|
6367
|
+
const fieldMenusFn = this.aiFieldConfig()?.fieldMenus;
|
6368
|
+
if (fieldMenusFn && this.aiTable) {
|
6369
|
+
return fieldMenusFn(this.aiTable);
|
6370
|
+
}
|
6371
|
+
return [];
|
6230
6372
|
});
|
6231
6373
|
this.gridData = computed(() => {
|
6232
6374
|
if (this.aiBuildRenderDataFn && this.aiBuildRenderDataFn() && this.aiTable) {
|
@@ -6250,6 +6392,9 @@ class AITableGridBase {
|
|
6250
6392
|
}
|
6251
6393
|
initAITable() {
|
6252
6394
|
this.aiTable = createAITable(this.aiRecords, this.aiFields, this.gridData);
|
6395
|
+
if (this.aiGetI18nTextByKey()) {
|
6396
|
+
this.aiTable.getI18nTextByKey = this.aiGetI18nTextByKey();
|
6397
|
+
}
|
6253
6398
|
this.aiPlugins()?.forEach((plugin) => {
|
6254
6399
|
this.aiTable = plugin(this.aiTable);
|
6255
6400
|
});
|
@@ -6339,7 +6484,7 @@ class AITableGridBase {
|
|
6339
6484
|
}
|
6340
6485
|
}
|
6341
6486
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
6342
|
-
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", aiMoveField: "aiMoveField", aiUpdateFieldValue: "aiUpdateFieldValue", aiSetField: "aiSetField", aiClick: "aiClick", aiDbClick: "aiDbClick" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
6487
|
+
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 }, aiGetI18nTextByKey: { classPropertyName: "aiGetI18nTextByKey", publicName: "aiGetI18nTextByKey", 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", aiMoveField: "aiMoveField", aiUpdateFieldValue: "aiUpdateFieldValue", aiSetField: "aiSetField", aiClick: "aiClick", aiDbClick: "aiDbClick" }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
6343
6488
|
}
|
6344
6489
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableGridBase, decorators: [{
|
6345
6490
|
type: Component,
|
@@ -7944,7 +8089,8 @@ const createColumnHeads = (config) => {
|
|
7944
8089
|
};
|
7945
8090
|
};
|
7946
8091
|
const fieldHeads = [];
|
7947
|
-
const
|
8092
|
+
const fieldMenuFn = config.aiTable.context?.aiFieldConfig()?.fieldMenus;
|
8093
|
+
const fieldMenus = (fieldMenuFn && fieldMenuFn(aiTable)) || [];
|
7948
8094
|
let noMoreIcon = false;
|
7949
8095
|
if (fieldMenus.length === 0) {
|
7950
8096
|
noMoreIcon = true;
|
@@ -8386,7 +8532,6 @@ const createActiveCellBorder = (config) => {
|
|
8386
8532
|
columnIndex,
|
8387
8533
|
columnCount: totalColumnCount
|
8388
8534
|
});
|
8389
|
-
// active 外边界和非 active 外边界 box 大小保持一致
|
8390
8535
|
const currentConfig = {
|
8391
8536
|
x: x + offset + AI_TABLE_OFFSET,
|
8392
8537
|
y: y + AI_TABLE_OFFSET,
|
@@ -8691,22 +8836,17 @@ class AITableDragComponent {
|
|
8691
8836
|
this.draggedData = null;
|
8692
8837
|
this.mouseStartPosition = null;
|
8693
8838
|
this.aiTableDrag = null;
|
8694
|
-
effect(() =>
|
8695
|
-
const drag = this.aiTableGridSelectionService.aiTable.dragState?.();
|
8696
|
-
if (drag && drag.sourceIds.size > 0) {
|
8697
|
-
if (!this.rect || !this.line) {
|
8698
|
-
return;
|
8699
|
-
}
|
8700
|
-
this.aiTableDrag = drag;
|
8701
|
-
}
|
8702
|
-
else {
|
8703
|
-
this.aiTableDrag = null;
|
8704
|
-
}
|
8705
|
-
});
|
8839
|
+
effect(() => this.handleDragStateChange());
|
8706
8840
|
}
|
8707
8841
|
ngOnInit() {
|
8842
|
+
this.initElements();
|
8843
|
+
this.setupEventListeners();
|
8844
|
+
}
|
8845
|
+
initElements() {
|
8708
8846
|
this.rect = this.elementRef.nativeElement.querySelector('.rect');
|
8709
|
-
this.
|
8847
|
+
this.auxiliaryLine = this.elementRef.nativeElement.querySelector('.auxiliary-line');
|
8848
|
+
}
|
8849
|
+
setupEventListeners() {
|
8710
8850
|
this.mousedownListener = this.render2.listen('window', 'mousedown', (e) => {
|
8711
8851
|
this.mouseStartPosition = { x: e.x, y: e.y };
|
8712
8852
|
});
|
@@ -8715,7 +8855,7 @@ class AITableDragComponent {
|
|
8715
8855
|
cancelAnimationFrame(this.timer);
|
8716
8856
|
}
|
8717
8857
|
this.timer = requestAnimationFrame(() => {
|
8718
|
-
if (this.
|
8858
|
+
if (this.aiTableDrag && this.mouseStartPosition) {
|
8719
8859
|
this.handleDrag(e, this.aiTableDrag);
|
8720
8860
|
}
|
8721
8861
|
});
|
@@ -8726,72 +8866,23 @@ class AITableDragComponent {
|
|
8726
8866
|
this.handleDragEnd();
|
8727
8867
|
});
|
8728
8868
|
}
|
8729
|
-
|
8730
|
-
|
8731
|
-
|
8869
|
+
handleDragStateChange() {
|
8870
|
+
const drag = this.aiTableGridSelectionService.aiTable.dragState?.();
|
8871
|
+
if (!drag || drag.type === DragType.none || !this.rect || !this.auxiliaryLine) {
|
8872
|
+
this.aiTableDrag = null;
|
8873
|
+
return;
|
8732
8874
|
}
|
8733
|
-
|
8875
|
+
this.aiTableDrag = drag;
|
8876
|
+
}
|
8877
|
+
handleDrag(e, drag) {
|
8878
|
+
if (drag.type === DragType.none) {
|
8734
8879
|
return;
|
8735
8880
|
}
|
8736
|
-
|
8737
|
-
const
|
8738
|
-
const scroll = drag.scroll || { x: 0, y: 0 };
|
8739
|
-
const coordinate = drag.coordinate;
|
8881
|
+
this.setDisplayStyle('block');
|
8882
|
+
const moveX = e.x - (this.mouseStartPosition?.x || 0);
|
8740
8883
|
switch (drag.type) {
|
8741
8884
|
case DragType.field:
|
8742
|
-
|
8743
|
-
let width = 0;
|
8744
|
-
fields.forEach((field, index) => {
|
8745
|
-
if (drag.sourceIds.has(field._id)) {
|
8746
|
-
width += coordinate.columnIndicesSizeMap[index] || 0;
|
8747
|
-
}
|
8748
|
-
});
|
8749
|
-
const visibleColumnIndexMap = aiTable.context.visibleColumnsIndexMap();
|
8750
|
-
const sourceColumnIndex = visibleColumnIndexMap.get(drag.sourceIds.values().next().value) || 0;
|
8751
|
-
const sourceColumnStartX = coordinate.getColumnOffset(sourceColumnIndex);
|
8752
|
-
const sourceColumnWidth = coordinate.getColumnWidth(sourceColumnIndex);
|
8753
|
-
// TODO: 目前默认第一列为冻结列,后期支持设置冻结列需要处理
|
8754
|
-
const isSourceColumnFrozen = sourceColumnIndex === 0;
|
8755
|
-
const pointerX = moveX + sourceColumnStartX;
|
8756
|
-
// 拖拽中心点
|
8757
|
-
const dragCenter = sourceColumnWidth / 2;
|
8758
|
-
let targetColumnIndex = coordinate.getColumnStartIndex(pointerX + (isSourceColumnFrozen ? scroll.x : 0) + dragCenter);
|
8759
|
-
let targetColumnStartX = coordinate.getColumnOffset(targetColumnIndex);
|
8760
|
-
this.render2.setStyle(this.rect, 'cursor', 'move');
|
8761
|
-
this.render2.setStyle(this.rect, 'width', `${width}px`);
|
8762
|
-
this.render2.setStyle(this.rect, 'height', `100%`);
|
8763
|
-
this.render2.setStyle(this.rect, 'top', 0);
|
8764
|
-
this.render2.setStyle(this.rect, 'left', `${pointerX - (isSourceColumnFrozen ? 0 : scroll.x)}px`);
|
8765
|
-
const lastColumnOffset = coordinate.getColumnOffset(coordinate.columnCount - 1);
|
8766
|
-
const lastColumnWidth = coordinate.getColumnWidth(coordinate.columnCount - 1);
|
8767
|
-
let isLastColumn = false;
|
8768
|
-
// 处理最后一列
|
8769
|
-
if (pointerX + dragCenter > lastColumnOffset + lastColumnWidth) {
|
8770
|
-
targetColumnIndex = coordinate.columnCount;
|
8771
|
-
targetColumnStartX = lastColumnOffset + lastColumnWidth;
|
8772
|
-
isLastColumn = true;
|
8773
|
-
}
|
8774
|
-
if ((targetColumnIndex >= 0 && (targetColumnIndex - sourceColumnIndex > 1 || targetColumnIndex - sourceColumnIndex < 0)) ||
|
8775
|
-
isLastColumn) {
|
8776
|
-
this.render2.setStyle(this.line, 'width', `2px`);
|
8777
|
-
this.render2.setStyle(this.line, 'height', `100%`);
|
8778
|
-
this.render2.setStyle(this.line, 'top', 0);
|
8779
|
-
this.render2.setStyle(this.line, 'left', `${targetColumnStartX - scroll.x}px`);
|
8780
|
-
const fieldsIndex = [];
|
8781
|
-
drag.sourceIds.forEach((id) => {
|
8782
|
-
const index = visibleColumnIndexMap.get(id) || 0;
|
8783
|
-
fieldsIndex.push(index);
|
8784
|
-
});
|
8785
|
-
// 向右移动目标在目标列的前一列
|
8786
|
-
if (targetColumnIndex > sourceColumnIndex) {
|
8787
|
-
targetColumnIndex -= 1;
|
8788
|
-
}
|
8789
|
-
this.draggedData = { type: DragType.field, targetIndex: targetColumnIndex, fieldIds: drag.sourceIds, fieldsIndex };
|
8790
|
-
}
|
8791
|
-
else {
|
8792
|
-
this.render2.setStyle(this.line, 'width', 0);
|
8793
|
-
this.draggedData = null;
|
8794
|
-
}
|
8885
|
+
this.movingColumn(drag, moveX);
|
8795
8886
|
break;
|
8796
8887
|
case DragType.record:
|
8797
8888
|
break;
|
@@ -8799,13 +8890,95 @@ class AITableDragComponent {
|
|
8799
8890
|
break;
|
8800
8891
|
}
|
8801
8892
|
}
|
8893
|
+
movingColumn(drag, moveX) {
|
8894
|
+
const aiTable = this.aiTableGridSelectionService.aiTable;
|
8895
|
+
const scroll = drag.scroll || { x: 0, y: 0 };
|
8896
|
+
const coordinate = drag.coordinate;
|
8897
|
+
const fields = aiTable.gridData().fields;
|
8898
|
+
const width = this.calculateDragWidth(fields, coordinate, drag);
|
8899
|
+
const visibleColumnIndexMap = aiTable.context.visibleColumnsIndexMap();
|
8900
|
+
const sourceColumnIndex = visibleColumnIndexMap.get(drag.sourceIds.values().next().value) || 0;
|
8901
|
+
const sourceColumnStartX = coordinate.getColumnOffset(sourceColumnIndex);
|
8902
|
+
const sourceColumnWidth = coordinate.getColumnWidth(sourceColumnIndex);
|
8903
|
+
// TODO: 目前默认第一列为冻结列,后期支持设置冻结列需要处理
|
8904
|
+
const isSourceColumnFrozen = sourceColumnIndex === 0;
|
8905
|
+
const pointerX = moveX + sourceColumnStartX;
|
8906
|
+
// 拖拽中心点
|
8907
|
+
const dragCenter = sourceColumnWidth / 2;
|
8908
|
+
this.setRectStyles({
|
8909
|
+
cursor: 'move',
|
8910
|
+
width: `${width}px`,
|
8911
|
+
height: '100%',
|
8912
|
+
top: '0',
|
8913
|
+
left: `${pointerX - (isSourceColumnFrozen ? 0 : scroll.x)}px`
|
8914
|
+
});
|
8915
|
+
const lastColumnOffset = coordinate.getColumnOffset(coordinate.columnCount - 1);
|
8916
|
+
const lastColumnWidth = coordinate.getColumnWidth(coordinate.columnCount - 1);
|
8917
|
+
let targetColumnIndex = coordinate.getColumnStartIndex(pointerX + (isSourceColumnFrozen ? scroll.x : 0) + dragCenter);
|
8918
|
+
let targetColumnStartX = coordinate.getColumnOffset(targetColumnIndex);
|
8919
|
+
let isLastColumn = false;
|
8920
|
+
// 处理最后一列
|
8921
|
+
if (pointerX + dragCenter > lastColumnOffset + lastColumnWidth) {
|
8922
|
+
targetColumnIndex = coordinate.columnCount;
|
8923
|
+
targetColumnStartX = lastColumnOffset + lastColumnWidth;
|
8924
|
+
isLastColumn = true;
|
8925
|
+
}
|
8926
|
+
if ((targetColumnIndex >= 0 && (targetColumnIndex - sourceColumnIndex > 1 || targetColumnIndex - sourceColumnIndex < 0)) ||
|
8927
|
+
isLastColumn) {
|
8928
|
+
this.setAuxiliaryLineStyles({
|
8929
|
+
width: '2px',
|
8930
|
+
height: '100%',
|
8931
|
+
top: 0,
|
8932
|
+
left: `${targetColumnStartX - scroll.x}px`
|
8933
|
+
});
|
8934
|
+
const fieldsIndex = [];
|
8935
|
+
drag.sourceIds.forEach((id) => {
|
8936
|
+
const index = visibleColumnIndexMap.get(id) || 0;
|
8937
|
+
fieldsIndex.push(index);
|
8938
|
+
});
|
8939
|
+
// 向右移动目标在目标列的前一列
|
8940
|
+
if (targetColumnIndex > sourceColumnIndex) {
|
8941
|
+
targetColumnIndex -= 1;
|
8942
|
+
}
|
8943
|
+
this.draggedData = { type: DragType.field, targetIndex: targetColumnIndex, fieldIds: drag.sourceIds, fieldsIndex };
|
8944
|
+
}
|
8945
|
+
else {
|
8946
|
+
this.resetAuxiliaryLine();
|
8947
|
+
this.draggedData = null;
|
8948
|
+
}
|
8949
|
+
}
|
8802
8950
|
handleDragEnd() {
|
8803
|
-
this.
|
8951
|
+
this.setDisplayStyle('none');
|
8804
8952
|
if (this.draggedData) {
|
8805
8953
|
this.dragEnd.emit({ ...this.draggedData });
|
8806
8954
|
this.draggedData = null;
|
8807
8955
|
}
|
8808
8956
|
}
|
8957
|
+
calculateDragWidth(fields, coordinate, drag) {
|
8958
|
+
let width = 0;
|
8959
|
+
fields.forEach((field, index) => {
|
8960
|
+
if (drag.sourceIds.has(field._id)) {
|
8961
|
+
width += coordinate.columnIndicesSizeMap[index] || 0;
|
8962
|
+
}
|
8963
|
+
});
|
8964
|
+
return width;
|
8965
|
+
}
|
8966
|
+
setDisplayStyle(display) {
|
8967
|
+
this.render2.setStyle(this.elementRef.nativeElement, 'display', display);
|
8968
|
+
}
|
8969
|
+
setRectStyles(styles) {
|
8970
|
+
Object.entries(styles).forEach(([prop, value]) => {
|
8971
|
+
this.render2.setStyle(this.rect, prop, value);
|
8972
|
+
});
|
8973
|
+
}
|
8974
|
+
setAuxiliaryLineStyles(styles) {
|
8975
|
+
Object.entries(styles).forEach(([prop, value]) => {
|
8976
|
+
this.render2.setStyle(this.auxiliaryLine, prop, value);
|
8977
|
+
});
|
8978
|
+
}
|
8979
|
+
resetAuxiliaryLine() {
|
8980
|
+
this.setAuxiliaryLineStyles({ width: 0 });
|
8981
|
+
}
|
8809
8982
|
ngOnDestroy() {
|
8810
8983
|
if (this.mousedownListener)
|
8811
8984
|
this.mousedownListener();
|
@@ -8819,13 +8992,13 @@ class AITableDragComponent {
|
|
8819
8992
|
}
|
8820
8993
|
}
|
8821
8994
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDragComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
8822
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AITableDragComponent, isStandalone: true, selector: "ai-table-drag", outputs: { dragEnd: "dragEnd" }, host: { classAttribute: "drag-container" }, ngImport: i0, template: "<div class=\"rect\"></div>\n<div class=\"line\"></div>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
8995
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: AITableDragComponent, isStandalone: true, selector: "ai-table-drag", outputs: { dragEnd: "dragEnd" }, host: { classAttribute: "drag-container" }, ngImport: i0, template: "<div class=\"rect\"></div>\n<div class=\"auxiliary-line\"></div>", changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
8823
8996
|
}
|
8824
8997
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: AITableDragComponent, decorators: [{
|
8825
8998
|
type: Component,
|
8826
8999
|
args: [{ selector: 'ai-table-drag', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
8827
9000
|
class: 'drag-container'
|
8828
|
-
}, template: "<div class=\"rect\"></div>\n<div class=\"line\"></div>" }]
|
9001
|
+
}, template: "<div class=\"rect\"></div>\n<div class=\"auxiliary-line\"></div>" }]
|
8829
9002
|
}], ctorParameters: () => [] });
|
8830
9003
|
|
8831
9004
|
class AITableGrid extends AITableGridBase {
|
@@ -8867,7 +9040,7 @@ class AITableGrid extends AITableGridBase {
|
|
8867
9040
|
rowInitSize: AI_TABLE_FIELD_HEAD_HEIGHT,
|
8868
9041
|
columnInitSize: AI_TABLE_ROW_HEAD_WIDTH,
|
8869
9042
|
rowIndicesSizeMap: {},
|
8870
|
-
columnIndicesSizeMap: getColumnIndicesSizeMap(fields),
|
9043
|
+
columnIndicesSizeMap: getColumnIndicesSizeMap(this.aiTable, fields),
|
8871
9044
|
frozenColumnCount: this.frozenColumnCount()
|
8872
9045
|
});
|
8873
9046
|
return {
|
@@ -9009,7 +9182,7 @@ class AITableGrid extends AITableGridBase {
|
|
9009
9182
|
return;
|
9010
9183
|
const { context } = this.aiTable;
|
9011
9184
|
const { x, y } = pos;
|
9012
|
-
const curMousePosition = getMousePosition(x, y, this.coordinate(), AITable.getVisibleFields(this.aiTable), context, targetName);
|
9185
|
+
const curMousePosition = getMousePosition(this.aiTable, x, y, this.coordinate(), AITable.getVisibleFields(this.aiTable), context, targetName);
|
9013
9186
|
handleMouseStyle(curMousePosition.realTargetName, curMousePosition.areaType, this.containerElement());
|
9014
9187
|
context.setPointPosition(curMousePosition);
|
9015
9188
|
this.timer = null;
|
@@ -9077,7 +9250,10 @@ class AITableGrid extends AITableGridBase {
|
|
9077
9250
|
x: mouseEvent.x,
|
9078
9251
|
y: mouseEvent.y
|
9079
9252
|
};
|
9080
|
-
const menuItems =
|
9253
|
+
const menuItems = [];
|
9254
|
+
if (this.aiContextMenuItems()) {
|
9255
|
+
menuItems.push(...this.aiContextMenuItems()(this.aiTable));
|
9256
|
+
}
|
9081
9257
|
if (!menuItems.length || menuItems.every((item) => !!(item.hidden && item.hidden(this.aiTable, targetName, position)))) {
|
9082
9258
|
return;
|
9083
9259
|
}
|
@@ -9306,18 +9482,24 @@ class AITableGrid extends AITableGridBase {
|
|
9306
9482
|
fromEvent(document, 'keydown')
|
9307
9483
|
.pipe(filter((event) => (event.ctrlKey || event.metaKey) && (event.key === 'c' || event.key === 'v')), takeUntilDestroyed(this.destroyRef))
|
9308
9484
|
.subscribe(async (event) => {
|
9485
|
+
const hasSelectedCells = this.aiTable.selection().selectedCells.size > 0;
|
9486
|
+
if (!hasSelectedCells) {
|
9487
|
+
return;
|
9488
|
+
}
|
9489
|
+
const hasEditingCell = !!this.aiTableGridEventService.getCurrentEditCell();
|
9309
9490
|
if (event.key === 'c') {
|
9310
9491
|
const clipboardData = buildClipboardData(this.aiTable);
|
9311
9492
|
if (clipboardData) {
|
9312
9493
|
writeToClipboard(clipboardData).then(() => {
|
9313
9494
|
const copiedCellsCount = this.aiTable.selection().selectedCells.size;
|
9314
|
-
this.
|
9495
|
+
const message = getI18nTextByKey(this.aiTable, AITableGridI18nKey.copiedCells).replace('{count}', copiedCellsCount.toString());
|
9496
|
+
this.notifyService.success(message, undefined, {
|
9315
9497
|
placement: 'bottomLeft'
|
9316
9498
|
});
|
9317
9499
|
});
|
9318
9500
|
}
|
9319
9501
|
}
|
9320
|
-
else if (event.key === 'v') {
|
9502
|
+
else if (event.key === 'v' && !hasEditingCell) {
|
9321
9503
|
event.preventDefault();
|
9322
9504
|
const actions = {
|
9323
9505
|
updateFieldValue: (data) => {
|
@@ -9335,7 +9517,7 @@ class AITableGrid extends AITableGridBase {
|
|
9335
9517
|
};
|
9336
9518
|
writeToAITable(this.aiTable, actions).then((isPasteSuccess) => {
|
9337
9519
|
if (!isPasteSuccess) {
|
9338
|
-
this.notifyService.error(
|
9520
|
+
this.notifyService.error(getI18nTextByKey(this.aiTable, AITableGridI18nKey.invalidPasteContent), undefined, {
|
9339
9521
|
placement: 'bottomLeft'
|
9340
9522
|
});
|
9341
9523
|
}
|
@@ -9393,5 +9575,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
9393
9575
|
* Generated bundle index. Do not edit.
|
9394
9576
|
*/
|
9395
9577
|
|
9396
|
-
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsSameOptionPipe, AITableFieldSetting, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridSelectionService, AITableMemberType, AITableMouseDownType, AITableQueries, AITableRenderer, AITableRowColumnType, AITableRowType, AITableSelectAllState, AITableSelectOptionStyle, AITableStatType, AI_TABLE_ACTION_COMMON_RADIUS, AI_TABLE_ACTION_COMMON_RIGHT_PADDING, 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_ATTACHMENT_ADD, AI_TABLE_CELL_ATTACHMENT_FILE, 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_FIELD_ITEM_HEIGHT, 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_FIELD_ITEM_MARGIN_RIGHT, AI_TABLE_FIELD_MAX_WIDTH, AI_TABLE_FIELD_MIDDLE_WIDTH, AI_TABLE_FIELD_MINI_WIDTH, AI_TABLE_FIELD_MIN_WIDTH, AI_TABLE_FILE_ICON_ITEM_HEIGHT, AI_TABLE_FILE_ICON_SIZE, 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, AttachmentPath, 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, DragType, FONT_SIZE_SM, FieldModelMap,
|
9578
|
+
export { AITable, AITableAreaType, AITableAvatarSize, AITableAvatarType, AITableCheckType, AITableContextMenu, AITableDomGrid, AITableFieldIsSameOptionPipe, AITableFieldSetting, AITableFieldType, AITableFilterOperation, AITableGrid, AITableGridEventService, AITableGridFieldService, AITableGridI18nKey, AITableGridSelectionService, AITableMemberType, AITableMouseDownType, AITableQueries, AITableRenderer, AITableRowColumnType, AITableRowType, AITableSelectAllState, AITableSelectOptionStyle, AITableStatType, AI_TABLE_ACTION_COMMON_RADIUS, AI_TABLE_ACTION_COMMON_RIGHT_PADDING, 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_ATTACHMENT_ADD, AI_TABLE_CELL_ATTACHMENT_FILE, 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_FIELD_ITEM_HEIGHT, 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_FIELD_ITEM_MARGIN_RIGHT, AI_TABLE_FIELD_MAX_WIDTH, AI_TABLE_FIELD_MIDDLE_WIDTH, AI_TABLE_FIELD_MINI_WIDTH, AI_TABLE_FIELD_MIN_WIDTH, AI_TABLE_FILE_ICON_ITEM_HEIGHT, AI_TABLE_FILE_ICON_SIZE, 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, AttachmentPath, 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, DragType, FONT_SIZE_SM, FieldModelMap, 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, WebOutlinedPath, aiTableFragmentAttribute, buildClipboardData, buildGridData, buildGridLinearRows, castToString, compareNumber, compareString, createAITable, createActiveCellBorder, createCells, createDefaultField, createDefaultFieldName, extractLinkHref, extractText, generateNewName, generateTargetName, getAvatarBgColor, getAvatarShortName, getCellEditorBorderSpace, getCellHorizontalPosition, getColumnIndicesSizeMap, getDefaultFieldValue, getDefaultI18nTextByKey, getDetailByTargetName, getEditorBoxOffset, getEditorSpace, getFieldOptionByField, getFieldOptions, getFieldValue, getHoverCell, getHoverEditorBoxOffset, getHoverEditorSpace, getI18nTextByKey, getMousePosition, getPlaceHolderCellsConfigs, getSystemFieldValue, getTargetName, getTextWidth, getVisibleRangeInfo, handleMouseStyle, hasIntersect, idCreator, idsCreator, imageCache, isArrayField, isCellMatchKeywords, isClipboardReadSupported, isClipboardReadTextSupported, isClipboardWriteSupported, isClipboardWriteTextSupported, isEmpty, isMac, isNumberFiled, isSameFieldOption, isSelectedField, isSystemField, isWindows, isWindowsOS, isWithinFrozenColumnBoundary, readFromClipboard, scrollMax, setMouseStyle, shortIdCreator, shortIdsCreator, stringInclude, textDataCache, transformCellValue, writeToAITable, writeToClipboard, zhIntlCollator };
|
9397
9579
|
//# sourceMappingURL=ai-table-grid.mjs.map
|