amis-core 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (211) hide show
  1. package/dist/Root.js +94 -0
  2. package/dist/RootRenderer.js +288 -0
  3. package/dist/SchemaRenderer.js +323 -0
  4. package/dist/Scoped.js +252 -0
  5. package/dist/WithRootStore.js +44 -0
  6. package/dist/WithStore.js +179 -0
  7. package/dist/__tests__/compat.test.d.ts +1 -0
  8. package/dist/__tests__/factory.test.d.ts +1 -0
  9. package/dist/__tests__/filter.test.d.ts +1 -0
  10. package/dist/__tests__/helper.d.ts +13 -0
  11. package/dist/__tests__/tokenize.test.d.ts +1 -0
  12. package/dist/actions/Action.js +119 -0
  13. package/dist/actions/AjaxAction.js +96 -0
  14. package/dist/actions/BreakAction.js +35 -0
  15. package/dist/actions/BroadcastAction.js +49 -0
  16. package/dist/actions/CmptAction.js +60 -0
  17. package/dist/actions/ContinueAction.js +35 -0
  18. package/dist/actions/CopyAction.js +43 -0
  19. package/dist/actions/CustomAction.js +49 -0
  20. package/dist/actions/DialogAction.js +104 -0
  21. package/dist/actions/DrawerAction.js +66 -0
  22. package/dist/actions/EmailAction.js +48 -0
  23. package/dist/actions/LinkAction.js +52 -0
  24. package/dist/actions/LoopAction.js +107 -0
  25. package/dist/actions/PageAction.js +80 -0
  26. package/dist/actions/ParallelAction.js +40 -0
  27. package/dist/actions/SwitchAction.js +52 -0
  28. package/dist/actions/ToastAction.js +35 -0
  29. package/dist/components/LazyComponent.js +99 -0
  30. package/dist/env.js +20 -0
  31. package/dist/envOverwrite.js +43 -0
  32. package/dist/factory.js +308 -0
  33. package/dist/index.js +218 -0
  34. package/dist/index2.js +255 -0
  35. package/dist/locale.js +114 -0
  36. package/dist/renderers/Form.js +1162 -0
  37. package/dist/renderers/Item.js +636 -0
  38. package/dist/renderers/Options.js +881 -0
  39. package/dist/renderers/Placeholder.js +31 -0
  40. package/dist/renderers/builtin.js +27 -0
  41. package/dist/renderers/wrapControl.js +507 -0
  42. package/dist/src/Root.d.ts +37 -0
  43. package/dist/src/RootRenderer.d.ts +27 -0
  44. package/dist/src/SchemaRenderer.d.ts +37 -0
  45. package/dist/src/Scoped.d.ts +38 -0
  46. package/dist/src/WithRootStore.d.ts +737 -0
  47. package/dist/src/WithStore.d.ts +5 -0
  48. package/dist/src/actions/Action.d.ts +38 -0
  49. package/dist/src/actions/AjaxAction.d.ts +25 -0
  50. package/dist/src/actions/BreakAction.d.ts +15 -0
  51. package/dist/src/actions/BroadcastAction.d.ts +16 -0
  52. package/dist/src/actions/CmptAction.d.ts +20 -0
  53. package/dist/src/actions/ContinueAction.d.ts +15 -0
  54. package/dist/src/actions/CopyAction.d.ts +20 -0
  55. package/dist/src/actions/CustomAction.d.ts +17 -0
  56. package/dist/src/actions/Decorators.d.ts +25 -0
  57. package/dist/src/actions/DialogAction.d.ts +57 -0
  58. package/dist/src/actions/DrawerAction.d.ts +30 -0
  59. package/dist/src/actions/EmailAction.d.ts +23 -0
  60. package/dist/src/actions/LinkAction.d.ts +24 -0
  61. package/dist/src/actions/LoopAction.d.ts +19 -0
  62. package/dist/src/actions/PageAction.d.ts +39 -0
  63. package/dist/src/actions/ParallelAction.d.ts +8 -0
  64. package/dist/src/actions/SwitchAction.d.ts +11 -0
  65. package/dist/src/actions/ToastAction.d.ts +19 -0
  66. package/dist/src/actions/index.d.ts +21 -0
  67. package/dist/src/components/LazyComponent.d.ts +32 -0
  68. package/dist/src/env.d.ts +172 -0
  69. package/dist/src/envOverwrite.d.ts +4 -0
  70. package/dist/src/factory.d.ts +78 -0
  71. package/dist/src/index.d.ts +25 -0
  72. package/dist/src/locale.d.ts +82 -0
  73. package/dist/src/renderers/Form.d.ts +352 -0
  74. package/dist/src/renderers/Item.d.ts +795 -0
  75. package/dist/src/renderers/Options.d.ts +150 -0
  76. package/dist/src/renderers/Placeholder.d.ts +6 -0
  77. package/dist/src/renderers/builtin.d.ts +1 -0
  78. package/dist/src/renderers/wrapControl.d.ts +446 -0
  79. package/dist/src/schema.d.ts +369 -0
  80. package/dist/src/store/app.d.ts +89 -0
  81. package/dist/src/store/combo.d.ts +8504 -0
  82. package/dist/src/store/crud.d.ts +124 -0
  83. package/dist/src/store/form.d.ts +3394 -0
  84. package/dist/src/store/formItem.d.ts +130 -0
  85. package/dist/src/store/iRenderer.d.ts +46 -0
  86. package/dist/src/store/index.d.ts +105 -0
  87. package/dist/src/store/list.d.ts +270 -0
  88. package/dist/src/store/manager.d.ts +115 -0
  89. package/dist/src/store/modal.d.ts +84 -0
  90. package/dist/src/store/node.d.ts +22 -0
  91. package/dist/src/store/pagination.d.ts +58 -0
  92. package/dist/src/store/root.d.ts +79 -0
  93. package/dist/src/store/service.d.ts +71 -0
  94. package/dist/src/store/table-v2.d.ts +309 -0
  95. package/dist/src/store/table.d.ts +8334 -0
  96. package/dist/src/theme.d.ts +83 -0
  97. package/dist/src/types.d.ts +217 -0
  98. package/dist/src/utils/Animation.d.ts +22 -0
  99. package/dist/src/utils/ColorScale.d.ts +19 -0
  100. package/dist/src/utils/DataSchema.d.ts +25 -0
  101. package/dist/src/utils/DataScope.d.ts +23 -0
  102. package/dist/src/utils/RootClose.d.ts +4 -0
  103. package/dist/src/utils/SimpleMap.d.ts +8 -0
  104. package/dist/src/utils/api.d.ts +27 -0
  105. package/dist/src/utils/attachmentAdpator.d.ts +7 -0
  106. package/dist/src/utils/autobind.d.ts +7 -0
  107. package/dist/src/utils/columnsSplit.d.ts +1 -0
  108. package/dist/src/utils/dataMapping.d.ts +3 -0
  109. package/dist/src/utils/date.d.ts +4 -0
  110. package/dist/src/utils/debug.d.ts +26 -0
  111. package/dist/src/utils/dom.d.ts +13 -0
  112. package/dist/src/utils/errors.d.ts +6 -0
  113. package/dist/src/utils/escapeHtml.d.ts +1 -0
  114. package/dist/src/utils/filter-schema.d.ts +12 -0
  115. package/dist/src/utils/filter.d.ts +1 -0
  116. package/dist/src/utils/formatDuration.d.ts +1 -0
  117. package/dist/src/utils/formula.d.ts +16 -0
  118. package/dist/src/utils/getVariable.d.ts +3 -0
  119. package/dist/src/utils/grammar.d.ts +4 -0
  120. package/dist/src/utils/handleAction.d.ts +6 -0
  121. package/dist/src/utils/helper.d.ts +286 -0
  122. package/dist/src/utils/icon.d.ts +12 -0
  123. package/dist/src/utils/image.d.ts +17 -0
  124. package/dist/src/utils/index.d.ts +12 -0
  125. package/dist/src/utils/isPureVariable.d.ts +1 -0
  126. package/dist/src/utils/json-schema-2-amis-schema.d.ts +6 -0
  127. package/dist/src/utils/keyToPath.d.ts +6 -0
  128. package/dist/src/utils/makeSorter.d.ts +1 -0
  129. package/dist/src/utils/markdown.d.ts +5 -0
  130. package/dist/src/utils/normalizeLink.d.ts +1 -0
  131. package/dist/src/utils/normalizeOptions.d.ts +7 -0
  132. package/dist/src/utils/object.d.ts +15 -0
  133. package/dist/src/utils/offset.d.ts +14 -0
  134. package/dist/src/utils/offsetParent.d.ts +4 -0
  135. package/dist/src/utils/optionValueCompare.d.ts +3 -0
  136. package/dist/src/utils/position.d.ts +15 -0
  137. package/dist/src/utils/prettyBytes.d.ts +1 -0
  138. package/dist/src/utils/renderer-event.d.ts +44 -0
  139. package/dist/src/utils/replaceText.d.ts +6 -0
  140. package/dist/src/utils/resize-sensor.d.ts +6 -0
  141. package/dist/src/utils/resolveVariable.d.ts +1 -0
  142. package/dist/src/utils/resolveVariableAndFilter.d.ts +1 -0
  143. package/dist/src/utils/scrollPosition.d.ts +6 -0
  144. package/dist/src/utils/string2regExp.d.ts +1 -0
  145. package/dist/src/utils/stripNumber.d.ts +1 -0
  146. package/dist/src/utils/style.d.ts +10 -0
  147. package/dist/src/utils/tokenize.d.ts +1 -0
  148. package/dist/src/utils/tpl-builtin.d.ts +18 -0
  149. package/dist/src/utils/tpl-lodash.d.ts +4 -0
  150. package/dist/src/utils/tpl.d.ts +11 -0
  151. package/dist/src/utils/validations.d.ts +39 -0
  152. package/dist/store/app.js +190 -0
  153. package/dist/store/combo.js +154 -0
  154. package/dist/store/crud.js +413 -0
  155. package/dist/store/form.js +579 -0
  156. package/dist/store/formItem.js +846 -0
  157. package/dist/store/iRenderer.js +189 -0
  158. package/dist/store/index.js +103 -0
  159. package/dist/store/list.js +248 -0
  160. package/dist/store/manager.js +56 -0
  161. package/dist/store/modal.js +54 -0
  162. package/dist/store/node.js +93 -0
  163. package/dist/store/pagination.js +60 -0
  164. package/dist/store/root.js +45 -0
  165. package/dist/store/service.js +415 -0
  166. package/dist/store/table-v2.js +471 -0
  167. package/dist/store/table.js +1105 -0
  168. package/dist/theme.js +93 -0
  169. package/dist/tsconfig.tsbuildinfo +1 -0
  170. package/dist/utils/Animation.js +290 -0
  171. package/dist/utils/DataSchema.js +120 -0
  172. package/dist/utils/DataScope.js +151 -0
  173. package/dist/utils/SimpleMap.js +46 -0
  174. package/dist/utils/api.js +555 -0
  175. package/dist/utils/autobind.js +94 -0
  176. package/dist/utils/dataMapping.js +136 -0
  177. package/dist/utils/date.js +90 -0
  178. package/dist/utils/debug.js +343 -0
  179. package/dist/utils/errors.js +23 -0
  180. package/dist/utils/escapeHtml.js +24 -0
  181. package/dist/utils/filter-schema.js +75 -0
  182. package/dist/utils/filter.js +481 -0
  183. package/dist/utils/formatDuration.js +27 -0
  184. package/dist/utils/formula.js +165 -0
  185. package/dist/utils/getVariable.js +29 -0
  186. package/dist/utils/grammar.js +54 -0
  187. package/dist/utils/helper.js +1283 -0
  188. package/dist/utils/isPureVariable.js +16 -0
  189. package/dist/utils/keyToPath.js +34 -0
  190. package/dist/utils/makeSorter.js +30 -0
  191. package/dist/utils/normalizeLink.js +47 -0
  192. package/dist/utils/normalizeOptions.js +92 -0
  193. package/dist/utils/object.js +156 -0
  194. package/dist/utils/offset.js +36 -0
  195. package/dist/utils/offsetParent.js +27 -0
  196. package/dist/utils/optionValueCompare.js +25 -0
  197. package/dist/utils/position.js +50 -0
  198. package/dist/utils/prettyBytes.js +28 -0
  199. package/dist/utils/renderer-event.js +131 -0
  200. package/dist/utils/replaceText.js +35 -0
  201. package/dist/utils/resize-sensor.js +177 -0
  202. package/dist/utils/resolveVariable.js +39 -0
  203. package/dist/utils/resolveVariableAndFilter.js +37 -0
  204. package/dist/utils/string2regExp.js +18 -0
  205. package/dist/utils/stripNumber.js +20 -0
  206. package/dist/utils/tokenize.js +33 -0
  207. package/dist/utils/tpl-builtin.js +71 -0
  208. package/dist/utils/tpl-lodash.js +71 -0
  209. package/dist/utils/tpl.js +140 -0
  210. package/dist/utils/validations.js +377 -0
  211. package/package.json +121 -0
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import hoistNonReactStatic from 'hoist-non-react-statics';
3
+ export declare type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean;
4
+ interface ClassDictionary {
5
+ [id: string]: any;
6
+ }
7
+ interface ClassArray extends Array<ClassValue> {
8
+ }
9
+ export declare type ClassNamesFn = (...classes: ClassValue[]) => string;
10
+ interface ThemeConfig {
11
+ classPrefix?: string;
12
+ renderers?: {
13
+ [propName: string]: any;
14
+ };
15
+ components?: {
16
+ [propName: string]: any;
17
+ };
18
+ [propsName: string]: any;
19
+ }
20
+ export declare function theme(name: string, config: Partial<ThemeConfig>): void;
21
+ export declare function makeClassnames(ns?: string): (...classes: ClassValue[]) => string;
22
+ export declare type ThemeInstance = ThemeConfig & {
23
+ getRendererConfig: (name?: string) => any;
24
+ getComponentConfig: (name?: string) => any;
25
+ classnames: ClassNamesFn;
26
+ };
27
+ export declare function hasTheme(theme: string): boolean;
28
+ export declare function setDefaultTheme(theme: string): void;
29
+ export declare function classnames(...classes: ClassValue[]): any;
30
+ export declare function getClassPrefix(): string | undefined;
31
+ export declare function getTheme(theme: string): ThemeInstance;
32
+ export interface ThemeProps {
33
+ className?: string;
34
+ classPrefix: string;
35
+ classnames: ClassNamesFn;
36
+ theme?: string;
37
+ }
38
+ export interface ThemeOutterProps {
39
+ theme?: string;
40
+ className?: string;
41
+ classPrefix?: string;
42
+ classnames?: ClassNamesFn;
43
+ }
44
+ export declare let defaultTheme: string;
45
+ export declare const ThemeContext: React.Context<string>;
46
+ export declare function themeable<T extends React.ComponentType<React.ComponentProps<T> & ThemeProps> & {
47
+ themeKey?: string;
48
+ }>(ComposedComponent: T): {
49
+ new (props: JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps): {
50
+ ref: any;
51
+ childRef(ref: any): void;
52
+ getWrappedInstance(): any;
53
+ render(): JSX.Element;
54
+ context: any;
55
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
56
+ forceUpdate(callback?: (() => void) | undefined): void;
57
+ readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps> & Readonly<{
58
+ children?: React.ReactNode;
59
+ }>;
60
+ state: Readonly<{}>;
61
+ refs: {
62
+ [key: string]: React.ReactInstance;
63
+ };
64
+ componentDidMount?(): void;
65
+ shouldComponentUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
66
+ componentWillUnmount?(): void;
67
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
68
+ getSnapshotBeforeUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, prevState: Readonly<{}>): any;
69
+ componentDidUpdate?(prevProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
70
+ componentWillMount?(): void;
71
+ UNSAFE_componentWillMount?(): void;
72
+ componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextContext: any): void;
73
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextContext: any): void;
74
+ componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
75
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
76
+ };
77
+ displayName: string;
78
+ contextType: React.Context<string>;
79
+ ComposedComponent: React.ComponentType<T>;
80
+ } & hoistNonReactStatic.NonReactStatics<T, {}> & {
81
+ ComposedComponent: T;
82
+ };
83
+ export {};
@@ -0,0 +1,217 @@
1
+ /// <reference types="react" />
2
+ import { Option, Options, SchemaApiObject } from './schema';
3
+ export interface ApiObject extends SchemaApiObject {
4
+ config?: {
5
+ withCredentials?: boolean;
6
+ cancelExecutor?: (cancel: Function) => void;
7
+ };
8
+ graphql?: string;
9
+ operationName?: string;
10
+ body?: PlainObject;
11
+ query?: PlainObject;
12
+ adaptor?: (payload: object, response: fetcherResult, api: ApiObject) => any;
13
+ requestAdaptor?: (api: ApiObject) => ApiObject;
14
+ }
15
+ export declare type ApiString = string;
16
+ export declare type Api = ApiString | ApiObject;
17
+ export interface fetcherResult {
18
+ data?: {
19
+ data: object;
20
+ status: number;
21
+ msg: string;
22
+ msgTimeout?: number;
23
+ errors?: {
24
+ [propName: string]: string;
25
+ };
26
+ type?: string;
27
+ [propName: string]: any;
28
+ };
29
+ status: number;
30
+ headers: object;
31
+ }
32
+ export interface fetchOptions {
33
+ method?: 'get' | 'post' | 'put' | 'patch' | 'delete' | 'jsonp';
34
+ successMessage?: string;
35
+ errorMessage?: string;
36
+ autoAppend?: boolean;
37
+ beforeSend?: (data: any) => any;
38
+ onSuccess?: (json: Payload) => any;
39
+ onFailed?: (json: Payload) => any;
40
+ silent?: boolean;
41
+ [propName: string]: any;
42
+ }
43
+ export interface Payload {
44
+ ok: boolean;
45
+ msg: string;
46
+ msgTimeout?: number;
47
+ data: any;
48
+ status: number;
49
+ errors?: {
50
+ [propName: string]: string;
51
+ };
52
+ }
53
+ export interface Schema {
54
+ type: string;
55
+ detectField?: string;
56
+ visibleOn?: string;
57
+ hiddenOn?: string;
58
+ children?: JSX.Element | ((props: any, schema?: any) => JSX.Element) | null;
59
+ definitions?: Definitions;
60
+ [propName: string]: any;
61
+ }
62
+ export interface Button {
63
+ type: 'submit' | 'button' | 'reset';
64
+ label?: string;
65
+ icon?: string;
66
+ size?: string;
67
+ disabled?: boolean;
68
+ className?: string;
69
+ }
70
+ export declare type SchemaNode = Schema | string | Array<Schema | string>;
71
+ export interface SchemaArray extends Array<SchemaNode> {
72
+ }
73
+ export interface Definitions {
74
+ [propName: string]: SchemaNode;
75
+ }
76
+ export interface Action extends Button {
77
+ actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'selectAll' | 'changeTabKey';
78
+ api?: Api;
79
+ asyncApi?: Api;
80
+ payload?: any;
81
+ dialog?: SchemaNode;
82
+ to?: string;
83
+ target?: string;
84
+ link?: string;
85
+ url?: string;
86
+ cc?: string;
87
+ bcc?: string;
88
+ subject?: string;
89
+ body?: string;
90
+ mergeData?: boolean;
91
+ reload?: string;
92
+ messages?: {
93
+ success?: string;
94
+ failed?: string;
95
+ };
96
+ feedback?: any;
97
+ required?: Array<string>;
98
+ [propName: string]: any;
99
+ }
100
+ export interface Location {
101
+ pathname: string;
102
+ search: string;
103
+ state: any;
104
+ hash: string;
105
+ key?: string;
106
+ query?: any;
107
+ }
108
+ export interface PlainObject {
109
+ [propsName: string]: any;
110
+ }
111
+ export interface RendererData {
112
+ [propsName: string]: any;
113
+ __prev?: RendererDataAlias;
114
+ __super?: RendererData;
115
+ }
116
+ declare type RendererDataAlias = RendererData;
117
+ export declare type FunctionPropertyNames<T> = {
118
+ [K in keyof T]: T[K] extends Function ? K : never;
119
+ }[keyof T];
120
+ export interface JSONSchema {
121
+ [propsName: string]: any;
122
+ }
123
+ /**
124
+ * 事件跟踪的定义
125
+ */
126
+ export interface EventTrack {
127
+ /**
128
+ * 事件类型,目前有以下几种
129
+ *
130
+ * api: 所有 fetcher 前调用
131
+ * url: 打开外部链接,组件有可能是 action 也有可能是 link
132
+ * link: 打开内部链接
133
+ * dialog: action 的弹框
134
+ * drawer: action 的抽出式弹框
135
+ * copy: action 里的复制
136
+ * reload: action 里的 reload
137
+ * email: action 里的 email
138
+ * prev: action 里的 prev
139
+ * next: action 里的 next
140
+ * cancel: action 里的 cancel
141
+ * close: action 里的 close
142
+ * submit: 有可能是 action 里的 submit,也有可能是表单提交
143
+ * confirm: action 里的 confirm
144
+ * add: action 里的 add
145
+ * reset: action 里的 reset
146
+ * reset-and-submit: action 里的 reset-and-submit
147
+ * formItemChange: 表单项内容变化
148
+ * formError: 表单验证失败
149
+ * formSubmit: 表单成功提交,在表单验证成功之后才会触发,这个可能会和 api 重合
150
+ * tabChange: tab 切换
151
+ * netError: api 报错
152
+ */
153
+ eventType: 'api' | 'url' | 'link' | 'dialog' | 'drawer' | 'copy' | 'reload' | 'email' | 'prev' | 'next' | 'cancel' | 'close' | 'submit' | 'confirm' | 'reset' | 'reset-and-submit' | 'formItemChange' | 'tabChange' | 'pageHidden' | 'pageVisible';
154
+ /**
155
+ * 事件数据
156
+ */
157
+ eventData?: PlainObject | Api;
158
+ }
159
+ export declare type ToastLevel = 'info' | 'success' | 'error' | 'warning';
160
+ export declare type ToastConf = {
161
+ position: 'top-right' | 'top-center' | 'top-left' | 'bottom-center' | 'bottom-left' | 'bottom-right' | 'center';
162
+ closeButton: boolean;
163
+ showIcon?: boolean;
164
+ timeout: number;
165
+ errorTimeout: number;
166
+ className?: string;
167
+ items?: Array<any>;
168
+ useMobileUI?: boolean;
169
+ };
170
+ export interface OptionProps {
171
+ className?: string;
172
+ multi?: boolean;
173
+ multiple?: boolean;
174
+ valueField?: string;
175
+ labelField?: string;
176
+ simpleValue?: boolean;
177
+ options: Options;
178
+ loading?: boolean;
179
+ joinValues?: boolean;
180
+ extractValue?: boolean;
181
+ delimiter?: string;
182
+ clearable?: boolean;
183
+ resetValue: any;
184
+ placeholder?: string;
185
+ disabled?: boolean;
186
+ creatable?: boolean;
187
+ pathSeparator?: string;
188
+ hasError?: boolean;
189
+ block?: boolean;
190
+ onAdd?: (idx?: number | Array<number>, value?: any, skipForm?: boolean) => void;
191
+ editable?: boolean;
192
+ onEdit?: (value: Option, origin?: Option, skipForm?: boolean) => void;
193
+ removable?: boolean;
194
+ onDelete?: (value: Option) => void;
195
+ }
196
+ export declare type LinkItem = LinkItemProps;
197
+ interface LinkItemProps {
198
+ id?: number;
199
+ label: string;
200
+ hidden?: boolean;
201
+ open?: boolean;
202
+ active?: boolean;
203
+ className?: string;
204
+ children?: Array<LinkItem>;
205
+ path?: string;
206
+ icon?: string;
207
+ component?: React.ReactType;
208
+ }
209
+ export interface Navigation {
210
+ label: string;
211
+ children?: Array<LinkItem>;
212
+ prefix?: JSX.Element;
213
+ affix?: JSX.Element;
214
+ className?: string;
215
+ [propName: string]: any;
216
+ }
217
+ export {};
@@ -0,0 +1,22 @@
1
+ interface Rect {
2
+ top: number;
3
+ left: number;
4
+ bottom: number;
5
+ right: number;
6
+ width: number;
7
+ height: number;
8
+ }
9
+ interface AnimationState {
10
+ rect: Rect;
11
+ target: HTMLElement;
12
+ }
13
+ export declare class AnimationManager {
14
+ animating: boolean;
15
+ animationCallbackId: any;
16
+ states: Array<AnimationState>;
17
+ capture(el: HTMLElement): void;
18
+ animateAll(callback?: () => void): void;
19
+ animate(target: HTMLElement, currentRect: Rect, toRect: Rect, duration: number): void;
20
+ }
21
+ declare const _default: AnimationManager;
22
+ export default _default;
@@ -0,0 +1,19 @@
1
+ declare class Color {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ a: number;
6
+ constructor(r: number, g: number, b: number, a?: number);
7
+ toRGBString(): string;
8
+ toRGBAString(): string;
9
+ toHexString(): string;
10
+ }
11
+ export default class ColorScale {
12
+ private min;
13
+ private max;
14
+ private alpha;
15
+ private colorStops;
16
+ constructor(min: number, max: number, colorStops: string[], alpha?: number);
17
+ getColor(value: number): Color;
18
+ }
19
+ export {};
@@ -0,0 +1,25 @@
1
+ import { DataScope } from './DataScope';
2
+ import type { JSONSchema } from './DataScope';
3
+ /**
4
+ * 用来定义数据本身的数据结构,比如有类型是什么,有哪些属性。
5
+ */
6
+ export declare class DataSchema {
7
+ readonly root: DataScope;
8
+ readonly idMap: {
9
+ [propName: string]: DataScope;
10
+ };
11
+ current: DataScope;
12
+ constructor(schema: JSONSchema | Array<JSONSchema>);
13
+ setSchema(schemas: Array<JSONSchema>): this;
14
+ addSchema(schema: JSONSchema): this;
15
+ removeSchema(id: string): this;
16
+ getSchemas(): import("json-schema").JSONSchema7[];
17
+ addScope(schema?: JSONSchema | Array<JSONSchema>, id?: string): this;
18
+ removeScope(idOrScope: string | DataScope): this;
19
+ hasScope(idOrScope: string | DataScope): idOrScope is string | DataScope;
20
+ getScope(idOrScope: string | DataScope): DataScope;
21
+ switchToRoot(): this;
22
+ switchTo(idOrScope: string | DataScope): this;
23
+ getDataPropsAsOptions(): any[];
24
+ getSchemaByPath(path: string): import("json-schema").JSONSchema7 | null;
25
+ }
@@ -0,0 +1,23 @@
1
+ import type { JSONSchema7 } from 'json-schema';
2
+ export declare type JSONSchema = JSONSchema7;
3
+ export declare class DataScope {
4
+ parent?: DataScope;
5
+ readonly children: Array<DataScope>;
6
+ readonly id: string;
7
+ ref?: string;
8
+ name?: string;
9
+ tag?: string;
10
+ description?: string;
11
+ readonly schemas: Array<JSONSchema>;
12
+ constructor(schemas: JSONSchema | Array<JSONSchema>, id: string);
13
+ addChild(id: string, schema?: JSONSchema | Array<JSONSchema>): DataScope;
14
+ removeChild(idOrScope: string | DataScope): void;
15
+ setSchemas(schemas: Array<JSONSchema>): this;
16
+ addSchema(schema: JSONSchema): this;
17
+ removeSchema(id: string): this;
18
+ contains(scope: DataScope): boolean;
19
+ getMergedSchema(): any;
20
+ protected buildOptions(options: Array<any>, schema: JSONSchema, path?: string, key?: string): void;
21
+ getDataPropsAsOptions(): any;
22
+ getSchemaByPath(path: string): JSONSchema7 | null;
23
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 兼容之前的 RootCloseWrapper 写法
3
+ */
4
+ export declare const RootClose: ({ children, onRootClose, ...props }: any) => any;
@@ -0,0 +1,8 @@
1
+ export declare class SimpleMap<V = any, K = any> {
2
+ private readonly list;
3
+ has(key: K): boolean;
4
+ set(key: K, value: V): void;
5
+ get(key: K): V | null;
6
+ delete(key: K): void;
7
+ dispose(): void;
8
+ }
@@ -0,0 +1,27 @@
1
+ import { Api, ApiObject, EventTrack, fetcherResult, Payload } from '../types';
2
+ import { fetcherConfig } from '../factory';
3
+ interface ApiCacheConfig extends ApiObject {
4
+ cachedPromise: Promise<any>;
5
+ requestTime: number;
6
+ }
7
+ export declare function normalizeApi(api: Api, defaultMethod?: string): ApiObject;
8
+ export declare function buildApi(api: Api, data?: object, options?: {
9
+ autoAppend?: boolean;
10
+ ignoreData?: boolean;
11
+ [propName: string]: any;
12
+ }): ApiObject;
13
+ export declare function str2function(contents: string, ...args: Array<string>): Function | null;
14
+ export declare function str2AsyncFunction(contents: string, ...args: Array<string>): Function | null;
15
+ export declare function responseAdaptor(ret: fetcherResult, api: ApiObject): Payload;
16
+ export declare function wrapFetcher(fn: (config: fetcherConfig) => Promise<fetcherResult>, tracker?: (eventTrack: EventTrack, data: any) => void): (api: Api, data: object, options?: object) => Promise<Payload | void>;
17
+ export declare function wrapAdaptor(promise: Promise<fetcherResult>, api: ApiObject): Promise<Payload>;
18
+ export declare function jsonpFetcher(api: ApiObject): Promise<fetcherResult>;
19
+ export declare function isApiOutdated(prevApi: Api | undefined, nextApi: Api | undefined, prevData: any, nextData: any): nextApi is Api;
20
+ export declare function isValidApi(api: string): boolean | "";
21
+ export declare function isEffectiveApi(api?: Api, data?: any, initFetch?: boolean, initFetchOn?: string): api is Api;
22
+ export declare function isSameApi(apiA: ApiObject | ApiCacheConfig, apiB: ApiObject | ApiCacheConfig): boolean;
23
+ export declare function getApiCache(api: ApiObject): ApiCacheConfig | undefined;
24
+ export declare function setApiCache(api: ApiObject, promise: Promise<any>): Promise<any>;
25
+ export declare function clearApiCache(): void;
26
+ export declare function normalizeApiResponseData(data: any): any;
27
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 处理接口返回附件的情况,好几个地方用
3
+ * @param response
4
+ * @param __
5
+ * @returns
6
+ */
7
+ export default function attachmentAdpator(response: any, __: Function): any;
@@ -0,0 +1,7 @@
1
+ export declare function bind(fn: Function, context: any): any;
2
+ export declare function autobindMethod(target: Object, key: string, { value: fn, configurable, enumerable }: TypedPropertyDescriptor<Function>): {
3
+ configurable: boolean | undefined;
4
+ enumerable: boolean | undefined;
5
+ get(): any;
6
+ set: (this: any, newValue: any) => any;
7
+ };
@@ -0,0 +1 @@
1
+ export declare function columnsSplit(body: any[], cx: any, columnsCount?: number | number[]): any[];
@@ -0,0 +1,3 @@
1
+ import { PlainObject } from '../types';
2
+ export declare function resolveMapping(value: any, data: PlainObject, defaultFilter?: string): any;
3
+ export declare function dataMapping(to: any, from?: PlainObject, ignoreFunction?: boolean | ((key: string, value: any) => boolean), convertKeyToPath?: boolean): any;
@@ -0,0 +1,4 @@
1
+ import moment from 'moment';
2
+ export declare const relativeValueRe: RegExp;
3
+ export declare const filterDate: (value: string, data?: object, format?: string, utc?: boolean) => moment.Moment;
4
+ export declare function parseDuration(str: string): moment.Duration | undefined;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * amis 运行时调试功能,为了避免循环引用,这个组件不要依赖 amis 里的组件
3
+ */
4
+ import React, { Component } from 'react';
5
+ export declare function enableDebug(): void;
6
+ interface DebugWrapperProps {
7
+ renderer: any;
8
+ }
9
+ export declare class DebugWrapper extends Component<DebugWrapperProps> {
10
+ componentDidMount(): void;
11
+ render(): React.ReactNode;
12
+ }
13
+ declare type Category = 'api' | 'event';
14
+ /**
15
+ * 一般调试日志
16
+ * @param msg 简单消息
17
+ * @param ext 扩展信息
18
+ */
19
+ export declare function debug(cat: Category, msg: string, ext?: object): void;
20
+ /**
21
+ * 警告日志
22
+ * @param msg 简单消息
23
+ * @param ext 扩展信息
24
+ */
25
+ export declare function warning(cat: Category, msg: string, ext?: object): void;
26
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare function getContainer(container: any, defaultContainer: any): any;
2
+ export declare function ownerDocument(componentOrElement: any): Document;
3
+ export declare function calculatePosition(placement: any, overlayNode: any, target: HTMLElement, container: any, padding?: any, customOffset?: [number, number]): {
4
+ positionLeft: number;
5
+ positionTop: number;
6
+ arrowOffsetLeft: number;
7
+ arrowOffsetTop: number;
8
+ activePlacement: string;
9
+ };
10
+ /**
11
+ * 专门用来获取样式的像素值,默认返回 0
12
+ */
13
+ export declare function getStyleNumber(element: HTMLElement, styleName: string): number;
@@ -0,0 +1,6 @@
1
+ import { Payload } from '../types';
2
+ export declare class ServerError extends Error {
3
+ type: string;
4
+ response: Payload;
5
+ constructor(msg: string, response: Payload);
6
+ }
@@ -0,0 +1 @@
1
+ export declare const escapeHtml: (str: string) => string;
@@ -0,0 +1,12 @@
1
+ import { PlainObject } from '../types';
2
+ /**
3
+ * 处理 Props 数据,所有带 On 结束的做一次
4
+ *
5
+ * xxxOn
6
+ * xxxExpr
7
+ *
8
+ *
9
+ * @param schema
10
+ * @param data
11
+ */
12
+ export default function getExprProperties(schema: PlainObject, data?: object, blackList?: Array<string>, props?: any): PlainObject;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function formatDuration(value: number): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 用于存储当前可用运算器,默认支持 tpl、formula、js、var 四种类型运算器
3
+ * 备注:在这里统一参数。
4
+ */
5
+ export declare const FormulaExec: {
6
+ [key: string]: Function;
7
+ };
8
+ export declare function formulaExec(value: any, data: any, execMode?: string | boolean): any;
9
+ export declare function registerFormulaExec(execMode: string, formulaExec: Function): void;
10
+ export declare function isExpression(expression: any): boolean;
11
+ export declare function isNeedFormula(expression: any, prevData: {
12
+ [propName: string]: any;
13
+ }, curData: {
14
+ [propName: string]: any;
15
+ }): boolean;
16
+ export declare function replaceExpression(expression: any): any;
@@ -0,0 +1,3 @@
1
+ export declare function getVariable(data: {
2
+ [propName: string]: any;
3
+ }, key: string | undefined, canAccessSuper?: boolean): any;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @file 公式语法解析
3
+ */
4
+ export declare function collectVariables(strOrAst: string | Object, execMode?: boolean): Array<string>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 后续好多地方可能都要支持 action,所以提取公共功能
3
+ */
4
+ /// <reference types="react" />
5
+ import { RendererProps } from '../factory';
6
+ export default function handleAction(e: React.MouseEvent<any>, action: any, props: RendererProps, data?: any): void;