refactoring
This commit is contained in:
parent
2134a17f46
commit
69f0aa9691
@ -44,7 +44,8 @@ import {
|
|||||||
CalculatedFieldTestScriptDialogData,
|
CalculatedFieldTestScriptDialogData,
|
||||||
getCalculatedFieldArgumentsEditorCompleter,
|
getCalculatedFieldArgumentsEditorCompleter,
|
||||||
getCalculatedFieldArgumentsHighlights,
|
getCalculatedFieldArgumentsHighlights,
|
||||||
CalculatedFieldTypeTranslations, CalculatedFieldType,
|
CalculatedFieldTypeTranslations,
|
||||||
|
CalculatedFieldType,
|
||||||
} from '@shared/models/calculated-field.models';
|
} from '@shared/models/calculated-field.models';
|
||||||
import {
|
import {
|
||||||
CalculatedFieldDebugDialogComponent,
|
CalculatedFieldDebugDialogComponent,
|
||||||
|
|||||||
@ -36,7 +36,6 @@ import {
|
|||||||
AceHighlightRules,
|
AceHighlightRules,
|
||||||
dotOperatorHighlightRule,
|
dotOperatorHighlightRule,
|
||||||
endGroupHighlightRule,
|
endGroupHighlightRule,
|
||||||
identifierRe
|
|
||||||
} from '@shared/models/ace/ace.models';
|
} from '@shared/models/ace/ace.models';
|
||||||
import { HelpLinks, ValueType } from '@shared/models/constants';
|
import { HelpLinks, ValueType } from '@shared/models/constants';
|
||||||
import { formPropertyCompletions } from '@shared/models/dynamic-form.models';
|
import { formPropertyCompletions } from '@shared/models/dynamic-form.models';
|
||||||
@ -925,6 +924,8 @@ export class ScadaSymbolElement {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const identifierRe = /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*/;
|
||||||
|
|
||||||
const scadaSymbolCtxObjectHighlightRule: AceHighlightRule = {
|
const scadaSymbolCtxObjectHighlightRule: AceHighlightRule = {
|
||||||
token: 'tb.scada-symbol-ctx',
|
token: 'tb.scada-symbol-ctx',
|
||||||
regex: /\bctx\b/,
|
regex: /\bctx\b/,
|
||||||
|
|||||||
@ -587,6 +587,10 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal
|
|||||||
newMode.$highlightRules.$rules[group] = this.highlightRules[group];
|
newMode.$highlightRules.$rules[group] = this.highlightRules[group];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const identifierRule = newMode.$highlightRules.$rules.no_regex.find(rule => rule.token?.includes('identifier'));
|
||||||
|
if (identifierRule) {
|
||||||
|
identifierRule.next = 'start';
|
||||||
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this.jsEditor.session.$onChangeMode(newMode);
|
this.jsEditor.session.$onChangeMode(newMode);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -376,7 +376,4 @@ export const endGroupHighlightRule: AceHighlightRule = {
|
|||||||
next: 'no_regex'
|
next: 'no_regex'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const identifierRe = /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*/;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,6 @@ import {
|
|||||||
AceHighlightRules,
|
AceHighlightRules,
|
||||||
dotOperatorHighlightRule,
|
dotOperatorHighlightRule,
|
||||||
endGroupHighlightRule,
|
endGroupHighlightRule,
|
||||||
identifierRe
|
|
||||||
} from '@shared/models/ace/ace.models';
|
} from '@shared/models/ace/ace.models';
|
||||||
|
|
||||||
export interface CalculatedField extends Omit<BaseData<CalculatedFieldId>, 'label'>, HasVersion, HasEntityDebugSettings, HasTenantId, ExportableEntity<CalculatedFieldId> {
|
export interface CalculatedField extends Omit<BaseData<CalculatedFieldId>, 'label'>, HasVersion, HasEntityDebugSettings, HasTenantId, ExportableEntity<CalculatedFieldId> {
|
||||||
@ -536,17 +535,6 @@ export const getCalculatedFieldArgumentsHighlights = (
|
|||||||
? 'calculatedFieldRollingArgumentValue'
|
? 'calculatedFieldRollingArgumentValue'
|
||||||
: 'calculatedFieldSingleArgumentValue'
|
: 'calculatedFieldSingleArgumentValue'
|
||||||
})),
|
})),
|
||||||
no_regex: [
|
|
||||||
{
|
|
||||||
token: 'tb.identifier',
|
|
||||||
regex: identifierRe,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
token: 'tb.paren.lparen',
|
|
||||||
regex: '\\(',
|
|
||||||
next: 'start'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
...calculatedFieldSingleArgumentValueHighlightRules,
|
...calculatedFieldSingleArgumentValueHighlightRules,
|
||||||
...calculatedFieldRollingArgumentValueHighlightRules,
|
...calculatedFieldRollingArgumentValueHighlightRules,
|
||||||
...calculatedFieldTimeWindowArgumentValueHighlightRules
|
...calculatedFieldTimeWindowArgumentValueHighlightRules
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user