ngx-rs-ant 0.2.3 → 0.3.9
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 +15 -0
- package/box-container/box-container.component.d.ts +12 -0
- package/box-container/box-container.module.d.ts +21 -0
- package/box-container/box-item/box-item-host.directive.d.ts +10 -0
- package/box-container/box-item/box-item.component.d.ts +36 -0
- package/box-container/box-item/item-blank/item-blank.component.d.ts +8 -0
- package/box-container/box-item/item-config/item-config.component.d.ts +8 -0
- package/box-container/box-item/item-style/item-style.component.d.ts +10 -0
- package/box-container/box-item/item-style/style/style.component.d.ts +12 -0
- package/box-container/box-item/item-style/style-blank/style-blank.component.d.ts +5 -0
- package/box-container/plugin-active/divider/divider-line/divider-line.component.d.ts +12 -0
- package/box-container/plugin-active/divider/divider.component.d.ts +23 -0
- package/box-container/plugin-active/plugin-active.component.d.ts +31 -0
- package/box-container/plugin-hover/plugin-hover.component.d.ts +18 -0
- package/data-grid/data-grid.component.d.ts +7 -4
- package/esm2020/box-container/PluginManager.mjs +103 -0
- package/esm2020/box-container/box-container.component.mjs +44 -0
- package/esm2020/box-container/box-container.module.mjs +69 -0
- package/esm2020/box-container/box-item/box-item-host.directive.mjs +20 -0
- package/esm2020/box-container/box-item/box-item.component.mjs +169 -0
- package/esm2020/box-container/box-item/item-blank/item-blank.component.mjs +20 -0
- package/esm2020/box-container/box-item/item-config/item-config.component.mjs +35 -0
- package/esm2020/box-container/box-item/item-style/item-style.component.mjs +35 -0
- package/esm2020/box-container/box-item/item-style/style/style.component.mjs +44 -0
- package/esm2020/box-container/box-item/item-style/style-blank/style-blank.component.mjs +11 -0
- package/esm2020/box-container/plugin-active/divider/divider-line/divider-line.component.mjs +35 -0
- package/esm2020/box-container/plugin-active/divider/divider.component.mjs +50 -0
- package/esm2020/box-container/plugin-active/plugin-active.component.mjs +55 -0
- package/esm2020/box-container/plugin-hover/plugin-hover.component.mjs +26 -0
- package/esm2020/data-grid/data-grid.component.mjs +16 -9
- package/esm2020/data-grid/data-grid.module.mjs +4 -4
- package/esm2020/form/form.component.mjs +53 -0
- package/esm2020/form/form.module.mjs +39 -0
- package/esm2020/modal/modal.component.mjs +5 -5
- package/esm2020/modal/modal.module.mjs +8 -6
- package/esm2020/modal/modal.service.mjs +3 -3
- package/esm2020/public-api.mjs +11 -3
- package/fesm2015/ngx-rs-ant.mjs +902 -152
- package/fesm2015/ngx-rs-ant.mjs.map +1 -1
- package/fesm2020/ngx-rs-ant.mjs +894 -152
- package/fesm2020/ngx-rs-ant.mjs.map +1 -1
- package/form/form.component.d.ts +21 -0
- package/form/form.module.d.ts +11 -0
- package/modal/modal.component.d.ts +1 -1
- package/modal/modal.module.d.ts +1 -1
- package/package.json +4 -3
- package/public-api.d.ts +10 -2
package/fesm2020/ngx-rs-ant.mjs
CHANGED
|
@@ -1,188 +1,668 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Input,
|
|
2
|
+
import { Component, Input, HostBinding, EventEmitter, Output, HostListener, ViewContainerRef, ViewChild, Directive, ViewChildren, NgModule, Injectable } from '@angular/core';
|
|
3
|
+
import { PluginFactory } from 'coast-plugin-register';
|
|
3
4
|
import * as i1 from '@angular/common';
|
|
4
5
|
import { CommonModule } from '@angular/common';
|
|
6
|
+
import { Subject, lastValueFrom } from 'rxjs';
|
|
7
|
+
import * as i2 from 'ng-devui/input-number';
|
|
8
|
+
import * as i3 from '@angular/forms';
|
|
9
|
+
import { UntypedFormControl, FormsModule, UntypedFormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
10
|
+
import * as i1$1 from 'ng-devui/dragdrop';
|
|
11
|
+
import { DevUIModule, FormLayout } from 'ng-devui';
|
|
5
12
|
import CustomStore from 'devextreme/data/custom_store';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import * as
|
|
10
|
-
import * as
|
|
13
|
+
import * as i1$2 from 'devextreme-angular';
|
|
14
|
+
import { DxDataGridComponent, DxDataGridModule } from 'devextreme-angular';
|
|
15
|
+
import * as i2$1 from 'devextreme-angular/ui/nested';
|
|
16
|
+
import * as i3$1 from 'devextreme-angular/core';
|
|
17
|
+
import * as i2$2 from 'ng-devui/form';
|
|
11
18
|
|
|
12
|
-
class
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
|
|
16
|
-
this._width = 480;
|
|
17
|
-
this.movable = false;
|
|
18
|
-
this.topStart = 0;
|
|
19
|
-
this.leftStart = 0;
|
|
20
|
-
}
|
|
21
|
-
ngOnInit() {
|
|
22
|
-
if (this.size === 'full') {
|
|
23
|
-
this.modalElementRef.nativeElement.style.top = '0px';
|
|
24
|
-
this.modalElementRef.nativeElement.style.right = '0px';
|
|
25
|
-
this.modalElementRef.nativeElement.style.bottom = '0px';
|
|
26
|
-
this.modalElementRef.nativeElement.style.left = '0px';
|
|
27
|
-
this.modalElementRef.nativeElement.style.margin = '2px';
|
|
28
|
-
this.modalElementRef.nativeElement.style.boxShadow = 'none';
|
|
19
|
+
class DividerLineComponent {
|
|
20
|
+
get _style() {
|
|
21
|
+
if (!this.targetElement) {
|
|
22
|
+
return {};
|
|
29
23
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.modalElementRef.nativeElement.style.top = '40px';
|
|
36
|
-
this.modalElementRef.nativeElement.style.left =
|
|
37
|
-
(this.elementRef.nativeElement.parentElement.offsetWidth - this.modalElementRef.nativeElement.offsetWidth) / 2 + 'px';
|
|
38
|
-
this.moveHandleEl = this.elementRef.nativeElement.querySelector('.modal-header');
|
|
39
|
-
this.moveHandleEl.style.cursor = 'move';
|
|
24
|
+
const elementRect = this.targetElement.getBoundingClientRect();
|
|
25
|
+
if (this.direction === 'row') {
|
|
26
|
+
return {
|
|
27
|
+
height: elementRect.width + 'px'
|
|
28
|
+
};
|
|
40
29
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const nodeName = this.elementRef.nativeElement.nodeName;
|
|
46
|
-
const modals = parentElement.querySelectorAll(nodeName);
|
|
47
|
-
for (let i = 0; i < modals.length; i++) {
|
|
48
|
-
if (i === modals.length - 1) {
|
|
49
|
-
modals[i].querySelector('.modal-backdrop').style.backgroundColor = 'rgba(37, 43, 58, 0.05)';
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
modals[i].querySelector('.modal-backdrop').style.backgroundColor = 'rgba(37, 43, 58, 0)';
|
|
53
|
-
}
|
|
30
|
+
if (this.direction === 'column') {
|
|
31
|
+
return {
|
|
32
|
+
height: elementRect.height + 'px'
|
|
33
|
+
};
|
|
54
34
|
}
|
|
35
|
+
return {};
|
|
55
36
|
}
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
}
|
|
38
|
+
DividerLineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DividerLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
39
|
+
DividerLineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: DividerLineComponent, selector: "rs-divider-line", inputs: { direction: "direction", targetElement: "targetElement" }, host: { properties: { "style": "this._style" } }, ngImport: i0, template: "", styles: ["coast-divider:hover>:host{position:absolute;top:-5px;border:1px dashed var(--devui-brand, #5e7ce0)}\n"] });
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DividerLineComponent, decorators: [{
|
|
41
|
+
type: Component,
|
|
42
|
+
args: [{ selector: 'rs-divider-line', template: "", styles: ["coast-divider:hover>:host{position:absolute;top:-5px;border:1px dashed var(--devui-brand, #5e7ce0)}\n"] }]
|
|
43
|
+
}], propDecorators: { direction: [{
|
|
44
|
+
type: Input
|
|
45
|
+
}], targetElement: [{
|
|
46
|
+
type: Input
|
|
47
|
+
}], _style: [{
|
|
48
|
+
type: HostBinding,
|
|
49
|
+
args: ['style']
|
|
50
|
+
}] } });
|
|
51
|
+
|
|
52
|
+
class DividerComponent {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.dividerClick = new EventEmitter();
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
|
|
56
|
+
get _style() {
|
|
57
|
+
if (!this.targetElement) {
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
const elementRect = this.targetElement.getBoundingClientRect();
|
|
61
|
+
if (this.direction === 'row') {
|
|
62
|
+
return {
|
|
63
|
+
top: elementRect.height / 2 - 12 + 'px',
|
|
64
|
+
left: '4px',
|
|
65
|
+
transform: 'rotate(270deg)'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (this.direction === 'column') {
|
|
69
|
+
return {
|
|
70
|
+
top: '4px',
|
|
71
|
+
left: elementRect.width / 2 - 12 + 'px'
|
|
72
|
+
};
|
|
66
73
|
}
|
|
74
|
+
return {};
|
|
67
75
|
}
|
|
68
|
-
|
|
76
|
+
onClick() {
|
|
77
|
+
this.dividerClick.emit();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
DividerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
81
|
+
DividerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: DividerComponent, selector: "rs-divider", inputs: { direction: "direction", targetElement: "targetElement" }, outputs: { dividerClick: "dividerClick" }, host: { listeners: { "click": "onClick()" }, properties: { "style": "this._style" } }, ngImport: i0, template: "<div class=\"divider-image\"></div>\n<rs-divider-line [targetElement]=\"targetElement\" [direction]=\"direction\"></rs-divider-line>\n", styles: [":host{position:absolute;display:flex;justify-content:center;align-items:center;width:24px;height:24px;background-color:#fff;border-radius:12px;cursor:pointer;pointer-events:all}:host .divider-image{width:12px;height:12px;background-size:contain;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAGKADAAQAAAABAAAAGAAAAADiNXWtAAACO0lEQVRIDa2Uy6tNURzHN7cwMUAmHncot0QeV5QiBgZKmWEgzDDx+ANu5soMcUkxIY+iEFIKEZnIyMC9GZAMrke6hXt9Pvus1VnntPbZ53B/9dnrt36P7zpr7bVPUTRtD+5j+Arv4QwshDpbTIG1o2CvGmq12CVmk/ADnsGnMHccgCpbRiLWjuA/BTXUUrM0VzNwD+aVkcbjIMNveJnEUrePyWuYgP1JYi6+WmqWO3FLrpqKMy3tHE8LtzemLc99ITfcEm1MXERNtYsxcGs520nQBV61JWcyHw253W25OFVzbDqPj1D1MheF6tWM24LvcAD6w7yqdwF5tYvT4K90y6m5zQ/wE37BC9Bmw2f4Ah6DNdamFo/vlEHP3pvwB87CLjgGNrrwEbgY/K2MQ8E/zHg0+NbaY68aaqmpdmlLeT4HBSPf8RXQloA3ylvzDTx/34OmsLWxz9Hdqtlivo/l4NXy1syB1C4ziSK547THXjXU6tk20uECnn1fz91dNJynJu5gUxf1PZV4nr6DdzABj2BK7Rpq/votcDX4GxinxNagovjDoOZLdBcPwvy/h/souMDaROlGiK1PYv/kbg5C19u6V4b43bZ4z1M/GF/uQKbzFjF3NpjJdRXaEQQuVFQr7AK3K/Idw36Jb2Ec+jtU3iHnIqs61GRTe4naeDKbbQbXhbqbzVC9N4OSEfAPbD7UmbfMa7uirjDmD+H464/HQM3oB2f9lVxd7l9vFoVv4ESuIRN7QkzxaZlc8RcdnI7tMHZBlAAAAABJRU5ErkJggg==)}:host:hover{background-color:var(--devui-brand, #5e7ce0)}\n"], dependencies: [{ kind: "component", type: DividerLineComponent, selector: "rs-divider-line", inputs: ["direction", "targetElement"] }] });
|
|
82
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DividerComponent, decorators: [{
|
|
83
|
+
type: Component,
|
|
84
|
+
args: [{ selector: 'rs-divider', template: "<div class=\"divider-image\"></div>\n<rs-divider-line [targetElement]=\"targetElement\" [direction]=\"direction\"></rs-divider-line>\n", styles: [":host{position:absolute;display:flex;justify-content:center;align-items:center;width:24px;height:24px;background-color:#fff;border-radius:12px;cursor:pointer;pointer-events:all}:host .divider-image{width:12px;height:12px;background-size:contain;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAGKADAAQAAAABAAAAGAAAAADiNXWtAAACO0lEQVRIDa2Uy6tNURzHN7cwMUAmHncot0QeV5QiBgZKmWEgzDDx+ANu5soMcUkxIY+iEFIKEZnIyMC9GZAMrke6hXt9Pvus1VnntPbZ53B/9dnrt36P7zpr7bVPUTRtD+5j+Arv4QwshDpbTIG1o2CvGmq12CVmk/ADnsGnMHccgCpbRiLWjuA/BTXUUrM0VzNwD+aVkcbjIMNveJnEUrePyWuYgP1JYi6+WmqWO3FLrpqKMy3tHE8LtzemLc99ITfcEm1MXERNtYsxcGs520nQBV61JWcyHw253W25OFVzbDqPj1D1MheF6tWM24LvcAD6w7yqdwF5tYvT4K90y6m5zQ/wE37BC9Bmw2f4Ah6DNdamFo/vlEHP3pvwB87CLjgGNrrwEbgY/K2MQ8E/zHg0+NbaY68aaqmpdmlLeT4HBSPf8RXQloA3ylvzDTx/34OmsLWxz9Hdqtlivo/l4NXy1syB1C4ziSK547THXjXU6tk20uECnn1fz91dNJynJu5gUxf1PZV4nr6DdzABj2BK7Rpq/votcDX4GxinxNagovjDoOZLdBcPwvy/h/souMDaROlGiK1PYv/kbg5C19u6V4b43bZ4z1M/GF/uQKbzFjF3NpjJdRXaEQQuVFQr7AK3K/Idw36Jb2Ec+jtU3iHnIqs61GRTe4naeDKbbQbXhbqbzVC9N4OSEfAPbD7UmbfMa7uirjDmD+H464/HQM3oB2f9lVxd7l9vFoVv4ESuIRN7QkzxaZlc8RcdnI7tMHZBlAAAAABJRU5ErkJggg==)}:host:hover{background-color:var(--devui-brand, #5e7ce0)}\n"] }]
|
|
85
|
+
}], propDecorators: { direction: [{
|
|
86
|
+
type: Input
|
|
87
|
+
}], targetElement: [{
|
|
88
|
+
type: Input
|
|
89
|
+
}], dividerClick: [{
|
|
90
|
+
type: Output
|
|
91
|
+
}], _style: [{
|
|
92
|
+
type: HostBinding,
|
|
93
|
+
args: ['style']
|
|
94
|
+
}], onClick: [{
|
|
95
|
+
type: HostListener,
|
|
96
|
+
args: ['click']
|
|
97
|
+
}] } });
|
|
98
|
+
|
|
99
|
+
class PluginActiveComponent {
|
|
100
|
+
constructor() {
|
|
101
|
+
this.showClose = true;
|
|
102
|
+
this.showDivider = false;
|
|
103
|
+
this.itemRemove = new EventEmitter();
|
|
104
|
+
this.targetRect = {
|
|
105
|
+
width: 0,
|
|
106
|
+
height: 0
|
|
107
|
+
};
|
|
108
|
+
this._targetRect = {};
|
|
109
|
+
this.width = 0;
|
|
110
|
+
this._width = 0;
|
|
111
|
+
this.height = 0;
|
|
112
|
+
this._height = 0;
|
|
113
|
+
}
|
|
114
|
+
get _style() {
|
|
115
|
+
if (!this.targetElement) {
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
const elementRect = this.targetElement.getBoundingClientRect();
|
|
119
|
+
this._targetRect.width = elementRect.width;
|
|
120
|
+
this._targetRect.height = elementRect.height;
|
|
69
121
|
return {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
122
|
+
width: elementRect.width + 'px',
|
|
123
|
+
height: elementRect.height + 'px',
|
|
124
|
+
top: this.targetElement.offsetTop + 'px',
|
|
125
|
+
left: this.targetElement.offsetLeft + 'px'
|
|
74
126
|
};
|
|
75
127
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
128
|
+
ngOnInit() {
|
|
129
|
+
setTimeout(() => {
|
|
130
|
+
this.targetRect = this._targetRect;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
onItemCloseIconClick($event) {
|
|
134
|
+
this.itemRemove.emit();
|
|
135
|
+
}
|
|
136
|
+
splitItem(direction) {
|
|
137
|
+
// 在布局型组件中实例化时重写
|
|
138
|
+
}
|
|
139
|
+
}
|
|
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 (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
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PluginActiveComponent, decorators: [{
|
|
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 (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
|
+
}], propDecorators: { _style: [{
|
|
146
|
+
type: HostBinding,
|
|
147
|
+
args: ['style']
|
|
148
|
+
}] } });
|
|
149
|
+
|
|
150
|
+
class PluginHoverComponent {
|
|
151
|
+
get _style() {
|
|
152
|
+
if (!this.targetElement) {
|
|
153
|
+
return {};
|
|
79
154
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
155
|
+
const elementRect = this.targetElement.getBoundingClientRect();
|
|
156
|
+
return {
|
|
157
|
+
width: elementRect.width + 'px',
|
|
158
|
+
height: elementRect.height + 'px',
|
|
159
|
+
top: this.targetElement.offsetTop + 'px',
|
|
160
|
+
left: this.targetElement.offsetLeft + 'px'
|
|
161
|
+
};
|
|
83
162
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
163
|
+
}
|
|
164
|
+
PluginHoverComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PluginHoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
165
|
+
PluginHoverComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: PluginHoverComponent, selector: "rs-plugin-hover", host: { properties: { "style": "this._style" } }, ngImport: i0, template: "<div class=\"hover-title\">{{name}}</div>\n", styles: [":host{display:none;position:absolute;border:1px dashed var(--devui-brand, #5e7ce0);pointer-events:none}:host .hover-title{color:var(--devui-brand, #5e7ce0);position:absolute;top:-18px;left:0}.plugin-active>:host{display:none!important}.plugin-hover>:host{display:block}\n"] });
|
|
166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: PluginHoverComponent, decorators: [{
|
|
167
|
+
type: Component,
|
|
168
|
+
args: [{ selector: 'rs-plugin-hover', template: "<div class=\"hover-title\">{{name}}</div>\n", styles: [":host{display:none;position:absolute;border:1px dashed var(--devui-brand, #5e7ce0);pointer-events:none}:host .hover-title{color:var(--devui-brand, #5e7ce0);position:absolute;top:-18px;left:0}.plugin-active>:host{display:none!important}.plugin-hover>:host{display:block}\n"] }]
|
|
169
|
+
}], propDecorators: { _style: [{
|
|
170
|
+
type: HostBinding,
|
|
171
|
+
args: ['style']
|
|
172
|
+
}] } });
|
|
173
|
+
|
|
174
|
+
class StyleBlankComponent {
|
|
175
|
+
}
|
|
176
|
+
StyleBlankComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StyleBlankComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
177
|
+
StyleBlankComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: StyleBlankComponent, selector: "rs-style-blank", ngImport: i0, template: "<div>\n <span>\u8BF7\u5728\u5DE6\u4FA7\u753B\u5E03\u9009\u4E2D\u8282\u70B9</span>\n</div>\n", styles: [":host{height:80px;margin:8px;display:flex;justify-content:center}:host div{flex:auto;display:flex;justify-content:center;align-items:center}:host div span{text-align:center;-webkit-user-select:none;user-select:none}\n"] });
|
|
178
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StyleBlankComponent, decorators: [{
|
|
179
|
+
type: Component,
|
|
180
|
+
args: [{ selector: 'rs-style-blank', template: "<div>\n <span>\u8BF7\u5728\u5DE6\u4FA7\u753B\u5E03\u9009\u4E2D\u8282\u70B9</span>\n</div>\n", styles: [":host{height:80px;margin:8px;display:flex;justify-content:center}:host div{flex:auto;display:flex;justify-content:center;align-items:center}:host div span{text-align:center;-webkit-user-select:none;user-select:none}\n"] }]
|
|
181
|
+
}] });
|
|
182
|
+
|
|
183
|
+
class StyleComponent {
|
|
184
|
+
ngOnInit() {
|
|
185
|
+
this.style.width = this.style.width ? this.style.width : 'auto';
|
|
186
|
+
this.style.height = this.style.height ? this.style.height : 'auto';
|
|
187
|
+
if (this.style.width !== 'auto') {
|
|
188
|
+
this.width = this.style.width.substring(0, this.style.width.length - 2);
|
|
87
189
|
}
|
|
88
|
-
if (
|
|
89
|
-
|
|
190
|
+
if (this.style.height !== 'auto') {
|
|
191
|
+
this.height = this.style.height.substring(0, this.style.height.length - 2);
|
|
90
192
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
193
|
+
}
|
|
194
|
+
select(name, value) {
|
|
195
|
+
const that = this;
|
|
196
|
+
if (value === 'auto') {
|
|
197
|
+
this.style[name] = 'auto';
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
if (!that[name]) {
|
|
201
|
+
that[name] = value;
|
|
96
202
|
}
|
|
203
|
+
this.style[name] = that[name] + 'px';
|
|
97
204
|
}
|
|
98
|
-
return false;
|
|
99
205
|
}
|
|
100
|
-
|
|
101
|
-
|
|
206
|
+
typing(name, value) {
|
|
207
|
+
if (value) {
|
|
208
|
+
this.style[name] = value + 'px';
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.style[name] = 'auto';
|
|
212
|
+
}
|
|
102
213
|
}
|
|
103
|
-
|
|
104
|
-
|
|
214
|
+
}
|
|
215
|
+
StyleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StyleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
216
|
+
StyleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: StyleComponent, selector: "rs-style", ngImport: i0, template: "<div class=\"config-item\">\n <div class=\"item-title\">\u5BBD\u5EA6\u7C7B\u578B</div>\n <div class=\"item-setting\">\n <div class=\"card-style-radio\">\n <div class=\"radio-value\" [ngClass]=\"!style.width || style.width === 'auto' ? 'active' : ''\"\n (click)=\"select('width','auto')\">\n <span>\u81EA\u9002\u5E94</span>\n </div>\n <div class=\"radio-value\" [ngClass]=\"style.width && style.width !== 'auto' ? 'active' : ''\"\n (click)=\"select('width',240)\">\n <span>\u56FA\u5B9A\u503C</span>\n </div>\n </div>\n </div>\n</div>\n<div class=\"config-item\">\n <div class=\"item-title\">\u56FA\u5B9A\u5BBD\u5EA6</div>\n <div class=\"item-setting\">\n <d-input-number [allowEmpty]=\"true\" [(ngModel)]=\"width\"\n (whileValueChanging)=\"typing('width', $event)\"></d-input-number>\n </div>\n</div>\n<div class=\"config-item\">\n <div class=\"item-title\">\u9AD8\u5EA6\u7C7B\u578B</div>\n <div class=\"item-setting\">\n <div class=\"card-style-radio\">\n <div class=\"radio-value\" [ngClass]=\"!style.height || style.height === 'auto' ? 'active' : ''\"\n (click)=\"select('height','auto')\">\n <span>\u81EA\u9002\u5E94</span>\n </div>\n <div class=\"radio-value\" [ngClass]=\"style.height && style.height !== 'auto' ? 'active' : ''\"\n (click)=\"select('height',800)\">\n <span>\u56FA\u5B9A\u503C</span>\n </div>\n </div>\n </div>\n</div>\n<div class=\"config-item\">\n <div class=\"item-title\">\u56FA\u5B9A\u9AD8\u5EA6</div>\n <div class=\"item-setting\">\n <d-input-number [allowEmpty]=\"true\" [(ngModel)]=\"height\"\n (whileValueChanging)=\"typing('height', $event)\"></d-input-number>\n </div>\n</div>\n", styles: [":host .config-item{display:flex;margin:8px;align-items:center}:host .config-item .item-title{flex:0 0 80px}:host .config-item .item-setting{flex:auto;display:flex}:host .config-item .item-setting .card-style-radio{flex:auto;display:flex;justify-content:stretch}:host .config-item .item-setting .card-style-radio .radio-value{flex:auto;border:1px solid var(--devui-dividing-line, #f2f2f3);text-align:center;padding:4px;margin-left:-1px;cursor:pointer}:host .config-item .item-setting .card-style-radio .radio-value span{-webkit-user-select:none;user-select:none}:host .config-item .item-setting .card-style-radio .radio-value.active{color:var(--devui-brand, #5e7ce0);border:1px solid var(--devui-brand, #5e7ce0);z-index:1}:host .config-item .item-setting d-input-number{flex:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: i2.InputNumberComponent, selector: "d-input-number", inputs: ["step", "disabled", "size", "decimalLimit", "autoFocus", "allowEmpty", "placeholder", "maxLength", "reg", "styleType", "min", "max"], outputs: ["afterValueChanged", "whileValueChanging"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: StyleComponent, decorators: [{
|
|
218
|
+
type: Component,
|
|
219
|
+
args: [{ selector: 'rs-style', template: "<div class=\"config-item\">\n <div class=\"item-title\">\u5BBD\u5EA6\u7C7B\u578B</div>\n <div class=\"item-setting\">\n <div class=\"card-style-radio\">\n <div class=\"radio-value\" [ngClass]=\"!style.width || style.width === 'auto' ? 'active' : ''\"\n (click)=\"select('width','auto')\">\n <span>\u81EA\u9002\u5E94</span>\n </div>\n <div class=\"radio-value\" [ngClass]=\"style.width && style.width !== 'auto' ? 'active' : ''\"\n (click)=\"select('width',240)\">\n <span>\u56FA\u5B9A\u503C</span>\n </div>\n </div>\n </div>\n</div>\n<div class=\"config-item\">\n <div class=\"item-title\">\u56FA\u5B9A\u5BBD\u5EA6</div>\n <div class=\"item-setting\">\n <d-input-number [allowEmpty]=\"true\" [(ngModel)]=\"width\"\n (whileValueChanging)=\"typing('width', $event)\"></d-input-number>\n </div>\n</div>\n<div class=\"config-item\">\n <div class=\"item-title\">\u9AD8\u5EA6\u7C7B\u578B</div>\n <div class=\"item-setting\">\n <div class=\"card-style-radio\">\n <div class=\"radio-value\" [ngClass]=\"!style.height || style.height === 'auto' ? 'active' : ''\"\n (click)=\"select('height','auto')\">\n <span>\u81EA\u9002\u5E94</span>\n </div>\n <div class=\"radio-value\" [ngClass]=\"style.height && style.height !== 'auto' ? 'active' : ''\"\n (click)=\"select('height',800)\">\n <span>\u56FA\u5B9A\u503C</span>\n </div>\n </div>\n </div>\n</div>\n<div class=\"config-item\">\n <div class=\"item-title\">\u56FA\u5B9A\u9AD8\u5EA6</div>\n <div class=\"item-setting\">\n <d-input-number [allowEmpty]=\"true\" [(ngModel)]=\"height\"\n (whileValueChanging)=\"typing('height', $event)\"></d-input-number>\n </div>\n</div>\n", styles: [":host .config-item{display:flex;margin:8px;align-items:center}:host .config-item .item-title{flex:0 0 80px}:host .config-item .item-setting{flex:auto;display:flex}:host .config-item .item-setting .card-style-radio{flex:auto;display:flex;justify-content:stretch}:host .config-item .item-setting .card-style-radio .radio-value{flex:auto;border:1px solid var(--devui-dividing-line, #f2f2f3);text-align:center;padding:4px;margin-left:-1px;cursor:pointer}:host .config-item .item-setting .card-style-radio .radio-value span{-webkit-user-select:none;user-select:none}:host .config-item .item-setting .card-style-radio .radio-value.active{color:var(--devui-brand, #5e7ce0);border:1px solid var(--devui-brand, #5e7ce0);z-index:1}:host .config-item .item-setting d-input-number{flex:auto}\n"] }]
|
|
220
|
+
}] });
|
|
221
|
+
|
|
222
|
+
class ItemStyleComponent {
|
|
223
|
+
constructor(changeDetectorRef) {
|
|
224
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
225
|
+
}
|
|
226
|
+
ngOnInit() {
|
|
227
|
+
this.pageStyleContent.createComponent(StyleBlankComponent);
|
|
228
|
+
PluginManager.activeItem.subscribe(item => {
|
|
229
|
+
this.pageStyleContent.clear();
|
|
230
|
+
if (item) {
|
|
231
|
+
const componentRef = this.pageStyleContent.createComponent(StyleComponent);
|
|
232
|
+
const instance = componentRef.instance;
|
|
233
|
+
instance.style = item.style;
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
this.pageStyleContent.createComponent(StyleBlankComponent);
|
|
237
|
+
this.changeDetectorRef.detectChanges();
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
ItemStyleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ItemStyleComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
243
|
+
ItemStyleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ItemStyleComponent, selector: "rs-item-style", viewQueries: [{ propertyName: "pageStyleContent", first: true, predicate: ["pageStyleContent"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #pageStyleContent></ng-container>\n", styles: [""] });
|
|
244
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ItemStyleComponent, decorators: [{
|
|
245
|
+
type: Component,
|
|
246
|
+
args: [{ selector: 'rs-item-style', template: "<ng-container #pageStyleContent></ng-container>\n" }]
|
|
247
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { pageStyleContent: [{
|
|
248
|
+
type: ViewChild,
|
|
249
|
+
args: ['pageStyleContent', { static: true, read: ViewContainerRef }]
|
|
250
|
+
}] } });
|
|
251
|
+
|
|
252
|
+
class PluginManager {
|
|
253
|
+
static createComponent(boxItem, index, style, config, editMode = false, control) {
|
|
254
|
+
const plugin = PluginFactory.get(config.name);
|
|
255
|
+
if (!plugin) {
|
|
256
|
+
console.error('undefined plugin: ' + config.name);
|
|
105
257
|
return;
|
|
106
258
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
259
|
+
const viewContainerRef = boxItem.itemHosts.get(index)?.viewContainerRef;
|
|
260
|
+
viewContainerRef.clear();
|
|
261
|
+
const componentRef = viewContainerRef.createComponent(plugin.component);
|
|
262
|
+
const instance = componentRef.instance;
|
|
263
|
+
Object.assign(instance, config.pluginConfig);
|
|
264
|
+
if (plugin.category === 'form') {
|
|
265
|
+
if (editMode) {
|
|
266
|
+
instance.control = new UntypedFormControl('');
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
instance.control = control.get(config.pluginConfig.field);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
if (editMode) {
|
|
273
|
+
instance.onRemove = () => {
|
|
274
|
+
boxItem.config.list.splice(index, 1, { type: 'blank', style: boxItem.config.list[index].style });
|
|
275
|
+
boxItem.load();
|
|
276
|
+
};
|
|
277
|
+
if (plugin.type === 'default') {
|
|
278
|
+
componentRef.location.nativeElement.style.pointerEvents = 'all';
|
|
279
|
+
for (let child of componentRef.location.nativeElement.children) {
|
|
280
|
+
child.style.pointerEvents = 'none';
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
this.createHoverComponent(viewContainerRef, componentRef, plugin.caption);
|
|
284
|
+
this.createActiveComponent(boxItem, index, componentRef, style, {
|
|
285
|
+
caption: plugin.caption,
|
|
286
|
+
config
|
|
287
|
+
}, true);
|
|
288
|
+
}
|
|
289
|
+
return componentRef;
|
|
290
|
+
}
|
|
291
|
+
static createHoverComponent(viewContainerRef, componentRef, caption) {
|
|
292
|
+
const hoverComponentRef = viewContainerRef.createComponent(PluginHoverComponent);
|
|
293
|
+
hoverComponentRef.instance.name = caption;
|
|
294
|
+
hoverComponentRef.instance.targetElement = componentRef.location.nativeElement;
|
|
295
|
+
const hoverElement = hoverComponentRef.location.nativeElement;
|
|
296
|
+
componentRef.location.nativeElement.appendChild(hoverElement);
|
|
297
|
+
this.hoverItems.push(componentRef.location.nativeElement);
|
|
298
|
+
componentRef.location.nativeElement.addEventListener('mouseenter', ($event) => {
|
|
299
|
+
for (let hoverItem of this.hoverItems) {
|
|
300
|
+
hoverItem.classList.remove('plugin-hover');
|
|
301
|
+
}
|
|
302
|
+
$event.target.classList.add('plugin-hover');
|
|
303
|
+
});
|
|
304
|
+
componentRef.location.nativeElement.addEventListener('mouseleave', ($event) => {
|
|
305
|
+
$event.target.classList.remove('plugin-hover');
|
|
306
|
+
$event.target.parentElement.parentElement.classList.add('plugin-hover');
|
|
307
|
+
});
|
|
308
|
+
return hoverComponentRef;
|
|
309
|
+
}
|
|
310
|
+
static createActiveComponent(boxItem, index, componentRef, style, config, showClose) {
|
|
311
|
+
const viewContainerRef = boxItem.itemHosts.get(index)?.viewContainerRef;
|
|
312
|
+
const activeComponentRef = viewContainerRef.createComponent(PluginActiveComponent);
|
|
313
|
+
activeComponentRef.instance.name = config.caption;
|
|
314
|
+
activeComponentRef.instance.showClose = showClose;
|
|
315
|
+
activeComponentRef.instance.targetElement = componentRef.location.nativeElement;
|
|
316
|
+
const activeElement = activeComponentRef.location.nativeElement;
|
|
317
|
+
componentRef.location.nativeElement.appendChild(activeElement);
|
|
318
|
+
this.activeItems.push(componentRef.location.nativeElement);
|
|
319
|
+
componentRef.location.nativeElement.addEventListener('click', ($event) => {
|
|
320
|
+
$event.stopPropagation();
|
|
321
|
+
for (let activeItem of this.activeItems) {
|
|
322
|
+
activeItem.classList.remove('plugin-active');
|
|
323
|
+
}
|
|
324
|
+
if (this.activeItems.indexOf($event.target) < 0) {
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
this.activeItem.next({ boxItem, index, style, config: config.config });
|
|
328
|
+
$event.target.classList.add('plugin-active');
|
|
329
|
+
});
|
|
330
|
+
activeComponentRef.instance.itemRemove.subscribe(() => {
|
|
331
|
+
this.activeItem.next('');
|
|
332
|
+
viewContainerRef.clear();
|
|
333
|
+
componentRef.instance.onRemove();
|
|
334
|
+
});
|
|
335
|
+
return activeComponentRef;
|
|
336
|
+
}
|
|
337
|
+
static getItemConfigComponent() {
|
|
338
|
+
return ItemConfigComponent;
|
|
339
|
+
}
|
|
340
|
+
static getItemStyleComponent() {
|
|
341
|
+
return ItemStyleComponent;
|
|
120
342
|
}
|
|
121
343
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
344
|
+
PluginManager.hoverItems = [];
|
|
345
|
+
PluginManager.activeItem = new Subject();
|
|
346
|
+
PluginManager.activeItems = [];
|
|
347
|
+
|
|
348
|
+
class ItemConfigComponent {
|
|
349
|
+
ngOnInit() {
|
|
350
|
+
PluginManager.activeItem.subscribe(item => {
|
|
351
|
+
if (!item) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
this.pageConfigContent.clear();
|
|
355
|
+
const pluginConfig = PluginFactory.getConfig(item.config?.name);
|
|
356
|
+
if (!pluginConfig) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
const componentRef = this.pageConfigContent.createComponent(pluginConfig.component);
|
|
360
|
+
const instance = componentRef.instance;
|
|
361
|
+
instance.config = item.config.pluginConfig;
|
|
362
|
+
instance.configChange.subscribe(() => {
|
|
363
|
+
const componentRef = PluginManager.createComponent(item.boxItem, item.index, item.style, item.config, true);
|
|
364
|
+
componentRef.location.nativeElement.click();
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
ItemConfigComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ItemConfigComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
370
|
+
ItemConfigComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ItemConfigComponent, selector: "rs-item-config", viewQueries: [{ propertyName: "pageConfigContent", first: true, predicate: ["pageConfigContent"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-container #pageConfigContent></ng-container>\n", styles: [""] });
|
|
371
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ItemConfigComponent, decorators: [{
|
|
125
372
|
type: Component,
|
|
126
|
-
args: [{ selector: 'rs-
|
|
127
|
-
}],
|
|
128
|
-
type: Input
|
|
129
|
-
}], size: [{
|
|
130
|
-
type: Input
|
|
131
|
-
}], modalElementRef: [{
|
|
373
|
+
args: [{ selector: 'rs-item-config', template: "<ng-container #pageConfigContent></ng-container>\n" }]
|
|
374
|
+
}], propDecorators: { pageConfigContent: [{
|
|
132
375
|
type: ViewChild,
|
|
133
|
-
args: ['
|
|
134
|
-
}]
|
|
135
|
-
|
|
136
|
-
|
|
376
|
+
args: ['pageConfigContent', { static: true, read: ViewContainerRef }]
|
|
377
|
+
}] } });
|
|
378
|
+
|
|
379
|
+
class BoxItemHostDirective {
|
|
380
|
+
constructor(el, viewContainerRef) {
|
|
381
|
+
this.el = el;
|
|
382
|
+
this.viewContainerRef = viewContainerRef;
|
|
383
|
+
this.el.nativeElement.hostId = this.hostId;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
BoxItemHostDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxItemHostDirective, deps: [{ token: i0.ElementRef }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
387
|
+
BoxItemHostDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.7", type: BoxItemHostDirective, selector: "[rsBoxItemHost]", inputs: { hostId: "hostId" }, ngImport: i0 });
|
|
388
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxItemHostDirective, decorators: [{
|
|
389
|
+
type: Directive,
|
|
390
|
+
args: [{
|
|
391
|
+
selector: '[rsBoxItemHost]'
|
|
392
|
+
}]
|
|
393
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ViewContainerRef }]; }, propDecorators: { hostId: [{
|
|
137
394
|
type: Input
|
|
138
|
-
}], onMouseup: [{
|
|
139
|
-
type: HostListener,
|
|
140
|
-
args: ['document:mouseup', ['$event']]
|
|
141
|
-
}], onMousemove: [{
|
|
142
|
-
type: HostListener,
|
|
143
|
-
args: ['document:mousemove', ['$event']]
|
|
144
395
|
}] } });
|
|
145
396
|
|
|
146
|
-
class
|
|
397
|
+
class ItemBlankComponent {
|
|
147
398
|
constructor() {
|
|
399
|
+
this.dropItem = new EventEmitter();
|
|
148
400
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
401
|
+
dropEvent($event) {
|
|
402
|
+
this.dropItem.emit($event.dragData);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
ItemBlankComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ItemBlankComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
406
|
+
ItemBlankComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ItemBlankComponent, selector: "rs-item-blank", outputs: { dropItem: "dropItem" }, ngImport: i0, template: "<div\n dDroppable\n [dropScope]=\"'default'\"\n dragOverClass=\"active\"\n (dropEvent)=\"dropEvent($event)\"\n>\n <span>\u62D6\u62FD\u7EC4\u4EF6\u5230\u6B64\u5904</span>\n</div>\n", styles: [":host{flex:auto;margin:16px;border:1px solid var(--devui-dividing-line, #f2f2f3);background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAZQTFRF8fHxAAAAMCd7XAAAAAJ0Uk5T/wDltzBKAAABJUlEQVR4nFVSy23EIBCdAiKxBaxCC1tBaGk7YG/OjZYSOQptLKKB8Y0D8ssbjBPl9gQz7wfigQbgQxygEXjIAjwDcJEV+PbYb1KAlNDusgE+Q1Va3EPFptJDjwVVZfcNiqwCV9BiIlhW9DdPkEn5GggKRV4igVL2AYJGpc8TFAMa5lXhzHuc69dwEO6DkBI9OhNVii60ERu3VxrjRUVRet7DsMoUbpgny+LRb5b0K2C/CAWejCxCSYVl9wcQSaMEzuRRArcqebzxcMCnUcKQsBKiiVoJoR1+4DfWSodILCGa5zXTvKWo5L5ars0C/iuh003F7GecbG62YVujunzypDqZTcsK76HF2UYP41HM4WoO7eEWNLUUyaHf/3L9JvXnBwjzS/wAoXR0PDbjCSUAAAAASUVORK5CYII=) repeat var(--devui-unavailable, #f5f5f5);display:flex;justify-content:center;pointer-events:all}:host div{flex:auto;padding:16px;display:flex;justify-content:center;align-items:center}:host div span{text-align:center;-webkit-user-select:none;user-select:none}:host div.active{background-color:var(--devui-waiting, #beccfa)}:host.plugin-hover>div{pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i1$1.DroppableDirective, selector: "[dDroppable]", inputs: ["dragOverClass", "dropScope", "placeholderTag", "placeholderStyle", "placeholderText", "allowDropOnItem", "dragOverItemClass", "nestingTargetRect", "switchWhileCrossEdge", "defaultDropPosition", "dropSortCountSelector", "dropSortVirtualScrollOption"], outputs: ["dragEnterEvent", "dragOverEvent", "dragLeaveEvent", "dropEvent"] }] });
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ItemBlankComponent, decorators: [{
|
|
408
|
+
type: Component,
|
|
409
|
+
args: [{ selector: 'rs-item-blank', template: "<div\n dDroppable\n [dropScope]=\"'default'\"\n dragOverClass=\"active\"\n (dropEvent)=\"dropEvent($event)\"\n>\n <span>\u62D6\u62FD\u7EC4\u4EF6\u5230\u6B64\u5904</span>\n</div>\n", styles: [":host{flex:auto;margin:16px;border:1px solid var(--devui-dividing-line, #f2f2f3);background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8AQMAAAAAMksxAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAZQTFRF8fHxAAAAMCd7XAAAAAJ0Uk5T/wDltzBKAAABJUlEQVR4nFVSy23EIBCdAiKxBaxCC1tBaGk7YG/OjZYSOQptLKKB8Y0D8ssbjBPl9gQz7wfigQbgQxygEXjIAjwDcJEV+PbYb1KAlNDusgE+Q1Va3EPFptJDjwVVZfcNiqwCV9BiIlhW9DdPkEn5GggKRV4igVL2AYJGpc8TFAMa5lXhzHuc69dwEO6DkBI9OhNVii60ERu3VxrjRUVRet7DsMoUbpgny+LRb5b0K2C/CAWejCxCSYVl9wcQSaMEzuRRArcqebzxcMCnUcKQsBKiiVoJoR1+4DfWSodILCGa5zXTvKWo5L5ars0C/iuh003F7GecbG62YVujunzypDqZTcsK76HF2UYP41HM4WoO7eEWNLUUyaHf/3L9JvXnBwjzS/wAoXR0PDbjCSUAAAAASUVORK5CYII=) repeat var(--devui-unavailable, #f5f5f5);display:flex;justify-content:center;pointer-events:all}:host div{flex:auto;padding:16px;display:flex;justify-content:center;align-items:center}:host div span{text-align:center;-webkit-user-select:none;user-select:none}:host div.active{background-color:var(--devui-waiting, #beccfa)}:host.plugin-hover>div{pointer-events:none}\n"] }]
|
|
410
|
+
}], propDecorators: { dropItem: [{
|
|
411
|
+
type: Output
|
|
412
|
+
}] } });
|
|
413
|
+
|
|
414
|
+
class BoxItemComponent {
|
|
415
|
+
constructor() {
|
|
416
|
+
this.editMode = false;
|
|
417
|
+
this.style = {};
|
|
418
|
+
this.config = {};
|
|
419
|
+
this.leaveOneItem = new EventEmitter();
|
|
420
|
+
}
|
|
421
|
+
get _direction() {
|
|
422
|
+
return this.config.direction;
|
|
423
|
+
}
|
|
424
|
+
get _style() {
|
|
425
|
+
if (this.pDirection) {
|
|
426
|
+
return {};
|
|
427
|
+
}
|
|
428
|
+
const width = this.style?.width ? this.style.width : 'auto';
|
|
429
|
+
const height = this.style?.height ? this.style.height : 'auto';
|
|
430
|
+
return this._calcStyle(this.pDirection, width, height);
|
|
431
|
+
}
|
|
432
|
+
ngOnInit() {
|
|
433
|
+
this.load();
|
|
434
|
+
}
|
|
435
|
+
load() {
|
|
436
|
+
setTimeout(() => {
|
|
437
|
+
for (let i = 0; i < this.itemHosts.length; i++) {
|
|
438
|
+
const itemHost = this.itemHosts.get(i);
|
|
439
|
+
itemHost.viewContainerRef.clear();
|
|
440
|
+
const item = this.config.list[i];
|
|
441
|
+
switch (item.type) {
|
|
442
|
+
case 'plugin':
|
|
443
|
+
PluginManager.createComponent(this, i, item.style, item.config, this.editMode, this.control);
|
|
444
|
+
break;
|
|
445
|
+
case 'item':
|
|
446
|
+
const boxItemComponentRef = itemHost.viewContainerRef.createComponent(BoxItemComponent);
|
|
447
|
+
const instance = boxItemComponentRef.instance;
|
|
448
|
+
instance.editMode = this.editMode;
|
|
449
|
+
instance.style = item.style;
|
|
450
|
+
instance.config = item.config;
|
|
451
|
+
instance.control = this.control;
|
|
452
|
+
instance.pDirection = this.config.direction;
|
|
453
|
+
if (this.editMode) {
|
|
454
|
+
instance.leaveOneItem.subscribe((item) => {
|
|
455
|
+
if (item.type === 'item' && item.direction === this.config.direction) {
|
|
456
|
+
this.config.list.splice(i, 1, ...item.list);
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.config.list.splice(i, 1, item);
|
|
460
|
+
}
|
|
461
|
+
this.load();
|
|
462
|
+
});
|
|
463
|
+
PluginManager.createHoverComponent(itemHost.viewContainerRef, boxItemComponentRef, '格子容器');
|
|
464
|
+
PluginManager.createActiveComponent(this, i, boxItemComponentRef, item.style, {
|
|
465
|
+
name: 'coast-box-container',
|
|
466
|
+
caption: '格子容器'
|
|
467
|
+
}, false);
|
|
468
|
+
}
|
|
469
|
+
break;
|
|
470
|
+
case 'blank':
|
|
471
|
+
default:
|
|
472
|
+
if (this.editMode) {
|
|
473
|
+
this.createBlankComponent(i);
|
|
474
|
+
}
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
createBlankComponent(index) {
|
|
481
|
+
const viewContainerRef = this.itemHosts.get(index)?.viewContainerRef;
|
|
482
|
+
const containerBlankComponentRef = viewContainerRef.createComponent(ItemBlankComponent);
|
|
483
|
+
containerBlankComponentRef.instance.dropItem.subscribe((plugin) => {
|
|
484
|
+
this.config.list[index] = {
|
|
485
|
+
type: 'plugin',
|
|
486
|
+
style: this.config.list[index].style,
|
|
487
|
+
config: {
|
|
488
|
+
name: plugin.name,
|
|
489
|
+
pluginConfig: plugin.pluginConfig || {}
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
this.load();
|
|
493
|
+
});
|
|
494
|
+
containerBlankComponentRef.instance.onRemove = () => {
|
|
495
|
+
this.config.list.splice(index, 1);
|
|
496
|
+
if (this.config.list.length === 1) {
|
|
497
|
+
this.leaveOneItem.emit(this.config.list[0]);
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
this.load();
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
PluginManager.createHoverComponent(viewContainerRef, containerBlankComponentRef, '占位格');
|
|
504
|
+
const activeComponentRef = PluginManager.createActiveComponent(this, index, containerBlankComponentRef, this.config.list[index].style, {
|
|
505
|
+
name: 'coast-box-container',
|
|
506
|
+
caption: '占位格'
|
|
507
|
+
}, this.config.list.length > 1);
|
|
508
|
+
activeComponentRef.instance.showDivider = true;
|
|
509
|
+
activeComponentRef.instance.splitItem = (direction) => {
|
|
510
|
+
if (this.config.direction === direction) {
|
|
511
|
+
this.config.list.splice(index, 0, { type: 'blank', style: {} });
|
|
512
|
+
this.load();
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
if (this.config.list.length === 1) {
|
|
516
|
+
this.config.direction = direction;
|
|
517
|
+
this.config.list.push({ type: 'blank', style: {} });
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
this.config.list.splice(index, 1, {
|
|
521
|
+
type: 'item',
|
|
522
|
+
style: this.config.list[index].style,
|
|
523
|
+
config: {
|
|
524
|
+
direction,
|
|
525
|
+
list: [{ type: 'blank', style: {} }, { type: 'blank', style: {} }]
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
this.load();
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
calcStyle(item) {
|
|
534
|
+
const width = item.style?.width ? item.style.width : 'auto';
|
|
535
|
+
const height = item.style?.height ? item.style.height : 'auto';
|
|
536
|
+
return this._calcStyle(this.config.direction, width, height);
|
|
537
|
+
}
|
|
538
|
+
_calcStyle(direction, width, height) {
|
|
539
|
+
if (direction === 'row') {
|
|
540
|
+
return {
|
|
541
|
+
flex: width === 'auto' ? '1' : '0 0 ' + width,
|
|
542
|
+
height,
|
|
543
|
+
pointerEvents: this.editMode ? 'none' : 'all'
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
else if (direction === 'column') {
|
|
547
|
+
return {
|
|
548
|
+
width,
|
|
549
|
+
flex: height === 'auto' ? '1' : '0 0 ' + height,
|
|
550
|
+
pointerEvents: this.editMode ? 'none' : 'all'
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
return {
|
|
554
|
+
pointerEvents: this.editMode ? 'none' : 'all'
|
|
153
555
|
};
|
|
154
|
-
modalRef.instance.title = title;
|
|
155
|
-
modalRef.instance.contentTemplate = contentTemplate;
|
|
156
|
-
modalRef.instance.size = size;
|
|
157
|
-
modalRef.instance.contentTemplateContext = contentTemplateContext;
|
|
158
|
-
modalRef.instance.show();
|
|
159
|
-
return modalRef.instance;
|
|
160
556
|
}
|
|
161
557
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
165
|
-
type:
|
|
166
|
-
args: [{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
558
|
+
BoxItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
559
|
+
BoxItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BoxItemComponent, selector: "rs-box-item", outputs: { leaveOneItem: "leaveOneItem" }, host: { properties: { "style.flex-direction": "this._direction", "style": "this._style" } }, viewQueries: [{ propertyName: "itemHosts", predicate: BoxItemHostDirective, descendants: true }], ngImport: i0, template: "<ng-container *ngFor=\"let item of config.list; index as index\">\n <div [ngStyle]=\"calcStyle(item)\">\n <ng-template rsBoxItemHost [hostId]=\"index\"></ng-template>\n </div>\n</ng-container>\n", styles: [":host{flex:auto;display:flex;pointer-events:all}:host div{flex:auto;display:flex}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: BoxItemHostDirective, selector: "[rsBoxItemHost]", inputs: ["hostId"] }] });
|
|
560
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxItemComponent, decorators: [{
|
|
561
|
+
type: Component,
|
|
562
|
+
args: [{ selector: 'rs-box-item', template: "<ng-container *ngFor=\"let item of config.list; index as index\">\n <div [ngStyle]=\"calcStyle(item)\">\n <ng-template rsBoxItemHost [hostId]=\"index\"></ng-template>\n </div>\n</ng-container>\n", styles: [":host{flex:auto;display:flex;pointer-events:all}:host div{flex:auto;display:flex}\n"] }]
|
|
563
|
+
}], propDecorators: { _direction: [{
|
|
564
|
+
type: HostBinding,
|
|
565
|
+
args: ['style.flex-direction']
|
|
566
|
+
}], _style: [{
|
|
567
|
+
type: HostBinding,
|
|
568
|
+
args: ['style']
|
|
569
|
+
}], leaveOneItem: [{
|
|
570
|
+
type: Output
|
|
571
|
+
}], itemHosts: [{
|
|
572
|
+
type: ViewChildren,
|
|
573
|
+
args: [BoxItemHostDirective]
|
|
574
|
+
}] } });
|
|
170
575
|
|
|
171
|
-
class
|
|
576
|
+
class BoxContainerComponent {
|
|
577
|
+
constructor() {
|
|
578
|
+
this.editMode = false;
|
|
579
|
+
this.config = {
|
|
580
|
+
direction: 'row',
|
|
581
|
+
list: [{ type: 'blank', style: {} }]
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
ngOnInit() {
|
|
585
|
+
const boxItemComponentRef = this.boxContainerContent.createComponent(BoxItemComponent);
|
|
586
|
+
const instance = boxItemComponentRef.instance;
|
|
587
|
+
instance.editMode = this.editMode;
|
|
588
|
+
instance.config = this.config;
|
|
589
|
+
instance.control = this.control;
|
|
590
|
+
instance.leaveOneItem?.subscribe((item) => {
|
|
591
|
+
if (item.type === 'item') {
|
|
592
|
+
Object.assign(instance.config, item);
|
|
593
|
+
}
|
|
594
|
+
else {
|
|
595
|
+
instance.config.direction = 'row';
|
|
596
|
+
}
|
|
597
|
+
instance.load();
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
BoxContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
602
|
+
BoxContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: BoxContainerComponent, selector: "rs-box-container", inputs: { editMode: "editMode", config: "config", control: "control" }, 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"] });
|
|
603
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerComponent, decorators: [{
|
|
604
|
+
type: Component,
|
|
605
|
+
args: [{ selector: 'rs-box-container', template: "<ng-container #boxContainerContent></ng-container>\n", styles: [":host{flex:auto;position:relative;display:flex;overflow:auto}\n"] }]
|
|
606
|
+
}], propDecorators: { editMode: [{
|
|
607
|
+
type: Input
|
|
608
|
+
}], config: [{
|
|
609
|
+
type: Input
|
|
610
|
+
}], control: [{
|
|
611
|
+
type: Input
|
|
612
|
+
}], boxContainerContent: [{
|
|
613
|
+
type: ViewChild,
|
|
614
|
+
args: ['boxContainerContent', { static: true, read: ViewContainerRef }]
|
|
615
|
+
}] } });
|
|
616
|
+
|
|
617
|
+
class BoxContainerModule {
|
|
172
618
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
619
|
+
BoxContainerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
620
|
+
BoxContainerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerModule, declarations: [BoxContainerComponent,
|
|
621
|
+
BoxItemHostDirective,
|
|
622
|
+
BoxItemComponent,
|
|
623
|
+
PluginActiveComponent,
|
|
624
|
+
DividerComponent,
|
|
625
|
+
DividerLineComponent,
|
|
626
|
+
PluginHoverComponent,
|
|
627
|
+
ItemConfigComponent,
|
|
628
|
+
ItemStyleComponent,
|
|
629
|
+
StyleBlankComponent,
|
|
630
|
+
ItemBlankComponent,
|
|
631
|
+
StyleComponent], imports: [CommonModule,
|
|
632
|
+
DevUIModule,
|
|
633
|
+
FormsModule], exports: [BoxContainerComponent,
|
|
634
|
+
ItemConfigComponent,
|
|
635
|
+
ItemStyleComponent] });
|
|
636
|
+
BoxContainerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerModule, imports: [CommonModule,
|
|
637
|
+
DevUIModule,
|
|
638
|
+
FormsModule] });
|
|
639
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: BoxContainerModule, decorators: [{
|
|
177
640
|
type: NgModule,
|
|
178
641
|
args: [{
|
|
179
642
|
declarations: [
|
|
180
|
-
|
|
643
|
+
BoxContainerComponent,
|
|
644
|
+
BoxItemHostDirective,
|
|
645
|
+
BoxItemComponent,
|
|
646
|
+
PluginActiveComponent,
|
|
647
|
+
DividerComponent,
|
|
648
|
+
DividerLineComponent,
|
|
649
|
+
PluginHoverComponent,
|
|
650
|
+
ItemConfigComponent,
|
|
651
|
+
ItemStyleComponent,
|
|
652
|
+
StyleBlankComponent,
|
|
653
|
+
ItemBlankComponent,
|
|
654
|
+
StyleComponent
|
|
181
655
|
],
|
|
182
656
|
imports: [
|
|
183
|
-
CommonModule
|
|
657
|
+
CommonModule,
|
|
658
|
+
DevUIModule,
|
|
659
|
+
FormsModule
|
|
184
660
|
],
|
|
185
|
-
exports: [
|
|
661
|
+
exports: [
|
|
662
|
+
BoxContainerComponent,
|
|
663
|
+
ItemConfigComponent,
|
|
664
|
+
ItemStyleComponent
|
|
665
|
+
]
|
|
186
666
|
}]
|
|
187
667
|
}] });
|
|
188
668
|
|
|
@@ -224,10 +704,11 @@ class DataGridComponent {
|
|
|
224
704
|
};
|
|
225
705
|
}
|
|
226
706
|
ngOnInit() {
|
|
227
|
-
this.
|
|
707
|
+
this.reload();
|
|
228
708
|
}
|
|
229
|
-
|
|
230
|
-
this.
|
|
709
|
+
reload() {
|
|
710
|
+
this.dxDataGrid.instance?.state(null);
|
|
711
|
+
this.service.getMetadataByView(this.tenant, this.className, this.view || '').subscribe((response) => {
|
|
231
712
|
this.columns = [];
|
|
232
713
|
for (let column of response.data.columns) {
|
|
233
714
|
if (column.type === 'NORMAL') {
|
|
@@ -291,11 +772,11 @@ class DataGridComponent {
|
|
|
291
772
|
});
|
|
292
773
|
}
|
|
293
774
|
}
|
|
294
|
-
DataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
295
|
-
DataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.
|
|
296
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
775
|
+
DataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DataGridComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
776
|
+
DataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: DataGridComponent, selector: "rs-data-grid", inputs: { tenant: "tenant", className: "className", view: "view", filter: "filter", service: "service", height: "height" }, viewQueries: [{ propertyName: "dxDataGrid", first: true, predicate: DxDataGridComponent, descendants: true, static: true }], ngImport: i0, template: "<dx-data-grid [dataSource]=\"dataSource\"\n [columns]=\"columns\"\n [height]=\"height\"\n [showBorders]=\"true\"\n [showColumnLines]=\"true\"\n [showRowLines]=\"true\"\n [hoverStateEnabled]=\"true\"\n [rowAlternationEnabled]=\"true\"\n [columnAutoWidth]=\"true\"\n [allowColumnResizing]=\"true\"\n columnResizingMode=\"widget\"\n dateSerializationFormat=\"yyyy/MM/dd HH:mm:ss\"\n>\n <dxo-sorting mode=\"multiple\"></dxo-sorting>\n <dxo-selection mode=\"multiple\" selectAllMode=\"page\"></dxo-selection>\n <dxo-filter-row [visible]=\"true\"></dxo-filter-row>\n <dxo-remote-operations [filtering]=\"true\"\n [sorting]=\"true\"\n [paging]=\"true\">\n </dxo-remote-operations>\n <dxo-paging [pageSize]=\"15\"></dxo-paging>\n <dxo-pager [visible]=\"true\"\n [showInfo]=\"true\"\n infoText=\"\u7B2C{0}\u9875\uFF0C\u5171{1}\u9875\uFF08\u5171{2}\u4E2A\u9879\u76EE\uFF09\"\n [showPageSizeSelector]=\"true\"\n [allowedPageSizes]=\"[15, 30, 50]\"\n ></dxo-pager>\n <dxo-scrolling showScrollbar=\"always\"></dxo-scrolling>\n <dxo-export [allowExportSelectedData]=\"true\"\n [fileName]=\"className\"></dxo-export>\n <div *dxTemplate=\"let cellInfo of 'rowIndexTemplate'\">\n {{cellInfo.rowIndex + 1}}\n </div>\n</dx-data-grid>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.DxDataGridComponent, selector: "dx-data-grid", inputs: ["accessKey", "activeStateEnabled", "allowColumnReordering", "allowColumnResizing", "autoNavigateToFocusedRow", "cacheEnabled", "cellHintEnabled", "columnAutoWidth", "columnChooser", "columnFixing", "columnHidingEnabled", "columnMinWidth", "columnResizingMode", "columns", "columnWidth", "customizeColumns", "dataRowTemplate", "dataSource", "dateSerializationFormat", "disabled", "editing", "elementAttr", "errorRowEnabled", "export", "filterBuilder", "filterBuilderPopup", "filterPanel", "filterRow", "filterSyncEnabled", "filterValue", "focusedColumnIndex", "focusedRowEnabled", "focusedRowIndex", "focusedRowKey", "grouping", "groupPanel", "headerFilter", "height", "highlightChanges", "hint", "hoverStateEnabled", "keyboardNavigation", "keyExpr", "loadPanel", "masterDetail", "noDataText", "pager", "paging", "remoteOperations", "renderAsync", "repaintChangesOnly", "rowAlternationEnabled", "rowDragging", "rowTemplate", "rtlEnabled", "scrolling", "searchPanel", "selectedRowKeys", "selection", "selectionFilter", "showBorders", "showColumnHeaders", "showColumnLines", "showRowLines", "sortByGroupSummaryInfo", "sorting", "stateStoring", "summary", "syncLookupFilterValues", "tabIndex", "toolbar", "twoWayBindingEnabled", "visible", "width", "wordWrapEnabled"], outputs: ["onAdaptiveDetailRowPreparing", "onCellClick", "onCellDblClick", "onCellHoverChanged", "onCellPrepared", "onContentReady", "onContextMenuPreparing", "onDataErrorOccurred", "onDisposing", "onEditCanceled", "onEditCanceling", "onEditingStart", "onEditorPrepared", "onEditorPreparing", "onExporting", "onFocusedCellChanged", "onFocusedCellChanging", "onFocusedRowChanged", "onFocusedRowChanging", "onInitialized", "onInitNewRow", "onKeyDown", "onOptionChanged", "onRowClick", "onRowCollapsed", "onRowCollapsing", "onRowDblClick", "onRowExpanded", "onRowExpanding", "onRowInserted", "onRowInserting", "onRowPrepared", "onRowRemoved", "onRowRemoving", "onRowUpdated", "onRowUpdating", "onRowValidating", "onSaved", "onSaving", "onSelectionChanged", "onToolbarPreparing", "accessKeyChange", "activeStateEnabledChange", "allowColumnReorderingChange", "allowColumnResizingChange", "autoNavigateToFocusedRowChange", "cacheEnabledChange", "cellHintEnabledChange", "columnAutoWidthChange", "columnChooserChange", "columnFixingChange", "columnHidingEnabledChange", "columnMinWidthChange", "columnResizingModeChange", "columnsChange", "columnWidthChange", "customizeColumnsChange", "dataRowTemplateChange", "dataSourceChange", "dateSerializationFormatChange", "disabledChange", "editingChange", "elementAttrChange", "errorRowEnabledChange", "exportChange", "filterBuilderChange", "filterBuilderPopupChange", "filterPanelChange", "filterRowChange", "filterSyncEnabledChange", "filterValueChange", "focusedColumnIndexChange", "focusedRowEnabledChange", "focusedRowIndexChange", "focusedRowKeyChange", "groupingChange", "groupPanelChange", "headerFilterChange", "heightChange", "highlightChangesChange", "hintChange", "hoverStateEnabledChange", "keyboardNavigationChange", "keyExprChange", "loadPanelChange", "masterDetailChange", "noDataTextChange", "pagerChange", "pagingChange", "remoteOperationsChange", "renderAsyncChange", "repaintChangesOnlyChange", "rowAlternationEnabledChange", "rowDraggingChange", "rowTemplateChange", "rtlEnabledChange", "scrollingChange", "searchPanelChange", "selectedRowKeysChange", "selectionChange", "selectionFilterChange", "showBordersChange", "showColumnHeadersChange", "showColumnLinesChange", "showRowLinesChange", "sortByGroupSummaryInfoChange", "sortingChange", "stateStoringChange", "summaryChange", "syncLookupFilterValuesChange", "tabIndexChange", "toolbarChange", "twoWayBindingEnabledChange", "visibleChange", "widthChange", "wordWrapEnabledChange"] }, { kind: "component", type: i2$1.DxoExportComponent, selector: "dxo-export", inputs: ["backgroundColor", "enabled", "fileName", "formats", "margin", "printingEnabled", "svgToCanvas", "allowExportSelectedData", "texts"] }, { kind: "component", type: i2$1.DxoFilterRowComponent, selector: "dxo-filter-row", inputs: ["applyFilter", "applyFilterText", "betweenEndText", "betweenStartText", "operationDescriptions", "resetOperationText", "showAllText", "showOperationChooser", "visible"] }, { kind: "component", type: i2$1.DxoPagerComponent, selector: "dxo-pager", inputs: ["allowedPageSizes", "displayMode", "infoText", "label", "showInfo", "showNavigationButtons", "showPageSizeSelector", "visible"] }, { kind: "component", type: i2$1.DxoPagingComponent, selector: "dxo-paging", inputs: ["enabled", "pageIndex", "pageSize"], outputs: ["pageIndexChange", "pageSizeChange"] }, { kind: "component", type: i2$1.DxoRemoteOperationsComponent, selector: "dxo-remote-operations", inputs: ["filtering", "grouping", "groupPaging", "paging", "sorting", "summary"] }, { kind: "component", type: i2$1.DxoScrollingComponent, selector: "dxo-scrolling", inputs: ["columnRenderingMode", "mode", "preloadEnabled", "renderAsync", "rowRenderingMode", "scrollByContent", "scrollByThumb", "showScrollbar", "useNative"] }, { kind: "component", type: i2$1.DxoSelectionComponent, selector: "dxo-selection", inputs: ["allowSelectAll", "deferred", "mode", "selectAllMode", "showCheckBoxesMode", "recursive"] }, { kind: "component", type: i2$1.DxoSortingComponent, selector: "dxo-sorting", inputs: ["ascendingText", "clearText", "descendingText", "mode", "showSortIndexes"] }, { kind: "directive", type: i3$1.DxTemplateDirective, selector: "[dxTemplate]", inputs: ["dxTemplateOf"] }] });
|
|
777
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DataGridComponent, decorators: [{
|
|
297
778
|
type: Component,
|
|
298
|
-
args: [{ selector: 'rs-data-grid', template: "<dx-data-grid [dataSource]=\"dataSource\"\n [columns]=\"columns\"\n [showBorders]=\"true\"\n [showColumnLines]=\"true\"\n [showRowLines]=\"true\"\n [hoverStateEnabled]=\"true\"\n [rowAlternationEnabled]=\"true\"\n [columnAutoWidth]=\"true\"\n [allowColumnResizing]=\"true\"\n columnResizingMode=\"widget\"\n dateSerializationFormat=\"yyyy/MM/dd HH:mm:ss\"\n>\n <dxo-sorting mode=\"multiple\"></dxo-sorting>\n <dxo-selection mode=\"multiple\" selectAllMode=\"page\"></dxo-selection>\n <dxo-filter-row [visible]=\"true\"></dxo-filter-row>\n <dxo-remote-operations [filtering]=\"true\"\n [sorting]=\"true\"\n [paging]=\"true\">\n </dxo-remote-operations>\n <dxo-paging [pageSize]=\"15\"></dxo-paging>\n <dxo-pager [visible]=\"true\"\n [showInfo]=\"true\"\n infoText=\"\u7B2C{0}\u9875\uFF0C\u5171{1}\u9875\uFF08\u5171{2}\u4E2A\u9879\u76EE\uFF09\"\n [showPageSizeSelector]=\"true\"\n [allowedPageSizes]=\"[15, 30, 50]\"\n ></dxo-pager>\n <dxo-export [allowExportSelectedData]=\"true\"\n [fileName]=\"className\"></dxo-export>\n <div *dxTemplate=\"let cellInfo of 'rowIndexTemplate'\">\n {{cellInfo.rowIndex + 1}}\n </div>\n</dx-data-grid>\n" }]
|
|
779
|
+
args: [{ selector: 'rs-data-grid', template: "<dx-data-grid [dataSource]=\"dataSource\"\n [columns]=\"columns\"\n [height]=\"height\"\n [showBorders]=\"true\"\n [showColumnLines]=\"true\"\n [showRowLines]=\"true\"\n [hoverStateEnabled]=\"true\"\n [rowAlternationEnabled]=\"true\"\n [columnAutoWidth]=\"true\"\n [allowColumnResizing]=\"true\"\n columnResizingMode=\"widget\"\n dateSerializationFormat=\"yyyy/MM/dd HH:mm:ss\"\n>\n <dxo-sorting mode=\"multiple\"></dxo-sorting>\n <dxo-selection mode=\"multiple\" selectAllMode=\"page\"></dxo-selection>\n <dxo-filter-row [visible]=\"true\"></dxo-filter-row>\n <dxo-remote-operations [filtering]=\"true\"\n [sorting]=\"true\"\n [paging]=\"true\">\n </dxo-remote-operations>\n <dxo-paging [pageSize]=\"15\"></dxo-paging>\n <dxo-pager [visible]=\"true\"\n [showInfo]=\"true\"\n infoText=\"\u7B2C{0}\u9875\uFF0C\u5171{1}\u9875\uFF08\u5171{2}\u4E2A\u9879\u76EE\uFF09\"\n [showPageSizeSelector]=\"true\"\n [allowedPageSizes]=\"[15, 30, 50]\"\n ></dxo-pager>\n <dxo-scrolling showScrollbar=\"always\"></dxo-scrolling>\n <dxo-export [allowExportSelectedData]=\"true\"\n [fileName]=\"className\"></dxo-export>\n <div *dxTemplate=\"let cellInfo of 'rowIndexTemplate'\">\n {{cellInfo.rowIndex + 1}}\n </div>\n</dx-data-grid>\n" }]
|
|
299
780
|
}], propDecorators: { tenant: [{
|
|
300
781
|
type: Input
|
|
301
782
|
}], className: [{
|
|
@@ -306,16 +787,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
306
787
|
type: Input
|
|
307
788
|
}], service: [{
|
|
308
789
|
type: Input
|
|
790
|
+
}], height: [{
|
|
791
|
+
type: Input
|
|
792
|
+
}], dxDataGrid: [{
|
|
793
|
+
type: ViewChild,
|
|
794
|
+
args: [DxDataGridComponent, { static: true }]
|
|
309
795
|
}] } });
|
|
310
796
|
|
|
311
797
|
class DataGridModule {
|
|
312
798
|
}
|
|
313
|
-
DataGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.
|
|
314
|
-
DataGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.
|
|
799
|
+
DataGridModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DataGridModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
800
|
+
DataGridModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: DataGridModule, declarations: [DataGridComponent], imports: [CommonModule,
|
|
315
801
|
DxDataGridModule], exports: [DataGridComponent] });
|
|
316
|
-
DataGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.
|
|
802
|
+
DataGridModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DataGridModule, imports: [CommonModule,
|
|
317
803
|
DxDataGridModule] });
|
|
318
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.
|
|
804
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: DataGridModule, decorators: [{
|
|
319
805
|
type: NgModule,
|
|
320
806
|
args: [{
|
|
321
807
|
declarations: [
|
|
@@ -331,6 +817,262 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
331
817
|
}]
|
|
332
818
|
}] });
|
|
333
819
|
|
|
820
|
+
class FormComponent {
|
|
821
|
+
constructor() {
|
|
822
|
+
this.layoutDirection = FormLayout.Vertical;
|
|
823
|
+
this.model = {};
|
|
824
|
+
this.items = [];
|
|
825
|
+
this.formGroup = new UntypedFormGroup({});
|
|
826
|
+
this.submitted = new EventEmitter();
|
|
827
|
+
}
|
|
828
|
+
ngOnInit() {
|
|
829
|
+
this.formGroup.valueChanges.subscribe(model => {
|
|
830
|
+
this.model = model;
|
|
831
|
+
});
|
|
832
|
+
this.service.getMetadataByTemplate(this.tenant, this.className, this.template).subscribe((response) => {
|
|
833
|
+
this.config = JSON.parse(response.data.template);
|
|
834
|
+
this.items = ["modifier", "createTime", "modifyTime", "creator", "number"];
|
|
835
|
+
for (let item of this.items) {
|
|
836
|
+
this.formGroup.addControl(item, new UntypedFormControl(this.model[item]));
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
submit($event) {
|
|
841
|
+
console.log($event);
|
|
842
|
+
console.log(this.model);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
846
|
+
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: { submitted: "submitted" }, 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 && formGroup\">\n <rs-box-container [config]=\"config\" [control]=\"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", "control"] }] });
|
|
847
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormComponent, decorators: [{
|
|
848
|
+
type: Component,
|
|
849
|
+
args: [{ selector: 'rs-form', template: "<form dForm [formGroup]=\"formGroup\" [layout]=\"layoutDirection\" (dSubmit)=\"submit($event)\">\n <ng-container *ngIf=\"config && formGroup\">\n <rs-box-container [config]=\"config\" [control]=\"formGroup\"></rs-box-container>\n </ng-container>\n <button #formSubmitter dFormSubmit=\"click\"></button>\n</form>\n" }]
|
|
850
|
+
}], propDecorators: { tenant: [{
|
|
851
|
+
type: Input
|
|
852
|
+
}], className: [{
|
|
853
|
+
type: Input
|
|
854
|
+
}], template: [{
|
|
855
|
+
type: Input
|
|
856
|
+
}], service: [{
|
|
857
|
+
type: Input
|
|
858
|
+
}], formSubmitter: [{
|
|
859
|
+
type: ViewChild,
|
|
860
|
+
args: ['formSubmitter']
|
|
861
|
+
}], submitted: [{
|
|
862
|
+
type: Output
|
|
863
|
+
}] } });
|
|
864
|
+
|
|
865
|
+
class FormModule {
|
|
866
|
+
}
|
|
867
|
+
FormModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
868
|
+
FormModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: FormModule, declarations: [FormComponent], imports: [CommonModule,
|
|
869
|
+
DevUIModule,
|
|
870
|
+
FormsModule,
|
|
871
|
+
ReactiveFormsModule,
|
|
872
|
+
BoxContainerModule], exports: [FormComponent] });
|
|
873
|
+
FormModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormModule, imports: [CommonModule,
|
|
874
|
+
DevUIModule,
|
|
875
|
+
FormsModule,
|
|
876
|
+
ReactiveFormsModule,
|
|
877
|
+
BoxContainerModule] });
|
|
878
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: FormModule, decorators: [{
|
|
879
|
+
type: NgModule,
|
|
880
|
+
args: [{
|
|
881
|
+
declarations: [
|
|
882
|
+
FormComponent
|
|
883
|
+
],
|
|
884
|
+
imports: [
|
|
885
|
+
CommonModule,
|
|
886
|
+
DevUIModule,
|
|
887
|
+
FormsModule,
|
|
888
|
+
ReactiveFormsModule,
|
|
889
|
+
BoxContainerModule
|
|
890
|
+
],
|
|
891
|
+
exports: [
|
|
892
|
+
FormComponent
|
|
893
|
+
]
|
|
894
|
+
}]
|
|
895
|
+
}] });
|
|
896
|
+
|
|
897
|
+
class ModalComponent {
|
|
898
|
+
constructor(elementRef) {
|
|
899
|
+
this.elementRef = elementRef;
|
|
900
|
+
this.size = 'default';
|
|
901
|
+
this._width = 480;
|
|
902
|
+
this.movable = false;
|
|
903
|
+
this.topStart = 0;
|
|
904
|
+
this.leftStart = 0;
|
|
905
|
+
}
|
|
906
|
+
ngOnInit() {
|
|
907
|
+
if (this.size === 'full') {
|
|
908
|
+
this.modalElementRef.nativeElement.style.top = '0px';
|
|
909
|
+
this.modalElementRef.nativeElement.style.right = '0px';
|
|
910
|
+
this.modalElementRef.nativeElement.style.bottom = '0px';
|
|
911
|
+
this.modalElementRef.nativeElement.style.left = '0px';
|
|
912
|
+
this.modalElementRef.nativeElement.style.margin = '2px';
|
|
913
|
+
this.modalElementRef.nativeElement.style.boxShadow = 'none';
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
if (this.size === 'large') {
|
|
917
|
+
this._width = 960;
|
|
918
|
+
}
|
|
919
|
+
this.modalElementRef.nativeElement.style.width = this._width + 'px';
|
|
920
|
+
this.modalElementRef.nativeElement.style.top = '40px';
|
|
921
|
+
this.modalElementRef.nativeElement.style.left =
|
|
922
|
+
(this.elementRef.nativeElement.parentElement.offsetWidth - this.modalElementRef.nativeElement.offsetWidth) / 2 + 'px';
|
|
923
|
+
this.moveHandleEl = this.elementRef.nativeElement.querySelector('.modal-header');
|
|
924
|
+
this.moveHandleEl.style.cursor = 'move';
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
show() {
|
|
928
|
+
// 若存在多层模态框,仅保留最上层遮罩颜色,下层遮罩设置为透明
|
|
929
|
+
const parentElement = this.elementRef.nativeElement.parentElement;
|
|
930
|
+
const nodeName = this.elementRef.nativeElement.nodeName;
|
|
931
|
+
const modals = parentElement.querySelectorAll(nodeName);
|
|
932
|
+
for (let i = 0; i < modals.length; i++) {
|
|
933
|
+
if (i === modals.length - 1) {
|
|
934
|
+
modals[i].querySelector('.modal-backdrop').style.backgroundColor = 'rgba(37, 43, 58, 0.05)';
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
modals[i].querySelector('.modal-backdrop').style.backgroundColor = 'rgba(37, 43, 58, 0)';
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
hide() {
|
|
942
|
+
// 在service中重写
|
|
943
|
+
}
|
|
944
|
+
ngOnDestroy() {
|
|
945
|
+
// 若存在多层模态框,下一层遮罩设置为不透明
|
|
946
|
+
const parentElement = this.elementRef.nativeElement.parentElement;
|
|
947
|
+
const nodeName = this.elementRef.nativeElement.nodeName;
|
|
948
|
+
const nextModal = parentElement.querySelector(nodeName + ':nth-last-child(2)');
|
|
949
|
+
if (nextModal) {
|
|
950
|
+
nextModal.querySelector('.modal-backdrop').style.backgroundColor = 'rgba(37, 43, 58, 0.05)';
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
resolveModalBackdropPosition() {
|
|
954
|
+
return {
|
|
955
|
+
"width": this.elementRef.nativeElement.parentElement.offsetWidth + 'px',
|
|
956
|
+
"height": this.elementRef.nativeElement.parentElement.offsetHeight + 'px',
|
|
957
|
+
"top": this.elementRef.nativeElement.parentElement.offsetTop + 'px',
|
|
958
|
+
"left": this.elementRef.nativeElement.parentElement.offsetLeft + 'px',
|
|
959
|
+
};
|
|
960
|
+
}
|
|
961
|
+
onMousedown($event) {
|
|
962
|
+
if ($event.button === 2 || !this.checkHandleTarget($event.target, this.moveHandleEl)) {
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
this.movable = true;
|
|
966
|
+
this.topStart = $event.clientY - this.modalElementRef.nativeElement.style.top.replace('px', '');
|
|
967
|
+
this.leftStart = $event.clientX - this.modalElementRef.nativeElement.style.left.replace('px', '');
|
|
968
|
+
}
|
|
969
|
+
checkHandleTarget(target, element) {
|
|
970
|
+
if (!element) {
|
|
971
|
+
return false;
|
|
972
|
+
}
|
|
973
|
+
if (target === element) {
|
|
974
|
+
return true;
|
|
975
|
+
}
|
|
976
|
+
for (let child in element.children) {
|
|
977
|
+
if (Object.prototype.hasOwnProperty.call(element.children, child)) {
|
|
978
|
+
if (this.checkHandleTarget(target, element.children[child])) {
|
|
979
|
+
return true;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
985
|
+
onMouseup() {
|
|
986
|
+
this.movable = false;
|
|
987
|
+
}
|
|
988
|
+
onMousemove($event) {
|
|
989
|
+
if (!this.movable) {
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
$event.stopPropagation();
|
|
993
|
+
$event.preventDefault();
|
|
994
|
+
const element = this.modalElementRef.nativeElement;
|
|
995
|
+
let currentTop = $event.clientY - this.topStart;
|
|
996
|
+
let currentLeft = $event.clientX - this.leftStart;
|
|
997
|
+
currentTop = currentTop < 0 ? 0 : currentTop;
|
|
998
|
+
const maxTop = element.parentElement.offsetHeight - element.offsetHeight;
|
|
999
|
+
currentTop = currentTop > maxTop ? maxTop : currentTop;
|
|
1000
|
+
currentLeft = currentLeft < 0 ? 0 : currentLeft;
|
|
1001
|
+
const maxLeft = element.parentElement.offsetWidth - element.offsetWidth;
|
|
1002
|
+
currentLeft = currentLeft > maxLeft ? maxLeft : currentLeft;
|
|
1003
|
+
element.style.top = currentTop + 'px';
|
|
1004
|
+
element.style.left = currentLeft + 'px';
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
ModalComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1008
|
+
ModalComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.7", type: ModalComponent, selector: "rs-modal", inputs: { title: "title", size: "size", contentTemplate: "contentTemplate", contentTemplateContext: "contentTemplateContext" }, host: { listeners: { "document:mouseup": "onMouseup($event)", "document:mousemove": "onMousemove($event)" } }, viewQueries: [{ propertyName: "modalElementRef", first: true, predicate: ["modal"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"modal-backdrop\" [ngStyle]=\"resolveModalBackdropPosition()\">\n <div #modal class=\"modal\">\n <div class=\"modal-header\" (mousedown)=\"onMousedown($event)\">\n <div class=\"modal-title\">{{title}}</div>\n <i class=\"icon-close\" (click)=\"hide()\"></i>\n </div>\n <div class=\"modal-content\">\n <ng-template [ngTemplateOutlet]=\"contentTemplate\"\n [ngTemplateOutletContext]=\"{$implicit: contentTemplateContext}\"></ng-template>\n </div>\n </div>\n</div>\n", styles: [":host .modal-backdrop{position:absolute;inset:0;z-index:calc(var(--devui-z-index-modal, 1050) - 1)}:host .modal-backdrop .modal{position:absolute;top:0;left:0;z-index:var(--devui-z-index-modal, 1050);background-color:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px);box-shadow:var(--devui-shadow-length-fullscreen-overlay, 0 10px 24px 0) var(--devui-shadow, rgba(37, 43, 58, .24));display:flex;flex-flow:column nowrap}:host .modal-backdrop .modal .modal-header{flex:0 0 36px;border-bottom:1px solid var(--devui-dividing-line, #f2f2f3)}:host .modal-backdrop .modal .modal-header .modal-title{padding:12px 24px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700}:host .modal-backdrop .modal .modal-header i{position:absolute;top:12px;right:12px;padding:4px;font-size:var(--devui-font-size-card-title, 14px)}:host .modal-backdrop .modal .modal-header i:hover{cursor:pointer;color:var(--devui-danger, #f66f6a);background-color:var(--devui-info-bg, #e9edfa)}:host .modal-backdrop .modal .modal-content{flex:auto;padding:24px;display:flex;flex-flow:column;font-size:var(--devui-font-size, 12px);color:var(--devui-aide-text, #71757f)}\n"], dependencies: [{ kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
1009
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalComponent, decorators: [{
|
|
1010
|
+
type: Component,
|
|
1011
|
+
args: [{ selector: 'rs-modal', template: "<div class=\"modal-backdrop\" [ngStyle]=\"resolveModalBackdropPosition()\">\n <div #modal class=\"modal\">\n <div class=\"modal-header\" (mousedown)=\"onMousedown($event)\">\n <div class=\"modal-title\">{{title}}</div>\n <i class=\"icon-close\" (click)=\"hide()\"></i>\n </div>\n <div class=\"modal-content\">\n <ng-template [ngTemplateOutlet]=\"contentTemplate\"\n [ngTemplateOutletContext]=\"{$implicit: contentTemplateContext}\"></ng-template>\n </div>\n </div>\n</div>\n", styles: [":host .modal-backdrop{position:absolute;inset:0;z-index:calc(var(--devui-z-index-modal, 1050) - 1)}:host .modal-backdrop .modal{position:absolute;top:0;left:0;z-index:var(--devui-z-index-modal, 1050);background-color:var(--devui-base-bg, #ffffff);border-radius:var(--devui-border-radius-card, 6px);box-shadow:var(--devui-shadow-length-fullscreen-overlay, 0 10px 24px 0) var(--devui-shadow, rgba(37, 43, 58, .24));display:flex;flex-flow:column nowrap}:host .modal-backdrop .modal .modal-header{flex:0 0 36px;border-bottom:1px solid var(--devui-dividing-line, #f2f2f3)}:host .modal-backdrop .modal .modal-header .modal-title{padding:12px 24px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700}:host .modal-backdrop .modal .modal-header i{position:absolute;top:12px;right:12px;padding:4px;font-size:var(--devui-font-size-card-title, 14px)}:host .modal-backdrop .modal .modal-header i:hover{cursor:pointer;color:var(--devui-danger, #f66f6a);background-color:var(--devui-info-bg, #e9edfa)}:host .modal-backdrop .modal .modal-content{flex:auto;padding:24px;display:flex;flex-flow:column;font-size:var(--devui-font-size, 12px);color:var(--devui-aide-text, #71757f)}\n"] }]
|
|
1012
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { title: [{
|
|
1013
|
+
type: Input
|
|
1014
|
+
}], size: [{
|
|
1015
|
+
type: Input
|
|
1016
|
+
}], modalElementRef: [{
|
|
1017
|
+
type: ViewChild,
|
|
1018
|
+
args: ['modal', { static: true }]
|
|
1019
|
+
}], contentTemplate: [{
|
|
1020
|
+
type: Input
|
|
1021
|
+
}], contentTemplateContext: [{
|
|
1022
|
+
type: Input
|
|
1023
|
+
}], onMouseup: [{
|
|
1024
|
+
type: HostListener,
|
|
1025
|
+
args: ['document:mouseup', ['$event']]
|
|
1026
|
+
}], onMousemove: [{
|
|
1027
|
+
type: HostListener,
|
|
1028
|
+
args: ['document:mousemove', ['$event']]
|
|
1029
|
+
}] } });
|
|
1030
|
+
|
|
1031
|
+
class ModalModule {
|
|
1032
|
+
}
|
|
1033
|
+
ModalModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1034
|
+
ModalModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.7", ngImport: i0, type: ModalModule, declarations: [ModalComponent], imports: [CommonModule], exports: [ModalComponent] });
|
|
1035
|
+
ModalModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalModule, imports: [CommonModule] });
|
|
1036
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalModule, decorators: [{
|
|
1037
|
+
type: NgModule,
|
|
1038
|
+
args: [{
|
|
1039
|
+
declarations: [
|
|
1040
|
+
ModalComponent
|
|
1041
|
+
],
|
|
1042
|
+
imports: [
|
|
1043
|
+
CommonModule
|
|
1044
|
+
],
|
|
1045
|
+
exports: [
|
|
1046
|
+
ModalComponent
|
|
1047
|
+
]
|
|
1048
|
+
}]
|
|
1049
|
+
}] });
|
|
1050
|
+
|
|
1051
|
+
class ModalService {
|
|
1052
|
+
constructor() {
|
|
1053
|
+
}
|
|
1054
|
+
open(viewContainerRef, title, size = 'default', contentTemplate, contentTemplateContext) {
|
|
1055
|
+
const modalRef = viewContainerRef.createComponent(ModalComponent);
|
|
1056
|
+
modalRef.instance.hide = () => {
|
|
1057
|
+
modalRef.hostView.destroy();
|
|
1058
|
+
};
|
|
1059
|
+
modalRef.instance.title = title;
|
|
1060
|
+
modalRef.instance.contentTemplate = contentTemplate;
|
|
1061
|
+
modalRef.instance.size = size;
|
|
1062
|
+
modalRef.instance.contentTemplateContext = contentTemplateContext;
|
|
1063
|
+
modalRef.instance.show();
|
|
1064
|
+
return modalRef.instance;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
ModalService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1068
|
+
ModalService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalService, providedIn: 'root' });
|
|
1069
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.7", ngImport: i0, type: ModalService, decorators: [{
|
|
1070
|
+
type: Injectable,
|
|
1071
|
+
args: [{
|
|
1072
|
+
providedIn: 'root'
|
|
1073
|
+
}]
|
|
1074
|
+
}], ctorParameters: function () { return []; } });
|
|
1075
|
+
|
|
334
1076
|
/*
|
|
335
1077
|
* Public API Surface of ngx-rs-ant
|
|
336
1078
|
*/
|
|
@@ -339,5 +1081,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.0", ngImpor
|
|
|
339
1081
|
* Generated bundle index. Do not edit.
|
|
340
1082
|
*/
|
|
341
1083
|
|
|
342
|
-
export { DataGridComponent, DataGridModule, ModalModule, ModalService };
|
|
1084
|
+
export { BoxContainerComponent, BoxContainerModule, DataGridComponent, DataGridModule, FormComponent, FormModule, ItemConfigComponent, ItemStyleComponent, ModalComponent, ModalModule, ModalService, PluginManager };
|
|
343
1085
|
//# sourceMappingURL=ngx-rs-ant.mjs.map
|