amis 1.9.1-beta.13 → 1.9.1-beta.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. package/lib/components/Select.js +2 -2
  2. package/lib/components/Select.js.map +2 -2
  3. package/lib/components/formula/Editor.d.ts +44 -40
  4. package/lib/components/formula/Editor.js +16 -5
  5. package/lib/components/formula/Editor.js.map +2 -2
  6. package/lib/components/formula/Picker.d.ts +88 -41
  7. package/lib/components/formula/Picker.js +49 -22
  8. package/lib/components/formula/Picker.js.map +2 -2
  9. package/lib/index.js +1 -1
  10. package/lib/locale/zh-CN.js +1 -1
  11. package/lib/locale/zh-CN.js.map +2 -2
  12. package/lib/renderers/Action.js +2 -1
  13. package/lib/renderers/Action.js.map +2 -2
  14. package/lib/renderers/CRUD.js +3 -0
  15. package/lib/renderers/CRUD.js.map +2 -2
  16. package/lib/renderers/Form/InputFormula.d.ts +6 -2
  17. package/lib/renderers/Form/InputFormula.js +4 -3
  18. package/lib/renderers/Form/InputFormula.js.map +2 -2
  19. package/lib/renderers/Form/InputTree.d.ts +4 -0
  20. package/lib/renderers/Form/InputTree.js +2 -2
  21. package/lib/renderers/Form/InputTree.js.map +2 -2
  22. package/lib/renderers/Table/index.js +2 -1
  23. package/lib/renderers/Table/index.js.map +2 -2
  24. package/lib/renderers/Tabs.d.ts +6 -2
  25. package/lib/renderers/Tabs.js +21 -0
  26. package/lib/renderers/Tabs.js.map +2 -2
  27. package/lib/themes/ang-ie11.css +45 -6
  28. package/lib/themes/ang.css +40 -6
  29. package/lib/themes/ang.css.map +1 -1
  30. package/lib/themes/antd-ie11.css +45 -6
  31. package/lib/themes/antd.css +40 -6
  32. package/lib/themes/antd.css.map +1 -1
  33. package/lib/themes/cxd-ie11.css +45 -6
  34. package/lib/themes/cxd.css +40 -6
  35. package/lib/themes/cxd.css.map +1 -1
  36. package/lib/themes/dark-ie11.css +45 -6
  37. package/lib/themes/dark.css +40 -6
  38. package/lib/themes/dark.css.map +1 -1
  39. package/lib/themes/default-ie11.css +45 -6
  40. package/lib/themes/default.css +40 -6
  41. package/lib/themes/default.css.map +1 -1
  42. package/lib/utils/formula.js +4 -3
  43. package/lib/utils/formula.js.map +2 -2
  44. package/package.json +2 -2
  45. package/schema.json +41 -38
  46. package/scss/components/_formula.scss +45 -4
  47. package/scss/components/form/_checks.scss +47 -44
  48. package/scss/components/form/_select.scss +3 -2
  49. package/sdk/ang-ie11.css +52 -6
  50. package/sdk/ang.css +47 -6
  51. package/sdk/antd-ie11.css +52 -6
  52. package/sdk/antd.css +47 -6
  53. package/sdk/barcode.js +51 -51
  54. package/sdk/charts.js +14 -14
  55. package/sdk/codemirror.js +7 -7
  56. package/sdk/color-picker.js +65 -65
  57. package/sdk/cropperjs.js +2 -2
  58. package/sdk/cxd-ie11.css +52 -6
  59. package/sdk/cxd.css +47 -6
  60. package/sdk/dark-ie11.css +52 -6
  61. package/sdk/dark.css +47 -6
  62. package/sdk/exceljs.js +1 -1
  63. package/sdk/markdown.js +69 -69
  64. package/sdk/papaparse.js +1 -1
  65. package/sdk/renderers/Form/CityDB.js +1 -1
  66. package/sdk/rest.js +16 -16
  67. package/sdk/rich-text.js +62 -62
  68. package/sdk/sdk-ie11.css +52 -6
  69. package/sdk/sdk.css +47 -6
  70. package/sdk/sdk.js +1339 -1339
  71. package/sdk/thirds/hls.js/hls.js +1 -1
  72. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  73. package/sdk/tinymce.js +57 -57
  74. package/src/components/Select.tsx +3 -6
  75. package/src/components/formula/Editor.tsx +51 -23
  76. package/src/components/formula/Picker.tsx +67 -9
  77. package/src/locale/zh-CN.ts +1 -1
  78. package/src/renderers/Action.tsx +2 -1
  79. package/src/renderers/CRUD.tsx +2 -0
  80. package/src/renderers/Form/InputFormula.tsx +11 -3
  81. package/src/renderers/Form/InputTree.tsx +7 -0
  82. package/src/renderers/Table/index.tsx +9 -7
  83. package/src/renderers/Tabs.tsx +33 -3
  84. package/src/utils/formula.ts +5 -3
@@ -42,6 +42,10 @@ export interface FormulaEditorProps extends ThemeProps, LocaleProps {
42
42
  * 变量展现模式,可选值:'tabs' | 'tree'
43
43
  */
44
44
  variableMode?: 'tabs' | 'tree';
45
+ /**
46
+ * 只展示变量,不需要其他面板
47
+ */
48
+ onlyVariable?: boolean;
45
49
  /**
46
50
  * 函数集合,默认不需要传,即 amis-formula 里面那个函数
47
51
  * 如果有扩充,则需要传。
@@ -92,7 +96,7 @@ export declare class FormulaEditor extends React.Component<FormulaEditorProps, F
92
96
  render(): JSX.Element;
93
97
  }
94
98
  declare const _default: {
95
- new (props: Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
99
+ new (props: Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
96
100
  locale?: string | undefined;
97
101
  translate?: ((str: string, ...args: any[]) => string) | undefined;
98
102
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps): {
@@ -101,12 +105,12 @@ declare const _default: {
101
105
  getWrappedInstance(): any;
102
106
  render(): JSX.Element;
103
107
  context: any;
104
- setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
108
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
105
109
  locale?: string | undefined;
106
110
  translate?: ((str: string, ...args: any[]) => string) | undefined;
107
111
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
108
112
  forceUpdate(callback?: (() => void) | undefined): void;
109
- readonly props: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
113
+ readonly props: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
110
114
  locale?: string | undefined;
111
115
  translate?: ((str: string, ...args: any[]) => string) | undefined;
112
116
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
@@ -117,35 +121,35 @@ declare const _default: {
117
121
  [key: string]: React.ReactInstance;
118
122
  };
119
123
  componentDidMount?(): void;
120
- shouldComponentUpdate?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
124
+ shouldComponentUpdate?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
121
125
  locale?: string | undefined;
122
126
  translate?: ((str: string, ...args: any[]) => string) | undefined;
123
127
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
124
128
  componentWillUnmount?(): void;
125
129
  componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
126
- getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
130
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
127
131
  locale?: string | undefined;
128
132
  translate?: ((str: string, ...args: any[]) => string) | undefined;
129
133
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
130
- componentDidUpdate?(prevProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
134
+ componentDidUpdate?(prevProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
131
135
  locale?: string | undefined;
132
136
  translate?: ((str: string, ...args: any[]) => string) | undefined;
133
137
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
134
138
  componentWillMount?(): void;
135
139
  UNSAFE_componentWillMount?(): void;
136
- componentWillReceiveProps?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
140
+ componentWillReceiveProps?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
137
141
  locale?: string | undefined;
138
142
  translate?: ((str: string, ...args: any[]) => string) | undefined;
139
143
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
140
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
144
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
141
145
  locale?: string | undefined;
142
146
  translate?: ((str: string, ...args: any[]) => string) | undefined;
143
147
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
144
- componentWillUpdate?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
148
+ componentWillUpdate?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
145
149
  locale?: string | undefined;
146
150
  translate?: ((str: string, ...args: any[]) => string) | undefined;
147
151
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
148
- UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
152
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
149
153
  locale?: string | undefined;
150
154
  translate?: ((str: string, ...args: any[]) => string) | undefined;
151
155
  }, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
@@ -153,7 +157,7 @@ declare const _default: {
153
157
  displayName: string;
154
158
  contextType: React.Context<string>;
155
159
  ComposedComponent: React.ComponentType<{
156
- new (props: Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
160
+ new (props: Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
157
161
  locale?: string | undefined;
158
162
  translate?: ((str: string, ...args: any[]) => string) | undefined;
159
163
  }): {
@@ -162,12 +166,12 @@ declare const _default: {
162
166
  getWrappedInstance(): any;
163
167
  render(): JSX.Element;
164
168
  context: any;
165
- setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
169
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
166
170
  locale?: string | undefined;
167
171
  translate?: ((str: string, ...args: any[]) => string) | undefined;
168
172
  }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
169
173
  forceUpdate(callback?: (() => void) | undefined): void;
170
- readonly props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
174
+ readonly props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
171
175
  locale?: string | undefined;
172
176
  translate?: ((str: string, ...args: any[]) => string) | undefined;
173
177
  }> & Readonly<{
@@ -178,35 +182,35 @@ declare const _default: {
178
182
  [key: string]: React.ReactInstance;
179
183
  };
180
184
  componentDidMount?(): void;
181
- shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
185
+ shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
182
186
  locale?: string | undefined;
183
187
  translate?: ((str: string, ...args: any[]) => string) | undefined;
184
188
  }>, nextState: Readonly<{}>, nextContext: any): boolean;
185
189
  componentWillUnmount?(): void;
186
190
  componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
187
- getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
191
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
188
192
  locale?: string | undefined;
189
193
  translate?: ((str: string, ...args: any[]) => string) | undefined;
190
194
  }>, prevState: Readonly<{}>): any;
191
- componentDidUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
195
+ componentDidUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
192
196
  locale?: string | undefined;
193
197
  translate?: ((str: string, ...args: any[]) => string) | undefined;
194
198
  }>, prevState: Readonly<{}>, snapshot?: any): void;
195
199
  componentWillMount?(): void;
196
200
  UNSAFE_componentWillMount?(): void;
197
- componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
201
+ componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
198
202
  locale?: string | undefined;
199
203
  translate?: ((str: string, ...args: any[]) => string) | undefined;
200
204
  }>, nextContext: any): void;
201
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
205
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
202
206
  locale?: string | undefined;
203
207
  translate?: ((str: string, ...args: any[]) => string) | undefined;
204
208
  }>, nextContext: any): void;
205
- componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
209
+ componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
206
210
  locale?: string | undefined;
207
211
  translate?: ((str: string, ...args: any[]) => string) | undefined;
208
212
  }>, nextState: Readonly<{}>, nextContext: any): void;
209
- UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
213
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
210
214
  locale?: string | undefined;
211
215
  translate?: ((str: string, ...args: any[]) => string) | undefined;
212
216
  }>, nextState: Readonly<{}>, nextContext: any): void;
@@ -218,7 +222,7 @@ declare const _default: {
218
222
  ComposedComponent: typeof FormulaEditor;
219
223
  }>;
220
224
  } & import("hoist-non-react-statics").NonReactStatics<{
221
- new (props: Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
225
+ new (props: Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
222
226
  locale?: string | undefined;
223
227
  translate?: ((str: string, ...args: any[]) => string) | undefined;
224
228
  }): {
@@ -227,12 +231,12 @@ declare const _default: {
227
231
  getWrappedInstance(): any;
228
232
  render(): JSX.Element;
229
233
  context: any;
230
- setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
234
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
231
235
  locale?: string | undefined;
232
236
  translate?: ((str: string, ...args: any[]) => string) | undefined;
233
237
  }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
234
238
  forceUpdate(callback?: (() => void) | undefined): void;
235
- readonly props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
239
+ readonly props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
236
240
  locale?: string | undefined;
237
241
  translate?: ((str: string, ...args: any[]) => string) | undefined;
238
242
  }> & Readonly<{
@@ -243,35 +247,35 @@ declare const _default: {
243
247
  [key: string]: React.ReactInstance;
244
248
  };
245
249
  componentDidMount?(): void;
246
- shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
250
+ shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
247
251
  locale?: string | undefined;
248
252
  translate?: ((str: string, ...args: any[]) => string) | undefined;
249
253
  }>, nextState: Readonly<{}>, nextContext: any): boolean;
250
254
  componentWillUnmount?(): void;
251
255
  componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
252
- getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
256
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
253
257
  locale?: string | undefined;
254
258
  translate?: ((str: string, ...args: any[]) => string) | undefined;
255
259
  }>, prevState: Readonly<{}>): any;
256
- componentDidUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
260
+ componentDidUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
257
261
  locale?: string | undefined;
258
262
  translate?: ((str: string, ...args: any[]) => string) | undefined;
259
263
  }>, prevState: Readonly<{}>, snapshot?: any): void;
260
264
  componentWillMount?(): void;
261
265
  UNSAFE_componentWillMount?(): void;
262
- componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
266
+ componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
263
267
  locale?: string | undefined;
264
268
  translate?: ((str: string, ...args: any[]) => string) | undefined;
265
269
  }>, nextContext: any): void;
266
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
270
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
267
271
  locale?: string | undefined;
268
272
  translate?: ((str: string, ...args: any[]) => string) | undefined;
269
273
  }>, nextContext: any): void;
270
- componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
274
+ componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
271
275
  locale?: string | undefined;
272
276
  translate?: ((str: string, ...args: any[]) => string) | undefined;
273
277
  }>, nextState: Readonly<{}>, nextContext: any): void;
274
- UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
278
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
275
279
  locale?: string | undefined;
276
280
  translate?: ((str: string, ...args: any[]) => string) | undefined;
277
281
  }>, nextState: Readonly<{}>, nextContext: any): void;
@@ -283,7 +287,7 @@ declare const _default: {
283
287
  ComposedComponent: typeof FormulaEditor;
284
288
  }, {}> & {
285
289
  ComposedComponent: {
286
- new (props: Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
290
+ new (props: Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
287
291
  locale?: string | undefined;
288
292
  translate?: ((str: string, ...args: any[]) => string) | undefined;
289
293
  }): {
@@ -292,12 +296,12 @@ declare const _default: {
292
296
  getWrappedInstance(): any;
293
297
  render(): JSX.Element;
294
298
  context: any;
295
- setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
299
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
296
300
  locale?: string | undefined;
297
301
  translate?: ((str: string, ...args: any[]) => string) | undefined;
298
302
  }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
299
303
  forceUpdate(callback?: (() => void) | undefined): void;
300
- readonly props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
304
+ readonly props: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
301
305
  locale?: string | undefined;
302
306
  translate?: ((str: string, ...args: any[]) => string) | undefined;
303
307
  }> & Readonly<{
@@ -308,35 +312,35 @@ declare const _default: {
308
312
  [key: string]: React.ReactInstance;
309
313
  };
310
314
  componentDidMount?(): void;
311
- shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
315
+ shouldComponentUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
312
316
  locale?: string | undefined;
313
317
  translate?: ((str: string, ...args: any[]) => string) | undefined;
314
318
  }>, nextState: Readonly<{}>, nextContext: any): boolean;
315
319
  componentWillUnmount?(): void;
316
320
  componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
317
- getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
321
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
318
322
  locale?: string | undefined;
319
323
  translate?: ((str: string, ...args: any[]) => string) | undefined;
320
324
  }>, prevState: Readonly<{}>): any;
321
- componentDidUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
325
+ componentDidUpdate?(prevProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
322
326
  locale?: string | undefined;
323
327
  translate?: ((str: string, ...args: any[]) => string) | undefined;
324
328
  }>, prevState: Readonly<{}>, snapshot?: any): void;
325
329
  componentWillMount?(): void;
326
330
  UNSAFE_componentWillMount?(): void;
327
- componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
331
+ componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
328
332
  locale?: string | undefined;
329
333
  translate?: ((str: string, ...args: any[]) => string) | undefined;
330
334
  }>, nextContext: any): void;
331
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
335
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
332
336
  locale?: string | undefined;
333
337
  translate?: ((str: string, ...args: any[]) => string) | undefined;
334
338
  }>, nextContext: any): void;
335
- componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
339
+ componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
336
340
  locale?: string | undefined;
337
341
  translate?: ((str: string, ...args: any[]) => string) | undefined;
338
342
  }>, nextState: Readonly<{}>, nextContext: any): void;
339
- UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
343
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "classPrefix" | "classnames" | "header" | "className" | "theme" | "value" | "onChange" | "functions" | "variableMode" | "onlyVariable" | "variableClassName" | "functionClassName"> & Partial<Pick<Omit<FormulaEditorProps, keyof LocaleProps>, "evalMode" | "variables">> & Partial<Pick<Pick<FormulaEditorProps, "evalMode" | "variables">, never>> & {
340
344
  locale?: string | undefined;
341
345
  translate?: ((str: string, ...args: any[]) => string) | undefined;
342
346
  }>, nextState: Readonly<{}>, nextContext: any): void;
@@ -114,6 +114,17 @@ var FormulaEditor = /** @class */ (function (_super) {
114
114
  };
115
115
  FormulaEditor.prototype.handleVariableSelect = function (item) {
116
116
  var _a;
117
+ var _b = this.props, onlyVariable = _b.onlyVariable, evalMode = _b.evalMode;
118
+ // 只展示变量时,选择即提交
119
+ if (onlyVariable) {
120
+ var onChange = this.props.onChange;
121
+ var value = item.value
122
+ ? evalMode
123
+ ? item.value
124
+ : '${' + item.value + '}'
125
+ : '';
126
+ return onChange === null || onChange === void 0 ? void 0 : onChange(value);
127
+ }
117
128
  (_a = this.editorPlugin) === null || _a === void 0 ? void 0 : _a.insertContent({
118
129
  key: item.value,
119
130
  name: item.label
@@ -127,22 +138,22 @@ var FormulaEditor = /** @class */ (function (_super) {
127
138
  return (0, plugin_1.editorFactory)(dom, cm, this.props);
128
139
  };
129
140
  FormulaEditor.prototype.render = function () {
130
- var _a = this.props, variables = _a.variables, header = _a.header, value = _a.value, functions = _a.functions, variableMode = _a.variableMode, __ = _a.translate, cx = _a.classnames, variableClassName = _a.variableClassName, functionClassName = _a.functionClassName, classPrefix = _a.classPrefix;
141
+ var _a = this.props, variables = _a.variables, header = _a.header, value = _a.value, functions = _a.functions, variableMode = _a.variableMode, onlyVariable = _a.onlyVariable, __ = _a.translate, cx = _a.classnames, variableClassName = _a.variableClassName, functionClassName = _a.functionClassName, classPrefix = _a.classPrefix;
131
142
  var focused = this.state.focused;
132
143
  var customFunctions = Array.isArray(functions) ? functions : [];
133
144
  var functionList = (0, tslib_1.__spreadArray)((0, tslib_1.__spreadArray)([], FormulaEditor.buildDefaultFunctions(doc_1.doc), true), customFunctions, true);
134
145
  return (react_1.default.createElement("div", { className: cx("FormulaEditor", {
135
146
  'is-focused': focused
136
147
  }) },
137
- react_1.default.createElement("section", { className: cx("FormulaEditor-content") },
148
+ onlyVariable ? null : (react_1.default.createElement("section", { className: cx("FormulaEditor-content") },
138
149
  react_1.default.createElement("header", { className: cx("FormulaEditor-header") }, __(header || 'FormulaEditor.title')),
139
- react_1.default.createElement(CodeMirror_1.default, { className: cx('FormulaEditor-editor'), value: value, onChange: this.handleOnChange, editorFactory: this.editorFactory, editorDidMount: this.handleEditorMounted, onFocus: this.handleFocus, onBlur: this.handleBlur })),
140
- react_1.default.createElement("section", { className: cx('FormulaEditor-settings') },
150
+ react_1.default.createElement(CodeMirror_1.default, { className: cx('FormulaEditor-editor'), value: value, onChange: this.handleOnChange, editorFactory: this.editorFactory, editorDidMount: this.handleEditorMounted, onFocus: this.handleFocus, onBlur: this.handleBlur }))),
151
+ react_1.default.createElement("section", { className: cx('FormulaEditor-settings', onlyVariable ? 'only-variable' : '') },
141
152
  react_1.default.createElement("div", { className: cx('FormulaEditor-panel') },
142
153
  variableMode !== 'tabs' ? (react_1.default.createElement("div", { className: cx('FormulaEditor-panel-header') }, __('FormulaEditor.variable'))) : null,
143
154
  react_1.default.createElement("div", { className: cx('FormulaEditor-panel-body', variableMode && "FormulaEditor-panel-body--".concat(variableMode)) },
144
155
  react_1.default.createElement(VariableList_1.default, { classPrefix: classPrefix, className: cx('FormulaEditor-VariableList', 'FormulaEditor-VariableList-root', variableClassName), selectMode: variableMode, data: variables, onSelect: this.handleVariableSelect }))),
145
- react_1.default.createElement(FuncList_1.default, { className: functionClassName, title: __('FormulaEditor.function'), data: functionList, onSelect: this.handleFunctionSelect }))));
156
+ onlyVariable ? null : (react_1.default.createElement(FuncList_1.default, { className: functionClassName, title: __('FormulaEditor.function'), data: functionList, onSelect: this.handleFunctionSelect })))));
146
157
  };
147
158
  var _a;
148
159
  FormulaEditor.defaultProps = {
@@ -6,8 +6,8 @@
6
6
  "/src/components/formula/Editor.tsx"
7
7
  ],
8
8
  "names": [],
9
- "mappings": ";;;;AAAA;;GAEG;AACH,6DAA0B;AAC1B,iDAA8C;AAC9C,6CAAmC;AACnC,6CAA0C;AAE1C,mCAAsD;AACtD,qEAAkC;AAClC,6EAA0C;AAC1C,0EAA6C;AAC7C,6CAAsD;AACtD,qCAAkD;AAClD,uCAAqD;AA2ErD;IAAmC,8CAGlC;IAHD;QAAA,qEAyOC;QArOC,WAAK,GAAiB;YACpB,OAAO,EAAE,KAAK;SACf,CAAC;;IAmOJ,CAAC;IAhOQ,mCAAqB,GAA5B,UACE,GAIE;QAEF,IAAM,KAAK,GAAqB,EAAE,CAAC;QAEnC,GAAG,CAAC,OAAO,CAAC,UAAA,IAAI;YACd,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC;YAC7C,IAAI,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,SAAS,KAAK,SAAS,EAA5B,CAA4B,CAAC,CAAC;YAC9D,IAAI,CAAC,MAAM,EAAE;gBACX,MAAM,GAAG;oBACP,SAAS,EAAE,SAAS;oBACpB,KAAK,EAAE,EAAE;iBACV,CAAC;gBACF,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACpB;YACD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAOM,4BAAc,GAArB,UACE,KAAa,EACb,SAA8B,EAC9B,QAAwB;QAAxB,yBAAA,EAAA,eAAwB;QAExB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,I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AAhQY,sCAAa;AAkQ1B,kBAAe,IAAA,+BAAc,EAC3B,IAAA,iBAAS,EAAC,IAAA,mBAAU,EAAC,aAAa,CAAC,CAAC,EACpC;IACE,KAAK,EAAE,UAAU;CAClB,EACD,CAAC,UAAU,CAAC,CACb,CAAC",
10
10
  "sourcesContent": [
11
- "/**\n * @file 公式编辑器\n */\nimport React from 'react';\nimport {uncontrollable} from 'uncontrollable';\nimport {parse} from 'amis-formula';\nimport {doc} from 'amis-formula/dist/doc';\n\nimport {FormulaPlugin, editorFactory} from './plugin';\nimport FuncList from './FuncList';\nimport VariableList from './VariableList';\nimport CodeMirrorEditor from '../CodeMirror';\nimport {autobind, eachTree} from '../../utils/helper';\nimport {themeable, ThemeProps} from '../../theme';\nimport {localeable, LocaleProps} from '../../locale';\n\nexport interface VariableItem {\n label: string;\n value?: string;\n children?: Array<VariableItem>;\n type: '';\n tag?: string;\n selectMode?: 'tree' | 'tabs';\n}\n\nexport interface FuncGroup {\n groupName: string;\n items: Array<FuncItem>;\n}\n\nexport interface FuncItem {\n name: string; // 函数名\n example?: string; // 示例\n description?: string; // 描述\n [propName: string]: any;\n}\n\nexport interface FormulaEditorProps extends ThemeProps, LocaleProps {\n onChange?: (value: string) => void;\n value?: string;\n /**\n * evalMode 即直接就是表达式,否则\n * 需要 ${这里面才是表达式}\n * 默认为 true\n */\n evalMode?: boolean;\n\n /**\n * 用于提示的变量集合,默认为空\n */\n variables?: Array<VariableItem>;\n\n /**\n * 变量展现模式,可选值:'tabs' | 'tree'\n */\n variableMode?: 'tabs' | 'tree';\n\n /**\n * 函数集合,默认不需要传,即 amis-formula 里面那个函数\n * 如果有扩充,则需要传。\n */\n functions?: Array<FuncGroup>;\n\n /**\n * 顶部标题,默认为表达式\n */\n header: string;\n\n variableClassName?: string;\n\n functionClassName?: string;\n}\n\nexport interface FunctionsProps {\n name: string;\n items: FunctionProps[];\n}\n\nexport interface FunctionProps {\n name: string;\n intro: string;\n usage: string;\n example: string;\n}\n\nexport interface FormulaState {\n focused: boolean;\n}\n\nexport class FormulaEditor extends React.Component<\n FormulaEditorProps,\n FormulaState\n> {\n state: FormulaState = {\n focused: false\n };\n editorPlugin?: FormulaPlugin;\n\n static buildDefaultFunctions(\n doc: Array<{\n namespace: string;\n name: string;\n [propName: string]: any;\n }>\n ) {\n const funcs: Array<FuncGroup> = [];\n\n doc.forEach(item => {\n const namespace = item.namespace || 'Others';\n let exists = funcs.find(item => item.groupName === namespace);\n if (!exists) {\n exists = {\n groupName: namespace,\n items: []\n };\n funcs.push(exists);\n }\n exists.items.push(item);\n });\n\n return funcs;\n }\n\n static defaultProps: Pick<FormulaEditorProps, 'variables' | 'evalMode'> = {\n variables: [],\n evalMode: true\n };\n\n static highlightValue(\n value: string,\n variables: Array<VariableItem>,\n evalMode: boolean = true\n ) {\n if (!Array.isArray(variables) || !variables.length || !value) {\n return;\n }\n\n const varMap: {\n [propname: string]: string;\n } = {};\n\n eachTree(variables, item => {\n if (item.value) {\n const key = item.value;\n varMap[key] = item.label;\n }\n });\n const vars = Object.keys(varMap)\n .filter(item => item)\n .sort((a, b) => b.length - a.length);\n\n const content = value || '';\n let html = '';\n\n // 标记方法调用\n html = content.replace(/([A-Z]+)\\s*\\(/g, (_, func, pos) => {\n return _?.replace(func, `<span class=\"c-func\">${func}</span>`);\n });\n\n vars.forEach(v => {\n let from = 0;\n let idx = -1;\n while (~(idx = content.indexOf(v, from))) {\n html = html.replace(v, `<span class=\"c-field\">${varMap[v]}</span>`);\n from = idx + v.length;\n }\n });\n\n return {html};\n }\n\n componentWillUnmount() {\n this.editorPlugin?.dispose();\n }\n\n @autobind\n handleFocus() {\n this.setState({\n focused: true\n });\n }\n\n @autobind\n handleBlur() {\n this.setState({\n focused: false\n });\n }\n\n @autobind\n insertValue(value: any, type: 'variable' | 'func') {\n this.editorPlugin?.insertContent(value, type);\n }\n\n @autobind\n handleEditorMounted(cm: any, editor: any) {\n this.editorPlugin = new FormulaPlugin(editor, cm, () => this.props);\n }\n\n @autobind\n validate() {\n const value = this.props.value;\n\n try {\n value\n ? parse(value, {\n evalMode: this.props.evalMode\n })\n : null;\n } catch (e) {\n return e.message;\n }\n\n return;\n }\n\n @autobind\n handleFunctionSelect(item: FuncItem) {\n this.editorPlugin?.insertContent(`${item.name}`, 'func');\n }\n\n @autobind\n handleVariableSelect(item: VariableItem) {\n this.editorPlugin?.insertContent(\n {\n key: item.value,\n name: item.label\n },\n 'variable'\n );\n }\n\n @autobind\n handleOnChange(value: any) {\n const onChange = this.props.onChange;\n onChange?.(value);\n }\n\n @autobind\n editorFactory(dom: HTMLElement, cm: any) {\n return editorFactory(dom, cm, this.props);\n }\n\n render() {\n const {\n variables,\n header,\n value,\n functions,\n variableMode,\n translate: __,\n classnames: cx,\n variableClassName,\n functionClassName,\n classPrefix\n } = this.props;\n const {focused} = this.state;\n const customFunctions = Array.isArray(functions) ? functions : [];\n const functionList = [\n ...FormulaEditor.buildDefaultFunctions(doc),\n ...customFunctions\n ];\n\n return (\n <div\n className={cx(`FormulaEditor`, {\n 'is-focused': focused\n })}\n >\n <section className={cx(`FormulaEditor-content`)}>\n <header className={cx(`FormulaEditor-header`)}>\n {__(header || 'FormulaEditor.title')}\n </header>\n\n <CodeMirrorEditor\n className={cx('FormulaEditor-editor')}\n value={value}\n onChange={this.handleOnChange}\n editorFactory={this.editorFactory}\n editorDidMount={this.handleEditorMounted}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n </section>\n\n <section className={cx('FormulaEditor-settings')}>\n <div className={cx('FormulaEditor-panel')}>\n {variableMode !== 'tabs' ? (\n <div className={cx('FormulaEditor-panel-header')}>\n {__('FormulaEditor.variable')}\n </div>\n ) : null}\n <div\n className={cx(\n 'FormulaEditor-panel-body',\n variableMode && `FormulaEditor-panel-body--${variableMode}`\n )}\n >\n <VariableList\n classPrefix={classPrefix}\n className={cx(\n 'FormulaEditor-VariableList',\n 'FormulaEditor-VariableList-root',\n variableClassName\n )}\n selectMode={variableMode}\n data={variables!}\n onSelect={this.handleVariableSelect}\n />\n </div>\n </div>\n\n <FuncList\n className={functionClassName}\n title={__('FormulaEditor.function')}\n data={functionList}\n onSelect={this.handleFunctionSelect}\n />\n </section>\n </div>\n );\n }\n}\n\nexport default uncontrollable(\n themeable(localeable(FormulaEditor)),\n {\n value: 'onChange'\n },\n ['validate']\n);\n"
11
+ "/**\n * @file 公式编辑器\n */\nimport React from 'react';\nimport {uncontrollable} from 'uncontrollable';\nimport {parse} from 'amis-formula';\nimport {doc} from 'amis-formula/dist/doc';\n\nimport {FormulaPlugin, editorFactory} from './plugin';\nimport FuncList from './FuncList';\nimport VariableList from './VariableList';\nimport CodeMirrorEditor from '../CodeMirror';\nimport {autobind, eachTree} from '../../utils/helper';\nimport {themeable, ThemeProps} from '../../theme';\nimport {localeable, LocaleProps} from '../../locale';\n\nexport interface VariableItem {\n label: string;\n value?: string;\n children?: Array<VariableItem>;\n type: '';\n tag?: string;\n selectMode?: 'tree' | 'tabs';\n}\n\nexport interface FuncGroup {\n groupName: string;\n items: Array<FuncItem>;\n}\n\nexport interface FuncItem {\n name: string; // 函数名\n example?: string; // 示例\n description?: string; // 描述\n [propName: string]: any;\n}\n\nexport interface FormulaEditorProps extends ThemeProps, LocaleProps {\n onChange?: (value: string) => void;\n value?: string;\n /**\n * evalMode 即直接就是表达式,否则\n * 需要 ${这里面才是表达式}\n * 默认为 true\n */\n evalMode?: boolean;\n\n /**\n * 用于提示的变量集合,默认为空\n */\n variables?: Array<VariableItem>;\n\n /**\n * 变量展现模式,可选值:'tabs' | 'tree'\n */\n variableMode?: 'tabs' | 'tree';\n\n /**\n * 只展示变量,不需要其他面板\n */\n onlyVariable?: boolean;\n\n /**\n * 函数集合,默认不需要传,即 amis-formula 里面那个函数\n * 如果有扩充,则需要传。\n */\n functions?: Array<FuncGroup>;\n\n /**\n * 顶部标题,默认为表达式\n */\n header: string;\n\n variableClassName?: string;\n\n functionClassName?: string;\n}\n\nexport interface FunctionsProps {\n name: string;\n items: FunctionProps[];\n}\n\nexport interface FunctionProps {\n name: string;\n intro: string;\n usage: string;\n example: string;\n}\n\nexport interface FormulaState {\n focused: boolean;\n}\n\nexport class FormulaEditor extends React.Component<\n FormulaEditorProps,\n FormulaState\n> {\n state: FormulaState = {\n focused: false\n };\n editorPlugin?: FormulaPlugin;\n\n static buildDefaultFunctions(\n doc: Array<{\n namespace: string;\n name: string;\n [propName: string]: any;\n }>\n ) {\n const funcs: Array<FuncGroup> = [];\n\n doc.forEach(item => {\n const namespace = item.namespace || 'Others';\n let exists = funcs.find(item => item.groupName === namespace);\n if (!exists) {\n exists = {\n groupName: namespace,\n items: []\n };\n funcs.push(exists);\n }\n exists.items.push(item);\n });\n\n return funcs;\n }\n\n static defaultProps: Pick<FormulaEditorProps, 'variables' | 'evalMode'> = {\n variables: [],\n evalMode: true\n };\n\n static highlightValue(\n value: string,\n variables: Array<VariableItem>,\n evalMode: boolean = true\n ) {\n if (!Array.isArray(variables) || !variables.length || !value) {\n return;\n }\n\n const varMap: {\n [propname: string]: string;\n } = {};\n\n eachTree(variables, item => {\n if (item.value) {\n const key = item.value;\n varMap[key] = item.label;\n }\n });\n const vars = Object.keys(varMap)\n .filter(item => item)\n .sort((a, b) => b.length - a.length);\n\n const content = value || '';\n let html = '';\n\n // 标记方法调用\n html = content.replace(/([A-Z]+)\\s*\\(/g, (_, func, pos) => {\n return _?.replace(func, `<span class=\"c-func\">${func}</span>`);\n });\n\n vars.forEach(v => {\n let from = 0;\n let idx = -1;\n while (~(idx = content.indexOf(v, from))) {\n html = html.replace(v, `<span class=\"c-field\">${varMap[v]}</span>`);\n from = idx + v.length;\n }\n });\n\n return {html};\n }\n\n componentWillUnmount() {\n this.editorPlugin?.dispose();\n }\n\n @autobind\n handleFocus() {\n this.setState({\n focused: true\n });\n }\n\n @autobind\n handleBlur() {\n this.setState({\n focused: false\n });\n }\n\n @autobind\n insertValue(value: any, type: 'variable' | 'func') {\n this.editorPlugin?.insertContent(value, type);\n }\n\n @autobind\n handleEditorMounted(cm: any, editor: any) {\n this.editorPlugin = new FormulaPlugin(editor, cm, () => this.props);\n }\n\n @autobind\n validate() {\n const value = this.props.value;\n\n try {\n value\n ? parse(value, {\n evalMode: this.props.evalMode\n })\n : null;\n } catch (e) {\n return e.message;\n }\n\n return;\n }\n\n @autobind\n handleFunctionSelect(item: FuncItem) {\n this.editorPlugin?.insertContent(`${item.name}`, 'func');\n }\n\n @autobind\n handleVariableSelect(item: VariableItem) {\n const {onlyVariable, evalMode} = this.props;\n\n // 只展示变量时,选择即提交\n if (onlyVariable) {\n const onChange = this.props.onChange;\n const value = item.value\n ? evalMode\n ? item.value\n : '${' + item.value + '}'\n : '';\n return onChange?.(value);\n }\n\n this.editorPlugin?.insertContent(\n {\n key: item.value,\n name: item.label\n },\n 'variable'\n );\n }\n\n @autobind\n handleOnChange(value: any) {\n const onChange = this.props.onChange;\n onChange?.(value);\n }\n\n @autobind\n editorFactory(dom: HTMLElement, cm: any) {\n return editorFactory(dom, cm, this.props);\n }\n\n render() {\n const {\n variables,\n header,\n value,\n functions,\n variableMode,\n onlyVariable,\n translate: __,\n classnames: cx,\n variableClassName,\n functionClassName,\n classPrefix\n } = this.props;\n const {focused} = this.state;\n const customFunctions = Array.isArray(functions) ? functions : [];\n const functionList = [\n ...FormulaEditor.buildDefaultFunctions(doc),\n ...customFunctions\n ];\n\n return (\n <div\n className={cx(`FormulaEditor`, {\n 'is-focused': focused\n })}\n >\n {onlyVariable ? null : (\n <section className={cx(`FormulaEditor-content`)}>\n <header className={cx(`FormulaEditor-header`)}>\n {__(header || 'FormulaEditor.title')}\n </header>\n\n <CodeMirrorEditor\n className={cx('FormulaEditor-editor')}\n value={value}\n onChange={this.handleOnChange}\n editorFactory={this.editorFactory}\n editorDidMount={this.handleEditorMounted}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n />\n </section>\n )}\n\n <section\n className={cx(\n 'FormulaEditor-settings',\n onlyVariable ? 'only-variable' : ''\n )}\n >\n <div className={cx('FormulaEditor-panel')}>\n {variableMode !== 'tabs' ? (\n <div className={cx('FormulaEditor-panel-header')}>\n {__('FormulaEditor.variable')}\n </div>\n ) : null}\n <div\n className={cx(\n 'FormulaEditor-panel-body',\n variableMode && `FormulaEditor-panel-body--${variableMode}`\n )}\n >\n <VariableList\n classPrefix={classPrefix}\n className={cx(\n 'FormulaEditor-VariableList',\n 'FormulaEditor-VariableList-root',\n variableClassName\n )}\n selectMode={variableMode}\n data={variables!}\n onSelect={this.handleVariableSelect}\n />\n </div>\n </div>\n\n {onlyVariable ? null : (\n <FuncList\n className={functionClassName}\n title={__('FormulaEditor.function')}\n data={functionList}\n onSelect={this.handleFunctionSelect}\n />\n )}\n </section>\n </div>\n );\n }\n}\n\nexport default uncontrollable(\n themeable(localeable(FormulaEditor)),\n {\n value: 'onChange'\n },\n ['validate']\n);\n"
12
12
  ]
13
13
  }