amis-core 2.9.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +1 -1
  3. package/esm/SchemaRenderer.d.ts +1 -0
  4. package/esm/SchemaRenderer.js +7 -5
  5. package/esm/Scoped.js +1 -1
  6. package/esm/WithRootStore.js +1 -1
  7. package/esm/WithStore.js +1 -1
  8. package/esm/actions/Action.js +8 -2
  9. package/esm/actions/AjaxAction.js +1 -1
  10. package/esm/actions/BreakAction.js +1 -1
  11. package/esm/actions/BroadcastAction.js +1 -1
  12. package/esm/actions/CmptAction.js +1 -1
  13. package/esm/actions/ContinueAction.js +1 -1
  14. package/esm/actions/CopyAction.js +1 -1
  15. package/esm/actions/CustomAction.js +1 -1
  16. package/esm/actions/DialogAction.js +5 -1
  17. package/esm/actions/DrawerAction.js +1 -1
  18. package/esm/actions/EmailAction.js +1 -1
  19. package/esm/actions/LinkAction.js +1 -1
  20. package/esm/actions/LoopAction.js +1 -1
  21. package/esm/actions/PageAction.js +1 -1
  22. package/esm/actions/ParallelAction.js +1 -1
  23. package/esm/actions/SwitchAction.js +1 -1
  24. package/esm/actions/ToastAction.js +1 -1
  25. package/esm/components/LazyComponent.js +1 -1
  26. package/esm/components/Overlay.d.ts +2 -2
  27. package/esm/components/Overlay.js +1 -1
  28. package/esm/components/PopOver.js +1 -1
  29. package/esm/env.js +1 -1
  30. package/esm/envOverwrite.js +1 -1
  31. package/esm/factory.d.ts +2 -1
  32. package/esm/factory.js +3 -3
  33. package/esm/index.d.ts +8 -3
  34. package/esm/index.js +10 -9
  35. package/esm/locale.js +1 -1
  36. package/esm/renderers/Form.d.ts +1 -1
  37. package/esm/renderers/Form.js +1 -1
  38. package/esm/renderers/Item.js +10 -7
  39. package/esm/renderers/Options.js +3 -3
  40. package/esm/renderers/Placeholder.js +1 -1
  41. package/esm/renderers/builtin.js +1 -1
  42. package/esm/renderers/register.js +1 -1
  43. package/esm/renderers/wrapControl.js +1 -1
  44. package/esm/store/app.js +1 -1
  45. package/esm/store/combo.js +1 -1
  46. package/esm/store/crud.js +22 -8
  47. package/esm/store/form.js +1 -1
  48. package/esm/store/formItem.js +2 -2
  49. package/esm/store/iRenderer.js +1 -1
  50. package/esm/store/index.js +1 -1
  51. package/esm/store/list.js +1 -1
  52. package/esm/store/manager.js +1 -1
  53. package/esm/store/modal.js +1 -1
  54. package/esm/store/node.js +1 -1
  55. package/esm/store/pagination.js +2 -2
  56. package/esm/store/root.js +1 -1
  57. package/esm/store/service.js +1 -1
  58. package/esm/store/table.d.ts +24 -23
  59. package/esm/store/table.js +17 -4
  60. package/esm/store/table2.d.ts +5 -5
  61. package/esm/store/table2.js +23 -19
  62. package/esm/theme.js +1 -1
  63. package/esm/types.d.ts +6 -0
  64. package/esm/utils/Animation.js +1 -1
  65. package/esm/utils/ColorScale.js +1 -1
  66. package/esm/utils/DataSchema.js +1 -1
  67. package/esm/utils/DataScope.js +1 -1
  68. package/esm/utils/RootClose.js +1 -1
  69. package/esm/utils/SimpleMap.js +1 -1
  70. package/esm/utils/api.js +9 -2
  71. package/esm/utils/attachmentAdpator.js +1 -1
  72. package/esm/utils/autobind.js +1 -1
  73. package/esm/utils/columnsSplit.js +1 -1
  74. package/esm/utils/dataMapping.js +1 -1
  75. package/esm/utils/date.js +1 -1
  76. package/esm/utils/debug.js +4 -4
  77. package/esm/utils/decodeEntity.js +1 -1
  78. package/esm/utils/dom.d.ts +2 -0
  79. package/esm/utils/dom.js +47 -10
  80. package/esm/utils/errors.js +1 -1
  81. package/esm/utils/escapeHtml.js +1 -1
  82. package/esm/utils/filter-schema.js +1 -1
  83. package/esm/utils/filter.js +1 -1
  84. package/esm/utils/formatDuration.js +1 -1
  85. package/esm/utils/formula.js +2 -2
  86. package/esm/utils/getVariable.js +1 -1
  87. package/esm/utils/grammar.js +1 -1
  88. package/esm/utils/handleAction.js +1 -1
  89. package/esm/utils/helper.d.ts +7 -0
  90. package/esm/utils/helper.js +28 -3
  91. package/esm/utils/highlight.js +1 -1
  92. package/esm/utils/icon.d.ts +6 -1
  93. package/esm/utils/icon.js +6 -1
  94. package/esm/utils/image.js +1 -1
  95. package/esm/utils/isPureVariable.js +1 -1
  96. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  97. package/esm/utils/keyToPath.js +1 -1
  98. package/esm/utils/makeSorter.js +1 -1
  99. package/esm/utils/normalizeLink.js +1 -1
  100. package/esm/utils/normalizeOptions.js +1 -1
  101. package/esm/utils/object.js +1 -1
  102. package/esm/utils/offset.js +1 -1
  103. package/esm/utils/offsetParent.js +1 -1
  104. package/esm/utils/optionValueCompare.js +1 -1
  105. package/esm/utils/position.js +1 -1
  106. package/esm/utils/prettyBytes.js +1 -1
  107. package/esm/utils/renderer-event.js +35 -32
  108. package/esm/utils/replaceText.js +1 -1
  109. package/esm/utils/resize-sensor.js +1 -1
  110. package/esm/utils/resolveCondition.d.ts +1 -0
  111. package/esm/utils/resolveCondition.js +19 -4
  112. package/esm/utils/resolveVariable.js +1 -1
  113. package/esm/utils/resolveVariableAndFilter.js +1 -1
  114. package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
  115. package/esm/utils/resolveVariableAndFilterForAsync.js +20 -3
  116. package/esm/utils/scrollPosition.js +1 -1
  117. package/esm/utils/string2regExp.js +1 -1
  118. package/esm/utils/stripNumber.js +1 -1
  119. package/esm/utils/style-helper.d.ts +9 -4
  120. package/esm/utils/style-helper.js +81 -16
  121. package/esm/utils/style.js +2 -2
  122. package/esm/utils/toNumber.js +1 -1
  123. package/esm/utils/tokenize.d.ts +1 -0
  124. package/esm/utils/tokenize.js +34 -3
  125. package/esm/utils/tpl-builtin.d.ts +2 -1
  126. package/esm/utils/tpl-builtin.js +18 -3
  127. package/esm/utils/tpl-lodash.js +3 -2
  128. package/esm/utils/tpl.d.ts +2 -0
  129. package/esm/utils/tpl.js +24 -2
  130. package/esm/utils/uncontrollable.js +1 -1
  131. package/esm/utils/validations.d.ts +4 -1
  132. package/esm/utils/validations.js +27 -12
  133. package/lib/Root.js +1 -1
  134. package/lib/RootRenderer.js +1 -1
  135. package/lib/SchemaRenderer.d.ts +1 -0
  136. package/lib/SchemaRenderer.js +7 -4
  137. package/lib/Scoped.js +1 -1
  138. package/lib/WithRootStore.js +1 -1
  139. package/lib/WithStore.js +1 -1
  140. package/lib/actions/Action.js +8 -2
  141. package/lib/actions/AjaxAction.js +1 -1
  142. package/lib/actions/BreakAction.js +1 -1
  143. package/lib/actions/BroadcastAction.js +1 -1
  144. package/lib/actions/CmptAction.js +1 -1
  145. package/lib/actions/ContinueAction.js +1 -1
  146. package/lib/actions/CopyAction.js +1 -1
  147. package/lib/actions/CustomAction.js +1 -1
  148. package/lib/actions/DialogAction.js +5 -1
  149. package/lib/actions/DrawerAction.js +1 -1
  150. package/lib/actions/EmailAction.js +1 -1
  151. package/lib/actions/LinkAction.js +1 -1
  152. package/lib/actions/LoopAction.js +1 -1
  153. package/lib/actions/PageAction.js +1 -1
  154. package/lib/actions/ParallelAction.js +1 -1
  155. package/lib/actions/SwitchAction.js +1 -1
  156. package/lib/actions/ToastAction.js +1 -1
  157. package/lib/components/LazyComponent.js +1 -1
  158. package/lib/components/Overlay.d.ts +2 -2
  159. package/lib/components/Overlay.js +1 -1
  160. package/lib/components/PopOver.js +1 -1
  161. package/lib/env.js +1 -1
  162. package/lib/envOverwrite.js +1 -1
  163. package/lib/factory.d.ts +2 -1
  164. package/lib/factory.js +3 -3
  165. package/lib/index.d.ts +8 -3
  166. package/lib/index.js +14 -2
  167. package/lib/locale.js +1 -1
  168. package/lib/renderers/Form.d.ts +1 -1
  169. package/lib/renderers/Form.js +1 -1
  170. package/lib/renderers/Item.js +10 -7
  171. package/lib/renderers/Options.js +3 -3
  172. package/lib/renderers/Placeholder.js +1 -1
  173. package/lib/renderers/builtin.js +1 -1
  174. package/lib/renderers/register.js +1 -1
  175. package/lib/renderers/wrapControl.js +1 -1
  176. package/lib/store/app.js +1 -1
  177. package/lib/store/combo.js +1 -1
  178. package/lib/store/crud.js +22 -8
  179. package/lib/store/form.js +1 -1
  180. package/lib/store/formItem.js +2 -2
  181. package/lib/store/iRenderer.js +1 -1
  182. package/lib/store/index.js +1 -1
  183. package/lib/store/list.js +1 -1
  184. package/lib/store/manager.js +1 -1
  185. package/lib/store/modal.js +1 -1
  186. package/lib/store/node.js +1 -1
  187. package/lib/store/pagination.js +2 -2
  188. package/lib/store/root.js +1 -1
  189. package/lib/store/service.js +1 -1
  190. package/lib/store/table.d.ts +24 -23
  191. package/lib/store/table.js +17 -4
  192. package/lib/store/table2.d.ts +5 -5
  193. package/lib/store/table2.js +23 -19
  194. package/lib/theme.js +1 -1
  195. package/lib/types.d.ts +6 -0
  196. package/lib/utils/Animation.js +1 -1
  197. package/lib/utils/ColorScale.js +1 -1
  198. package/lib/utils/DataSchema.js +1 -1
  199. package/lib/utils/DataScope.js +1 -1
  200. package/lib/utils/RootClose.js +1 -1
  201. package/lib/utils/SimpleMap.js +1 -1
  202. package/lib/utils/api.js +9 -2
  203. package/lib/utils/attachmentAdpator.js +1 -1
  204. package/lib/utils/autobind.js +1 -1
  205. package/lib/utils/columnsSplit.js +1 -1
  206. package/lib/utils/dataMapping.js +1 -1
  207. package/lib/utils/date.js +1 -1
  208. package/lib/utils/debug.js +4 -4
  209. package/lib/utils/decodeEntity.js +1 -1
  210. package/lib/utils/dom.d.ts +2 -0
  211. package/lib/utils/dom.js +48 -9
  212. package/lib/utils/errors.js +1 -1
  213. package/lib/utils/escapeHtml.js +1 -1
  214. package/lib/utils/filter-schema.js +1 -1
  215. package/lib/utils/filter.js +1 -1
  216. package/lib/utils/formatDuration.js +1 -1
  217. package/lib/utils/formula.js +2 -2
  218. package/lib/utils/getVariable.js +1 -1
  219. package/lib/utils/grammar.js +1 -1
  220. package/lib/utils/handleAction.js +1 -1
  221. package/lib/utils/helper.d.ts +7 -0
  222. package/lib/utils/helper.js +29 -2
  223. package/lib/utils/highlight.js +1 -1
  224. package/lib/utils/icon.d.ts +6 -1
  225. package/lib/utils/icon.js +6 -1
  226. package/lib/utils/image.js +1 -1
  227. package/lib/utils/isPureVariable.js +1 -1
  228. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  229. package/lib/utils/keyToPath.js +1 -1
  230. package/lib/utils/makeSorter.js +1 -1
  231. package/lib/utils/normalizeLink.js +1 -1
  232. package/lib/utils/normalizeOptions.js +1 -1
  233. package/lib/utils/object.js +1 -1
  234. package/lib/utils/offset.js +1 -1
  235. package/lib/utils/offsetParent.js +1 -1
  236. package/lib/utils/optionValueCompare.js +1 -1
  237. package/lib/utils/position.js +1 -1
  238. package/lib/utils/prettyBytes.js +1 -1
  239. package/lib/utils/renderer-event.js +35 -32
  240. package/lib/utils/replaceText.js +1 -1
  241. package/lib/utils/resize-sensor.js +1 -1
  242. package/lib/utils/resolveCondition.d.ts +1 -0
  243. package/lib/utils/resolveCondition.js +19 -3
  244. package/lib/utils/resolveVariable.js +1 -1
  245. package/lib/utils/resolveVariableAndFilter.js +1 -1
  246. package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
  247. package/lib/utils/resolveVariableAndFilterForAsync.js +20 -2
  248. package/lib/utils/scrollPosition.js +1 -1
  249. package/lib/utils/string2regExp.js +1 -1
  250. package/lib/utils/stripNumber.js +1 -1
  251. package/lib/utils/style-helper.d.ts +9 -4
  252. package/lib/utils/style-helper.js +86 -15
  253. package/lib/utils/style.js +2 -2
  254. package/lib/utils/toNumber.js +1 -1
  255. package/lib/utils/tokenize.d.ts +1 -0
  256. package/lib/utils/tokenize.js +33 -1
  257. package/lib/utils/tpl-builtin.d.ts +2 -1
  258. package/lib/utils/tpl-builtin.js +17 -2
  259. package/lib/utils/tpl-lodash.js +3 -2
  260. package/lib/utils/tpl.d.ts +2 -0
  261. package/lib/utils/tpl.js +24 -1
  262. package/lib/utils/uncontrollable.js +1 -1
  263. package/lib/utils/validations.d.ts +4 -1
  264. package/lib/utils/validations.js +27 -12
  265. package/package.json +3 -3
@@ -1,13 +1,13 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
6
+ import { __awaiter, __generator } from 'tslib';
6
7
  export { getFilters, registerFilter, registerFunction } from 'amis-formula';
7
8
  import 'moment';
8
- import 'tslib';
9
9
  import 'lodash/isPlainObject';
10
- import { tokenize } from './tokenize.js';
10
+ import { tokenize, asyncTokenize } from './tokenize.js';
11
11
  export { tokenize } from './tokenize.js';
12
12
  import './filter.js';
13
13
 
@@ -38,6 +38,7 @@ function matchSynatax(str) {
38
38
  return false;
39
39
  }
40
40
  function register() {
41
+ var _this = this;
41
42
  return {
42
43
  name: 'builtin',
43
44
  test: function (str) { return typeof str === 'string' && matchSynatax(str); },
@@ -52,6 +53,20 @@ function register() {
52
53
  catch (e) {
53
54
  return "error: ".concat(e.message);
54
55
  }
56
+ },
57
+ asyncCompile: function (str, data, defaultFilter) {
58
+ if (defaultFilter === void 0) { defaultFilter = '| html'; }
59
+ return __awaiter(_this, void 0, void 0, function () {
60
+ return __generator(this, function (_a) {
61
+ try {
62
+ return [2 /*return*/, asyncTokenize(str, data, defaultFilter)];
63
+ }
64
+ catch (e) {
65
+ return [2 /*return*/, "error: ".concat(e.message)];
66
+ }
67
+ return [2 /*return*/];
68
+ });
69
+ });
55
70
  }
56
71
  };
57
72
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -55,7 +55,8 @@ function register() {
55
55
  return {
56
56
  name: 'lodash',
57
57
  test: function (str) { return !!~str.indexOf('<%'); },
58
- compile: function (str, data) { return lodashCompile(str, data); }
58
+ compile: function (str, data) { return lodashCompile(str, data); },
59
+ asyncCompile: function (str, data) { return lodashCompile(str, data); }
59
60
  };
60
61
  }
61
62
 
@@ -2,9 +2,11 @@ export interface Enginer {
2
2
  test: (tpl: string) => boolean;
3
3
  removeEscapeToken?: (tpl: string) => string;
4
4
  compile: (tpl: string, data: object, ...rest: Array<any>) => string;
5
+ asyncCompile: (tpl: string, data: object, ...rest: Array<any>) => Promise<string>;
5
6
  }
6
7
  export declare function registerTplEnginer(name: string, enginer: Enginer): void;
7
8
  export declare function filter(tpl?: any, data?: object, ...rest: Array<any>): string;
9
+ export declare function asyncFilter(tpl?: any, data?: object, ...rest: Array<any>): Promise<string>;
8
10
  export declare function setCustomEvalExpression(fn: (expression: string, data?: any) => boolean): void;
9
11
  export declare function evalExpression(expression: string, data?: object): boolean;
10
12
  /**
package/esm/utils/tpl.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -34,6 +34,27 @@ function filter(tpl, data) {
34
34
  }
35
35
  return tpl;
36
36
  }
37
+ function asyncFilter(tpl, data) {
38
+ if (data === void 0) { data = {}; }
39
+ var rest = [];
40
+ for (var _i = 2; _i < arguments.length; _i++) {
41
+ rest[_i - 2] = arguments[_i];
42
+ }
43
+ if (!tpl || typeof tpl !== 'string') {
44
+ return Promise.resolve('');
45
+ }
46
+ var keys = Object.keys(enginers);
47
+ for (var i = 0, len = keys.length; i < len; i++) {
48
+ var enginer = enginers[keys[i]];
49
+ if (enginer.test(tpl)) {
50
+ return enginer.asyncCompile.apply(enginer, __spreadArray([tpl, data], __read(rest), false));
51
+ }
52
+ else if (enginer.removeEscapeToken) {
53
+ tpl = enginer.removeEscapeToken(tpl);
54
+ }
55
+ }
56
+ return tpl;
57
+ }
37
58
  // 缓存一下提升性能
38
59
  var EVAL_CACHE = {};
39
60
  var customEvalExpressionFn;
@@ -144,8 +165,9 @@ function evalJS(js, data) {
144
165
  registerTplEnginer(info.name, {
145
166
  test: info.test,
146
167
  compile: info.compile,
168
+ asyncCompile: info.asyncCompile,
147
169
  removeEscapeToken: info.removeEscapeToken
148
170
  });
149
171
  });
150
172
 
151
- export { evalExpression, evalExpressionWithConditionBuilder, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs };
173
+ export { asyncFilter, evalExpression, evalExpressionWithConditionBuilder, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,7 +1,10 @@
1
1
  export interface ValidateFn {
2
2
  (values: {
3
3
  [propsName: string]: any;
4
- }, value: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): boolean;
4
+ }, value: any, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any): boolean | {
5
+ error: boolean;
6
+ msg?: string;
7
+ };
5
8
  }
6
9
  export declare const validations: {
7
10
  [propsName: string]: ValidateFn;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -348,12 +348,16 @@ var validateMessages = {
348
348
  isVariableName: 'validate.isVariableName'
349
349
  };
350
350
  function validate(value, values, rules, messages, __) {
351
+ var _a;
351
352
  if (__ === void 0) { __ = function (str) { return str; }; }
352
353
  var errors = [];
353
- rules &&
354
- Object.keys(rules).forEach(function (ruleName) {
354
+ if (rules) {
355
+ var ruleNames = Object.keys(rules);
356
+ var length_1 = ruleNames.length;
357
+ for (var index = 0; index < length_1; index++) {
358
+ var ruleName = ruleNames[index];
355
359
  if (!rules[ruleName] && rules[ruleName] !== 0) {
356
- return;
360
+ continue;
357
361
  }
358
362
  else if (typeof validations[ruleName] !== 'function') {
359
363
  throw new Error('Validation `' + ruleName + '` not exists!');
@@ -365,19 +369,30 @@ function validate(value, values, rules, messages, __) {
365
369
  }
366
370
  return item;
367
371
  });
368
- if (!fn.apply(void 0, __spreadArray([values, value], __read(args), false))) {
372
+ var validateRes = fn.apply(void 0, __spreadArray([values, value], __read(args), false));
373
+ // addRule 允许返回
374
+ // {error: true, msg: '错误提示'}
375
+ // 格式的信息来灵活展示错误
376
+ var fnResErrorMsg = '';
377
+ if (typeof validateRes === 'object' &&
378
+ validateRes.error === true) {
379
+ fnResErrorMsg = (_a = validateRes === null || validateRes === void 0 ? void 0 : validateRes.msg) !== null && _a !== void 0 ? _a : '';
380
+ }
381
+ if (!validateRes || fnResErrorMsg) {
369
382
  var msgRuleName = ruleName;
370
383
  if (Array.isArray(value)) {
371
384
  msgRuleName = "".concat(ruleName, "Array");
372
385
  }
373
- errors.push({
374
- rule: ruleName,
375
- msg: filter(__((messages && messages[ruleName]) ||
376
- validateMessages[msgRuleName] ||
377
- validateMessages[ruleName]), __assign({}, [''].concat(args)))
378
- });
386
+ return [{
387
+ rule: ruleName,
388
+ msg: filter(__((messages && messages[ruleName]) ||
389
+ fnResErrorMsg ||
390
+ validateMessages[msgRuleName] ||
391
+ validateMessages[ruleName]), __assign({}, [''].concat(args)))
392
+ }];
379
393
  }
380
- });
394
+ }
395
+ }
381
396
  return errors;
382
397
  }
383
398
  function validateObject(values, rules, messages, __) {
package/lib/Root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -8,6 +8,7 @@ interface SchemaRendererProps extends Partial<RendererProps> {
8
8
  $path: string;
9
9
  env: RendererEnv;
10
10
  }
11
+ export declare const RENDERER_TRANSMISSION_OMIT_PROPS: string[];
11
12
  export declare class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
12
13
  static displayName: string;
13
14
  static contextType: React.Context<IScopedContext>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -35,7 +35,7 @@ var difference__default = /*#__PURE__*/_interopDefaultLegacy(difference);
35
35
  var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
36
36
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
37
37
 
38
- var defaultOmitList = [
38
+ var RENDERER_TRANSMISSION_OMIT_PROPS = [
39
39
  'type',
40
40
  'name',
41
41
  '$ref',
@@ -60,7 +60,9 @@ var defaultOmitList = [
60
60
  'mode',
61
61
  'body',
62
62
  'id',
63
- 'inputOnly'
63
+ 'inputOnly',
64
+ 'label',
65
+ 'renderLabel'
64
66
  ];
65
67
  var componentCache = new SimpleMap.SimpleMap();
66
68
  var SchemaRenderer = /** @class */ (function (_super) {
@@ -178,7 +180,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
178
180
  if (subProps === void 0) { subProps = {}; }
179
181
  var _a = this.props; _a.schema; _a.$path; var env = _a.env, render = _a.render, rest = tslib.__rest(_a, ["schema", "$path", "env", "render"]);
180
182
  var $path = this.resolveRenderer(this.props).path;
181
- var omitList = defaultOmitList.concat();
183
+ var omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
182
184
  if (this.renderer) {
183
185
  var Component = this.renderer.component;
184
186
  Component.propsList &&
@@ -351,4 +353,5 @@ var PlaceholderComponent = /** @class */ (function (_super) {
351
353
  return PlaceholderComponent;
352
354
  }(React__default["default"].Component));
353
355
 
356
+ exports.RENDERER_TRANSMISSION_OMIT_PROPS = RENDERER_TRANSMISSION_OMIT_PROPS;
354
357
  exports.SchemaRenderer = SchemaRenderer;
package/lib/Scoped.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/lib/WithStore.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -206,7 +206,13 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
206
206
  _d.label = 6;
207
207
  case 6:
208
208
  args = dataMapping.dataMapping(actionConfig.args, mergeData, function (key) {
209
- return ['adaptor', 'responseAdaptor', 'requestAdaptor', 'responseData'].includes(key);
209
+ return [
210
+ 'adaptor',
211
+ 'responseAdaptor',
212
+ 'requestAdaptor',
213
+ 'responseData',
214
+ 'condition'
215
+ ].includes(key);
210
216
  });
211
217
  afterMappingData = dataMapping.dataMapping(actionConfig.data, mergeData);
212
218
  actionData = args && Object.keys(args).length
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -24,6 +24,10 @@ var DialogAction = /** @class */ (function () {
24
24
  var _a, _b, _c;
25
25
  return tslib.__awaiter(this, void 0, void 0, function () {
26
26
  return tslib.__generator(this, function (_d) {
27
+ // 防止editor preview模式下执行
28
+ if (action.$$id !== undefined) {
29
+ return [2 /*return*/];
30
+ }
27
31
  (_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, {
28
32
  actionType: 'dialog',
29
33
  dialog: ((_c = action.args) === null || _c === void 0 ? void 0 : _c.dialog) || action.dialog,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -13,9 +13,9 @@ interface OverlayProps {
13
13
  shouldUpdatePosition?: boolean;
14
14
  rootClose?: boolean;
15
15
  onHide?(props: any, ...args: any[]): any;
16
- container?: HTMLElement | (() => HTMLElement | null | undefined);
16
+ container?: HTMLElement | React.ReactNode | (() => HTMLElement | React.ReactNode | null | undefined);
17
17
  containerSelector?: string;
18
- target?: React.ReactNode | Function;
18
+ target?: React.ReactNode | HTMLElement | Function;
19
19
  watchTargetSizeChange?: boolean;
20
20
  offset?: [number, number];
21
21
  onEnter?(node: HTMLElement): any;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/lib/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/lib/factory.d.ts CHANGED
@@ -4,7 +4,7 @@ import { fetcherResult, SchemaNode, Schema, PlainObject } from './types';
4
4
  import { ThemeProps } from './theme';
5
5
  import { LocaleProps } from './locale';
6
6
  import type { RendererEnv } from './env';
7
- import { OnEventProps } from './utils/renderer-event';
7
+ import { OnEventProps, RendererEvent } from './utils/renderer-event';
8
8
  export interface TestFunc {
9
9
  (path: string, schema?: Schema, resolveRenderer?: (path: string, schema?: Schema, props?: any) => null | RendererConfig): boolean;
10
10
  }
@@ -35,6 +35,7 @@ export interface RendererProps extends ThemeProps, LocaleProps, OnEventProps {
35
35
  style?: {
36
36
  [propName: string]: any;
37
37
  };
38
+ onBroadcast?: (type: string, rawEvent: RendererEvent<any>, ctx: any) => any;
38
39
  [propName: string]: any;
39
40
  }
40
41
  export type RendererComponent = React.ComponentType<RendererProps> & {
package/lib/factory.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -147,11 +147,11 @@ var defaultOptions = {
147
147
  }
148
148
  },
149
149
  isCancel: function () {
150
- console.error('Please implement isCancel. see https://baidu.gitee.io/amis/docs/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
150
+ console.error('Please implement isCancel. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
151
151
  return false;
152
152
  },
153
153
  updateLocation: function () {
154
- console.error('Please implement updateLocation. see https://baidu.gitee.io/amis/docs/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
154
+ console.error('Please implement updateLocation. see https://aisuda.bce.baidu.com/amis/zh-CN/start/getting-started#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97');
155
155
  },
156
156
  jumpTo: function (to, action) {
157
157
  if (to === 'goBack') {
package/lib/index.d.ts CHANGED
@@ -14,10 +14,11 @@ export * from './types';
14
14
  export * from './store';
15
15
  import * as utils from './utils/helper';
16
16
  import { RegisterStore } from './store';
17
+ import type { IColumn, IColumn2, IRow, IRow2 } from './store';
17
18
  import { setDefaultLocale, getDefaultLocale, makeTranslator, register as registerLocale, extendLocale, removeLocaleData, localeable } from './locale';
18
19
  import type { LocaleProps, TranslateFn } from './locale';
19
20
  import Scoped, { ScopedContext } from './Scoped';
20
- import type { IScopedContext } from './Scoped';
21
+ import type { ScopedComponentType, IScopedContext } from './Scoped';
21
22
  import { classnames, getClassPrefix, setDefaultTheme, theme, getTheme, themeable, makeClassnames } from './theme';
22
23
  import type { ClassNamesFn, ThemeProps } from './theme';
23
24
  declare const classPrefix: string | undefined;
@@ -37,7 +38,11 @@ import LazyComponent from './components/LazyComponent';
37
38
  import Overlay from './components/Overlay';
38
39
  import PopOver from './components/PopOver';
39
40
  import { FormRenderer } from './renderers/Form';
40
- import type { FormHorizontal } from './renderers/Form';
41
+ import type { FormHorizontal, FormSchemaBase } from './renderers/Form';
42
+ import type { OnEventProps } from './utils/index';
43
+ import { valueMap as styleMap } from './utils/style-helper';
44
+ import { RENDERER_TRANSMISSION_OMIT_PROPS } from './SchemaRenderer';
45
+ import type { IItem } from './store/list';
41
46
  export declare const version = "__buildVersion";
42
- export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, AsyncEvaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, evaluateForAsync, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig };
47
+ export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, AsyncEvaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, evaluateForAsync, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig, styleMap, RENDERER_TRANSMISSION_OMIT_PROPS, ScopedComponentType, IItem, IColumn, IRow, IColumn2, IRow2, OnEventProps, FormSchemaBase };
43
48
  export declare function render(schema: Schema, props?: RootRenderProps, options?: RenderOptions, pathPrefix?: string): JSX.Element;