@flexem/fc-gui 3.0.0-alpha.162 → 3.0.0-alpha.164
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/bundles/@flexem/fc-gui.umd.js +47 -17
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/numerical-display/numerical-display-element.js +1 -1
- package/elements/shared/text/text-element.js +1 -1
- package/elements/shared/text/text-state-element.d.ts +2 -0
- package/elements/shared/text/text-state-element.js +33 -8
- package/elements/view-operation/view-operation.element.js +10 -5
- package/modal/write-value/write-value-modal.component.html +5 -5
- package/modal/write-value/write-value-modal.component.js +2 -2
- package/modal/write-value/write-value-modal.component.less +15 -1
- package/modal/write-value/write-value-modal.component.metadata.json +1 -1
- package/model/shared/text/font.d.ts +1 -1
- package/package.json +1 -1
|
@@ -245,7 +245,7 @@ export class NumericalDisplayElement extends ReadableElement {
|
|
|
245
245
|
}
|
|
246
246
|
const args = new WriteValueModalArgs(this.writeVariableName, this.model.dataType, this.model.fBoxDataType, this.model.integerDigits, this.model.fractionDigits, numericalOperation, this.model.version, this.enableDataParsed, this.releasedVariableService, this.guiContext);
|
|
247
247
|
this.writeValueMmodalRef = this.modalService.show(WriteValueModalComponent, {
|
|
248
|
-
initialState: { args: args }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false
|
|
248
|
+
initialState: { args: args }, backdrop: 'static', class: 'gui-modal-dialog-position gui-modal-write', animated: false
|
|
249
249
|
});
|
|
250
250
|
this.writeValueMmodalRef.content.onClosed = (result) => {
|
|
251
251
|
if (result) {
|
|
@@ -77,7 +77,7 @@ export class TextElementModal {
|
|
|
77
77
|
lineHeight = parseInt(font.fontSize, 10) + 5;
|
|
78
78
|
fontString += font.fontSize + '/' + lineHeight.toString() + 'px ' + font.fontFamily;
|
|
79
79
|
textDiv.style.cssText = `color: ${font.color};word-break: break-all;font: ${fontString};text-align: ${textAlign};`;
|
|
80
|
-
if (font.isUnderline) {
|
|
80
|
+
if (font.isUnderline && content.length > 0) {
|
|
81
81
|
textDiv.style.textDecoration = 'underline';
|
|
82
82
|
}
|
|
83
83
|
const spanText = document.createElement('span');
|
|
@@ -44,10 +44,23 @@ export class TextStateElement {
|
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
const textElement = this.getforeignObjectElement();
|
|
47
|
-
// 设置 text-anchor 和 dominant-baseline
|
|
48
|
-
textElement.setAttribute('text-anchor', 'middle');
|
|
49
|
-
textElement.setAttribute('dominant-baseline', 'middle');
|
|
50
47
|
textElement.setAttribute('pointer-events', 'auto');
|
|
48
|
+
// 根据 textAlign 计算 SVG text-anchor 和 x 坐标
|
|
49
|
+
const textAlign = font.textAlign || 'center';
|
|
50
|
+
let textAnchor;
|
|
51
|
+
let anchorX;
|
|
52
|
+
if (textAlign === 'left') {
|
|
53
|
+
textAnchor = 'start';
|
|
54
|
+
anchorX = 0;
|
|
55
|
+
}
|
|
56
|
+
else if (textAlign === 'right') {
|
|
57
|
+
textAnchor = 'end';
|
|
58
|
+
anchorX = this.width;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
textAnchor = 'middle';
|
|
62
|
+
anchorX = this.width / 2;
|
|
63
|
+
}
|
|
51
64
|
// 拆分换行
|
|
52
65
|
const lines = content.split('\n');
|
|
53
66
|
const fontSize = parseInt(font.fontSize, 10);
|
|
@@ -65,16 +78,16 @@ export class TextStateElement {
|
|
|
65
78
|
textElement.appendChild(tspan);
|
|
66
79
|
}
|
|
67
80
|
tspan.setAttribute('display', 'inline');
|
|
68
|
-
tspan.setAttribute('x',
|
|
81
|
+
tspan.setAttribute('x', anchorX.toString());
|
|
69
82
|
tspan.setAttribute('y', startY + i * lineHeight + 'px');
|
|
70
|
-
tspan.textContent = lines[i].replace(/ /g, '
|
|
83
|
+
tspan.textContent = lines[i].replace(/ /g, ' ');
|
|
71
84
|
tspan.setAttribute('font-size', font.fontSize);
|
|
72
85
|
tspan.setAttribute('fill', font.color);
|
|
73
86
|
tspan.setAttribute('font-family', font.fontFamily);
|
|
74
87
|
tspan.setAttribute('font-weight', font.isBold ? 'bold' : 'normal');
|
|
75
88
|
tspan.setAttribute('font-style', font.isItalic ? 'italic' : 'normal');
|
|
76
89
|
tspan.setAttribute('text-decoration', font.isUnderline ? 'underline' : 'none');
|
|
77
|
-
tspan.setAttribute('text-anchor',
|
|
90
|
+
tspan.setAttribute('text-anchor', textAnchor);
|
|
78
91
|
tspan.setAttribute('dominant-baseline', 'middle');
|
|
79
92
|
}
|
|
80
93
|
// 隐藏多余的 tspan(不删除)
|
|
@@ -132,7 +145,7 @@ export class TextStateElement {
|
|
|
132
145
|
}
|
|
133
146
|
}
|
|
134
147
|
doFaultFlicker(textElement, stateId) {
|
|
135
|
-
if (this.version > 3 && this.faultFlickers) {
|
|
148
|
+
if (this.version != null && this.version > 3 && this.faultFlickers) {
|
|
136
149
|
this.clearFlickerInterval(textElement);
|
|
137
150
|
const faultFlicker = this.faultFlickers.find(t => t.id === stateId);
|
|
138
151
|
if (faultFlicker && faultFlicker.faultFlicker) {
|
|
@@ -161,6 +174,8 @@ export class TextStateElement {
|
|
|
161
174
|
}
|
|
162
175
|
/**
|
|
163
176
|
* 获取指定状态在当前语种下的字体样式
|
|
177
|
+
* fontStyleCultures 中保存的对象含 fontStyle 字符串但无 isBold/isItalic/fontFamily,
|
|
178
|
+
* 此处从 fontStyle 解析这三个字段后返回
|
|
164
179
|
*/
|
|
165
180
|
getFontForState(stateId, defaultFont) {
|
|
166
181
|
if (!this.fontStyleCultures) {
|
|
@@ -181,7 +196,17 @@ export class TextStateElement {
|
|
|
181
196
|
};
|
|
182
197
|
const targetLanguage = getTargetLanguage();
|
|
183
198
|
if (this.fontStyleCultures[stateKey][targetLanguage]) {
|
|
184
|
-
|
|
199
|
+
const culturedFont = this.fontStyleCultures[stateKey][targetLanguage];
|
|
200
|
+
if (culturedFont.fontStyle) {
|
|
201
|
+
const fs = culturedFont.fontStyle;
|
|
202
|
+
const isBold = fs.indexOf('bold') !== -1;
|
|
203
|
+
const isItalic = fs.indexOf('Italic') !== -1;
|
|
204
|
+
const parts = fs.split(' ');
|
|
205
|
+
const familyIndex = (isBold ? 1 : 0) + (isItalic ? 1 : 0) + 1;
|
|
206
|
+
const fontFamily = parts.length > familyIndex ? parts[familyIndex] : null;
|
|
207
|
+
return Object.assign(Object.assign({}, culturedFont), { isBold, isItalic, fontFamily });
|
|
208
|
+
}
|
|
209
|
+
return culturedFont;
|
|
185
210
|
}
|
|
186
211
|
return defaultFont;
|
|
187
212
|
}
|
|
@@ -233,14 +233,19 @@ export class ViewOperationElement extends ConditionalEnableElement {
|
|
|
233
233
|
const targetLanguage = getTargetLanguage();
|
|
234
234
|
if (this.model.fontStyleCultures && this.model.fontStyleCultures[targetLanguage]) {
|
|
235
235
|
const style = this.model.fontStyleCultures[targetLanguage];
|
|
236
|
+
const fs = style.fontStyle || '';
|
|
237
|
+
const isBold = fs.indexOf('bold') !== -1;
|
|
238
|
+
const isItalic = fs.indexOf('Italic') !== -1;
|
|
239
|
+
const parts = fs.split(' ');
|
|
240
|
+
const familyIndex = (isBold ? 1 : 0) + (isItalic ? 1 : 0) + 1;
|
|
241
|
+
const fontFamily = parts.length > familyIndex ? parts[familyIndex] : null;
|
|
236
242
|
return {
|
|
237
243
|
isUnderline: style.isUnderline,
|
|
238
|
-
isBold
|
|
239
|
-
isItalic
|
|
244
|
+
isBold,
|
|
245
|
+
isItalic,
|
|
240
246
|
fontSize: style.fontSize,
|
|
241
|
-
fontFamily:
|
|
242
|
-
color: style.color
|
|
243
|
-
textAlign: style.textAlign
|
|
247
|
+
fontFamily: fontFamily || 'msyh',
|
|
248
|
+
color: style.color
|
|
244
249
|
};
|
|
245
250
|
}
|
|
246
251
|
return Object.assign(Object.assign({}, this.model.label.font), { fontFamily: this.model.label.font.fontFamily || 'msyh' });
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
</div>
|
|
11
11
|
<div class="modal-body">
|
|
12
12
|
<span class="write-value-range">{{localization.writeValueRange}}:</span>
|
|
13
|
-
<
|
|
13
|
+
<span>
|
|
14
14
|
{{writeValueRangeText}}
|
|
15
15
|
<span *ngIf="valueType">({{valueType}})</span>
|
|
16
|
-
</
|
|
17
|
-
<input type="text" name="valueInput" autoFocus class="form-control write-value" [(ngModel)]="value" (keyup)="validate($event)" autocomplete="off">
|
|
16
|
+
</span>
|
|
17
|
+
<input type="text" name="valueInput" autoFocus class="form-control form-control-write write-value" [(ngModel)]="value" (keyup)="validate($event)" autocomplete="off">
|
|
18
18
|
<span class="help-block text-danger" [hidden]="!validationError">{{validationErrorText}}</span>
|
|
19
19
|
</div>
|
|
20
|
-
<div class="modal-footer">
|
|
21
|
-
<button type="submit" class="btn md-skip btn-primary btn-block" [disabled]="validationError || isSubmitting">
|
|
20
|
+
<div class="modal-footer modal-footer-write">
|
|
21
|
+
<button type="submit" class="btn md-skip btn-primary btn-primary-write btn-block" [disabled]="validationError || isSubmitting">
|
|
22
22
|
<ng-container *ngIf="!isSubmitting">{{localization.submit}}</ng-container>
|
|
23
23
|
<ng-container *ngIf="isSubmitting">{{localization.submitting}}</ng-container>
|
|
24
24
|
</button>
|
|
@@ -267,8 +267,8 @@ __decorate([
|
|
|
267
267
|
WriteValueModalComponent = __decorate([
|
|
268
268
|
Component({
|
|
269
269
|
selector: 'writeValueModal',
|
|
270
|
-
template: "<form #writeValueForm=\"ngForm\" novalidate (ngSubmit)=\"save()\" bs-modal-drag> <div class=\"modal-header\"> <h4 class=\"modal-title\"> <span>{{localization.setting}}</span> <span>{{displayVariableName}}</span> </h4> <button type=\"button\" class=\"close pull-right\" aria-label=\"Close\" (click)=\"close()\"> <span aria-hidden=\"true\">×</span> </button> </div> <div class=\"modal-body\"> <span class=\"write-value-range\">{{localization.writeValueRange}}:</span> <
|
|
271
|
-
styles: [".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; padding-top: 10px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .modal-footer { padding: 10px
|
|
270
|
+
template: "<form #writeValueForm=\"ngForm\" novalidate (ngSubmit)=\"save()\" bs-modal-drag> <div class=\"modal-header\"> <h4 class=\"modal-title\"> <span>{{localization.setting}}</span> <span>{{displayVariableName}}</span> </h4> <button type=\"button\" class=\"close pull-right\" aria-label=\"Close\" (click)=\"close()\"> <span aria-hidden=\"true\">×</span> </button> </div> <div class=\"modal-body\"> <span class=\"write-value-range\">{{localization.writeValueRange}}:</span> <span> {{writeValueRangeText}} <span *ngIf=\"valueType\">({{valueType}})</span> </span> <input type=\"text\" name=\"valueInput\" autoFocus class=\"form-control form-control-write write-value\" [(ngModel)]=\"value\" (keyup)=\"validate($event)\" autocomplete=\"off\"> <span class=\"help-block text-danger\" [hidden]=\"!validationError\">{{validationErrorText}}</span> </div> <div class=\"modal-footer modal-footer-write\"> <button type=\"submit\" class=\"btn md-skip btn-primary btn-primary-write btn-block\" [disabled]=\"validationError || isSubmitting\"> <ng-container *ngIf=\"!isSubmitting\">{{localization.submit}}</ng-container> <ng-container *ngIf=\"isSubmitting\">{{localization.submitting}}</ng-container> </button> </div> </form> ",
|
|
271
|
+
styles: [".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; padding-top: 10px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .form-control-write { margin: 0 20px; width: 410px; } .modal-footer { padding: 10px 5px 20px 5px !important; text-align: right; border-color: transparent; } .modal-footer-write { padding: 10px 5px 20px 5px !important; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 5px 0px 0px 15px; } .btn-primary { background-color: #3B97FC; border-color: #3B97FC; padding: 5px 30px; width: 90%; margin: 0 5%; height: 32px; } .btn-primary-write { width: 410px; margin: 0 15px; } .write-value-range { color: #7f939e; font-size: 14px; margin-left: 15px; } .write-value { padding-left: 8px; margin-left: 16px; height: 32px; } "]
|
|
272
272
|
}),
|
|
273
273
|
__param(0, Inject(LOCALIZATION)),
|
|
274
274
|
__metadata("design:paramtypes", [Object, DataTypeService,
|
|
@@ -21,12 +21,21 @@
|
|
|
21
21
|
width: 90%;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
.form-control-write {
|
|
25
|
+
margin: 0 20px;
|
|
26
|
+
width: 410px;
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
.modal-footer {
|
|
25
|
-
padding: 10px
|
|
30
|
+
padding: 10px 5px 20px 5px !important;
|
|
26
31
|
text-align: right;
|
|
27
32
|
border-color: transparent;
|
|
28
33
|
}
|
|
29
34
|
|
|
35
|
+
.modal-footer-write {
|
|
36
|
+
padding: 10px 5px 20px 5px !important;
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
.text-danger {
|
|
31
40
|
display: block;
|
|
32
41
|
color: #ed6b75;
|
|
@@ -43,6 +52,11 @@
|
|
|
43
52
|
height: 32px;
|
|
44
53
|
}
|
|
45
54
|
|
|
55
|
+
.btn-primary-write {
|
|
56
|
+
width: 410px;
|
|
57
|
+
margin: 0 15px;
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
.write-value-range {
|
|
47
61
|
color: #7f939e;
|
|
48
62
|
font-size: 14px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"WriteValueModalComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":10,"character":1},"arguments":[{"selector":"writeValueModal","template":"<form #writeValueForm=\"ngForm\" novalidate (ngSubmit)=\"save()\" bs-modal-drag> <div class=\"modal-header\"> <h4 class=\"modal-title\"> <span>{{localization.setting}}</span> <span>{{displayVariableName}}</span> </h4> <button type=\"button\" class=\"close pull-right\" aria-label=\"Close\" (click)=\"close()\"> <span aria-hidden=\"true\">×</span> </button> </div> <div class=\"modal-body\"> <span class=\"write-value-range\">{{localization.writeValueRange}}:</span> <
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"WriteValueModalComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":10,"character":1},"arguments":[{"selector":"writeValueModal","template":"<form #writeValueForm=\"ngForm\" novalidate (ngSubmit)=\"save()\" bs-modal-drag> <div class=\"modal-header\"> <h4 class=\"modal-title\"> <span>{{localization.setting}}</span> <span>{{displayVariableName}}</span> </h4> <button type=\"button\" class=\"close pull-right\" aria-label=\"Close\" (click)=\"close()\"> <span aria-hidden=\"true\">×</span> </button> </div> <div class=\"modal-body\"> <span class=\"write-value-range\">{{localization.writeValueRange}}:</span> <span> {{writeValueRangeText}} <span *ngIf=\"valueType\">({{valueType}})</span> </span> <input type=\"text\" name=\"valueInput\" autoFocus class=\"form-control form-control-write write-value\" [(ngModel)]=\"value\" (keyup)=\"validate($event)\" autocomplete=\"off\"> <span class=\"help-block text-danger\" [hidden]=\"!validationError\">{{validationErrorText}}</span> </div> <div class=\"modal-footer modal-footer-write\"> <button type=\"submit\" class=\"btn md-skip btn-primary btn-primary-write btn-block\" [disabled]=\"validationError || isSubmitting\"> <ng-container *ngIf=\"!isSubmitting\">{{localization.submit}}</ng-container> <ng-container *ngIf=\"isSubmitting\">{{localization.submitting}}</ng-container> </button> </div> </form> ","styles":[".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; padding-top: 10px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .form-control-write { margin: 0 20px; width: 410px; } .modal-footer { padding: 10px 5px 20px 5px !important; text-align: right; border-color: transparent; } .modal-footer-write { padding: 10px 5px 20px 5px !important; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 5px 0px 0px 15px; } .btn-primary { background-color: #3B97FC; border-color: #3B97FC; padding: 5px 30px; width: 90%; margin: 0 5%; height: 32px; } .btn-primary-write { width: 410px; margin: 0 15px; } .write-value-range { color: #7f939e; font-size: 14px; margin-left: 15px; } .write-value { padding-left: 8px; margin-left: 16px; height: 32px; } "]}]}],"members":{"invalidErrorText":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":45,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":51,"character":9},"arguments":[{"__symbolic":"reference","module":"../../localization","name":"LOCALIZATION","line":51,"character":16}]}],null,null,null,null],"parameters":[{"__symbolic":"reference","module":"../../localization","name":"Localization","line":51,"character":51},{"__symbolic":"reference","module":"../../utils/data-type/data-type.service","name":"DataTypeService","line":52,"character":42},{"__symbolic":"reference","module":"../../utils/fraction-digit.service","name":"FractionDigitService","line":53,"character":47},{"__symbolic":"reference","module":"../../utils/numerical-operation.service","name":"NumericalOperationService","line":54,"character":52},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalRef","line":55,"character":37}]}],"ngOnInit":[{"__symbolic":"method"}],"initData":[{"__symbolic":"method"}],"setValueRangeAccordToDataParsed":[{"__symbolic":"method"}],"getWriteValueRangeText":[{"__symbolic":"method"}],"save":[{"__symbolic":"method"}],"handleCurrentLanguageIdSave":[{"__symbolic":"method"}],"close":[{"__symbolic":"method"}],"validate":[{"__symbolic":"method"}],"showValidationErrorInfo":[{"__symbolic":"method"}],"hideValidationErrorInfo":[{"__symbolic":"method"}],"getFractionDigits":[{"__symbolic":"method"}],"formatWriteValue":[{"__symbolic":"method"}]}}}}]
|