@ebuilding/base 2.3.3 → 2.3.4
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/components/codemirror/src/index.module.d.ts +1 -1
- package/components/codemirror/src/main/common-enhanced.d.ts +51 -0
- package/components/codemirror/src/{tools/formula.d.ts → main/common-formula.d.ts} +2 -2
- package/components/codemirror/src/main/formula-enhanced.d.ts +84 -0
- package/components/codemirror/src/main/index.component.d.ts +75 -0
- package/components/codemirror/src/public_api.d.ts +1 -1
- package/fesm2022/components.codemirror.mjs +1068 -1478
- package/fesm2022/components.codemirror.mjs.map +1 -1
- package/package.json +229 -229
- package/components/codemirror/src/default/index.d.ts +0 -210
- package/components/codemirror/src/tools/common.d.ts +0 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import * as i1 from "./
|
|
2
|
+
import * as i1 from "./main/index.component";
|
|
3
3
|
export declare class GramCodemirrorModule {
|
|
4
4
|
static ɵfac: i0.ɵɵFactoryDeclaration<GramCodemirrorModule, never>;
|
|
5
5
|
static ɵmod: i0.ɵɵNgModuleDeclaration<GramCodemirrorModule, never, [typeof i1.GramCodemirrorComponent], [typeof i1.GramCodemirrorComponent]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare function searchUsageFun(value: string, formulaList: any[]): any[];
|
|
2
|
+
export declare function searchVariable(value: string, fieldData: any): any[];
|
|
3
|
+
export declare function searchArrayVariable(value: string, fieldDataArray: any[]): any[];
|
|
4
|
+
export interface ValidationError {
|
|
5
|
+
message: string;
|
|
6
|
+
severity: 'error' | 'warning' | 'info';
|
|
7
|
+
line?: number;
|
|
8
|
+
column?: number;
|
|
9
|
+
type?: 'syntax' | 'semantic' | 'runtime';
|
|
10
|
+
}
|
|
11
|
+
export interface ValidationResult {
|
|
12
|
+
isValid: boolean;
|
|
13
|
+
errors: ValidationError[];
|
|
14
|
+
warnings: ValidationError[];
|
|
15
|
+
ast?: any;
|
|
16
|
+
}
|
|
17
|
+
export interface SuggestionItem {
|
|
18
|
+
text: string;
|
|
19
|
+
displayText: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
type?: 'function' | 'variable' | 'keyword';
|
|
22
|
+
description?: string;
|
|
23
|
+
usage?: string;
|
|
24
|
+
category?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 增强的公式验证器
|
|
28
|
+
*/
|
|
29
|
+
export declare class FormulaValidator {
|
|
30
|
+
static validateSyntax(formula: string): ValidationError[];
|
|
31
|
+
static validateSemantics(formula: string, availableFunctions: string[]): ValidationError[];
|
|
32
|
+
static validateFormula(formula: string, availableFunctions: string[]): ValidationResult;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 增强的智能提示服务
|
|
36
|
+
*/
|
|
37
|
+
export declare class SmartSuggestionService {
|
|
38
|
+
static getSuggestions(text: string, cursorPos: number, formulaList: any[], fieldData: any, searchType?: 'variable' | 'function' | 'all'): SuggestionItem[];
|
|
39
|
+
private static getLineText;
|
|
40
|
+
private static getVariableSuggestions;
|
|
41
|
+
private static getFunctionSuggestions;
|
|
42
|
+
private static sortSuggestions;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 公式高亮服务
|
|
46
|
+
*/
|
|
47
|
+
export declare class FormulaHighlighter {
|
|
48
|
+
static highlightErrors(codeMirror: any, errors: ValidationError[]): void;
|
|
49
|
+
static clearHighlights(codeMirror: any): void;
|
|
50
|
+
static highlightVariable(codeMirror: any, variable: string, label: string): void;
|
|
51
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { InjectionToken } from "@angular/core";
|
|
2
|
-
export declare const KRE_CODEMIRROR_TOKEN: InjectionToken<any>;
|
|
3
1
|
export declare class Formula {
|
|
4
2
|
FormulaUsage: {
|
|
5
3
|
category: string;
|
|
@@ -28,4 +26,6 @@ export declare class Formula {
|
|
|
28
26
|
Utils: any;
|
|
29
27
|
Formula: any;
|
|
30
28
|
constructor();
|
|
29
|
+
private initUtils;
|
|
30
|
+
private initFormula;
|
|
31
31
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Formula } from './common-formula';
|
|
2
|
+
export interface ValidationError {
|
|
3
|
+
message: string;
|
|
4
|
+
severity: 'error' | 'warning' | 'info';
|
|
5
|
+
line?: number;
|
|
6
|
+
column?: number;
|
|
7
|
+
type?: 'syntax' | 'semantic' | 'runtime';
|
|
8
|
+
}
|
|
9
|
+
export interface ValidationResult {
|
|
10
|
+
isValid: boolean;
|
|
11
|
+
errors: ValidationError[];
|
|
12
|
+
warnings: ValidationError[];
|
|
13
|
+
ast?: any;
|
|
14
|
+
}
|
|
15
|
+
export interface SuggestionItem {
|
|
16
|
+
text: string;
|
|
17
|
+
displayText: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
type?: 'function' | 'variable' | 'keyword';
|
|
20
|
+
description?: string;
|
|
21
|
+
usage?: string;
|
|
22
|
+
category?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 公式增强器 - 通过组合而不是继承来扩展 Formula 类
|
|
26
|
+
*/
|
|
27
|
+
export declare class FormulaEnhancer {
|
|
28
|
+
private formulaInstance;
|
|
29
|
+
private validationCache;
|
|
30
|
+
private functionNamesCache;
|
|
31
|
+
constructor(formulaInstance: Formula);
|
|
32
|
+
/**
|
|
33
|
+
* 获取底层 Formula 实例(用于访问原有功能)
|
|
34
|
+
*/
|
|
35
|
+
get formula(): Formula;
|
|
36
|
+
/**
|
|
37
|
+
* 验证公式
|
|
38
|
+
*/
|
|
39
|
+
validate(formula: string): ValidationResult;
|
|
40
|
+
/**
|
|
41
|
+
* 获取所有可用函数名
|
|
42
|
+
*/
|
|
43
|
+
getAllFunctionNames(): string[];
|
|
44
|
+
/**
|
|
45
|
+
* 获取函数详情
|
|
46
|
+
*/
|
|
47
|
+
getFunctionDetails(name: string): any;
|
|
48
|
+
/**
|
|
49
|
+
* 获取函数签名
|
|
50
|
+
*/
|
|
51
|
+
getFunctionSignature(name: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* 清理验证缓存
|
|
54
|
+
*/
|
|
55
|
+
clearValidationCache(): void;
|
|
56
|
+
/**
|
|
57
|
+
* 获取公式中使用的所有变量
|
|
58
|
+
*/
|
|
59
|
+
extractVariables(formula: string): string[];
|
|
60
|
+
/**
|
|
61
|
+
* 获取公式中使用的所有函数
|
|
62
|
+
*/
|
|
63
|
+
extractFunctions(formula: string): string[];
|
|
64
|
+
/**
|
|
65
|
+
* 格式化公式
|
|
66
|
+
*/
|
|
67
|
+
format(formula: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* 获取智能建议
|
|
70
|
+
*/
|
|
71
|
+
getSuggestions(text: string, cursorPos: number, availableVariables?: any[]): SuggestionItem[];
|
|
72
|
+
private getLineText;
|
|
73
|
+
private getFunctionSuggestions;
|
|
74
|
+
private getVariableSuggestions;
|
|
75
|
+
private sortSuggestions;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 公式高亮器
|
|
79
|
+
*/
|
|
80
|
+
export declare class FormulaHighlighter {
|
|
81
|
+
static highlightErrors(codeMirror: any, errors: ValidationError[]): void;
|
|
82
|
+
static clearHighlights(codeMirror: any): void;
|
|
83
|
+
static highlightVariable(codeMirror: any, variable: string, label: string): void;
|
|
84
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, OnInit, ChangeDetectorRef } from "@angular/core";
|
|
2
|
+
import { ControlValueAccessor } from "@angular/forms";
|
|
3
|
+
import { NzMessageService } from 'ng-zorro-antd/message';
|
|
4
|
+
import * as CodeMirror from 'codemirror';
|
|
5
|
+
import 'codemirror/mode/javascript/javascript';
|
|
6
|
+
import 'codemirror/addon/edit/matchbrackets';
|
|
7
|
+
import { Formula } from './common-formula';
|
|
8
|
+
import { ValidationResult, SuggestionItem } from './formula-enhanced';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export declare class GramCodemirrorComponent implements OnInit, AfterViewInit, OnDestroy, ControlValueAccessor {
|
|
11
|
+
private el;
|
|
12
|
+
private msg;
|
|
13
|
+
private cdr;
|
|
14
|
+
private formula;
|
|
15
|
+
ref: ElementRef<HTMLTextAreaElement>;
|
|
16
|
+
title: string;
|
|
17
|
+
name: string;
|
|
18
|
+
autoFocus: boolean;
|
|
19
|
+
fieldData: any[];
|
|
20
|
+
options: CodeMirror.EditorConfiguration;
|
|
21
|
+
validationResult: EventEmitter<ValidationResult>;
|
|
22
|
+
codeMirror: CodeMirror.EditorFromTextArea;
|
|
23
|
+
value: string;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
FormulaUsage: any[];
|
|
26
|
+
usageDescription: string;
|
|
27
|
+
suggestions: SuggestionItem[];
|
|
28
|
+
showSuggestionBox: boolean;
|
|
29
|
+
selectedSuggestionIndex: number;
|
|
30
|
+
private fieldLabelMap;
|
|
31
|
+
private labelKeyMap;
|
|
32
|
+
showVariableLabels: boolean;
|
|
33
|
+
private variableMarkers;
|
|
34
|
+
_variableSearch: any;
|
|
35
|
+
variableSearchList: any[];
|
|
36
|
+
_usageFunSearch: any;
|
|
37
|
+
usageFunSearchList: any[];
|
|
38
|
+
set variableSearch(value: string);
|
|
39
|
+
get variableSearch(): string;
|
|
40
|
+
set usageFunSearch(value: string);
|
|
41
|
+
get usageFunSearch(): string;
|
|
42
|
+
get dateType(): string;
|
|
43
|
+
constructor(el: ElementRef, msg: NzMessageService, cdr: ChangeDetectorRef, formula: Formula);
|
|
44
|
+
ngOnInit(): void;
|
|
45
|
+
ngAfterViewInit(): void;
|
|
46
|
+
ngOnDestroy(): void;
|
|
47
|
+
private escapeRegExp;
|
|
48
|
+
private buildVariableMap;
|
|
49
|
+
private displayToFormula;
|
|
50
|
+
private formulaToDisplay;
|
|
51
|
+
private defineMode;
|
|
52
|
+
private initEditor;
|
|
53
|
+
private onEditorChange;
|
|
54
|
+
private highlightVariables;
|
|
55
|
+
insertField(f: any): void;
|
|
56
|
+
insertUsageFun(f: any): void;
|
|
57
|
+
updateSuggestions(): void;
|
|
58
|
+
applySuggestion(): void;
|
|
59
|
+
insertSuggestion(s: SuggestionItem): void;
|
|
60
|
+
btnValidate(): void;
|
|
61
|
+
validateFormula(): ValidationResult;
|
|
62
|
+
toggleVariableDisplay(): void;
|
|
63
|
+
btnCopy(): void;
|
|
64
|
+
btnPaste(): void;
|
|
65
|
+
btnClear(): void;
|
|
66
|
+
writeValue(v: string): void;
|
|
67
|
+
onChange: (_: any) => void;
|
|
68
|
+
registerOnChange(fn: any): void;
|
|
69
|
+
registerOnTouched(): void;
|
|
70
|
+
setDisabledState(d: boolean): void;
|
|
71
|
+
closeSuggest(e: MouseEvent): void;
|
|
72
|
+
usageMouseover(e: any): void;
|
|
73
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GramCodemirrorComponent, never>;
|
|
74
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<GramCodemirrorComponent, "deon-codemirror", never, { "title": { "alias": "title"; "required": false; }; "name": { "alias": "name"; "required": false; }; "autoFocus": { "alias": "autoFocus"; "required": false; }; "fieldData": { "alias": "fieldData"; "required": false; }; "options": { "alias": "options"; "required": false; }; }, { "validationResult": "validationResult"; }, never, never, true, never>;
|
|
75
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { GramCodemirrorModule } from './index.module';
|
|
2
|
-
export { GramCodemirrorComponent } from './
|
|
2
|
+
export { GramCodemirrorComponent } from './main/index.component';
|