@dignite-ng/expand.dynamic-form 0.0.4 → 0.0.6

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.
@@ -12,6 +12,23 @@ import { FileExplorerModule } from '@dignite-ng/expand.file-explorer';
12
12
  import * as i3 from '@ngx-validate/core';
13
13
  import * as i2$1 from '@angular/common';
14
14
  import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
15
+ import '@ckeditor/ckeditor5-build-classic/build/translations/zh-cn.js';
16
+ import '@ckeditor/ckeditor5-build-classic/build/translations/zh.js';
17
+ import '@ckeditor/ckeditor5-build-classic/build/translations/de.js';
18
+ import '@ckeditor/ckeditor5-build-classic/build/translations/de-ch.js';
19
+ import '@ckeditor/ckeditor5-build-classic/build/translations/ar';
20
+ import '@ckeditor/ckeditor5-build-classic/build/translations/cs.js';
21
+ import '@ckeditor/ckeditor5-build-classic/build/translations/hi.js';
22
+ import '@ckeditor/ckeditor5-build-classic/build/translations/fi.js';
23
+ import '@ckeditor/ckeditor5-build-classic/build/translations/hu.js';
24
+ import '@ckeditor/ckeditor5-build-classic/build/translations/fr.js';
25
+ import '@ckeditor/ckeditor5-build-classic/build/translations/it.js';
26
+ import '@ckeditor/ckeditor5-build-classic/build/translations/en-gb.js';
27
+ import '@ckeditor/ckeditor5-build-classic/build/translations/pt-br.js';
28
+ import '@ckeditor/ckeditor5-build-classic/build/translations/sk';
29
+ import '@ckeditor/ckeditor5-build-classic/build/translations/ja.js';
30
+ import '@ckeditor/ckeditor5-build-classic/build/translations/es.js';
31
+ import '@ckeditor/ckeditor5-build-classic/build/translations/vi.js';
15
32
  import * as i3$1 from '@ckeditor/ckeditor5-angular';
16
33
  import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
17
34
  import { pinyin } from 'pinyin-pro';
@@ -159,6 +176,10 @@ class TextEditComponent {
159
176
  if (this._fields.required) {
160
177
  ValidatorsArray.push(Validators.required);
161
178
  }
179
+ this._fields.field.formConfiguration = {
180
+ ...this.fb.group(new TextEditConfig()).value,
181
+ ...this._fields.field.formConfiguration
182
+ };
162
183
  if (this._fields.field.formConfiguration['TextEdit.CharLimit']) {
163
184
  ValidatorsArray.push(Validators.maxLength(this._fields.field.formConfiguration['TextEdit.CharLimit']));
164
185
  }
@@ -167,6 +188,7 @@ class TextEditComponent {
167
188
  resolve(true);
168
189
  });
169
190
  }
191
+ isObjEmpty = (obj) => Object.keys(obj).length === 0;
170
192
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextEditComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
171
193
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextEditComponent, selector: "df-text-edit", 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]=\"_parentFiledName\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <ng-container *ngIf=\"_fields.field.formConfiguration['TextEdit.Mode'] ===_TextEditMode.SingleLine\">\n <input type=\"text\" class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" />\n </ng-container>\n <ng-container *ngIf=\"_fields.field.formConfiguration['TextEdit.Mode'] === _TextEditMode.MultipleLine\">\n <textarea class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" rows=\"3\"></textarea>\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.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: 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: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }] });
172
194
  }
@@ -610,7 +632,6 @@ class isBase64UploadAdapter {
610
632
  this.loader = loader;
611
633
  this.ImagesContainerName = ImagesContainerName;
612
634
  this.restService = restService;
613
- console.log(this.restService, 11111111111, restService);
614
635
  }
615
636
  upload() {
616
637
  return new Promise((resolve, reject) => {
@@ -658,38 +679,63 @@ class isBase64UploadAdapter {
658
679
  class CkEditorControlComponent {
659
680
  fb;
660
681
  restService;
661
- constructor(fb, restService) {
682
+ config;
683
+ languagesMap = {
684
+ ar: 'ar',
685
+ cs: 'cs',
686
+ en: 'en',
687
+ hi: 'hi',
688
+ fi: 'fi',
689
+ hu: 'hu',
690
+ fr: 'fr',
691
+ it: 'it',
692
+ 'en-GB': 'en-gb',
693
+ 'pt-BR': 'pt-br',
694
+ 'zh-Hant': 'zh',
695
+ 'zh-Hans': 'zh-cn',
696
+ tr: 'tr',
697
+ sk: 'sk',
698
+ 'de-DE': 'de',
699
+ es: 'es',
700
+ ja: 'ja',
701
+ vi: 'vi',
702
+ };
703
+ constructor(fb, restService, config) {
662
704
  this.fb = fb;
663
705
  this.restService = restService;
706
+ this.config = config;
707
+ const currentCulture = this.config.getOne("localization")?.currentCulture?.name;
708
+ this.editorConfig = {
709
+ language: this.languagesMap[currentCulture],
710
+ // language: currentCulture||'en',
711
+ placeholder: '',
712
+ toolbar: {
713
+ removeItems: ['mediaEmbed'],
714
+ shouldNotGroupWhenFull: true
715
+ },
716
+ styles: [
717
+ 'alignCenter',
718
+ 'alignLeft',
719
+ 'alignRight'
720
+ ],
721
+ image: {
722
+ toolbar: [
723
+ 'imageTextAlternative', 'toggleImageCaption', '|',
724
+ 'imageStyle:inline', 'imageStyle:wrapText', 'imageStyle:breakText', 'imageStyle:side', '|',
725
+ ,
726
+ 'resizeImage'
727
+ ],
728
+ insert: {
729
+ integrations: [
730
+ 'insertImageViaUrl'
731
+ ]
732
+ }
733
+ }
734
+ };
664
735
  }
665
736
  Editor = ClassicEditor;
666
737
  /**富文本配置 */
667
- editorConfig = {
668
- language: 'zh-cn',
669
- placeholder: '',
670
- toolbar: {
671
- removeItems: ['mediaEmbed'],
672
- shouldNotGroupWhenFull: true
673
- },
674
- styles: [
675
- 'alignCenter',
676
- 'alignLeft',
677
- 'alignRight'
678
- ],
679
- image: {
680
- toolbar: [
681
- 'imageTextAlternative', 'toggleImageCaption', '|',
682
- 'imageStyle:inline', 'imageStyle:wrapText', 'imageStyle:breakText', 'imageStyle:side', '|',
683
- ,
684
- 'resizeImage'
685
- ],
686
- insert: {
687
- integrations: [
688
- 'insertImageViaUrl'
689
- ]
690
- }
691
- }
692
- };
738
+ editorConfig = {};
693
739
  //**富文本加载完成 */
694
740
  onReady(editor) {
695
741
  let that = this;
@@ -699,8 +745,6 @@ class CkEditorControlComponent {
699
745
  }
700
746
  /**富文本内容改变 */
701
747
  onChange({ editor }) {
702
- // const data = editor.getData();
703
- // console.log(editor, 'onChangeonChange');
704
748
  }
705
749
  /**表单实体 */
706
750
  _entity;
@@ -745,17 +789,13 @@ class CkEditorControlComponent {
745
789
  if (this._fields.required) {
746
790
  ValidatorsArray.push(Validators.required);
747
791
  }
748
- // if (this._fields.field.formConfiguration.limit) {
749
- // ValidatorsArray.push(Validators.maxLength(this._fields.field.formConfiguration.limit))
750
- // }
751
792
  let newControl = this.fb.control(this._selected ? this._selected : this._fields.field.formConfiguration['Ckeditor.InitialContent'], ValidatorsArray);
752
793
  this.extraProperties.setControl(this._fields.field.name, newControl);
753
794
  this.imagesContainerName = this._fields.field.formConfiguration['Ckeditor.ImagesContainerName'];
754
- // console.log(this._fields,'ceshiceshiceshiceshiceshi',this.extraProperties.value,this._entity.value,'this._selected',this._selected);
755
795
  resolve(true);
756
796
  });
757
797
  }
758
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CkEditorControlComponent, deps: [{ token: i1.FormBuilder }, { token: i2.RestService }], target: i0.ɵɵFactoryTarget.Component });
798
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CkEditorControlComponent, deps: [{ token: i1.FormBuilder }, { token: i2.RestService }, { token: i2.ConfigStateService }], target: i0.ɵɵFactoryTarget.Component });
759
799
  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: i3$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 }] });
760
800
  }
761
801
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CkEditorControlComponent, decorators: [{
@@ -767,7 +807,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
767
807
  ThemeSharedModule,
768
808
  ReactiveFormsModule,
769
809
  ], 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>" }]
770
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.RestService }]; }, propDecorators: { entity: [{
810
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.RestService }, { type: i2.ConfigStateService }]; }, propDecorators: { entity: [{
771
811
  type: Input
772
812
  }], fields: [{
773
813
  type: Input
@@ -1120,14 +1160,13 @@ class FileExplorerControlComponent {
1120
1160
  let obj = {};
1121
1161
  obj[fieldName] = event;
1122
1162
  this.extraProperties.patchValue(obj);
1123
- console.log(event, '_selectedFile改变回调---file-explorer', this.extraProperties);
1124
1163
  }
1125
1164
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerControlComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
1126
- 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\" (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>\n", 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: ["fileContainerName", "selectFormFile"], outputs: ["selectedFileChange"] }] });
1165
+ 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"] }] });
1127
1166
  }
1128
1167
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerControlComponent, decorators: [{
1129
1168
  type: Component,
1130
- 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\" (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>\n" }]
1169
+ 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>" }]
1131
1170
  }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { entity: [{
1132
1171
  type: Input
1133
1172
  }], fields: [{
@@ -1170,7 +1209,8 @@ class DfApiService {
1170
1209
  * */
1171
1210
  chineseToPinyin(value) {
1172
1211
  //去除字符串中所有的空格
1173
- let val = value.replace(/\s+/g, "");
1212
+ // let val = value
1213
+ let val = value.replaceAll(' ', "-");
1174
1214
  let array = val.split('');
1175
1215
  let newArray = [];
1176
1216
  array.forEach((el, index) => {