@ai-table/grid 0.0.5 → 0.0.7
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/abstract-cell-editor.component.d.ts.map +1 -1
- package/components/cell-editors/cell-editor.scss +22 -2
- package/components/cell-editors/select/select-editor.component.d.ts +7 -8
- package/components/cell-editors/select/select-editor.component.d.ts.map +1 -1
- package/components/cell-views/select/option.component.d.ts +11 -0
- package/components/cell-views/select/option.component.d.ts.map +1 -0
- package/components/field-property-editor/field-property-editor.component.d.ts +13 -4
- package/components/field-property-editor/field-property-editor.component.d.ts.map +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.d.ts.map +1 -1
- package/constants/field.d.ts.map +1 -1
- package/core/action/field.d.ts +3 -3
- package/core/action/field.d.ts.map +1 -1
- package/core/action/general.d.ts +1 -1
- package/core/action/general.d.ts.map +1 -1
- package/core/action/index.d.ts +1 -1
- package/core/action/record.d.ts +3 -3
- package/core/action/record.d.ts.map +1 -1
- package/core/constants/field.d.ts +22 -4
- package/core/constants/field.d.ts.map +1 -1
- package/core/types/action.d.ts +10 -8
- package/core/types/action.d.ts.map +1 -1
- package/core/types/core.d.ts +30 -18
- package/core/types/core.d.ts.map +1 -1
- package/core/utils/field.d.ts +2 -2
- package/core/utils/field.d.ts.map +1 -1
- package/core/utils/id-creator.d.ts +1 -1
- package/core/utils/id-creator.d.ts.map +1 -1
- package/core/utils/queries.d.ts +5 -4
- package/core/utils/queries.d.ts.map +1 -1
- package/esm2022/components/cell-editors/abstract-cell-editor.component.mjs +6 -8
- package/esm2022/components/cell-editors/date-time/date-time-editor.component.mjs +3 -3
- package/esm2022/components/cell-editors/link/number-editor.component.mjs +3 -3
- package/esm2022/components/cell-editors/number/number-editor.component.mjs +3 -3
- package/esm2022/components/cell-editors/progress/progress-editor.component.mjs +3 -3
- package/esm2022/components/cell-editors/rating/rating-editor.component.mjs +3 -3
- package/esm2022/components/cell-editors/select/select-editor.component.mjs +37 -27
- package/esm2022/components/cell-editors/text/text-editor.component.mjs +3 -3
- package/esm2022/components/cell-views/select/option.component.mjs +27 -0
- package/esm2022/components/field-menu/field-menu.component.mjs +3 -3
- package/esm2022/components/field-property-editor/field-property-editor.component.mjs +17 -13
- package/esm2022/components/index.mjs +2 -1
- package/esm2022/constants/field.mjs +3 -4
- package/esm2022/core/action/field.mjs +12 -9
- package/esm2022/core/action/general.mjs +45 -32
- package/esm2022/core/action/record.mjs +1 -1
- package/esm2022/core/constants/field.mjs +10 -2
- package/esm2022/core/types/action.mjs +1 -1
- package/esm2022/core/types/core.mjs +8 -1
- package/esm2022/core/utils/field.mjs +6 -3
- package/esm2022/core/utils/id-creator.mjs +4 -10
- package/esm2022/core/utils/queries.mjs +12 -12
- package/esm2022/core/utils/record.mjs +2 -2
- package/esm2022/grid.component.mjs +19 -13
- package/esm2022/pipes/grid.pipe.mjs +67 -7
- package/esm2022/services/event.service.mjs +8 -5
- package/esm2022/services/field.service.mjs +6 -6
- package/esm2022/services/selection.service.mjs +3 -3
- package/esm2022/types/field.mjs +1 -1
- package/esm2022/types/grid.mjs +1 -1
- package/esm2022/utils/build.mjs +4 -32
- package/fesm2022/ai-table-grid.mjs +279 -183
- package/fesm2022/ai-table-grid.mjs.map +1 -1
- package/grid.component.d.ts +2 -1
- package/grid.component.d.ts.map +1 -1
- package/package.json +3 -3
- package/pipes/grid.pipe.d.ts +22 -2
- package/pipes/grid.pipe.d.ts.map +1 -1
- package/services/event.service.d.ts +1 -0
- package/services/event.service.d.ts.map +1 -1
- package/services/field.service.d.ts +1 -1
- package/services/field.service.d.ts.map +1 -1
- package/styles/styles.scss +2 -3
- package/types/field.d.ts +4 -1
- package/types/field.d.ts.map +1 -1
- package/types/grid.d.ts +2 -1
- package/types/grid.d.ts.map +1 -1
- package/utils/build.d.ts +2 -3
- package/utils/build.d.ts.map +1 -1
|
@@ -6,6 +6,8 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
6
6
|
import * as i1 from '@angular/forms';
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
8
8
|
import { ThyAction } from 'ngx-tethys/action';
|
|
9
|
+
import * as i4 from 'ngx-tethys/avatar';
|
|
10
|
+
import { ThyAvatarModule } from 'ngx-tethys/avatar';
|
|
9
11
|
import * as i3 from 'ngx-tethys/checkbox';
|
|
10
12
|
import { ThyCheckboxModule } from 'ngx-tethys/checkbox';
|
|
11
13
|
import { ThyDatePicker, ThyDatePickerFormatPipe } from 'ngx-tethys/date-picker';
|
|
@@ -19,12 +21,15 @@ import { ThyRate } from 'ngx-tethys/rate';
|
|
|
19
21
|
import { ThyAutofocusDirective, ThyEnterDirective, ThyOption, ThyStopPropagationDirective } from 'ngx-tethys/shared';
|
|
20
22
|
import { ThyTag } from 'ngx-tethys/tag';
|
|
21
23
|
import { mergeWith } from 'rxjs/operators';
|
|
24
|
+
import ObjectID from 'bson-objectid';
|
|
22
25
|
import { helpers, isUndefinedOrNull } from 'ngx-tethys/util';
|
|
23
26
|
import { createDraft, finishDraft } from 'immer';
|
|
24
27
|
import { ThyTimePickerModule } from 'ngx-tethys/time-picker';
|
|
25
28
|
import { ThyInputNumber } from 'ngx-tethys/input-number';
|
|
26
29
|
import { ThySlider } from 'ngx-tethys/slider';
|
|
27
30
|
import { ThyInputDirective, ThyInputGroup, ThyInputCount, ThyInput } from 'ngx-tethys/input';
|
|
31
|
+
import { ThyDot } from 'ngx-tethys/dot';
|
|
32
|
+
import { ThyTooltipModule } from 'ngx-tethys/tooltip';
|
|
28
33
|
import * as i2 from 'ngx-tethys/form';
|
|
29
34
|
import { ThyUniqueCheckValidator, ThyFormModule, ThyConfirmValidatorDirective } from 'ngx-tethys/form';
|
|
30
35
|
import { ThyButton } from 'ngx-tethys/button';
|
|
@@ -32,8 +37,7 @@ import { ThyListItem } from 'ngx-tethys/list';
|
|
|
32
37
|
import { of, Subject, fromEvent, debounceTime } from 'rxjs';
|
|
33
38
|
import { ThyDivider } from 'ngx-tethys/divider';
|
|
34
39
|
import { ThySelect } from 'ngx-tethys/select';
|
|
35
|
-
import
|
|
36
|
-
import { ThyAvatarModule } from 'ngx-tethys/avatar';
|
|
40
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
37
41
|
|
|
38
42
|
var AITableFieldType;
|
|
39
43
|
(function (AITableFieldType) {
|
|
@@ -73,6 +77,13 @@ var AITableStatType;
|
|
|
73
77
|
AITableStatType[AITableStatType["PercentChecked"] = 16] = "PercentChecked";
|
|
74
78
|
AITableStatType[AITableStatType["PercentUnChecked"] = 17] = "PercentUnChecked";
|
|
75
79
|
})(AITableStatType || (AITableStatType = {}));
|
|
80
|
+
var AITableSelectOptionStyle;
|
|
81
|
+
(function (AITableSelectOptionStyle) {
|
|
82
|
+
AITableSelectOptionStyle["text"] = "text";
|
|
83
|
+
AITableSelectOptionStyle["tag"] = "tag";
|
|
84
|
+
AITableSelectOptionStyle["dot"] = "dot";
|
|
85
|
+
AITableSelectOptionStyle["piece"] = "piece";
|
|
86
|
+
})(AITableSelectOptionStyle || (AITableSelectOptionStyle = {}));
|
|
76
87
|
|
|
77
88
|
var ActionName;
|
|
78
89
|
(function (ActionName) {
|
|
@@ -92,15 +103,8 @@ var ExecuteType;
|
|
|
92
103
|
ExecuteType[ExecuteType["Redo"] = 2] = "Redo";
|
|
93
104
|
})(ExecuteType || (ExecuteType = {}));
|
|
94
105
|
|
|
95
|
-
function idCreator(
|
|
96
|
-
|
|
97
|
-
const $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz'; /**** Easily confusing characters are removed by default oOLl,9gq,Vv,Uu,I1****/
|
|
98
|
-
const maxPosition = $chars.length;
|
|
99
|
-
let key = '';
|
|
100
|
-
for (let i = 0; i < length; i++) {
|
|
101
|
-
key += $chars.charAt(Math.floor(Math.random() * maxPosition));
|
|
102
|
-
}
|
|
103
|
-
return key;
|
|
106
|
+
function idCreator() {
|
|
107
|
+
return ObjectID().toHexString();
|
|
104
108
|
}
|
|
105
109
|
|
|
106
110
|
const BasicFields = [
|
|
@@ -117,7 +121,15 @@ const BasicFields = [
|
|
|
117
121
|
icon: 'check-circle',
|
|
118
122
|
width: 200
|
|
119
123
|
},
|
|
120
|
-
|
|
124
|
+
{
|
|
125
|
+
type: AITableFieldType.select,
|
|
126
|
+
name: '多选',
|
|
127
|
+
icon: 'list-check',
|
|
128
|
+
width: 200,
|
|
129
|
+
settings: {
|
|
130
|
+
is_multiple: true
|
|
131
|
+
}
|
|
132
|
+
},
|
|
121
133
|
{
|
|
122
134
|
type: AITableFieldType.number,
|
|
123
135
|
name: '数字',
|
|
@@ -184,13 +196,16 @@ const BasicFields = [
|
|
|
184
196
|
const Fields = [...BasicFields];
|
|
185
197
|
const FieldsMap = helpers.keyBy([...BasicFields], 'type');
|
|
186
198
|
|
|
187
|
-
function getDefaultFieldValue(
|
|
199
|
+
function getDefaultFieldValue(field) {
|
|
200
|
+
if ([AITableFieldType.select, AITableFieldType.member, AITableFieldType.createdBy, AITableFieldType.updatedBy].includes(field.type)) {
|
|
201
|
+
return [];
|
|
202
|
+
}
|
|
188
203
|
return '';
|
|
189
204
|
}
|
|
190
205
|
function createDefaultFieldName(aiTable, type = AITableFieldType.text) {
|
|
191
206
|
const fields = aiTable.fields();
|
|
192
207
|
const count = fields.filter((item) => item.type === type).length;
|
|
193
|
-
return count === 0 ? FieldsMap[type].name : FieldsMap[type].name + count;
|
|
208
|
+
return count === 0 ? FieldsMap[type].name : FieldsMap[type].name + ' ' + count;
|
|
194
209
|
}
|
|
195
210
|
function createDefaultField(aiTable, type = AITableFieldType.text) {
|
|
196
211
|
return { _id: idCreator(), type, name: createDefaultFieldName(aiTable, type) };
|
|
@@ -234,25 +249,25 @@ function getDefaultRecord(fields) {
|
|
|
234
249
|
values: {}
|
|
235
250
|
};
|
|
236
251
|
fields.map((item) => {
|
|
237
|
-
newRow.values[item._id] = getDefaultFieldValue(item
|
|
252
|
+
newRow.values[item._id] = getDefaultFieldValue(item);
|
|
238
253
|
});
|
|
239
254
|
return newRow;
|
|
240
255
|
}
|
|
241
256
|
|
|
242
257
|
const AITableQueries = {
|
|
243
|
-
|
|
258
|
+
findRecordPath(aiTable, record) {
|
|
244
259
|
const recordIndex = record && aiTable.records().indexOf(record);
|
|
245
|
-
const fieldIndex = field && aiTable.fields().indexOf(field);
|
|
246
|
-
if (!isUndefinedOrNull(recordIndex) && recordIndex > -1 && !isUndefinedOrNull(fieldIndex) && fieldIndex > -1) {
|
|
247
|
-
return [recordIndex, fieldIndex];
|
|
248
|
-
}
|
|
249
260
|
if (!isUndefinedOrNull(recordIndex) && recordIndex > -1) {
|
|
250
261
|
return [recordIndex];
|
|
251
262
|
}
|
|
263
|
+
throw new Error(`can not find the record path: ${JSON.stringify({ ...(record || {}) })}`);
|
|
264
|
+
},
|
|
265
|
+
findFieldPath(aiTable, field) {
|
|
266
|
+
const fieldIndex = field && aiTable.fields().indexOf(field);
|
|
252
267
|
if (!isUndefinedOrNull(fieldIndex) && fieldIndex > -1) {
|
|
253
268
|
return [fieldIndex];
|
|
254
269
|
}
|
|
255
|
-
throw new Error(`can not find the path: ${JSON.stringify({ ...(field || {})
|
|
270
|
+
throw new Error(`can not find the field path: ${JSON.stringify({ ...(field || {}) })}`);
|
|
256
271
|
},
|
|
257
272
|
getFieldValue(aiTable, path) {
|
|
258
273
|
if (!aiTable) {
|
|
@@ -267,11 +282,11 @@ const AITableQueries = {
|
|
|
267
282
|
if (!path) {
|
|
268
283
|
throw new Error(`path does not exist as path [${path}]`);
|
|
269
284
|
}
|
|
270
|
-
const
|
|
271
|
-
if (
|
|
272
|
-
throw new Error(`can not find
|
|
285
|
+
const recordIndex = aiTable.records().findIndex((item) => item._id === path[0]);
|
|
286
|
+
if (recordIndex < 0) {
|
|
287
|
+
throw new Error(`can not find record at path [${path}]`);
|
|
273
288
|
}
|
|
274
|
-
return aiTable.records()[
|
|
289
|
+
return aiTable.records()[recordIndex].values[path[1]];
|
|
275
290
|
},
|
|
276
291
|
getField(aiTable, path) {
|
|
277
292
|
if (!aiTable) {
|
|
@@ -280,7 +295,7 @@ const AITableQueries = {
|
|
|
280
295
|
if (!path) {
|
|
281
296
|
throw new Error(`path does not exist as path [${path}]`);
|
|
282
297
|
}
|
|
283
|
-
return aiTable.fields()
|
|
298
|
+
return aiTable.fields().find(item => item._id === path[0]);
|
|
284
299
|
},
|
|
285
300
|
getRecord(aiTable, path) {
|
|
286
301
|
if (!aiTable) {
|
|
@@ -319,20 +334,23 @@ function removeField(aiTable, path) {
|
|
|
319
334
|
function setField(aiTable, value, path) {
|
|
320
335
|
const field = AITableQueries.getField(aiTable, path);
|
|
321
336
|
if (field) {
|
|
322
|
-
const
|
|
323
|
-
const
|
|
324
|
-
for (const
|
|
325
|
-
|
|
337
|
+
const properties = {};
|
|
338
|
+
const newProperties = {};
|
|
339
|
+
for (const key in value) {
|
|
340
|
+
const k = key;
|
|
341
|
+
if (field[k]?.toString() !== value[k]?.toString()) {
|
|
326
342
|
if (field.hasOwnProperty(k)) {
|
|
327
|
-
|
|
343
|
+
properties[k] = field[k];
|
|
344
|
+
}
|
|
345
|
+
if (newProperties[k] !== null) {
|
|
346
|
+
newProperties[k] = value[k];
|
|
328
347
|
}
|
|
329
|
-
newField[k] = value[k];
|
|
330
348
|
}
|
|
331
349
|
}
|
|
332
350
|
const operation = {
|
|
333
351
|
type: ActionName.SetField,
|
|
334
|
-
|
|
335
|
-
|
|
352
|
+
properties,
|
|
353
|
+
newProperties,
|
|
336
354
|
path
|
|
337
355
|
};
|
|
338
356
|
aiTable.apply(operation);
|
|
@@ -345,30 +363,30 @@ const FieldActions = {
|
|
|
345
363
|
setField
|
|
346
364
|
};
|
|
347
365
|
|
|
348
|
-
const apply = (aiTable, records, fields,
|
|
349
|
-
switch (
|
|
366
|
+
const apply = (aiTable, records, fields, action) => {
|
|
367
|
+
switch (action.type) {
|
|
350
368
|
case ActionName.UpdateFieldValue: {
|
|
351
|
-
const [
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
records[recordIndex].values[fieldId] =
|
|
369
|
+
const [recordId, fieldId] = action.path;
|
|
370
|
+
if (recordId && fieldId) {
|
|
371
|
+
const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);
|
|
372
|
+
records[recordIndex].values[fieldId] = action.newFieldValue;
|
|
355
373
|
}
|
|
356
374
|
break;
|
|
357
375
|
}
|
|
358
376
|
case ActionName.AddRecord: {
|
|
359
|
-
const [recordIndex] =
|
|
377
|
+
const [recordIndex] = action.path;
|
|
360
378
|
if (recordIndex > -1) {
|
|
361
|
-
records.splice(recordIndex, 0,
|
|
379
|
+
records.splice(recordIndex, 0, action.record);
|
|
362
380
|
}
|
|
363
381
|
break;
|
|
364
382
|
}
|
|
365
383
|
case ActionName.AddField: {
|
|
366
|
-
const [fieldIndex] =
|
|
384
|
+
const [fieldIndex] = action.path;
|
|
367
385
|
if (fieldIndex > -1) {
|
|
368
|
-
const newField =
|
|
386
|
+
const newField = action.field;
|
|
369
387
|
fields.splice(fieldIndex, 0, newField);
|
|
370
388
|
const newRecord = {
|
|
371
|
-
[newField._id]:
|
|
389
|
+
[newField._id]: getDefaultFieldValue(action.field)
|
|
372
390
|
};
|
|
373
391
|
records.forEach((item) => {
|
|
374
392
|
item.values = {
|
|
@@ -380,27 +398,27 @@ const apply = (aiTable, records, fields, options) => {
|
|
|
380
398
|
break;
|
|
381
399
|
}
|
|
382
400
|
case ActionName.MoveRecord: {
|
|
383
|
-
if (isPathEqual(
|
|
401
|
+
if (isPathEqual(action.path, action.newPath)) {
|
|
384
402
|
return;
|
|
385
403
|
}
|
|
386
|
-
const record = records[
|
|
387
|
-
records.splice(
|
|
388
|
-
records.splice(
|
|
404
|
+
const record = records[action.path[0]];
|
|
405
|
+
records.splice(action.path[0], 1);
|
|
406
|
+
records.splice(action.newPath[0], 0, record);
|
|
389
407
|
break;
|
|
390
408
|
}
|
|
391
409
|
case ActionName.MoveField: {
|
|
392
|
-
if (isPathEqual(
|
|
410
|
+
if (isPathEqual(action.path, action.newPath)) {
|
|
393
411
|
return;
|
|
394
412
|
}
|
|
395
|
-
const field = fields[
|
|
396
|
-
fields.splice(
|
|
397
|
-
fields.splice(
|
|
413
|
+
const field = fields[action.path[0]];
|
|
414
|
+
fields.splice(action.path[0], 1);
|
|
415
|
+
fields.splice(action.newPath[0], 0, field);
|
|
398
416
|
break;
|
|
399
417
|
}
|
|
400
418
|
case ActionName.RemoveField: {
|
|
401
|
-
const [
|
|
419
|
+
const [fieldId] = action.path;
|
|
420
|
+
const fieldIndex = aiTable.fields().findIndex((item) => item._id === fieldId);
|
|
402
421
|
if (fieldIndex > -1) {
|
|
403
|
-
const fieldId = aiTable.fields()[fieldIndex]._id;
|
|
404
422
|
fields.splice(fieldIndex, 1);
|
|
405
423
|
records.forEach((item) => {
|
|
406
424
|
delete item.values[fieldId];
|
|
@@ -409,19 +427,32 @@ const apply = (aiTable, records, fields, options) => {
|
|
|
409
427
|
break;
|
|
410
428
|
}
|
|
411
429
|
case ActionName.RemoveRecord: {
|
|
412
|
-
const [
|
|
430
|
+
const [recordId] = action.path;
|
|
431
|
+
const recordIndex = aiTable.records().findIndex((item) => item._id === recordId);
|
|
413
432
|
if (recordIndex > -1) {
|
|
414
433
|
records.splice(recordIndex, 1);
|
|
415
434
|
}
|
|
416
435
|
break;
|
|
417
436
|
}
|
|
418
437
|
case ActionName.SetField: {
|
|
419
|
-
const
|
|
420
|
-
if (
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
438
|
+
const field = fields.find((item) => item._id === action.path[0]);
|
|
439
|
+
if (field) {
|
|
440
|
+
for (const key in action.newProperties) {
|
|
441
|
+
const k = key;
|
|
442
|
+
const value = action.newProperties[k];
|
|
443
|
+
if (value == null) {
|
|
444
|
+
delete field[k];
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
field[k] = value;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
// properties that were previously defined, but are now missing, must be deleted
|
|
451
|
+
for (const key in action.properties) {
|
|
452
|
+
if (!action.newProperties.hasOwnProperty(key)) {
|
|
453
|
+
delete field[key];
|
|
454
|
+
}
|
|
455
|
+
}
|
|
425
456
|
}
|
|
426
457
|
break;
|
|
427
458
|
}
|
|
@@ -432,10 +463,10 @@ const apply = (aiTable, records, fields, options) => {
|
|
|
432
463
|
};
|
|
433
464
|
};
|
|
434
465
|
const GeneralActions = {
|
|
435
|
-
transform(aiTable,
|
|
466
|
+
transform(aiTable, action) {
|
|
436
467
|
const records = createDraft(aiTable.records());
|
|
437
468
|
const fields = createDraft(aiTable.fields());
|
|
438
|
-
apply(aiTable, records, fields,
|
|
469
|
+
apply(aiTable, records, fields, action);
|
|
439
470
|
aiTable.fields.update(() => {
|
|
440
471
|
return finishDraft(fields);
|
|
441
472
|
});
|
|
@@ -501,21 +532,19 @@ class AbstractEditCellEditor {
|
|
|
501
532
|
}
|
|
502
533
|
ngOnInit() {
|
|
503
534
|
this.modelValue = computed(() => {
|
|
504
|
-
|
|
505
|
-
return AITableQueries.getFieldValue(this.aiTable, path);
|
|
535
|
+
return AITableQueries.getFieldValue(this.aiTable, [this.record()._id, this.field()._id]);
|
|
506
536
|
})();
|
|
507
537
|
}
|
|
508
538
|
updateFieldValue() {
|
|
509
|
-
|
|
510
|
-
Actions.updateFieldValue(this.aiTable, this.modelValue, path);
|
|
539
|
+
Actions.updateFieldValue(this.aiTable, this.modelValue, [this.record()._id, this.field()._id]);
|
|
511
540
|
}
|
|
512
541
|
closePopover() {
|
|
513
542
|
this.thyPopoverRef?.close();
|
|
514
543
|
}
|
|
515
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
516
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.
|
|
544
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AbstractEditCellEditor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
545
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.1.4", type: AbstractEditCellEditor, isStandalone: true, selector: "abstract-edit-cell", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, record: { classPropertyName: "record", publicName: "record", isSignal: true, isRequired: true, transformFunction: null }, aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: false, isRequired: true, transformFunction: null } }, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
517
546
|
}
|
|
518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
547
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AbstractEditCellEditor, decorators: [{
|
|
519
548
|
type: Component,
|
|
520
549
|
args: [{
|
|
521
550
|
selector: 'abstract-edit-cell',
|
|
@@ -554,8 +583,8 @@ class DateTimeCellEditorComponent extends AbstractEditCellEditor {
|
|
|
554
583
|
this.closePopover();
|
|
555
584
|
}
|
|
556
585
|
}
|
|
557
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
558
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.
|
|
586
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: DateTimeCellEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
587
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "18.1.4", type: DateTimeCellEditorComponent, isStandalone: true, selector: "date-time-cell-editor", inputs: { dateShowTime: { classPropertyName: "dateShowTime", publicName: "dateShowTime", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "date-time-cell-editor" }, usesInheritance: true, ngImport: i0, template: `
|
|
559
588
|
<thy-date-picker
|
|
560
589
|
class="h-100"
|
|
561
590
|
thyTimestampPrecision="milliseconds"
|
|
@@ -573,7 +602,7 @@ class DateTimeCellEditorComponent extends AbstractEditCellEditor {
|
|
|
573
602
|
</thy-date-picker>
|
|
574
603
|
`, isInline: true, dependencies: [{ 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: "component", type: ThyDatePicker, selector: "thy-date-picker", exportAs: ["thyDatePicker"] }, { kind: "ngmodule", type: ThyTimePickerModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
575
604
|
}
|
|
576
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
605
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: DateTimeCellEditorComponent, decorators: [{
|
|
577
606
|
type: Component,
|
|
578
607
|
args: [{
|
|
579
608
|
selector: 'date-time-cell-editor',
|
|
@@ -608,10 +637,10 @@ class LinkCellEditorComponent extends AbstractEditCellEditor {
|
|
|
608
637
|
this.updateFieldValue();
|
|
609
638
|
this.closePopover();
|
|
610
639
|
}
|
|
611
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
612
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.
|
|
640
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LinkCellEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
641
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.4", type: LinkCellEditorComponent, isStandalone: true, selector: "link-cell-editor", usesInheritance: true, ngImport: i0, template: ``, isInline: true, dependencies: [{ kind: "ngmodule", type: FormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
613
642
|
}
|
|
614
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: LinkCellEditorComponent, decorators: [{
|
|
615
644
|
type: Component,
|
|
616
645
|
args: [{
|
|
617
646
|
selector: 'link-cell-editor',
|
|
@@ -627,8 +656,8 @@ class NumberCellEditorComponent extends AbstractEditCellEditor {
|
|
|
627
656
|
this.updateFieldValue();
|
|
628
657
|
this.closePopover();
|
|
629
658
|
}
|
|
630
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
631
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.
|
|
659
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: NumberCellEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
660
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.4", type: NumberCellEditorComponent, isStandalone: true, selector: "number-cell-editor", host: { classAttribute: "number-cell-editor" }, usesInheritance: true, ngImport: i0, template: `<thy-input-number
|
|
632
661
|
class="h-100"
|
|
633
662
|
[thyAutoFocus]="true"
|
|
634
663
|
[(ngModel)]="modelValue"
|
|
@@ -636,7 +665,7 @@ class NumberCellEditorComponent extends AbstractEditCellEditor {
|
|
|
636
665
|
(thyBlur)="updateValue()"
|
|
637
666
|
/> `, isInline: true, dependencies: [{ 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: "directive", type: ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }, { kind: "component", type: ThyInputNumber, selector: "thy-input-number", inputs: ["thyAutoFocus", "thyPlaceholder", "thyDisabled", "thyMax", "thyMin", "thyStep", "thyStepDelay", "thySize", "thyPrecision", "thySuffix"], outputs: ["thyBlur", "thyFocus", "thyStepChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
638
667
|
}
|
|
639
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
668
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: NumberCellEditorComponent, decorators: [{
|
|
640
669
|
type: Component,
|
|
641
670
|
args: [{
|
|
642
671
|
selector: 'number-cell-editor',
|
|
@@ -678,8 +707,8 @@ class ProgressEditorComponent extends AbstractEditCellEditor {
|
|
|
678
707
|
updateValue(value) {
|
|
679
708
|
this.updateFieldValue();
|
|
680
709
|
}
|
|
681
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
682
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.
|
|
710
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ProgressEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
711
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.4", type: ProgressEditorComponent, isStandalone: true, selector: "progress-editor", host: { listeners: { "mousedown": "mousedownHandler($event)" }, properties: { "attr.type": "field().type", "attr.fieldId": "field()._id", "attr.recordId": "record()._id" }, classAttribute: "grid-cell progress-editor" }, usesInheritance: true, ngImport: i0, template: `
|
|
683
712
|
<thy-slider
|
|
684
713
|
[(ngModel)]="modelValue"
|
|
685
714
|
[thyMax]="config?.max || 100"
|
|
@@ -693,7 +722,7 @@ class ProgressEditorComponent extends AbstractEditCellEditor {
|
|
|
693
722
|
<span class="progress-text">{{ modelValue }}{{ config?.suffix || '%' }}</span>
|
|
694
723
|
`, isInline: true, dependencies: [{ 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: "component", type: ThySlider, selector: "thy-slider", inputs: ["thyVertical", "thyDisabled", "thyMax", "thyMin", "thyStep", "thyType", "thyColor", "thySize"], outputs: ["thyAfterChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
695
724
|
}
|
|
696
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
725
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: ProgressEditorComponent, decorators: [{
|
|
697
726
|
type: Component,
|
|
698
727
|
args: [{
|
|
699
728
|
selector: 'progress-editor',
|
|
@@ -729,10 +758,10 @@ class RatingCellEditorComponent extends AbstractEditCellEditor {
|
|
|
729
758
|
updateValue() {
|
|
730
759
|
this.updateFieldValue();
|
|
731
760
|
}
|
|
732
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
733
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.
|
|
761
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RatingCellEditorComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
762
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.4", type: RatingCellEditorComponent, isStandalone: true, selector: "rating-cell-editor", host: { classAttribute: "d-flex align-items-center h-100 px-3" }, usesInheritance: true, ngImport: i0, template: ` <thy-rate [(ngModel)]="modelValue" (ngModelChange)="updateValue()"></thy-rate> `, isInline: true, dependencies: [{ 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: "component", type: ThyRate, selector: "thy-rate", inputs: ["thyCount", "thyDisabled", "thyAllowHalf", "thyAllowClear", "thyTooltips", "thyIconTemplate"], outputs: ["thyItemHoverChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
734
763
|
}
|
|
735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
764
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: RatingCellEditorComponent, decorators: [{
|
|
736
765
|
type: Component,
|
|
737
766
|
args: [{
|
|
738
767
|
selector: 'rating-cell-editor',
|
|
@@ -773,8 +802,8 @@ class TextCellEditorComponent extends AbstractEditCellEditor {
|
|
|
773
802
|
this.updateFieldValue();
|
|
774
803
|
this.closePopover();
|
|
775
804
|
}
|
|
776
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
777
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.
|
|
805
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: TextCellEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
806
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.4", type: TextCellEditorComponent, isStandalone: true, selector: "text-cell-editor", host: { classAttribute: "text-cell-editor" }, usesInheritance: true, ngImport: i0, template: `
|
|
778
807
|
<textarea
|
|
779
808
|
placeholder=""
|
|
780
809
|
rows="1"
|
|
@@ -787,7 +816,7 @@ class TextCellEditorComponent extends AbstractEditCellEditor {
|
|
|
787
816
|
></textarea>
|
|
788
817
|
`, isInline: true, 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: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "directive", type: ThyEnterDirective, selector: "[thyEnter]", outputs: ["thyEnter"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
789
818
|
}
|
|
790
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
819
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: TextCellEditorComponent, decorators: [{
|
|
791
820
|
type: Component,
|
|
792
821
|
args: [{
|
|
793
822
|
selector: 'text-cell-editor',
|
|
@@ -812,12 +841,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
812
841
|
}]
|
|
813
842
|
}], ctorParameters: () => [] });
|
|
814
843
|
|
|
844
|
+
class SelectOptionComponent {
|
|
845
|
+
constructor() {
|
|
846
|
+
this.field = input.required();
|
|
847
|
+
this.displayOption = input.required();
|
|
848
|
+
this.optionStyle = computed(() => {
|
|
849
|
+
return this.field().settings.option_style || AITableSelectOptionStyle.tag;
|
|
850
|
+
});
|
|
851
|
+
this.AITableSelectOptionStyle = AITableSelectOptionStyle;
|
|
852
|
+
}
|
|
853
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
854
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.4", type: SelectOptionComponent, isStandalone: true, selector: "select-option", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, displayOption: { classPropertyName: "displayOption", publicName: "displayOption", isSignal: true, isRequired: true, transformFunction: null } }, host: { classAttribute: "d-flex align-items-center select-option" }, ngImport: i0, template: "@if (displayOption(); as displayOption) {\n @switch (optionStyle()) {\n @case (AITableSelectOptionStyle.dot) {\n @if (displayOption.bg_color) {\n <thy-dot [thyColor]=\"displayOption.bg_color\" [thySize]=\"'sm'\" class=\"mr-2\"></thy-dot>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n }\n @case (AITableSelectOptionStyle.tag) {\n @if (displayOption.bg_color || displayOption.color; as color) {\n <thy-tag thyTheme=\"fill\" thyShape=\"pill\" [thyColor]=\"color\">\n @if (displayOption['icon']) {\n <thy-icon class=\"text-white\" [thyIconName]=\"displayOption['icon']\"></thy-icon>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n </thy-tag>\n }\n }\n @case (AITableSelectOptionStyle.piece) {\n @if (displayOption.bg_color || displayOption.color; as color) {\n <thy-dot thyShape=\"square\" [thyColor]=\"color\" [thySize]=\"'sm'\" class=\"mr-2\"></thy-dot>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n }\n @default {\n @if (displayOption['icon']) {\n <thy-icon [thyIconName]=\"displayOption['icon']\" [style.color]=\"displayOption.color\"></thy-icon>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n }\n }\n}\n", dependencies: [{ kind: "component", type: ThyTag, selector: "thy-tag,[thyTag]", inputs: ["thyTag", "thyShape", "thyColor", "thyTheme", "thySize", "thyHoverable"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "ngmodule", type: ThyTooltipModule }, { kind: "component", type: ThyDot, selector: "thy-dot,[thy-dot],[thyDot]", inputs: ["thyColor", "thySize", "thyTheme", "thyShape"] }, { kind: "component", type: ThyFlexibleText, selector: "thy-flexible-text,[thyFlexibleText]", inputs: ["thyTooltipTrigger", "thyContainerClass", "thyTooltipContent", "thyTooltipPlacement", "thyTooltipOffset"], exportAs: ["thyFlexibleText"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
855
|
+
}
|
|
856
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionComponent, decorators: [{
|
|
857
|
+
type: Component,
|
|
858
|
+
args: [{ selector: 'select-option', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
859
|
+
class: 'd-flex align-items-center select-option'
|
|
860
|
+
}, imports: [ThyTag, ThyIcon, ThyTooltipModule, ThyDot, ThyFlexibleText], template: "@if (displayOption(); as displayOption) {\n @switch (optionStyle()) {\n @case (AITableSelectOptionStyle.dot) {\n @if (displayOption.bg_color) {\n <thy-dot [thyColor]=\"displayOption.bg_color\" [thySize]=\"'sm'\" class=\"mr-2\"></thy-dot>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n }\n @case (AITableSelectOptionStyle.tag) {\n @if (displayOption.bg_color || displayOption.color; as color) {\n <thy-tag thyTheme=\"fill\" thyShape=\"pill\" [thyColor]=\"color\">\n @if (displayOption['icon']) {\n <thy-icon class=\"text-white\" [thyIconName]=\"displayOption['icon']\"></thy-icon>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n </thy-tag>\n }\n }\n @case (AITableSelectOptionStyle.piece) {\n @if (displayOption.bg_color || displayOption.color; as color) {\n <thy-dot thyShape=\"square\" [thyColor]=\"color\" [thySize]=\"'sm'\" class=\"mr-2\"></thy-dot>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n }\n @default {\n @if (displayOption['icon']) {\n <thy-icon [thyIconName]=\"displayOption['icon']\" [style.color]=\"displayOption.color\"></thy-icon>\n }\n <span thyFlexibleText [thyTooltipContent]=\"displayOption.text\">{{ displayOption.text }}</span>\n }\n }\n}\n" }]
|
|
861
|
+
}] });
|
|
862
|
+
|
|
815
863
|
class AITableFieldPropertyEditor {
|
|
816
864
|
constructor() {
|
|
817
|
-
this.
|
|
865
|
+
this.aiEditField = model.required();
|
|
818
866
|
this.aiExternalTemplate = null;
|
|
819
867
|
this.fieldType = computed(() => {
|
|
820
|
-
return FieldsMap[this.
|
|
868
|
+
return FieldsMap[this.aiEditField().type];
|
|
821
869
|
});
|
|
822
870
|
this.fieldMaxLength = 32;
|
|
823
871
|
this.validatorConfig = {
|
|
@@ -832,29 +880,33 @@ class AITableFieldPropertyEditor {
|
|
|
832
880
|
this.thyPopoverRef = inject((ThyPopoverRef));
|
|
833
881
|
this.checkUniqueName = (fieldName) => {
|
|
834
882
|
fieldName = fieldName?.trim();
|
|
835
|
-
return of(!!this.aiTable.fields()?.find((field) => field.name === fieldName && this.
|
|
883
|
+
return of(!!this.aiTable.fields()?.find((field) => field.name === fieldName && this.aiEditField()?._id !== field._id));
|
|
836
884
|
};
|
|
837
885
|
}
|
|
838
|
-
selectFieldType(
|
|
839
|
-
this.
|
|
886
|
+
selectFieldType(field) {
|
|
887
|
+
this.aiEditField.update((item) => {
|
|
888
|
+
const width = item.width ?? field.width;
|
|
889
|
+
const name = createDefaultFieldName(this.aiTable, field.type);
|
|
890
|
+
const settings = field.settings;
|
|
891
|
+
return { ...item, ...field, width, name, settings };
|
|
892
|
+
});
|
|
840
893
|
}
|
|
841
894
|
editFieldProperty() {
|
|
842
895
|
if (this.isUpdate) {
|
|
843
|
-
|
|
844
|
-
Actions.setField(this.aiTable, this.aiField(), [path]);
|
|
896
|
+
Actions.setField(this.aiTable, this.aiEditField(), [this.aiEditField()._id]);
|
|
845
897
|
}
|
|
846
898
|
else {
|
|
847
|
-
Actions.addField(this.aiTable, this.
|
|
899
|
+
Actions.addField(this.aiTable, this.aiEditField(), [this.aiTable.fields().length]);
|
|
848
900
|
}
|
|
849
901
|
this.thyPopoverRef.close();
|
|
850
902
|
}
|
|
851
903
|
cancel() {
|
|
852
904
|
this.thyPopoverRef.close();
|
|
853
905
|
}
|
|
854
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
855
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.
|
|
906
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableFieldPropertyEditor, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
907
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.4", type: AITableFieldPropertyEditor, isStandalone: true, selector: "ai-table-field-property-editor", inputs: { aiEditField: { classPropertyName: "aiEditField", publicName: "aiEditField", isSignal: true, isRequired: true, transformFunction: null }, aiTable: { classPropertyName: "aiTable", publicName: "aiTable", isSignal: false, isRequired: true, transformFunction: null }, aiExternalTemplate: { classPropertyName: "aiExternalTemplate", publicName: "aiExternalTemplate", isSignal: false, isRequired: false, transformFunction: null }, isUpdate: { classPropertyName: "isUpdate", publicName: "isUpdate", isSignal: false, isRequired: false, transformFunction: booleanAttribute } }, outputs: { aiEditField: "aiEditFieldChange" }, host: { classAttribute: "field-property-editor 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=\"\u8868\u683C\u5217\u540D\">\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=\"\u8F93\u5165\u5217\u540D\u79F0\"\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=\"\u5217\u7C7B\u578B\">\n <div class=\"ml-n5 mr-n5\">\n <thy-list-item [thyDropdown]=\"menu\" thyTrigger=\"hover\" thyPlacement=\"right\" class=\"justify-content-between\">\n <span>\n <thy-icon [thyIconName]=\"fieldType().icon\" class=\"text-desc mr-2\"></thy-icon>\n <span>{{ fieldType().name }}</span>\n </span>\n <thy-icon thyIconName=\"angle-right\" class=\"text-desc\"></thy-icon>\n </thy-list-item>\n </div>\n </thy-form-group>\n <ng-container *ngIf=\"aiExternalTemplate; else defaultTemplate\">\n <ng-container *ngTemplateOutlet=\"aiExternalTemplate\"></ng-container>\n </ng-container>\n <ng-template #defaultTemplate>\n <!-- TODO: \u5185\u90E8\u5C5E\u6027\u6E32\u67D3 -->\n </ng-template>\n <thy-form-group-footer thyAlign=\"right\">\n <button thyButton=\"link-secondary\" (click)=\"cancel()\" thySize=\"sm\">\u53D6\u6D88</button>\n <button thyButton=\"primary\" (thyFormSubmit)=\"editFieldProperty()\" thySize=\"sm\">\u786E\u5B9A</button>\n </thy-form-group-footer>\n</form>\n\n<thy-dropdown-menu #menu>\n @for (item of selectableFields; track $index) {\n <a thyDropdownMenuItem href=\"javascript:;\" (click)=\"selectFieldType(item)\">\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: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { 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: "directive", type: ThyDropdownDirective, selector: "[thyDropdown]", inputs: ["thyDropdownMenu", "thyDropdown", "thyTrigger", "thyShowDelay", "thyHideDelay", "thyActiveClass", "thyPopoverOptions", "thyPlacement", "thyMenuInsideClosable", "thyPanelClass"], outputs: ["thyActiveChange"] }, { kind: "component", type: ThyDropdownMenuComponent, selector: "thy-dropdown-menu", inputs: ["thyWidth", "thyImmediateRender"] }, { kind: "directive", type: ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }, { kind: "directive", type: ThyDropdownMenuItemNameDirective, selector: "[thyDropdownMenuItemName]" }, { kind: "component", type: ThyButton, selector: "thy-button,[thy-button],[thyButton]", inputs: ["thyButton", "thyType", "thyLoading", "thyLoadingText", "thySize", "thyIcon", "thyBlock"] }, { 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: "component", type: ThyListItem, selector: "thy-list-item,[thy-list-item]" }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutofocus", "thyAutoSelect"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
856
908
|
}
|
|
857
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
909
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableFieldPropertyEditor, decorators: [{
|
|
858
910
|
type: Component,
|
|
859
911
|
args: [{ selector: 'ai-table-field-property-editor', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
860
912
|
NgIf,
|
|
@@ -879,7 +931,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
879
931
|
ThyAutofocusDirective
|
|
880
932
|
], host: {
|
|
881
933
|
class: 'field-property-editor d-block pl-5 pr-5 pb-5 pt-4'
|
|
882
|
-
}, template: "<form thyForm name=\"createPropertyForm\" [thyFormValidatorConfig]=\"validatorConfig\" thyLayout=\"vertical\">\n <thy-form-group thyLabelRequired thyLabelText=\"\u8868\u683C\u5217\u540D\">\n <thy-input-group>\n <input\n thyInput\n [thyAutofocus]=\"true\"\n name=\"fieldName\"\n [maxlength]=\"fieldMaxLength\"\n [(ngModel)]=\"
|
|
934
|
+
}, template: "<form thyForm name=\"createPropertyForm\" [thyFormValidatorConfig]=\"validatorConfig\" thyLayout=\"vertical\">\n <thy-form-group thyLabelRequired thyLabelText=\"\u8868\u683C\u5217\u540D\">\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=\"\u8F93\u5165\u5217\u540D\u79F0\"\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=\"\u5217\u7C7B\u578B\">\n <div class=\"ml-n5 mr-n5\">\n <thy-list-item [thyDropdown]=\"menu\" thyTrigger=\"hover\" thyPlacement=\"right\" class=\"justify-content-between\">\n <span>\n <thy-icon [thyIconName]=\"fieldType().icon\" class=\"text-desc mr-2\"></thy-icon>\n <span>{{ fieldType().name }}</span>\n </span>\n <thy-icon thyIconName=\"angle-right\" class=\"text-desc\"></thy-icon>\n </thy-list-item>\n </div>\n </thy-form-group>\n <ng-container *ngIf=\"aiExternalTemplate; else defaultTemplate\">\n <ng-container *ngTemplateOutlet=\"aiExternalTemplate\"></ng-container>\n </ng-container>\n <ng-template #defaultTemplate>\n <!-- TODO: \u5185\u90E8\u5C5E\u6027\u6E32\u67D3 -->\n </ng-template>\n <thy-form-group-footer thyAlign=\"right\">\n <button thyButton=\"link-secondary\" (click)=\"cancel()\" thySize=\"sm\">\u53D6\u6D88</button>\n <button thyButton=\"primary\" (thyFormSubmit)=\"editFieldProperty()\" thySize=\"sm\">\u786E\u5B9A</button>\n </thy-form-group-footer>\n</form>\n\n<thy-dropdown-menu #menu>\n @for (item of selectableFields; track $index) {\n <a thyDropdownMenuItem href=\"javascript:;\" (click)=\"selectFieldType(item)\">\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"] }]
|
|
883
935
|
}], ctorParameters: () => [], propDecorators: { aiTable: [{
|
|
884
936
|
type: Input,
|
|
885
937
|
args: [{ required: true }]
|
|
@@ -890,7 +942,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
890
942
|
args: [{ transform: booleanAttribute }]
|
|
891
943
|
}] } });
|
|
892
944
|
|
|
893
|
-
const buildGridData = (recordValue, fieldsValue
|
|
945
|
+
const buildGridData = (recordValue, fieldsValue) => {
|
|
894
946
|
const fields = fieldsValue.map((item) => {
|
|
895
947
|
return {
|
|
896
948
|
...item,
|
|
@@ -898,39 +950,12 @@ const buildGridData = (recordValue, fieldsValue, references) => {
|
|
|
898
950
|
width: item.width || FieldsMap[item.type].width
|
|
899
951
|
};
|
|
900
952
|
});
|
|
901
|
-
let records = buildRecordsByReferences(recordValue, fieldsValue, references);
|
|
902
953
|
return {
|
|
903
954
|
type: 'grid',
|
|
904
955
|
fields,
|
|
905
|
-
records
|
|
956
|
+
records: recordValue
|
|
906
957
|
};
|
|
907
958
|
};
|
|
908
|
-
function buildRecordsByReferences(records, fields, references) {
|
|
909
|
-
if (!references) {
|
|
910
|
-
return records;
|
|
911
|
-
}
|
|
912
|
-
const memberFields = fields.filter((field) => [AITableFieldType.createdBy, AITableFieldType.updatedBy, AITableFieldType.member].includes(field.type));
|
|
913
|
-
if (memberFields.length) {
|
|
914
|
-
const uidToMember = references.members.reduce((map, member) => {
|
|
915
|
-
map[member.uid] = member;
|
|
916
|
-
return map;
|
|
917
|
-
}, {});
|
|
918
|
-
const draftRecords = createDraft(records);
|
|
919
|
-
draftRecords.forEach((record) => {
|
|
920
|
-
memberFields.forEach((field) => {
|
|
921
|
-
const value = record.values[field._id];
|
|
922
|
-
if (field.isMultiple) {
|
|
923
|
-
record.values[field._id] = value.map((uid) => uidToMember[uid]).filter(Boolean);
|
|
924
|
-
}
|
|
925
|
-
else {
|
|
926
|
-
record.values[field._id] = uidToMember[value] || {};
|
|
927
|
-
}
|
|
928
|
-
});
|
|
929
|
-
});
|
|
930
|
-
records = finishDraft(draftRecords);
|
|
931
|
-
}
|
|
932
|
-
return records;
|
|
933
|
-
}
|
|
934
959
|
|
|
935
960
|
function getRecordOrField(value, _id) {
|
|
936
961
|
return computed(() => {
|
|
@@ -943,10 +968,10 @@ class FieldMenu {
|
|
|
943
968
|
const field = getRecordOrField(this.aiTable.fields, this.fieldId);
|
|
944
969
|
menu.exec && menu.exec(this.aiTable, field, this.origin);
|
|
945
970
|
}
|
|
946
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
947
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.
|
|
971
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: FieldMenu, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
972
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.4", type: FieldMenu, isStandalone: true, selector: "field-menu", inputs: { fieldId: "fieldId", aiTable: "aiTable", fieldMenus: "fieldMenus", origin: "origin" }, ngImport: i0, template: "@for (menu of fieldMenus; track index; let index = $index) {\n @if (menu.type === 'divider') {\n <thy-divider [thyStyle]=\"'solid'\"></thy-divider>\n } @else {\n <a thyDropdownMenuItem href=\"javascript:;\" (click)=\"execute(menu)\">\n <thy-icon [thyIconName]=\"menu.icon!\"></thy-icon>\n <span>{{ menu.name! }}</span>\n </a>\n }\n}\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "directive", type: ThyDropdownMenuItemDirective, selector: "[thyDropdownMenuItem]", inputs: ["thyType", "thyDisabled"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
948
973
|
}
|
|
949
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
974
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: FieldMenu, decorators: [{
|
|
950
975
|
type: Component,
|
|
951
976
|
args: [{ selector: 'field-menu', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
952
977
|
ThyIcon,
|
|
@@ -994,7 +1019,7 @@ class AITableGridFieldService {
|
|
|
994
1019
|
initAIFieldConfig(aiFieldConfig) {
|
|
995
1020
|
this.aiFieldConfig = aiFieldConfig;
|
|
996
1021
|
}
|
|
997
|
-
editFieldProperty(origin, aiTable,
|
|
1022
|
+
editFieldProperty(origin, aiTable, aiEditField, isUpdate) {
|
|
998
1023
|
const component = this.aiFieldConfig?.fieldPropertyEditor ?? AITableFieldPropertyEditor;
|
|
999
1024
|
this.thyPopover.open(component, {
|
|
1000
1025
|
origin: origin,
|
|
@@ -1002,15 +1027,15 @@ class AITableGridFieldService {
|
|
|
1002
1027
|
placement: 'bottomLeft',
|
|
1003
1028
|
initialState: {
|
|
1004
1029
|
aiTable,
|
|
1005
|
-
|
|
1030
|
+
aiEditField,
|
|
1006
1031
|
isUpdate
|
|
1007
1032
|
}
|
|
1008
1033
|
});
|
|
1009
1034
|
}
|
|
1010
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1011
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.
|
|
1035
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridFieldService, deps: [{ token: i1$1.ThyPopover }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1036
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridFieldService }); }
|
|
1012
1037
|
}
|
|
1013
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1038
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridFieldService, decorators: [{
|
|
1014
1039
|
type: Injectable
|
|
1015
1040
|
}], ctorParameters: () => [{ type: i1$1.ThyPopover }] });
|
|
1016
1041
|
|
|
@@ -1032,8 +1057,7 @@ const RemoveFieldItem = {
|
|
|
1032
1057
|
name: '删除列',
|
|
1033
1058
|
icon: 'trash',
|
|
1034
1059
|
exec: (aiTable, field) => {
|
|
1035
|
-
|
|
1036
|
-
Actions.removeField(aiTable, path);
|
|
1060
|
+
Actions.removeField(aiTable, [field()._id]);
|
|
1037
1061
|
}
|
|
1038
1062
|
};
|
|
1039
1063
|
const DefaultFieldMenus = [EditFieldPropertyItem, RemoveFieldItem];
|
|
@@ -1042,37 +1066,101 @@ class SelectOptionPipe {
|
|
|
1042
1066
|
transform(_id, options) {
|
|
1043
1067
|
return options.find((item) => item._id === _id);
|
|
1044
1068
|
}
|
|
1045
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1046
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.
|
|
1069
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1070
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionPipe, isStandalone: true, name: "selectOption" }); }
|
|
1047
1071
|
}
|
|
1048
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1072
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionPipe, decorators: [{
|
|
1049
1073
|
type: Pipe,
|
|
1050
1074
|
args: [{
|
|
1051
1075
|
name: 'selectOption',
|
|
1052
1076
|
standalone: true
|
|
1053
1077
|
}]
|
|
1054
1078
|
}] });
|
|
1079
|
+
class SelectOptionsPipe {
|
|
1080
|
+
transform(ids, options = []) {
|
|
1081
|
+
return ids.map((id) => {
|
|
1082
|
+
return options.find((item) => item._id === id);
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1086
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionsPipe, isStandalone: true, name: "selectOptions" }); }
|
|
1087
|
+
}
|
|
1088
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectOptionsPipe, decorators: [{
|
|
1089
|
+
type: Pipe,
|
|
1090
|
+
args: [{
|
|
1091
|
+
name: 'selectOptions',
|
|
1092
|
+
standalone: true
|
|
1093
|
+
}]
|
|
1094
|
+
}] });
|
|
1055
1095
|
class IsSelectRecordPipe {
|
|
1056
1096
|
transform(recordId, selection) {
|
|
1057
1097
|
return selection.selectedRecords.has(recordId);
|
|
1058
1098
|
}
|
|
1059
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1060
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.
|
|
1099
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: IsSelectRecordPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1100
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.4", ngImport: i0, type: IsSelectRecordPipe, isStandalone: true, name: "isSelectRecord" }); }
|
|
1061
1101
|
}
|
|
1062
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1102
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: IsSelectRecordPipe, decorators: [{
|
|
1063
1103
|
type: Pipe,
|
|
1064
1104
|
args: [{
|
|
1065
1105
|
name: 'isSelectRecord',
|
|
1066
1106
|
standalone: true
|
|
1067
1107
|
}]
|
|
1068
1108
|
}] });
|
|
1109
|
+
class UserPipe {
|
|
1110
|
+
transform(values, references) {
|
|
1111
|
+
return values.map((item) => {
|
|
1112
|
+
return references.members[item] || {};
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: UserPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1116
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.4", ngImport: i0, type: UserPipe, isStandalone: true, name: "user" }); }
|
|
1117
|
+
}
|
|
1118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: UserPipe, decorators: [{
|
|
1119
|
+
type: Pipe,
|
|
1120
|
+
args: [{
|
|
1121
|
+
name: 'user',
|
|
1122
|
+
standalone: true
|
|
1123
|
+
}]
|
|
1124
|
+
}] });
|
|
1125
|
+
class SelectSettingPipe {
|
|
1126
|
+
transform(settings) {
|
|
1127
|
+
return settings;
|
|
1128
|
+
}
|
|
1129
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectSettingPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1130
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.4", ngImport: i0, type: SelectSettingPipe, isStandalone: true, name: "selectSetting" }); }
|
|
1131
|
+
}
|
|
1132
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectSettingPipe, decorators: [{
|
|
1133
|
+
type: Pipe,
|
|
1134
|
+
args: [{
|
|
1135
|
+
name: 'selectSetting',
|
|
1136
|
+
standalone: true
|
|
1137
|
+
}]
|
|
1138
|
+
}] });
|
|
1139
|
+
class MemberSettingPipe {
|
|
1140
|
+
transform(settings) {
|
|
1141
|
+
return settings;
|
|
1142
|
+
}
|
|
1143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: MemberSettingPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
1144
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.1.4", ngImport: i0, type: MemberSettingPipe, isStandalone: true, name: "memberSetting" }); }
|
|
1145
|
+
}
|
|
1146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: MemberSettingPipe, decorators: [{
|
|
1147
|
+
type: Pipe,
|
|
1148
|
+
args: [{
|
|
1149
|
+
name: 'memberSetting',
|
|
1150
|
+
standalone: true
|
|
1151
|
+
}]
|
|
1152
|
+
}] });
|
|
1069
1153
|
|
|
1070
1154
|
class SelectCellEditorComponent extends AbstractEditCellEditor {
|
|
1071
1155
|
constructor() {
|
|
1072
1156
|
super();
|
|
1073
1157
|
this.selectOptions = computed(() => {
|
|
1074
|
-
return this.field().options;
|
|
1158
|
+
return this.field().settings.options;
|
|
1075
1159
|
});
|
|
1160
|
+
this.optionStyle = computed(() => {
|
|
1161
|
+
return this.field().settings.option_style || AITableSelectOptionStyle.tag;
|
|
1162
|
+
});
|
|
1163
|
+
this.AITableSelectOptionStyle = AITableSelectOptionStyle;
|
|
1076
1164
|
}
|
|
1077
1165
|
updateValue(value) {
|
|
1078
1166
|
if (!value) {
|
|
@@ -1080,28 +1168,28 @@ class SelectCellEditorComponent extends AbstractEditCellEditor {
|
|
|
1080
1168
|
this.closePopover();
|
|
1081
1169
|
}
|
|
1082
1170
|
}
|
|
1083
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1084
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
1085
|
-
<thy-option *ngFor="let option of selectOptions()" [thyValue]="option._id" [thyLabelText]="option.text"> </thy-option>
|
|
1086
|
-
</thy-select> `, isInline: true, dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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: "component", type: ThySelect, selector: "thy-select,thy-custom-select", inputs: ["thyDropdownWidthMode", "thyShowSearch", "thyPlaceHolder", "thyServerSearch", "thyLoadState", "thyAutoActiveFirstItem", "thyMode", "thySize", "thyEmptyStateText", "thyEmptySearchMessageText", "thyEnableScrollLoad", "thyAllowClear", "thyDisabled", "thySortComparator", "thyFooterTemplate", "thyPlacement", "thyOrigin", "thyFooterClass", "thyAutoExpand", "thyHasBackdrop", "thyMaxTagCount", "thyBorderless", "thyOptions", "thyPreset"], outputs: ["thyOnSearch", "thyOnScrollToBottom", "thyOnExpandStatusChange"], exportAs: ["thySelect"] }, { kind: "component", type: ThyOption, selector: "thy-option", inputs: ["thyValue", "thyRawValue", "thyLabelText", "thyShowOptionCustom", "thySearchKey", "thyDisabled"], outputs: ["selectionChange", "visibleChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1171
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectCellEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1172
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.4", type: SelectCellEditorComponent, isStandalone: true, selector: "select-cell-editor", host: { properties: { "class.tag": "field()!.settings.option_style === AITableSelectOptionStyle.tag" }, classAttribute: "d-block h-100 select-cell-editor" }, usesInheritance: true, ngImport: i0, template: "<thy-select\n [(ngModel)]=\"modelValue\"\n [thyAutoExpand]=\"true\"\n [thyAllowClear]=\"true\"\n [thyMode]=\"field().settings.is_multiple ? 'multiple' : ''\"\n [thyPreset]=\"'tag'\"\n (thyOnExpandStatusChange)=\"updateValue($event)\"\n>\n <ng-template #selectedDisplay let-option>\n @if (optionStyle() === AITableSelectOptionStyle.tag) {\n <select-option [field]=\"field()\" [displayOption]=\"option\"></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 </ng-template>\n @for (option of selectOptions(); track option._id) {\n <thy-option [thyValue]=\"option._id\" [thyRawValue]=\"option\" [thyShowOptionCustom]=\"true\" [thyLabelText]=\"option.text\">\n <select-option [field]=\"field()\" [displayOption]=\"option\"></select-option>\n </thy-option>\n }\n</thy-select>\n", dependencies: [{ 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: "component", type: ThySelect, selector: "thy-select,thy-custom-select", inputs: ["thyDropdownWidthMode", "thyShowSearch", "thyPlaceHolder", "thyServerSearch", "thyLoadState", "thyAutoActiveFirstItem", "thyMode", "thySize", "thyEmptyStateText", "thyEmptySearchMessageText", "thyEnableScrollLoad", "thyAllowClear", "thyDisabled", "thySortComparator", "thyFooterTemplate", "thyPlacement", "thyOrigin", "thyFooterClass", "thyAutoExpand", "thyHasBackdrop", "thyMaxTagCount", "thyBorderless", "thyOptions", "thyPreset"], outputs: ["thyOnSearch", "thyOnScrollToBottom", "thyOnExpandStatusChange"], exportAs: ["thySelect"] }, { kind: "component", type: ThyOption, selector: "thy-option", inputs: ["thyValue", "thyRawValue", "thyLabelText", "thyShowOptionCustom", "thySearchKey", "thyDisabled"], outputs: ["selectionChange", "visibleChange"] }, { kind: "component", type: ThyTag, selector: "thy-tag,[thyTag]", inputs: ["thyTag", "thyShape", "thyColor", "thyTheme", "thySize", "thyHoverable"] }, { kind: "ngmodule", type: ThyTooltipModule }, { kind: "component", type: SelectOptionComponent, selector: "select-option", inputs: ["field", "displayOption"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1087
1173
|
}
|
|
1088
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: SelectCellEditorComponent, decorators: [{
|
|
1089
1175
|
type: Component,
|
|
1090
|
-
args: [{
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1176
|
+
args: [{ selector: 'select-cell-editor', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1177
|
+
class: 'd-block h-100 select-cell-editor',
|
|
1178
|
+
'[class.tag]': 'field()!.settings.option_style === AITableSelectOptionStyle.tag'
|
|
1179
|
+
}, imports: [
|
|
1180
|
+
FormsModule,
|
|
1181
|
+
NgTemplateOutlet,
|
|
1182
|
+
ThySelect,
|
|
1183
|
+
ThyOption,
|
|
1184
|
+
ThyTag,
|
|
1185
|
+
ThyIcon,
|
|
1186
|
+
ThyTooltipModule,
|
|
1187
|
+
ThyDot,
|
|
1188
|
+
ThyFlexibleText,
|
|
1189
|
+
SelectOptionPipe,
|
|
1190
|
+
SelectOptionComponent
|
|
1191
|
+
], template: "<thy-select\n [(ngModel)]=\"modelValue\"\n [thyAutoExpand]=\"true\"\n [thyAllowClear]=\"true\"\n [thyMode]=\"field().settings.is_multiple ? 'multiple' : ''\"\n [thyPreset]=\"'tag'\"\n (thyOnExpandStatusChange)=\"updateValue($event)\"\n>\n <ng-template #selectedDisplay let-option>\n @if (optionStyle() === AITableSelectOptionStyle.tag) {\n <select-option [field]=\"field()\" [displayOption]=\"option\"></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 </ng-template>\n @for (option of selectOptions(); track option._id) {\n <thy-option [thyValue]=\"option._id\" [thyRawValue]=\"option\" [thyShowOptionCustom]=\"true\" [thyLabelText]=\"option.text\">\n <select-option [field]=\"field()\" [displayOption]=\"option\"></select-option>\n </thy-option>\n }\n</thy-select>\n" }]
|
|
1192
|
+
}], ctorParameters: () => [] });
|
|
1105
1193
|
|
|
1106
1194
|
const GRID_CELL_EDITOR_MAP = {
|
|
1107
1195
|
[AITableFieldType.text]: TextCellEditorComponent,
|
|
@@ -1122,6 +1210,7 @@ class AITableGridEventService {
|
|
|
1122
1210
|
this.globalMouseoverEvent$ = new Subject();
|
|
1123
1211
|
this.globalMousedownEvent$ = new Subject();
|
|
1124
1212
|
this.destroyRef = inject(DestroyRef);
|
|
1213
|
+
this.overlay = inject(Overlay);
|
|
1125
1214
|
this.thyPopover = inject(ThyPopover);
|
|
1126
1215
|
}
|
|
1127
1216
|
initialize(aiTable, aiFieldRenderers) {
|
|
@@ -1191,14 +1280,15 @@ class AITableGridEventService {
|
|
|
1191
1280
|
hasBackdrop: false,
|
|
1192
1281
|
manualClosure: true,
|
|
1193
1282
|
animationDisabled: true,
|
|
1194
|
-
autoAdaptive: true
|
|
1283
|
+
autoAdaptive: true,
|
|
1284
|
+
scrollStrategy: this.overlay.scrollStrategies.close()
|
|
1195
1285
|
});
|
|
1196
1286
|
return ref;
|
|
1197
1287
|
}
|
|
1198
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1199
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.
|
|
1288
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1289
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridEventService }); }
|
|
1200
1290
|
}
|
|
1201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridEventService, decorators: [{
|
|
1202
1292
|
type: Injectable
|
|
1203
1293
|
}] });
|
|
1204
1294
|
|
|
@@ -1265,10 +1355,10 @@ class AITableGridSelectionService {
|
|
|
1265
1355
|
this.clearSelection();
|
|
1266
1356
|
}
|
|
1267
1357
|
}
|
|
1268
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1269
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.
|
|
1358
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridSelectionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1359
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridSelectionService }); }
|
|
1270
1360
|
}
|
|
1271
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGridSelectionService, decorators: [{
|
|
1272
1362
|
type: Injectable
|
|
1273
1363
|
}], ctorParameters: () => [] });
|
|
1274
1364
|
|
|
@@ -1281,13 +1371,14 @@ class AITableGrid {
|
|
|
1281
1371
|
this.aiPlugins = input();
|
|
1282
1372
|
this.aiReferences = input();
|
|
1283
1373
|
this.AITableFieldType = AITableFieldType;
|
|
1374
|
+
this.AITableSelectOptionStyle = AITableSelectOptionStyle;
|
|
1284
1375
|
this.isSelectedAll = computed(() => {
|
|
1285
1376
|
return this.aiTable.selection().selectedRecords.size === this.aiRecords().length;
|
|
1286
1377
|
});
|
|
1287
1378
|
this.onChange = output();
|
|
1288
1379
|
this.aiTableInitialized = output();
|
|
1289
1380
|
this.gridData = computed(() => {
|
|
1290
|
-
return buildGridData(this.aiRecords(), this.aiFields()
|
|
1381
|
+
return buildGridData(this.aiRecords(), this.aiFields());
|
|
1291
1382
|
});
|
|
1292
1383
|
this.ngZone = inject(NgZone);
|
|
1293
1384
|
this.elementRef = inject(ElementRef);
|
|
@@ -1360,8 +1451,7 @@ class AITableGrid {
|
|
|
1360
1451
|
dblClick(event) {
|
|
1361
1452
|
const cellDom = event.target.closest('.grid-cell');
|
|
1362
1453
|
const type = cellDom && cellDom.getAttribute('type');
|
|
1363
|
-
|
|
1364
|
-
if (type && !readonly && DBL_CLICK_EDIT_TYPE.includes(type)) {
|
|
1454
|
+
if (type && DBL_CLICK_EDIT_TYPE.includes(type)) {
|
|
1365
1455
|
this.aiTableGridEventService.openEdit(cellDom);
|
|
1366
1456
|
}
|
|
1367
1457
|
}
|
|
@@ -1384,10 +1474,10 @@ class AITableGrid {
|
|
|
1384
1474
|
}
|
|
1385
1475
|
}
|
|
1386
1476
|
}
|
|
1387
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.
|
|
1388
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.2", type: AITableGrid, isStandalone: true, selector: "ai-table-grid", inputs: { aiRecords: { classPropertyName: "aiRecords", publicName: "aiRecords", isSignal: true, isRequired: true, transformFunction: null }, aiFields: { classPropertyName: "aiFields", publicName: "aiFields", isSignal: true, isRequired: true, 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: false, transformFunction: null } }, outputs: { aiRecords: "aiRecordsChange", aiFields: "aiFieldsChange", onChange: "onChange", aiTableInitialized: "aiTableInitialized" }, host: { classAttribute: "ai-table-grid" }, providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], 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 class=\"grid-field-action\"\n thyAction\n thyActiveClass=\"active\"\n thyIcon=\"more-vertical\"\n [thyDropdown]=\"fieldMenu\"\n href=\"javascript:;\"\n >\n <thy-dropdown-menu #fieldMenu>\n <field-menu [origin]=\"fieldAction\" [fieldId]=\"field._id\" [aiTable]=\"aiTable\" [fieldMenus]=\"fieldMenus\"></field-menu>\n </thy-dropdown-menu>\n </a>\n </div>\n }\n <div class=\"grid-column-blank cursor-pointer\" #gridColumnBlank (click)=\"addField(gridColumnBlank)\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n<div class=\"grid-body d-flex\">\n @for (record of gridData().records; track record._id; let index = $index) {\n <div class=\"grid-row d-flex\" [ngClass]=\"{ highlight: (record._id | isSelectRecord: aiTable.selection()) }\">\n <div class=\"grid-row-index grid-checkbox\">\n <label\n [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'checked-box' : 'unchecked-box'\"\n thyCheckbox\n thyLabelText=\"\"\n [ngModel]=\"record._id | isSelectRecord: aiTable.selection()\"\n (ngModelChange)=\"selectRecord(record._id)\"\n ></label>\n <span [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'grid-row-no-number' : 'grid-row-number'\">\n {{ index + 1 }}\n </span>\n </div>\n @for (field of gridData().fields; track field._id) {\n <div\n #cell\n class=\"grid-cell\"\n [ngClass]=\"{\n highlight: aiTable.selection().selectedCells.has(record._id) || aiTable.selection().selectedFields.has(field._id),\n selected: aiTable.selection().selectedCells.get(record._id)?.hasOwnProperty(field._id)\n }\"\n [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.readonly]=\"[field?.readonly]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: field.width + 'px' }\"\n >\n @switch (field.type) {\n @case (AITableFieldType.select) {\n @if (!field.isMultiple && record.values[field._id] | selectOption: field['options']; as selectedOption) {\n <thy-tag [thyColor]=\"selectedOption!.color!\">{{ selectedOption.text }}</thy-tag>\n }\n }\n @case (AITableFieldType.date) {\n {{ record.values[field._id] | 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]\"\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] }}{{ record.values[field._id]?.config?.suffix || '%' }} </span>\n </thy-progress>\n }\n @case (AITableFieldType.member) {\n @if (!field.isMultiple) {\n <thy-avatar\n [thyName]=\"record.values[field._id].display_name\"\n [thySrc]=\"record.values[field._id].avatar\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n } @else {\n <thy-avatar-list thyAvatarSize=\"xs\">\n @for (item of record.values[field._id]; 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 <thy-avatar\n [thyName]=\"record.values[field._id].display_name\"\n [thySrc]=\"record.values[field._id].avatar\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\n }\n @case (AITableFieldType.updatedBy) {\n <thy-avatar\n [thyName]=\"record.values[field._id].display_name\"\n [thySrc]=\"record.values[field._id].avatar\"\n thySize=\"xs\"\n thyShowName=\"true\"\n ></thy-avatar>\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>", 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: "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: FieldMenu, selector: "field-menu", inputs: ["fieldId", "aiTable", "fieldMenus", "origin"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "directive", type: ThyDropdownDirective, selector: "[thyDropdown]", inputs: ["thyDropdownMenu", "thyDropdown", "thyTrigger", "thyShowDelay", "thyHideDelay", "thyActiveClass", "thyPopoverOptions", "thyPlacement", "thyMenuInsideClosable", "thyPanelClass"], outputs: ["thyActiveChange"] }, { kind: "component", type: ThyDropdownMenuComponent, selector: "thy-dropdown-menu", inputs: ["thyWidth", "thyImmediateRender"] }, { kind: "ngmodule", type: ThyCheckboxModule }, { kind: "component", type: i3.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" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1477
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGrid, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1478
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.4", type: AITableGrid, isStandalone: true, selector: "ai-table-grid", inputs: { aiRecords: { classPropertyName: "aiRecords", publicName: "aiRecords", isSignal: true, isRequired: true, transformFunction: null }, aiFields: { classPropertyName: "aiFields", publicName: "aiFields", isSignal: true, isRequired: true, 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: false, transformFunction: null } }, outputs: { aiRecords: "aiRecordsChange", aiFields: "aiFieldsChange", onChange: "onChange", aiTableInitialized: "aiTableInitialized" }, host: { classAttribute: "ai-table-grid" }, providers: [AITableGridEventService, AITableGridFieldService, AITableGridSelectionService], 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 class=\"grid-field-action\"\n thyAction\n thyActiveClass=\"active\"\n thyIcon=\"more-vertical\"\n [thyDropdown]=\"fieldMenu\"\n href=\"javascript:;\"\n >\n <thy-dropdown-menu #fieldMenu>\n <field-menu [origin]=\"fieldAction\" [fieldId]=\"field._id\" [aiTable]=\"aiTable\" [fieldMenus]=\"fieldMenus\"></field-menu>\n </thy-dropdown-menu>\n </a>\n </div>\n }\n <div class=\"grid-column-blank cursor-pointer\" #gridColumnBlank (click)=\"addField(gridColumnBlank)\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n<div class=\"grid-body d-flex\">\n @for (record of gridData().records; track record._id; let index = $index) {\n <div class=\"grid-row d-flex\" [ngClass]=\"{ highlight: (record._id | isSelectRecord: aiTable.selection()) }\">\n <div class=\"grid-row-index grid-checkbox\">\n <label\n [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'checked-box' : 'unchecked-box'\"\n thyCheckbox\n thyLabelText=\"\"\n [ngModel]=\"record._id | isSelectRecord: aiTable.selection()\"\n (ngModelChange)=\"selectRecord(record._id)\"\n ></label>\n <span [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'grid-row-no-number' : 'grid-row-number'\">\n {{ index + 1 }}\n </span>\n </div>\n @for (field of gridData().fields; track field._id) {\n <div\n #cell\n class=\"grid-cell\"\n [ngClass]=\"{\n highlight: aiTable.selection().selectedCells.has(record._id) || aiTable.selection().selectedFields.has(field._id),\n selected: aiTable.selection().selectedCells.get(record._id)?.hasOwnProperty(field._id)\n }\"\n [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: field.width + 'px' }\"\n >\n @switch (field.type) {\n @case (AITableFieldType.select) {\n @let fieldValue = record.values[field._id];\n @let settings = field.settings! | selectSetting;\n @let options = settings['options'];\n @let optionStyle = settings['option_style'] || AITableSelectOptionStyle.tag;\n @let isTagStyle = optionStyle === AITableSelectOptionStyle.tag;\n @let isPieceStyle = optionStyle === AITableSelectOptionStyle.piece;\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] | 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: FieldMenu, selector: "field-menu", inputs: ["fieldId", "aiTable", "fieldMenus", "origin"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "directive", type: ThyDropdownDirective, selector: "[thyDropdown]", inputs: ["thyDropdownMenu", "thyDropdown", "thyTrigger", "thyShowDelay", "thyHideDelay", "thyActiveClass", "thyPopoverOptions", "thyPlacement", "thyMenuInsideClosable", "thyPanelClass"], outputs: ["thyActiveChange"] }, { kind: "component", type: ThyDropdownMenuComponent, selector: "thy-dropdown-menu", inputs: ["thyWidth", "thyImmediateRender"] }, { kind: "ngmodule", type: ThyCheckboxModule }, { kind: "component", type: i3.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 }); }
|
|
1389
1479
|
}
|
|
1390
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.
|
|
1480
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.4", ngImport: i0, type: AITableGrid, decorators: [{
|
|
1391
1481
|
type: Component,
|
|
1392
1482
|
args: [{ selector: 'ai-table-grid', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1393
1483
|
class: 'ai-table-grid'
|
|
@@ -1398,6 +1488,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
1398
1488
|
CommonModule,
|
|
1399
1489
|
FormsModule,
|
|
1400
1490
|
SelectOptionPipe,
|
|
1491
|
+
SelectOptionsPipe,
|
|
1401
1492
|
ThyTag,
|
|
1402
1493
|
ThyPopoverModule,
|
|
1403
1494
|
ThyIcon,
|
|
@@ -1415,13 +1506,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.2", ngImpor
|
|
|
1415
1506
|
ProgressEditorComponent,
|
|
1416
1507
|
ThyAvatarModule,
|
|
1417
1508
|
NgTemplateOutlet,
|
|
1418
|
-
IsSelectRecordPipe
|
|
1419
|
-
|
|
1509
|
+
IsSelectRecordPipe,
|
|
1510
|
+
ProgressEditorComponent,
|
|
1511
|
+
SelectOptionComponent,
|
|
1512
|
+
UserPipe,
|
|
1513
|
+
SelectSettingPipe,
|
|
1514
|
+
MemberSettingPipe
|
|
1515
|
+
], 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 class=\"grid-field-action\"\n thyAction\n thyActiveClass=\"active\"\n thyIcon=\"more-vertical\"\n [thyDropdown]=\"fieldMenu\"\n href=\"javascript:;\"\n >\n <thy-dropdown-menu #fieldMenu>\n <field-menu [origin]=\"fieldAction\" [fieldId]=\"field._id\" [aiTable]=\"aiTable\" [fieldMenus]=\"fieldMenus\"></field-menu>\n </thy-dropdown-menu>\n </a>\n </div>\n }\n <div class=\"grid-column-blank cursor-pointer\" #gridColumnBlank (click)=\"addField(gridColumnBlank)\">\n <thy-icon thyIconName=\"plus\"></thy-icon>\n </div>\n</div>\n<div class=\"grid-body d-flex\">\n @for (record of gridData().records; track record._id; let index = $index) {\n <div class=\"grid-row d-flex\" [ngClass]=\"{ highlight: (record._id | isSelectRecord: aiTable.selection()) }\">\n <div class=\"grid-row-index grid-checkbox\">\n <label\n [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'checked-box' : 'unchecked-box'\"\n thyCheckbox\n thyLabelText=\"\"\n [ngModel]=\"record._id | isSelectRecord: aiTable.selection()\"\n (ngModelChange)=\"selectRecord(record._id)\"\n ></label>\n <span [ngClass]=\"(record._id | isSelectRecord: aiTable.selection()) ? 'grid-row-no-number' : 'grid-row-number'\">\n {{ index + 1 }}\n </span>\n </div>\n @for (field of gridData().fields; track field._id) {\n <div\n #cell\n class=\"grid-cell\"\n [ngClass]=\"{\n highlight: aiTable.selection().selectedCells.has(record._id) || aiTable.selection().selectedFields.has(field._id),\n selected: aiTable.selection().selectedCells.get(record._id)?.hasOwnProperty(field._id)\n }\"\n [attr.type]=\"[field.type]\"\n [attr.fieldId]=\"[field._id]\"\n [attr.recordId]=\"[record._id]\"\n [ngStyle]=\"{ width: field.width + 'px' }\"\n >\n @switch (field.type) {\n @case (AITableFieldType.select) {\n @let fieldValue = record.values[field._id];\n @let settings = field.settings! | selectSetting;\n @let options = settings['options'];\n @let optionStyle = settings['option_style'] || AITableSelectOptionStyle.tag;\n @let isTagStyle = optionStyle === AITableSelectOptionStyle.tag;\n @let isPieceStyle = optionStyle === AITableSelectOptionStyle.piece;\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] | 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" }]
|
|
1420
1516
|
}] });
|
|
1421
1517
|
|
|
1422
1518
|
/**
|
|
1423
1519
|
* Generated bundle index. Do not edit.
|
|
1424
1520
|
*/
|
|
1425
1521
|
|
|
1426
|
-
export { AITableFieldPropertyEditor, AITableFieldType, AITableGrid, AITableQueries, AITableStatType, ActionName, Actions, BasicFields, DBL_CLICK_EDIT_TYPE, DEFAULT_COLUMN_WIDTH, DateTimeCellEditorComponent, DefaultFieldMenus, DividerMenuItem, EditFieldPropertyItem, ExecuteType, FLUSHING, Fields, FieldsMap, IsSelectRecordPipe, LinkCellEditorComponent, MIN_COLUMN_WIDTH, MOUSEOVER_EDIT_TYPE, NumberCellEditorComponent, ProgressEditorComponent, RatingCellEditorComponent, RemoveFieldItem, RowHeight, SelectOptionPipe, TextCellEditorComponent,
|
|
1522
|
+
export { AITableFieldPropertyEditor, AITableFieldType, AITableGrid, AITableQueries, AITableSelectOptionStyle, AITableStatType, ActionName, Actions, BasicFields, DBL_CLICK_EDIT_TYPE, DEFAULT_COLUMN_WIDTH, DateTimeCellEditorComponent, DefaultFieldMenus, DividerMenuItem, EditFieldPropertyItem, ExecuteType, FLUSHING, Fields, FieldsMap, IsSelectRecordPipe, LinkCellEditorComponent, MIN_COLUMN_WIDTH, MOUSEOVER_EDIT_TYPE, MemberSettingPipe, NumberCellEditorComponent, ProgressEditorComponent, RatingCellEditorComponent, RemoveFieldItem, RowHeight, SelectOptionComponent, SelectOptionPipe, SelectOptionsPipe, SelectSettingPipe, TextCellEditorComponent, UserPipe, buildGridData, createAITable, createDefaultField, createDefaultFieldName, getDefaultFieldValue, getDefaultRecord, getRecordOrField, idCreator, isPathEqual };
|
|
1427
1523
|
//# sourceMappingURL=ai-table-grid.mjs.map
|