ngx-rs-ant 0.4.0 → 0.4.2
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/box-container/PluginManager.d.ts +1 -1
- package/box-container/box-container.component.d.ts +2 -3
- package/box-container/box-item/box-item.component.d.ts +1 -1
- package/esm2020/box-container/PluginManager.mjs +3 -9
- package/esm2020/box-container/box-container.component.mjs +4 -4
- package/esm2020/box-container/box-item/box-item.component.mjs +3 -3
- package/esm2020/box-container/plugin-active/plugin-active.component.mjs +3 -3
- package/esm2020/data-grid/data-grid.component.mjs +19 -1
- package/esm2020/form/form.component.mjs +31 -19
- package/fesm2015/ngx-rs-ant.mjs +54 -32
- package/fesm2015/ngx-rs-ant.mjs.map +1 -1
- package/fesm2020/ngx-rs-ant.mjs +57 -32
- package/fesm2020/ngx-rs-ant.mjs.map +1 -1
- package/form/form.component.d.ts +4 -4
- package/package.json +1 -1
package/fesm2015/ngx-rs-ant.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { CommonModule } from '@angular/common';
|
|
|
6
6
|
import { Subject, lastValueFrom } from 'rxjs';
|
|
7
7
|
import * as i2 from 'ng-devui/input-number';
|
|
8
8
|
import * as i3 from '@angular/forms';
|
|
9
|
-
import {
|
|
9
|
+
import { FormsModule, UntypedFormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
10
10
|
import * as i1$1 from 'ng-devui/dragdrop';
|
|
11
11
|
import { DevUIModule, FormLayout } from 'ng-devui';
|
|
12
12
|
import CustomStore from 'devextreme/data/custom_store';
|
|
@@ -138,10 +138,10 @@ class PluginActiveComponent {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
PluginActiveComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PluginActiveComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
141
|
-
PluginActiveComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: PluginActiveComponent, selector: "rs-plugin-active", host: { properties: { "style": "this._style" } }, ngImport: i0, template: "<div class=\"active-bar\">\r\n <span>{{name}}</span>\r\n <i *ngIf=\"showClose\" class=\"icon-close\" (click)=\"onItemCloseIconClick($event)\"></i>\r\n</div>\r\n<rs-divider *ngIf=\"showDivider\" [targetElement]=\"targetElement\" direction=\"row\"\r\n
|
|
141
|
+
PluginActiveComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: PluginActiveComponent, selector: "rs-plugin-active", host: { properties: { "style": "this._style" } }, ngImport: i0, template: "<div class=\"active-bar\">\r\n <span>{{name}}</span>\r\n <i *ngIf=\"showClose\" class=\"icon-close\" (click)=\"onItemCloseIconClick($event)\"></i>\r\n</div>\r\n<rs-divider *ngIf=\"showDivider\" [targetElement]=\"targetElement\" direction=\"row\"\r\n (dividerClick)=\"splitItem('column')\"></rs-divider>\r\n<rs-divider *ngIf=\"showDivider\" [targetElement]=\"targetElement\" direction=\"column\"\r\n (dividerClick)=\"splitItem('row')\"></rs-divider>\r\n", styles: [":host{display:none;position:absolute;border:1px solid var(--devui-brand, #5e7ce0);pointer-events:none}:host .active-bar{padding:2px 4px;color:#fff;background-color:var(--devui-brand, #5e7ce0);position:absolute;top:-23px;right:-1px;display:flex;align-items:center;pointer-events:all;white-space:nowrap}:host .active-bar span{flex:auto}:host .active-bar i{flex:none;margin-left:8px;cursor:pointer}:host .active-bar i:hover{color:var(--devui-danger, #f66f6a)}.plugin-active>:host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: DividerComponent, selector: "rs-divider", inputs: ["direction", "targetElement"], outputs: ["dividerClick"] }] });
|
|
142
142
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PluginActiveComponent, decorators: [{
|
|
143
143
|
type: Component,
|
|
144
|
-
args: [{ selector: 'rs-plugin-active', template: "<div class=\"active-bar\">\r\n <span>{{name}}</span>\r\n <i *ngIf=\"showClose\" class=\"icon-close\" (click)=\"onItemCloseIconClick($event)\"></i>\r\n</div>\r\n<rs-divider *ngIf=\"showDivider\" [targetElement]=\"targetElement\" direction=\"row\"\r\n
|
|
144
|
+
args: [{ selector: 'rs-plugin-active', template: "<div class=\"active-bar\">\r\n <span>{{name}}</span>\r\n <i *ngIf=\"showClose\" class=\"icon-close\" (click)=\"onItemCloseIconClick($event)\"></i>\r\n</div>\r\n<rs-divider *ngIf=\"showDivider\" [targetElement]=\"targetElement\" direction=\"row\"\r\n (dividerClick)=\"splitItem('column')\"></rs-divider>\r\n<rs-divider *ngIf=\"showDivider\" [targetElement]=\"targetElement\" direction=\"column\"\r\n (dividerClick)=\"splitItem('row')\"></rs-divider>\r\n", styles: [":host{display:none;position:absolute;border:1px solid var(--devui-brand, #5e7ce0);pointer-events:none}:host .active-bar{padding:2px 4px;color:#fff;background-color:var(--devui-brand, #5e7ce0);position:absolute;top:-23px;right:-1px;display:flex;align-items:center;pointer-events:all;white-space:nowrap}:host .active-bar span{flex:auto}:host .active-bar i{flex:none;margin-left:8px;cursor:pointer}:host .active-bar i:hover{color:var(--devui-danger, #f66f6a)}.plugin-active>:host{display:block}\n"] }]
|
|
145
145
|
}], propDecorators: { _style: [{
|
|
146
146
|
type: HostBinding,
|
|
147
147
|
args: ['style']
|
|
@@ -250,7 +250,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
250
250
|
}] } });
|
|
251
251
|
|
|
252
252
|
class PluginManager {
|
|
253
|
-
static createComponent(boxItem, index, style, config, editMode = false,
|
|
253
|
+
static createComponent(boxItem, index, style, config, editMode = false, formGroup) {
|
|
254
254
|
var _a;
|
|
255
255
|
const plugin = PluginFactory.get(config.name);
|
|
256
256
|
if (!plugin) {
|
|
@@ -263,12 +263,7 @@ class PluginManager {
|
|
|
263
263
|
const instance = componentRef.instance;
|
|
264
264
|
Object.assign(instance, config.pluginConfig);
|
|
265
265
|
if (plugin.category === 'form') {
|
|
266
|
-
|
|
267
|
-
instance.control = new UntypedFormControl('');
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
instance.control = control.get(config.pluginConfig.field);
|
|
271
|
-
}
|
|
266
|
+
instance.formGroup = formGroup;
|
|
272
267
|
}
|
|
273
268
|
if (editMode) {
|
|
274
269
|
instance.onRemove = () => {
|
|
@@ -444,7 +439,7 @@ class BoxItemComponent {
|
|
|
444
439
|
const item = this.config.list[i];
|
|
445
440
|
switch (item.type) {
|
|
446
441
|
case 'plugin':
|
|
447
|
-
PluginManager.createComponent(this, i, item.style, item.config, this.editMode, this.
|
|
442
|
+
PluginManager.createComponent(this, i, item.style, item.config, this.editMode, this.formGroup);
|
|
448
443
|
break;
|
|
449
444
|
case 'item':
|
|
450
445
|
const boxItemComponentRef = itemHost.viewContainerRef.createComponent(BoxItemComponent);
|
|
@@ -452,7 +447,7 @@ class BoxItemComponent {
|
|
|
452
447
|
instance.editMode = this.editMode;
|
|
453
448
|
instance.style = item.style;
|
|
454
449
|
instance.config = item.config;
|
|
455
|
-
instance.
|
|
450
|
+
instance.formGroup = this.formGroup;
|
|
456
451
|
instance.pDirection = this.config.direction;
|
|
457
452
|
if (this.editMode) {
|
|
458
453
|
instance.leaveOneItem.subscribe((item) => {
|
|
@@ -593,7 +588,7 @@ class BoxContainerComponent {
|
|
|
593
588
|
const instance = boxItemComponentRef.instance;
|
|
594
589
|
instance.editMode = this.editMode;
|
|
595
590
|
instance.config = this.config;
|
|
596
|
-
instance.
|
|
591
|
+
instance.formGroup = this.formGroup;
|
|
597
592
|
(_a = instance.leaveOneItem) === null || _a === void 0 ? void 0 : _a.subscribe((item) => {
|
|
598
593
|
if (item.type === 'item') {
|
|
599
594
|
Object.assign(instance.config, item);
|
|
@@ -606,7 +601,7 @@ class BoxContainerComponent {
|
|
|
606
601
|
}
|
|
607
602
|
}
|
|
608
603
|
BoxContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
609
|
-
BoxContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BoxContainerComponent, selector: "rs-box-container", inputs: { editMode: "editMode", config: "config",
|
|
604
|
+
BoxContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BoxContainerComponent, selector: "rs-box-container", inputs: { editMode: "editMode", config: "config", formGroup: "formGroup" }, viewQueries: [{ propertyName: "boxContainerContent", first: true, predicate: ["boxContainerContent"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #boxContainerContent></ng-container>\n", styles: [":host{flex:auto;position:relative;display:flex;overflow:auto}\n"] });
|
|
610
605
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerComponent, decorators: [{
|
|
611
606
|
type: Component,
|
|
612
607
|
args: [{ selector: 'rs-box-container', template: "<ng-container #boxContainerContent></ng-container>\n", styles: [":host{flex:auto;position:relative;display:flex;overflow:auto}\n"] }]
|
|
@@ -614,7 +609,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
614
609
|
type: Input
|
|
615
610
|
}], config: [{
|
|
616
611
|
type: Input
|
|
617
|
-
}],
|
|
612
|
+
}], formGroup: [{
|
|
618
613
|
type: Input
|
|
619
614
|
}], boxContainerContent: [{
|
|
620
615
|
type: ViewChild,
|
|
@@ -729,6 +724,24 @@ class DataGridComponent {
|
|
|
729
724
|
format: this.typeMap[column.dataType].format
|
|
730
725
|
});
|
|
731
726
|
}
|
|
727
|
+
else if (column.type === 'FILE') {
|
|
728
|
+
this.columns.push({
|
|
729
|
+
dataField: column.name,
|
|
730
|
+
caption: column.caption,
|
|
731
|
+
dataType: 'string',
|
|
732
|
+
alignment: 'left',
|
|
733
|
+
filterOperations: []
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
else if (column.type === 'RELATION') {
|
|
737
|
+
this.columns.push({
|
|
738
|
+
dataField: column.name,
|
|
739
|
+
caption: column.caption,
|
|
740
|
+
dataType: 'string',
|
|
741
|
+
alignment: 'left',
|
|
742
|
+
filterOperations: ['=']
|
|
743
|
+
});
|
|
744
|
+
}
|
|
732
745
|
}
|
|
733
746
|
});
|
|
734
747
|
this.dataSource = new CustomStore({
|
|
@@ -828,37 +841,46 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
828
841
|
class FormComponent {
|
|
829
842
|
constructor() {
|
|
830
843
|
this.layoutDirection = FormLayout.Vertical;
|
|
831
|
-
this.model = {};
|
|
832
|
-
this.items = [];
|
|
833
844
|
this.formGroup = new UntypedFormGroup({});
|
|
834
|
-
this.
|
|
845
|
+
this.submitCallback = new EventEmitter();
|
|
835
846
|
}
|
|
836
847
|
ngOnInit() {
|
|
837
|
-
this.
|
|
838
|
-
this.
|
|
839
|
-
});
|
|
840
|
-
this.service.getMetadataByTemplate(this.tenant, this.className, this.template || 'Test').subscribe((response) => {
|
|
841
|
-
this.config = JSON.parse(response.data.template);
|
|
842
|
-
this.items = ["modifier", "createTime", "modifyTime", "creator", "number"];
|
|
843
|
-
for (let item of this.items) {
|
|
844
|
-
this.formGroup.addControl(item, new UntypedFormControl(this.model[item]));
|
|
845
|
-
}
|
|
848
|
+
this.service.getMetadataByTemplate(this.tenant, this.className, this.template).subscribe((response) => {
|
|
849
|
+
this.config = response.data.template;
|
|
846
850
|
});
|
|
851
|
+
if (this.copyOid || this.oid) {
|
|
852
|
+
const attributes = encodeURIComponent(Object.keys(this.formGroup.controls).join(';'));
|
|
853
|
+
this.service.getOne(this.tenant, this.className, this.copyOid || this.oid, attributes).subscribe((response) => {
|
|
854
|
+
if (this.copyOid) {
|
|
855
|
+
delete response.data.oid;
|
|
856
|
+
}
|
|
857
|
+
this.formGroup.patchValue(response.data);
|
|
858
|
+
});
|
|
859
|
+
}
|
|
847
860
|
}
|
|
848
861
|
submit($event) {
|
|
849
|
-
|
|
850
|
-
|
|
862
|
+
if (!$event.valid) {
|
|
863
|
+
this.submitCallback.emit();
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
this.service.createOrUpdate(this.tenant, this.className, Object.assign({ oid: this.oid }, this.formGroup.value)).subscribe((response) => {
|
|
867
|
+
this.submitCallback.emit(response);
|
|
868
|
+
});
|
|
851
869
|
}
|
|
852
870
|
}
|
|
853
871
|
FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
854
|
-
FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: FormComponent, selector: "rs-form", inputs: { tenant: "tenant", className: "className", template: "template", service: "service" }, outputs: {
|
|
872
|
+
FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: FormComponent, selector: "rs-form", inputs: { tenant: "tenant", className: "className", oid: "oid", copyOid: "copyOid", template: "template", service: "service" }, outputs: { submitCallback: "submitCallback" }, viewQueries: [{ propertyName: "formSubmitter", first: true, predicate: ["formSubmitter"], descendants: true }], ngImport: i0, template: "<form dForm [formGroup]=\"formGroup\" [layout]=\"layoutDirection\" (dSubmit)=\"submit($event)\">\n <ng-container *ngIf=\"config\">\n <rs-box-container [config]=\"config\" [formGroup]=\"formGroup\"></rs-box-container>\n </ng-container>\n <button #formSubmitter dFormSubmit=\"click\"></button>\n</form>\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$2.FormDirective, selector: "[dForm]", inputs: ["layout", "labelSize", "labelAlign", "dFeedbackType", "dHasFeedback"], outputs: ["dSubmit"], exportAs: ["dForm"] }, { kind: "directive", type: i2$2.DFormSubmitDirective, selector: "[dFormSubmit]", inputs: ["dFormSubmit", "dFormSubmitData"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: BoxContainerComponent, selector: "rs-box-container", inputs: ["editMode", "config", "formGroup"] }] });
|
|
855
873
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormComponent, decorators: [{
|
|
856
874
|
type: Component,
|
|
857
|
-
args: [{ selector: 'rs-form', template: "<form dForm [formGroup]=\"formGroup\" [layout]=\"layoutDirection\" (dSubmit)=\"submit($event)\">\n <ng-container *ngIf=\"config
|
|
875
|
+
args: [{ selector: 'rs-form', template: "<form dForm [formGroup]=\"formGroup\" [layout]=\"layoutDirection\" (dSubmit)=\"submit($event)\">\n <ng-container *ngIf=\"config\">\n <rs-box-container [config]=\"config\" [formGroup]=\"formGroup\"></rs-box-container>\n </ng-container>\n <button #formSubmitter dFormSubmit=\"click\"></button>\n</form>\n" }]
|
|
858
876
|
}], propDecorators: { tenant: [{
|
|
859
877
|
type: Input
|
|
860
878
|
}], className: [{
|
|
861
879
|
type: Input
|
|
880
|
+
}], oid: [{
|
|
881
|
+
type: Input
|
|
882
|
+
}], copyOid: [{
|
|
883
|
+
type: Input
|
|
862
884
|
}], template: [{
|
|
863
885
|
type: Input
|
|
864
886
|
}], service: [{
|
|
@@ -866,7 +888,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImpor
|
|
|
866
888
|
}], formSubmitter: [{
|
|
867
889
|
type: ViewChild,
|
|
868
890
|
args: ['formSubmitter']
|
|
869
|
-
}],
|
|
891
|
+
}], submitCallback: [{
|
|
870
892
|
type: Output
|
|
871
893
|
}] } });
|
|
872
894
|
|