@dignite-ng/expand.cms 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/lib/cms-routing.module.mjs +2 -2
- package/esm2022/lib/cms.module.mjs +20 -28
- package/esm2022/lib/components/admin/entries/create-or-edit-entries.component.mjs +10 -4
- package/esm2022/lib/components/admin/fields/create-or-edit-field.component.mjs +20 -11
- package/esm2022/lib/components/dynamic-form/form-control-group.mjs +18 -18
- package/esm2022/lib/components/dynamic-form/index.mjs +3 -3
- package/esm2022/lib/components/dynamic-form/matrix/index.mjs +4 -0
- package/esm2022/lib/components/dynamic-form/matrix/matrix-config.component.mjs +229 -0
- package/esm2022/lib/components/dynamic-form/matrix/matrix-config.mjs +50 -0
- package/esm2022/lib/components/dynamic-form/matrix/matrix-control.component.mjs +111 -0
- package/esm2022/lib/components/dynamic-form/table/index.mjs +4 -0
- package/esm2022/lib/components/dynamic-form/table/table-config.component.mjs +174 -0
- package/esm2022/lib/components/dynamic-form/table/table-config.mjs +38 -0
- package/esm2022/lib/components/dynamic-form/table/table-control.component.mjs +114 -0
- package/esm2022/lib/services/field-abstracts.service.mjs +1 -1
- package/fesm2022/dignite-ng-expand.cms.mjs +732 -56
- package/fesm2022/dignite-ng-expand.cms.mjs.map +1 -1
- package/lib/cms.module.d.ts +20 -16
- package/lib/components/admin/entries/create-or-edit-entries.component.d.ts +3 -1
- package/lib/components/admin/fields/create-or-edit-field.component.d.ts +4 -0
- package/lib/components/dynamic-form/index.d.ts +2 -0
- package/lib/components/dynamic-form/matrix/index.d.ts +3 -0
- package/lib/components/dynamic-form/matrix/matrix-config.component.d.ts +73 -0
- package/lib/components/dynamic-form/matrix/matrix-config.d.ts +24 -0
- package/lib/components/dynamic-form/matrix/matrix-control.component.d.ts +39 -0
- package/lib/components/dynamic-form/table/index.d.ts +3 -0
- package/lib/components/dynamic-form/table/table-config.component.d.ts +58 -0
- package/lib/components/dynamic-form/table/table-config.d.ts +18 -0
- package/lib/components/dynamic-form/table/table-control.component.d.ts +36 -0
- package/lib/services/field-abstracts.service.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { EventEmitter, Injectable, inject, Component, Input, ViewChild, Output, InjectionToken, RendererFactory2, NgModule } from '@angular/core';
|
|
2
|
+
import { EventEmitter, Injectable, inject, Component, ViewContainerRef, Input, ViewChildren, ViewChild, Output, InjectionToken, RendererFactory2, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@abp/ng.core';
|
|
4
4
|
import { mapEnumToOptions, ListService, LIST_QUERY_DEBOUNCE_TIME, ConfigStateService, AuthGuard, PermissionGuard, LazyModuleFactory, CoreModule } from '@abp/ng.core';
|
|
5
5
|
import * as i3 from '@abp/ng.theme.shared';
|
|
@@ -21,14 +21,15 @@ import * as i9 from '@abp/ng.components/page';
|
|
|
21
21
|
import { PageModule } from '@abp/ng.components/page';
|
|
22
22
|
import { pinyin } from 'pinyin-pro';
|
|
23
23
|
import * as i1$2 from '@angular/platform-browser';
|
|
24
|
-
import * as
|
|
25
|
-
import {
|
|
24
|
+
import * as i8 from '@dignite-ng/expand.dynamic-form';
|
|
25
|
+
import { CreateDynamicComponentsService, DynamicFormModule } from '@dignite-ng/expand.dynamic-form';
|
|
26
26
|
import * as i4 from 'ng-zorro-antd/select';
|
|
27
27
|
import { NzSelectModule } from 'ng-zorro-antd/select';
|
|
28
|
+
import * as i7$2 from 'ng-zorro-antd/table';
|
|
29
|
+
import { NzTableModule } from 'ng-zorro-antd/table';
|
|
28
30
|
import { map, tap } from 'rxjs';
|
|
29
31
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
|
30
32
|
import { CommercialUiConfigModule } from '@volo/abp.commercial.ng.ui/config';
|
|
31
|
-
import { NzTableModule } from 'ng-zorro-antd/table';
|
|
32
33
|
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
33
34
|
|
|
34
35
|
var EntryStatus;
|
|
@@ -826,6 +827,9 @@ class CreateOrEditEntriesComponent {
|
|
|
826
827
|
await this.getAllVersionsList();
|
|
827
828
|
}
|
|
828
829
|
}
|
|
830
|
+
/**表单控件模板-动态表单配置组件 */
|
|
831
|
+
FormDynamicontrolRef;
|
|
832
|
+
// private _CreateDynamicComponentsService = inject(CreateDynamicComponentsService)
|
|
829
833
|
/**定义自定义异步验证 */
|
|
830
834
|
cultureAsyncValidator_test() {
|
|
831
835
|
return (ctrl) => {
|
|
@@ -954,11 +958,11 @@ class CreateOrEditEntriesComponent {
|
|
|
954
958
|
});
|
|
955
959
|
}
|
|
956
960
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateOrEditEntriesComponent, deps: [{ token: i3.ToasterService }, { token: i2.Location }, { token: i1.ConfigStateService }, { token: SectionAdminService }, { token: EntryAdminService }, { token: i2.DatePipe }, { token: i1.LocalizationService }, { token: i3$1.Router }, { token: CmsApiService }], target: i0.ɵɵFactoryTarget.Component });
|
|
957
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CreateOrEditEntriesComponent, selector: "cms-create-or-edit-entries", inputs: { isEdit: "isEdit", ParentQueryParams: "ParentQueryParams", entity: "entity", parentEntrySelect: "parentEntrySelect" }, ngImport: i0, template: "<div class=\"create-or-edit-entry-page\" [formGroup]=\"_entity\">\n <div class=\"container \">\n <div class=\"row\">\n <div class=\"col-md-8 \">\n <div class=\"card p-2\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"title\">{{'Cms::Title' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" (blur)=\"setTitleToSlugBlur($event)\"\n formControlName=\"title\">\n </div>\n <ng-container *ngFor=\"let item of entryTypesItem?.fieldTabs\">\n <ng-container *ngFor=\"let el of item.fields\">\n <ng-container *ngIf=\"el&&_entity\">\n <df-dynamic [entity]=\"_entity\" [fields]=\"el\"\n [selected]=\"entrySelect ? entrySelect.extraProperties[el.field.name] : ''\"\n [parentFiledName]=\"'extraProperties'\" [culture]=\"cultureinput.value\" ></df-dynamic>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-4 \">\n <div class=\"card mb-0 p-2\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"slug\">{{'Cms::Slug' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"slug\" >\n <div class=\"text-danger invalid-feedback\" *ngIf=\"sluginput.errors?.repetition\">\n {{sluginput.errors?.repetition}}\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"culture\">{{'AbpUi::Languages' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"culture\" >\n <ng-container *ngFor=\"let item of languagesList;let i =index\">\n <option [value]=\"item.cultureName\">{{item.displayName}}</option>\n </ng-container>\n </select>\n <input type=\"text\" formControlName=\"culture_shadow\" style=\"position: absolute;z-index: -1;opacity: 0;\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"culture_shadowInput.errors?.repetition\">\n {{culture_shadowInput.errors?.repetition}}\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"parentId\">{{'Cms::ParentEntry' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"parentId\">\n <option value=\"\"></option>\n <ng-container *ngFor=\"let item of entryTypesList;let i =index\">\n <option [value]=\"item.id\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"publishTime\">{{'Cms::PublishTime' | abpLocalization}}</label>\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"publishTime\">\n </div>\n <!-- RevisionEntryId -->\n <div class=\"mb-2\" *ngIf=\"isEdit\">\n <label class=\"form-label\" for=\"publishTime\">{{'Cms::Version' | abpLocalization}}</label>\n <ul class=\"list-group\">\n <ng-container *ngFor=\"let item of AllVersionsList\">\n <li class=\"list-group-item flex-between\">\n <div>\n {{item.initialVersionId?(item.creationTime| date: 'YYYY/MM/dd HH:m:s'):('Cms::InitialVersion' | abpLocalization)}}\n <span class=\"badge text-bg-success ms-1\"\n *ngIf=\"item.isActivatedVersion\">{{'Cms::IsActive' | abpLocalization}}</span>\n <span class=\"badge text-bg-primary ms-1\"\n *ngIf=\"item.id === RevisionEntryId\">{{'Cms::Editing' | abpLocalization}}</span>\n </div>\n <div>\n <div ngbDropdown class=\"d-inline-block\">\n <button type=\"button\" class=\"btn btn-link-primary p-2 \"\n style=\"line-height: 0;\" id=\"dropdownBasic1\" ngbDropdownToggle>\n </button>\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\">\n <button ngbDropdownItem type=\"button\" *ngIf=\"!item.isActivatedVersion\"\n (click)=\"ActivatedVersion(item.id)\">\n <i class=\"fas fa-check me-1\"></i>{{'Cms::IsActive' | abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\"\n routerLink=\"/cms/admin/entries/create\"\n [queryParams]=\"{RevisionEntryId:item.id}\">\n <i class=\"fas fa-plus me-1\"></i>{{'Cms::NewVersion' | abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\" (click.stop)=\"toEditUrl(item.id)\"\n *ngIf=\"item.id !== RevisionEntryId\">\n <i class=\"fas fa-edit me-1\"></i>{{'AbpUi::Edit' | abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\"\n (click.stop)=\"delectVersion(item.id)\"\n *ngIf=\"item.initialVersionId&&!item.isActivatedVersion&&item.id !== RevisionEntryId\">\n <i class=\"fas fa-trash me-1\"></i>{{'AbpUi::Delete' | abpLocalization}}\n </button>\n </div>\n </div>\n </div>\n </li>\n </ng-container>\n </ul>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"versionNotes\">{{'Cms::RevisionNotes' | abpLocalization}}</label>\n <textarea class=\"form-control\" formControlName=\"versionNotes\" rows=\"3\"></textarea>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>", styles: ["::ng-deep .create-or-edit-entry-page .dignite_page{height:calc(100vh - 125px);overflow:auto;background:transparent}::ng-deep .create-or-edit-entry-page .form-control,::ng-deep .create-or-edit-entry-page .form-select{padding:.475rem 1.25rem}::ng-deep .create-or-edit-entry-page .cursor-move{cursor:move}::ng-deep .create-or-edit-entry-page .bordernNavs{border:var(--bs-border-width) solid var(--lpx-border-color);padding-left:inherit;padding-right:inherit}::ng-deep .create-or-edit-entry-page .flex-between{display:flex;align-items:center;justify-content:space-between}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.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$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i7$1.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i7$1.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "directive", type: i10.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i10.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i10.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i10.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["disabled"] }, { kind: "component", type: i11.DynamicComponent, selector: "df-dynamic", inputs: ["selected", "type", "entity", "culture", "parentFiledName", "fields"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }] });
|
|
961
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CreateOrEditEntriesComponent, selector: "cms-create-or-edit-entries", inputs: { isEdit: "isEdit", ParentQueryParams: "ParentQueryParams", entity: "entity", parentEntrySelect: "parentEntrySelect" }, viewQueries: [{ propertyName: "FormDynamicontrolRef", predicate: ["FormDynamicontrolRef"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div class=\"create-or-edit-entry-page\" [formGroup]=\"_entity\">\n <div class=\"container \">\n <div class=\"row\">\n <div class=\"col-md-8 \">\n <div class=\"card p-2\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"title\">{{'Cms::Title' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" (blur)=\"setTitleToSlugBlur($event)\"\n formControlName=\"title\">\n </div>\n <template #FormDynamicRef></template>\n <ng-container *ngFor=\"let item of entryTypesItem?.fieldTabs;let i =index\">\n <ng-container *ngFor=\"let el of item.fields;let i1 =index\">\n <ng-container *ngIf=\"el&&_entity\">\n <df-dynamic [entity]=\"_entity\" [fields]=\"el\"\n [selected]=\"entrySelect ? entrySelect.extraProperties[el.field.name] : ''\"\n [parentFiledName]=\"'extraProperties'\" [culture]=\"cultureinput.value\" ></df-dynamic>\n\n\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-4 \">\n <div class=\"card mb-0 p-2\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"slug\">{{'Cms::Slug' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"slug\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"sluginput.errors?.repetition\">\n {{sluginput.errors?.repetition}}\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"culture\">{{'AbpUi::Languages' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"culture\">\n <ng-container *ngFor=\"let item of languagesList;let i =index\">\n <option [value]=\"item.cultureName\">{{item.displayName}}</option>\n </ng-container>\n </select>\n <input type=\"text\" formControlName=\"culture_shadow\"\n style=\"position: absolute;z-index: -1;opacity: 0;\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"culture_shadowInput.errors?.repetition\">\n {{culture_shadowInput.errors?.repetition}}\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"parentId\">{{'Cms::ParentEntry' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"parentId\">\n <option value=\"\"></option>\n <ng-container *ngFor=\"let item of entryTypesList;let i =index\">\n <option [value]=\"item.id\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"publishTime\">{{'Cms::PublishTime' | abpLocalization}}</label>\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"publishTime\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isEdit\">\n <label class=\"form-label\" for=\"publishTime\">{{'Cms::Version' | abpLocalization}}</label>\n <ul class=\"list-group\">\n <ng-container *ngFor=\"let item of AllVersionsList\">\n <li class=\"list-group-item flex-between\">\n <div>\n {{item.initialVersionId?(item.creationTime| date: 'YYYY/MM/dd HH:m:s'):('Cms::InitialVersion' | abpLocalization)}}\n <span class=\"badge text-bg-success ms-1\"\n *ngIf=\"item.isActivatedVersion\">{{'Cms::IsActive' | abpLocalization}}</span>\n <span class=\"badge text-bg-primary ms-1\"\n *ngIf=\"item.id === RevisionEntryId\">{{'Cms::Editing' |\n abpLocalization}}</span>\n </div>\n <div>\n <div ngbDropdown class=\"d-inline-block\">\n <button type=\"button\" class=\"btn btn-link-primary p-2 \"\n style=\"line-height: 0;\" id=\"dropdownBasic1\" ngbDropdownToggle>\n </button>\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\">\n <button ngbDropdownItem type=\"button\" *ngIf=\"!item.isActivatedVersion\"\n (click)=\"ActivatedVersion(item.id)\">\n <i class=\"fas fa-check me-1\"></i>{{'Cms::IsActive' |\n abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\"\n routerLink=\"/cms/admin/entries/create\"\n [queryParams]=\"{RevisionEntryId:item.id}\">\n <i class=\"fas fa-plus me-1\"></i>{{'Cms::NewVersion' |\n abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\" (click.stop)=\"toEditUrl(item.id)\"\n *ngIf=\"item.id !== RevisionEntryId\">\n <i class=\"fas fa-edit me-1\"></i>{{'AbpUi::Edit' | abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\"\n (click.stop)=\"delectVersion(item.id)\"\n *ngIf=\"item.initialVersionId&&!item.isActivatedVersion&&item.id !== RevisionEntryId\">\n <i class=\"fas fa-trash me-1\"></i>{{'AbpUi::Delete' |\n abpLocalization}}\n </button>\n </div>\n </div>\n </div>\n </li>\n </ng-container>\n </ul>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"versionNotes\">{{'Cms::RevisionNotes' | abpLocalization}}</label>\n <textarea class=\"form-control\" formControlName=\"versionNotes\" rows=\"3\"></textarea>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>", styles: ["::ng-deep .create-or-edit-entry-page .dignite_page{height:calc(100vh - 125px);overflow:auto;background:transparent}::ng-deep .create-or-edit-entry-page .form-control,::ng-deep .create-or-edit-entry-page .form-select{padding:.475rem 1.25rem}::ng-deep .create-or-edit-entry-page .cursor-move{cursor:move}::ng-deep .create-or-edit-entry-page .bordernNavs{border:var(--bs-border-width) solid var(--lpx-border-color);padding-left:inherit;padding-right:inherit}::ng-deep .create-or-edit-entry-page .flex-between{display:flex;align-items:center;justify-content:space-between}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.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$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "directive", type: i1.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i7$1.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i7$1.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "directive", type: i10.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i10.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i10.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i10.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["disabled"] }, { kind: "component", type: i8.DynamicComponent, selector: "df-dynamic", inputs: ["selected", "type", "entity", "culture", "parentFiledName", "fields"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }] });
|
|
958
962
|
}
|
|
959
963
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateOrEditEntriesComponent, decorators: [{
|
|
960
964
|
type: Component,
|
|
961
|
-
args: [{ selector: 'cms-create-or-edit-entries', template: "<div class=\"create-or-edit-entry-page\" [formGroup]=\"_entity\">\n <div class=\"container \">\n <div class=\"row\">\n <div class=\"col-md-8 \">\n <div class=\"card p-2\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"title\">{{'Cms::Title' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\"
|
|
965
|
+
args: [{ selector: 'cms-create-or-edit-entries', template: "<div class=\"create-or-edit-entry-page\" [formGroup]=\"_entity\">\n <div class=\"container \">\n <div class=\"row\">\n <div class=\"col-md-8 \">\n <div class=\"card p-2\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"title\">{{'Cms::Title' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" (blur)=\"setTitleToSlugBlur($event)\"\n formControlName=\"title\">\n </div>\n <template #FormDynamicRef></template>\n <ng-container *ngFor=\"let item of entryTypesItem?.fieldTabs;let i =index\">\n <ng-container *ngFor=\"let el of item.fields;let i1 =index\">\n <ng-container *ngIf=\"el&&_entity\">\n <df-dynamic [entity]=\"_entity\" [fields]=\"el\"\n [selected]=\"entrySelect ? entrySelect.extraProperties[el.field.name] : ''\"\n [parentFiledName]=\"'extraProperties'\" [culture]=\"cultureinput.value\" ></df-dynamic>\n\n\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-4 \">\n <div class=\"card mb-0 p-2\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"slug\">{{'Cms::Slug' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"slug\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"sluginput.errors?.repetition\">\n {{sluginput.errors?.repetition}}\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"culture\">{{'AbpUi::Languages' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"culture\">\n <ng-container *ngFor=\"let item of languagesList;let i =index\">\n <option [value]=\"item.cultureName\">{{item.displayName}}</option>\n </ng-container>\n </select>\n <input type=\"text\" formControlName=\"culture_shadow\"\n style=\"position: absolute;z-index: -1;opacity: 0;\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"culture_shadowInput.errors?.repetition\">\n {{culture_shadowInput.errors?.repetition}}\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"parentId\">{{'Cms::ParentEntry' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"parentId\">\n <option value=\"\"></option>\n <ng-container *ngFor=\"let item of entryTypesList;let i =index\">\n <option [value]=\"item.id\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"publishTime\">{{'Cms::PublishTime' | abpLocalization}}</label>\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"publishTime\">\n </div>\n <div class=\"mb-2\" *ngIf=\"isEdit\">\n <label class=\"form-label\" for=\"publishTime\">{{'Cms::Version' | abpLocalization}}</label>\n <ul class=\"list-group\">\n <ng-container *ngFor=\"let item of AllVersionsList\">\n <li class=\"list-group-item flex-between\">\n <div>\n {{item.initialVersionId?(item.creationTime| date: 'YYYY/MM/dd HH:m:s'):('Cms::InitialVersion' | abpLocalization)}}\n <span class=\"badge text-bg-success ms-1\"\n *ngIf=\"item.isActivatedVersion\">{{'Cms::IsActive' | abpLocalization}}</span>\n <span class=\"badge text-bg-primary ms-1\"\n *ngIf=\"item.id === RevisionEntryId\">{{'Cms::Editing' |\n abpLocalization}}</span>\n </div>\n <div>\n <div ngbDropdown class=\"d-inline-block\">\n <button type=\"button\" class=\"btn btn-link-primary p-2 \"\n style=\"line-height: 0;\" id=\"dropdownBasic1\" ngbDropdownToggle>\n </button>\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\">\n <button ngbDropdownItem type=\"button\" *ngIf=\"!item.isActivatedVersion\"\n (click)=\"ActivatedVersion(item.id)\">\n <i class=\"fas fa-check me-1\"></i>{{'Cms::IsActive' |\n abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\"\n routerLink=\"/cms/admin/entries/create\"\n [queryParams]=\"{RevisionEntryId:item.id}\">\n <i class=\"fas fa-plus me-1\"></i>{{'Cms::NewVersion' |\n abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\" (click.stop)=\"toEditUrl(item.id)\"\n *ngIf=\"item.id !== RevisionEntryId\">\n <i class=\"fas fa-edit me-1\"></i>{{'AbpUi::Edit' | abpLocalization}}\n </button>\n <button ngbDropdownItem type=\"button\"\n (click.stop)=\"delectVersion(item.id)\"\n *ngIf=\"item.initialVersionId&&!item.isActivatedVersion&&item.id !== RevisionEntryId\">\n <i class=\"fas fa-trash me-1\"></i>{{'AbpUi::Delete' |\n abpLocalization}}\n </button>\n </div>\n </div>\n </div>\n </li>\n </ng-container>\n </ul>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"versionNotes\">{{'Cms::RevisionNotes' | abpLocalization}}</label>\n <textarea class=\"form-control\" formControlName=\"versionNotes\" rows=\"3\"></textarea>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>", styles: ["::ng-deep .create-or-edit-entry-page .dignite_page{height:calc(100vh - 125px);overflow:auto;background:transparent}::ng-deep .create-or-edit-entry-page .form-control,::ng-deep .create-or-edit-entry-page .form-select{padding:.475rem 1.25rem}::ng-deep .create-or-edit-entry-page .cursor-move{cursor:move}::ng-deep .create-or-edit-entry-page .bordernNavs{border:var(--bs-border-width) solid var(--lpx-border-color);padding-left:inherit;padding-right:inherit}::ng-deep .create-or-edit-entry-page .flex-between{display:flex;align-items:center;justify-content:space-between}\n"] }]
|
|
962
966
|
}], ctorParameters: function () { return [{ type: i3.ToasterService }, { type: i2.Location }, { type: i1.ConfigStateService }, { type: SectionAdminService }, { type: EntryAdminService }, { type: i2.DatePipe }, { type: i1.LocalizationService }, { type: i3$1.Router }, { type: CmsApiService }]; }, propDecorators: { isEdit: [{
|
|
963
967
|
type: Input
|
|
964
968
|
}], ParentQueryParams: [{
|
|
@@ -967,6 +971,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
967
971
|
type: Input
|
|
968
972
|
}], parentEntrySelect: [{
|
|
969
973
|
type: Input
|
|
974
|
+
}], FormDynamicontrolRef: [{
|
|
975
|
+
type: ViewChildren,
|
|
976
|
+
args: ['FormDynamicontrolRef', { read: ViewContainerRef }]
|
|
970
977
|
}] } });
|
|
971
978
|
|
|
972
979
|
class CreateComponent {
|
|
@@ -1440,6 +1447,8 @@ class CreateOrEditFieldComponent {
|
|
|
1440
1447
|
_CmsApiService;
|
|
1441
1448
|
_FieldAdminService;
|
|
1442
1449
|
_LocalizationService;
|
|
1450
|
+
/**表单控件模板-动态表单配置组件 */
|
|
1451
|
+
FormDynamicRef;
|
|
1443
1452
|
constructor(_FieldAbstractsService, _CmsApiService, _FieldAdminService, _LocalizationService) {
|
|
1444
1453
|
this._FieldAbstractsService = _FieldAbstractsService;
|
|
1445
1454
|
this._CmsApiService = _CmsApiService;
|
|
@@ -1452,9 +1461,10 @@ class CreateOrEditFieldComponent {
|
|
|
1452
1461
|
/**表单实体 */
|
|
1453
1462
|
_Entity;
|
|
1454
1463
|
set Entity(v) {
|
|
1455
|
-
|
|
1456
|
-
|
|
1464
|
+
if (v) {
|
|
1465
|
+
this._Entity = v;
|
|
1457
1466
|
this.dataLoaded();
|
|
1467
|
+
}
|
|
1458
1468
|
}
|
|
1459
1469
|
get formControlName() {
|
|
1460
1470
|
return this._Entity.get('formControlName');
|
|
@@ -1463,11 +1473,13 @@ class CreateOrEditFieldComponent {
|
|
|
1463
1473
|
_selected_copy;
|
|
1464
1474
|
_selected;
|
|
1465
1475
|
set selected(v) {
|
|
1466
|
-
if (
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1476
|
+
if (v) {
|
|
1477
|
+
this._selected = v || '';
|
|
1478
|
+
this._selected_copy = v;
|
|
1479
|
+
this.dataLoaded();
|
|
1480
|
+
}
|
|
1470
1481
|
}
|
|
1482
|
+
_CreateDynamicComponentsService = inject(CreateDynamicComponentsService);
|
|
1471
1483
|
async dataLoaded() {
|
|
1472
1484
|
if (this._FieldAbstractsService.fromControlList.length == 0) {
|
|
1473
1485
|
await this._FieldAbstractsService.getFromControlList();
|
|
@@ -1524,12 +1536,15 @@ class CreateOrEditFieldComponent {
|
|
|
1524
1536
|
formControlNameChange() {
|
|
1525
1537
|
}
|
|
1526
1538
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateOrEditFieldComponent, deps: [{ token: FieldAbstractsService }, { token: CmsApiService }, { token: FieldAdminService }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1527
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CreateOrEditFieldComponent, selector: "cms-create-or-edit-field", inputs: { Entity: "Entity", selected: "selected" }, ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"groupId\">{{'Cms::FieldGroup' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"groupId\">\n <option value=\"\">{{'Cms::OptionalGrouping' | abpLocalization}}</option>\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fieldGroupList\">\n <option [value]=\"item.id\">{{item.name}}</option>\n </ng-container>\n </select>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'DigniteAbpForms::FieldDisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\" (input)=\"nameInputBlur($event)\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"nameInput.errors?.repetition\">\n {{nameInput.errors?.repetition}}\n </div>\n <div class=\"form-text\">{{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\" (change)=\"formControlNameChange()\">\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fromControlList;let i =index\">\n <option [value]=\"item.name\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"_Entity.value.formControlName&&_Entity\"
|
|
1539
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CreateOrEditFieldComponent, selector: "cms-create-or-edit-field", inputs: { Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "FormDynamicRef", first: true, predicate: ["FormDynamicRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"groupId\">{{'Cms::FieldGroup' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"groupId\">\n <option value=\"\">{{'Cms::OptionalGrouping' | abpLocalization}}</option>\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fieldGroupList\">\n <option [value]=\"item.id\">{{item.name}}</option>\n </ng-container>\n </select>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'DigniteAbpForms::FieldDisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\" (input)=\"nameInputBlur($event)\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"nameInput.errors?.repetition\">\n {{nameInput.errors?.repetition}}\n </div>\n <div class=\"form-text\">{{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\" (change)=\"formControlNameChange()\">\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fromControlList;let i =index\">\n <option [value]=\"item.name\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"_Entity.value.formControlName&&_Entity\"> \n <df-dynamic [type]=\"_Entity.value.formControlName\" [entity]=\"_Entity\" [selected]=\"_selected\"></df-dynamic>\n </ng-container>\n\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.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$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i7$1.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i7$1.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "component", type: i8.DynamicComponent, selector: "df-dynamic", inputs: ["selected", "type", "entity", "culture", "parentFiledName", "fields"] }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }] });
|
|
1528
1540
|
}
|
|
1529
1541
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CreateOrEditFieldComponent, decorators: [{
|
|
1530
1542
|
type: Component,
|
|
1531
|
-
args: [{ selector: 'cms-create-or-edit-field', template: "<form [formGroup]=\"_Entity\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"groupId\">{{'Cms::FieldGroup' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"groupId\">\n <option value=\"\">{{'Cms::OptionalGrouping' | abpLocalization}}</option>\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fieldGroupList\">\n <option [value]=\"item.id\">{{item.name}}</option>\n </ng-container>\n </select>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'DigniteAbpForms::FieldDisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\" (input)=\"nameInputBlur($event)\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"nameInput.errors?.repetition\">\n {{nameInput.errors?.repetition}}\n </div>\n <div class=\"form-text\">{{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\" (change)=\"formControlNameChange()\">\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fromControlList;let i =index\">\n <option [value]=\"item.name\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"_Entity.value.formControlName&&_Entity\"
|
|
1532
|
-
}], ctorParameters: function () { return [{ type: FieldAbstractsService }, { type: CmsApiService }, { type: FieldAdminService }, { type: i1.LocalizationService }]; }, propDecorators: {
|
|
1543
|
+
args: [{ selector: 'cms-create-or-edit-field', template: "<form [formGroup]=\"_Entity\">\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"groupId\">{{'Cms::FieldGroup' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"groupId\">\n <option value=\"\">{{'Cms::OptionalGrouping' | abpLocalization}}</option>\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fieldGroupList\">\n <option [value]=\"item.id\">{{item.name}}</option>\n </ng-container>\n </select>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'DigniteAbpForms::FieldDisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\" (input)=\"nameInputBlur($event)\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"nameInput.errors?.repetition\">\n {{nameInput.errors?.repetition}}\n </div>\n <div class=\"form-text\">{{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\" (change)=\"formControlNameChange()\">\n <ng-container *ngFor=\"let item of _FieldAbstractsService.fromControlList;let i =index\">\n <option [value]=\"item.name\">{{item.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"_Entity.value.formControlName&&_Entity\"> \n <df-dynamic [type]=\"_Entity.value.formControlName\" [entity]=\"_Entity\" [selected]=\"_selected\"></df-dynamic>\n </ng-container>\n\n</form>" }]
|
|
1544
|
+
}], ctorParameters: function () { return [{ type: FieldAbstractsService }, { type: CmsApiService }, { type: FieldAdminService }, { type: i1.LocalizationService }]; }, propDecorators: { FormDynamicRef: [{
|
|
1545
|
+
type: ViewChild,
|
|
1546
|
+
args: ['FormDynamicRef', { read: ViewContainerRef, static: true }]
|
|
1547
|
+
}], Entity: [{
|
|
1533
1548
|
type: Input
|
|
1534
1549
|
}], selected: [{
|
|
1535
1550
|
type: Input
|
|
@@ -3035,27 +3050,694 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
3035
3050
|
args: ['submitclick', { static: true }]
|
|
3036
3051
|
}] } });
|
|
3037
3052
|
|
|
3038
|
-
|
|
3039
|
-
//
|
|
3040
|
-
|
|
3053
|
+
class MatrixConfig {
|
|
3054
|
+
// 矩阵类型
|
|
3055
|
+
'MatrixBlockTypes' = new FormArray([]);
|
|
3056
|
+
constructor(data) {
|
|
3057
|
+
if (data) {
|
|
3058
|
+
for (const key in data) {
|
|
3059
|
+
if (data.hasOwnProperty(key)) {
|
|
3060
|
+
this[key] = data[key];
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
}
|
|
3066
|
+
class MatrixItemConfig {
|
|
3067
|
+
displayName = ['', [Validators.required]];
|
|
3068
|
+
/**字段名字 */
|
|
3069
|
+
name = ['', [Validators.required]];
|
|
3070
|
+
constructor(data) {
|
|
3071
|
+
if (data) {
|
|
3072
|
+
for (const key in data) {
|
|
3073
|
+
if (data.hasOwnProperty(key)) {
|
|
3074
|
+
this[key] = data[key];
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
3080
|
+
class matrixFieldInputBase {
|
|
3081
|
+
/**字段名称 Display name of this field */
|
|
3082
|
+
displayName = ['', [Validators.required]];
|
|
3083
|
+
/**字段唯一名称 Unique Name*/
|
|
3084
|
+
name = ['', [Validators.required]];
|
|
3085
|
+
/**描述 说明 */
|
|
3086
|
+
description = ['', []];
|
|
3087
|
+
/**FieldType字段类型 表单控件名称 */
|
|
3088
|
+
formControlName = ['TextEdit', [Validators.required]];
|
|
3089
|
+
/**动态表单配置 */
|
|
3090
|
+
formConfiguration = new FormGroup({});
|
|
3091
|
+
constructor(data) {
|
|
3092
|
+
if (data) {
|
|
3093
|
+
for (const key in data) {
|
|
3094
|
+
if (data.hasOwnProperty(key)) {
|
|
3095
|
+
this[key] = data[key];
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
// import { CreateDynamicComponentsService, DfApiService, } from '../../../services';
|
|
3103
|
+
// import { getExcludeAssignControl } from '../form-control-group';
|
|
3104
|
+
class MatrixConfigComponent {
|
|
3105
|
+
fb;
|
|
3106
|
+
_CmsApiService;
|
|
3107
|
+
_FieldAbstractsService;
|
|
3108
|
+
constructor(fb, _CmsApiService, _FieldAbstractsService) {
|
|
3109
|
+
this.fb = fb;
|
|
3110
|
+
this._CmsApiService = _CmsApiService;
|
|
3111
|
+
this._FieldAbstractsService = _FieldAbstractsService;
|
|
3112
|
+
}
|
|
3113
|
+
/**表单控件组 */
|
|
3114
|
+
_FieldControlGroup;
|
|
3115
|
+
/**表单控件类型 */
|
|
3116
|
+
_type;
|
|
3117
|
+
set type(v) {
|
|
3118
|
+
this._type = v;
|
|
3119
|
+
this.dataLoaded();
|
|
3120
|
+
}
|
|
3121
|
+
/**表单实体 */
|
|
3122
|
+
_Entity;
|
|
3123
|
+
set Entity(v) {
|
|
3124
|
+
this._Entity = v;
|
|
3125
|
+
this.dataLoaded();
|
|
3126
|
+
}
|
|
3127
|
+
/**选择的表单信息 */
|
|
3128
|
+
_selected;
|
|
3129
|
+
set selected(v) {
|
|
3130
|
+
if (v) {
|
|
3131
|
+
this._selected = v;
|
|
3132
|
+
this.dataLoaded();
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
submitclick;
|
|
3136
|
+
async dataLoaded() {
|
|
3137
|
+
if (this._Entity && this._type) {
|
|
3138
|
+
await this.AfterInit();
|
|
3139
|
+
this.submitclick.nativeElement.click();
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
AfterInit() {
|
|
3143
|
+
return new Promise(async (resolve, rejects) => {
|
|
3144
|
+
this._FieldControlGroup = this._FieldAbstractsService.getExcludeAssignControl(this._type);
|
|
3145
|
+
this._Entity.setControl('formConfiguration', this.fb.group(new MatrixConfig()));
|
|
3146
|
+
await this.setSelectValue();
|
|
3147
|
+
this.formConfiguration.patchValue(this._selected.formConfiguration);
|
|
3148
|
+
resolve(true);
|
|
3149
|
+
});
|
|
3150
|
+
}
|
|
3151
|
+
setSelectValue() {
|
|
3152
|
+
return new Promise((resolve, rejects) => {
|
|
3153
|
+
if (this._selected && this._selected.formControlName == this._type) {
|
|
3154
|
+
this._selected.formConfiguration['MatrixBlockTypes'].forEach(((el, index) => {
|
|
3155
|
+
this.addMatrixBlockTypeItem(el);
|
|
3156
|
+
el.fields.forEach((elf, indexf) => {
|
|
3157
|
+
this.addMatrixFieldItem(elf, index);
|
|
3158
|
+
});
|
|
3159
|
+
}));
|
|
3160
|
+
resolve(true);
|
|
3161
|
+
}
|
|
3162
|
+
});
|
|
3163
|
+
}
|
|
3164
|
+
/**获取表单配置 */
|
|
3165
|
+
get formConfiguration() {
|
|
3166
|
+
return this._Entity.get('formConfiguration');
|
|
3167
|
+
}
|
|
3168
|
+
/**获取表单配置下的矩阵块表单数组 */
|
|
3169
|
+
get MatrixBlockTypes() {
|
|
3170
|
+
return this.formConfiguration.controls['MatrixBlockTypes'];
|
|
3171
|
+
}
|
|
3172
|
+
/**模态框-状态 */
|
|
3173
|
+
matrixModalOpen = false;
|
|
3174
|
+
/**模态框-是否正在编辑 */
|
|
3175
|
+
isMatrixModalEdit = false;
|
|
3176
|
+
/**模态框-用于确定模态的繁忙状态是否为真 */
|
|
3177
|
+
modalBusy = false;
|
|
3178
|
+
/**模态框-表单 */
|
|
3179
|
+
matrixModalForm;
|
|
3180
|
+
/**表单控件模板-用于在form外提交submit */
|
|
3181
|
+
matrixModalModalSubmit;
|
|
3182
|
+
/**矩阵块-选择的下标 */
|
|
3183
|
+
selectMatrixBlockIndex = 0;
|
|
3184
|
+
/**矩阵块-选择的矩阵下字段的下标 */
|
|
3185
|
+
selectMatrixFieldIndex = 0;
|
|
3186
|
+
/**模态框-状态改变 */
|
|
3187
|
+
matrixModalVisibleChange(event) {
|
|
3188
|
+
if (!event) {
|
|
3189
|
+
this.isMatrixModalEdit = false;
|
|
3190
|
+
this.matrixModalForm = undefined;
|
|
3191
|
+
return;
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
/**矩阵块--新增-打开模态框 */
|
|
3195
|
+
addMatrixBlockType() {
|
|
3196
|
+
this.matrixModalForm = this.fb.group(new MatrixItemConfig());
|
|
3197
|
+
this.matrixModalOpen = true;
|
|
3198
|
+
}
|
|
3199
|
+
/**模态框--矩阵表单保存提交 */
|
|
3200
|
+
createOrEditSave() {
|
|
3201
|
+
let input = this.matrixModalForm.value;
|
|
3202
|
+
if (!this.matrixModalForm.valid)
|
|
3203
|
+
return;
|
|
3204
|
+
if (this.isMatrixModalEdit) {
|
|
3205
|
+
let MatrixBlockTypesItem = this.MatrixBlockTypes.at(this.selectMatrixBlockIndex);
|
|
3206
|
+
MatrixBlockTypesItem.patchValue({
|
|
3207
|
+
...input
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
else {
|
|
3211
|
+
this.addMatrixBlockTypeItem(input);
|
|
3212
|
+
}
|
|
3213
|
+
this.matrixModalOpen = false;
|
|
3214
|
+
}
|
|
3215
|
+
/**新增矩阵块-向数组表单中增加项 */
|
|
3216
|
+
addMatrixBlockTypeItem(input) {
|
|
3217
|
+
this.MatrixBlockTypes.push(new FormGroup({
|
|
3218
|
+
displayName: new FormControl(input.displayName, Validators.required),
|
|
3219
|
+
name: new FormControl(input.name, Validators.required),
|
|
3220
|
+
fields: new FormArray([])
|
|
3221
|
+
}));
|
|
3222
|
+
}
|
|
3223
|
+
/**编辑矩阵块 */
|
|
3224
|
+
EditMatrixBlock(input) {
|
|
3225
|
+
this.matrixModalForm = this.fb.group(new MatrixItemConfig());
|
|
3226
|
+
this.matrixModalForm.patchValue({
|
|
3227
|
+
...input
|
|
3228
|
+
});
|
|
3229
|
+
this.matrixModalOpen = true;
|
|
3230
|
+
this.isMatrixModalEdit = true;
|
|
3231
|
+
}
|
|
3232
|
+
/**删除矩阵块 */
|
|
3233
|
+
DeleteMatrixBlock(index) {
|
|
3234
|
+
this.MatrixBlockTypes.removeAt(index);
|
|
3235
|
+
}
|
|
3236
|
+
/**矩阵块-选择 */
|
|
3237
|
+
selectMatrixBlockChange(index) {
|
|
3238
|
+
this.selectMatrixBlockIndex = index;
|
|
3239
|
+
}
|
|
3240
|
+
/**矩阵字段-新增 */
|
|
3241
|
+
addMatrixField() {
|
|
3242
|
+
this.addMatrixFieldItem('', this.selectMatrixBlockIndex);
|
|
3243
|
+
}
|
|
3244
|
+
/**矩阵字段-新增矩阵字段项 */
|
|
3245
|
+
addMatrixFieldItem(input = '', selectMatrixBlockIndex) {
|
|
3246
|
+
/**矩阵下标的矩阵项Form */
|
|
3247
|
+
let MatrixBlockTypesItemForm = this.MatrixBlockTypes.at(selectMatrixBlockIndex);
|
|
3248
|
+
let MatrixFieldItemForm = MatrixBlockTypesItemForm.get('fields');
|
|
3249
|
+
MatrixFieldItemForm.push(this.fb.group({
|
|
3250
|
+
/**字段名称 Display name of this field */
|
|
3251
|
+
displayName: [input.displayName, [Validators.required]],
|
|
3252
|
+
/**字段唯一名称 Unique Name*/
|
|
3253
|
+
name: [input.name, [Validators.required]],
|
|
3254
|
+
/**描述 说明 */
|
|
3255
|
+
description: [input.description, []],
|
|
3256
|
+
/**FieldType字段类型 表单控件名称 */
|
|
3257
|
+
formControlName: [input.formControlName || 'TextEdit', [Validators.required]],
|
|
3258
|
+
//动态表单配置
|
|
3259
|
+
formConfiguration: new FormGroup({}),
|
|
3260
|
+
}));
|
|
3261
|
+
//
|
|
3262
|
+
}
|
|
3263
|
+
/**删除矩阵字段项 */
|
|
3264
|
+
deleteMatrixField(MatrixFieldForm, index) {
|
|
3265
|
+
MatrixFieldForm.removeAt(index);
|
|
3266
|
+
this.selectMatrixFieldIndex = 0;
|
|
3267
|
+
}
|
|
3268
|
+
/**矩阵字段-选择 */
|
|
3269
|
+
selectMatrixFieldChange(MatrixBlockIndex, MatrixFieldIndex) {
|
|
3270
|
+
this.selectMatrixFieldIndex = MatrixFieldIndex;
|
|
3271
|
+
}
|
|
3272
|
+
get nameInput() {
|
|
3273
|
+
return this.matrixModalForm?.get('name');
|
|
3274
|
+
}
|
|
3275
|
+
get FieldnameInput() {
|
|
3276
|
+
let MatrixBlockTypesItemForm = this.MatrixBlockTypes.at(this.selectMatrixBlockIndex);
|
|
3277
|
+
let MatrixFieldItemForm = MatrixBlockTypesItemForm.get('fields');
|
|
3278
|
+
return MatrixFieldItemForm.at(this.selectMatrixFieldIndex).get('name');
|
|
3279
|
+
}
|
|
3280
|
+
/**矩阵displayNameInput字段失去焦点 */
|
|
3281
|
+
displayNameInputBlur(event) {
|
|
3282
|
+
let value = event.target.value;
|
|
3283
|
+
let pinyin = this._CmsApiService.chineseToPinyin(value);
|
|
3284
|
+
let nameInput = this.nameInput;
|
|
3285
|
+
if (nameInput.value)
|
|
3286
|
+
return;
|
|
3287
|
+
nameInput.patchValue(pinyin);
|
|
3288
|
+
}
|
|
3289
|
+
/**矩阵displayNameInput字段失去焦点 */
|
|
3290
|
+
MatrixFieldDisplayNameInputBlur(event) {
|
|
3291
|
+
let value = event.target.value;
|
|
3292
|
+
let pinyin = this._CmsApiService.chineseToPinyin(value);
|
|
3293
|
+
let FieldnameInput = this.FieldnameInput;
|
|
3294
|
+
if (FieldnameInput.value)
|
|
3295
|
+
return;
|
|
3296
|
+
FieldnameInput.patchValue(pinyin);
|
|
3297
|
+
}
|
|
3298
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixConfigComponent, deps: [{ token: i1$1.FormBuilder }, { token: CmsApiService }, { token: FieldAbstractsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3299
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MatrixConfigComponent, selector: "df-matrix-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }, { propertyName: "matrixModalModalSubmit", first: true, predicate: ["matrixModalModalSubmit"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'Cms::::FormControl:Matrix' | abpLocalization}}</label>\n <div class=\"row\">\n <div class=\"col-md-3\">\n <div class=\"list-group\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::MatrixBlockType' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixBlockType()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixBlockChange(i)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"i===selectMatrixBlockIndex\">\n <div>\n <div>{{item.value.displayName}}</div>\n <div>{{item.value.name}}</div>\n </div>\n <div ngbDropdown class=\"d-inline-block\">\n <button type=\"button\" class=\"btn btn-light btn-sm\" id=\"dropdownBasic1\"\n style=\"z-index: 8;\" ngbDropdownToggle></button>\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"z-index: 9;\">\n <button ngbDropdownItem\n (click.stop)=\"EditMatrixBlock(item.value)\">{{'AbpUi::Edit' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"DeleteMatrixBlock(i)\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </div>\n </div>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"list-group\" *ngIf=\"MatrixBlockTypes?.controls.length>0\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::Fields' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixField()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <ng-container *ngIf=\"i === selectMatrixBlockIndex\">\n <ng-container *ngFor=\"let el of item.controls['fields'].controls;let fi =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixFieldChange(i,fi)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"fi===selectMatrixFieldIndex\">\n <div>\n <div>{{el.value.displayName}}</div>\n <div>{{el.value.name}}</div>\n </div>\n <button type=\"button\"\n (click.stop)=\"deleteMatrixField(item.controls['fields'],fi)\"\n class=\"btn btn-sm btn-li\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-6\" formArrayName=\"MatrixBlockTypes\">\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <div [formGroupName]=\"i\" [hidden]=\"i !== selectMatrixBlockIndex\">\n <div formArrayName=\"fields\">\n <ng-container *ngFor=\"let itemf of item.controls['fields'].controls;let fi =index\">\n <div [formGroupName]=\"fi\" [hidden]=\"fi !== selectMatrixFieldIndex\">\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"MatrixFieldDisplayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n <div class=\"form-text\">\n {{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\" (change)=\"setConfigComponent()\">\n <ng-container *ngFor=\"let itemC of _FieldControlGroup;let i =index\">\n <option [value]=\"itemC.name\">{{itemC.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"itemf.value.formControlName&&item\">\n <df-dynamic [type]=\"itemf.value.formControlName\" [entity]=\"item\"\n [selected]=\"_selected?_selected['formConfiguration']['MatrixBlockTypes'][i]['fields'][fi]:''\"></df-dynamic>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n\n<abp-modal [(visible)]=\"matrixModalOpen\" [busy]=\"modalBusy\" (visibleChange)=\"matrixModalVisibleChange($event)\" >\n <ng-template #abpHeader>\n <h3>{{isMatrixEdit?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"matrixModalForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"matrixModalForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #matrixModalModalSubmit style=\"display: none\"></button>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"displayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'Cms::Name' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n </div>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"matrixModalModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.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$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i1.FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: ["debounce", "notValidateOnSubmit", "markAsDirtyWhenSubmit"], outputs: ["ngSubmit"] }, { kind: "directive", type: i1.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i1.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i7$1.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i7$1.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "component", type: i3.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "formName", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }, { kind: "component", type: i3.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { kind: "directive", type: i3.ModalCloseDirective, selector: "[abpClose]" }, { kind: "directive", type: i10.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i10.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i10.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i10.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["disabled"] }, { kind: "component", type: i8.DynamicComponent, selector: "df-dynamic", inputs: ["selected", "type", "entity", "culture", "parentFiledName", "fields"] }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }] });
|
|
3300
|
+
}
|
|
3301
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixConfigComponent, decorators: [{
|
|
3302
|
+
type: Component,
|
|
3303
|
+
args: [{ selector: 'df-matrix-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'Cms::::FormControl:Matrix' | abpLocalization}}</label>\n <div class=\"row\">\n <div class=\"col-md-3\">\n <div class=\"list-group\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::MatrixBlockType' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixBlockType()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixBlockChange(i)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"i===selectMatrixBlockIndex\">\n <div>\n <div>{{item.value.displayName}}</div>\n <div>{{item.value.name}}</div>\n </div>\n <div ngbDropdown class=\"d-inline-block\">\n <button type=\"button\" class=\"btn btn-light btn-sm\" id=\"dropdownBasic1\"\n style=\"z-index: 8;\" ngbDropdownToggle></button>\n <div ngbDropdownMenu aria-labelledby=\"dropdownBasic1\" style=\"z-index: 9;\">\n <button ngbDropdownItem\n (click.stop)=\"EditMatrixBlock(item.value)\">{{'AbpUi::Edit' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"DeleteMatrixBlock(i)\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </div>\n </div>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-3\">\n <div class=\"list-group\" *ngIf=\"MatrixBlockTypes?.controls.length>0\">\n <li class=\"list-group-item d-flex align-items-center justify-content-between\"\n aria-current=\"true\">\n {{'Cms::Fields' | abpLocalization}}\n <button class=\"btn btn-light btn-sm p-0\" (click.stop)=\"addMatrixField()\">\n <i class=\"fas fa-plus-circle p-1\"></i>\n </button>\n </li>\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <ng-container *ngIf=\"i === selectMatrixBlockIndex\">\n <ng-container *ngFor=\"let el of item.controls['fields'].controls;let fi =index\">\n <button type=\"button\" (click.stop)=\"selectMatrixFieldChange(i,fi)\"\n class=\"list-group-item d-flex align-items-center justify-content-between list-group-item-action \"\n [class.active]=\"fi===selectMatrixFieldIndex\">\n <div>\n <div>{{el.value.displayName}}</div>\n <div>{{el.value.name}}</div>\n </div>\n <button type=\"button\"\n (click.stop)=\"deleteMatrixField(item.controls['fields'],fi)\"\n class=\"btn btn-sm btn-li\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </button>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n <div class=\"col-md-6\" formArrayName=\"MatrixBlockTypes\">\n <ng-container *ngFor=\"let item of MatrixBlockTypes.controls;let i =index\">\n <div [formGroupName]=\"i\" [hidden]=\"i !== selectMatrixBlockIndex\">\n <div formArrayName=\"fields\">\n <ng-container *ngFor=\"let itemf of item.controls['fields'].controls;let fi =index\">\n <div [formGroupName]=\"fi\" [hidden]=\"fi !== selectMatrixFieldIndex\">\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"MatrixFieldDisplayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"name\">{{'DigniteAbpForms::FieldName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n <div class=\"form-text\">\n {{'DigniteAbpForms::FieldNameHelpText' | abpLocalization}}</div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"description\">{{'Cms::Description' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"description\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\"\n for=\"formControlName\">{{'Cms::FieldType' | abpLocalization}}</label>\n <select class=\"form-select\" formControlName=\"formControlName\" (change)=\"setConfigComponent()\">\n <ng-container *ngFor=\"let itemC of _FieldControlGroup;let i =index\">\n <option [value]=\"itemC.name\">{{itemC.displayName}}</option>\n </ng-container>\n </select>\n </div>\n <ng-container *ngIf=\"itemf.value.formControlName&&item\">\n <df-dynamic [type]=\"itemf.value.formControlName\" [entity]=\"item\"\n [selected]=\"_selected?_selected['formConfiguration']['MatrixBlockTypes'][i]['fields'][fi]:''\"></df-dynamic>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n\n<abp-modal [(visible)]=\"matrixModalOpen\" [busy]=\"modalBusy\" (visibleChange)=\"matrixModalVisibleChange($event)\" >\n <ng-template #abpHeader>\n <h3>{{isMatrixEdit?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"matrixModalForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"matrixModalForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #matrixModalModalSubmit style=\"display: none\"></button>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"displayName\">{{'Cms::DisplayName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"displayName\"\n (blur)=\"displayNameInputBlur($event)\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\" for=\"name\">{{'Cms::Name' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"name\">\n </div>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"matrixModalModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>" }]
|
|
3304
|
+
}], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: CmsApiService }, { type: FieldAbstractsService }]; }, propDecorators: { type: [{
|
|
3305
|
+
type: Input
|
|
3306
|
+
}], Entity: [{
|
|
3307
|
+
type: Input
|
|
3308
|
+
}], selected: [{
|
|
3309
|
+
type: Input
|
|
3310
|
+
}], submitclick: [{
|
|
3311
|
+
type: ViewChild,
|
|
3312
|
+
args: ['submitclick', { static: true }]
|
|
3313
|
+
}], matrixModalModalSubmit: [{
|
|
3314
|
+
type: ViewChild,
|
|
3315
|
+
args: ['matrixModalModalSubmit', { static: false }]
|
|
3316
|
+
}] } });
|
|
3317
|
+
|
|
3318
|
+
class MatrixControlComponent {
|
|
3319
|
+
fb;
|
|
3320
|
+
constructor(fb) {
|
|
3321
|
+
this.fb = fb;
|
|
3322
|
+
}
|
|
3323
|
+
/**表单实体 */
|
|
3324
|
+
_entity;
|
|
3325
|
+
set entity(v) {
|
|
3326
|
+
this._entity = v;
|
|
3327
|
+
this.dataLoaded();
|
|
3328
|
+
}
|
|
3329
|
+
/**字段配置列表 */
|
|
3330
|
+
_fields = '';
|
|
3331
|
+
set fields(v) {
|
|
3332
|
+
this._fields = v;
|
|
3333
|
+
this.dataLoaded();
|
|
3334
|
+
}
|
|
3335
|
+
/**父级字段名称,用于为表单设置控件赋值 */
|
|
3336
|
+
_parentFiledName;
|
|
3337
|
+
set parentFiledName(v) {
|
|
3338
|
+
this._parentFiledName = v;
|
|
3339
|
+
this.dataLoaded();
|
|
3340
|
+
}
|
|
3341
|
+
/**父级字段名称,用于为表单设置控件赋值 */
|
|
3342
|
+
_selected;
|
|
3343
|
+
set selected(v) {
|
|
3344
|
+
this._selected = v;
|
|
3345
|
+
if (v) {
|
|
3346
|
+
this.dataLoaded();
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
/**语言 */
|
|
3350
|
+
_culture;
|
|
3351
|
+
set culture(v) {
|
|
3352
|
+
this._culture = v;
|
|
3353
|
+
}
|
|
3354
|
+
submitclick;
|
|
3355
|
+
/** 获取父级字段代表的表单组*/
|
|
3356
|
+
extraProperties;
|
|
3357
|
+
/**数据加载完成 */
|
|
3358
|
+
async dataLoaded() {
|
|
3359
|
+
if (this._fields && this._entity && this._parentFiledName) {
|
|
3360
|
+
this.extraProperties = this._entity.get(this._parentFiledName);
|
|
3361
|
+
await this.AfterInit();
|
|
3362
|
+
this.submitclick.nativeElement.click();
|
|
3363
|
+
if (this._selected)
|
|
3364
|
+
this.fieldNameControl.patchValue(this._selected);
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
formConfiguration;
|
|
3368
|
+
/**获取表格字段代表的控件 */
|
|
3369
|
+
fieldNameControl;
|
|
3370
|
+
AfterInit() {
|
|
3371
|
+
return new Promise((resolve, rejects) => {
|
|
3372
|
+
let formConfiguration = this._fields.field.formConfiguration;
|
|
3373
|
+
let newArrayGroup = this.fb.array([]);
|
|
3374
|
+
this.extraProperties.setControl(this._fields.field.name, newArrayGroup);
|
|
3375
|
+
this.fieldNameControl = this.extraProperties.get(this._fields.field.name);
|
|
3376
|
+
if (this._selected) {
|
|
3377
|
+
this._selected.forEach(el => {
|
|
3378
|
+
this.addMatrixControl(formConfiguration.MatrixBlockTypes.find(item => item.name == el.matrixBlockTypeName));
|
|
3379
|
+
});
|
|
3380
|
+
}
|
|
3381
|
+
this.MatrixBlockTypesList = formConfiguration.MatrixBlockTypes;
|
|
3382
|
+
resolve(true);
|
|
3383
|
+
});
|
|
3384
|
+
}
|
|
3385
|
+
/**矩阵列表 */
|
|
3386
|
+
MatrixBlockTypesList = [];
|
|
3387
|
+
/**增加指定矩阵控件项 */
|
|
3388
|
+
addMatrixControl(item) {
|
|
3389
|
+
this.fieldNameControl.push(this.fb.group({
|
|
3390
|
+
extraProperties: new FormGroup({}),
|
|
3391
|
+
matrixBlockTypeName: [item.name],
|
|
3392
|
+
displayName: [item.displayName]
|
|
3393
|
+
}));
|
|
3394
|
+
}
|
|
3395
|
+
/**删除矩阵控件 */
|
|
3396
|
+
deleteMatrixControl(index) {
|
|
3397
|
+
this.fieldNameControl.removeAt(index);
|
|
3398
|
+
}
|
|
3399
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixControlComponent, deps: [{ token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|
|
3400
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MatrixControlComponent, selector: "df-matrix-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected", culture: "culture" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <div [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls;let i=index\">\n <div class=\"card mb-3 border \" [formGroupName]=\"i\">\n <div class=\"card-header d-flex align-items-center justify-content-between border-bottom pt-1\">\n <div>{{item.value.displayName}}</div>\n <button class=\"btn btn-sm btn-light p-0\" (click.stop)=\"deleteMatrixControl(i)\"><i\n class=\"fas fa-trash p-2\"></i></button>\n </div>\n <div class=\"card-body\">\n <ng-container *ngFor=\"let el of MatrixBlockTypesList;let il =index\">\n <ng-container *ngIf=\"el.name===item.value.matrixBlockTypeName\">\n <ng-container *ngFor=\"let elf of el.fields; let fi=index\">\n <ng-container>\n <df-dynamic [entity]=\"item\"\n [fields]=\"{ field: elf,displayName:elf.displayName }\"\n [selected]=\"_selected ? _selected[i][_parentFiledName][elf.name]: ''\"\n [parentFiledName]=\"'extraProperties'\" [culture]=\"_culture\"></df-dynamic>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n <div>\n <div class=\"btn-group\" role=\"group\" aria-label=\"Basic example\">\n <ng-container *ngFor=\"let item of MatrixBlockTypesList;let i =index\">\n <button type=\"button\" class=\"btn btn-primary btn-sm\" (click.stop)=\"addMatrixControl(item)\"><i\n class=\"fas fa-plus me-1\"></i>{{item.displayName}}</button>\n </ng-container>\n </div>\n </div>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i1.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i7$1.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "component", type: i8.DynamicComponent, selector: "df-dynamic", inputs: ["selected", "type", "entity", "culture", "parentFiledName", "fields"] }] });
|
|
3401
|
+
}
|
|
3402
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MatrixControlComponent, decorators: [{
|
|
3403
|
+
type: Component,
|
|
3404
|
+
args: [{ selector: 'df-matrix-control', template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <div [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls;let i=index\">\n <div class=\"card mb-3 border \" [formGroupName]=\"i\">\n <div class=\"card-header d-flex align-items-center justify-content-between border-bottom pt-1\">\n <div>{{item.value.displayName}}</div>\n <button class=\"btn btn-sm btn-light p-0\" (click.stop)=\"deleteMatrixControl(i)\"><i\n class=\"fas fa-trash p-2\"></i></button>\n </div>\n <div class=\"card-body\">\n <ng-container *ngFor=\"let el of MatrixBlockTypesList;let il =index\">\n <ng-container *ngIf=\"el.name===item.value.matrixBlockTypeName\">\n <ng-container *ngFor=\"let elf of el.fields; let fi=index\">\n <ng-container>\n <df-dynamic [entity]=\"item\"\n [fields]=\"{ field: elf,displayName:elf.displayName }\"\n [selected]=\"_selected ? _selected[i][_parentFiledName][elf.name]: ''\"\n [parentFiledName]=\"'extraProperties'\" [culture]=\"_culture\"></df-dynamic>\n </ng-container>\n </ng-container>\n </ng-container>\n </ng-container>\n </div>\n </div>\n </ng-container>\n </div>\n <div>\n <div class=\"btn-group\" role=\"group\" aria-label=\"Basic example\">\n <ng-container *ngFor=\"let item of MatrixBlockTypesList;let i =index\">\n <button type=\"button\" class=\"btn btn-primary btn-sm\" (click.stop)=\"addMatrixControl(item)\"><i\n class=\"fas fa-plus me-1\"></i>{{item.displayName}}</button>\n </ng-container>\n </div>\n </div>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>" }]
|
|
3405
|
+
}], ctorParameters: function () { return [{ type: i1$1.FormBuilder }]; }, propDecorators: { entity: [{
|
|
3406
|
+
type: Input
|
|
3407
|
+
}], fields: [{
|
|
3408
|
+
type: Input
|
|
3409
|
+
}], parentFiledName: [{
|
|
3410
|
+
type: Input
|
|
3411
|
+
}], selected: [{
|
|
3412
|
+
type: Input
|
|
3413
|
+
}], culture: [{
|
|
3414
|
+
type: Input
|
|
3415
|
+
}], submitclick: [{
|
|
3416
|
+
type: ViewChild,
|
|
3417
|
+
args: ['submitclick', { static: true }]
|
|
3418
|
+
}] } });
|
|
3419
|
+
|
|
3420
|
+
class TableConfig {
|
|
3421
|
+
// 选项
|
|
3422
|
+
TableColumns = new FormArray([]);
|
|
3423
|
+
constructor(data) {
|
|
3424
|
+
if (data) {
|
|
3425
|
+
for (const key in data) {
|
|
3426
|
+
if (data.hasOwnProperty(key)) {
|
|
3427
|
+
this[key] = data[key];
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
class TableFormControl {
|
|
3434
|
+
/**列标题 */
|
|
3435
|
+
displayName = ['', [Validators.required]];
|
|
3436
|
+
/**空间配置 */
|
|
3437
|
+
formConfiguration = new FormGroup({});
|
|
3438
|
+
/**列名 */
|
|
3439
|
+
name = ['', [Validators.required]];
|
|
3440
|
+
//控件标识
|
|
3441
|
+
formControlName = ['', [Validators.required]];
|
|
3442
|
+
/**是否必填 */
|
|
3443
|
+
required = [false];
|
|
3444
|
+
/**描述 */
|
|
3445
|
+
description = [''];
|
|
3446
|
+
constructor(data) {
|
|
3447
|
+
if (data) {
|
|
3448
|
+
for (const key in data) {
|
|
3449
|
+
if (data.hasOwnProperty(key)) {
|
|
3450
|
+
this[key] = data[key];
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
class TableConfigComponent {
|
|
3458
|
+
fb;
|
|
3459
|
+
_CmsApiService;
|
|
3460
|
+
_FieldAbstractsService;
|
|
3461
|
+
constructor(fb, _CmsApiService, _FieldAbstractsService) {
|
|
3462
|
+
this.fb = fb;
|
|
3463
|
+
this._CmsApiService = _CmsApiService;
|
|
3464
|
+
this._FieldAbstractsService = _FieldAbstractsService;
|
|
3465
|
+
}
|
|
3466
|
+
/**表单实体 */
|
|
3467
|
+
_Entity;
|
|
3468
|
+
set Entity(v) {
|
|
3469
|
+
this._Entity = v;
|
|
3470
|
+
this.dataLoaded();
|
|
3471
|
+
}
|
|
3472
|
+
/**选择的表单信息 */
|
|
3473
|
+
_selected;
|
|
3474
|
+
set selected(v) {
|
|
3475
|
+
if (v) {
|
|
3476
|
+
this._selected = v;
|
|
3477
|
+
this.dataLoaded();
|
|
3478
|
+
}
|
|
3479
|
+
}
|
|
3480
|
+
/**表单控件组 */
|
|
3481
|
+
_fieldControlGroup;
|
|
3482
|
+
/**表单控件类型 */
|
|
3483
|
+
_type;
|
|
3484
|
+
set type(v) {
|
|
3485
|
+
this._type = v;
|
|
3486
|
+
this.dataLoaded();
|
|
3487
|
+
}
|
|
3488
|
+
get formConfiguration() {
|
|
3489
|
+
return this._Entity.get('formConfiguration');
|
|
3490
|
+
}
|
|
3491
|
+
get TableColumns() {
|
|
3492
|
+
return this.formConfiguration.controls['TableColumns'];
|
|
3493
|
+
}
|
|
3494
|
+
submitclick;
|
|
3495
|
+
async dataLoaded() {
|
|
3496
|
+
if (this._Entity && this._type) {
|
|
3497
|
+
await this.AfterInit();
|
|
3498
|
+
this.submitclick.nativeElement.click();
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
/**增加选项 */
|
|
3502
|
+
addTableColumns() {
|
|
3503
|
+
this.TableColumns.push(this.fb.group({
|
|
3504
|
+
...new TableFormControl(),
|
|
3505
|
+
formConfiguration: [{}]
|
|
3506
|
+
}));
|
|
3507
|
+
}
|
|
3508
|
+
/**删除某个选项 */
|
|
3509
|
+
deleteTableColumns(index) {
|
|
3510
|
+
this.TableColumns.removeAt(index);
|
|
3511
|
+
}
|
|
3512
|
+
AfterInit() {
|
|
3513
|
+
return new Promise((resolve, rejects) => {
|
|
3514
|
+
this._Entity.setControl('formConfiguration', this.fb.group(new TableConfig()));
|
|
3515
|
+
this._fieldControlGroup = this._FieldAbstractsService.getExcludeAssignControl(this._type);
|
|
3516
|
+
if (this._selected && this._selected.formControlName == this._type) {
|
|
3517
|
+
this._selected.formConfiguration['TableColumns'].forEach(el => {
|
|
3518
|
+
this.addTableColumns();
|
|
3519
|
+
});
|
|
3520
|
+
this.formConfiguration.patchValue(this._selected.formConfiguration);
|
|
3521
|
+
}
|
|
3522
|
+
else {
|
|
3523
|
+
this.addTableColumns();
|
|
3524
|
+
}
|
|
3525
|
+
resolve(true);
|
|
3526
|
+
});
|
|
3527
|
+
}
|
|
3528
|
+
itemForm;
|
|
3529
|
+
/**选择表格的表单控件 */
|
|
3530
|
+
selectTableControl(event, i, item) {
|
|
3531
|
+
this.CurrentSelectionTableControlName = event.target.value;
|
|
3532
|
+
this.tableSelectOpen = true;
|
|
3533
|
+
this.tableSelectForm = this.fb.group(new TableFormControl());
|
|
3534
|
+
this.TableColumnsIndex = i;
|
|
3535
|
+
this.itemForm = item;
|
|
3536
|
+
}
|
|
3537
|
+
CurrentSelectionTableControlName;
|
|
3538
|
+
/**正在创建或编辑的表格项下标 */
|
|
3539
|
+
TableColumnsIndex;
|
|
3540
|
+
/**创建站点模态框状态 */
|
|
3541
|
+
tableSelectOpen = false;
|
|
3542
|
+
/**用于确定模态的繁忙状态是否为真 */
|
|
3543
|
+
modalBusy = false;
|
|
3544
|
+
/**创建站点表单 */
|
|
3545
|
+
tableSelectForm;
|
|
3546
|
+
/**表格已选择数据 */
|
|
3547
|
+
_tableSelected;
|
|
3548
|
+
/**表单控件模板-动态赋值表单控件 */
|
|
3549
|
+
tableSelectModalSubmit;
|
|
3550
|
+
/**创建站点模态框状态改变 */
|
|
3551
|
+
tableSelectVisibleChange(event) {
|
|
3552
|
+
if (!event) {
|
|
3553
|
+
this._tableSelected = undefined;
|
|
3554
|
+
this.tableSelectForm = undefined;
|
|
3555
|
+
this.CurrentSelectionTableControlName = undefined;
|
|
3556
|
+
this.TableColumnsIndex = undefined;
|
|
3557
|
+
return;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
/**表单保存提交 */
|
|
3561
|
+
createOrEditSave() {
|
|
3562
|
+
const formGroup = this.TableColumns.at(this.TableColumnsIndex);
|
|
3563
|
+
let formConfigurationgroup = formGroup.get('formConfiguration');
|
|
3564
|
+
formConfigurationgroup.setValue({
|
|
3565
|
+
...this.tableSelectForm.value['formConfiguration'],
|
|
3566
|
+
});
|
|
3567
|
+
this.tableSelectOpen = false;
|
|
3568
|
+
}
|
|
3569
|
+
/**编辑站点按钮 */
|
|
3570
|
+
EditSitesBtn(rows, i) {
|
|
3571
|
+
this.CurrentSelectionTableControlName = rows.get('formControlName').value;
|
|
3572
|
+
this.tableSelectForm = this.fb.group(new TableFormControl());
|
|
3573
|
+
this.tableSelectForm.patchValue({
|
|
3574
|
+
...rows.value
|
|
3575
|
+
});
|
|
3576
|
+
this.tableSelectForm.get('formConfiguration').patchValue({
|
|
3577
|
+
...rows.value['formConfiguration']
|
|
3578
|
+
});
|
|
3579
|
+
this._tableSelected = rows.value;
|
|
3580
|
+
this.TableColumnsIndex = i;
|
|
3581
|
+
this.tableSelectOpen = true;
|
|
3582
|
+
}
|
|
3583
|
+
/**调整表格位置 */
|
|
3584
|
+
TableArrowUpOrDown(type, index) {
|
|
3585
|
+
let controlAt = this.TableColumns.at(index);
|
|
3586
|
+
this.TableColumns.removeAt(index);
|
|
3587
|
+
let lastindex = type == 'up' ? index - 1 : index + 1;
|
|
3588
|
+
this.TableColumns.insert(lastindex, controlAt);
|
|
3589
|
+
}
|
|
3590
|
+
/**字段标签input失去标点生成字段名字 */
|
|
3591
|
+
disPlayNameInputBlur(event, item) {
|
|
3592
|
+
let value = event.target.value;
|
|
3593
|
+
let pinyin = this._CmsApiService.chineseToPinyin(value);
|
|
3594
|
+
let nameInput = item.get('name');
|
|
3595
|
+
if (nameInput.value)
|
|
3596
|
+
return;
|
|
3597
|
+
nameInput.patchValue(pinyin);
|
|
3598
|
+
}
|
|
3599
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableConfigComponent, deps: [{ token: i1$1.FormBuilder }, { token: CmsApiService }, { token: FieldAbstractsService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3600
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TableConfigComponent, selector: "df-table-config", inputs: { Entity: "Entity", selected: "selected", type: "type" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }, { propertyName: "tableSelectModalSubmit", first: true, predicate: ["tableSelectModalSubmit"], descendants: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::SelectListItem' | abpLocalization}}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'Cms::TableColumnDisplayName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnForm' | abpLocalization}}</th>\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableColumns()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"TableColumns\">\n <ng-container *ngFor=\"let item of TableColumns.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event,item)\" ></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"name\"></td>\n <td>\n <select class=\"form-select\" formControlName=\"formControlName\"\n (change)=\"selectTableControl($event,i,item)\">\n <option value=\"\">SelectFrom</option>\n <ng-container *ngFor=\"let item_f of _fieldControlGroup;let i_f =index\">\n <option [value]=\"item_f.name\">{{item_f.displayName}}</option>\n </ng-container>\n </select>\n </td>\n <td scope=\"row\">\n <div class=\"flex-start\">\n <button class=\"btn btn-light btn-sm \" (click.stop)=\"EditSitesBtn(item,i)\">\n <i class=\"fas fa-edit\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"deleteTableColumns(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==0\"\n (click.stop)=\"TableArrowUpOrDown('up',i)\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==TableColumns.controls.length-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n<abp-modal [(visible)]=\"tableSelectOpen\" [busy]=\"modalBusy\" (visibleChange)=\"tableSelectVisibleChange($event)\" [options]=\"{ size: CurrentSelectionTableControlName=='Matrix'?'xl':'' ,scrollable:false }\">\n <ng-template #abpHeader>\n <h3>{{_tableSelected?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"tableSelectForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"tableSelectForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #tableSelectModalSubmit style=\"display: none\"></button>\n <ng-container *ngIf=\"CurrentSelectionTableControlName&&tableSelectForm\">\n <df-dynamic [type]=\"CurrentSelectionTableControlName\" [entity]=\"tableSelectForm\"\n [selected]=\"_tableSelected\" [formGroup]=\"tableSelectForm\"></df-dynamic>\n </ng-container>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"tableSelectModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1$1.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$1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i1.FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: ["debounce", "notValidateOnSubmit", "markAsDirtyWhenSubmit"], outputs: ["ngSubmit"] }, { kind: "directive", type: i1.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i1.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i7$1.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i7$1.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "component", type: i3.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "formName", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }, { kind: "component", type: i3.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { kind: "directive", type: i3.ModalCloseDirective, selector: "[abpClose]" }, { kind: "directive", type: i7$2.NzTableCellDirective, selector: "th:not(.nz-disable-th):not([mat-cell]), td:not(.nz-disable-td):not([mat-cell])" }, { kind: "directive", type: i7$2.NzThMeasureDirective, selector: "th", inputs: ["nzWidth", "colspan", "colSpan", "rowspan", "rowSpan"] }, { kind: "component", type: i7$2.NzTheadComponent, selector: "thead:not(.ant-table-thead)", outputs: ["nzSortOrderChange"] }, { kind: "component", type: i7$2.NzTbodyComponent, selector: "tbody" }, { kind: "directive", type: i7$2.NzTrDirective, selector: "tr:not([mat-row]):not([mat-header-row]):not([nz-table-measure-row]):not([nzExpand]):not([nz-table-fixed-row])" }, { kind: "component", type: i8.DynamicComponent, selector: "df-dynamic", inputs: ["selected", "type", "entity", "culture", "parentFiledName", "fields"] }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }] });
|
|
3601
|
+
}
|
|
3602
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableConfigComponent, decorators: [{
|
|
3603
|
+
type: Component,
|
|
3604
|
+
args: [{ selector: 'df-table-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::SelectListItem' | abpLocalization}}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'Cms::TableColumnDisplayName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnName' | abpLocalization}}</th>\n <th scope=\"col\">{{'Cms::TableColumnForm' | abpLocalization}}</th>\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableColumns()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"TableColumns\">\n <ng-container *ngFor=\"let item of TableColumns.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"displayName\" (blur)=\"disPlayNameInputBlur($event,item)\" ></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"name\"></td>\n <td>\n <select class=\"form-select\" formControlName=\"formControlName\"\n (change)=\"selectTableControl($event,i,item)\">\n <option value=\"\">SelectFrom</option>\n <ng-container *ngFor=\"let item_f of _fieldControlGroup;let i_f =index\">\n <option [value]=\"item_f.name\">{{item_f.displayName}}</option>\n </ng-container>\n </select>\n </td>\n <td scope=\"row\">\n <div class=\"flex-start\">\n <button class=\"btn btn-light btn-sm \" (click.stop)=\"EditSitesBtn(item,i)\">\n <i class=\"fas fa-edit\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"deleteTableColumns(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==0\"\n (click.stop)=\"TableArrowUpOrDown('up',i)\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" *ngIf=\"i!==TableColumns.controls.length-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>\n\n\n<abp-modal [(visible)]=\"tableSelectOpen\" [busy]=\"modalBusy\" (visibleChange)=\"tableSelectVisibleChange($event)\" [options]=\"{ size: CurrentSelectionTableControlName=='Matrix'?'xl':'' ,scrollable:false }\">\n <ng-template #abpHeader>\n <h3>{{_tableSelected?('AbpUi::Edit' | abpLocalization):('Cms::New' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"tableSelectForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"tableSelectForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #tableSelectModalSubmit style=\"display: none\"></button>\n <ng-container *ngIf=\"CurrentSelectionTableControlName&&tableSelectForm\">\n <df-dynamic [type]=\"CurrentSelectionTableControlName\" [entity]=\"tableSelectForm\"\n [selected]=\"_tableSelected\" [formGroup]=\"tableSelectForm\"></df-dynamic>\n </ng-container>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"tableSelectModalSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"] }]
|
|
3605
|
+
}], ctorParameters: function () { return [{ type: i1$1.FormBuilder }, { type: CmsApiService }, { type: FieldAbstractsService }]; }, propDecorators: { Entity: [{
|
|
3606
|
+
type: Input
|
|
3607
|
+
}], selected: [{
|
|
3608
|
+
type: Input
|
|
3609
|
+
}], type: [{
|
|
3610
|
+
type: Input
|
|
3611
|
+
}], submitclick: [{
|
|
3612
|
+
type: ViewChild,
|
|
3613
|
+
args: ['submitclick', { static: true }]
|
|
3614
|
+
}], tableSelectModalSubmit: [{
|
|
3615
|
+
type: ViewChild,
|
|
3616
|
+
args: ['tableSelectModalSubmit', { static: false }]
|
|
3617
|
+
}] } });
|
|
3618
|
+
|
|
3619
|
+
class TableControlComponent {
|
|
3620
|
+
constructor() {
|
|
3621
|
+
}
|
|
3622
|
+
fb = inject(FormBuilder);
|
|
3623
|
+
/**表单实体 */
|
|
3624
|
+
_entity;
|
|
3625
|
+
set entity(v) {
|
|
3626
|
+
this._entity = v;
|
|
3627
|
+
this.dataLoaded();
|
|
3628
|
+
}
|
|
3629
|
+
/**字段配置列表 */
|
|
3630
|
+
_fields = '';
|
|
3631
|
+
set fields(v) {
|
|
3632
|
+
this._fields = v;
|
|
3633
|
+
this.dataLoaded();
|
|
3634
|
+
}
|
|
3635
|
+
/**父级字段名称,用于为表单设置控件赋值 */
|
|
3636
|
+
_parentFiledName;
|
|
3637
|
+
set parentFiledName(v) {
|
|
3638
|
+
this._parentFiledName = v;
|
|
3639
|
+
this.dataLoaded();
|
|
3640
|
+
}
|
|
3641
|
+
/**父级字段名称,用于为表单设置控件赋值 */
|
|
3642
|
+
_selected;
|
|
3643
|
+
set selected(v) {
|
|
3644
|
+
this._selected = v;
|
|
3645
|
+
if (v) {
|
|
3646
|
+
this.dataLoaded();
|
|
3647
|
+
}
|
|
3648
|
+
}
|
|
3649
|
+
submitclick;
|
|
3650
|
+
/** 获取父级字段代表的表单组*/
|
|
3651
|
+
extraProperties;
|
|
3652
|
+
/**数据加载完成 */
|
|
3653
|
+
async dataLoaded() {
|
|
3654
|
+
if (this._fields && this._entity && this._parentFiledName) {
|
|
3655
|
+
this.extraProperties = this._entity.get(this._parentFiledName);
|
|
3656
|
+
await this.AfterInit();
|
|
3657
|
+
this.submitclick.nativeElement.click();
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
formConfiguration;
|
|
3661
|
+
/**获取表格字段代表的控件 */
|
|
3662
|
+
fieldNameControl;
|
|
3663
|
+
AfterInit() {
|
|
3664
|
+
return new Promise((resolve, rejects) => {
|
|
3665
|
+
let ValidatorsArray = [];
|
|
3666
|
+
if (this._fields.required) {
|
|
3667
|
+
ValidatorsArray.push(Validators.required);
|
|
3668
|
+
}
|
|
3669
|
+
let formConfiguration = this._fields.field.formConfiguration;
|
|
3670
|
+
this.formConfiguration = formConfiguration;
|
|
3671
|
+
let newArrayGroup = this.fb.array([]);
|
|
3672
|
+
this.extraProperties.setControl(this._fields.field.name, newArrayGroup);
|
|
3673
|
+
this.fieldNameControl = this.extraProperties.get(this._fields.field.name);
|
|
3674
|
+
if (this._selected) {
|
|
3675
|
+
this._selected.forEach(el => {
|
|
3676
|
+
this.addTableControlItem();
|
|
3677
|
+
});
|
|
3678
|
+
this.fieldNameControl.patchValue(this._selected);
|
|
3679
|
+
}
|
|
3680
|
+
else {
|
|
3681
|
+
this.addTableControlItem();
|
|
3682
|
+
}
|
|
3683
|
+
resolve(true);
|
|
3684
|
+
});
|
|
3685
|
+
}
|
|
3686
|
+
/**增加表格项 */
|
|
3687
|
+
addTableControlItem() {
|
|
3688
|
+
this.fieldNameControl.push(this.fb.group({
|
|
3689
|
+
'extraProperties': this.fb.group({})
|
|
3690
|
+
}));
|
|
3691
|
+
}
|
|
3692
|
+
/**删除表格项 */
|
|
3693
|
+
minusTableControlItem(index) {
|
|
3694
|
+
this.fieldNameControl.removeAt(index);
|
|
3695
|
+
}
|
|
3696
|
+
/**调整表格位置 */
|
|
3697
|
+
TableArrowUpOrDown(type, index) {
|
|
3698
|
+
let controlAt = this.fieldNameControl.at(index);
|
|
3699
|
+
this.fieldNameControl.removeAt(index);
|
|
3700
|
+
let lastindex = type == 'up' ? index - 1 : index + 1;
|
|
3701
|
+
this.fieldNameControl.insert(lastindex, controlAt);
|
|
3702
|
+
this._selected = this.fieldNameControl.value;
|
|
3703
|
+
}
|
|
3704
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3705
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TableControlComponent, selector: "df-table-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <ng-container *ngFor=\"let item of formConfiguration.TableColumns\">\n <th scope=\"col\">{{ item.displayName }}</th>\n </ng-container>\n\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableControlItem()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls; let i = index\">\n <tr>\n <ng-container *ngFor=\"let el of formConfiguration.TableColumns\">\n <td>\n <ng-container *ngIf=\"item&&el\">\n <df-dynamic [entity]=\"item\" [fields]=\"{ field: el }\"\n [selected]=\"_selected[i]?.extraProperties[''+el.name+'']\"\n [parentFiledName]=\"'extraProperties'\"></df-dynamic>\n </ng-container>\n </td>\n </ng-container>\n <td scope=\"row\" class=\"\">\n <div class=\"flex-end mb-2\">\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"minusTableControlItem(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"TableArrowUpOrDown('up',i)\"\n *ngIf=\"i!==0\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\"\n *ngIf=\"i!==fieldNameControl.controls.length-1\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1$1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i1.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i7$1.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i7$2.NzTableCellDirective, selector: "th:not(.nz-disable-th):not([mat-cell]), td:not(.nz-disable-td):not([mat-cell])" }, { kind: "directive", type: i7$2.NzThMeasureDirective, selector: "th", inputs: ["nzWidth", "colspan", "colSpan", "rowspan", "rowSpan"] }, { kind: "component", type: i7$2.NzTheadComponent, selector: "thead:not(.ant-table-thead)", outputs: ["nzSortOrderChange"] }, { kind: "component", type: i7$2.NzTbodyComponent, selector: "tbody" }, { kind: "directive", type: i7$2.NzTrDirective, selector: "tr:not([mat-row]):not([mat-header-row]):not([nz-table-measure-row]):not([nzExpand]):not([nz-table-fixed-row])" }, { kind: "component", type: i8.DynamicComponent, selector: "df-dynamic", inputs: ["selected", "type", "entity", "culture", "parentFiledName", "fields"] }] });
|
|
3706
|
+
}
|
|
3707
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableControlComponent, decorators: [{
|
|
3708
|
+
type: Component,
|
|
3709
|
+
args: [{ selector: 'df-table-control', template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <ng-container *ngFor=\"let item of formConfiguration.TableColumns\">\n <th scope=\"col\">{{ item.displayName }}</th>\n </ng-container>\n\n <th scope=\"col\" class=\"flex-end\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addTableControlItem()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody [formArrayName]=\"_fields.field.name\">\n <ng-container *ngFor=\"let item of fieldNameControl.controls; let i = index\">\n <tr>\n <ng-container *ngFor=\"let el of formConfiguration.TableColumns\">\n <td>\n <ng-container *ngIf=\"item&&el\">\n <df-dynamic [entity]=\"item\" [fields]=\"{ field: el }\"\n [selected]=\"_selected[i]?.extraProperties[''+el.name+'']\"\n [parentFiledName]=\"'extraProperties'\"></df-dynamic>\n </ng-container>\n </td>\n </ng-container>\n <td scope=\"row\" class=\"\">\n <div class=\"flex-end mb-2\">\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"minusTableControlItem(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\" (click.stop)=\"TableArrowUpOrDown('up',i)\"\n *ngIf=\"i!==0\">\n <i class=\"fas fa-arrow-up\"></i>\n </button>\n <button class=\"btn btn-light btn-sm ms-1\"\n (click.stop)=\"TableArrowUpOrDown('down',i)\"\n *ngIf=\"i!==fieldNameControl.controls.length-1\">\n <i class=\"fas fa-arrow-down\"></i>\n </button>\n </div>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none\" #submitclick></button>\n</form>", styles: [".flex-end{display:flex;align-items:center;justify-content:flex-end}.flex-start{display:flex;align-items:center;justify-content:flex-start}\n"] }]
|
|
3710
|
+
}], ctorParameters: function () { return []; }, propDecorators: { entity: [{
|
|
3711
|
+
type: Input
|
|
3712
|
+
}], fields: [{
|
|
3713
|
+
type: Input
|
|
3714
|
+
}], parentFiledName: [{
|
|
3715
|
+
type: Input
|
|
3716
|
+
}], selected: [{
|
|
3717
|
+
type: Input
|
|
3718
|
+
}], submitclick: [{
|
|
3719
|
+
type: ViewChild,
|
|
3720
|
+
args: ['submitclick', { static: true }]
|
|
3721
|
+
}] } });
|
|
3722
|
+
|
|
3041
3723
|
/**
|
|
3042
3724
|
* 表单控件分组-包含配置,控件,显示的数组
|
|
3043
3725
|
*/
|
|
3044
3726
|
const FieldControlGroup = [
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3727
|
+
{
|
|
3728
|
+
displayName: '表格',
|
|
3729
|
+
name: 'Table',
|
|
3730
|
+
fieldConfigComponent: TableConfigComponent,
|
|
3731
|
+
fieldComponent: TableControlComponent,
|
|
3732
|
+
// fieldViewComponent:TextBoxViewComponent,
|
|
3733
|
+
},
|
|
3734
|
+
{
|
|
3735
|
+
displayName: '矩阵',
|
|
3736
|
+
name: 'Matrix',
|
|
3737
|
+
fieldConfigComponent: MatrixConfigComponent,
|
|
3738
|
+
fieldComponent: MatrixControlComponent,
|
|
3739
|
+
// fieldViewComponent:TextBoxViewComponent,
|
|
3740
|
+
},
|
|
3059
3741
|
{
|
|
3060
3742
|
displayName: '条目',
|
|
3061
3743
|
name: 'Entry',
|
|
@@ -3065,9 +3747,6 @@ const FieldControlGroup = [
|
|
|
3065
3747
|
},
|
|
3066
3748
|
];
|
|
3067
3749
|
|
|
3068
|
-
// export * from './table'
|
|
3069
|
-
// export * from './matrix'
|
|
3070
|
-
|
|
3071
3750
|
/**版块 */
|
|
3072
3751
|
const Sections_Defaults_Toolbar_Action = ToolbarAction.createMany([
|
|
3073
3752
|
{
|
|
@@ -3508,10 +4187,10 @@ class CmsModule {
|
|
|
3508
4187
|
CreateComponent,
|
|
3509
4188
|
EditComponent,
|
|
3510
4189
|
CreateOrEditEntriesComponent,
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
4190
|
+
TableConfigComponent,
|
|
4191
|
+
TableControlComponent,
|
|
4192
|
+
MatrixConfigComponent,
|
|
4193
|
+
MatrixControlComponent,
|
|
3515
4194
|
EntryConfigComponent,
|
|
3516
4195
|
EntryControlComponent], imports: [CoreModule,
|
|
3517
4196
|
ThemeSharedModule,
|
|
@@ -3527,11 +4206,10 @@ class CmsModule {
|
|
|
3527
4206
|
CommercialUiConfigModule,
|
|
3528
4207
|
NzSelectModule,
|
|
3529
4208
|
NzTableModule,
|
|
3530
|
-
ScrollingModule,
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
// MatrixControlComponent,
|
|
4209
|
+
ScrollingModule, i8.DynamicFormModule], exports: [TableConfigComponent,
|
|
4210
|
+
TableControlComponent,
|
|
4211
|
+
MatrixConfigComponent,
|
|
4212
|
+
MatrixControlComponent,
|
|
3535
4213
|
EntryConfigComponent,
|
|
3536
4214
|
EntryControlComponent] });
|
|
3537
4215
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CmsModule, providers: [
|
|
@@ -3554,8 +4232,7 @@ class CmsModule {
|
|
|
3554
4232
|
ScrollingModule,
|
|
3555
4233
|
DynamicFormModule.forRoot({
|
|
3556
4234
|
cmsFieldControlGroup: FieldControlGroup
|
|
3557
|
-
})
|
|
3558
|
-
DynamicComponent] });
|
|
4235
|
+
})] });
|
|
3559
4236
|
}
|
|
3560
4237
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CmsModule, decorators: [{
|
|
3561
4238
|
type: NgModule,
|
|
@@ -3573,10 +4250,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
3573
4250
|
CreateComponent,
|
|
3574
4251
|
EditComponent,
|
|
3575
4252
|
CreateOrEditEntriesComponent,
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
4253
|
+
TableConfigComponent,
|
|
4254
|
+
TableControlComponent,
|
|
4255
|
+
MatrixConfigComponent,
|
|
4256
|
+
MatrixControlComponent,
|
|
3580
4257
|
EntryConfigComponent,
|
|
3581
4258
|
EntryControlComponent,
|
|
3582
4259
|
],
|
|
@@ -3599,13 +4276,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
3599
4276
|
DynamicFormModule.forRoot({
|
|
3600
4277
|
cmsFieldControlGroup: FieldControlGroup
|
|
3601
4278
|
}),
|
|
3602
|
-
DynamicComponent,
|
|
3603
4279
|
],
|
|
3604
4280
|
exports: [
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
4281
|
+
TableConfigComponent,
|
|
4282
|
+
TableControlComponent,
|
|
4283
|
+
MatrixConfigComponent,
|
|
4284
|
+
MatrixControlComponent,
|
|
3609
4285
|
EntryConfigComponent,
|
|
3610
4286
|
EntryControlComponent,
|
|
3611
4287
|
],
|
|
@@ -3835,5 +4511,5 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3835
4511
|
* Generated bundle index. Do not edit.
|
|
3836
4512
|
*/
|
|
3837
4513
|
|
|
3838
|
-
export { ActionGroup, index$l as Admin, CMS_TOOLBAR_ACTION_CONTRIBUTORS, CmsApiService, CmsExtensionsResolver, CmsModule, CmsRoutingModule, CmsService, Cms_Default_Toolbar_Actions, CreateComponent, CreateFieldComponent, CreateOrEditComponent, CreateOrEditEntriesComponent, CreateOrEditEntryTypeInputBase, CreateOrEditFieldComponent, CreateOrUpdateFieldInputBase, CreateOrUpdateSectionsInputBase, CreateOrUpdateSitesInputBase, index$f as Dignite, ECmsComponent, EditComponent, EditFieldComponent, index$s as Entries, EntriesComponent, Entries_Create_Defaults_Toolbar_Action, Entries_Defaults_Toolbar_Action, Entries_Edit_Defaults_Toolbar_Action, EntryConfig, EntryConfigComponent, EntryControlComponent, FieldAbstractsService, FieldControlGroup, FieldGroupComponent, index$e as Fields, FieldsComponent, Fields_Create_Defaults_Toolbar_Action, Fields_Defaults_Toolbar_Action, Fields_Edit_Defaults_Toolbar_Action, index$6 as Microsoft, index$m as Sections, SectionsComponent, Sections_Create_Or_Edit_Defaults_Toolbar_Action, Sections_Defaults_Toolbar_Action, index$5 as Sites, SitesComponent, Sites_Defaults_Toolbar_Action, index as Volo, fieldTabsBase, fieldsBase, fieldsInputBase };
|
|
4514
|
+
export { ActionGroup, index$l as Admin, CMS_TOOLBAR_ACTION_CONTRIBUTORS, CmsApiService, CmsExtensionsResolver, CmsModule, CmsRoutingModule, CmsService, Cms_Default_Toolbar_Actions, CreateComponent, CreateFieldComponent, CreateOrEditComponent, CreateOrEditEntriesComponent, CreateOrEditEntryTypeInputBase, CreateOrEditFieldComponent, CreateOrUpdateFieldInputBase, CreateOrUpdateSectionsInputBase, CreateOrUpdateSitesInputBase, index$f as Dignite, ECmsComponent, EditComponent, EditFieldComponent, index$s as Entries, EntriesComponent, Entries_Create_Defaults_Toolbar_Action, Entries_Defaults_Toolbar_Action, Entries_Edit_Defaults_Toolbar_Action, EntryConfig, EntryConfigComponent, EntryControlComponent, FieldAbstractsService, FieldControlGroup, FieldGroupComponent, index$e as Fields, FieldsComponent, Fields_Create_Defaults_Toolbar_Action, Fields_Defaults_Toolbar_Action, Fields_Edit_Defaults_Toolbar_Action, MatrixConfig, MatrixConfigComponent, MatrixControlComponent, MatrixItemConfig, index$6 as Microsoft, index$m as Sections, SectionsComponent, Sections_Create_Or_Edit_Defaults_Toolbar_Action, Sections_Defaults_Toolbar_Action, index$5 as Sites, SitesComponent, Sites_Defaults_Toolbar_Action, TableConfig, TableConfigComponent, TableControlComponent, TableFormControl, index as Volo, fieldTabsBase, fieldsBase, fieldsInputBase, matrixFieldInputBase };
|
|
3839
4515
|
//# sourceMappingURL=dignite-ng-expand.cms.mjs.map
|