ngx-axis-appforge 0.0.41 → 0.0.42
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/axis-components/edit-table/index.d.ts +49 -77
- package/axis-components/table/index.d.ts +9 -65
- package/axis-components/transfer/index.d.ts +17 -19
- package/core/index.d.ts +149 -3
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs +43 -146
- package/fesm2022/ngx-axis-appforge-axis-components-edit-table.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs +9 -0
- package/fesm2022/ngx-axis-appforge-axis-components-select.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-table.mjs +27 -210
- package/fesm2022/ngx-axis-appforge-axis-components-table.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs +51 -78
- package/fesm2022/ngx-axis-appforge-axis-components-transfer.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-axis-components.mjs +0 -1
- package/fesm2022/ngx-axis-appforge-axis-components.mjs.map +1 -1
- package/fesm2022/ngx-axis-appforge-core.mjs +365 -1
- package/fesm2022/ngx-axis-appforge-core.mjs.map +1 -1
- package/package.json +99 -99
|
@@ -55,6 +55,7 @@ import * as i5 from 'ng-zorro-antd/auto-complete';
|
|
|
55
55
|
import { NzAutocompleteModule } from 'ng-zorro-antd/auto-complete';
|
|
56
56
|
import * as i1$4 from 'ng-zorro-antd/tag';
|
|
57
57
|
import { NzTagModule } from 'ng-zorro-antd/tag';
|
|
58
|
+
import * as i1$5 from '@angular/common';
|
|
58
59
|
import { CommonModule } from '@angular/common';
|
|
59
60
|
import { NzSpaceModule } from 'ng-zorro-antd/space';
|
|
60
61
|
import * as i15 from 'ng-zorro-antd/input-number';
|
|
@@ -3445,6 +3446,369 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImpor
|
|
|
3445
3446
|
], template: "<nz-collapse [nzBordered]=\"false\">\n <ng-template #addButton>\n <a nz-button nzType=\"link\" style=\"float: right;\" (click)=\"$event.stopPropagation();openWithCreate()\">\n <nz-icon nzType=\"plus\"></nz-icon>\n \u6DFB\u52A0\n </a>\n </ng-template>\n <nz-collapse-panel nzHeader=\"\u8868\u5355\u9879\u9A8C\u8BC1\" nzActive [nzExtra]=\"addButton\">\n @if (!value()?.length) {\n <nz-empty nzNotFoundContent=\"\u6682\u65E0\u9A8C\u8BC1\u5668\"></nz-empty>\n }@else{\n <div nz-flex nzVertical nzGap=\"8px\" style=\"padding: 6px;\">\n @for (item of value()??[]; track item;let i=$index) {\n <div nz-flex nzGap=\"8px\" nzAlign=\"center\">\n <div style=\"width: 64px;\">\n @switch (item.type) {\n @case (\"required\") {\n <nz-tag nzColor=\"magenta\">\u5FC5\u586B\u9A8C\u8BC1</nz-tag>\n }\n @case (\"length\") {\n <nz-tag nzColor=\"blue\">\u957F\u5EA6\u9A8C\u8BC1</nz-tag>\n }\n @case (\"value\") {\n <nz-tag nzColor=\"purple\">\u503C\u9A8C\u8BC1</nz-tag>\n }\n @case (\"regex\") {\n <nz-tag nzColor=\"cyan\">\u6B63\u5219\u9A8C\u8BC1</nz-tag>\n }\n }\n </div>\n <div class=\"validator-desc\">{{validatorDesc()?.[i]}}</div>\n <div>\n <a nz-button nzType=\"link\" nzSize=\"small\" (click)=\"openWithUpdate(i)\">\n <i nz-icon nzType=\"edit\" nzTheme=\"outline\"></i>\n </a>\n <a nz-button nzType=\"link\" nzSize=\"small\" nzDanger (click)=\"deleteValidator(i)\">\n <i nz-icon nzType=\"delete\" nzTheme=\"outline\"></i>\n </a>\n </div>\n </div>\n }\n </div>\n }\n </nz-collapse-panel>\n @if (showLine()) {\n <div></div>\n }\n</nz-collapse>\n\n<nz-modal [(nzVisible)]=\"showModal\" nzTitle=\"\u9A8C\u8BC1\u5668\" nzWidth=\"450px\" (nzOnCancel)=\"showModal.set(false)\" (nzOnOk)=\"save()\">\n <ng-container *nzModalContent>\n <form [formGroup]=\"fg\" nz-form>\n <nz-form-item>\n <nz-form-label nzSpan=\"6\" nzRequired>\n \u9A8C\u8BC1\u7C7B\u578B\n </nz-form-label>\n <nz-form-control nzSpan=\"18\">\n <nz-select formControlName=\"type\">\n <nz-option nzValue=\"required\" nzLabel=\"\u5FC5\u586B\u9A8C\u8BC1\"></nz-option>\n <nz-option nzValue=\"length\" nzLabel=\"\u957F\u5EA6\u9A8C\u8BC1\"></nz-option>\n <nz-option nzValue=\"value\" nzLabel=\"\u503C\u9A8C\u8BC1\"></nz-option>\n <nz-option nzValue=\"regex\" nzLabel=\"\u6B63\u5219\u9A8C\u8BC1\"></nz-option>\n </nz-select>\n </nz-form-control>\n </nz-form-item>\n <nz-form-item>\n <nz-form-label nzSpan=\"6\" nzRequired>\n \u7981\u7528\n </nz-form-label>\n <nz-form-control nzSpan=\"18\">\n <axis-fun-field formControlName=\"disabled\">\n <nz-switch ngModel [ngModelOptions]=\"{standalone:true}\"></nz-switch>\n </axis-fun-field>\n </nz-form-control>\n </nz-form-item>\n @switch (fg.value.type) {\n @case (\"length\") {\n <nz-form-item>\n <nz-form-label nzSpan=\"6\">\n \u6700\u5C0F\u957F\u5EA6\n </nz-form-label>\n <nz-form-control nzSpan=\"18\">\n <axis-fun-field formControlName=\"minLength\">\n <nz-input-number style=\"width: 100%\" nzPlaceHolder=\"\u4E0D\u9650\u5236\" nzMin=\"0\" ngModel\n [ngModelOptions]=\"{standalone:true}\"></nz-input-number>\n </axis-fun-field>\n </nz-form-control>\n </nz-form-item>\n <nz-form-item>\n <nz-form-label nzSpan=\"6\">\n \u6700\u5927\u957F\u5EA6\n </nz-form-label>\n <nz-form-control nzSpan=\"18\">\n <axis-fun-field formControlName=\"maxLength\">\n <nz-input-number style=\"width: 100%\" nzPlaceHolder=\"\u4E0D\u9650\u5236\" nzMin=\"0\" ngModel\n [ngModelOptions]=\"{standalone:true}\"></nz-input-number>\n </axis-fun-field>\n </nz-form-control>\n </nz-form-item>\n }\n @case (\"value\") {\n <nz-form-item>\n <nz-form-label nzSpan=\"6\">\n \u6700\u5C0F\u503C\n </nz-form-label>\n <nz-form-control nzSpan=\"18\">\n <axis-fun-field formControlName=\"minValue\">\n <nz-input-number style=\"width: 100%\" nzPlaceHolder=\"\u4E0D\u9650\u5236\" ngModel\n [ngModelOptions]=\"{standalone:true}\"></nz-input-number>\n </axis-fun-field>\n </nz-form-control>\n </nz-form-item>\n <nz-form-item>\n <nz-form-label nzSpan=\"6\">\n \u6700\u5927\u503C\n </nz-form-label>\n <nz-form-control nzSpan=\"18\">\n <axis-fun-field formControlName=\"maxValue\">\n <nz-input-number style=\"width: 100%\" nzPlaceHolder=\"\u4E0D\u9650\u5236\" ngModel\n [ngModelOptions]=\"{standalone:true}\"></nz-input-number>\n </axis-fun-field>\n </nz-form-control>\n </nz-form-item>\n }\n @case (\"regex\") {\n <nz-form-item>\n <nz-form-label nzSpan=\"6\">\n \u6B63\u5219\u8868\u8FBE\u5F0F\n </nz-form-label>\n <nz-form-control nzSpan=\"18\">\n <axis-fun-field formControlName=\"pattern\">\n <input nz-input nzPlaceHolder=\"\u8F93\u5165\u6B63\u5219\u8868\u8FBE\u5F0F\" ngModel [ngModelOptions]=\"{standalone:true}\" />\n </axis-fun-field>\n </nz-form-control>\n </nz-form-item>\n }\n }\n </form>\n </ng-container>\n</nz-modal>", styles: [".validator-desc{flex:1;font-size:12px;color:#00000073;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n"] }]
|
|
3446
3447
|
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
3447
3448
|
|
|
3449
|
+
class TableFieldDisplayService {
|
|
3450
|
+
datePipe;
|
|
3451
|
+
decimalPipe;
|
|
3452
|
+
percentPipe;
|
|
3453
|
+
scope;
|
|
3454
|
+
constructor(datePipe, decimalPipe, percentPipe, scope) {
|
|
3455
|
+
this.datePipe = datePipe;
|
|
3456
|
+
this.decimalPipe = decimalPipe;
|
|
3457
|
+
this.percentPipe = percentPipe;
|
|
3458
|
+
this.scope = scope;
|
|
3459
|
+
}
|
|
3460
|
+
fieldDisplayCache = new Map();
|
|
3461
|
+
clearCache(field) {
|
|
3462
|
+
if (!field) {
|
|
3463
|
+
this.fieldDisplayCache.clear();
|
|
3464
|
+
}
|
|
3465
|
+
else {
|
|
3466
|
+
this.fieldDisplayCache.delete(field);
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
getFieldDisplayText(field, row) {
|
|
3470
|
+
if (["axis-components/text", "axis-components/badge"].includes(field.child()?.component)) {
|
|
3471
|
+
if (!this.fieldDisplayCache.has(field.field())) {
|
|
3472
|
+
this.fieldDisplayCache.set(field.field(), new Map());
|
|
3473
|
+
}
|
|
3474
|
+
if (!this.fieldDisplayCache.get(field.field()).has(row[field.field()])) {
|
|
3475
|
+
const child = this.scope?.snapshotOptions(field.child(), { row });
|
|
3476
|
+
let text;
|
|
3477
|
+
switch (child.component) {
|
|
3478
|
+
case "axis-components/text":
|
|
3479
|
+
switch (child.transfer) {
|
|
3480
|
+
case "date":
|
|
3481
|
+
if (child.data) {
|
|
3482
|
+
text = this.datePipe.transform(new Date(child.data), child.dateFormat);
|
|
3483
|
+
}
|
|
3484
|
+
else {
|
|
3485
|
+
text = '';
|
|
3486
|
+
}
|
|
3487
|
+
break;
|
|
3488
|
+
case "number":
|
|
3489
|
+
text = this.decimalPipe.transform(child.data, this.getDigitsInfo(child));
|
|
3490
|
+
break;
|
|
3491
|
+
case "percent":
|
|
3492
|
+
text = this.percentPipe.transform(child.data, this.getDigitsInfo(child));
|
|
3493
|
+
break;
|
|
3494
|
+
case "deepObj":
|
|
3495
|
+
text = this.getDeepObjectValue(child);
|
|
3496
|
+
break;
|
|
3497
|
+
default:
|
|
3498
|
+
text = child.data;
|
|
3499
|
+
break;
|
|
3500
|
+
}
|
|
3501
|
+
break;
|
|
3502
|
+
case "axis-components/badge":
|
|
3503
|
+
text = child.text;
|
|
3504
|
+
break;
|
|
3505
|
+
}
|
|
3506
|
+
this.fieldDisplayCache.get(field.field()).set(row[field.field()], text);
|
|
3507
|
+
}
|
|
3508
|
+
return this.fieldDisplayCache.get(field.field()).get(row[field.field()]);
|
|
3509
|
+
}
|
|
3510
|
+
return row[field.field()];
|
|
3511
|
+
}
|
|
3512
|
+
getDigitsInfo(options) {
|
|
3513
|
+
return `${options.integerMinLength}.${options.decimalRange[0]}-${options.decimalRange[1]}`;
|
|
3514
|
+
}
|
|
3515
|
+
getDeepObjectValue(options) {
|
|
3516
|
+
if (options.objPath) {
|
|
3517
|
+
const patharr = options.objPath.split(".").map(p => p.trim());
|
|
3518
|
+
let outValue = options.data;
|
|
3519
|
+
for (let p of patharr) {
|
|
3520
|
+
if (Array.isArray(outValue)) {
|
|
3521
|
+
outValue = outValue?.[+p];
|
|
3522
|
+
}
|
|
3523
|
+
else {
|
|
3524
|
+
outValue = outValue?.[p];
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
return outValue;
|
|
3528
|
+
}
|
|
3529
|
+
return options.data;
|
|
3530
|
+
}
|
|
3531
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TableFieldDisplayService, deps: [{ token: i1$5.DatePipe }, { token: i1$5.DecimalPipe }, { token: i1$5.PercentPipe }, { token: ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3532
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TableFieldDisplayService });
|
|
3533
|
+
}
|
|
3534
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TableFieldDisplayService, decorators: [{
|
|
3535
|
+
type: Injectable
|
|
3536
|
+
}], ctorParameters: () => [{ type: i1$5.DatePipe }, { type: i1$5.DecimalPipe }, { type: i1$5.PercentPipe }, { type: ScopeDirective, decorators: [{
|
|
3537
|
+
type: Optional
|
|
3538
|
+
}] }] });
|
|
3539
|
+
|
|
3540
|
+
class TableService {
|
|
3541
|
+
fieldDisplayService;
|
|
3542
|
+
constructor(fieldDisplayService) {
|
|
3543
|
+
this.fieldDisplayService = fieldDisplayService;
|
|
3544
|
+
effect(() => {
|
|
3545
|
+
if (!!this.fields) {
|
|
3546
|
+
this.refreshFieldControls();
|
|
3547
|
+
}
|
|
3548
|
+
});
|
|
3549
|
+
}
|
|
3550
|
+
data;
|
|
3551
|
+
options;
|
|
3552
|
+
fields;
|
|
3553
|
+
getRow;
|
|
3554
|
+
cacheFilterItem;
|
|
3555
|
+
displayFields = computed(() => this.fields().filter(f => f.inuse()), ...(ngDevMode ? [{ debugName: "displayFields" }] : []));
|
|
3556
|
+
fieldsControlsMap = signal({}, ...(ngDevMode ? [{ debugName: "fieldsControlsMap" }] : []));
|
|
3557
|
+
filedsFilterItemsCache = new Map();
|
|
3558
|
+
leaderFieldWidth = computed(() => this.buildLeaderFieldWidth(), ...(ngDevMode ? [{ debugName: "leaderFieldWidth" }] : []));
|
|
3559
|
+
pageSizeOptions = computed(() => this.options.pageSizeOptions().split(",").map(size => +size), ...(ngDevMode ? [{ debugName: "pageSizeOptions" }] : []));
|
|
3560
|
+
init(opts) {
|
|
3561
|
+
this.data = opts.data;
|
|
3562
|
+
this.options = opts.options;
|
|
3563
|
+
this.fields = opts.fields;
|
|
3564
|
+
this.getRow = opts.getRow;
|
|
3565
|
+
this.cacheFilterItem = opts.cacheFilterItem ?? true;
|
|
3566
|
+
this.refreshFieldControls();
|
|
3567
|
+
}
|
|
3568
|
+
refreshFieldControls(f) {
|
|
3569
|
+
if (!this.cacheFilterItem) {
|
|
3570
|
+
if (!f) {
|
|
3571
|
+
this.filedsFilterItemsCache.clear();
|
|
3572
|
+
}
|
|
3573
|
+
else {
|
|
3574
|
+
this.filedsFilterItemsCache.delete(f);
|
|
3575
|
+
}
|
|
3576
|
+
this.fieldDisplayService.clearCache(f);
|
|
3577
|
+
}
|
|
3578
|
+
const res = {};
|
|
3579
|
+
for (const field of this.displayFields()) {
|
|
3580
|
+
if (f && field.field() != f) {
|
|
3581
|
+
continue;
|
|
3582
|
+
}
|
|
3583
|
+
res[field.field()] = {};
|
|
3584
|
+
if (field.filterAble()) {
|
|
3585
|
+
if (!this.filedsFilterItemsCache.has(field.field())) {
|
|
3586
|
+
this.filedsFilterItemsCache.set(field.field(), new Map());
|
|
3587
|
+
}
|
|
3588
|
+
const filterItemsCache = this.filedsFilterItemsCache.get(field.field());
|
|
3589
|
+
for (let row of this.data() ?? []) {
|
|
3590
|
+
if (this.getRow) {
|
|
3591
|
+
row = this.getRow(row);
|
|
3592
|
+
}
|
|
3593
|
+
const value = row[field.field()];
|
|
3594
|
+
if (!filterItemsCache.has(value)) {
|
|
3595
|
+
filterItemsCache.set(value, { value, text: this.fieldDisplayService.getFieldDisplayText(field, row) });
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
res[field.field()].filterItems = Array.from(filterItemsCache.values());
|
|
3599
|
+
res[field.field()].filterFn = (fd, row) => {
|
|
3600
|
+
if (this.getRow) {
|
|
3601
|
+
row = this.getRow(row);
|
|
3602
|
+
}
|
|
3603
|
+
if (fd instanceof Array) {
|
|
3604
|
+
return fd.includes(row[field.field()]);
|
|
3605
|
+
}
|
|
3606
|
+
else {
|
|
3607
|
+
return fd == row[field.field()];
|
|
3608
|
+
}
|
|
3609
|
+
};
|
|
3610
|
+
}
|
|
3611
|
+
if (field.sortAble()) {
|
|
3612
|
+
if (this.data()?.map(row => this.getRow ? this.getRow(row) : row).some((row) => row[field.field()] != undefined && typeof (row[field.field()]) == "number")) {
|
|
3613
|
+
res[field.field()].sortFn = (a, b) => {
|
|
3614
|
+
if (this.getRow) {
|
|
3615
|
+
a = this.getRow(a);
|
|
3616
|
+
b = this.getRow(b);
|
|
3617
|
+
}
|
|
3618
|
+
return a[field.field()] - b[field.field()];
|
|
3619
|
+
};
|
|
3620
|
+
}
|
|
3621
|
+
else {
|
|
3622
|
+
res[field.field()].sortFn = (a, b) => {
|
|
3623
|
+
if (this.getRow) {
|
|
3624
|
+
a = this.getRow(a);
|
|
3625
|
+
b = this.getRow(b);
|
|
3626
|
+
}
|
|
3627
|
+
return ((a[field.field()] || "") + "").localeCompare(b[field.field()]);
|
|
3628
|
+
};
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
if (f) {
|
|
3633
|
+
this.fieldsControlsMap.set({
|
|
3634
|
+
...this.fieldsControlsMap(),
|
|
3635
|
+
...res
|
|
3636
|
+
});
|
|
3637
|
+
}
|
|
3638
|
+
else {
|
|
3639
|
+
this.fieldsControlsMap.set(res);
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
filterChange(field, value) {
|
|
3643
|
+
for (const item of this.filedsFilterItemsCache.get(field).values()) {
|
|
3644
|
+
item.byDefault = value != null && (Array.isArray(value) ? value.includes(item.value) : item.value == value);
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
buildLeaderFieldWidth() {
|
|
3648
|
+
switch (this.options.size()) {
|
|
3649
|
+
case "small":
|
|
3650
|
+
return 45;
|
|
3651
|
+
case "middle":
|
|
3652
|
+
return 50;
|
|
3653
|
+
default:
|
|
3654
|
+
return 65;
|
|
3655
|
+
}
|
|
3656
|
+
}
|
|
3657
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TableService, deps: [{ token: TableFieldDisplayService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3658
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TableService });
|
|
3659
|
+
}
|
|
3660
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: TableService, decorators: [{
|
|
3661
|
+
type: Injectable
|
|
3662
|
+
}], ctorParameters: () => [{ type: TableFieldDisplayService }] });
|
|
3663
|
+
|
|
3664
|
+
class SelectService {
|
|
3665
|
+
scope;
|
|
3666
|
+
constructor(scope) {
|
|
3667
|
+
this.scope = scope;
|
|
3668
|
+
}
|
|
3669
|
+
options;
|
|
3670
|
+
keyField;
|
|
3671
|
+
data;
|
|
3672
|
+
onSelectedChange;
|
|
3673
|
+
headerChecked = signal("none", ...(ngDevMode ? [{ debugName: "headerChecked" }] : []));
|
|
3674
|
+
setOfCheckedId = new Set();
|
|
3675
|
+
setOfIndeterminateId = new Set();
|
|
3676
|
+
setOfDisabledId = computed(() => this.buildDisabledId(), ...(ngDevMode ? [{ debugName: "setOfDisabledId" }] : []));
|
|
3677
|
+
init(opts) {
|
|
3678
|
+
this.options = opts.options;
|
|
3679
|
+
this.keyField = opts.keyField;
|
|
3680
|
+
this.data = opts.data;
|
|
3681
|
+
this.onSelectedChange = opts.onSelectedChange;
|
|
3682
|
+
}
|
|
3683
|
+
buildDisabledId() {
|
|
3684
|
+
if (this.options.disableCheckboxFn()) {
|
|
3685
|
+
const args = this.scope?.snapshotAll() ?? {};
|
|
3686
|
+
return new Set(this.data()?.filter(row => this.scope?.runFnWithSnapshot(this.options.disableCheckboxFn(), Object.assign({}, args, { row })))
|
|
3687
|
+
.map(row => row[this.keyField]));
|
|
3688
|
+
}
|
|
3689
|
+
return new Set();
|
|
3690
|
+
}
|
|
3691
|
+
onAllChecked(checked) {
|
|
3692
|
+
this.data()?.filter(row => !this.setOfDisabledId().has(row[this.keyField]))?.forEach(row => this.updateCheckedSet(row, checked));
|
|
3693
|
+
this.refreshCheckedStatus();
|
|
3694
|
+
}
|
|
3695
|
+
toggleChecked(row) {
|
|
3696
|
+
if (this.options.showCheckbox() && !this.setOfDisabledId().has(row[this.keyField])) {
|
|
3697
|
+
this.onItemChecked(row, !this.setOfCheckedId.has(row[this.keyField]));
|
|
3698
|
+
}
|
|
3699
|
+
}
|
|
3700
|
+
onItemChecked(row, checked) {
|
|
3701
|
+
this.updateCheckedSet(row, checked);
|
|
3702
|
+
this.refreshCheckedStatus();
|
|
3703
|
+
}
|
|
3704
|
+
updateCheckedSet(row, checked) {
|
|
3705
|
+
const key = row[this.keyField];
|
|
3706
|
+
if (checked && !this.setOfCheckedId.has(key)) {
|
|
3707
|
+
if (this.options.singleCheck()) {
|
|
3708
|
+
this.setOfCheckedId.clear();
|
|
3709
|
+
}
|
|
3710
|
+
this.setOfCheckedId.add(key);
|
|
3711
|
+
}
|
|
3712
|
+
else if (!checked && this.setOfCheckedId.has(key)) {
|
|
3713
|
+
this.setOfCheckedId.delete(key);
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
refreshCheckedStatus() {
|
|
3717
|
+
const listOfEnabledData = this.data()?.filter(row => !this.setOfDisabledId().has(row[this.keyField])) ?? [];
|
|
3718
|
+
const checked = listOfEnabledData.length > 0 && listOfEnabledData.every(row => this.setOfCheckedId.has(row[this.keyField]) && !this.setOfIndeterminateId.has(row[this.keyField]));
|
|
3719
|
+
if (checked) {
|
|
3720
|
+
this.headerChecked.set("checked");
|
|
3721
|
+
}
|
|
3722
|
+
else {
|
|
3723
|
+
const indeterminate = listOfEnabledData.some(row => this.setOfCheckedId.has(row[this.keyField]) || this.setOfIndeterminateId.has(row[this.keyField])) && !checked;
|
|
3724
|
+
this.headerChecked.set(indeterminate ? "indeterminate" : "none");
|
|
3725
|
+
}
|
|
3726
|
+
this.onSelectedChange?.(this.setOfCheckedId);
|
|
3727
|
+
}
|
|
3728
|
+
getSelectedData() {
|
|
3729
|
+
return this.data()?.filter(row => this.setOfCheckedId.has(row[this.keyField]));
|
|
3730
|
+
}
|
|
3731
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SelectService, deps: [{ token: ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3732
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SelectService });
|
|
3733
|
+
}
|
|
3734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: SelectService, decorators: [{
|
|
3735
|
+
type: Injectable
|
|
3736
|
+
}], ctorParameters: () => [{ type: ScopeDirective, decorators: [{
|
|
3737
|
+
type: Optional
|
|
3738
|
+
}] }] });
|
|
3739
|
+
|
|
3740
|
+
class ExpandService {
|
|
3741
|
+
scope;
|
|
3742
|
+
constructor(scope) {
|
|
3743
|
+
this.scope = scope;
|
|
3744
|
+
}
|
|
3745
|
+
options;
|
|
3746
|
+
keyField;
|
|
3747
|
+
data;
|
|
3748
|
+
expandedSet = new Set();
|
|
3749
|
+
nodeMap = computed(() => this.buildNodeMap(), ...(ngDevMode ? [{ debugName: "nodeMap" }] : []));
|
|
3750
|
+
init(opts) {
|
|
3751
|
+
this.options = opts.options;
|
|
3752
|
+
this.keyField = opts.keyField;
|
|
3753
|
+
this.data = opts.data;
|
|
3754
|
+
}
|
|
3755
|
+
buildNodeMap() {
|
|
3756
|
+
const nodeMap = new Map();
|
|
3757
|
+
if (this.options.showExpand() && this.options.expandMode() == "tree") {
|
|
3758
|
+
this.data()?.forEach((row) => {
|
|
3759
|
+
this.buildNodeMapForRow(row, nodeMap);
|
|
3760
|
+
});
|
|
3761
|
+
}
|
|
3762
|
+
return nodeMap;
|
|
3763
|
+
}
|
|
3764
|
+
onExpandChange(key, checked) {
|
|
3765
|
+
if (checked) {
|
|
3766
|
+
this.expandedSet.add(key);
|
|
3767
|
+
}
|
|
3768
|
+
else {
|
|
3769
|
+
this.expandedSet.delete(key);
|
|
3770
|
+
}
|
|
3771
|
+
}
|
|
3772
|
+
buildNodeMapForRow(row, nodeMap, parentLevel = 0) {
|
|
3773
|
+
const node = {
|
|
3774
|
+
level: parentLevel + 1,
|
|
3775
|
+
node: row,
|
|
3776
|
+
children: []
|
|
3777
|
+
};
|
|
3778
|
+
nodeMap.set(row[this.keyField], node);
|
|
3779
|
+
if (this.options.showExpand() && this.options.expandMode() == "tree") {
|
|
3780
|
+
let children;
|
|
3781
|
+
if (this.options.treeChildrenFun()) {
|
|
3782
|
+
children = this.scope?.runFnWithSnapshot(this.options.treeChildrenFun(), { row });
|
|
3783
|
+
}
|
|
3784
|
+
else {
|
|
3785
|
+
children = row.children;
|
|
3786
|
+
}
|
|
3787
|
+
if (children?.length) {
|
|
3788
|
+
node.children = children;
|
|
3789
|
+
children.forEach(child => {
|
|
3790
|
+
this.buildNodeMapForRow(child, nodeMap, node.level);
|
|
3791
|
+
});
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
getListForExpanded(row) {
|
|
3796
|
+
const key = row[this.keyField];
|
|
3797
|
+
let res = [row];
|
|
3798
|
+
if (this.options.showExpand() && this.options.expandMode() == "tree" && this.nodeMap().get(key)?.children?.length && this.expandedSet.has(key)) {
|
|
3799
|
+
res = res.concat(this.nodeMap().get(key).children);
|
|
3800
|
+
}
|
|
3801
|
+
return res;
|
|
3802
|
+
}
|
|
3803
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ExpandService, deps: [{ token: ScopeDirective, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3804
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ExpandService });
|
|
3805
|
+
}
|
|
3806
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.6", ngImport: i0, type: ExpandService, decorators: [{
|
|
3807
|
+
type: Injectable
|
|
3808
|
+
}], ctorParameters: () => [{ type: ScopeDirective, decorators: [{
|
|
3809
|
+
type: Optional
|
|
3810
|
+
}] }] });
|
|
3811
|
+
|
|
3448
3812
|
class ComponentsLoader {
|
|
3449
3813
|
components = inject(AXIS_COMPONENTS_TOKEN);
|
|
3450
3814
|
loadedMap = new Map();
|
|
@@ -3497,5 +3861,5 @@ function nameCode(name, code) {
|
|
|
3497
3861
|
* Generated bundle index. Do not edit.
|
|
3498
3862
|
*/
|
|
3499
3863
|
|
|
3500
|
-
export { AXIS_COMPONENTS_LOADER_TOKEN, AXIS_COMPONENTS_TOKEN, AXIS_CURRENT_USER_PERMISSIONS_TOKEN, AXIS_DESIGN_ALL_PERMISSIONS_TOKEN, AXIS_DESIGN_CHOOSE_COMPONENT_FUNC_TOKEN, AXIS_DESIGN_CMPLIBS_TOKEN, AXIS_DESIGN_COMPONENT_INFO_FOR_SETTING_TOKEN, AXIS_DESIGN_COMPONENT_REF_FOR_SETTING_TOKEN, AXIS_DESIGN_COMPONENT_REF_GETTER_TOKEN, AXIS_DESIGN_OPTIONS_NODE_FOR_MENU, AXIS_DESIGN_SCOPE_INFOS_GETTER_TOKEN, AXIS_EVENT_HANDLERS_TOKEN, AXIS_EVENT_HANDLER_DESCS_TOKEN, AXIS_FILE_BASE_URL_TOKEN, AXIS_FORM_REGISTE_CONTROL_TOKEN, AXIS_HTTP_CONTEXT_DATA_TOKEN, AXIS_HTTP_CONTEXT_TOKEN, AXIS_INJECT_DATA_TOKEN, AXIS_INJECT_FUNC_TOKEN, AXIS_SCRIPTS_TOKEN, Base, BaseDesignSetting, BaseMenu, BaseOptions, CommonMenu, ComponentsLoader, DataHandler, DataOptions, DesignBuilder, DynamicDirective, ElementNode, FilteredTreeResult, FormValidators, FunField, FunFieldBase, FunFieldValueBase, HowLongPipe, InputTrigger, InputValidator, OptionsNode, ScopeDirective, SimpleMenu, ValueAccess, ValueAccessOptions, ValueDesignSetting, assignDefaultField, baseFbConfig, baseFunField, buildValidators, codeName, copy, deepMerge, fn, isEquals, listSort, nameCode, obj2Arr, objDiff, rebuildObject, recursionArray, recursionObject, sendApi, trackByFn, updateAndValidAll, valueFbConfig, valueFunField };
|
|
3864
|
+
export { AXIS_COMPONENTS_LOADER_TOKEN, AXIS_COMPONENTS_TOKEN, AXIS_CURRENT_USER_PERMISSIONS_TOKEN, AXIS_DESIGN_ALL_PERMISSIONS_TOKEN, AXIS_DESIGN_CHOOSE_COMPONENT_FUNC_TOKEN, AXIS_DESIGN_CMPLIBS_TOKEN, AXIS_DESIGN_COMPONENT_INFO_FOR_SETTING_TOKEN, AXIS_DESIGN_COMPONENT_REF_FOR_SETTING_TOKEN, AXIS_DESIGN_COMPONENT_REF_GETTER_TOKEN, AXIS_DESIGN_OPTIONS_NODE_FOR_MENU, AXIS_DESIGN_SCOPE_INFOS_GETTER_TOKEN, AXIS_EVENT_HANDLERS_TOKEN, AXIS_EVENT_HANDLER_DESCS_TOKEN, AXIS_FILE_BASE_URL_TOKEN, AXIS_FORM_REGISTE_CONTROL_TOKEN, AXIS_HTTP_CONTEXT_DATA_TOKEN, AXIS_HTTP_CONTEXT_TOKEN, AXIS_INJECT_DATA_TOKEN, AXIS_INJECT_FUNC_TOKEN, AXIS_SCRIPTS_TOKEN, Base, BaseDesignSetting, BaseMenu, BaseOptions, CommonMenu, ComponentsLoader, DataHandler, DataOptions, DesignBuilder, DynamicDirective, ElementNode, ExpandService, FilteredTreeResult, FormValidators, FunField, FunFieldBase, FunFieldValueBase, HowLongPipe, InputTrigger, InputValidator, OptionsNode, ScopeDirective, SelectService, SimpleMenu, TableFieldDisplayService, TableService, ValueAccess, ValueAccessOptions, ValueDesignSetting, assignDefaultField, baseFbConfig, baseFunField, buildValidators, codeName, copy, deepMerge, fn, isEquals, listSort, nameCode, obj2Arr, objDiff, rebuildObject, recursionArray, recursionObject, sendApi, trackByFn, updateAndValidAll, valueFbConfig, valueFunField };
|
|
3501
3865
|
//# sourceMappingURL=ngx-axis-appforge-core.mjs.map
|