@ebuilding/abc 2.0.0
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/LICENSE +0 -0
- package/README.md +0 -0
- package/button/index.d.ts +1 -0
- package/button/src/default/index.d.ts +15 -0
- package/button/src/index.module.d.ts +9 -0
- package/button/src/inner/index.d.ts +10 -0
- package/button/src/main/index.d.ts +16 -0
- package/button/src/public_api.d.ts +4 -0
- package/card/index.d.ts +1 -0
- package/card/src/card.service.d.ts +19 -0
- package/card/src/column-default/index.d.ts +22 -0
- package/card/src/column-img/index.d.ts +22 -0
- package/card/src/column-img1/index.d.ts +13 -0
- package/card/src/column-img2/index.d.ts +13 -0
- package/card/src/column-img3/index.d.ts +13 -0
- package/card/src/default/index.d.ts +45 -0
- package/card/src/design/index.d.ts +10 -0
- package/card/src/design-text/index.d.ts +10 -0
- package/card/src/index.module.d.ts +11 -0
- package/card/src/item-group/index.d.ts +16 -0
- package/card/src/item-text/index.d.ts +15 -0
- package/card/src/item.service.d.ts +20 -0
- package/card/src/public_api.d.ts +6 -0
- package/card-assess/index.d.ts +1 -0
- package/card-assess/src/default/index.d.ts +19 -0
- package/card-assess/src/index.module.d.ts +7 -0
- package/card-assess/src/public_api.d.ts +2 -0
- package/card-emp/index.d.ts +1 -0
- package/card-emp/src/default/index.d.ts +10 -0
- package/card-emp/src/emp-okr/index.d.ts +12 -0
- package/card-emp/src/index.module.d.ts +8 -0
- package/card-emp/src/public_api.d.ts +3 -0
- package/card-list/index.d.ts +1 -0
- package/card-list/src/default/index.d.ts +14 -0
- package/card-list/src/index.module.d.ts +7 -0
- package/card-list/src/public_api.d.ts +2 -0
- package/card-okr/index.d.ts +1 -0
- package/card-okr/src/default/index.d.ts +22 -0
- package/card-okr/src/index.module.d.ts +17 -0
- package/card-okr/src/kpi-stats1/index.d.ts +15 -0
- package/card-okr/src/kpi-stats2/index.d.ts +14 -0
- package/card-okr/src/kpi-stats3/index.d.ts +16 -0
- package/card-okr/src/objective/index.d.ts +14 -0
- package/card-okr/src/objective-dl/index.d.ts +16 -0
- package/card-okr/src/objective-dx/index.d.ts +16 -0
- package/card-okr/src/public_api.d.ts +11 -0
- package/card-okr/src/stats-default/index.d.ts +14 -0
- package/card-okr/src/stats-objective/index.d.ts +14 -0
- package/card-okr/src/stats-progress/index.d.ts +12 -0
- package/card-plan-kpi/index.d.ts +1 -0
- package/card-plan-kpi/src/default/index.d.ts +22 -0
- package/card-plan-kpi/src/index.module.d.ts +7 -0
- package/card-plan-kpi/src/public_api.d.ts +2 -0
- package/card-result/index.d.ts +1 -0
- package/card-result/src/default/index.d.ts +45 -0
- package/card-result/src/index.module.d.ts +8 -0
- package/card-result/src/public_api.d.ts +2 -0
- package/card-score/index.d.ts +1 -0
- package/card-score/src/default/index.d.ts +9 -0
- package/card-score/src/index.module.d.ts +8 -0
- package/card-score/src/public_api.d.ts +2 -0
- package/card-user/index.d.ts +1 -0
- package/card-user/src/default/index.d.ts +11 -0
- package/card-user/src/index.module.d.ts +7 -0
- package/card-user/src/public_api.d.ts +2 -0
- package/card2/index.d.ts +1 -0
- package/card2/src/default/index.d.ts +90 -0
- package/card2/src/index.module.d.ts +7 -0
- package/card2/src/public_api.d.ts +2 -0
- package/codemirror/index.d.ts +1 -0
- package/codemirror/src/default/index.d.ts +10 -0
- package/codemirror/src/index.module.d.ts +7 -0
- package/codemirror/src/public_api.d.ts +5 -0
- package/collect/index.d.ts +1 -0
- package/collect/src/default/index.d.ts +11 -0
- package/collect/src/index.module.d.ts +7 -0
- package/collect/src/public_api.d.ts +2 -0
- package/developing/index.d.ts +1 -0
- package/developing/src/default/index.d.ts +8 -0
- package/developing/src/index.module.d.ts +10 -0
- package/developing/src/public_api.d.ts +2 -0
- package/empty/index.d.ts +1 -0
- package/empty/src/default/index.d.ts +13 -0
- package/empty/src/index.module.d.ts +7 -0
- package/empty/src/public_api.d.ts +2 -0
- package/fesm2022/codemirror.mjs +806 -0
- package/fesm2022/codemirror.mjs.map +1 -0
- package/fesm2022/components.button.mjs +121 -0
- package/fesm2022/components.button.mjs.map +1 -0
- package/fesm2022/components.card-assess.mjs +68 -0
- package/fesm2022/components.card-assess.mjs.map +1 -0
- package/fesm2022/components.card-emp.mjs +65 -0
- package/fesm2022/components.card-emp.mjs.map +1 -0
- package/fesm2022/components.card-list.mjs +53 -0
- package/fesm2022/components.card-list.mjs.map +1 -0
- package/fesm2022/components.card-okr.mjs +370 -0
- package/fesm2022/components.card-okr.mjs.map +1 -0
- package/fesm2022/components.card-plan-kpi.mjs +68 -0
- package/fesm2022/components.card-plan-kpi.mjs.map +1 -0
- package/fesm2022/components.card-result.mjs +137 -0
- package/fesm2022/components.card-result.mjs.map +1 -0
- package/fesm2022/components.card-score.mjs +47 -0
- package/fesm2022/components.card-score.mjs.map +1 -0
- package/fesm2022/components.card-user.mjs +56 -0
- package/fesm2022/components.card-user.mjs.map +1 -0
- package/fesm2022/components.card.mjs +670 -0
- package/fesm2022/components.card.mjs.map +1 -0
- package/fesm2022/components.card2.mjs +463 -0
- package/fesm2022/components.card2.mjs.map +1 -0
- package/fesm2022/components.collect.mjs +57 -0
- package/fesm2022/components.collect.mjs.map +1 -0
- package/fesm2022/components.developing.mjs +38 -0
- package/fesm2022/components.developing.mjs.map +1 -0
- package/fesm2022/components.empty.mjs +54 -0
- package/fesm2022/components.empty.mjs.map +1 -0
- package/fesm2022/components.flow-button.mjs +89 -0
- package/fesm2022/components.flow-button.mjs.map +1 -0
- package/fesm2022/components.header-user.mjs +261 -0
- package/fesm2022/components.header-user.mjs.map +1 -0
- package/fesm2022/components.header.mjs +81 -0
- package/fesm2022/components.header.mjs.map +1 -0
- package/fesm2022/components.line.mjs +44 -0
- package/fesm2022/components.line.mjs.map +1 -0
- package/fesm2022/components.no-role.mjs +37 -0
- package/fesm2022/components.no-role.mjs.map +1 -0
- package/fesm2022/components.nz-table-tree.mjs +407 -0
- package/fesm2022/components.nz-table-tree.mjs.map +1 -0
- package/fesm2022/components.nz-table.mjs +463 -0
- package/fesm2022/components.nz-table.mjs.map +1 -0
- package/fesm2022/components.plan-item.mjs +249 -0
- package/fesm2022/components.plan-item.mjs.map +1 -0
- package/fesm2022/components.principal.mjs +59 -0
- package/fesm2022/components.principal.mjs.map +1 -0
- package/fesm2022/components.python.mjs +140 -0
- package/fesm2022/components.python.mjs.map +1 -0
- package/fesm2022/components.quick.mjs +158 -0
- package/fesm2022/components.quick.mjs.map +1 -0
- package/fesm2022/components.record.mjs +106 -0
- package/fesm2022/components.record.mjs.map +1 -0
- package/fesm2022/components.step-entry.mjs +50 -0
- package/fesm2022/components.step-entry.mjs.map +1 -0
- package/fesm2022/components.target-value.mjs +83 -0
- package/fesm2022/components.target-value.mjs.map +1 -0
- package/fesm2022/components.text.mjs +444 -0
- package/fesm2022/components.text.mjs.map +1 -0
- package/fesm2022/components.tree.mjs +203 -0
- package/fesm2022/components.tree.mjs.map +1 -0
- package/fesm2022/ebuilding-abc.mjs +121 -0
- package/fesm2022/ebuilding-abc.mjs.map +1 -0
- package/flow-button/index.d.ts +1 -0
- package/flow-button/src/default/index.d.ts +14 -0
- package/flow-button/src/index.module.d.ts +7 -0
- package/flow-button/src/public_api.d.ts +2 -0
- package/header/index.d.ts +1 -0
- package/header/src/default/index.d.ts +16 -0
- package/header/src/index.module.d.ts +10 -0
- package/header/src/public_api.d.ts +2 -0
- package/header-user/index.d.ts +1 -0
- package/header-user/src/default/index.d.ts +57 -0
- package/header-user/src/index.module.d.ts +7 -0
- package/header-user/src/public_api.d.ts +2 -0
- package/index.d.ts +1 -0
- package/line/index.d.ts +1 -0
- package/line/src/default/index.d.ts +9 -0
- package/line/src/index.module.d.ts +10 -0
- package/line/src/public_api.d.ts +2 -0
- package/no-role/index.d.ts +1 -0
- package/no-role/src/default/index.d.ts +9 -0
- package/no-role/src/index.module.d.ts +8 -0
- package/no-role/src/public_api.d.ts +2 -0
- package/nz-table/index.d.ts +1 -0
- package/nz-table/src/default/index.d.ts +90 -0
- package/nz-table/src/index.module.d.ts +7 -0
- package/nz-table/src/public_api.d.ts +2 -0
- package/nz-table-tree/index.d.ts +1 -0
- package/nz-table-tree/src/default/index.d.ts +98 -0
- package/nz-table-tree/src/index.module.d.ts +8 -0
- package/nz-table-tree/src/operation/index.d.ts +12 -0
- package/nz-table-tree/src/public_api.d.ts +2 -0
- package/package.json +144 -0
- package/plan-item/index.d.ts +1 -0
- package/plan-item/src/default/index.d.ts +45 -0
- package/plan-item/src/index.module.d.ts +7 -0
- package/plan-item/src/public_api.d.ts +2 -0
- package/principal/index.d.ts +1 -0
- package/principal/src/default/index.d.ts +15 -0
- package/principal/src/index.module.d.ts +7 -0
- package/principal/src/public_api.d.ts +2 -0
- package/python/index.d.ts +1 -0
- package/python/src/default/index.d.ts +8 -0
- package/python/src/index.module.d.ts +8 -0
- package/python/src/public_api.d.ts +2 -0
- package/quick/index.d.ts +1 -0
- package/quick/src/datetime/index.d.ts +12 -0
- package/quick/src/default/index.d.ts +14 -0
- package/quick/src/index.module.d.ts +10 -0
- package/quick/src/public_api.d.ts +2 -0
- package/record/index.d.ts +1 -0
- package/record/src/default/index.d.ts +12 -0
- package/record/src/index.module.d.ts +8 -0
- package/record/src/main/index.d.ts +12 -0
- package/record/src/public_api.d.ts +3 -0
- package/step-entry/index.d.ts +1 -0
- package/step-entry/src/default/index.d.ts +12 -0
- package/step-entry/src/index.module.d.ts +9 -0
- package/step-entry/src/public_api.d.ts +2 -0
- package/target-value/index.d.ts +1 -0
- package/target-value/src/default/index.d.ts +17 -0
- package/target-value/src/index.module.d.ts +8 -0
- package/target-value/src/public_api.d.ts +2 -0
- package/text/index.d.ts +1 -0
- package/text/src/default/index.d.ts +25 -0
- package/text/src/index.module.d.ts +9 -0
- package/text/src/public_api.d.ts +2 -0
- package/text/src/text.service.d.ts +57 -0
- package/tree/index.d.ts +1 -0
- package/tree/src/default/index.d.ts +39 -0
- package/tree/src/index.module.d.ts +9 -0
- package/tree/src/public_api.d.ts +2 -0
|
@@ -0,0 +1,806 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
|
|
5
|
+
// import {
|
|
6
|
+
// AfterViewInit,
|
|
7
|
+
// ChangeDetectionStrategy,
|
|
8
|
+
// Component,
|
|
9
|
+
// DoCheck,
|
|
10
|
+
// ElementRef,
|
|
11
|
+
// EventEmitter,
|
|
12
|
+
// forwardRef,
|
|
13
|
+
// Inject,
|
|
14
|
+
// Input,
|
|
15
|
+
// KeyValueDiffer,
|
|
16
|
+
// KeyValueDiffers,
|
|
17
|
+
// NgZone,
|
|
18
|
+
// OnChanges,
|
|
19
|
+
// OnDestroy,
|
|
20
|
+
// OnInit,
|
|
21
|
+
// Output,
|
|
22
|
+
// SimpleChanges,
|
|
23
|
+
// ViewChild,
|
|
24
|
+
// } from "@angular/core";
|
|
25
|
+
// import { CommonModule } from "@angular/common";
|
|
26
|
+
// import { ReactiveFormsModule, FormsModule, ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
27
|
+
// import { NzInputModule } from "ng-zorro-antd/input";
|
|
28
|
+
// import { NzCollapseModule } from "ng-zorro-antd/collapse";
|
|
29
|
+
// import { NzIconModule } from "ng-zorro-antd/icon";
|
|
30
|
+
// import { NzButtonModule } from "ng-zorro-antd/button";
|
|
31
|
+
// import { NzToolTipModule } from "ng-zorro-antd/tooltip";
|
|
32
|
+
// import { NzConfigService } from "ng-zorro-antd/core/config";
|
|
33
|
+
// import { NzMessageService } from "ng-zorro-antd/message";
|
|
34
|
+
// import CodeMirror from 'codemirror';
|
|
35
|
+
// import { Editor, EditorFromTextArea, ScrollInfo } from "codemirror";
|
|
36
|
+
// import { GramPipeModule } from "@ebuilding/base/shared.pipe";
|
|
37
|
+
// import { Formula } from "../tools/formula";
|
|
38
|
+
// import { searchUsageFun, searchVariable, searchArrayVariable } from "../tools/common";
|
|
39
|
+
// import _ from "lodash";
|
|
40
|
+
// declare var require: any;
|
|
41
|
+
// type FormulaType = (a?: any, b?: any, c?: any, d?: any) => boolean;
|
|
42
|
+
// export declare interface IFormulaClass {
|
|
43
|
+
// FormulaUsage?: {
|
|
44
|
+
// category: string;
|
|
45
|
+
// categoryCode: string;
|
|
46
|
+
// contains: {
|
|
47
|
+
// name: string;
|
|
48
|
+
// intro: string;
|
|
49
|
+
// usage: string;
|
|
50
|
+
// example: string;
|
|
51
|
+
// }[];
|
|
52
|
+
// }[];
|
|
53
|
+
// Formula?: {
|
|
54
|
+
// [funcName: string]: FormulaType;
|
|
55
|
+
// };
|
|
56
|
+
// }
|
|
57
|
+
// @Component({
|
|
58
|
+
// selector: "deon-codemirror",
|
|
59
|
+
// templateUrl: "./index.html",
|
|
60
|
+
// styleUrls: ['./index.less'],
|
|
61
|
+
// providers: [
|
|
62
|
+
// {
|
|
63
|
+
// provide: NG_VALUE_ACCESSOR,
|
|
64
|
+
// useExisting: forwardRef(() => GramCodemirrorComponent),
|
|
65
|
+
// multi: true,
|
|
66
|
+
// },
|
|
67
|
+
// Formula
|
|
68
|
+
// ],
|
|
69
|
+
// preserveWhitespaces: false,
|
|
70
|
+
// changeDetection: ChangeDetectionStrategy.OnPush,
|
|
71
|
+
// imports: [CommonModule, ReactiveFormsModule, FormsModule, NzInputModule, NzCollapseModule, NzIconModule, NzButtonModule, NzToolTipModule, GramPipeModule]
|
|
72
|
+
// })
|
|
73
|
+
// export class GramCodemirrorComponent
|
|
74
|
+
// implements
|
|
75
|
+
// AfterViewInit,
|
|
76
|
+
// OnDestroy,
|
|
77
|
+
// ControlValueAccessor,
|
|
78
|
+
// OnChanges,
|
|
79
|
+
// DoCheck,
|
|
80
|
+
// OnInit {
|
|
81
|
+
// @Input() itemTitle = {};
|
|
82
|
+
// @Input()
|
|
83
|
+
// set options(value: { [key: string]: any }) {
|
|
84
|
+
// if (value!!) {
|
|
85
|
+
// this._options = value;
|
|
86
|
+
// if (!this._differ && value) {
|
|
87
|
+
// this._differ = this._differs.find(value).create();
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
90
|
+
// }
|
|
91
|
+
// /**
|
|
92
|
+
// * 可用变量对象
|
|
93
|
+
// * {
|
|
94
|
+
// * formFields:[],tableList:[]
|
|
95
|
+
// * }
|
|
96
|
+
// */
|
|
97
|
+
// @Input()
|
|
98
|
+
// set fieldData(value: any) {
|
|
99
|
+
// this._fieldData = value;
|
|
100
|
+
// if (Array.isArray(value) && value.length > 0) {
|
|
101
|
+
// value.forEach((t: any) => {
|
|
102
|
+
// if (Array.isArray(t.listField) && t.listField.length > 0) {
|
|
103
|
+
// t.listField.forEach((f: any) => {
|
|
104
|
+
// this.labelMap['$' + `{${f.key}}`] = f.label;
|
|
105
|
+
// });
|
|
106
|
+
// }
|
|
107
|
+
// })
|
|
108
|
+
// }
|
|
109
|
+
// }
|
|
110
|
+
// get fieldData() {
|
|
111
|
+
// return this._fieldData;
|
|
112
|
+
// }
|
|
113
|
+
// /**
|
|
114
|
+
// * 黑名单 值为函数名数组
|
|
115
|
+
// */
|
|
116
|
+
// @Input() blacklist: Array<string>;
|
|
117
|
+
// /**
|
|
118
|
+
// * 启用默认黑名单
|
|
119
|
+
// * 默认黑名单与blackList合并
|
|
120
|
+
// */
|
|
121
|
+
// @Input() enableDefaultBlack = true;
|
|
122
|
+
// /**
|
|
123
|
+
// * 显示的公式 值显示列表内指定公式
|
|
124
|
+
// */
|
|
125
|
+
// @Input() showList: Array<string>;
|
|
126
|
+
// get dateType(): string {
|
|
127
|
+
// const t = Array.isArray(this.fieldData);
|
|
128
|
+
// return t ? "array" : "object";
|
|
129
|
+
// }
|
|
130
|
+
// set variableSearch(value: string) {
|
|
131
|
+
// let variableSearchList;
|
|
132
|
+
// if ("array" === this.dateType) {
|
|
133
|
+
// variableSearchList = searchArrayVariable(value, this.fieldData);
|
|
134
|
+
// } else {
|
|
135
|
+
// variableSearchList = searchVariable(value, this.fieldData);
|
|
136
|
+
// }
|
|
137
|
+
// this.variableSearchList = variableSearchList;
|
|
138
|
+
// this._variableSearch = value;
|
|
139
|
+
// }
|
|
140
|
+
// get variableSearch() {
|
|
141
|
+
// return this._variableSearch;
|
|
142
|
+
// }
|
|
143
|
+
// set usageFunSearch(value: string) {
|
|
144
|
+
// // TODO 只显示当前公式编辑器支持的函数
|
|
145
|
+
// this.usageFunSearchList = searchUsageFun(value, this.FormulaUsage);
|
|
146
|
+
// this._usageFunSearch = value;
|
|
147
|
+
// }
|
|
148
|
+
// get usageFunSearch() {
|
|
149
|
+
// return this._usageFunSearch;
|
|
150
|
+
// }
|
|
151
|
+
// /**
|
|
152
|
+
// * 所有支持函数分组信息
|
|
153
|
+
// * name 分组名称 string
|
|
154
|
+
// * code 分组code string
|
|
155
|
+
// * items 函数名集合 string[]
|
|
156
|
+
// */
|
|
157
|
+
// public get globalCategorys() {
|
|
158
|
+
// var info: any[] = [];
|
|
159
|
+
// _.forEach(this.fml.FormulaUsage, function (item: any) {
|
|
160
|
+
// info.push({
|
|
161
|
+
// // name 分组名称 string
|
|
162
|
+
// name: item.category,
|
|
163
|
+
// // code 分组code string
|
|
164
|
+
// code: item.categoryCode,
|
|
165
|
+
// // items 函数名集合 string[]
|
|
166
|
+
// items: _.flatMap(item.contains, function (c) {
|
|
167
|
+
// return c.name;
|
|
168
|
+
// }),
|
|
169
|
+
// });
|
|
170
|
+
// });
|
|
171
|
+
// return info;
|
|
172
|
+
// }
|
|
173
|
+
// /**
|
|
174
|
+
// * 获取全局CodeMirror
|
|
175
|
+
// */
|
|
176
|
+
// get codeMirrorGlobal(): any {
|
|
177
|
+
// if (this._codeMirror) {
|
|
178
|
+
// return this._codeMirror;
|
|
179
|
+
// }
|
|
180
|
+
// this._codeMirror =
|
|
181
|
+
// typeof CodeMirror !== "undefined" ? CodeMirror : require("codemirror");
|
|
182
|
+
// return this._codeMirror;
|
|
183
|
+
// }
|
|
184
|
+
// // fml = new Formula();
|
|
185
|
+
// @Input() name = "codemirror";
|
|
186
|
+
// @Input() title = "";
|
|
187
|
+
// @Input() autoFocus = false;
|
|
188
|
+
// /**
|
|
189
|
+
// * 函数显示类型
|
|
190
|
+
// * 班次 attendance 所有 // attendance-items 精度 进位规则
|
|
191
|
+
// *
|
|
192
|
+
// * 与categorys互斥,有type时使用type
|
|
193
|
+
// */
|
|
194
|
+
// @Input() type: string = "";
|
|
195
|
+
// /**
|
|
196
|
+
// * 显示的函数组
|
|
197
|
+
// * 与type 互斥,如果type有值,当前参数无效。
|
|
198
|
+
// */
|
|
199
|
+
// @Input() categorys: Array<string>;
|
|
200
|
+
// /**
|
|
201
|
+
// * 自定义公式
|
|
202
|
+
// */
|
|
203
|
+
// @Input() formulaClass: IFormulaClass;
|
|
204
|
+
// typeList: any = {
|
|
205
|
+
// "attendance-items": [
|
|
206
|
+
// "MANHOURS",
|
|
207
|
+
// "CalendarDay",
|
|
208
|
+
// "PRECISION",
|
|
209
|
+
// "DepartmentScope",
|
|
210
|
+
// "AND",
|
|
211
|
+
// "OR",
|
|
212
|
+
// "IF",
|
|
213
|
+
// "IN",
|
|
214
|
+
// "AttendanceType",
|
|
215
|
+
// "MinusSupport",
|
|
216
|
+
// ],
|
|
217
|
+
// Daycalculation: [
|
|
218
|
+
// "Daycalculation",
|
|
219
|
+
// "Hourcalculation",
|
|
220
|
+
// "SUM",
|
|
221
|
+
// "Daycompute",
|
|
222
|
+
// "PositionHeadcount",
|
|
223
|
+
// ],
|
|
224
|
+
// };
|
|
225
|
+
// @Input() preserveScrollPosition = false;
|
|
226
|
+
// labelMap: any = {};
|
|
227
|
+
// _fieldData: any = null;
|
|
228
|
+
// @Output()
|
|
229
|
+
// cursorActivity = new EventEmitter<Editor>();
|
|
230
|
+
// @Output() focusChange = new EventEmitter<boolean>();
|
|
231
|
+
// @Output() scroll = new EventEmitter<ScrollInfo>();
|
|
232
|
+
// @Output() drop = new EventEmitter<[Editor, DragEvent]>();
|
|
233
|
+
// @Output() textChange = new EventEmitter<any>();
|
|
234
|
+
// @ViewChild("ref", { static: true }) ref!: ElementRef;
|
|
235
|
+
// fml: any;
|
|
236
|
+
// value: any = "";
|
|
237
|
+
// disabled = false;
|
|
238
|
+
// isFocused = false;
|
|
239
|
+
// codeMirror?: EditorFromTextArea;
|
|
240
|
+
// /**
|
|
241
|
+
// * 存放匹配的变量集合
|
|
242
|
+
// */
|
|
243
|
+
// variableSearchList: any[] = [];
|
|
244
|
+
// /**
|
|
245
|
+
// * 存放匹配的函数集合
|
|
246
|
+
// */
|
|
247
|
+
// usageFunSearchList: any[] = [];
|
|
248
|
+
// FormulaUsage: any[] = [];
|
|
249
|
+
// /**
|
|
250
|
+
// * 查询可用变量
|
|
251
|
+
// */
|
|
252
|
+
// _variableSearch: any = null;
|
|
253
|
+
// /**
|
|
254
|
+
// * 查询可用函数
|
|
255
|
+
// */
|
|
256
|
+
// _usageFunSearch: any = null;
|
|
257
|
+
// /**
|
|
258
|
+
// * 函数描述
|
|
259
|
+
// */
|
|
260
|
+
// usageDescription = `
|
|
261
|
+
// <ul class="intro-wrapper default">
|
|
262
|
+
// <li>从左侧面板选择字段名和函数,或输入函数</li>
|
|
263
|
+
// <li>公式编辑举例:
|
|
264
|
+
// <span class="formula-name">AVERAGE</span>
|
|
265
|
+
// (
|
|
266
|
+
// <span class="formula-field">语文成绩</span>
|
|
267
|
+
// ,
|
|
268
|
+
// <span class="formula-field">数学成绩</span>
|
|
269
|
+
// )
|
|
270
|
+
// </li>
|
|
271
|
+
// </ul>
|
|
272
|
+
// `;
|
|
273
|
+
// private _codeMirror: any;
|
|
274
|
+
// private _differ?: KeyValueDiffer<string, any>;
|
|
275
|
+
// private _options: any = {
|
|
276
|
+
// autoCloseBrackets: true,
|
|
277
|
+
// keywords: [],
|
|
278
|
+
// textWrapping: true,
|
|
279
|
+
// lineWrapping: true,
|
|
280
|
+
// lineNumbers: false,
|
|
281
|
+
// matchBrackets: true,
|
|
282
|
+
// specialChars:
|
|
283
|
+
// /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/,
|
|
284
|
+
// mode: "text/fx-formula",
|
|
285
|
+
// labelMap: null,
|
|
286
|
+
// };
|
|
287
|
+
// private _fomulaContext: string[];
|
|
288
|
+
// /**
|
|
289
|
+
// * 默认公式
|
|
290
|
+
// */
|
|
291
|
+
// private defaultFml: any;
|
|
292
|
+
// constructor(
|
|
293
|
+
// private _differs: KeyValueDiffers,
|
|
294
|
+
// private _ngZone: NgZone,
|
|
295
|
+
// public el: ElementRef,
|
|
296
|
+
// private message: NzMessageService,
|
|
297
|
+
// private nzConfigService: NzConfigService,
|
|
298
|
+
// private fmlService: Formula
|
|
299
|
+
// ) {
|
|
300
|
+
// this.defaultFml = _.cloneDeep({
|
|
301
|
+
// FormulaUsage: fmlService.FormulaUsage,
|
|
302
|
+
// Formula: fmlService.Formula,
|
|
303
|
+
// });
|
|
304
|
+
// this.fml = fmlService;
|
|
305
|
+
// }
|
|
306
|
+
// ngOnInit() {
|
|
307
|
+
// this.nzConfigService.set("message", {
|
|
308
|
+
// nzMaxStack: 1,
|
|
309
|
+
// nzAnimate: false,
|
|
310
|
+
// });
|
|
311
|
+
// }
|
|
312
|
+
// /**
|
|
313
|
+
// * 根据黑名单过滤公式
|
|
314
|
+
// */
|
|
315
|
+
// filterUsageByBlackList(formulaUsage: any) {
|
|
316
|
+
// let FormulaUsageList: any[] = [];
|
|
317
|
+
// formulaUsage.forEach((el: any) => {
|
|
318
|
+
// el.contains.forEach((formula: any) => {
|
|
319
|
+
// // 黑名单列表内的Index。
|
|
320
|
+
// const blackIndex = _.indexOf(this.blacklist, formula.name);
|
|
321
|
+
// if (blackIndex < 0) {
|
|
322
|
+
// if (
|
|
323
|
+
// FormulaUsageList.findIndex((ele) => ele.category === el.category) >
|
|
324
|
+
// -1
|
|
325
|
+
// ) {
|
|
326
|
+
// let index = FormulaUsageList.findIndex(
|
|
327
|
+
// (ele) => ele.category === el.category
|
|
328
|
+
// );
|
|
329
|
+
// (FormulaUsageList[index].contains as any[]).push(formula);
|
|
330
|
+
// } else {
|
|
331
|
+
// let item: any = {
|
|
332
|
+
// category: el.category,
|
|
333
|
+
// contains: [],
|
|
334
|
+
// };
|
|
335
|
+
// item.contains.push(formula);
|
|
336
|
+
// FormulaUsageList.push(item);
|
|
337
|
+
// }
|
|
338
|
+
// }
|
|
339
|
+
// });
|
|
340
|
+
// });
|
|
341
|
+
// return FormulaUsageList;
|
|
342
|
+
// }
|
|
343
|
+
// /**
|
|
344
|
+
// * 组装显示的函数
|
|
345
|
+
// */
|
|
346
|
+
// resolveDisplayFormula(): string[] {
|
|
347
|
+
// let displayFormula: string[] = [];
|
|
348
|
+
// if (this.showList) {
|
|
349
|
+
// return _.cloneDeep(this.showList);
|
|
350
|
+
// }
|
|
351
|
+
// if (this.type && !_.isEmpty(this.type)) {
|
|
352
|
+
// displayFormula = this.typeList[this.type];
|
|
353
|
+
// return displayFormula || [];
|
|
354
|
+
// }
|
|
355
|
+
// /**
|
|
356
|
+
// * this.categorys 显示的函数组
|
|
357
|
+
// * 与this.type 互斥,this.type优先级最高。
|
|
358
|
+
// */
|
|
359
|
+
// if (this.categorys && Array.isArray(this.categorys)) {
|
|
360
|
+
// // 显示函数组数组转对象
|
|
361
|
+
// const displayCategory = _.keyBy(this.categorys, function (o) {
|
|
362
|
+
// return o;
|
|
363
|
+
// });
|
|
364
|
+
// // 过滤出需显示的函数
|
|
365
|
+
// this.globalCategorys.map((c: any) => {
|
|
366
|
+
// if (c.items && displayCategory[c.code]) {
|
|
367
|
+
// displayFormula = displayFormula.concat(c.items);
|
|
368
|
+
// }
|
|
369
|
+
// });
|
|
370
|
+
// }
|
|
371
|
+
// return displayFormula || [];
|
|
372
|
+
// }
|
|
373
|
+
// /**
|
|
374
|
+
// * 组装FomulaContext
|
|
375
|
+
// */
|
|
376
|
+
// resolveFomulaContext() {
|
|
377
|
+
// const fomlaArray: string[] = [];
|
|
378
|
+
// if (!this.FormulaUsage) {
|
|
379
|
+
// return fomlaArray;
|
|
380
|
+
// }
|
|
381
|
+
// this.FormulaUsage.map((usage) => {
|
|
382
|
+
// const contains = _.flatMap(usage.contains, function (c) {
|
|
383
|
+
// return c.name;
|
|
384
|
+
// });
|
|
385
|
+
// fomlaArray.push(...contains);
|
|
386
|
+
// });
|
|
387
|
+
// this._fomulaContext = fomlaArray;
|
|
388
|
+
// return fomlaArray;
|
|
389
|
+
// }
|
|
390
|
+
// /**
|
|
391
|
+
// * 组装 this.FormulaUsage
|
|
392
|
+
// */
|
|
393
|
+
// setFormulaUsage() {
|
|
394
|
+
// var FormulaUsage = _.cloneDeep(this.fml.FormulaUsage);
|
|
395
|
+
// this.FormulaUsage = FormulaUsage;
|
|
396
|
+
// }
|
|
397
|
+
// ngAfterViewInit(): void {
|
|
398
|
+
// this.setFormulaUsage();
|
|
399
|
+
// if (!this.ref) {
|
|
400
|
+
// return;
|
|
401
|
+
// }
|
|
402
|
+
// this._ngZone.runOutsideAngular(() => {
|
|
403
|
+
// this.codeMirror = this.codeMirrorGlobal.fromTextArea(
|
|
404
|
+
// this.ref.nativeElement,
|
|
405
|
+
// this._options
|
|
406
|
+
// ) as EditorFromTextArea;
|
|
407
|
+
// this.codeMirror.on("cursorActivity", (cm) =>
|
|
408
|
+
// this._ngZone.run(() => this.cursorActive(cm))
|
|
409
|
+
// );
|
|
410
|
+
// this.codeMirror.on("scroll", this.scrollChanged.bind(this));
|
|
411
|
+
// this.codeMirror.on("blur", () =>
|
|
412
|
+
// this._ngZone.run(() => this.focusChanged(false))
|
|
413
|
+
// );
|
|
414
|
+
// this.codeMirror.on("focus", () =>
|
|
415
|
+
// this._ngZone.run(() => this.focusChanged(true))
|
|
416
|
+
// );
|
|
417
|
+
// this.codeMirror.on("change", (cm: any, change: any) => {
|
|
418
|
+
// this._ngZone.run(() => this.codemirrorValueChanged(cm, change));
|
|
419
|
+
// });
|
|
420
|
+
// this.codeMirror.on("drop", (cm: Editor, e: DragEvent) => {
|
|
421
|
+
// this._ngZone.run(() => this.dropFiles(cm, e));
|
|
422
|
+
// });
|
|
423
|
+
// this.codeMirror.setValue(this.value);
|
|
424
|
+
// (CodeMirror as any).fomulaContext = Object.keys(this.fml.Formula);
|
|
425
|
+
// this.codeMirror.setOption("mode", "text/fx-formula");
|
|
426
|
+
// });
|
|
427
|
+
// }
|
|
428
|
+
// ngOnChanges(changes: SimpleChanges): void {
|
|
429
|
+
// if (changes && changes["formulaClass"]) {
|
|
430
|
+
// const change = changes["formulaClass"];
|
|
431
|
+
// if (change && (change.currentValue || change.previousValue)) {
|
|
432
|
+
// this.setFormulaClass(change.currentValue);
|
|
433
|
+
// this.setFormulaUsage();
|
|
434
|
+
// }
|
|
435
|
+
// }
|
|
436
|
+
// }
|
|
437
|
+
// ngDoCheck(): void {
|
|
438
|
+
// if (!this._differ) {
|
|
439
|
+
// return;
|
|
440
|
+
// }
|
|
441
|
+
// const changes = this._differ.diff(this._options);
|
|
442
|
+
// if (changes) {
|
|
443
|
+
// changes.forEachChangedItem((option) =>
|
|
444
|
+
// this.setOptionIfChanged(option.key, option.currentValue)
|
|
445
|
+
// );
|
|
446
|
+
// changes.forEachAddedItem((option) =>
|
|
447
|
+
// this.setOptionIfChanged(option.key, option.currentValue)
|
|
448
|
+
// );
|
|
449
|
+
// changes.forEachRemovedItem((option) =>
|
|
450
|
+
// this.setOptionIfChanged(option.key, option.currentValue)
|
|
451
|
+
// );
|
|
452
|
+
// }
|
|
453
|
+
// }
|
|
454
|
+
// ngOnDestroy(): void {
|
|
455
|
+
// if (this.codeMirror) {
|
|
456
|
+
// this.codeMirror.toTextArea();
|
|
457
|
+
// }
|
|
458
|
+
// }
|
|
459
|
+
// /**
|
|
460
|
+
// * set FormulaClass
|
|
461
|
+
// * @param formulaCalss
|
|
462
|
+
// */
|
|
463
|
+
// setFormulaClass(formulaCalss: any): void {
|
|
464
|
+
// const fml: IFormulaClass = new formulaCalss(this.fml);
|
|
465
|
+
// const { FormulaUsage, Formula } = fml;
|
|
466
|
+
// if (Formula) {
|
|
467
|
+
// this._ngZone.runOutsideAngular(() => {
|
|
468
|
+
// Object.keys(Formula).forEach((key) => {
|
|
469
|
+
// this.fml.Formula[key] = Formula[key].bind(this.fml);
|
|
470
|
+
// });
|
|
471
|
+
// // CodeMirror.fomulaContext = this.resolveFomulaContext();
|
|
472
|
+
// (CodeMirror as any).fomulaContext = Object.keys(this.fml.Formula);
|
|
473
|
+
// });
|
|
474
|
+
// }
|
|
475
|
+
// if (FormulaUsage) {
|
|
476
|
+
// const oldIndexs: any = {};
|
|
477
|
+
// this.fml.FormulaUsage.forEach((category: any, index: number) => {
|
|
478
|
+
// oldIndexs[category.categoryCode] = index;
|
|
479
|
+
// });
|
|
480
|
+
// const newCategorys: any = {};
|
|
481
|
+
// FormulaUsage.forEach((category: any) => {
|
|
482
|
+
// newCategorys[category.categoryCode] = category;
|
|
483
|
+
// });
|
|
484
|
+
// Object.keys(newCategorys).forEach((categoryCode: any) => {
|
|
485
|
+
// const oldIndex = _.get(oldIndexs, categoryCode, undefined);
|
|
486
|
+
// const newCategory = newCategorys[categoryCode];
|
|
487
|
+
// if (undefined === oldIndex) {
|
|
488
|
+
// // 新增分类
|
|
489
|
+
// this.fml.FormulaUsage.push(newCategorys[categoryCode]);
|
|
490
|
+
// } else {
|
|
491
|
+
// // 已有分类 添加新函数
|
|
492
|
+
// let oldContains = this.fml.FormulaUsage[oldIndex].contains;
|
|
493
|
+
// oldContains = oldContains.concat(newCategory.contains);
|
|
494
|
+
// oldContains.reverse();
|
|
495
|
+
// _.uniqWith(oldContains, (a: any, b: any) => {
|
|
496
|
+
// return a.name === b.name;
|
|
497
|
+
// });
|
|
498
|
+
// this.fml.FormulaUsage[oldIndex].contains = oldContains.reverse();
|
|
499
|
+
// }
|
|
500
|
+
// });
|
|
501
|
+
// }
|
|
502
|
+
// }
|
|
503
|
+
// codemirrorValueChanged(cm: any, change: any): void {
|
|
504
|
+
// if (change.origin !== "complete") {
|
|
505
|
+
// cm.showHint({
|
|
506
|
+
// hint: (CodeMirror as any).hint.formula,
|
|
507
|
+
// completeSingle: false,
|
|
508
|
+
// shown: function () { },
|
|
509
|
+
// select: function (cpt: any, ele: any) { },
|
|
510
|
+
// pick: function (item: any) { },
|
|
511
|
+
// });
|
|
512
|
+
// } else {
|
|
513
|
+
// this.insertBarcket();
|
|
514
|
+
// }
|
|
515
|
+
// setTimeout(() => {
|
|
516
|
+
// this.getValue();
|
|
517
|
+
// }, 0);
|
|
518
|
+
// }
|
|
519
|
+
// setOptionIfChanged(optionName: string, newValue: any): void {
|
|
520
|
+
// if (!this.codeMirror) {
|
|
521
|
+
// return;
|
|
522
|
+
// }
|
|
523
|
+
// this.codeMirror.setOption(optionName as any, newValue);
|
|
524
|
+
// }
|
|
525
|
+
// focusChanged(focused: boolean): void {
|
|
526
|
+
// this.onTouched();
|
|
527
|
+
// this.isFocused = focused;
|
|
528
|
+
// // CodeMirror.fomulaContext = this._fomulaContext;
|
|
529
|
+
// this.focusChange.emit(focused);
|
|
530
|
+
// }
|
|
531
|
+
// scrollChanged(cm: Editor): void {
|
|
532
|
+
// this.scroll.emit(cm.getScrollInfo());
|
|
533
|
+
// }
|
|
534
|
+
// cursorActive(cm: Editor): void {
|
|
535
|
+
// this.cursorActivity.emit(cm);
|
|
536
|
+
// }
|
|
537
|
+
// dropFiles(cm: Editor, e: DragEvent): void {
|
|
538
|
+
// this.drop.emit([cm, e]);
|
|
539
|
+
// }
|
|
540
|
+
// writeValue(value: string): void {
|
|
541
|
+
// if (value === null || value === undefined) {
|
|
542
|
+
// if (this.codeMirror) {
|
|
543
|
+
// this.codeMirror.setValue("");
|
|
544
|
+
// }
|
|
545
|
+
// return;
|
|
546
|
+
// }
|
|
547
|
+
// this.value = value;
|
|
548
|
+
// this.setValue();
|
|
549
|
+
// }
|
|
550
|
+
// registerOnChange(fn: (value: string) => void): void {
|
|
551
|
+
// this.onChange = fn;
|
|
552
|
+
// }
|
|
553
|
+
// registerOnTouched(fn: () => void): void {
|
|
554
|
+
// this.onTouched = fn;
|
|
555
|
+
// }
|
|
556
|
+
// setDisabledState(isDisabled: boolean): void {
|
|
557
|
+
// this.disabled = isDisabled;
|
|
558
|
+
// this.setOptionIfChanged("readOnly", this.disabled);
|
|
559
|
+
// }
|
|
560
|
+
// /**
|
|
561
|
+
// * 函数鼠标滑动时事件
|
|
562
|
+
// * @param e
|
|
563
|
+
// */
|
|
564
|
+
// usageMouseover(e: any) {
|
|
565
|
+
// let usage = e.usage ? `<li class="usage"> 用法:${e.usage} </li>` : "";
|
|
566
|
+
// this.usageDescription = `
|
|
567
|
+
// <div class="formula-title">${e.name}</div>
|
|
568
|
+
// <ul class="intro-wrapper">
|
|
569
|
+
// <li class="intro">
|
|
570
|
+
// ${e.intro}
|
|
571
|
+
// </li>
|
|
572
|
+
// ${usage}
|
|
573
|
+
// <li class="example">示例:${e.example}</li>
|
|
574
|
+
// </ul>
|
|
575
|
+
// `;
|
|
576
|
+
// }
|
|
577
|
+
// /**
|
|
578
|
+
// * 插入函数
|
|
579
|
+
// * @param e
|
|
580
|
+
// */
|
|
581
|
+
// insertUsageFun(e: any) {
|
|
582
|
+
// if (this.codeMirror && this.codeMirror !== null) {
|
|
583
|
+
// let c = this.codeMirror.getCursor();
|
|
584
|
+
// this.codeMirror.replaceSelection(`${e.name}`);
|
|
585
|
+
// let d = this.codeMirror.getCursor();
|
|
586
|
+
// this.insertBarcket();
|
|
587
|
+
// this.getValue();
|
|
588
|
+
// }
|
|
589
|
+
// }
|
|
590
|
+
// /**
|
|
591
|
+
// * 插入可用变量
|
|
592
|
+
// * @param event
|
|
593
|
+
// */
|
|
594
|
+
// insertField(event: any) {
|
|
595
|
+
// if (this.codeMirror && this.codeMirror !== null) {
|
|
596
|
+
// let c = this.codeMirror.getCursor();
|
|
597
|
+
// this.codeMirror.replaceSelection("" + event.label + "");
|
|
598
|
+
// let d = this.codeMirror.getCursor();
|
|
599
|
+
// let e = {
|
|
600
|
+
// from: c,
|
|
601
|
+
// to: d,
|
|
602
|
+
// key: '$' + `{${event.key}}`, // 工作项ID
|
|
603
|
+
// label: event.label,
|
|
604
|
+
// };
|
|
605
|
+
// this.markField(e);
|
|
606
|
+
// this.codeMirror.focus();
|
|
607
|
+
// this.getValue();
|
|
608
|
+
// }
|
|
609
|
+
// }
|
|
610
|
+
// /**
|
|
611
|
+
// * 复制
|
|
612
|
+
// */
|
|
613
|
+
// btnCopy() {
|
|
614
|
+
// if (!!`${this.value}`) {
|
|
615
|
+
// let value = (_.cloneDeep(this.value) as string).replace("↵", "");
|
|
616
|
+
// localStorage.setItem("codemirror", value);
|
|
617
|
+
// this.message.success(`复制成功`);
|
|
618
|
+
// } else {
|
|
619
|
+
// this.message.warning(`公式为空,请配置公式后复制`);
|
|
620
|
+
// }
|
|
621
|
+
// }
|
|
622
|
+
// /**
|
|
623
|
+
// * 粘贴
|
|
624
|
+
// */
|
|
625
|
+
// btnPaste() {
|
|
626
|
+
// if (!!localStorage.getItem("codemirror")) {
|
|
627
|
+
// if (!this.value) {
|
|
628
|
+
// this.value = localStorage.getItem("codemirror") as string;
|
|
629
|
+
// } else {
|
|
630
|
+
// this.value = `${this.value}${localStorage.getItem("codemirror") as string}`;
|
|
631
|
+
// }
|
|
632
|
+
// this.setValue();
|
|
633
|
+
// this.message.success(`粘贴成功`);
|
|
634
|
+
// } else {
|
|
635
|
+
// this.message.warning(`没有需要粘贴的数据,请先复制`);
|
|
636
|
+
// }
|
|
637
|
+
// }
|
|
638
|
+
// /**
|
|
639
|
+
// * 清空
|
|
640
|
+
// */
|
|
641
|
+
// btnClear() {
|
|
642
|
+
// this.value = null;
|
|
643
|
+
// if (this.codeMirror) {
|
|
644
|
+
// this.codeMirror.setValue("");
|
|
645
|
+
// }
|
|
646
|
+
// this.message.success(`清空成功`);
|
|
647
|
+
// }
|
|
648
|
+
// private onChange = (_: any) => { };
|
|
649
|
+
// private onTouched = () => { };
|
|
650
|
+
// private markField(e: any) {
|
|
651
|
+
// if (this.codeMirror && this.codeMirror !== null) {
|
|
652
|
+
// let node = document.createElement("span");
|
|
653
|
+
// node.innerHTML = e.label;
|
|
654
|
+
// node.className = "cm-field cm-field-value";
|
|
655
|
+
// node.setAttribute("field-key", e.key);
|
|
656
|
+
// this.codeMirror.markText(e.from, e.to, {
|
|
657
|
+
// handleMouseEvents: !0,
|
|
658
|
+
// atomic: !0,
|
|
659
|
+
// replacedWith: node,
|
|
660
|
+
// });
|
|
661
|
+
// let d = this.codeMirror.getCursor();
|
|
662
|
+
// }
|
|
663
|
+
// }
|
|
664
|
+
// private insertBarcket() {
|
|
665
|
+
// if (this.codeMirror && this.codeMirror !== null) {
|
|
666
|
+
// let c = this.codeMirror.getCursor();
|
|
667
|
+
// this.codeMirror.replaceSelection("(");
|
|
668
|
+
// let d = this.codeMirror.getCursor();
|
|
669
|
+
// let c1 = this.codeMirror.getCursor();
|
|
670
|
+
// this.codeMirror.replaceSelection(")");
|
|
671
|
+
// let d1 = this.codeMirror.getCursor();
|
|
672
|
+
// this.codeMirror.setCursor(d);
|
|
673
|
+
// this.codeMirror.focus();
|
|
674
|
+
// }
|
|
675
|
+
// }
|
|
676
|
+
// private getValue() {
|
|
677
|
+
// let result: any = [];
|
|
678
|
+
// let codeContent =
|
|
679
|
+
// this.el.nativeElement.querySelectorAll(".CodeMirror-line");
|
|
680
|
+
// this.fml.Utils.forEach(codeContent, (t: any, e: any) => {
|
|
681
|
+
// this.fml.Utils.forEach(e.children, (t1: any, e1: any) => {
|
|
682
|
+
// this.fml.Utils.forEach(e1.children, (t2: any, e2: any) => {
|
|
683
|
+
// if (
|
|
684
|
+
// e2.getAttribute("cm-text") !== undefined &&
|
|
685
|
+
// e2.getAttribute("cm-text") !== null
|
|
686
|
+
// ) {
|
|
687
|
+
// result.push("↵");
|
|
688
|
+
// } else {
|
|
689
|
+
// if (e2.className === "CodeMirror-widget") {
|
|
690
|
+
// this.fml.Utils.forEach(e2.children, (t3: any, e3: any) => {
|
|
691
|
+
// if (
|
|
692
|
+
// e3.getAttribute("field-key") !== undefined &&
|
|
693
|
+
// e3.getAttribute("field-key") !== null
|
|
694
|
+
// ) {
|
|
695
|
+
// result.push(e3.getAttribute("field-key"));
|
|
696
|
+
// } else {
|
|
697
|
+
// result.push(e3.innerText);
|
|
698
|
+
// }
|
|
699
|
+
// });
|
|
700
|
+
// } else {
|
|
701
|
+
// result.push(e2.innerText);
|
|
702
|
+
// }
|
|
703
|
+
// }
|
|
704
|
+
// });
|
|
705
|
+
// });
|
|
706
|
+
// });
|
|
707
|
+
// if (result[0] === "↵") {
|
|
708
|
+
// result.splice(0, 1);
|
|
709
|
+
// }
|
|
710
|
+
// this.value = result.join("");
|
|
711
|
+
// if (this.codeMirror) {
|
|
712
|
+
// this.textChange.emit(this.codeMirror.getValue());
|
|
713
|
+
// }
|
|
714
|
+
// this.onChange(this.value);
|
|
715
|
+
// }
|
|
716
|
+
// private fakeLabel(t: any) {
|
|
717
|
+
// return t ? t.replace(/[\[\]()'"]/g, " ") : "";
|
|
718
|
+
// }
|
|
719
|
+
// private setValue() {
|
|
720
|
+
// if (this.value === undefined || this.value === null || this.value === "") {
|
|
721
|
+
// return;
|
|
722
|
+
// }
|
|
723
|
+
// let e: any = [];
|
|
724
|
+
// let p: any = [];
|
|
725
|
+
// let t: any[] = this.value.split("\n");
|
|
726
|
+
// this.fml.Utils.forEach(t, (c: any, t1: any) => {
|
|
727
|
+
// let d: any = "",
|
|
728
|
+
// t = t1.split(
|
|
729
|
+
// new RegExp(this.fml.FormulaEditor.COMMON_REG.FORM_FORMULA, "g")
|
|
730
|
+
// );
|
|
731
|
+
// this.fml.Utils.forEach(t, (t: any, e: any) => {
|
|
732
|
+
// let i: any, a: any, n: any, s: any, o: any, r: any, l: any;
|
|
733
|
+
// this.fml.FormulaEditor.CONST.FIELD_REG.test(e)
|
|
734
|
+
// ? ((a = !1),
|
|
735
|
+
// this.labelMap &&
|
|
736
|
+
// (i = this.labelMap[e] ? this.labelMap[e] : " ") &&
|
|
737
|
+
// ((i = this.fakeLabel(i)), (a = !0)),
|
|
738
|
+
// (n = !1),
|
|
739
|
+
// this.fml.Utils.isNull(i) && ((i = 1), (n = !0)),
|
|
740
|
+
// (s = (l = e.replace("$", "").split("}"))[0]),
|
|
741
|
+
// (o = l[1]),
|
|
742
|
+
// (r = CodeMirror.Pos(c, d.length)),
|
|
743
|
+
// (d += i),
|
|
744
|
+
// (l = CodeMirror.Pos(c, d.length)),
|
|
745
|
+
// p.push({
|
|
746
|
+
// from: r,
|
|
747
|
+
// to: l,
|
|
748
|
+
// key: `$${s}}`,
|
|
749
|
+
// label: a ? (this.labelMap[e] ? this.labelMap[e] : "") : null,
|
|
750
|
+
// }))
|
|
751
|
+
// : (d += e);
|
|
752
|
+
// });
|
|
753
|
+
// e.push(d);
|
|
754
|
+
// });
|
|
755
|
+
// if (this.codeMirror) {
|
|
756
|
+
// this.codeMirror.setValue(e.join("\n"));
|
|
757
|
+
// this.fml.Utils.forEach(p, (t: any, e: any) => {
|
|
758
|
+
// this.markField(e);
|
|
759
|
+
// });
|
|
760
|
+
// }
|
|
761
|
+
// }
|
|
762
|
+
// }
|
|
763
|
+
class GramCodemirrorComponent {
|
|
764
|
+
constructor() { }
|
|
765
|
+
ngOnInit() { }
|
|
766
|
+
ngAfterViewInit() {
|
|
767
|
+
}
|
|
768
|
+
ngOnChanges(change) {
|
|
769
|
+
}
|
|
770
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GramCodemirrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
771
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: GramCodemirrorComponent, isStandalone: true, selector: "deon-codemirror", usesOnChanges: true, ngImport: i0, template: "<!-- <div class=\"formula-head\">\r\n <div class=\"formula-title\">\r\n <span class=\"formula-name\">{{ title }}</span><span class=\"formula-equal\">=</span>\r\n </div>\r\n <div class=\"formula-body\">\r\n <textarea [name]=\"name\" autocomplete=\"off\" [autofocus]=\"autoFocus\" #ref>\r\n </textarea>\r\n <div class=\"button-body\">\r\n <button nz-button type=\"button\" nzSize=\"small\" (click)=\"btnCopy()\">\u590D\u5236</button>\r\n <button nz-button type=\"button\" nzSize=\"small\" (click)=\"btnPaste()\">\u7C98\u8D34</button>\r\n <button nz-button type=\"button\" nzSize=\"small\" (click)=\"btnClear()\">\u6E05\u7A7A</button>\r\n </div>\r\n </div>\r\n</div>\r\n<div class=\"formula-wrapper\">\r\n <div class=\"field-list\">\r\n <div class=\"title\">\u53EF\u7528\u53D8\u91CF</div>\r\n <div class=\"field-wrapper\">\r\n <div class=\"search\">\r\n <input type=\"text\" nz-input placeholder=\"\u641C\u7D22\u53EF\u7528\u53D8\u91CF\" [(ngModel)]=\"variableSearch\" />\r\n </div>\r\n <div class=\"collapse-wrapper\">\r\n <ng-container *ngIf=\"fieldData!! && fieldData.length>0\">\r\n <nz-collapse [nzBordered]=\"false\">\r\n <ng-container *ngFor=\"let item of fieldData\">\r\n <nz-collapse-panel [nzHeader]=\"item.label\">\r\n <div class=\"item\" *ngFor=\"let field of item.listField\" (click)=\"insertField(field)\">\r\n {{ field.label }}\r\n </div>\r\n </nz-collapse-panel>\r\n </ng-container>\r\n </nz-collapse>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"field-list\">\r\n <div class=\"title\">\u51FD\u6570</div>\r\n <div class=\"field-wrapper\">\r\n <div class=\"search\">\r\n <input type=\"text\" nz-input placeholder=\"\u641C\u7D22\u51FD\u6570\" [(ngModel)]=\"usageFunSearch\" />\r\n </div>\r\n <div class=\"collapse-wrapper\">\r\n\r\n <ng-container *ngIf=\"FormulaUsage!! && FormulaUsage.length>0\">\r\n <nz-collapse [nzBordered]=\"false\">\r\n <ng-container *ngFor=\"let item of FormulaUsage\">\r\n <nz-collapse-panel [nzHeader]=\"item.category\">\r\n <div class=\"item\" *ngFor=\"let field of item.contains\" (mouseover)=\"usageMouseover(field)\"\r\n (click)=\"insertUsageFun(field)\">\r\n {{ field.name }}\r\n </div>\r\n </nz-collapse-panel>\r\n </ng-container>\r\n </nz-collapse>\r\n </ng-container>\r\n\r\n\r\n <ng-template #searchPanel>\r\n <ul>\r\n <li *ngFor=\"let item of usageFunSearchList\" (mouseover)=\"usageMouseover(item)\"\r\n (click)=\"insertUsageFun(item)\">\r\n {{ item.name }}\r\n </li>\r\n </ul>\r\n </ng-template>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"formula-intro\" [innerHtml]=\"usageDescription | safeHtml\"></div>\r\n</div> -->", styles: [":host ::ng-deep{display:flex;flex-direction:column;width:100%}:host ::ng-deep .CodeMirror{height:200px}:host ::ng-deep input::placeholder{font-size:12px!important}:host ::ng-deep .ant-input{font-size:12px!important;border:0!important}:host ::ng-deep .ant-input:focus{box-shadow:none!important}:host ::ng-deep .formula-head{display:flex;flex-direction:column;width:100%;overflow:hidden;font-size:12px;border:1px solid #eaeaea;border-radius:4px}:host ::ng-deep .formula-head .formula-title{display:inline-block;width:100%;padding:8px 12px;background:#f3f8fb}:host ::ng-deep .formula-head .formula-body{padding:12px 12px 0}:host ::ng-deep .formula-head .formula-body .button-body{display:inline-block;width:100%;padding:0 0 10px;text-align:right}:host ::ng-deep .formula-head .formula-body .button-body button{font-size:12px!important}:host ::ng-deep .formula-wrapper{display:flex;flex-direction:row;height:280px;margin-top:10px;font-size:12px}:host ::ng-deep .formula-wrapper .search{border-bottom:1px solid #eaeaea}:host ::ng-deep .formula-wrapper .field-list+.field-list{padding-left:15px}:host ::ng-deep .formula-wrapper .field-list{display:flex;flex-direction:column;width:230px;height:100%}:host ::ng-deep .formula-wrapper .field-list .title{display:inline-block;height:20px}:host ::ng-deep .formula-wrapper .field-list .field-wrapper{display:flex;flex:1;flex-direction:column;width:100%;overflow:auto;border:1px solid #eaeaea;border-radius:2px}:host ::ng-deep .formula-wrapper .field-list .item{padding:3px 0 0;cursor:pointer}:host ::ng-deep .formula-wrapper .collapse-wrapper{flex:1;overflow-x:overlay;overflow-y:overlay}:host ::ng-deep .formula-wrapper .collapse-wrapper::-webkit-scrollbar{width:8px}:host ::ng-deep .formula-wrapper .collapse-wrapper::-webkit-scrollbar-thumb{background-color:#94949475;border-radius:7px}:host ::ng-deep .formula-wrapper .collapse-wrapper::-webkit-scrollbar-track{background-color:#fff}:host ::ng-deep .formula-intro{flex:1;margin:20px 0 0 15px;border:1px solid #eaeaea}:host ::ng-deep .formula-intro ul{margin:0;padding:0}:host ::ng-deep .formula-intro .intro-wrapper{height:240px;margin:0;padding:10px 0 0;color:#5e6d82;overflow-x:overlay;overflow-y:overlay}:host ::ng-deep .formula-intro .intro-wrapper::-webkit-scrollbar{width:8px}:host ::ng-deep .formula-intro .intro-wrapper::-webkit-scrollbar-thumb{background-color:#94949475;border-radius:7px}:host ::ng-deep .formula-intro .intro-wrapper::-webkit-scrollbar-track{background-color:#fff}:host ::ng-deep .formula-intro .intro-wrapper>li{padding:2px 10px;word-wrap:break-word;word-break:break-all;list-style-type:none}:host ::ng-deep .formula-intro .default>li{margin-left:25px;padding:5px 0;list-style-type:disc}:host ::ng-deep .formula-intro .formula-title{height:35px;padding-left:10px;line-height:35px;border-bottom:solid 1px #e0e0e0}:host ::ng-deep .ant-collapse-borderless{background-color:#fff}:host ::ng-deep .ant-collapse-borderless .ant-collapse-item{border-bottom:0}:host ::ng-deep .ant-collapse-header{padding:10px 15px 0 19px!important;font-size:12px}:host ::ng-deep .ant-collapse-header i{top:3px!important;left:5px!important;padding:10px 15px 10px 0!important}:host ::ng-deep .ant-collapse-content-box{padding:0 16px!important;font-size:12px!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
772
|
+
}
|
|
773
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GramCodemirrorComponent, decorators: [{
|
|
774
|
+
type: Component,
|
|
775
|
+
args: [{ selector: "deon-codemirror", imports: [
|
|
776
|
+
CommonModule
|
|
777
|
+
], template: "<!-- <div class=\"formula-head\">\r\n <div class=\"formula-title\">\r\n <span class=\"formula-name\">{{ title }}</span><span class=\"formula-equal\">=</span>\r\n </div>\r\n <div class=\"formula-body\">\r\n <textarea [name]=\"name\" autocomplete=\"off\" [autofocus]=\"autoFocus\" #ref>\r\n </textarea>\r\n <div class=\"button-body\">\r\n <button nz-button type=\"button\" nzSize=\"small\" (click)=\"btnCopy()\">\u590D\u5236</button>\r\n <button nz-button type=\"button\" nzSize=\"small\" (click)=\"btnPaste()\">\u7C98\u8D34</button>\r\n <button nz-button type=\"button\" nzSize=\"small\" (click)=\"btnClear()\">\u6E05\u7A7A</button>\r\n </div>\r\n </div>\r\n</div>\r\n<div class=\"formula-wrapper\">\r\n <div class=\"field-list\">\r\n <div class=\"title\">\u53EF\u7528\u53D8\u91CF</div>\r\n <div class=\"field-wrapper\">\r\n <div class=\"search\">\r\n <input type=\"text\" nz-input placeholder=\"\u641C\u7D22\u53EF\u7528\u53D8\u91CF\" [(ngModel)]=\"variableSearch\" />\r\n </div>\r\n <div class=\"collapse-wrapper\">\r\n <ng-container *ngIf=\"fieldData!! && fieldData.length>0\">\r\n <nz-collapse [nzBordered]=\"false\">\r\n <ng-container *ngFor=\"let item of fieldData\">\r\n <nz-collapse-panel [nzHeader]=\"item.label\">\r\n <div class=\"item\" *ngFor=\"let field of item.listField\" (click)=\"insertField(field)\">\r\n {{ field.label }}\r\n </div>\r\n </nz-collapse-panel>\r\n </ng-container>\r\n </nz-collapse>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"field-list\">\r\n <div class=\"title\">\u51FD\u6570</div>\r\n <div class=\"field-wrapper\">\r\n <div class=\"search\">\r\n <input type=\"text\" nz-input placeholder=\"\u641C\u7D22\u51FD\u6570\" [(ngModel)]=\"usageFunSearch\" />\r\n </div>\r\n <div class=\"collapse-wrapper\">\r\n\r\n <ng-container *ngIf=\"FormulaUsage!! && FormulaUsage.length>0\">\r\n <nz-collapse [nzBordered]=\"false\">\r\n <ng-container *ngFor=\"let item of FormulaUsage\">\r\n <nz-collapse-panel [nzHeader]=\"item.category\">\r\n <div class=\"item\" *ngFor=\"let field of item.contains\" (mouseover)=\"usageMouseover(field)\"\r\n (click)=\"insertUsageFun(field)\">\r\n {{ field.name }}\r\n </div>\r\n </nz-collapse-panel>\r\n </ng-container>\r\n </nz-collapse>\r\n </ng-container>\r\n\r\n\r\n <ng-template #searchPanel>\r\n <ul>\r\n <li *ngFor=\"let item of usageFunSearchList\" (mouseover)=\"usageMouseover(item)\"\r\n (click)=\"insertUsageFun(item)\">\r\n {{ item.name }}\r\n </li>\r\n </ul>\r\n </ng-template>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"formula-intro\" [innerHtml]=\"usageDescription | safeHtml\"></div>\r\n</div> -->", styles: [":host ::ng-deep{display:flex;flex-direction:column;width:100%}:host ::ng-deep .CodeMirror{height:200px}:host ::ng-deep input::placeholder{font-size:12px!important}:host ::ng-deep .ant-input{font-size:12px!important;border:0!important}:host ::ng-deep .ant-input:focus{box-shadow:none!important}:host ::ng-deep .formula-head{display:flex;flex-direction:column;width:100%;overflow:hidden;font-size:12px;border:1px solid #eaeaea;border-radius:4px}:host ::ng-deep .formula-head .formula-title{display:inline-block;width:100%;padding:8px 12px;background:#f3f8fb}:host ::ng-deep .formula-head .formula-body{padding:12px 12px 0}:host ::ng-deep .formula-head .formula-body .button-body{display:inline-block;width:100%;padding:0 0 10px;text-align:right}:host ::ng-deep .formula-head .formula-body .button-body button{font-size:12px!important}:host ::ng-deep .formula-wrapper{display:flex;flex-direction:row;height:280px;margin-top:10px;font-size:12px}:host ::ng-deep .formula-wrapper .search{border-bottom:1px solid #eaeaea}:host ::ng-deep .formula-wrapper .field-list+.field-list{padding-left:15px}:host ::ng-deep .formula-wrapper .field-list{display:flex;flex-direction:column;width:230px;height:100%}:host ::ng-deep .formula-wrapper .field-list .title{display:inline-block;height:20px}:host ::ng-deep .formula-wrapper .field-list .field-wrapper{display:flex;flex:1;flex-direction:column;width:100%;overflow:auto;border:1px solid #eaeaea;border-radius:2px}:host ::ng-deep .formula-wrapper .field-list .item{padding:3px 0 0;cursor:pointer}:host ::ng-deep .formula-wrapper .collapse-wrapper{flex:1;overflow-x:overlay;overflow-y:overlay}:host ::ng-deep .formula-wrapper .collapse-wrapper::-webkit-scrollbar{width:8px}:host ::ng-deep .formula-wrapper .collapse-wrapper::-webkit-scrollbar-thumb{background-color:#94949475;border-radius:7px}:host ::ng-deep .formula-wrapper .collapse-wrapper::-webkit-scrollbar-track{background-color:#fff}:host ::ng-deep .formula-intro{flex:1;margin:20px 0 0 15px;border:1px solid #eaeaea}:host ::ng-deep .formula-intro ul{margin:0;padding:0}:host ::ng-deep .formula-intro .intro-wrapper{height:240px;margin:0;padding:10px 0 0;color:#5e6d82;overflow-x:overlay;overflow-y:overlay}:host ::ng-deep .formula-intro .intro-wrapper::-webkit-scrollbar{width:8px}:host ::ng-deep .formula-intro .intro-wrapper::-webkit-scrollbar-thumb{background-color:#94949475;border-radius:7px}:host ::ng-deep .formula-intro .intro-wrapper::-webkit-scrollbar-track{background-color:#fff}:host ::ng-deep .formula-intro .intro-wrapper>li{padding:2px 10px;word-wrap:break-word;word-break:break-all;list-style-type:none}:host ::ng-deep .formula-intro .default>li{margin-left:25px;padding:5px 0;list-style-type:disc}:host ::ng-deep .formula-intro .formula-title{height:35px;padding-left:10px;line-height:35px;border-bottom:solid 1px #e0e0e0}:host ::ng-deep .ant-collapse-borderless{background-color:#fff}:host ::ng-deep .ant-collapse-borderless .ant-collapse-item{border-bottom:0}:host ::ng-deep .ant-collapse-header{padding:10px 15px 0 19px!important;font-size:12px}:host ::ng-deep .ant-collapse-header i{top:3px!important;left:5px!important;padding:10px 15px 10px 0!important}:host ::ng-deep .ant-collapse-content-box{padding:0 16px!important;font-size:12px!important}\n"] }]
|
|
778
|
+
}], ctorParameters: () => [] });
|
|
779
|
+
|
|
780
|
+
const components = [GramCodemirrorComponent];
|
|
781
|
+
class GramCodemirrorModule {
|
|
782
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GramCodemirrorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
783
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: GramCodemirrorModule, imports: [GramCodemirrorComponent], exports: [GramCodemirrorComponent] });
|
|
784
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GramCodemirrorModule, imports: [components] });
|
|
785
|
+
}
|
|
786
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GramCodemirrorModule, decorators: [{
|
|
787
|
+
type: NgModule,
|
|
788
|
+
args: [{
|
|
789
|
+
exports: [...components],
|
|
790
|
+
imports: [...components],
|
|
791
|
+
}]
|
|
792
|
+
}] });
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Public API surface of GramCodemirror
|
|
796
|
+
*/
|
|
797
|
+
// Components
|
|
798
|
+
// // Types
|
|
799
|
+
// export * from './tools/formula'; // Assuming this exists
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* Generated bundle index. Do not edit.
|
|
803
|
+
*/
|
|
804
|
+
|
|
805
|
+
export { GramCodemirrorComponent, GramCodemirrorModule };
|
|
806
|
+
//# sourceMappingURL=codemirror.mjs.map
|