amis-editor 4.2.0-beta.2 → 5.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. package/dist/6dbcbb49b6fd405190a9.png +0 -0
  2. package/dist/component/Control/APIControl.d.ts +1101 -447
  3. package/dist/component/Control/ActionAPIControl.d.ts +1158 -0
  4. package/dist/component/Control/BadgeControl.d.ts +133 -0
  5. package/dist/component/Control/BaseControl.d.ts +248 -0
  6. package/dist/component/Control/DataBindingControl.d.ts +14 -0
  7. package/dist/component/Control/DataPickerControl.d.ts +13 -0
  8. package/dist/component/Control/DateShortCutControl.d.ts +83 -0
  9. package/dist/component/Control/FormulaControl.d.ts +51 -0
  10. package/dist/component/Control/OptionControl.d.ts +23 -34
  11. package/dist/component/Control/StatusControl.d.ts +39 -0
  12. package/dist/component/Control/SwitchMoreControl.d.ts +224 -0
  13. package/dist/component/Control/ValidationControl.d.ts +50 -15
  14. package/dist/component/Control/ValidationItem.d.ts +46 -0
  15. package/dist/component/Control/style-control/Background.d.ts +17 -0
  16. package/dist/component/Control/style-control/Border.d.ts +18 -0
  17. package/dist/component/Control/style-control/BoxModel.d.ts +17 -0
  18. package/dist/component/Control/style-control/BoxShadow.d.ts +18 -0
  19. package/dist/component/Control/style-control/Display.d.ts +14 -0
  20. package/dist/component/Control/style-control/Font.d.ts +16 -0
  21. package/dist/component/Control/style-control/font-family.d.ts +11 -0
  22. package/dist/component/Control/style-control/transformation.d.ts +29 -0
  23. package/dist/component/Control/style-control/types.d.ts +8 -0
  24. package/dist/component/Editor.d.ts +16 -0
  25. package/dist/component/RegionWrapper.d.ts +10 -0
  26. package/dist/component/VRenderer.d.ts +10 -0
  27. package/dist/component/schemaTpl.d.ts +8 -0
  28. package/dist/component/validator.d.ts +62 -0
  29. package/dist/dnd/index.d.ts +1 -1
  30. package/dist/event-action/action-config-panel.d.ts +8 -0
  31. package/dist/event-action/actions.d.ts +3 -0
  32. package/dist/event-action/comp-action-select.d.ts +11 -0
  33. package/dist/event-action/config.d.ts +13 -0
  34. package/dist/event-action/index.d.ts +459 -0
  35. package/dist/event-action/schema.d.ts +32 -0
  36. package/dist/exports.min.js +1 -1
  37. package/dist/index.d.ts +23 -5
  38. package/dist/index.min.js +1 -1
  39. package/dist/manager.d.ts +46 -1
  40. package/dist/plugin/Alert.d.ts +4 -2
  41. package/dist/plugin/Button.d.ts +5 -1
  42. package/dist/plugin/ButtonGroup.d.ts +13 -34
  43. package/dist/plugin/ButtonToolbar.d.ts +4 -10
  44. package/dist/plugin/CRUD.d.ts +2 -0
  45. package/dist/plugin/Chart.d.ts +2 -0
  46. package/dist/plugin/Collapse.d.ts +1 -0
  47. package/dist/plugin/CollapseGroup.d.ts +28 -4
  48. package/dist/plugin/Container.d.ts +2 -1
  49. package/dist/plugin/Dialog.d.ts +12 -2
  50. package/dist/plugin/Drawer.d.ts +12 -2
  51. package/dist/plugin/DropDownButton.d.ts +11 -11
  52. package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
  53. package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
  54. package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
  55. package/dist/plugin/Form/Checkbox.d.ts +7 -2
  56. package/dist/plugin/Form/Checkboxes.d.ts +8 -2
  57. package/dist/plugin/Form/CodeEditor.d.ts +7 -22
  58. package/dist/plugin/Form/Combo.d.ts +3 -0
  59. package/dist/plugin/Form/Control.d.ts +6 -2
  60. package/dist/plugin/Form/DiffEditor.d.ts +7 -1
  61. package/dist/plugin/Form/Form.d.ts +6 -0
  62. package/dist/plugin/Form/Formula.d.ts +1 -25
  63. package/dist/plugin/Form/InputDate.d.ts +8 -2
  64. package/dist/plugin/Form/InputDateRange.d.ts +8 -2
  65. package/dist/plugin/Form/InputDateTime.d.ts +4 -4
  66. package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
  67. package/dist/plugin/Form/InputEmail.d.ts +1 -0
  68. package/dist/plugin/Form/InputExcel.d.ts +6 -41
  69. package/dist/plugin/Form/InputFile.d.ts +7 -3
  70. package/dist/plugin/Form/InputKV.d.ts +6 -0
  71. package/dist/plugin/Form/InputMonth.d.ts +1 -0
  72. package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
  73. package/dist/plugin/Form/InputPassword.d.ts +1 -0
  74. package/dist/plugin/Form/InputQuarter.d.ts +1 -0
  75. package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
  76. package/dist/plugin/Form/InputRange.d.ts +3 -0
  77. package/dist/plugin/Form/InputRating.d.ts +9 -3
  78. package/dist/plugin/Form/InputText.d.ts +24 -2
  79. package/dist/plugin/Form/InputTime.d.ts +3 -3
  80. package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
  81. package/dist/plugin/Form/InputTree.d.ts +6 -2
  82. package/dist/plugin/Form/InputURL.d.ts +1 -0
  83. package/dist/plugin/Form/InputYear.d.ts +1 -0
  84. package/dist/plugin/Form/InputYearRange.d.ts +20 -0
  85. package/dist/plugin/Form/ListSelect.d.ts +6 -2
  86. package/dist/plugin/Form/LocationPicker.d.ts +1 -31
  87. package/dist/plugin/Form/NestedSelect.d.ts +5 -2
  88. package/dist/plugin/Form/Radios.d.ts +7 -2
  89. package/dist/plugin/Form/Select.d.ts +7 -2
  90. package/dist/plugin/Form/Switch.d.ts +7 -2
  91. package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
  92. package/dist/plugin/Form/Textarea.d.ts +7 -1
  93. package/dist/plugin/Form/Transfer.d.ts +5 -2
  94. package/dist/plugin/Form/TreeSelect.d.ts +6 -2
  95. package/dist/plugin/IFrame.d.ts +2 -2
  96. package/dist/plugin/Nav.d.ts +1 -116
  97. package/dist/plugin/Others/Action.d.ts +5 -1
  98. package/dist/plugin/Page.d.ts +5 -2
  99. package/dist/plugin/Progress.d.ts +5 -1
  100. package/dist/plugin/Table.d.ts +2 -0
  101. package/dist/plugin/Tabs.d.ts +33 -2
  102. package/dist/plugin/TooltipWrapper.d.ts +10 -0
  103. package/dist/plugin/Tpl.d.ts +2 -1
  104. package/dist/plugin/Wizard.d.ts +4 -1
  105. package/dist/plugin.d.ts +37 -1
  106. package/dist/store/editor.d.ts +65 -38
  107. package/dist/store/node.d.ts +16 -0
  108. package/dist/style.css +1 -1
  109. package/dist/util.d.ts +36 -3
  110. package/package.json +14 -8
  111. package/src/component/schemaTpl.tsx +1198 -474
  112. package/src/plugin/.DS_Store +0 -0
  113. package/src/plugin/Alert.tsx +69 -48
  114. package/src/plugin/AnchorNav.tsx +1 -0
  115. package/src/plugin/Audio.tsx +9 -15
  116. package/src/plugin/Avatar.tsx +2 -1
  117. package/src/plugin/Breadcrumb.tsx +2 -1
  118. package/src/plugin/Button.tsx +257 -188
  119. package/src/plugin/ButtonGroup.tsx +99 -38
  120. package/src/plugin/ButtonToolbar.tsx +7 -13
  121. package/src/plugin/CRUD.tsx +77 -135
  122. package/src/plugin/Card.tsx +1 -0
  123. package/src/plugin/Cards.tsx +8 -14
  124. package/src/plugin/Carousel.tsx +1 -1
  125. package/src/plugin/Chart.tsx +26 -14
  126. package/src/plugin/Collapse.tsx +78 -78
  127. package/src/plugin/CollapseGroup.tsx +165 -83
  128. package/src/plugin/Container.tsx +59 -6
  129. package/src/plugin/Custom.tsx +2 -8
  130. package/src/plugin/CustomRegion.tsx +4 -3
  131. package/src/plugin/Dialog.tsx +55 -24
  132. package/src/plugin/Drawer.tsx +65 -35
  133. package/src/plugin/DropDownButton.tsx +95 -79
  134. package/src/plugin/Flex.tsx +123 -65
  135. package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
  136. package/src/plugin/Form/ButtonToolbar.tsx +62 -55
  137. package/src/plugin/Form/ChainedSelect.tsx +45 -0
  138. package/src/plugin/Form/Checkbox.tsx +122 -33
  139. package/src/plugin/Form/Checkboxes.tsx +154 -87
  140. package/src/plugin/Form/CodeEditor.tsx +163 -34
  141. package/src/plugin/Form/Combo.tsx +104 -65
  142. package/src/plugin/Form/Control.tsx +16 -70
  143. package/src/plugin/Form/DiffEditor.tsx +158 -54
  144. package/src/plugin/Form/FieldSet.tsx +6 -11
  145. package/src/plugin/Form/Form.tsx +277 -70
  146. package/src/plugin/Form/Formula.tsx +8 -14
  147. package/src/plugin/Form/InputArray.tsx +7 -16
  148. package/src/plugin/Form/InputCity.tsx +1 -1
  149. package/src/plugin/Form/InputDate.tsx +344 -121
  150. package/src/plugin/Form/InputDateRange.tsx +303 -161
  151. package/src/plugin/Form/InputDateTime.tsx +6 -150
  152. package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
  153. package/src/plugin/Form/InputEmail.tsx +1 -0
  154. package/src/plugin/Form/InputExcel.tsx +70 -27
  155. package/src/plugin/Form/InputFile.tsx +326 -152
  156. package/src/plugin/Form/InputImage.tsx +1 -1
  157. package/src/plugin/Form/InputKV.tsx +61 -0
  158. package/src/plugin/Form/InputMonth.tsx +3 -1
  159. package/src/plugin/Form/InputMonthRange.tsx +6 -160
  160. package/src/plugin/Form/InputNumber.tsx +1 -1
  161. package/src/plugin/Form/InputPassword.tsx +2 -0
  162. package/src/plugin/Form/InputQuarter.tsx +3 -1
  163. package/src/plugin/Form/InputQuarterRange.tsx +6 -160
  164. package/src/plugin/Form/InputRange.tsx +74 -4
  165. package/src/plugin/Form/InputRating.tsx +347 -35
  166. package/src/plugin/Form/InputRichText.tsx +2 -3
  167. package/src/plugin/Form/InputTable.tsx +33 -49
  168. package/src/plugin/Form/InputTag.tsx +1 -1
  169. package/src/plugin/Form/InputText.tsx +310 -132
  170. package/src/plugin/Form/InputTime.tsx +4 -53
  171. package/src/plugin/Form/InputTimeRange.tsx +41 -0
  172. package/src/plugin/Form/InputTree.tsx +196 -46
  173. package/src/plugin/Form/InputURL.tsx +2 -0
  174. package/src/plugin/Form/InputYear.tsx +2 -0
  175. package/src/plugin/Form/InputYearRange.tsx +41 -0
  176. package/src/plugin/Form/Item.tsx +17 -18
  177. package/src/plugin/Form/ListSelect.tsx +75 -20
  178. package/src/plugin/Form/LocationPicker.tsx +2 -7
  179. package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
  180. package/src/plugin/Form/NestedSelect.tsx +110 -43
  181. package/src/plugin/Form/Picker.tsx +2 -5
  182. package/src/plugin/Form/Radios.tsx +122 -52
  183. package/src/plugin/Form/Select.tsx +239 -168
  184. package/src/plugin/Form/Static.tsx +1 -1
  185. package/src/plugin/Form/Switch.tsx +170 -58
  186. package/src/plugin/Form/TabsTransfer.tsx +175 -79
  187. package/src/plugin/Form/Textarea.tsx +146 -36
  188. package/src/plugin/Form/Transfer.tsx +295 -233
  189. package/src/plugin/Form/TreeSelect.tsx +287 -146
  190. package/src/plugin/Grid.tsx +340 -312
  191. package/src/plugin/HBox.tsx +1 -0
  192. package/src/plugin/IFrame.tsx +21 -12
  193. package/src/plugin/Image.tsx +7 -12
  194. package/src/plugin/Images.tsx +7 -12
  195. package/src/plugin/Link.tsx +6 -12
  196. package/src/plugin/List.tsx +6 -10
  197. package/src/plugin/ListItem.tsx +1 -0
  198. package/src/plugin/Nav.tsx +7 -9
  199. package/src/plugin/Others/Action.tsx +16 -10
  200. package/src/plugin/Others/BasicToolbar.tsx +4 -1
  201. package/src/plugin/Others/TableCell.tsx +19 -39
  202. package/src/plugin/Page.tsx +315 -229
  203. package/src/plugin/Panel.tsx +6 -7
  204. package/src/plugin/Plain.tsx +3 -6
  205. package/src/plugin/Progress.tsx +234 -94
  206. package/src/plugin/Service.tsx +10 -6
  207. package/src/plugin/Table.tsx +49 -20
  208. package/src/plugin/TableView.tsx +212 -106
  209. package/src/plugin/Tabs.tsx +306 -146
  210. package/src/plugin/TooltipWrapper.tsx +231 -135
  211. package/src/plugin/Tpl.tsx +68 -52
  212. package/src/plugin/Video.tsx +9 -20
  213. package/src/plugin/Wizard.tsx +537 -336
  214. package/src/plugin/Wrapper.tsx +82 -61
  215. package/src/plugin.ts +66 -4
  216. package/static/empty.png +0 -0
@@ -12,6 +12,7 @@ export declare class VRenderer extends React.Component<VRendererProps> {
12
12
  parentRegion: string;
13
13
  isCommonConfig: boolean;
14
14
  id: string;
15
+ type: string;
15
16
  label: string;
16
17
  regionInfo: (import("../plugin").RegionConfig & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("../plugin").RegionConfig, import("../plugin").RegionConfig, import("../plugin").RegionConfig>>>) | undefined;
17
18
  path: string;
@@ -34,6 +35,8 @@ export declare class VRenderer extends React.Component<VRendererProps> {
34
35
  } & {
35
36
  readonly info: RendererInfo;
36
37
  setInfo(value: RendererInfo): void;
38
+ readonly rendererConfig: import("amis-core").RendererConfig | undefined;
39
+ setRendererConfig(value: import("amis-core").RendererConfig): void;
37
40
  readonly isVitualRenderer: boolean;
38
41
  readonly clickable: boolean;
39
42
  readonly draggable: boolean;
@@ -52,6 +55,7 @@ export declare class VRenderer extends React.Component<VRendererProps> {
52
55
  isExists(id: string): boolean;
53
56
  getChildById(id: string): any;
54
57
  readonly parent: any;
58
+ readonly ancestorField: any;
55
59
  readonly host: any;
56
60
  readonly firstChild: any;
57
61
  readonly index: any;
@@ -64,6 +68,7 @@ export declare class VRenderer extends React.Component<VRendererProps> {
64
68
  updateIsCommonConfig: (value: boolean) => void;
65
69
  addChild(props: {
66
70
  id: string;
71
+ type: string;
67
72
  label: string;
68
73
  path: string;
69
74
  isCommonConfig?: boolean | undefined;
@@ -92,6 +97,7 @@ export declare class VRenderer extends React.Component<VRendererProps> {
92
97
  parentRegion: import("mobx-state-tree").IType<string | undefined, string, string>;
93
98
  isCommonConfig: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
94
99
  id: import("mobx-state-tree").IType<string | undefined, string, string>;
100
+ type: import("mobx-state-tree").IType<string | undefined, string, string>;
95
101
  label: import("mobx-state-tree").IType<string | undefined, string, string>;
96
102
  regionInfo: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IType<import("../plugin").RegionConfig, import("../plugin").RegionConfig, import("../plugin").RegionConfig>>;
97
103
  path: import("mobx-state-tree").IType<string | undefined, string, string>;
@@ -114,6 +120,8 @@ export declare class VRenderer extends React.Component<VRendererProps> {
114
120
  } & {
115
121
  readonly info: RendererInfo;
116
122
  setInfo(value: RendererInfo): void;
123
+ readonly rendererConfig: import("amis-core").RendererConfig | undefined;
124
+ setRendererConfig(value: import("amis-core").RendererConfig): void;
117
125
  readonly isVitualRenderer: boolean;
118
126
  readonly clickable: boolean;
119
127
  readonly draggable: boolean;
@@ -132,6 +140,7 @@ export declare class VRenderer extends React.Component<VRendererProps> {
132
140
  isExists(id: string): boolean;
133
141
  getChildById(id: string): any;
134
142
  readonly parent: any;
143
+ readonly ancestorField: any;
135
144
  readonly host: any;
136
145
  readonly firstChild: any;
137
146
  readonly index: any;
@@ -144,6 +153,7 @@ export declare class VRenderer extends React.Component<VRendererProps> {
144
153
  updateIsCommonConfig: (value: boolean) => void;
145
154
  addChild(props: {
146
155
  id: string;
156
+ type: string;
147
157
  label: string;
148
158
  path: string;
149
159
  isCommonConfig?: boolean | undefined;
@@ -1,3 +1,4 @@
1
+ import { SchemaCollection } from 'amis/lib/Schema';
1
2
  /**
2
3
  * 样式相关的属性面板,因为预计会比较多所以拆出来
3
4
  */
@@ -13,7 +14,14 @@ export declare const styleTpl: {
13
14
  body: any[];
14
15
  }[];
15
16
  };
17
+ export declare function getCollapseCate(config: {
18
+ name: string;
19
+ body: SchemaCollection;
20
+ visibleOn?: string;
21
+ tools: SchemaCollection;
22
+ }): void;
16
23
  export declare function getSchemaTpl(name: string, patch?: object): any;
17
24
  export declare function setSchemaTpl(name: string, value: any): void;
18
25
  export declare function valuePipeOut(value: any): any;
26
+ export declare function undefinedPipeOut(value: any): any;
19
27
  export declare function defaultValue(defaultValue: any, strictMode?: boolean): (value: any) => any;
@@ -0,0 +1,62 @@
1
+ import { SchemaObject } from 'amis/lib/schema';
2
+ /**
3
+ * 校验规则类名
4
+ */
5
+ export declare enum ValidationGroup {
6
+ Pattern = "\u6587\u672C",
7
+ Number = "\u6570\u5B57",
8
+ Regex = "\u6B63\u5219",
9
+ Others = "\u5176\u4ED6"
10
+ }
11
+ export interface Validator {
12
+ /**
13
+ * 校验规则名称,英文
14
+ */
15
+ name: string;
16
+ /**
17
+ * 校验规则标题
18
+ */
19
+ label: string;
20
+ /**
21
+ * 校验不通过的提示,没有则表示用户不能自定义配置
22
+ */
23
+ message?: string;
24
+ /**
25
+ * 分类
26
+ */
27
+ group?: string;
28
+ /**
29
+ * 快速编辑的表单
30
+ */
31
+ schema?: SchemaObject[];
32
+ /**
33
+ * 输入类型,true则表示是默认
34
+ */
35
+ tag: Partial<Record<ValidatorTag, ValidTagMatchType>>;
36
+ }
37
+ declare enum ValidTagMatchType {
38
+ isDefault = 1,
39
+ isMore = 2,
40
+ isBuiltIn = 3
41
+ }
42
+ export declare const registerValidator: (...config: Array<Validator>) => void;
43
+ export declare const getValidatorsByTag: (tag: ValidatorTag) => {
44
+ defaultValidators: Record<string, Validator>;
45
+ moreValidators: Record<string, Validator>;
46
+ builtInValidators: Record<string, Validator>;
47
+ };
48
+ export declare const getValidator: (name: string) => Validator | undefined;
49
+ export declare enum ValidatorTag {
50
+ All = "0",
51
+ Text = "1",
52
+ MultiSelect = "2",
53
+ Check = "3",
54
+ Email = "4",
55
+ Password = "5",
56
+ URL = "6",
57
+ Number = "7",
58
+ File = "8",
59
+ Date = "9",
60
+ Code = "10"
61
+ }
62
+ export {};
@@ -56,7 +56,7 @@ export declare class EditorDNDManager {
56
56
  * 比如 table 列区域的拖拽就是放根线表示拖入的位置。
57
57
  * @param region
58
58
  */
59
- makeDNDModeInstance(region: EditorNodeType): void;
59
+ makeDNDModeInstance(region: EditorNodeType): DNDModeInterface | null;
60
60
  /**
61
61
  * 拖拽入口,一个是拖拽按钮 toolbar,一个是 outline 里面的导航项
62
62
  * @param id
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 动作配置面板
3
+ */
4
+ import { RendererProps } from 'amis-core';
5
+ import React from 'react';
6
+ export default class ActionConfigPanel extends React.Component<RendererProps> {
7
+ render(): JSX.Element;
8
+ }
@@ -0,0 +1,3 @@
1
+ import { ActionTypeNode } from './index';
2
+ declare const ACTION_TYPE_TREE: ActionTypeNode[];
3
+ export default ACTION_TYPE_TREE;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * 组件专有动作选择器
3
+ */
4
+ import { Option } from 'amis';
5
+ import { RendererProps } from 'amis-core';
6
+ import React from 'react';
7
+ export declare const BASE_ACTION_PROPS: string[];
8
+ export default class CmptActionSelect extends React.Component<RendererProps> {
9
+ onChange(option: Option): void;
10
+ render(): JSX.Element;
11
+ }
@@ -0,0 +1,13 @@
1
+ import { ActionConfigItemsMap } from './index';
2
+ export declare const DATA_CONTAINER: string[];
3
+ export declare const IS_DATA_CONTAINER: string;
4
+ export declare const getComboWrapper: (items: any, multiple?: boolean) => {
5
+ type: string;
6
+ name: string;
7
+ multiple: boolean;
8
+ strictMode: boolean;
9
+ items: any[];
10
+ };
11
+ export declare const FORMITEM_CMPTS: string[];
12
+ export declare const SUPPORT_DISABLED_CMPTS: string[];
13
+ export declare const COMMON_ACTION_SCHEMA_MAP: ActionConfigItemsMap;
@@ -0,0 +1,459 @@
1
+ import React from 'react';
2
+ import Sortable from 'sortablejs';
3
+ import { DataSchema } from 'amis';
4
+ import { FormControlProps, ListenerAction } from 'amis-core';
5
+ import CmptActionSelect from './comp-action-select';
6
+ import ActionConfigPanel from './action-config-panel';
7
+ export interface RendererEvent {
8
+ eventName: string;
9
+ eventLabel: string;
10
+ description?: string;
11
+ defaultShow?: boolean;
12
+ isBroadcast?: boolean;
13
+ owner?: string;
14
+ dataSchema?: any[];
15
+ }
16
+ export interface RendererAction {
17
+ actionType: string;
18
+ actionLabel: string;
19
+ description?: string;
20
+ schema?: any;
21
+ config?: string[];
22
+ desc?: (info: any) => string | JSX.Element;
23
+ }
24
+ export interface PluginEvents {
25
+ [propName: string]: RendererEvent[];
26
+ }
27
+ export interface PluginActions {
28
+ [propName: string]: RendererAction[];
29
+ }
30
+ export interface ActionConfig extends ListenerAction {
31
+ [propName: string]: any;
32
+ }
33
+ export interface ActionEventConfig {
34
+ [propName: string]: {
35
+ weight?: number;
36
+ actions: ActionConfig[];
37
+ __isBroadcast?: boolean;
38
+ };
39
+ }
40
+ export interface ComponentInfo {
41
+ label: string;
42
+ value: string;
43
+ type: string;
44
+ disabled?: boolean;
45
+ actions?: ActionTypeNode[];
46
+ children?: ComponentInfo[];
47
+ }
48
+ export interface ActionConfigItemsMap {
49
+ [propName: string]: {
50
+ schema?: any;
51
+ config?: string[];
52
+ desc?: (info: any) => string | JSX.Element;
53
+ withComponentId?: boolean;
54
+ supportComponents?: string[];
55
+ };
56
+ }
57
+ export interface ContextVariables {
58
+ label: string;
59
+ value?: any;
60
+ tag?: string | string[];
61
+ children?: any[];
62
+ }
63
+ export interface ActionTypeNode extends RendererAction {
64
+ children?: ActionTypeNode[];
65
+ }
66
+ interface EventControlProps extends FormControlProps {
67
+ actions: PluginActions;
68
+ events: PluginEvents;
69
+ actionTree: ActionTypeNode[];
70
+ actionConfigItemsMap?: ActionConfigItemsMap;
71
+ value: ActionEventConfig;
72
+ showOldEntry?: boolean;
73
+ onChange: (value: any, submitOnChange?: boolean, changeImmediately?: boolean) => void;
74
+ addBroadcast?: (event: RendererEvent) => void;
75
+ removeBroadcast?: (eventName: string) => void;
76
+ getComponents: () => ComponentInfo[];
77
+ getContextSchemas?: (id?: string, withoutSuper?: boolean) => DataSchema;
78
+ owner?: string;
79
+ }
80
+ interface EventControlState {
81
+ onEvent: ActionEventConfig;
82
+ events: RendererEvent[];
83
+ eventPanelActive: {
84
+ [prop: string]: boolean;
85
+ };
86
+ showAcionDialog: boolean;
87
+ actionData: {
88
+ eventKey: string;
89
+ actionIndex?: number;
90
+ action?: ActionConfig;
91
+ variables?: ContextVariables[];
92
+ } | undefined;
93
+ type: 'update' | 'add';
94
+ rawVariables: ContextVariables[];
95
+ actionConfigItems: ActionConfigItemsMap;
96
+ }
97
+ export declare class EventControl extends React.Component<EventControlProps, EventControlState> {
98
+ target: HTMLElement | null;
99
+ eventPanelSortMap: {
100
+ [prop: string]: Sortable;
101
+ };
102
+ drag?: HTMLElement | null;
103
+ isUnmount: boolean;
104
+ constructor(props: EventControlProps);
105
+ componentDidMount(): void;
106
+ componentDidUpdate(prevProps: EventControlProps, prevState: EventControlState): void;
107
+ componentWillUnmount(): void;
108
+ /**
109
+ * 获取上下文变量
110
+ */
111
+ loadContextVariables(): Promise<void>;
112
+ generateEmptyDefault(events: RendererEvent[]): ActionEventConfig;
113
+ addEvent(event: RendererEvent): void;
114
+ delEvent(event: string): void;
115
+ addAction(event: string, config: any): void;
116
+ updateAction(event: string, index: number, config: any): void;
117
+ delAction(event: string, action: any, index: number): void;
118
+ toggleActivePanel(eventKey: string): void;
119
+ updateWeight(event: string, data: any): void;
120
+ /**
121
+ * 更新事件配置
122
+ *
123
+ * @param {string} event
124
+ * @param {number} actionIndex
125
+ * @param {*} config
126
+ * @memberof EventControl
127
+ */
128
+ updateValue(event: string, index: number, config: any): void;
129
+ submitConfig(type: string, config: any): void;
130
+ /**
131
+ * 根据动作类型获取过滤后的组件树
132
+ * @param components
133
+ * @param actionType
134
+ * @returns
135
+ */
136
+ getComponentTreeSource(actionType: string): ComponentInfo[];
137
+ renderConfig(type: string): {
138
+ type: string;
139
+ title: string;
140
+ mode: string;
141
+ wrapperComponent: string;
142
+ submitText: string;
143
+ autoFocus: boolean;
144
+ preventEnterSubmit: boolean;
145
+ onSubmit: any;
146
+ body: {
147
+ type: string;
148
+ className: string;
149
+ columns: ({
150
+ body: ({
151
+ type: string;
152
+ tpl: string;
153
+ className: string;
154
+ inline: boolean;
155
+ name?: undefined;
156
+ disabled?: undefined;
157
+ options?: undefined;
158
+ showIcon?: undefined;
159
+ mode?: undefined;
160
+ labelField?: undefined;
161
+ valueField?: undefined;
162
+ inputClassName?: undefined;
163
+ autoFill?: undefined;
164
+ onChange?: undefined;
165
+ } | {
166
+ type: string;
167
+ name: string;
168
+ disabled: boolean;
169
+ options: ActionTypeNode[];
170
+ showIcon: boolean;
171
+ className: string;
172
+ mode: string;
173
+ labelField: string;
174
+ valueField: string;
175
+ inputClassName: string;
176
+ autoFill: {
177
+ __actionDesc: string;
178
+ };
179
+ onChange: (value: string, oldVal: any, data: any, form: any) => void;
180
+ tpl?: undefined;
181
+ inline?: undefined;
182
+ })[];
183
+ md: number;
184
+ columnClassName: string;
185
+ } | {
186
+ body: ({
187
+ type: string;
188
+ tpl: string;
189
+ className: string;
190
+ visibleOn: string;
191
+ inline: boolean;
192
+ body?: undefined;
193
+ } | {
194
+ type: string;
195
+ className: string;
196
+ tpl: string;
197
+ visibleOn: string;
198
+ inline?: undefined;
199
+ body?: undefined;
200
+ } | {
201
+ type: string;
202
+ className: string;
203
+ body: ({
204
+ type: string;
205
+ name: string;
206
+ label: string;
207
+ showIcon: boolean;
208
+ searchable: boolean;
209
+ requiredOn: string;
210
+ selfDisabledAffectChildren: boolean;
211
+ size: string;
212
+ source: string;
213
+ mode: string;
214
+ autoFill: {
215
+ __rendererLabel: string;
216
+ __rendererName: string;
217
+ __nodeId: string;
218
+ __nodeSchema: string;
219
+ };
220
+ visibleOn: string;
221
+ onChange: (value: string, oldVal: any, data: any, form: any) => Promise<void>;
222
+ asFormItem?: undefined;
223
+ required?: undefined;
224
+ component?: undefined;
225
+ description?: undefined;
226
+ pluginActions?: undefined;
227
+ value?: undefined;
228
+ pipeIn?: undefined;
229
+ options?: undefined;
230
+ actionConfigItems?: undefined;
231
+ actions?: undefined;
232
+ tpl?: undefined;
233
+ inline?: undefined;
234
+ className?: undefined;
235
+ title?: undefined;
236
+ variableMode?: undefined;
237
+ inputMode?: undefined;
238
+ variables?: undefined;
239
+ placeholder?: undefined;
240
+ } | {
241
+ asFormItem: boolean;
242
+ label: string;
243
+ name: string;
244
+ mode: string;
245
+ required: boolean;
246
+ visibleOn: string;
247
+ component: typeof CmptActionSelect;
248
+ description: string;
249
+ pluginActions: PluginActions;
250
+ type?: undefined;
251
+ showIcon?: undefined;
252
+ searchable?: undefined;
253
+ requiredOn?: undefined;
254
+ selfDisabledAffectChildren?: undefined;
255
+ size?: undefined;
256
+ source?: undefined;
257
+ autoFill?: undefined;
258
+ onChange?: undefined;
259
+ value?: undefined;
260
+ pipeIn?: undefined;
261
+ options?: undefined;
262
+ actionConfigItems?: undefined;
263
+ actions?: undefined;
264
+ tpl?: undefined;
265
+ inline?: undefined;
266
+ className?: undefined;
267
+ title?: undefined;
268
+ variableMode?: undefined;
269
+ inputMode?: undefined;
270
+ variables?: undefined;
271
+ placeholder?: undefined;
272
+ } | {
273
+ type: string;
274
+ label: string;
275
+ name: string;
276
+ mode: string;
277
+ value: string;
278
+ required: boolean;
279
+ pipeIn: (value: any) => any;
280
+ options: {
281
+ label: string;
282
+ value: string;
283
+ }[];
284
+ visibleOn: string;
285
+ showIcon?: undefined;
286
+ searchable?: undefined;
287
+ requiredOn?: undefined;
288
+ selfDisabledAffectChildren?: undefined;
289
+ size?: undefined;
290
+ source?: undefined;
291
+ autoFill?: undefined;
292
+ onChange?: undefined;
293
+ asFormItem?: undefined;
294
+ component?: undefined;
295
+ description?: undefined;
296
+ pluginActions?: undefined;
297
+ actionConfigItems?: undefined;
298
+ actions?: undefined;
299
+ tpl?: undefined;
300
+ inline?: undefined;
301
+ className?: undefined;
302
+ title?: undefined;
303
+ variableMode?: undefined;
304
+ inputMode?: undefined;
305
+ variables?: undefined;
306
+ placeholder?: undefined;
307
+ } | {
308
+ asFormItem: boolean;
309
+ component: typeof ActionConfigPanel;
310
+ actionConfigItems: ActionConfigItemsMap;
311
+ actions: PluginActions;
312
+ type?: undefined;
313
+ name?: undefined;
314
+ label?: undefined;
315
+ showIcon?: undefined;
316
+ searchable?: undefined;
317
+ requiredOn?: undefined;
318
+ selfDisabledAffectChildren?: undefined;
319
+ size?: undefined;
320
+ source?: undefined;
321
+ mode?: undefined;
322
+ autoFill?: undefined;
323
+ visibleOn?: undefined;
324
+ onChange?: undefined;
325
+ required?: undefined;
326
+ description?: undefined;
327
+ pluginActions?: undefined;
328
+ value?: undefined;
329
+ pipeIn?: undefined;
330
+ options?: undefined;
331
+ tpl?: undefined;
332
+ inline?: undefined;
333
+ className?: undefined;
334
+ title?: undefined;
335
+ variableMode?: undefined;
336
+ inputMode?: undefined;
337
+ variables?: undefined;
338
+ placeholder?: undefined;
339
+ } | {
340
+ type: string;
341
+ tpl: string;
342
+ inline: boolean;
343
+ className: string;
344
+ visibleOn: string;
345
+ name?: undefined;
346
+ label?: undefined;
347
+ showIcon?: undefined;
348
+ searchable?: undefined;
349
+ requiredOn?: undefined;
350
+ selfDisabledAffectChildren?: undefined;
351
+ size?: undefined;
352
+ source?: undefined;
353
+ mode?: undefined;
354
+ autoFill?: undefined;
355
+ onChange?: undefined;
356
+ asFormItem?: undefined;
357
+ required?: undefined;
358
+ component?: undefined;
359
+ description?: undefined;
360
+ pluginActions?: undefined;
361
+ value?: undefined;
362
+ pipeIn?: undefined;
363
+ options?: undefined;
364
+ actionConfigItems?: undefined;
365
+ actions?: undefined;
366
+ title?: undefined;
367
+ variableMode?: undefined;
368
+ inputMode?: undefined;
369
+ variables?: undefined;
370
+ placeholder?: undefined;
371
+ } | {
372
+ name: string;
373
+ title: string;
374
+ type: string;
375
+ variableMode: string;
376
+ inputMode: string;
377
+ variables: string;
378
+ className: string;
379
+ label: string;
380
+ mode: string;
381
+ size: string;
382
+ placeholder: string;
383
+ visibleOn: string;
384
+ showIcon?: undefined;
385
+ searchable?: undefined;
386
+ requiredOn?: undefined;
387
+ selfDisabledAffectChildren?: undefined;
388
+ source?: undefined;
389
+ autoFill?: undefined;
390
+ onChange?: undefined;
391
+ asFormItem?: undefined;
392
+ required?: undefined;
393
+ component?: undefined;
394
+ description?: undefined;
395
+ pluginActions?: undefined;
396
+ value?: undefined;
397
+ pipeIn?: undefined;
398
+ options?: undefined;
399
+ actionConfigItems?: undefined;
400
+ actions?: undefined;
401
+ tpl?: undefined;
402
+ inline?: undefined;
403
+ })[];
404
+ tpl?: undefined;
405
+ visibleOn?: undefined;
406
+ inline?: undefined;
407
+ })[];
408
+ columnClassName: string;
409
+ md?: undefined;
410
+ })[];
411
+ }[];
412
+ style: {
413
+ borderStyle: string;
414
+ };
415
+ className: string;
416
+ }[];
417
+ dragRef(ref: any): void;
418
+ initDragging(): void;
419
+ genSortPanel(eventKey: string, ele: HTMLElement): Sortable;
420
+ destroyDragging(): void;
421
+ getActionType(action: ActionConfig): string;
422
+ /**
423
+ * 格式化初始化时的动作配置
424
+ * @param action
425
+ */
426
+ formatActionInitConfig(action: ActionConfig): {
427
+ actionType: string;
428
+ __componentTreeSource: ComponentInfo[];
429
+ __cmptActionType: string;
430
+ __showSelectCmpt: boolean | undefined;
431
+ description?: string | undefined;
432
+ componentId?: string | undefined;
433
+ args?: Record<string, any> | undefined;
434
+ outputVar?: string | undefined;
435
+ preventDefault?: boolean | undefined;
436
+ stopPropagation?: boolean | undefined;
437
+ expression?: string | undefined;
438
+ execOn?: string | undefined;
439
+ };
440
+ activeActionDialog(data: Pick<EventControlState, 'showAcionDialog' | 'type' | 'actionData'>): void;
441
+ getAcionConfig(action: ActionConfig): RendererAction;
442
+ renderActionDesc(action: ActionConfig): JSX.Element | null;
443
+ render(): JSX.Element;
444
+ }
445
+ export declare class EventControlRenderer extends EventControl {
446
+ }
447
+ export declare const getEventLabel: (events: RendererEvent[], name: string) => string | undefined;
448
+ export declare const getEventDesc: (events: RendererEvent[], name: string) => string | undefined;
449
+ export declare const getActionLabel: (events: RendererAction[], name: string) => string | undefined;
450
+ /**
451
+ * 根据不同的动作类型过滤组件树
452
+ * @param componentsTree 组件树
453
+ * @param actionType 动作类型
454
+ * @returns
455
+ */
456
+ export declare const getComponentTreeByType: (componentsTree: ComponentInfo[] | undefined, actionType: string | undefined, pluginActions: {
457
+ [key: string]: any;
458
+ } | undefined, actionConfigItems: ActionConfigItemsMap) => ComponentInfo[];
459
+ export {};
@@ -0,0 +1,32 @@
1
+ import { ActionConfigItemsMap } from './index';
2
+ import { BaseEventContext } from '../plugin';
3
+ import { EditorManager } from '../manager';
4
+ export declare const getComboWrapper: (items: any, multiple?: boolean) => {
5
+ type: string;
6
+ name: string;
7
+ multiple: boolean;
8
+ strictMode: boolean;
9
+ items: any[];
10
+ };
11
+ export declare const getOldActionSchema: (manager: EditorManager, context: BaseEventContext) => {
12
+ type: string;
13
+ label: string;
14
+ className: string;
15
+ tooltip: string;
16
+ tooltipPlacement: string;
17
+ actionType: string;
18
+ dialog: {
19
+ type: string;
20
+ title: string;
21
+ body: {
22
+ type: string;
23
+ body: any[];
24
+ };
25
+ onConfirm: (values: any[]) => void;
26
+ };
27
+ };
28
+ /**
29
+ * 获取动作配置项map
30
+ * @param manager
31
+ */
32
+ export declare function getActionConfigItemsMap(manager: any): ActionConfigItemsMap;