@flexem/fc-gui 3.0.0-alpha.155 → 3.0.0-alpha.157
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 +149 -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/shared/text/text-element.d.ts +5 -0
- package/elements/shared/text/text-element.js +7 -0
- package/elements/shared/text/text-element.metadata.json +1 -1
- package/elements/shared/text/text-state-element.d.ts +10 -1
- package/elements/shared/text/text-state-element.js +29 -2
- package/elements/shared/text/text-state-element.metadata.json +1 -1
- package/elements/static-elements/hyperlink-element.d.ts +4 -0
- package/elements/static-elements/hyperlink-element.js +35 -7
- package/elements/static-elements/hyperlink-element.metadata.json +1 -1
- package/elements/static-elements/text-element.d.ts +4 -0
- package/elements/static-elements/text-element.js +44 -11
- package/elements/static-elements/text-element.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.js +1 -1
- package/elements/view-operation/view-operation.element.d.ts +4 -0
- package/elements/view-operation/view-operation.element.js +31 -1
- package/elements/view-operation/view-operation.element.metadata.json +1 -1
- package/modal/write-value/write-value-modal.component.js +2 -2
- package/model/base/font-setting-model.d.ts +10 -0
- package/model/base/font-setting-model.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -35793,6 +35793,13 @@ class text_element_TextElementModal {
|
|
|
35793
35793
|
get Element() {
|
|
35794
35794
|
return this._element;
|
|
35795
35795
|
}
|
|
35796
|
+
/**
|
|
35797
|
+
* 更新字体样式
|
|
35798
|
+
* @param font 新的字体样式
|
|
35799
|
+
*/
|
|
35800
|
+
updateFont(font) {
|
|
35801
|
+
this.font = font;
|
|
35802
|
+
}
|
|
35796
35803
|
/**
|
|
35797
35804
|
* 更新文本内容
|
|
35798
35805
|
* @param content 新的文本内容
|
|
@@ -39119,15 +39126,7 @@ class text_element_TextElement extends conditional_dynamic_display_element_Condi
|
|
|
39119
39126
|
graphStateElement.switchToState(0);
|
|
39120
39127
|
this.$element.prepend(graphStateElement.Element);
|
|
39121
39128
|
}
|
|
39122
|
-
const font =
|
|
39123
|
-
isUnderline: this.model.isUnderline,
|
|
39124
|
-
isBold: this.isBold(this.model.font),
|
|
39125
|
-
isItalic: this.isItalic(this.model.font),
|
|
39126
|
-
fontSize: this.model.fontSize,
|
|
39127
|
-
fontFamily: this.fontFamily(this.model.font),
|
|
39128
|
-
color: this.model.stroke,
|
|
39129
|
-
textAlign: this.model.textAlign
|
|
39130
|
-
};
|
|
39129
|
+
const font = this.getFontStyle();
|
|
39131
39130
|
// 获取显示文本(支持文本库)
|
|
39132
39131
|
const displayText = this.getDisplayText();
|
|
39133
39132
|
this.textElementModal = new text_element_TextElementModal(displayText, font, width, height);
|
|
@@ -39171,11 +39170,52 @@ class text_element_TextElement extends conditional_dynamic_display_element_Condi
|
|
|
39171
39170
|
if (!this.textElementModal || !this.model.size) {
|
|
39172
39171
|
return;
|
|
39173
39172
|
}
|
|
39174
|
-
//
|
|
39173
|
+
// 获取新的显示文本和样式
|
|
39175
39174
|
const displayText = this.getDisplayText();
|
|
39176
|
-
|
|
39175
|
+
const font = this.getFontStyle();
|
|
39176
|
+
// 更新样式和文本内容
|
|
39177
|
+
this.textElementModal.updateFont(font);
|
|
39177
39178
|
this.textElementModal.updateText(displayText);
|
|
39178
39179
|
}
|
|
39180
|
+
/**
|
|
39181
|
+
* 获取当前语种的字体样式
|
|
39182
|
+
*/
|
|
39183
|
+
getFontStyle() {
|
|
39184
|
+
// 获取目标语种
|
|
39185
|
+
const getTargetLanguage = () => {
|
|
39186
|
+
var _a, _b, _c, _d, _e, _f;
|
|
39187
|
+
const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
|
|
39188
|
+
const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
|
|
39189
|
+
if (currentLanguageId === null || currentLanguageId === undefined) {
|
|
39190
|
+
return defaultLanguage;
|
|
39191
|
+
}
|
|
39192
|
+
return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
|
|
39193
|
+
};
|
|
39194
|
+
const targetLanguage = getTargetLanguage();
|
|
39195
|
+
// 如果有多语种样式配置,优先使用
|
|
39196
|
+
if (this.model.fontStyleCultures && this.model.fontStyleCultures[targetLanguage]) {
|
|
39197
|
+
const style = this.model.fontStyleCultures[targetLanguage];
|
|
39198
|
+
return {
|
|
39199
|
+
isUnderline: style.isUnderline,
|
|
39200
|
+
isBold: this.isBold(style.fontStyle),
|
|
39201
|
+
isItalic: this.isItalic(style.fontStyle),
|
|
39202
|
+
fontSize: style.fontSize,
|
|
39203
|
+
fontFamily: this.fontFamily(style.fontStyle),
|
|
39204
|
+
color: style.fontColor,
|
|
39205
|
+
textAlign: style.textAlign
|
|
39206
|
+
};
|
|
39207
|
+
}
|
|
39208
|
+
// 回退到全局样式
|
|
39209
|
+
return {
|
|
39210
|
+
isUnderline: this.model.isUnderline,
|
|
39211
|
+
isBold: this.isBold(this.model.font),
|
|
39212
|
+
isItalic: this.isItalic(this.model.font),
|
|
39213
|
+
fontSize: this.model.fontSize,
|
|
39214
|
+
fontFamily: this.fontFamily(this.model.font),
|
|
39215
|
+
color: this.model.stroke,
|
|
39216
|
+
textAlign: this.model.textAlign
|
|
39217
|
+
};
|
|
39218
|
+
}
|
|
39179
39219
|
/**
|
|
39180
39220
|
* 获取显示文本
|
|
39181
39221
|
* 如果配置了文本库,则从文本库中获取对应语种的文本
|
|
@@ -39273,7 +39313,7 @@ class text_element_TextElement extends conditional_dynamic_display_element_Condi
|
|
|
39273
39313
|
// CONCATENATED MODULE: ./.tmp/elements/shared/text/text-state-element.ts
|
|
39274
39314
|
|
|
39275
39315
|
class text_state_element_TextStateElement {
|
|
39276
|
-
constructor(textStates, width, height, logger, version, faultFlickers, textLibrarySetting, textLibraryService, languageService, guiContext, allowEmpty = false) {
|
|
39316
|
+
constructor(textStates, width, height, logger, version, faultFlickers, textLibrarySetting, textLibraryService, languageService, guiContext, allowEmpty = false, fontStyleCultures) {
|
|
39277
39317
|
this.textStates = textStates;
|
|
39278
39318
|
this.width = width;
|
|
39279
39319
|
this.height = height;
|
|
@@ -39285,6 +39325,7 @@ class text_state_element_TextStateElement {
|
|
|
39285
39325
|
this.languageService = languageService;
|
|
39286
39326
|
this.guiContext = guiContext;
|
|
39287
39327
|
this.allowEmpty = allowEmpty;
|
|
39328
|
+
this.fontStyleCultures = fontStyleCultures;
|
|
39288
39329
|
this.faultFlickerStatus = false;
|
|
39289
39330
|
this.faultFlickerInterval = undefined;
|
|
39290
39331
|
this._element = document.createElementNS('http://www.w3.org/2000/svg', 'g');
|
|
@@ -39309,7 +39350,7 @@ class text_state_element_TextStateElement {
|
|
|
39309
39350
|
this.removeForeignObjectlement();
|
|
39310
39351
|
return;
|
|
39311
39352
|
}
|
|
39312
|
-
const font = textState.text.font;
|
|
39353
|
+
const font = this.getFontForState(stateId, textState.text.font);
|
|
39313
39354
|
if (!font) {
|
|
39314
39355
|
this.removeForeignObjectlement();
|
|
39315
39356
|
this.logger.debug('The font is undefined.');
|
|
@@ -39431,6 +39472,32 @@ class text_state_element_TextStateElement {
|
|
|
39431
39472
|
}
|
|
39432
39473
|
}
|
|
39433
39474
|
}
|
|
39475
|
+
/**
|
|
39476
|
+
* 获取指定状态在当前语种下的字体样式
|
|
39477
|
+
*/
|
|
39478
|
+
getFontForState(stateId, defaultFont) {
|
|
39479
|
+
if (!this.fontStyleCultures) {
|
|
39480
|
+
return defaultFont;
|
|
39481
|
+
}
|
|
39482
|
+
const stateKey = stateId.toString();
|
|
39483
|
+
if (!this.fontStyleCultures[stateKey]) {
|
|
39484
|
+
return defaultFont;
|
|
39485
|
+
}
|
|
39486
|
+
const getTargetLanguage = () => {
|
|
39487
|
+
var _a, _b, _c, _d, _e, _f;
|
|
39488
|
+
const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
|
|
39489
|
+
const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
|
|
39490
|
+
if (currentLanguageId === null || currentLanguageId === undefined) {
|
|
39491
|
+
return defaultLanguage;
|
|
39492
|
+
}
|
|
39493
|
+
return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
|
|
39494
|
+
};
|
|
39495
|
+
const targetLanguage = getTargetLanguage();
|
|
39496
|
+
if (this.fontStyleCultures[stateKey][targetLanguage]) {
|
|
39497
|
+
return this.fontStyleCultures[stateKey][targetLanguage];
|
|
39498
|
+
}
|
|
39499
|
+
return defaultFont;
|
|
39500
|
+
}
|
|
39434
39501
|
/**
|
|
39435
39502
|
* 获取显示文本
|
|
39436
39503
|
* 支持三种格式:
|
|
@@ -40140,7 +40207,7 @@ class switch_indicator_light_element_SwitchIndicatorLightElement extends conditi
|
|
|
40140
40207
|
this.graphStateElement = new graph_state_element_GraphStateElement(this.model.graphSetting, width, height, this.graphStore, this.logger, this.model.version, this.model.states);
|
|
40141
40208
|
this.$element.append(this.graphStateElement.Element);
|
|
40142
40209
|
}
|
|
40143
|
-
this.textStateElement = new text_state_element_TextStateElement(this.model.states, width, height, this.logger, this.model.version, this.model.states, this.model.textLibrary, this.textLibraryService, this.languageService, this.guiContext, true);
|
|
40210
|
+
this.textStateElement = new text_state_element_TextStateElement(this.model.states, width, height, this.logger, this.model.version, this.model.states, this.model.textLibrary, this.textLibraryService, this.languageService, this.guiContext, true, this.model.fontStyleCultures);
|
|
40144
40211
|
this.$element.append(this.textStateElement.Element);
|
|
40145
40212
|
}
|
|
40146
40213
|
/**
|
|
@@ -40585,7 +40652,7 @@ class view_operation_element_ViewOperationElement extends conditional_enable_ele
|
|
|
40585
40652
|
this.$element.find('text').remove();
|
|
40586
40653
|
this.initGraph(width, height);
|
|
40587
40654
|
this.rootElement.append('rect').attr('id', 'StateFrame').attr('width', width).attr('height', height).attr('fill', 'transparent');
|
|
40588
|
-
const font =
|
|
40655
|
+
const font = this.getFontStyle();
|
|
40589
40656
|
this.textElementModal = new text_element_TextElementModal(this.getDisplayText(), font, width, height);
|
|
40590
40657
|
this.$element.append(this.textElementModal.Element);
|
|
40591
40658
|
this.switchToState(0);
|
|
@@ -40765,11 +40832,41 @@ class view_operation_element_ViewOperationElement extends conditional_enable_ele
|
|
|
40765
40832
|
});
|
|
40766
40833
|
}
|
|
40767
40834
|
}
|
|
40835
|
+
/**
|
|
40836
|
+
* 获取当前语种的字体样式
|
|
40837
|
+
*/
|
|
40838
|
+
getFontStyle() {
|
|
40839
|
+
const getTargetLanguage = () => {
|
|
40840
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40841
|
+
const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
|
|
40842
|
+
const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
|
|
40843
|
+
if (currentLanguageId === null || currentLanguageId === undefined) {
|
|
40844
|
+
return defaultLanguage;
|
|
40845
|
+
}
|
|
40846
|
+
return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
|
|
40847
|
+
};
|
|
40848
|
+
const targetLanguage = getTargetLanguage();
|
|
40849
|
+
if (this.model.fontStyleCultures && this.model.fontStyleCultures[targetLanguage]) {
|
|
40850
|
+
const style = this.model.fontStyleCultures[targetLanguage];
|
|
40851
|
+
return {
|
|
40852
|
+
isUnderline: style.isUnderline,
|
|
40853
|
+
isBold: style.isBold,
|
|
40854
|
+
isItalic: style.isItalic,
|
|
40855
|
+
fontSize: style.fontSize,
|
|
40856
|
+
fontFamily: style.fontFamily || 'msyh',
|
|
40857
|
+
color: style.color,
|
|
40858
|
+
textAlign: style.textAlign
|
|
40859
|
+
};
|
|
40860
|
+
}
|
|
40861
|
+
return Object.assign(Object.assign({}, this.model.label.font), { fontFamily: this.model.label.font.fontFamily || 'msyh' });
|
|
40862
|
+
}
|
|
40768
40863
|
/**
|
|
40769
40864
|
* 更新文本内容(支持文本库和语种切换)
|
|
40770
40865
|
*/
|
|
40771
40866
|
updateTextContent() {
|
|
40772
40867
|
if (this.textElementModal) {
|
|
40868
|
+
const font = this.getFontStyle();
|
|
40869
|
+
this.textElementModal.updateFont(font);
|
|
40773
40870
|
this.textElementModal.updateText(this.getDisplayText());
|
|
40774
40871
|
}
|
|
40775
40872
|
}
|
|
@@ -40987,9 +41084,9 @@ class hyperlink_element_HyperlinkElement extends conditional_dynamic_display_ele
|
|
|
40987
41084
|
if (!this.textElementModal || !this.model.size) {
|
|
40988
41085
|
return;
|
|
40989
41086
|
}
|
|
40990
|
-
// 获取新的显示文本
|
|
40991
41087
|
const displayText = this.getDisplayText();
|
|
40992
|
-
|
|
41088
|
+
const font = this.getFontStyle();
|
|
41089
|
+
this.textElementModal.updateFont(font);
|
|
40993
41090
|
this.textElementModal.updateText(displayText);
|
|
40994
41091
|
}
|
|
40995
41092
|
initGraphAndText() {
|
|
@@ -41003,7 +41100,39 @@ class hyperlink_element_HyperlinkElement extends conditional_dynamic_display_ele
|
|
|
41003
41100
|
graphStateElement.switchToState(0);
|
|
41004
41101
|
this.$element.prepend(graphStateElement.Element);
|
|
41005
41102
|
}
|
|
41006
|
-
const font =
|
|
41103
|
+
const font = this.getFontStyle();
|
|
41104
|
+
// 获取显示文本(支持文本库)
|
|
41105
|
+
const displayText = this.getDisplayText();
|
|
41106
|
+
this.textElementModal = new text_element_TextElementModal(displayText, font, width, height);
|
|
41107
|
+
this.$element.append(this.textElementModal.Element);
|
|
41108
|
+
}
|
|
41109
|
+
/**
|
|
41110
|
+
* 获取当前语种的字体样式
|
|
41111
|
+
*/
|
|
41112
|
+
getFontStyle() {
|
|
41113
|
+
const getTargetLanguage = () => {
|
|
41114
|
+
var _a, _b, _c, _d, _e, _f;
|
|
41115
|
+
const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
|
|
41116
|
+
const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
|
|
41117
|
+
if (currentLanguageId === null || currentLanguageId === undefined) {
|
|
41118
|
+
return defaultLanguage;
|
|
41119
|
+
}
|
|
41120
|
+
return ((_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId)) || defaultLanguage;
|
|
41121
|
+
};
|
|
41122
|
+
const targetLanguage = getTargetLanguage();
|
|
41123
|
+
if (this.model.fontStyleCultures && this.model.fontStyleCultures[targetLanguage]) {
|
|
41124
|
+
const style = this.model.fontStyleCultures[targetLanguage];
|
|
41125
|
+
return {
|
|
41126
|
+
isUnderline: style.isUnderline,
|
|
41127
|
+
isBold: this.isBold(style.fontStyle),
|
|
41128
|
+
isItalic: this.isItalic(style.fontStyle),
|
|
41129
|
+
fontSize: style.fontSize,
|
|
41130
|
+
fontFamily: this.fontFamily(style.fontStyle),
|
|
41131
|
+
color: style.fontColor,
|
|
41132
|
+
textAlign: style.textAlign
|
|
41133
|
+
};
|
|
41134
|
+
}
|
|
41135
|
+
return {
|
|
41007
41136
|
isUnderline: this.model.isUnderline,
|
|
41008
41137
|
isBold: this.isBold(this.model.font),
|
|
41009
41138
|
isItalic: this.isItalic(this.model.font),
|
|
@@ -41012,10 +41141,6 @@ class hyperlink_element_HyperlinkElement extends conditional_dynamic_display_ele
|
|
|
41012
41141
|
color: this.model.stroke,
|
|
41013
41142
|
textAlign: this.model.textAlign
|
|
41014
41143
|
};
|
|
41015
|
-
// 获取显示文本(支持文本库)
|
|
41016
|
-
const displayText = this.getDisplayText();
|
|
41017
|
-
this.textElementModal = new text_element_TextElementModal(displayText, font, width, height);
|
|
41018
|
-
this.$element.append(this.textElementModal.Element);
|
|
41019
41144
|
}
|
|
41020
41145
|
/**
|
|
41021
41146
|
* 获取显示文本
|
|
@@ -44291,11 +44416,11 @@ let WriteValueModalComponent = class WriteValueModalComponent {
|
|
|
44291
44416
|
this.validate();
|
|
44292
44417
|
}
|
|
44293
44418
|
initData(option) {
|
|
44294
|
-
var _a, _b, _c;
|
|
44419
|
+
var _a, _b, _c, _d, _e;
|
|
44295
44420
|
this.variableName = option.variableName;
|
|
44296
44421
|
this.displayVariableName = this.variableName;
|
|
44297
44422
|
if (this.variableName === '当前语种ID') {
|
|
44298
|
-
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;
|
|
44423
|
+
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) || ((_e = (_d = this.localization.localizationService) === null || _d === void 0 ? void 0 : _d.translate) === null || _e === void 0 ? void 0 : _e.currentLang);
|
|
44299
44424
|
const isTraditionalChinese = language === 'zh-Hant' || language === 'zh-TW' || language === 'zh-tw';
|
|
44300
44425
|
const isChinese = language === 'zh-Hans' || language === 'zh';
|
|
44301
44426
|
if (isTraditionalChinese) {
|