@dignite-ng/expand.dynamic-form 0.0.12 → 0.0.14

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.
@@ -1,17 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, ViewChild, ChangeDetectionStrategy, inject, Injectable, ViewContainerRef, NgModule } from '@angular/core';
2
+ import { Component, Input, ViewChild, ChangeDetectionStrategy, inject, Inject, Injectable, ViewContainerRef, NgModule } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
- import { Validators, FormBuilder, FormsModule, ReactiveFormsModule, FormArray, FormGroup, FormControl } from '@angular/forms';
4
+ import { Validators, FormBuilder, FormArray, FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
5
  import * as i2 from '@abp/ng.core';
6
6
  import { RestService, ConfigStateService, CoreModule } from '@abp/ng.core';
7
7
  import { ThemeSharedModule } from '@abp/ng.theme.shared';
8
8
  import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
9
9
  import { NzTreeModule } from 'ng-zorro-antd/tree';
10
- import * as i4 from '@dignite-ng/expand.file-explorer';
11
- import { FileExplorerModule } from '@dignite-ng/expand.file-explorer';
12
10
  import * as i3 from '@ngx-validate/core';
13
11
  import * as i2$1 from '@angular/common';
14
- import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
12
+ import { DOCUMENT } from '@angular/common';
15
13
  import '@ckeditor/ckeditor5-build-classic/build/translations/zh-cn.js';
16
14
  import '@ckeditor/ckeditor5-build-classic/build/translations/zh.js';
17
15
  import '@ckeditor/ckeditor5-build-classic/build/translations/de.js';
@@ -29,9 +27,8 @@ import '@ckeditor/ckeditor5-build-classic/build/translations/sk';
29
27
  import '@ckeditor/ckeditor5-build-classic/build/translations/ja.js';
30
28
  import '@ckeditor/ckeditor5-build-classic/build/translations/es.js';
31
29
  import '@ckeditor/ckeditor5-build-classic/build/translations/vi.js';
32
- import * as i1$1 from '@ckeditor/ckeditor5-angular';
33
- import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
34
30
  import { pinyin } from 'pinyin-pro';
31
+ import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
35
32
 
36
33
  class TextEditConfig {
37
34
  /**占位符 */
@@ -670,8 +667,10 @@ class isBase64UploadAdapter {
670
667
  }
671
668
 
672
669
  class CkEditorControlComponent {
673
- // public Editor ;
674
- Editor = ClassicEditor;
670
+ renderer;
671
+ document;
672
+ _restService = inject(RestService);
673
+ config = inject(ConfigStateService);
675
674
  languagesMap = {
676
675
  ar: 'ar',
677
676
  cs: 'cs',
@@ -692,50 +691,89 @@ class CkEditorControlComponent {
692
691
  ja: 'ja',
693
692
  vi: 'vi',
694
693
  };
695
- fb = inject(FormBuilder);
696
- restService = inject(RestService);
697
- config = inject(ConfigStateService);
698
- constructor() {
694
+ ckeditor;
695
+ Editor;
696
+ constructor(renderer, document) {
697
+ this.renderer = renderer;
698
+ this.document = document;
699
+ this.addScript('https://cdn.ckeditor.com/ckeditor5/41.4.1/classic/ckeditor.js');
700
+ }
701
+ addScript(url) {
702
+ const script = this.renderer.createElement('script');
703
+ this.renderer.setAttribute(script, 'type', 'text/javascript');
704
+ this.renderer.setAttribute(script, 'src', url);
705
+ script.onload = () => {
706
+ this._init_Editor();
707
+ };
708
+ this.renderer.appendChild(this.document.head, script);
709
+ }
710
+ // 初始化富文本
711
+ _init_Editor() {
699
712
  const currentCulture = this.config.getOne("localization")?.currentCulture?.name;
700
- this.editorConfig = {
713
+ ClassicEditor.create(this.ckeditor?.nativeElement, {
701
714
  language: this.languagesMap[currentCulture],
702
- placeholder: '',
703
715
  toolbar: {
704
- removeItems: ['mediaEmbed', 'insertTable', 'undo', 'redo'],
716
+ items: [
717
+ 'heading', '|', 'Alignment', 'FontSize', 'FontColor', 'FontFamily', 'Highlight', '|',
718
+ 'bold', 'italic',
719
+ 'link', '|',
720
+ 'bulletedList', 'numberedList',
721
+ 'insertTable', '|',
722
+ 'uploadImage', 'ImageResize', '|',
723
+ 'undo', 'redo'
724
+ ],
725
+ viewportTopOffset: 30,
705
726
  shouldNotGroupWhenFull: true
706
727
  },
707
- styles: [
708
- 'alignCenter',
709
- 'alignLeft',
710
- 'alignRight'
711
- ],
712
728
  image: {
713
729
  toolbar: [
714
- 'imageTextAlternative', 'toggleImageCaption', '|',
715
- 'imageStyle:inline', 'imageStyle:wrapText', 'imageStyle:breakText', 'imageStyle:side', '|',
716
- ,
717
- 'resizeImage'
730
+ 'imageStyle:alignLeft', 'imageStyle:alignCenter', 'imageStyle:alignRight',
731
+ '|',
732
+ 'resizeImage',
733
+ '|',
734
+ 'imageTextAlternative'
718
735
  ],
719
- insert: {
720
- integrations: [
721
- 'insertImageViaUrl'
722
- ]
723
- }
724
- }
725
- };
726
- }
727
- /**富文本配置 */
728
- editorConfig = {};
729
- //**富文本加载完成 */
730
- onReady(editor) {
731
- let that = this;
732
- editor.plugins.get('FileRepository').createUploadAdapter = function (loader) {
733
- return new isBase64UploadAdapter(loader, that.imagesContainerName, that.restService);
734
- };
735
- }
736
- /**富文本内容改变 */
737
- onChange({ editor }) {
736
+ styles: [
737
+ 'alignLeft', 'alignCenter', 'alignRight'
738
+ ],
739
+ resizeOptions: [{
740
+ name: 'resizeImage:original',
741
+ label: 'Original',
742
+ value: null
743
+ },
744
+ {
745
+ name: 'resizeImage:25',
746
+ label: '25%',
747
+ value: '25'
748
+ },
749
+ {
750
+ name: 'resizeImage:50',
751
+ label: '50%',
752
+ value: '50'
753
+ },
754
+ {
755
+ name: 'resizeImage:75',
756
+ label: '75%',
757
+ value: '75'
758
+ }
759
+ ],
760
+ },
761
+ }).then((editor) => {
762
+ this.Editor = editor;
763
+ this.dataLoaded();
764
+ var _this = this;
765
+ editor.plugins.get('FileRepository').createUploadAdapter = function (loader) {
766
+ return new isBase64UploadAdapter(loader, _this.imagesContainerName, _this._restService);
767
+ };
768
+ editor.model.document.on('change:data', () => {
769
+ const data = editor.getData();
770
+ this.setckeditorInput(data);
771
+ });
772
+ }).catch((err) => {
773
+ console.log(err);
774
+ });
738
775
  }
776
+ fb = inject(FormBuilder);
739
777
  /**表单实体 */
740
778
  _entity;
741
779
  set entity(v) {
@@ -764,17 +802,29 @@ class CkEditorControlComponent {
764
802
  get extraProperties() {
765
803
  return this._entity.get('extraProperties');
766
804
  }
805
+ get ckeditorInput() {
806
+ return this.extraProperties.get(this._fields.field.name);
807
+ }
767
808
  /**数据加载完成 */
768
809
  async dataLoaded() {
769
- if (this._fields && this._entity) {
810
+ if (this._fields && this._entity && this.Editor) {
770
811
  await this.AfterInit();
812
+ if (this._selected) {
813
+ this.Editor.setData(this._selected);
814
+ this.setckeditorInput(this._selected);
815
+ }
771
816
  this.submitclick.nativeElement.click();
772
817
  }
773
818
  }
819
+ invalidfeedback = false;
820
+ setckeditorInput(val) {
821
+ this.invalidfeedback = true;
822
+ this.ckeditorInput.patchValue(val);
823
+ }
774
824
  /**图片容器名称 */
775
- imagesContainerName;
825
+ imagesContainerName = 111;
776
826
  AfterInit() {
777
- return new Promise((resolve, rejects) => {
827
+ return new Promise((resolve) => {
778
828
  let ValidatorsArray = [];
779
829
  if (this._fields.required) {
780
830
  ValidatorsArray.push(Validators.required);
@@ -785,19 +835,19 @@ class CkEditorControlComponent {
785
835
  resolve(true);
786
836
  });
787
837
  }
788
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CkEditorControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
789
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CkEditorControlComponent, isStandalone: true, selector: "df-ck-editor-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 <ckeditor [editor]=\"Editor\" [config]=\"editorConfig\" formControlName=\"{{_fields.field.name}}\"\n (ready)=\"onReady($event)\" (change)=\"onChange($event)\" required=\"\" name=\"overview\"></ckeditor>\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: "ngmodule", type: CKEditorModule }, { kind: "component", type: i1$1.CKEditorComponent, selector: "ckeditor", inputs: ["editor", "config", "data", "tagName", "watchdog", "editorWatchdogConfig", "disableTwoWayDataBinding", "disabled"], outputs: ["ready", "change", "blur", "focus", "error"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: ThemeSharedModule }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "ngmodule", type: ReactiveFormsModule }] });
838
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CkEditorControlComponent, deps: [{ token: i0.Renderer2 }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
839
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CkEditorControlComponent, selector: "df-ck-editor-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "ckeditor", first: true, predicate: ["ckeditor"], descendants: true, static: true }, { 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 #ckeditor id=\"ckeditor\"></div>\n <ng-container *ngIf=\"ckeditorInput?.errors?.required&&invalidfeedback\">\n <div class=\"text-danger \">\n {{'DigniteAbpForms::Validate:Required' | abpLocalization:' '}}\n </div>\n </ng-container>\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: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] });
790
840
  }
791
841
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CkEditorControlComponent, decorators: [{
792
842
  type: Component,
793
- args: [{ selector: 'df-ck-editor-control', standalone: true, imports: [
794
- CKEditorModule,
795
- FormsModule,
796
- CoreModule,
797
- ThemeSharedModule,
798
- ReactiveFormsModule,
799
- ], 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 <ckeditor [editor]=\"Editor\" [config]=\"editorConfig\" formControlName=\"{{_fields.field.name}}\"\n (ready)=\"onReady($event)\" (change)=\"onChange($event)\" required=\"\" name=\"overview\"></ckeditor>\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>" }]
800
- }], ctorParameters: function () { return []; }, propDecorators: { entity: [{
843
+ args: [{ selector: 'df-ck-editor-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 #ckeditor id=\"ckeditor\"></div>\n <ng-container *ngIf=\"ckeditorInput?.errors?.required&&invalidfeedback\">\n <div class=\"text-danger \">\n {{'DigniteAbpForms::Validate:Required' | abpLocalization:' '}}\n </div>\n </ng-container>\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>" }]
844
+ }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: Document, decorators: [{
845
+ type: Inject,
846
+ args: [DOCUMENT]
847
+ }] }]; }, propDecorators: { ckeditor: [{
848
+ type: ViewChild,
849
+ args: ['ckeditor', { static: true }]
850
+ }], entity: [{
801
851
  type: Input
802
852
  }], fields: [{
803
853
  type: Input
@@ -991,176 +1041,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
991
1041
  args: ['submitclick', { static: true }]
992
1042
  }] } });
993
1043
 
994
- class FileExplorerConfig {
995
- /**文件容器名称 */
996
- 'FileExplorer.FileContainerName' = ['', [Validators.required]];
997
- /**多选 */
998
- 'FileExplorer.UploadFileMultiple' = [false, []];
999
- constructor(data) {
1000
- if (data) {
1001
- for (const key in data) {
1002
- if (data.hasOwnProperty(key)) {
1003
- this[key] = data[key];
1004
- }
1005
- }
1006
- }
1007
- }
1008
- }
1009
-
1010
- class FileExplorerConfigComponent {
1011
- fb;
1012
- constructor(fb) {
1013
- this.fb = fb;
1014
- }
1015
- /**表单控件类型 */
1016
- _type;
1017
- set type(v) {
1018
- this._type = v;
1019
- this.dataLoaded();
1020
- }
1021
- /**表单实体 */
1022
- _Entity;
1023
- set Entity(v) {
1024
- this._Entity = v;
1025
- this.dataLoaded();
1026
- }
1027
- /**选择的表单信息 */
1028
- _selected;
1029
- set selected(v) {
1030
- this._selected = v;
1031
- this.dataLoaded();
1032
- }
1033
- get formConfiguration() {
1034
- return this._Entity.get('formConfiguration');
1035
- }
1036
- submitclick;
1037
- async dataLoaded() {
1038
- if (this._Entity && this._type) {
1039
- await this.AfterInit();
1040
- this.submitclick?.nativeElement?.click();
1041
- }
1042
- }
1043
- AfterInit() {
1044
- return new Promise((resolve, rejects) => {
1045
- this._Entity.setControl('formConfiguration', this.fb.group(new FileExplorerConfig()));
1046
- if (this._selected && this._selected.formControlName == this._type) {
1047
- this.formConfiguration.patchValue({
1048
- ...this._selected.formConfiguration
1049
- });
1050
- }
1051
- resolve(true);
1052
- });
1053
- }
1054
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerConfigComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
1055
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FileExplorerConfigComponent, selector: "df-file-explorer-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpDynamicFormsFileExplorer::FileContainerName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"FileExplorer.FileContainerName\">\n </div>\n <div class=\"mb-2\">\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"FileExplorer.UploadFileMultiple\" id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpDynamicFormsFileExplorer::UploadFileMultiple' | abpLocalization}}\n </label>\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] });
1056
- }
1057
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerConfigComponent, decorators: [{
1058
- type: Component,
1059
- args: [{ selector: 'df-file-explorer-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpDynamicFormsFileExplorer::FileContainerName' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"FileExplorer.FileContainerName\">\n </div>\n <div class=\"mb-2\">\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"FileExplorer.UploadFileMultiple\" id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpDynamicFormsFileExplorer::UploadFileMultiple' | abpLocalization}}\n </label>\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>" }]
1060
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { type: [{
1061
- type: Input
1062
- }], Entity: [{
1063
- type: Input
1064
- }], selected: [{
1065
- type: Input
1066
- }], submitclick: [{
1067
- type: ViewChild,
1068
- args: ['submitclick', { static: true }]
1069
- }] } });
1070
-
1071
- class FileExplorerControlComponent {
1072
- fb;
1073
- constructor(fb) {
1074
- this.fb = fb;
1075
- }
1076
- /**表单实体 */
1077
- _entity;
1078
- set entity(v) {
1079
- this._entity = v;
1080
- if (v)
1081
- this.dataLoaded();
1082
- }
1083
- /**字段配置列表 */
1084
- _fields = '';
1085
- set fields(v) {
1086
- this._fields = v;
1087
- if (v)
1088
- this.dataLoaded();
1089
- }
1090
- /**父级字段名称,用于为表单设置控件赋值 */
1091
- _parentFiledName;
1092
- set parentFiledName(v) {
1093
- this._parentFiledName = v;
1094
- if (v)
1095
- this.dataLoaded();
1096
- }
1097
- /**父级字段名称,用于为表单设置控件赋值 */
1098
- _selected;
1099
- set selected(v) {
1100
- this._selected = v;
1101
- if (v && v.length > 0)
1102
- this.dataLoaded();
1103
- }
1104
- submitclick;
1105
- get extraProperties() {
1106
- return this._entity.get('extraProperties');
1107
- }
1108
- /**数据加载完成 */
1109
- async dataLoaded() {
1110
- if (this._fields && this._entity && this._parentFiledName) {
1111
- await this.AfterInit();
1112
- this.submitclick.nativeElement.click();
1113
- }
1114
- }
1115
- /**字段配置 */
1116
- formConfiguration = '';
1117
- /**文件容器名称 */
1118
- FileContainerName = '';
1119
- AfterInit() {
1120
- return new Promise((resolve, rejects) => {
1121
- let ValidatorsArray = [];
1122
- if (this._fields.required) {
1123
- ValidatorsArray.push(Validators.required);
1124
- }
1125
- this.formConfiguration = this._fields.field.formConfiguration;
1126
- this.FileContainerName = this.formConfiguration['FileExplorer.FileContainerName'];
1127
- if (this._selected && this._selected.length > 0) {
1128
- this.selectedFileGroup = this._selected;
1129
- }
1130
- let newControl = this.fb.control(this._selected, ValidatorsArray);
1131
- this.extraProperties.setControl(this._fields.field.name, newControl);
1132
- resolve(true);
1133
- });
1134
- }
1135
- /**选择文件-弹窗的-已选定的文件 */
1136
- selectedFileGroup = [];
1137
- /**_selectedFile改变回调 */
1138
- _selectedFileChange(event) {
1139
- this.selectedFileGroup = event;
1140
- let fieldName = this._fields.field.name;
1141
- let obj = {};
1142
- obj[fieldName] = event;
1143
- this.extraProperties.patchValue(obj);
1144
- }
1145
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerControlComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
1146
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FileExplorerControlComponent, selector: "df-file-explorer-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 <fe-file-picker [selectFormFile]=\"selectedFileGroup\" [multiple]=\"formConfiguration['FileExplorer.UploadFileMultiple']\"\n (selectedFileChange)=\"_selectedFileChange($event)\"></fe-file-picker>\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: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "component", type: i4.FilePickerComponent, selector: "fe-file-picker", inputs: ["multiple", "fileContainerName", "selectFormFile"], outputs: ["selectedFileChange"] }] });
1147
- }
1148
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerControlComponent, decorators: [{
1149
- type: Component,
1150
- args: [{ selector: 'df-file-explorer-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 <fe-file-picker [selectFormFile]=\"selectedFileGroup\" [multiple]=\"formConfiguration['FileExplorer.UploadFileMultiple']\"\n (selectedFileChange)=\"_selectedFileChange($event)\"></fe-file-picker>\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>" }]
1151
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { entity: [{
1152
- type: Input
1153
- }], fields: [{
1154
- type: Input
1155
- }], parentFiledName: [{
1156
- type: Input
1157
- }], selected: [{
1158
- type: Input
1159
- }], submitclick: [{
1160
- type: ViewChild,
1161
- args: ['submitclick', { static: true }]
1162
- }] } });
1163
-
1164
1044
  class SelectConfig {
1165
1045
  /**空值文本 */
1166
1046
  'Select.NullText' = ['', []];
@@ -1469,12 +1349,6 @@ const FieldControlGroup = [
1469
1349
  // fieldViewComponent:TextBoxViewComponent,
1470
1350
  },
1471
1351
  {
1472
- displayName: '文件管理',
1473
- name: 'FileExplorer',
1474
- fieldConfigComponent: FileExplorerConfigComponent,
1475
- fieldComponent: FileExplorerControlComponent,
1476
- // fieldViewComponent:TextBoxViewComponent,
1477
- }, {
1478
1352
  displayName: 'CkEditor',
1479
1353
  name: 'CkEditor',
1480
1354
  fieldConfigComponent: CkEditorConfigComponent,
@@ -1627,18 +1501,18 @@ class DynamicFormModule {
1627
1501
  NumbericEditControlComponent,
1628
1502
  DateEditConfigComponent,
1629
1503
  DateEditControlComponent,
1630
- FileExplorerConfigComponent,
1631
- FileExplorerControlComponent,
1632
1504
  CkEditorConfigComponent,
1633
1505
  SelectConfigComponent,
1634
1506
  SelectControlComponent,
1635
- DynamicComponent], imports: [FormsModule,
1507
+ DynamicComponent,
1508
+ CkEditorControlComponent], imports: [FormsModule,
1636
1509
  CoreModule,
1637
1510
  ThemeSharedModule,
1638
1511
  ReactiveFormsModule,
1639
1512
  NgbDropdownModule,
1640
1513
  NzTreeModule,
1641
- FileExplorerModule], exports: [TextEditConfigComponent,
1514
+ // FileExplorerModule,
1515
+ CKEditorModule], exports: [TextEditConfigComponent,
1642
1516
  TextEditComponent,
1643
1517
  SwitchConfigComponent,
1644
1518
  SwitchControlComponent,
@@ -1646,8 +1520,6 @@ class DynamicFormModule {
1646
1520
  NumbericEditControlComponent,
1647
1521
  DateEditConfigComponent,
1648
1522
  DateEditControlComponent,
1649
- FileExplorerConfigComponent,
1650
- FileExplorerControlComponent,
1651
1523
  CkEditorConfigComponent,
1652
1524
  SelectConfigComponent,
1653
1525
  SelectControlComponent,
@@ -1658,7 +1530,8 @@ class DynamicFormModule {
1658
1530
  ReactiveFormsModule,
1659
1531
  NgbDropdownModule,
1660
1532
  NzTreeModule,
1661
- FileExplorerModule] });
1533
+ // FileExplorerModule,
1534
+ CKEditorModule] });
1662
1535
  }
1663
1536
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicFormModule, decorators: [{
1664
1537
  type: NgModule,
@@ -1672,12 +1545,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1672
1545
  NumbericEditControlComponent,
1673
1546
  DateEditConfigComponent,
1674
1547
  DateEditControlComponent,
1675
- FileExplorerConfigComponent,
1676
- FileExplorerControlComponent,
1677
1548
  CkEditorConfigComponent,
1678
1549
  SelectConfigComponent,
1679
1550
  SelectControlComponent,
1680
1551
  DynamicComponent,
1552
+ CkEditorControlComponent
1681
1553
  ],
1682
1554
  imports: [
1683
1555
  FormsModule,
@@ -1686,8 +1558,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1686
1558
  ReactiveFormsModule,
1687
1559
  NgbDropdownModule,
1688
1560
  NzTreeModule,
1689
- FileExplorerModule,
1690
- // DynamicComponent
1561
+ // FileExplorerModule,
1562
+ CKEditorModule,
1691
1563
  ],
1692
1564
  exports: [
1693
1565
  TextEditConfigComponent,
@@ -1698,8 +1570,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1698
1570
  NumbericEditControlComponent,
1699
1571
  DateEditConfigComponent,
1700
1572
  DateEditControlComponent,
1701
- FileExplorerConfigComponent,
1702
- FileExplorerControlComponent,
1703
1573
  CkEditorConfigComponent,
1704
1574
  SelectConfigComponent,
1705
1575
  SelectControlComponent,
@@ -1716,5 +1586,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1716
1586
  * Generated bundle index. Do not edit.
1717
1587
  */
1718
1588
 
1719
- export { AddFieldControlGroup, CkEditorConfigComponent, CkEditorControlComponent, DateEditConfigComponent, DateEditControlComponent, DynamicComponent, DynamicFormModule, FieldControlGroup, FileExplorerConfigComponent, FileExplorerControlComponent, NumbericEditConfigComponent, NumbericEditControlComponent, SelectConfigComponent, SelectControlComponent, SwitchConfigComponent, SwitchControlComponent, TextEditComponent, TextEditConfig, TextEditConfigComponent, getExcludeAssignControl, maxDecimalPlacesValidator };
1589
+ export { AddFieldControlGroup, CkEditorConfigComponent, CkEditorControlComponent, DateEditConfigComponent, DateEditControlComponent, DynamicComponent, DynamicFormModule, FieldControlGroup, NumbericEditConfigComponent, NumbericEditControlComponent, SelectConfigComponent, SelectControlComponent, SwitchConfigComponent, SwitchControlComponent, TextEditComponent, TextEditConfig, TextEditConfigComponent, getExcludeAssignControl, maxDecimalPlacesValidator };
1720
1590
  //# sourceMappingURL=dignite-ng-expand.dynamic-form.mjs.map