amis-core 2.8.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 (315) hide show
  1. package/esm/Root.d.ts +1 -1
  2. package/esm/Root.js +1 -1
  3. package/esm/RootRenderer.d.ts +1 -1
  4. package/esm/RootRenderer.js +21 -4
  5. package/esm/SchemaRenderer.d.ts +3 -1
  6. package/esm/SchemaRenderer.js +7 -5
  7. package/esm/Scoped.js +30 -2
  8. package/esm/WithRootStore.d.ts +4 -8
  9. package/esm/WithRootStore.js +1 -1
  10. package/esm/WithStore.js +1 -1
  11. package/esm/actions/Action.d.ts +2 -1
  12. package/esm/actions/Action.js +40 -12
  13. package/esm/actions/AjaxAction.js +1 -1
  14. package/esm/actions/BreakAction.js +1 -1
  15. package/esm/actions/BroadcastAction.js +1 -1
  16. package/esm/actions/CmptAction.js +1 -1
  17. package/esm/actions/ContinueAction.js +1 -1
  18. package/esm/actions/CopyAction.js +1 -1
  19. package/esm/actions/CustomAction.js +2 -1
  20. package/esm/actions/DialogAction.d.ts +1 -1
  21. package/esm/actions/DialogAction.js +12 -3
  22. package/esm/actions/DrawerAction.js +1 -1
  23. package/esm/actions/EmailAction.js +1 -1
  24. package/esm/actions/LinkAction.js +1 -1
  25. package/esm/actions/LoopAction.js +1 -1
  26. package/esm/actions/PageAction.js +1 -1
  27. package/esm/actions/ParallelAction.js +1 -1
  28. package/esm/actions/SwitchAction.js +18 -15
  29. package/esm/actions/ToastAction.js +1 -1
  30. package/esm/components/LazyComponent.d.ts +3 -3
  31. package/esm/components/LazyComponent.js +1 -1
  32. package/esm/components/Overlay.d.ts +2 -2
  33. package/esm/components/Overlay.js +2 -1
  34. package/esm/components/PopOver.d.ts +2 -4
  35. package/esm/components/PopOver.js +2 -1
  36. package/esm/env.d.ts +3 -7
  37. package/esm/env.js +1 -1
  38. package/esm/envOverwrite.js +1 -1
  39. package/esm/factory.d.ts +2 -1
  40. package/esm/factory.js +5 -3
  41. package/esm/index.d.ts +9 -5
  42. package/esm/index.js +12 -9
  43. package/esm/locale.d.ts +1 -3
  44. package/esm/locale.js +1 -1
  45. package/esm/renderers/Form.d.ts +1 -1
  46. package/esm/renderers/Form.js +17 -15
  47. package/esm/renderers/Item.d.ts +9 -15
  48. package/esm/renderers/Item.js +11 -7
  49. package/esm/renderers/Options.js +4 -3
  50. package/esm/renderers/Placeholder.js +1 -1
  51. package/esm/renderers/builtin.js +1 -1
  52. package/esm/renderers/register.js +1 -1
  53. package/esm/renderers/wrapControl.d.ts +4 -8
  54. package/esm/renderers/wrapControl.js +21 -30
  55. package/esm/store/app.d.ts +4 -2
  56. package/esm/store/app.js +1 -1
  57. package/esm/store/combo.d.ts +12 -6
  58. package/esm/store/combo.js +1 -1
  59. package/esm/store/crud.d.ts +5 -2
  60. package/esm/store/crud.js +46 -12
  61. package/esm/store/form.d.ts +4 -2
  62. package/esm/store/form.js +1 -1
  63. package/esm/store/formItem.js +6 -5
  64. package/esm/store/iRenderer.d.ts +5 -2
  65. package/esm/store/iRenderer.js +15 -3
  66. package/esm/store/index.js +1 -1
  67. package/esm/store/list.d.ts +4 -2
  68. package/esm/store/list.js +5 -5
  69. package/esm/store/manager.js +1 -1
  70. package/esm/store/modal.d.ts +4 -2
  71. package/esm/store/modal.js +1 -1
  72. package/esm/store/node.js +1 -1
  73. package/esm/store/pagination.d.ts +4 -2
  74. package/esm/store/pagination.js +2 -2
  75. package/esm/store/root.d.ts +4 -2
  76. package/esm/store/root.js +1 -1
  77. package/esm/store/service.d.ts +4 -2
  78. package/esm/store/service.js +1 -1
  79. package/esm/store/table.d.ts +36 -29
  80. package/esm/store/table.js +28 -5
  81. package/esm/store/table2.d.ts +9 -7
  82. package/esm/store/table2.js +23 -19
  83. package/esm/theme.d.ts +2 -4
  84. package/esm/theme.js +1 -1
  85. package/esm/types.d.ts +45 -2
  86. package/esm/utils/Animation.js +1 -1
  87. package/esm/utils/ColorScale.js +1 -1
  88. package/esm/utils/DataSchema.js +1 -1
  89. package/esm/utils/DataScope.js +1 -1
  90. package/esm/utils/RootClose.js +1 -1
  91. package/esm/utils/SimpleMap.js +1 -1
  92. package/esm/utils/api.js +11 -5
  93. package/esm/utils/attachmentAdpator.js +1 -1
  94. package/esm/utils/autobind.js +1 -1
  95. package/esm/utils/columnsSplit.js +1 -1
  96. package/esm/utils/dataMapping.js +1 -1
  97. package/esm/utils/date.js +1 -1
  98. package/esm/utils/debug.d.ts +1 -0
  99. package/esm/utils/debug.js +4 -4
  100. package/esm/utils/decodeEntity.js +1 -1
  101. package/esm/utils/dom.d.ts +2 -0
  102. package/esm/utils/dom.js +47 -10
  103. package/esm/utils/errors.js +1 -1
  104. package/esm/utils/escapeHtml.js +1 -1
  105. package/esm/utils/filter-schema.js +1 -1
  106. package/esm/utils/filter.js +1 -1
  107. package/esm/utils/formatDuration.js +1 -1
  108. package/esm/utils/formula.d.ts +1 -0
  109. package/esm/utils/formula.js +7 -3
  110. package/esm/utils/getVariable.js +1 -1
  111. package/esm/utils/grammar.js +1 -1
  112. package/esm/utils/handleAction.js +1 -1
  113. package/esm/utils/helper.d.ts +7 -0
  114. package/esm/utils/helper.js +28 -3
  115. package/esm/utils/highlight.js +1 -1
  116. package/esm/utils/icon.d.ts +6 -1
  117. package/esm/utils/icon.js +6 -1
  118. package/esm/utils/image.js +1 -1
  119. package/esm/utils/index.d.ts +2 -0
  120. package/esm/utils/isPureVariable.js +1 -1
  121. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  122. package/esm/utils/keyToPath.js +1 -1
  123. package/esm/utils/makeSorter.js +1 -1
  124. package/esm/utils/normalizeLink.js +1 -1
  125. package/esm/utils/normalizeOptions.js +1 -1
  126. package/esm/utils/object.js +1 -1
  127. package/esm/utils/offset.js +1 -1
  128. package/esm/utils/offsetParent.js +1 -1
  129. package/esm/utils/optionValueCompare.js +7 -3
  130. package/esm/utils/position.js +1 -1
  131. package/esm/utils/prettyBytes.js +1 -1
  132. package/esm/utils/renderer-event.js +35 -32
  133. package/esm/utils/replaceText.js +1 -1
  134. package/esm/utils/resize-sensor.js +1 -1
  135. package/esm/utils/resolveCondition.d.ts +6 -0
  136. package/esm/utils/resolveCondition.js +321 -0
  137. package/esm/utils/resolveVariable.js +1 -1
  138. package/esm/utils/resolveVariableAndFilter.js +1 -1
  139. package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
  140. package/esm/utils/resolveVariableAndFilterForAsync.js +63 -0
  141. package/esm/utils/scrollPosition.js +1 -1
  142. package/esm/utils/string2regExp.js +1 -1
  143. package/esm/utils/stripNumber.js +1 -1
  144. package/esm/utils/style-helper.d.ts +9 -4
  145. package/esm/utils/style-helper.js +81 -16
  146. package/esm/utils/style.js +2 -2
  147. package/esm/utils/toNumber.js +1 -1
  148. package/esm/utils/tokenize.d.ts +1 -0
  149. package/esm/utils/tokenize.js +34 -3
  150. package/esm/utils/tpl-builtin.d.ts +2 -1
  151. package/esm/utils/tpl-builtin.js +18 -3
  152. package/esm/utils/tpl-lodash.js +3 -2
  153. package/esm/utils/tpl.d.ts +9 -0
  154. package/esm/utils/tpl.js +45 -3
  155. package/esm/utils/uncontrollable.js +1 -1
  156. package/esm/utils/validations.d.ts +4 -1
  157. package/esm/utils/validations.js +27 -12
  158. package/lib/Root.d.ts +1 -1
  159. package/lib/Root.js +1 -1
  160. package/lib/RootRenderer.d.ts +1 -1
  161. package/lib/RootRenderer.js +21 -4
  162. package/lib/SchemaRenderer.d.ts +3 -1
  163. package/lib/SchemaRenderer.js +7 -4
  164. package/lib/Scoped.js +30 -2
  165. package/lib/WithRootStore.d.ts +4 -8
  166. package/lib/WithRootStore.js +1 -1
  167. package/lib/WithStore.js +1 -1
  168. package/lib/actions/Action.d.ts +2 -1
  169. package/lib/actions/Action.js +39 -11
  170. package/lib/actions/AjaxAction.js +1 -1
  171. package/lib/actions/BreakAction.js +1 -1
  172. package/lib/actions/BroadcastAction.js +1 -1
  173. package/lib/actions/CmptAction.js +1 -1
  174. package/lib/actions/ContinueAction.js +1 -1
  175. package/lib/actions/CopyAction.js +1 -1
  176. package/lib/actions/CustomAction.js +2 -1
  177. package/lib/actions/DialogAction.d.ts +1 -1
  178. package/lib/actions/DialogAction.js +12 -3
  179. package/lib/actions/DrawerAction.js +1 -1
  180. package/lib/actions/EmailAction.js +1 -1
  181. package/lib/actions/LinkAction.js +1 -1
  182. package/lib/actions/LoopAction.js +1 -1
  183. package/lib/actions/PageAction.js +1 -1
  184. package/lib/actions/ParallelAction.js +1 -1
  185. package/lib/actions/SwitchAction.js +17 -14
  186. package/lib/actions/ToastAction.js +1 -1
  187. package/lib/components/LazyComponent.d.ts +3 -3
  188. package/lib/components/LazyComponent.js +1 -1
  189. package/lib/components/Overlay.d.ts +2 -2
  190. package/lib/components/Overlay.js +2 -1
  191. package/lib/components/PopOver.d.ts +2 -4
  192. package/lib/components/PopOver.js +2 -1
  193. package/lib/env.d.ts +3 -7
  194. package/lib/env.js +1 -1
  195. package/lib/envOverwrite.js +1 -1
  196. package/lib/factory.d.ts +2 -1
  197. package/lib/factory.js +5 -3
  198. package/lib/index.d.ts +9 -5
  199. package/lib/index.js +30 -2
  200. package/lib/locale.d.ts +1 -3
  201. package/lib/locale.js +1 -1
  202. package/lib/renderers/Form.d.ts +1 -1
  203. package/lib/renderers/Form.js +16 -14
  204. package/lib/renderers/Item.d.ts +9 -15
  205. package/lib/renderers/Item.js +11 -7
  206. package/lib/renderers/Options.js +4 -3
  207. package/lib/renderers/Placeholder.js +1 -1
  208. package/lib/renderers/builtin.js +1 -1
  209. package/lib/renderers/register.js +1 -1
  210. package/lib/renderers/wrapControl.d.ts +4 -8
  211. package/lib/renderers/wrapControl.js +20 -28
  212. package/lib/store/app.d.ts +4 -2
  213. package/lib/store/app.js +1 -1
  214. package/lib/store/combo.d.ts +12 -6
  215. package/lib/store/combo.js +1 -1
  216. package/lib/store/crud.d.ts +5 -2
  217. package/lib/store/crud.js +45 -11
  218. package/lib/store/form.d.ts +4 -2
  219. package/lib/store/form.js +1 -1
  220. package/lib/store/formItem.js +6 -5
  221. package/lib/store/iRenderer.d.ts +5 -2
  222. package/lib/store/iRenderer.js +15 -3
  223. package/lib/store/index.js +1 -1
  224. package/lib/store/list.d.ts +4 -2
  225. package/lib/store/list.js +5 -5
  226. package/lib/store/manager.js +1 -1
  227. package/lib/store/modal.d.ts +4 -2
  228. package/lib/store/modal.js +1 -1
  229. package/lib/store/node.js +1 -1
  230. package/lib/store/pagination.d.ts +4 -2
  231. package/lib/store/pagination.js +2 -2
  232. package/lib/store/root.d.ts +4 -2
  233. package/lib/store/root.js +1 -1
  234. package/lib/store/service.d.ts +4 -2
  235. package/lib/store/service.js +1 -1
  236. package/lib/store/table.d.ts +36 -29
  237. package/lib/store/table.js +28 -5
  238. package/lib/store/table2.d.ts +9 -7
  239. package/lib/store/table2.js +23 -19
  240. package/lib/theme.d.ts +2 -4
  241. package/lib/theme.js +1 -1
  242. package/lib/types.d.ts +45 -2
  243. package/lib/utils/Animation.js +1 -1
  244. package/lib/utils/ColorScale.js +1 -1
  245. package/lib/utils/DataSchema.js +1 -1
  246. package/lib/utils/DataScope.js +1 -1
  247. package/lib/utils/RootClose.js +1 -1
  248. package/lib/utils/SimpleMap.js +1 -1
  249. package/lib/utils/api.js +10 -4
  250. package/lib/utils/attachmentAdpator.js +1 -1
  251. package/lib/utils/autobind.js +1 -1
  252. package/lib/utils/columnsSplit.js +1 -1
  253. package/lib/utils/dataMapping.js +1 -1
  254. package/lib/utils/date.js +1 -1
  255. package/lib/utils/debug.d.ts +1 -0
  256. package/lib/utils/debug.js +4 -4
  257. package/lib/utils/decodeEntity.js +1 -1
  258. package/lib/utils/dom.d.ts +2 -0
  259. package/lib/utils/dom.js +48 -9
  260. package/lib/utils/errors.js +1 -1
  261. package/lib/utils/escapeHtml.js +1 -1
  262. package/lib/utils/filter-schema.js +1 -1
  263. package/lib/utils/filter.js +1 -1
  264. package/lib/utils/formatDuration.js +1 -1
  265. package/lib/utils/formula.d.ts +1 -0
  266. package/lib/utils/formula.js +7 -2
  267. package/lib/utils/getVariable.js +1 -1
  268. package/lib/utils/grammar.js +1 -1
  269. package/lib/utils/handleAction.js +1 -1
  270. package/lib/utils/helper.d.ts +7 -0
  271. package/lib/utils/helper.js +29 -2
  272. package/lib/utils/highlight.js +1 -1
  273. package/lib/utils/icon.d.ts +6 -1
  274. package/lib/utils/icon.js +6 -1
  275. package/lib/utils/image.js +1 -1
  276. package/lib/utils/index.d.ts +2 -0
  277. package/lib/utils/isPureVariable.js +1 -1
  278. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  279. package/lib/utils/keyToPath.js +1 -1
  280. package/lib/utils/makeSorter.js +1 -1
  281. package/lib/utils/normalizeLink.js +1 -1
  282. package/lib/utils/normalizeOptions.js +1 -1
  283. package/lib/utils/object.js +1 -1
  284. package/lib/utils/offset.js +1 -1
  285. package/lib/utils/offsetParent.js +1 -1
  286. package/lib/utils/optionValueCompare.js +7 -3
  287. package/lib/utils/position.js +1 -1
  288. package/lib/utils/prettyBytes.js +1 -1
  289. package/lib/utils/renderer-event.js +35 -32
  290. package/lib/utils/replaceText.js +1 -1
  291. package/lib/utils/resize-sensor.js +1 -1
  292. package/lib/utils/resolveCondition.d.ts +6 -0
  293. package/lib/utils/resolveCondition.js +338 -0
  294. package/lib/utils/resolveVariable.js +1 -1
  295. package/lib/utils/resolveVariableAndFilter.js +1 -1
  296. package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
  297. package/lib/utils/resolveVariableAndFilterForAsync.js +68 -0
  298. package/lib/utils/scrollPosition.js +1 -1
  299. package/lib/utils/string2regExp.js +1 -1
  300. package/lib/utils/stripNumber.js +1 -1
  301. package/lib/utils/style-helper.d.ts +9 -4
  302. package/lib/utils/style-helper.js +86 -15
  303. package/lib/utils/style.js +2 -2
  304. package/lib/utils/toNumber.js +1 -1
  305. package/lib/utils/tokenize.d.ts +1 -0
  306. package/lib/utils/tokenize.js +33 -1
  307. package/lib/utils/tpl-builtin.d.ts +2 -1
  308. package/lib/utils/tpl-builtin.js +17 -2
  309. package/lib/utils/tpl-lodash.js +3 -2
  310. package/lib/utils/tpl.d.ts +9 -0
  311. package/lib/utils/tpl.js +45 -1
  312. package/lib/utils/uncontrollable.js +1 -1
  313. package/lib/utils/validations.d.ts +4 -1
  314. package/lib/utils/validations.js +27 -12
  315. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.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.8.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.8.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.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/lib/utils/date.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -5,6 +5,7 @@ import React, { Component } from 'react';
5
5
  export declare function enableDebug(): void;
6
6
  interface DebugWrapperProps {
7
7
  renderer: any;
8
+ children?: React.ReactNode;
8
9
  }
9
10
  export declare class DebugWrapper extends Component<DebugWrapperProps> {
10
11
  debugId: string;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -361,12 +361,12 @@ var DebugWrapper = /** @class */ (function (_super) {
361
361
  * @param ext 扩展信息
362
362
  */
363
363
  function debug(cat, msg, ext) {
364
- console.groupCollapsed('[amis debug]', msg);
365
- console.debug(ext);
366
- console.groupEnd();
367
364
  if (!isEnabled) {
368
365
  return;
369
366
  }
367
+ console.groupCollapsed('[amis debug]', msg);
368
+ console.debug(ext);
369
+ console.groupEnd();
370
370
  var log = {
371
371
  cat: cat,
372
372
  level: 'debug',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -11,3 +11,5 @@ export declare function calculatePosition(placement: any, overlayNode: any, targ
11
11
  * 专门用来获取样式的像素值,默认返回 0
12
12
  */
13
13
  export declare function getStyleNumber(element: HTMLElement, styleName: string): number;
14
+ /** 根据关键字高亮显示文本内容 */
15
+ export declare function renderTextByKeyword(rendererText: string, curKeyword: string): string | JSX.Element;
package/lib/utils/dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -9,12 +9,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  var tslib = require('tslib');
11
11
  var ReactDOM = require('react-dom');
12
+ var React = require('react');
12
13
  var offset = require('./offset.js');
13
14
  var position = require('./position.js');
14
15
 
15
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
17
 
17
18
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
19
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
18
20
 
19
21
  function getContainer(container, defaultContainer) {
20
22
  container = typeof container === 'function' ? container() : container;
@@ -86,16 +88,27 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
86
88
  ? clip2.height / overlayNode.offsetHeight
87
89
  : 1;
88
90
  // auto 尝试四个方向对齐。
89
- placement =
90
- placement === 'auto'
91
- ? 'left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom left-bottom-left-top'
92
- : placement;
91
+ var isAuto = placement === 'auto';
92
+ // 兜底方向
93
+ var autoDefaultPlacement = 'left-bottom-left-top';
94
+ placement = isAuto
95
+ ? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
96
+ : placement;
93
97
  var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
94
98
  if (~placement.indexOf('-')) {
95
99
  var tests = placement.split(/\s+/);
100
+ // 收集可见方向
101
+ var visiblePlacement = {};
96
102
  while (tests.length) {
97
103
  var current = (activePlacement = tests.shift());
98
- var _b = tslib.__read(current.split('-'), 4), atX = _b[0], atY = _b[1], myX = _b[2], myY = _b[3];
104
+ // 自动对齐模式下,当四个方向都无法完全可见时
105
+ // 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
106
+ if (isAuto && tests.length === 0) {
107
+ var _b = tslib.__read(autoDefaultPlacement.split('-'), 4), _atX = _b[0], _atY = _b[1], _myX = _b[2], _myY = _b[3];
108
+ var _c = visiblePlacement.atX, atX_1 = _c === void 0 ? _atX : _c, _d = visiblePlacement.atY, atY_1 = _d === void 0 ? _atY : _d, _e = visiblePlacement.myX, myX_1 = _e === void 0 ? _myX : _e, _f = visiblePlacement.myY, myY_1 = _f === void 0 ? _myY : _f;
109
+ current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
110
+ }
111
+ var _g = tslib.__read(current.split('-'), 4), atX = _g[0], atY = _g[1], myX = _g[2], myY = _g[3];
99
112
  myX = myX || atX;
100
113
  myY = myY || atY;
101
114
  positionLeft =
@@ -126,10 +139,21 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
126
139
  width: overlayWidth,
127
140
  height: overlayHeight
128
141
  };
142
+ var visibleX = false;
143
+ var visibleY = false;
129
144
  if (transformed.x > 0 &&
130
- transformed.x + transformed.width < window.innerWidth &&
131
- transformed.y > 0 &&
145
+ transformed.x + transformed.width < window.innerWidth) {
146
+ visibleX = true;
147
+ !visiblePlacement.atX && (visiblePlacement.atX = atX);
148
+ !visiblePlacement.myX && (visiblePlacement.myX = myX);
149
+ }
150
+ if (transformed.y > 0 &&
132
151
  transformed.y + transformed.height < window.innerHeight) {
152
+ visibleY = true;
153
+ !visiblePlacement.atY && (visiblePlacement.atY = atY);
154
+ !visiblePlacement.myY && (visiblePlacement.myY = myY);
155
+ }
156
+ if (visibleX && visibleY) {
133
157
  break;
134
158
  }
135
159
  }
@@ -175,7 +199,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
175
199
  else {
176
200
  throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
177
201
  }
178
- var _c = tslib.__read(customOffset, 2), _d = _c[0], offSetX = _d === void 0 ? 0 : _d, _e = _c[1], offSetY = _e === void 0 ? 0 : _e;
202
+ var _h = tslib.__read(customOffset, 2), _j = _h[0], offSetX = _j === void 0 ? 0 : _j, _k = _h[1], offSetY = _k === void 0 ? 0 : _k;
179
203
  return {
180
204
  positionLeft: (positionLeft + offSetX) / scaleX,
181
205
  positionTop: (positionTop + offSetY) / scaleY,
@@ -193,8 +217,23 @@ function getStyleNumber(element, styleName) {
193
217
  }
194
218
  return (parseInt(getComputedStyle(element).getPropertyValue(styleName), 10) || 0);
195
219
  }
220
+ /** 根据关键字高亮显示文本内容 */
221
+ function renderTextByKeyword(rendererText, curKeyword) {
222
+ if (curKeyword && ~rendererText.indexOf(curKeyword)) {
223
+ var keywordStartIndex = rendererText.indexOf(curKeyword);
224
+ var keywordEndIndex = keywordStartIndex + curKeyword.length;
225
+ return (React__default["default"].createElement("span", null,
226
+ rendererText.substring(0, keywordStartIndex),
227
+ React__default["default"].createElement("span", { className: "is-keyword" }, curKeyword),
228
+ rendererText.substring(keywordEndIndex)));
229
+ }
230
+ else {
231
+ return rendererText;
232
+ }
233
+ }
196
234
 
197
235
  exports.calculatePosition = calculatePosition;
198
236
  exports.getContainer = getContainer;
199
237
  exports.getStyleNumber = getStyleNumber;
200
238
  exports.ownerDocument = ownerDocument;
239
+ exports.renderTextByKeyword = renderTextByKeyword;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.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.8.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.8.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.8.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.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -13,4 +13,5 @@ export declare function isNeedFormula(expression: any, prevData: {
13
13
  }, curData: {
14
14
  [propName: string]: any;
15
15
  }): boolean;
16
+ export declare function isNowFormula(expression: string): boolean;
16
17
  export declare function replaceExpression(expression: any): any;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -12,8 +12,8 @@ var isString = require('lodash/isString');
12
12
  var isBoolean = require('lodash/isBoolean');
13
13
  var amisFormula = require('amis-formula');
14
14
  var tpl = require('./tpl.js');
15
- require('moment');
16
15
  require('tslib');
16
+ require('moment');
17
17
  require('lodash/isPlainObject');
18
18
  var getVariable = require('./getVariable.js');
19
19
  var resolveVariableAndFilter = require('./resolveVariableAndFilter.js');
@@ -216,6 +216,10 @@ function isNeedFormula(expression, prevData, curData) {
216
216
  return false;
217
217
  }
218
218
  }
219
+ function isNowFormula(expression) {
220
+ var block = expression.split(/\${|\||}/).filter(function (item) { return item; });
221
+ return block[1] === 'now';
222
+ }
219
223
  // 将 \${xx} 替换成 ${xx}
220
224
  function replaceExpression(expression) {
221
225
  if (expression &&
@@ -230,5 +234,6 @@ exports.FormulaExec = FormulaExec;
230
234
  exports.formulaExec = formulaExec;
231
235
  exports.isExpression = isExpression;
232
236
  exports.isNeedFormula = isNeedFormula;
237
+ exports.isNowFormula = isNowFormula;
233
238
  exports.registerFormulaExec = registerFormulaExec;
234
239
  exports.replaceExpression = replaceExpression;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.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.8.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.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -144,6 +144,12 @@ export declare function eachTree<T extends TreeItem>(tree: Array<T>, iterator: (
144
144
  * @param iterator
145
145
  */
146
146
  export declare function findTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => any): T | null;
147
+ /**
148
+ * 在树中查找节点。
149
+ * @param tree
150
+ * @param iterator
151
+ */
152
+ export declare function findTreeAll<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => any): Array<T>;
147
153
  /**
148
154
  * 在树中查找节点, 返回下标数组。
149
155
  * @param tree
@@ -259,6 +265,7 @@ export declare function chainFunctions(...fns: Array<(...args: Array<any>) => vo
259
265
  export declare function chainEvents(props: any, schema: any): any;
260
266
  export declare function mapObject(value: any, fn: Function, skipFn?: (value: any) => boolean): any;
261
267
  export declare function loadScript(src: string): Promise<void>;
268
+ export declare function loadStyle(href: string): Promise<void>;
262
269
  export declare class SkipOperation extends Error {
263
270
  }
264
271
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -609,6 +609,21 @@ function findTree(tree, iterator) {
609
609
  });
610
610
  return result;
611
611
  }
612
+ /**
613
+ * 在树中查找节点。
614
+ * @param tree
615
+ * @param iterator
616
+ */
617
+ function findTreeAll(tree, iterator) {
618
+ var result = [];
619
+ everyTree(tree, function (item, key, level, paths) {
620
+ if (iterator(item, key, level, paths)) {
621
+ result.push(item);
622
+ }
623
+ return true;
624
+ });
625
+ return result;
626
+ }
612
627
  /**
613
628
  * 在树中查找节点, 返回下标数组。
614
629
  * @param tree
@@ -1015,6 +1030,16 @@ function loadScript(src) {
1015
1030
  document.head.appendChild(script);
1016
1031
  });
1017
1032
  }
1033
+ function loadStyle(href) {
1034
+ return new Promise(function (ok, fail) {
1035
+ var link = document.createElement('link');
1036
+ link.rel = 'stylesheet';
1037
+ link.onerror = function (reason) { return fail(reason); };
1038
+ link.onload = function () { return ok(); };
1039
+ link.href = href;
1040
+ document.head.appendChild(link);
1041
+ });
1042
+ }
1018
1043
  var SkipOperation = /** @class */ (function (_super) {
1019
1044
  tslib.__extends(SkipOperation, _super);
1020
1045
  function SkipOperation() {
@@ -1189,7 +1214,7 @@ function isClickOnInput(e) {
1189
1214
  var formItem;
1190
1215
  if (!e.currentTarget.contains(target) ||
1191
1216
  ~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
1192
- ((formItem = target.closest("button, a, [data-role=\"form-item\"]")) &&
1217
+ ((formItem = target.closest("button, a, [data-role=\"form-item\"], label[data-role=\"checkbox\"]")) &&
1193
1218
  e.currentTarget.contains(formItem))) {
1194
1219
  return true;
1195
1220
  }
@@ -1297,6 +1322,7 @@ exports.filterTree = filterTree;
1297
1322
  exports.findIndex = findIndex;
1298
1323
  exports.findObjectsWithKey = findObjectsWithKey;
1299
1324
  exports.findTree = findTree;
1325
+ exports.findTreeAll = findTreeAll;
1300
1326
  exports.findTreeIndex = findTreeIndex;
1301
1327
  exports.flattenTree = flattenTree;
1302
1328
  exports.flattenTreeWithLeafNodes = flattenTreeWithLeafNodes;
@@ -1331,6 +1357,7 @@ exports.isUnfolded = isUnfolded;
1331
1357
  exports.isVisible = isVisible;
1332
1358
  exports.lcFirst = lcFirst;
1333
1359
  exports.loadScript = loadScript;
1360
+ exports.loadStyle = loadStyle;
1334
1361
  exports.makeColumnClassBuild = makeColumnClassBuild;
1335
1362
  exports.makeHorizontalDeeper = makeHorizontalDeeper;
1336
1363
  exports.mapObject = mapObject;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -6,6 +6,11 @@ import { ClassNamesFn } from '../theme';
6
6
  export interface IconCheckedSchema {
7
7
  id: string;
8
8
  name?: string;
9
+ svg?: string;
10
+ }
11
+ export interface IconCheckedSchemaNew {
12
+ type: 'icon';
13
+ icon: IconCheckedSchema;
9
14
  }
10
15
  /**
11
16
  * 判断字符串来生成 i 或 img
@@ -13,4 +18,4 @@ export interface IconCheckedSchema {
13
18
  * @param className 内部用的 className
14
19
  * @param classNameProp amis 配置里设置的 className
15
20
  */
16
- export declare const generateIcon: (cx: ClassNamesFn, icon?: string | IconCheckedSchema | React.ReactNode, className?: string, classNameProp?: string) => JSX.Element | null | undefined;
21
+ export declare const generateIcon: (cx: ClassNamesFn, icon?: string | IconCheckedSchema | React.ReactNode | IconCheckedSchemaNew, className?: string, classNameProp?: string) => JSX.Element | null | undefined;
package/lib/utils/icon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -24,6 +24,11 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
24
  * @param classNameProp amis 配置里设置的 className
25
25
  */
26
26
  var generateIcon = function (cx, icon, className, classNameProp) {
27
+ if (lodash.isObject(icon) &&
28
+ icon.type === 'icon' &&
29
+ icon.icon) {
30
+ icon = icon.icon;
31
+ }
27
32
  if (React__default["default"].isValidElement(icon)) {
28
33
  return icon;
29
34
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -39,6 +39,7 @@ export * from './replaceText';
39
39
  export * from './resize-sensor';
40
40
  export * from './resolveVariable';
41
41
  export * from './resolveVariableAndFilter';
42
+ export * from './resolveVariableAndFilterForAsync';
42
43
  export * from './RootClose';
43
44
  export * from './scrollPosition';
44
45
  export * from './SimpleMap';
@@ -52,5 +53,6 @@ export * from './validations';
52
53
  export * from './toNumber';
53
54
  export * from './decodeEntity';
54
55
  export * from './style-helper';
56
+ export * from './resolveCondition';
55
57
  import animation from './Animation';
56
58
  export { animation };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.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.8.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.8.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.8.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.8.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.8.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.8.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.8.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.8.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.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -17,9 +17,13 @@ function matchOptionValue(a, b, valueField) {
17
17
  var aValue = object.isObject(a) && a && a.hasOwnProperty(valueField)
18
18
  ? a[valueField]
19
19
  : a;
20
+ var bValue = b[valueField || 'value'];
20
21
  return object.isObject(aValue)
21
- ? lodash.isEqual(aValue, b[valueField || 'value'])
22
- : String(b[valueField || 'value']) === String(aValue);
22
+ ? lodash.isEqual(aValue, bValue)
23
+ : // 当值均为 undefined 时,不应该判定相等
24
+ aValue !== undefined &&
25
+ bValue !== undefined &&
26
+ String(bValue) === String(aValue);
23
27
  }
24
28
  function optionValueCompare(a, valueField) {
25
29
  if (valueField === void 0) { valueField = 'value'; }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.8.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.8.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5