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,286 @@
1
+ /// <reference types="react" />
2
+ import { Schema, PlainObject, FunctionPropertyNames } from '../types';
3
+ import qs from 'qs';
4
+ import { IIRendererStore } from '../store';
5
+ import { autobindMethod } from './autobind';
6
+ import { cloneObject, createObject, deleteVariable, extendObject, isObject, setVariable } from './object';
7
+ import { string2regExp } from './string2regExp';
8
+ import { getVariable } from './getVariable';
9
+ import { keyToPath } from './keyToPath';
10
+ export { createObject, cloneObject, isObject, string2regExp, getVariable, setVariable, deleteVariable, keyToPath, extendObject };
11
+ export declare function preventDefault(event: TouchEvent | Event): void;
12
+ export declare function isMobile(): any;
13
+ export declare function range(num: number, min: number, max: number): number;
14
+ /**
15
+ * 给目标对象添加其他属性,可读取但是不会被遍历。
16
+ * @param target
17
+ * @param props
18
+ */
19
+ export declare function injectPropsToObject(target: any, props: any): any;
20
+ export declare function isSuperDataModified(data: any, prevData: any, store: IIRendererStore): boolean;
21
+ export declare function syncDataFromSuper(data: any, superObject: any, prevSuperObject: any, store: IIRendererStore, force: boolean): any;
22
+ /**
23
+ * 生成 8 位随机数字。
24
+ *
25
+ * @return {string} 8位随机数字
26
+ */
27
+ export declare function guid(): string;
28
+ export declare function findIndex(arr: Array<any>, detect: (item?: any, index?: number) => boolean): number;
29
+ export declare function hasOwnProperty(data: {
30
+ [propName: string]: any;
31
+ }, key: string): boolean;
32
+ export declare function noop(): void;
33
+ export declare function anyChanged(attrs: string | Array<string>, from: {
34
+ [propName: string]: any;
35
+ }, to: {
36
+ [propName: string]: any;
37
+ }, strictMode?: boolean): boolean;
38
+ export declare function rmUndefined(obj: PlainObject): PlainObject;
39
+ export declare function isObjectShallowModified(prev: any, next: any, strictMode?: boolean, ignoreUndefined?: boolean, statck?: Array<any>): boolean;
40
+ export declare function isArrayChildrenModified(prev: Array<any>, next: Array<any>, strictMode?: boolean): boolean;
41
+ export declare function immutableExtends(to: any, from: any, deep?: boolean): any;
42
+ export declare function makeColumnClassBuild(steps: number, classNameTpl?: string): (schema: Schema) => any;
43
+ export declare function hasVisibleExpression(schema: {
44
+ visibleOn?: string;
45
+ hiddenOn?: string;
46
+ visible?: boolean;
47
+ hidden?: boolean;
48
+ }): string | undefined;
49
+ export declare function isVisible(schema: {
50
+ visibleOn?: string;
51
+ hiddenOn?: string;
52
+ visible?: boolean;
53
+ hidden?: boolean;
54
+ }, data?: object): boolean;
55
+ export declare function isUnfolded(node: any, config: {
56
+ foldedField?: string;
57
+ unfoldedField?: string;
58
+ }): boolean;
59
+ /**
60
+ * 过滤掉被隐藏的数组元素
61
+ */
62
+ export declare function visibilityFilter(items: any, data?: object): any;
63
+ export declare function isDisabled(schema: {
64
+ disabledOn?: string;
65
+ disabled?: boolean;
66
+ }, data?: object): boolean | "" | undefined;
67
+ export declare function hasAbility(schema: any, ability: string, data?: object, defaultValue?: boolean): boolean;
68
+ export declare function makeHorizontalDeeper(horizontal: {
69
+ left: string;
70
+ right: string;
71
+ offset: string;
72
+ leftFixed?: any;
73
+ }, count: number): {
74
+ left: string | number;
75
+ right: string | number;
76
+ offset: string | number;
77
+ leftFixed?: any;
78
+ };
79
+ export declare function promisify<T extends Function>(fn: T): (...args: Array<any>) => Promise<any> & {
80
+ raw: T;
81
+ };
82
+ export declare function getScrollParent(node: HTMLElement): HTMLElement | null;
83
+ /**
84
+ * Deep diff between two object, using lodash
85
+ * @param {Object} object Object compared
86
+ * @param {Object} base Object to compare with
87
+ * @return {Object} Return a new object who represent the diff
88
+ */
89
+ export declare function difference<T extends {
90
+ [propName: string]: any;
91
+ }, U extends {
92
+ [propName: string]: any;
93
+ }>(object: T, base: U, keepProps?: Array<string>): {
94
+ [propName: string]: any;
95
+ };
96
+ export declare const padArr: (arr: Array<any>, size?: number) => Array<Array<any>>;
97
+ export declare function __uri(id: string): string;
98
+ export declare function isBreakpoint(str: string): boolean;
99
+ export declare function until(fn: () => Promise<any>, when: (ret: any) => boolean, getCanceler: (fn: () => any) => void, interval?: number): Promise<unknown>;
100
+ export declare function omitControls(controls: Array<any>, omitItems: Array<string>): Array<any>;
101
+ export declare function isEmpty(thing: any): boolean;
102
+ /**
103
+ * 基于时间戳的 uuid
104
+ *
105
+ * @returns uniqueId
106
+ */
107
+ export declare const uuid: () => string;
108
+ export declare const uuidv4: () => string;
109
+ export interface TreeItem {
110
+ children?: TreeArray;
111
+ [propName: string]: any;
112
+ }
113
+ export interface TreeArray extends Array<TreeItem> {
114
+ }
115
+ /**
116
+ * 类似于 arr.map 方法,此方法主要针对类似下面示例的树形结构。
117
+ * [
118
+ * {
119
+ * children: []
120
+ * },
121
+ * // 其他成员
122
+ * ]
123
+ *
124
+ * @param {Tree} tree 树形数据
125
+ * @param {Function} iterator 处理函数,返回的数据会被替换成新的。
126
+ * @return {Tree} 返回处理过的 tree
127
+ */
128
+ export declare function mapTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => T, level?: number, depthFirst?: boolean, paths?: Array<T>): any[];
129
+ /**
130
+ * 遍历树
131
+ * @param tree
132
+ * @param iterator
133
+ */
134
+ export declare function eachTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number) => any, level?: number): void;
135
+ /**
136
+ * 在树中查找节点。
137
+ * @param tree
138
+ * @param iterator
139
+ */
140
+ export declare function findTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => any): T | null;
141
+ /**
142
+ * 在树中查找节点, 返回下标数组。
143
+ * @param tree
144
+ * @param iterator
145
+ */
146
+ export declare function findTreeIndex<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => any): Array<number> | undefined;
147
+ export declare function getTree<T extends TreeItem>(tree: Array<T>, idx: Array<number> | number): T | undefined | null;
148
+ /**
149
+ * 过滤树节点
150
+ *
151
+ * @param tree
152
+ * @param iterator
153
+ */
154
+ export declare function filterTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number) => any, level?: number, depthFirst?: boolean): T[];
155
+ /**
156
+ * 判断树中每个节点是否满足某个条件。
157
+ * @param tree
158
+ * @param iterator
159
+ */
160
+ export declare function everyTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>, indexes: Array<number>) => boolean, level?: number, paths?: Array<T>, indexes?: Array<number>): boolean;
161
+ /**
162
+ * 判断树中是否有某些节点满足某个条件。
163
+ * @param tree
164
+ * @param iterator
165
+ */
166
+ export declare function someTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => boolean): boolean;
167
+ /**
168
+ * 将树打平变成一维数组,可以传入第二个参数实现打平节点中的其他属性。
169
+ *
170
+ * 比如:
171
+ *
172
+ * flattenTree([
173
+ * {
174
+ * id: 1,
175
+ * children: [
176
+ * { id: 2 },
177
+ * { id: 3 },
178
+ * ]
179
+ * }
180
+ * ], item => item.id); // 输出为 [1, 2, 3]
181
+ *
182
+ * @param tree
183
+ * @param mapper
184
+ */
185
+ export declare function flattenTree<T extends TreeItem>(tree: Array<T>): Array<T>;
186
+ export declare function flattenTree<T extends TreeItem, U>(tree: Array<T>, mapper: (value: T, index: number) => U): Array<U>;
187
+ /**
188
+ * 操作树,遵循 imutable, 每次返回一个新的树。
189
+ * 类似数组的 splice 不同的地方这个方法不修改原始数据,
190
+ * 同时第二个参数不是下标,而是下标数组,分别代表每一层的下标。
191
+ *
192
+ * 至于如何获取下标数组,请查看 findTreeIndex
193
+ *
194
+ * @param tree
195
+ * @param idx
196
+ * @param deleteCount
197
+ * @param ...items
198
+ */
199
+ export declare function spliceTree<T extends TreeItem>(tree: Array<T>, idx: Array<number> | number, deleteCount?: number, ...items: Array<T>): Array<T>;
200
+ /**
201
+ * 计算树的深度
202
+ * @param tree
203
+ */
204
+ export declare function getTreeDepth<T extends TreeItem>(tree: Array<T>): number;
205
+ /**
206
+ * 从树中获取某个值的所有祖先
207
+ * @param tree
208
+ * @param value
209
+ */
210
+ export declare function getTreeAncestors<T extends TreeItem>(tree: Array<T>, value: T, includeSelf?: boolean): Array<T> | null;
211
+ /**
212
+ * 从树中获取某个值的上级
213
+ * @param tree
214
+ * @param value
215
+ */
216
+ export declare function getTreeParent<T extends TreeItem>(tree: Array<T>, value: T): T | null;
217
+ export declare function ucFirst(str?: string): string | undefined;
218
+ export declare function lcFirst(str?: string): string;
219
+ export declare function camel(str?: string): string;
220
+ export declare function getWidthRate(value: any, strictMode?: boolean): number;
221
+ export declare function getLevelFromClassName(value: string, defaultValue?: string): string;
222
+ export declare function pickEventsProps(props: any): any;
223
+ export declare const autobind: typeof autobindMethod;
224
+ export declare const bulkBindFunctions: <T extends {
225
+ [propName: string]: any;
226
+ }>(context: T, funNames: FunctionPropertyNames<T>[]) => void;
227
+ export declare function sortArray<T extends any>(items: Array<T>, field: string, dir: -1 | 1): Array<T>;
228
+ export declare function hasFile(object: any): boolean;
229
+ export declare function qsstringify(data: any, options?: any, keepEmptyArray?: boolean): string;
230
+ export declare function qsparse(data: string, options?: any): qs.ParsedQs;
231
+ export declare function object2formData(data: any, options?: any, fd?: FormData): any;
232
+ export declare function chainFunctions(...fns: Array<(...args: Array<any>) => void>): (...args: Array<any>) => void;
233
+ export declare function chainEvents(props: any, schema: any): any;
234
+ export declare function mapObject(value: any, fn: Function): any;
235
+ export declare function loadScript(src: string): Promise<void>;
236
+ export declare class SkipOperation extends Error {
237
+ }
238
+ /**
239
+ * 深度查找具有某个 key 名字段的对象,实际实现是 internalFindObjectsWithKey,这里包一层是为了做循环引用检测
240
+ * @param obj
241
+ * @param key
242
+ */
243
+ export declare function findObjectsWithKey(obj: any, key: string): any[];
244
+ /**
245
+ * 获取浏览器滚动条宽度 https://stackoverflow.com/a/13382873
246
+ */
247
+ export declare function getScrollbarWidth(): number;
248
+ export declare function getPropValue<T extends {
249
+ value?: any;
250
+ name?: string;
251
+ data?: any;
252
+ defaultValue?: any;
253
+ }>(props: T, getter?: (props: T) => any): any;
254
+ export declare function detectPropValueChanged<T extends {
255
+ value?: any;
256
+ name?: string;
257
+ data?: any;
258
+ defaultValue?: any;
259
+ }>(props: T, prevProps: T, onChange: (value: any) => void, getter?: (props: T) => any): void;
260
+ export declare function removeHTMLTag(str: string): string;
261
+ /**
262
+ * 将路径格式的value转换成普通格式的value值
263
+ *
264
+ * @example
265
+ *
266
+ * 'a/b/c' => 'c';
267
+ * {label: 'A/B/C', value: 'a/b/c'} => {label: 'C', value: 'c'};
268
+ * 'a/b/c,a/d' => 'c,d';
269
+ * ['a/b/c', 'a/d'] => ['c', 'd'];
270
+ * [{label: 'A/B/C', value: 'a/b/c'},{label: 'A/D', value: 'a/d'}] => [{label: 'C', value: 'c'},{label: 'D', value: 'd'}]
271
+ */
272
+ export declare function normalizeNodePath(value: any, enableNodePath: boolean, labelField?: string, valueField?: string, pathSeparator?: string, delimiter?: string): {
273
+ nodeValueArray: any[];
274
+ nodePathArray: any[];
275
+ };
276
+ export declare function isClickOnInput(e: React.MouseEvent<HTMLElement>): boolean;
277
+ export declare function hashCode(s: string): number;
278
+ /**
279
+ * 遍历 schema
280
+ * @param json
281
+ * @param mapper
282
+ */
283
+ export declare function JSONTraverse(json: any, mapper: (value: any, key: string | number, host: Object) => any): void;
284
+ export declare function convertArrayValueToMoment(value: number[], types: string[], mom: moment.Moment): moment.Moment;
285
+ export declare function getRange(min: number, max: number, step?: number): number[];
286
+ export declare function repeatCount(count: number, iterator: (index: number) => any): any[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @file 图标支持的公共方法,主要是支持自动识别地址和 icon-font
3
+ */
4
+ /// <reference types="react" />
5
+ import { ClassNamesFn } from '../theme';
6
+ /**
7
+ * 判断字符串来生成 i 或 img
8
+ * @param icon icon 设置
9
+ * @param className 内部用的 className
10
+ * @param classNameProp amis 配置里设置的 className
11
+ */
12
+ export declare const generateIcon: (cx: ClassNamesFn, icon?: string | undefined, className?: string | undefined, classNameProp?: string | undefined) => JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @file image 相关的工具
3
+ * @param url
4
+ */
5
+ /**
6
+ * 将 url 转成 dataurl
7
+ * @param url
8
+ */
9
+ export declare const toDataURL: ((url: string) => Promise<string>) & import("lodash").MemoizedFunction;
10
+ /**
11
+ * 根据 url 获取图片尺寸
12
+ * @param url
13
+ */
14
+ export declare const getImageDimensions: ((url: string) => Promise<{
15
+ width: number;
16
+ height: number;
17
+ }>) & import("lodash").MemoizedFunction;
@@ -0,0 +1,12 @@
1
+ export * from './helper';
2
+ export { resizeSensor } from './resize-sensor';
3
+ export * from './api';
4
+ export * from './tpl';
5
+ export * from './tpl-builtin';
6
+ export * from './DataScope';
7
+ export * from './DataSchema';
8
+ export * from './normalizeOptions';
9
+ export * from './validations';
10
+ import './debug';
11
+ import animation from './Animation';
12
+ export { animation };
@@ -0,0 +1 @@
1
+ export declare function isPureVariable(path?: any): path is string;
@@ -0,0 +1,6 @@
1
+ export declare function JSONSchme2AMisSchema(schema: any): {
2
+ title: any;
3
+ type: string;
4
+ mode: string;
5
+ controls: any[];
6
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 将例如像 a.b.c 或 a[1].b 的字符串转换为路径数组
3
+ *
4
+ * @param string 要转换的字符串
5
+ */
6
+ export declare const keyToPath: (string: string) => string[];
@@ -0,0 +1 @@
1
+ export declare function makeSorter(key: string, method?: 'alpha' | 'numerical', order?: 'desc' | 'asc'): (a: any, b: any) => number;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @file markdown 解析
3
+ */
4
+ import markdownIt from 'markdown-it';
5
+ export default function (content: string, options?: markdownIt.Options): string;
@@ -0,0 +1 @@
1
+ export declare const normalizeLink: (to: string, location?: Location) => string;
@@ -0,0 +1,7 @@
1
+ import { Options } from '../schema';
2
+ export declare function normalizeOptions(options: string | {
3
+ [propName: string]: string;
4
+ } | Array<string> | Options, share?: {
5
+ values: Array<any>;
6
+ options: Array<any>;
7
+ }, valueField?: string): Options;
@@ -0,0 +1,15 @@
1
+ export declare function createObject(superProps?: {
2
+ [propName: string]: any;
3
+ }, props?: {
4
+ [propName: string]: any;
5
+ }, properties?: any): object;
6
+ export declare function cloneObject(target: any, persistOwnProps?: boolean): any;
7
+ export declare function extendObject(target: any, src?: any, persistOwnProps?: boolean): any;
8
+ export declare function isObject(obj: any): any;
9
+ export declare function setVariable(data: {
10
+ [propName: string]: any;
11
+ }, key: string, value: any, convertKeyToPath?: boolean): void;
12
+ export declare function deleteVariable(data: {
13
+ [propName: string]: any;
14
+ }, key: string): void;
15
+ export declare function pickValues(names: string, data: object): any;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 修改自 https://github.com/react-bootstrap/dom-helpers/blob/master/src/offset.ts
3
+ */
4
+ /**
5
+ * Returns the offset of a given element, including top and left positions, width and height.
6
+ *
7
+ * @param node the element
8
+ */
9
+ export default function offset(node: HTMLElement): {
10
+ top: number;
11
+ left: number;
12
+ height: number;
13
+ width: number;
14
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 删减自 https://github.com/react-bootstrap/dom-helpers/blob/master/src/offsetParent.ts
3
+ */
4
+ export default function offsetParent(node: HTMLElement): HTMLElement;
@@ -0,0 +1,3 @@
1
+ import { OptionValue, Option } from '../schema';
2
+ export declare function matchOptionValue(a: OptionValue, b: Option, valueField?: string): boolean;
3
+ export declare function optionValueCompare(a: OptionValue, valueField?: string): (b: Option) => boolean;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 删减自 https://github.com/react-bootstrap/dom-helpers/blob/master/src/position.ts
3
+ */
4
+ /**
5
+ * Returns the relative position of a given element.
6
+ *
7
+ * @param node the element
8
+ * @param offsetParent the offset parent
9
+ */
10
+ export default function position(node: HTMLElement, offsetParent?: HTMLElement): {
11
+ top: number;
12
+ left: number;
13
+ height: number;
14
+ width: number;
15
+ };
@@ -0,0 +1 @@
1
+ export declare const prettyBytes: (num: number) => string;
@@ -0,0 +1,44 @@
1
+ /// <reference types="react" />
2
+ import { ListenerAction } from '../actions/Action';
3
+ import { RendererProps } from '../factory';
4
+ import { IScopedContext } from '../Scoped';
5
+ export interface EventListeners {
6
+ [propName: string]: {
7
+ weight?: number;
8
+ actions: ListenerAction[];
9
+ };
10
+ }
11
+ export interface OnEventProps {
12
+ onEvent?: {
13
+ [propName: string]: {
14
+ weight?: number;
15
+ actions: ListenerAction[];
16
+ };
17
+ };
18
+ }
19
+ export interface RendererEventListener {
20
+ renderer: React.Component<RendererProps>;
21
+ type: string;
22
+ weight: number;
23
+ actions: ListenerAction[];
24
+ }
25
+ export declare type RendererEvent<T, P = any> = {
26
+ context: T;
27
+ type: string;
28
+ prevented?: boolean;
29
+ stoped?: boolean;
30
+ data?: P;
31
+ preventDefault: () => void;
32
+ stopPropagation: () => void;
33
+ setData: (data: P) => void;
34
+ };
35
+ export interface RendererEventContext {
36
+ data?: any;
37
+ [propName: string]: any;
38
+ }
39
+ export declare function createRendererEvent<T extends RendererEventContext>(type: string, context: T): RendererEvent<T>;
40
+ export declare const bindEvent: (renderer: any) => (() => void) | undefined;
41
+ export declare function dispatchEvent(e: string | React.MouseEvent<any>, renderer: React.Component<RendererProps>, scoped: IScopedContext, data: any, broadcast?: RendererEvent<any>): Promise<RendererEvent<any> | void>;
42
+ export declare const getRendererEventListeners: () => RendererEventListener[];
43
+ declare const _default: {};
44
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 对文本进行替换
3
+ */
4
+ export declare function replaceText(schema: any, replaceText: {
5
+ [propName: string]: string;
6
+ }, replaceTextIgnoreKeys: String[]): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file resize-sensor.js.
3
+ * @author fex
4
+ */
5
+ export declare function getComputedStyle(element: HTMLElement, prop: string): any;
6
+ export declare function resizeSensor(element: HTMLElement, callback: () => void): () => void;
@@ -0,0 +1 @@
1
+ export declare function resolveVariable(path?: string, data?: any): any;
@@ -0,0 +1 @@
1
+ export declare const resolveVariableAndFilter: (path?: string | undefined, data?: object, defaultFilter?: string, fallbackValue?: (value: any) => any) => any;
@@ -0,0 +1,6 @@
1
+ export declare function scrollPosition(dom: HTMLElement): {
2
+ top: number;
3
+ left: number;
4
+ height: number;
5
+ width: number;
6
+ };
@@ -0,0 +1 @@
1
+ export declare function string2regExp(value: string, caseSensitive?: boolean): RegExp;
@@ -0,0 +1 @@
1
+ export declare function stripNumber(number: number): number;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 处理样式相关的工具方法,不放 helper 里是为了避免循环依赖
3
+ */
4
+ /**
5
+ * 处理配置中的 style,主要做三件事:
6
+ * 1. 变量解析
7
+ * 2. 将 font-size 之类的错误写法转成 fontSize
8
+ * 3. 针对 image 自动加 url
9
+ */
10
+ export declare function buildStyle(style: any, data: any): any;
@@ -0,0 +1 @@
1
+ export declare const tokenize: (str: string, data: object, defaultFilter?: string) => string;
@@ -0,0 +1,18 @@
1
+ import { Enginer } from './tpl';
2
+ import { getFilters, registerFilter } from 'amis-formula';
3
+ import { prettyBytes } from './prettyBytes';
4
+ import { escapeHtml } from './escapeHtml';
5
+ import { formatDuration } from './formatDuration';
6
+ import { filterDate, parseDuration, relativeValueRe } from './date';
7
+ import { pickValues } from './object';
8
+ import { isPureVariable } from './isPureVariable';
9
+ import { stripNumber } from './stripNumber';
10
+ import { tokenize } from './tokenize';
11
+ import { resolveVariable } from './resolveVariable';
12
+ import { resolveVariableAndFilter } from './resolveVariableAndFilter';
13
+ import { dataMapping, resolveMapping } from './dataMapping';
14
+ import './filter';
15
+ export { prettyBytes, escapeHtml, formatDuration, filterDate, relativeValueRe, parseDuration, getFilters, registerFilter, pickValues, isPureVariable, stripNumber, tokenize, resolveVariable, resolveVariableAndFilter, resolveMapping, dataMapping };
16
+ export declare function register(): Enginer & {
17
+ name: string;
18
+ };
@@ -0,0 +1,4 @@
1
+ import { Enginer } from './tpl';
2
+ export declare function register(): Enginer & {
3
+ name: string;
4
+ };
@@ -0,0 +1,11 @@
1
+ export interface Enginer {
2
+ test: (tpl: string) => boolean;
3
+ removeEscapeToken?: (tpl: string) => string;
4
+ compile: (tpl: string, data: object, ...rest: Array<any>) => string;
5
+ }
6
+ export declare function registerTplEnginer(name: string, enginer: Enginer): void;
7
+ export declare function filter(tpl?: any, data?: object, ...rest: Array<any>): string;
8
+ export declare function setCustomEvalExpression(fn: (expression: string, data?: any) => boolean): void;
9
+ export declare function evalExpression(expression: string, data?: object): boolean;
10
+ export declare function setCustomEvalJs(fn: (expression: string, data?: any) => any): void;
11
+ export declare function evalJS(js: string, data: object): any;
@@ -0,0 +1,39 @@
1
+ export interface ValidateFn {
2
+ (values: {
3
+ [propsName: string]: any;
4
+ }, value: any, arg1?: any, arg2?: any, arg3?: any): boolean;
5
+ }
6
+ export declare const validations: {
7
+ [propsName: string]: ValidateFn;
8
+ };
9
+ export declare function addRule(ruleName: string, fn: ValidateFn, message?: string): void;
10
+ export declare const validateMessages: {
11
+ [propName: string]: string;
12
+ };
13
+ export declare function validate(value: any, values: {
14
+ [propName: string]: any;
15
+ }, rules: {
16
+ [propName: string]: any;
17
+ }, messages?: {
18
+ [propName: string]: string;
19
+ }, __?: (str: string) => string): Array<{
20
+ rule: string;
21
+ msg: string;
22
+ }>;
23
+ export declare function validateObject(values: {
24
+ [propName: string]: any;
25
+ }, rules: {
26
+ [propName: string]: any;
27
+ }, messages?: {
28
+ [propName: string]: string;
29
+ }, __?: (str: string) => string): {
30
+ [propName: string]: {
31
+ rule: string;
32
+ msg: string;
33
+ }[];
34
+ };
35
+ export declare function str2rules(validations: string | {
36
+ [propName: string]: any;
37
+ }): {
38
+ [propName: string]: any;
39
+ };