Browse Source

refactoring

pull/12820/head
mpetrov 2 years ago
parent
commit
69f0aa9691
  1. 3
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts
  2. 3
      ui-ngx/src/app/modules/home/pages/scada-symbol/scada-symbol-editor.models.ts
  3. 4
      ui-ngx/src/app/shared/components/js-func.component.ts
  4. 3
      ui-ngx/src/app/shared/models/ace/ace.models.ts
  5. 12
      ui-ngx/src/app/shared/models/calculated-field.models.ts

3
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts

@ -44,7 +44,8 @@ import {
CalculatedFieldTestScriptDialogData,
getCalculatedFieldArgumentsEditorCompleter,
getCalculatedFieldArgumentsHighlights,
CalculatedFieldTypeTranslations, CalculatedFieldType,
CalculatedFieldTypeTranslations,
CalculatedFieldType,
} from '@shared/models/calculated-field.models';
import {
CalculatedFieldDebugDialogComponent,

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

@ -36,7 +36,6 @@ import {
AceHighlightRules,
dotOperatorHighlightRule,
endGroupHighlightRule,
identifierRe
} from '@shared/models/ace/ace.models';
import { HelpLinks, ValueType } from '@shared/models/constants';
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 = {
token: 'tb.scada-symbol-ctx',
regex: /\bctx\b/,

4
ui-ngx/src/app/shared/components/js-func.component.ts

@ -587,6 +587,10 @@ export class JsFuncComponent implements OnInit, OnChanges, OnDestroy, ControlVal
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
this.jsEditor.session.$onChangeMode(newMode);
}

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

@ -376,7 +376,4 @@ export const endGroupHighlightRule: AceHighlightRule = {
next: 'no_regex'
};
export const identifierRe = /[a-zA-Z$_\u00a1-\uffff][a-zA-Z\d$_\u00a1-\uffff]*/;

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

@ -33,7 +33,6 @@ import {
AceHighlightRules,
dotOperatorHighlightRule,
endGroupHighlightRule,
identifierRe
} from '@shared/models/ace/ace.models';
export interface CalculatedField extends Omit<BaseData<CalculatedFieldId>, 'label'>, HasVersion, HasEntityDebugSettings, HasTenantId, ExportableEntity<CalculatedFieldId> {
@ -536,17 +535,6 @@ export const getCalculatedFieldArgumentsHighlights = (
? 'calculatedFieldRollingArgumentValue'
: 'calculatedFieldSingleArgumentValue'
})),
no_regex: [
{
token: 'tb.identifier',
regex: identifierRe,
},
{
token: 'tb.paren.lparen',
regex: '\\(',
next: 'start'
}
],
...calculatedFieldSingleArgumentValueHighlightRules,
...calculatedFieldRollingArgumentValueHighlightRules,
...calculatedFieldTimeWindowArgumentValueHighlightRules

Loading…
Cancel
Save