@dignite-ng/expand.dynamic-form 0.0.3 → 0.0.5
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/components/dynamic/dynamic.component.mjs +1 -1
- package/esm2022/lib/components/from/ck-editor/ck-editor-control.component.mjs +72 -30
- package/esm2022/lib/components/from/file-explorer/file-explorer-control.component.mjs +3 -3
- package/esm2022/lib/components/from/select/select-config.component.mjs +21 -9
- package/esm2022/lib/components/from/text-edit/text-edit.component.mjs +7 -1
- package/esm2022/lib/services/df-api.service.mjs +3 -2
- package/fesm2022/dignite-ng-expand.dynamic-form.mjs +174 -115
- package/fesm2022/dignite-ng-expand.dynamic-form.mjs.map +1 -1
- package/lib/components/from/ck-editor/ck-editor-control.component.d.ts +41 -17
- package/lib/components/from/select/select-config.component.d.ts +4 -1
- package/lib/components/from/text-edit/text-edit.component.d.ts +1 -0
- package/lib/services/df-api.service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Input, ViewChild, ChangeDetectionStrategy, ViewContainerRef, NgModule
|
|
2
|
+
import { Component, Input, ViewChild, ChangeDetectionStrategy, Injectable, ViewContainerRef, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { Validators, FormsModule, ReactiveFormsModule, FormArray, FormGroup, FormControl } from '@angular/forms';
|
|
5
5
|
import * as i2 from '@abp/ng.core';
|
|
@@ -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
|
}
|
|
@@ -658,38 +680,63 @@ class isBase64UploadAdapter {
|
|
|
658
680
|
class CkEditorControlComponent {
|
|
659
681
|
fb;
|
|
660
682
|
restService;
|
|
661
|
-
|
|
683
|
+
config;
|
|
684
|
+
languagesMap = {
|
|
685
|
+
ar: 'ar',
|
|
686
|
+
cs: 'cs',
|
|
687
|
+
en: 'en',
|
|
688
|
+
hi: 'hi',
|
|
689
|
+
fi: 'fi',
|
|
690
|
+
hu: 'hu',
|
|
691
|
+
fr: 'fr',
|
|
692
|
+
it: 'it',
|
|
693
|
+
'en-GB': 'en-gb',
|
|
694
|
+
'pt-BR': 'pt-br',
|
|
695
|
+
'zh-Hant': 'zh',
|
|
696
|
+
'zh-Hans': 'zh-cn',
|
|
697
|
+
tr: 'tr',
|
|
698
|
+
sk: 'sk',
|
|
699
|
+
'de-DE': 'de',
|
|
700
|
+
es: 'es',
|
|
701
|
+
ja: 'ja',
|
|
702
|
+
vi: 'vi',
|
|
703
|
+
};
|
|
704
|
+
constructor(fb, restService, config) {
|
|
662
705
|
this.fb = fb;
|
|
663
706
|
this.restService = restService;
|
|
707
|
+
this.config = config;
|
|
708
|
+
const currentCulture = this.config.getOne("localization")?.currentCulture?.name;
|
|
709
|
+
this.editorConfig = {
|
|
710
|
+
language: this.languagesMap[currentCulture],
|
|
711
|
+
// language: currentCulture||'en',
|
|
712
|
+
placeholder: '',
|
|
713
|
+
toolbar: {
|
|
714
|
+
removeItems: ['mediaEmbed'],
|
|
715
|
+
shouldNotGroupWhenFull: true
|
|
716
|
+
},
|
|
717
|
+
styles: [
|
|
718
|
+
'alignCenter',
|
|
719
|
+
'alignLeft',
|
|
720
|
+
'alignRight'
|
|
721
|
+
],
|
|
722
|
+
image: {
|
|
723
|
+
toolbar: [
|
|
724
|
+
'imageTextAlternative', 'toggleImageCaption', '|',
|
|
725
|
+
'imageStyle:inline', 'imageStyle:wrapText', 'imageStyle:breakText', 'imageStyle:side', '|',
|
|
726
|
+
,
|
|
727
|
+
'resizeImage'
|
|
728
|
+
],
|
|
729
|
+
insert: {
|
|
730
|
+
integrations: [
|
|
731
|
+
'insertImageViaUrl'
|
|
732
|
+
]
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
};
|
|
664
736
|
}
|
|
665
737
|
Editor = ClassicEditor;
|
|
666
738
|
/**富文本配置 */
|
|
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
|
-
};
|
|
739
|
+
editorConfig = {};
|
|
693
740
|
//**富文本加载完成 */
|
|
694
741
|
onReady(editor) {
|
|
695
742
|
let that = this;
|
|
@@ -755,7 +802,7 @@ class CkEditorControlComponent {
|
|
|
755
802
|
resolve(true);
|
|
756
803
|
});
|
|
757
804
|
}
|
|
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 });
|
|
805
|
+
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
806
|
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
807
|
}
|
|
761
808
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CkEditorControlComponent, decorators: [{
|
|
@@ -767,7 +814,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
767
814
|
ThemeSharedModule,
|
|
768
815
|
ReactiveFormsModule,
|
|
769
816
|
], 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: [{
|
|
817
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.RestService }, { type: i2.ConfigStateService }]; }, propDecorators: { entity: [{
|
|
771
818
|
type: Input
|
|
772
819
|
}], fields: [{
|
|
773
820
|
type: Input
|
|
@@ -1123,11 +1170,11 @@ class FileExplorerControlComponent {
|
|
|
1123
1170
|
console.log(event, '_selectedFile改变回调---file-explorer', this.extraProperties);
|
|
1124
1171
|
}
|
|
1125
1172
|
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
|
|
1173
|
+
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
1174
|
}
|
|
1128
1175
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerControlComponent, decorators: [{
|
|
1129
1176
|
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
|
|
1177
|
+
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
1178
|
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { entity: [{
|
|
1132
1179
|
type: Input
|
|
1133
1180
|
}], fields: [{
|
|
@@ -1160,10 +1207,91 @@ class SelectConfig {
|
|
|
1160
1207
|
}
|
|
1161
1208
|
}
|
|
1162
1209
|
|
|
1210
|
+
class DfApiService {
|
|
1211
|
+
constructor() { }
|
|
1212
|
+
/**
|
|
1213
|
+
* 识别中文转化为拼音,固定返回类型
|
|
1214
|
+
* 汉字转拼音
|
|
1215
|
+
* 大写转小写
|
|
1216
|
+
*
|
|
1217
|
+
* */
|
|
1218
|
+
chineseToPinyin(value) {
|
|
1219
|
+
//去除字符串中所有的空格
|
|
1220
|
+
// let val = value
|
|
1221
|
+
let val = value.replaceAll(' ', "-");
|
|
1222
|
+
let array = val.split('');
|
|
1223
|
+
let newArray = [];
|
|
1224
|
+
array.forEach((el, index) => {
|
|
1225
|
+
//转化为小写
|
|
1226
|
+
let elChange = el.toLowerCase();
|
|
1227
|
+
let isChinese = (str) => {
|
|
1228
|
+
return /^[\u4e00-\u9fa5]+$/.test(str);
|
|
1229
|
+
};
|
|
1230
|
+
if (isChinese(elChange)) {
|
|
1231
|
+
const resultWithoutTone = pinyin(elChange, { toneType: 'none', type: 'array' });
|
|
1232
|
+
elChange = resultWithoutTone.toString();
|
|
1233
|
+
if (index < array.length - 1)
|
|
1234
|
+
elChange += '-';
|
|
1235
|
+
}
|
|
1236
|
+
;
|
|
1237
|
+
newArray.push(elChange);
|
|
1238
|
+
});
|
|
1239
|
+
let pinyinstr = newArray.join('');
|
|
1240
|
+
return pinyinstr || val;
|
|
1241
|
+
}
|
|
1242
|
+
/**获取图片的本地连接 */
|
|
1243
|
+
getImageLacolBase64Url(file) {
|
|
1244
|
+
return new Promise((resolve, rejects) => {
|
|
1245
|
+
const reader = new FileReader();
|
|
1246
|
+
reader.readAsDataURL(file);
|
|
1247
|
+
reader.onload = (e) => {
|
|
1248
|
+
resolve(e.target.result);
|
|
1249
|
+
};
|
|
1250
|
+
reader.onerror = error => rejects(error);
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* 深拷贝--方法 */
|
|
1255
|
+
deepClone(obj) {
|
|
1256
|
+
if (typeof obj !== 'object' || obj === null)
|
|
1257
|
+
return obj;
|
|
1258
|
+
const result = Array.isArray(obj) ? [] : {};
|
|
1259
|
+
for (let key in obj) {
|
|
1260
|
+
if (obj.hasOwnProperty(key)) {
|
|
1261
|
+
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
1262
|
+
if (obj[key] instanceof Date) {
|
|
1263
|
+
result[key] = new Date(obj[key].getTime());
|
|
1264
|
+
}
|
|
1265
|
+
else if (obj[key] instanceof RegExp) {
|
|
1266
|
+
result[key] = new RegExp(obj[key]);
|
|
1267
|
+
}
|
|
1268
|
+
else {
|
|
1269
|
+
result[key] = this.deepClone(obj[key]);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
else {
|
|
1273
|
+
result[key] = obj[key];
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return result;
|
|
1278
|
+
}
|
|
1279
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1280
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, providedIn: 'root' });
|
|
1281
|
+
}
|
|
1282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, decorators: [{
|
|
1283
|
+
type: Injectable,
|
|
1284
|
+
args: [{
|
|
1285
|
+
providedIn: 'root'
|
|
1286
|
+
}]
|
|
1287
|
+
}], ctorParameters: function () { return []; } });
|
|
1288
|
+
|
|
1163
1289
|
class SelectConfigComponent {
|
|
1164
1290
|
fb;
|
|
1165
|
-
|
|
1291
|
+
_DfApiService;
|
|
1292
|
+
constructor(fb, _DfApiService) {
|
|
1166
1293
|
this.fb = fb;
|
|
1294
|
+
this._DfApiService = _DfApiService;
|
|
1167
1295
|
}
|
|
1168
1296
|
/**表单控件类型 */
|
|
1169
1297
|
_type;
|
|
@@ -1225,13 +1353,22 @@ class SelectConfigComponent {
|
|
|
1225
1353
|
resolve(true);
|
|
1226
1354
|
});
|
|
1227
1355
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1356
|
+
textChange(event, index) {
|
|
1357
|
+
let SelectOptionsItem = this.SelectOptions.at(index);
|
|
1358
|
+
let value = event.target.value;
|
|
1359
|
+
if (SelectOptionsItem.get('Value').value)
|
|
1360
|
+
return;
|
|
1361
|
+
SelectOptionsItem.patchValue({
|
|
1362
|
+
Value: this._DfApiService.chineseToPinyin(value)
|
|
1363
|
+
});
|
|
1364
|
+
}
|
|
1365
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectConfigComponent, deps: [{ token: i1.FormBuilder }, { token: DfApiService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1366
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SelectConfigComponent, selector: "df-select-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\">{{'DigniteAbpForms::SelectListItem' | abpLocalization}}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemText' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addSelectOptions()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"Select.Options\">\n <ng-container *ngFor=\"let item of SelectOptions.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Text\" (change)=\"textChange($event,i)\"></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Value\"></td>\n <td>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Selected\" id=\"selected\">\n </div>\n </td>\n <td scope=\"row\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"deleteSelectOptions(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n </td>\n </tr> \n </ng-container>\n \n \n </tbody>\n </table>\n </div>\n\n\n\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NullText' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"Select.NullText\">\n </div>\n <div class=\"mb-2\">\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Select.Multiple\"\n id=\"Multiple\">\n <label class=\"form-check-label\" for=\"Multiple\">\n {{'DigniteAbpForms::Multiple' | 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: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i2.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { 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" }] });
|
|
1230
1367
|
}
|
|
1231
1368
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectConfigComponent, decorators: [{
|
|
1232
1369
|
type: Component,
|
|
1233
|
-
args: [{ selector: 'df-select-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\">{{'DigniteAbpForms::SelectListItemText' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addSelectOptions()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"Select.Options\">\n <ng-container *ngFor=\"let item of SelectOptions.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Text\"></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Value\"></td>\n <td>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Selected\" id=\"selected\">\n </div>\n </td>\n <td scope=\"row\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"deleteSelectOptions(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n </td>\n </tr> \n </ng-container>\n \n \n </tbody>\n </table>\n </div>\n\n\n\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NullText' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"Select.NullText\">\n </div>\n <div class=\"mb-2\">\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Select.Multiple\"\n id=\"Multiple\">\n <label class=\"form-check-label\" for=\"Multiple\">\n {{'DigniteAbpForms::Multiple' | 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>" }]
|
|
1234
|
-
}], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { type: [{
|
|
1370
|
+
args: [{ selector: 'df-select-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\">{{'DigniteAbpForms::SelectListItemText' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addSelectOptions()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"Select.Options\">\n <ng-container *ngFor=\"let item of SelectOptions.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Text\" (change)=\"textChange($event,i)\"></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Value\"></td>\n <td>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Selected\" id=\"selected\">\n </div>\n </td>\n <td scope=\"row\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"deleteSelectOptions(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n </td>\n </tr> \n </ng-container>\n \n \n </tbody>\n </table>\n </div>\n\n\n\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NullText' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"Select.NullText\">\n </div>\n <div class=\"mb-2\">\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Select.Multiple\"\n id=\"Multiple\">\n <label class=\"form-check-label\" for=\"Multiple\">\n {{'DigniteAbpForms::Multiple' | 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>" }]
|
|
1371
|
+
}], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: DfApiService }]; }, propDecorators: { type: [{
|
|
1235
1372
|
type: Input
|
|
1236
1373
|
}], Entity: [{
|
|
1237
1374
|
type: Input
|
|
@@ -1777,84 +1914,6 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
1777
1914
|
Abp: index$1
|
|
1778
1915
|
});
|
|
1779
1916
|
|
|
1780
|
-
class DfApiService {
|
|
1781
|
-
constructor() { }
|
|
1782
|
-
/**
|
|
1783
|
-
* 识别中文转化为拼音,固定返回类型
|
|
1784
|
-
* 汉字转拼音
|
|
1785
|
-
* 大写转小写
|
|
1786
|
-
*
|
|
1787
|
-
* */
|
|
1788
|
-
chineseToPinyin(value) {
|
|
1789
|
-
//去除字符串中所有的空格
|
|
1790
|
-
let val = value.replace(/\s+/g, "");
|
|
1791
|
-
let array = val.split('');
|
|
1792
|
-
let newArray = [];
|
|
1793
|
-
array.forEach((el, index) => {
|
|
1794
|
-
//转化为小写
|
|
1795
|
-
let elChange = el.toLowerCase();
|
|
1796
|
-
let isChinese = (str) => {
|
|
1797
|
-
return /^[\u4e00-\u9fa5]+$/.test(str);
|
|
1798
|
-
};
|
|
1799
|
-
if (isChinese(elChange)) {
|
|
1800
|
-
const resultWithoutTone = pinyin(elChange, { toneType: 'none', type: 'array' });
|
|
1801
|
-
elChange = resultWithoutTone.toString();
|
|
1802
|
-
if (index < array.length - 1)
|
|
1803
|
-
elChange += '-';
|
|
1804
|
-
}
|
|
1805
|
-
;
|
|
1806
|
-
newArray.push(elChange);
|
|
1807
|
-
});
|
|
1808
|
-
let pinyinstr = newArray.join('');
|
|
1809
|
-
return pinyinstr || val;
|
|
1810
|
-
}
|
|
1811
|
-
/**获取图片的本地连接 */
|
|
1812
|
-
getImageLacolBase64Url(file) {
|
|
1813
|
-
return new Promise((resolve, rejects) => {
|
|
1814
|
-
const reader = new FileReader();
|
|
1815
|
-
reader.readAsDataURL(file);
|
|
1816
|
-
reader.onload = (e) => {
|
|
1817
|
-
resolve(e.target.result);
|
|
1818
|
-
};
|
|
1819
|
-
reader.onerror = error => rejects(error);
|
|
1820
|
-
});
|
|
1821
|
-
}
|
|
1822
|
-
/**
|
|
1823
|
-
* 深拷贝--方法 */
|
|
1824
|
-
deepClone(obj) {
|
|
1825
|
-
if (typeof obj !== 'object' || obj === null)
|
|
1826
|
-
return obj;
|
|
1827
|
-
const result = Array.isArray(obj) ? [] : {};
|
|
1828
|
-
for (let key in obj) {
|
|
1829
|
-
if (obj.hasOwnProperty(key)) {
|
|
1830
|
-
if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
1831
|
-
if (obj[key] instanceof Date) {
|
|
1832
|
-
result[key] = new Date(obj[key].getTime());
|
|
1833
|
-
}
|
|
1834
|
-
else if (obj[key] instanceof RegExp) {
|
|
1835
|
-
result[key] = new RegExp(obj[key]);
|
|
1836
|
-
}
|
|
1837
|
-
else {
|
|
1838
|
-
result[key] = this.deepClone(obj[key]);
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
else {
|
|
1842
|
-
result[key] = obj[key];
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
return result;
|
|
1847
|
-
}
|
|
1848
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1849
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, providedIn: 'root' });
|
|
1850
|
-
}
|
|
1851
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, decorators: [{
|
|
1852
|
-
type: Injectable,
|
|
1853
|
-
args: [{
|
|
1854
|
-
providedIn: 'root'
|
|
1855
|
-
}]
|
|
1856
|
-
}], ctorParameters: function () { return []; } });
|
|
1857
|
-
|
|
1858
1917
|
/*
|
|
1859
1918
|
* Public API Surface of dynamic-form
|
|
1860
1919
|
*/
|