@flexem/fc-gui 3.0.0-alpha.147 → 3.0.0-alpha.149
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 +64 -24
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +4 -4
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/scroll-alarm/scroll-alarm-element.d.ts +2 -0
- package/elements/scroll-alarm/scroll-alarm-element.js +52 -24
- package/elements/scroll-alarm/scroll-alarm-element.metadata.json +1 -1
- package/modal/write-value/write-value-modal.component.js +12 -0
- package/package.json +1 -1
|
@@ -42527,9 +42527,9 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42527
42527
|
clipPath.setAttribute('id', clipId);
|
|
42528
42528
|
const clipRect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
|
42529
42529
|
clipRect.setAttribute('x', '2');
|
|
42530
|
-
clipRect.setAttribute('y', '
|
|
42530
|
+
clipRect.setAttribute('y', '1');
|
|
42531
42531
|
clipRect.setAttribute('width', (elementWidth - 4).toString());
|
|
42532
|
-
clipRect.setAttribute('height', elementHeight.toString());
|
|
42532
|
+
clipRect.setAttribute('height', (elementHeight - 2).toString());
|
|
42533
42533
|
clipPath.appendChild(clipRect);
|
|
42534
42534
|
defs.appendChild(clipPath);
|
|
42535
42535
|
this.$element[0].appendChild(defs);
|
|
@@ -42559,8 +42559,10 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42559
42559
|
_createSvgTextNode(textContent) {
|
|
42560
42560
|
const elementHeight = this.model.size.height;
|
|
42561
42561
|
const fa = this._buildFontAttrs();
|
|
42562
|
+
const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
|
|
42562
42563
|
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
42563
|
-
|
|
42564
|
+
const textY = elementHeight / 2;
|
|
42565
|
+
text.setAttribute('y', textY.toString());
|
|
42564
42566
|
text.setAttribute('dominant-baseline', 'central');
|
|
42565
42567
|
text.setAttribute('fill', fa.color);
|
|
42566
42568
|
text.setAttribute('font-size', fa.fontSize.toString());
|
|
@@ -42571,11 +42573,41 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42571
42573
|
if (fa.isItalic) {
|
|
42572
42574
|
text.setAttribute('font-style', 'italic');
|
|
42573
42575
|
}
|
|
42576
|
+
// 不使用 SVG text-decoration,避免跨平台下划线位置不一致(Chrome/Android 与 iOS Safari 渲染差异)
|
|
42577
|
+
text.textContent = textContent;
|
|
42578
|
+
g.appendChild(text);
|
|
42574
42579
|
if (fa.isUnderline) {
|
|
42575
|
-
|
|
42580
|
+
// dominant-baseline: central 下,基线约在 textY + fontSize*0.35
|
|
42581
|
+
// 下划线紧贴文字底部(基线下 fontSize*0.1),再加 2px 间距避免与字形粘连
|
|
42582
|
+
// stroke-width 随字号缩放,参照浏览器标准约 fontSize/14,最小 1px
|
|
42583
|
+
const lineY = textY + Math.round(fa.fontSize * 0.35) + Math.round(fa.fontSize * 0.1) + 2;
|
|
42584
|
+
const strokeWidth = Math.max(1, Math.round(fa.fontSize / 14));
|
|
42585
|
+
const underline = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
|
42586
|
+
underline.setAttribute('y1', lineY.toString());
|
|
42587
|
+
underline.setAttribute('y2', lineY.toString());
|
|
42588
|
+
underline.setAttribute('x1', '0');
|
|
42589
|
+
underline.setAttribute('x2', '0'); // 宽度在 append 后由 _updateUnderlineWidth 设置
|
|
42590
|
+
underline.setAttribute('stroke', fa.color);
|
|
42591
|
+
underline.setAttribute('stroke-width', strokeWidth.toString());
|
|
42592
|
+
underline.setAttribute('class', 'text-underline');
|
|
42593
|
+
g.appendChild(underline);
|
|
42594
|
+
}
|
|
42595
|
+
return g;
|
|
42596
|
+
}
|
|
42597
|
+
_getSvgTextWidth(g) {
|
|
42598
|
+
const text = g.querySelector('text');
|
|
42599
|
+
if (!text) {
|
|
42600
|
+
return 100;
|
|
42601
|
+
}
|
|
42602
|
+
return text.getComputedTextLength
|
|
42603
|
+
? text.getComputedTextLength()
|
|
42604
|
+
: (text.getBBox ? text.getBBox().width : 100);
|
|
42605
|
+
}
|
|
42606
|
+
_updateUnderlineWidth(g, width) {
|
|
42607
|
+
const underline = g.querySelector('line.text-underline');
|
|
42608
|
+
if (underline) {
|
|
42609
|
+
underline.setAttribute('x2', width.toString());
|
|
42576
42610
|
}
|
|
42577
|
-
text.textContent = textContent;
|
|
42578
|
-
return text;
|
|
42579
42611
|
}
|
|
42580
42612
|
renderNewPage(pageData) {
|
|
42581
42613
|
const GAP = 80;
|
|
@@ -42607,11 +42639,10 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42607
42639
|
contentParts.push(stateMap[alarm.state] || (isChinese ? '触发/未确认' : 'Triggered/Unconfirmed'));
|
|
42608
42640
|
}
|
|
42609
42641
|
const textNode = this._createSvgTextNode(contentParts.join(' '));
|
|
42610
|
-
textNode.setAttribute('
|
|
42642
|
+
textNode.setAttribute('transform', `translate(${xOffset}, 0)`);
|
|
42611
42643
|
this.allAlarmsContainer.appendChild(textNode);
|
|
42612
|
-
const textWidth = textNode
|
|
42613
|
-
|
|
42614
|
-
: (textNode.getBBox ? textNode.getBBox().width : 100);
|
|
42644
|
+
const textWidth = this._getSvgTextWidth(textNode);
|
|
42645
|
+
this._updateUnderlineWidth(textNode, textWidth);
|
|
42615
42646
|
xOffset += textWidth + GAP;
|
|
42616
42647
|
pageWidth += (pageWidth > 0 ? GAP : 0) + textWidth;
|
|
42617
42648
|
});
|
|
@@ -42622,10 +42653,9 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42622
42653
|
const GAP = 80;
|
|
42623
42654
|
let x = 0;
|
|
42624
42655
|
Array.from(this.allAlarmsContainer.children).forEach(node => {
|
|
42625
|
-
node.setAttribute('
|
|
42626
|
-
const w = node
|
|
42627
|
-
|
|
42628
|
-
: (node.getBBox ? node.getBBox().width : 100);
|
|
42656
|
+
node.setAttribute('transform', `translate(${x}, 0)`);
|
|
42657
|
+
const w = this._getSvgTextWidth(node);
|
|
42658
|
+
this._updateUnderlineWidth(node, w);
|
|
42629
42659
|
x += w + GAP;
|
|
42630
42660
|
});
|
|
42631
42661
|
const newTotal = x > 0 ? x - GAP : 0;
|
|
@@ -42642,14 +42672,13 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42642
42672
|
elementsToRemove.forEach(el => {
|
|
42643
42673
|
this.allAlarmsContainer.removeChild(el);
|
|
42644
42674
|
});
|
|
42645
|
-
//
|
|
42675
|
+
// g 元素的 transform 从 0 重排(DOM删除后剩余节点要重新编排位置)
|
|
42646
42676
|
const GAP = 80;
|
|
42647
42677
|
let x = 0;
|
|
42648
42678
|
Array.from(this.allAlarmsContainer.children).forEach(node => {
|
|
42649
|
-
node.setAttribute('
|
|
42650
|
-
const w = node
|
|
42651
|
-
|
|
42652
|
-
: (node.getBBox ? node.getBBox().width : 100);
|
|
42679
|
+
node.setAttribute('transform', `translate(${x}, 0)`);
|
|
42680
|
+
const w = this._getSvgTextWidth(node);
|
|
42681
|
+
this._updateUnderlineWidth(node, w);
|
|
42653
42682
|
x += w + GAP;
|
|
42654
42683
|
});
|
|
42655
42684
|
// currentLeft 补偿被移除页的宽度(含 gap),保持视觉位置不变
|
|
@@ -42859,14 +42888,13 @@ class scroll_alarm_element_ScrollAlarmElement extends conditional_dynamic_displa
|
|
|
42859
42888
|
}
|
|
42860
42889
|
// 创建 SVG text 节点(与真实运行模式一致,不依赖 foreignObject)
|
|
42861
42890
|
const textNode = this._createSvgTextNode(textParts.join(' '));
|
|
42862
|
-
textNode.setAttribute('
|
|
42891
|
+
textNode.setAttribute('transform', 'translate(0, 0)');
|
|
42863
42892
|
this.currentLeft = this.model.size.width;
|
|
42864
42893
|
this.allAlarmsContainer.setAttribute('transform', `translate(${this.currentLeft}, 0)`);
|
|
42865
42894
|
this.allAlarmsContainer.appendChild(textNode);
|
|
42866
|
-
// SVG text
|
|
42867
|
-
const textWidth = textNode
|
|
42868
|
-
|
|
42869
|
-
: (textNode.getBBox ? textNode.getBBox().width : 200);
|
|
42895
|
+
// SVG text 宽度通过内部 text 元素的 getComputedTextLength 获取
|
|
42896
|
+
const textWidth = this._getSvgTextWidth(textNode);
|
|
42897
|
+
this._updateUnderlineWidth(textNode, textWidth);
|
|
42870
42898
|
this.totalWidth = textWidth;
|
|
42871
42899
|
this.pageWidths.push(textWidth);
|
|
42872
42900
|
// 启动滚动(autoCycle 只控制是否循环,不控制是否滚动)
|
|
@@ -44221,7 +44249,19 @@ let WriteValueModalComponent = class WriteValueModalComponent {
|
|
|
44221
44249
|
this.validate();
|
|
44222
44250
|
}
|
|
44223
44251
|
initData(option) {
|
|
44252
|
+
var _a, _b, _c;
|
|
44224
44253
|
this.variableName = option.variableName;
|
|
44254
|
+
if (this.variableName === '当前语种ID') {
|
|
44255
|
+
const language = (_c = (_b = (_a = window.abp) === null || _a === void 0 ? void 0 : _a.localization) === null || _b === void 0 ? void 0 : _b.currentLanguage) === null || _c === void 0 ? void 0 : _c.name;
|
|
44256
|
+
const isChinese = language === 'zh-Hans' || language === 'zh';
|
|
44257
|
+
const isTraditionalChinese = language === 'zh-Hant' || language === 'zh-TW' || language === 'zh-tw';
|
|
44258
|
+
if (isTraditionalChinese) {
|
|
44259
|
+
this.variableName = '當前語種ID';
|
|
44260
|
+
}
|
|
44261
|
+
else if (!isChinese) {
|
|
44262
|
+
this.variableName = ' Current Language ID';
|
|
44263
|
+
}
|
|
44264
|
+
}
|
|
44225
44265
|
this.dataType = option.dataType;
|
|
44226
44266
|
this.fBoxDataType = option.fBoxDataType;
|
|
44227
44267
|
this.integerDigits = option.integerDigits ? option.integerDigits : 0;
|