Browse Source

fixed highlight bug

pull/12719/head
mpetrov 2 years ago
parent
commit
25f5027135
  1. 2
      ui-ngx/src/app/modules/home/components/calculated-fields/components/test-arguments/calculated-field-test-arguments.component.ts
  2. 18
      ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol-editor.models.ts
  3. 11
      ui-ngx/src/app/shared/models/ace/ace.models.ts
  4. 14
      ui-ngx/src/app/shared/models/calculated-field.models.ts

2
ui-ngx/src/app/modules/home/components/calculated-fields/components/test-arguments/calculated-field-test-arguments.component.ts

@ -139,7 +139,7 @@ export class CalculatedFieldTestArgumentsComponent extends PageComponent impleme
private getValue(): CalculatedFieldEventArguments {
return this.argumentsFormArray.getRawValue().reduce((acc, rowItem) => {
const { argumentName, rollingJson = {}, ...value } = rowItem;
acc[argumentName] = { ...rollingJson, ...value};
acc[argumentName] = { ...rollingJson, ...value };
return acc;
}, {});
}

18
ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol-editor.models.ts

@ -31,7 +31,12 @@ import {
} from '@home/components/widget/lib/scada/scada-symbol.models';
import { TbEditorCompletion, TbEditorCompletions } from '@shared/models/ace/completion.models';
import { CustomTranslatePipe } from '@shared/pipe/custom-translate.pipe';
import { AceHighlightRule, AceHighlightRules } from '@shared/models/ace/ace.models';
import {
AceHighlightRule,
AceHighlightRules,
dotOperatorHighlightRule,
endGroupHighlightRule
} from '@shared/models/ace/ace.models';
import { HelpLinks, ValueType } from '@shared/models/constants';
import { formPropertyCompletions } from '@shared/models/dynamic-form.models';
import ITooltipsterInstance = JQueryTooltipster.ITooltipsterInstance;
@ -921,17 +926,6 @@ export class ScadaSymbolElement {
const identifierRe = /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*/;
const dotOperatorHighlightRule: AceHighlightRule = {
token: 'punctuation.operator',
regex: /[.](?![.])/,
};
const endGroupHighlightRule: AceHighlightRule = {
regex: '',
token: 'empty',
next: 'no_regex'
};
const scadaSymbolCtxObjectHighlightRule: AceHighlightRule = {
token: 'tb.scada-symbol-ctx',
regex: /\bctx\b/,

11
ui-ngx/src/app/shared/models/ace/ace.models.ts

@ -365,5 +365,16 @@ export interface AceHighlightRule {
next?: string;
}
export const dotOperatorHighlightRule: AceHighlightRule = {
token: 'punctuation.operator',
regex: /[.](?![.])/,
};
export const endGroupHighlightRule: AceHighlightRule = {
regex: '',
token: 'empty',
next: 'no_regex'
};

14
ui-ngx/src/app/shared/models/calculated-field.models.ts

@ -28,7 +28,11 @@ import { EntityType } from '@shared/models/entity-type.models';
import { AliasFilterType } from '@shared/models/alias.models';
import { Observable } from 'rxjs';
import { TbEditorCompleter } from '@shared/models/ace/completion.models';
import { AceHighlightRules } from '@shared/models/ace/ace.models';
import {
AceHighlightRules,
dotOperatorHighlightRule,
endGroupHighlightRule
} from '@shared/models/ace/ace.models';
export interface CalculatedField extends Omit<BaseData<CalculatedFieldId>, 'label'>, HasVersion, HasTenantId, ExportableEntity<CalculatedFieldId> {
debugSettings?: EntityDebugSettings;
@ -337,6 +341,7 @@ export const getCalculatedFieldArgumentsHighlights = (
const calculatedFieldSingleArgumentValueHighlightRules: AceHighlightRules = {
calculatedFieldSingleArgumentValue: [
dotOperatorHighlightRule,
{
token: 'tb.calculated-field-value',
regex: /value/,
@ -346,12 +351,14 @@ const calculatedFieldSingleArgumentValueHighlightRules: AceHighlightRules = {
token: 'tb.calculated-field-ts',
regex: /ts/,
next: 'no_regex'
}
},
endGroupHighlightRule
],
}
const calculatedFieldRollingArgumentValueHighlightRules: AceHighlightRules = {
calculatedFieldRollingArgumentValue: [
dotOperatorHighlightRule,
{
token: 'tb.calculated-field-values',
regex: /values/,
@ -361,7 +368,8 @@ const calculatedFieldRollingArgumentValueHighlightRules: AceHighlightRules = {
token: 'tb.calculated-field-time-window',
regex: /timeWindow/,
next: 'calculatedFieldRollingArgumentTimeWindow'
}
},
endGroupHighlightRule
],
}

Loading…
Cancel
Save