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
package/esm/utils/api.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
 
@@ -350,7 +350,10 @@ function wrapFetcher(fn, tracker) {
350
350
  api = api.requestAdaptor(api) || api;
351
351
  debug('api', 'after requestAdaptor', api);
352
352
  }
353
- if (api.data && (hasFile(api.data) || api.dataType === 'form-data')) {
353
+ if (api.data &&
354
+ (api.data instanceof FormData ||
355
+ hasFile(api.data) ||
356
+ api.dataType === 'form-data')) {
354
357
  api.data =
355
358
  api.data instanceof FormData
356
359
  ? api.data
@@ -522,6 +525,10 @@ function isApiOutdated(prevApi, nextApi, prevData, nextData) {
522
525
  if (!nextApi) {
523
526
  return false;
524
527
  }
528
+ // 通常是编辑器里加了属性,一开始没值,后来有了
529
+ if (prevApi === undefined && !nextApi !== undefined) {
530
+ return true;
531
+ }
525
532
  nextApi = normalizeApi(nextApi);
526
533
  if (nextApi.autoRefresh === false) {
527
534
  return false;
@@ -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
 
package/esm/utils/date.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
 
@@ -351,12 +351,12 @@ var DebugWrapper = /** @class */ (function (_super) {
351
351
  * @param ext 扩展信息
352
352
  */
353
353
  function debug(cat, msg, ext) {
354
- console.groupCollapsed('[amis debug]', msg);
355
- console.debug(ext);
356
- console.groupEnd();
357
354
  if (!isEnabled) {
358
355
  return;
359
356
  }
357
+ console.groupCollapsed('[amis debug]', msg);
358
+ console.debug(ext);
359
+ console.groupEnd();
360
360
  var log = {
361
361
  cat: cat,
362
362
  level: 'debug',
@@ -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
 
@@ -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/esm/utils/dom.js CHANGED
@@ -1,10 +1,11 @@
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
6
  import { __read } from 'tslib';
7
7
  import ReactDOM from 'react-dom';
8
+ import React from 'react';
8
9
  import { offset } from './offset.js';
9
10
  import { position } from './position.js';
10
11
 
@@ -78,16 +79,27 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
78
79
  ? clip2.height / overlayNode.offsetHeight
79
80
  : 1;
80
81
  // auto 尝试四个方向对齐。
81
- placement =
82
- placement === 'auto'
83
- ? 'left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom left-bottom-left-top'
84
- : placement;
82
+ var isAuto = placement === 'auto';
83
+ // 兜底方向
84
+ var autoDefaultPlacement = 'left-bottom-left-top';
85
+ placement = isAuto
86
+ ? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
87
+ : placement;
85
88
  var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
86
89
  if (~placement.indexOf('-')) {
87
90
  var tests = placement.split(/\s+/);
91
+ // 收集可见方向
92
+ var visiblePlacement = {};
88
93
  while (tests.length) {
89
94
  var current = (activePlacement = tests.shift());
90
- var _b = __read(current.split('-'), 4), atX = _b[0], atY = _b[1], myX = _b[2], myY = _b[3];
95
+ // 自动对齐模式下,当四个方向都无法完全可见时
96
+ // 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
97
+ if (isAuto && tests.length === 0) {
98
+ var _b = __read(autoDefaultPlacement.split('-'), 4), _atX = _b[0], _atY = _b[1], _myX = _b[2], _myY = _b[3];
99
+ 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;
100
+ current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
101
+ }
102
+ var _g = __read(current.split('-'), 4), atX = _g[0], atY = _g[1], myX = _g[2], myY = _g[3];
91
103
  myX = myX || atX;
92
104
  myY = myY || atY;
93
105
  positionLeft =
@@ -118,10 +130,21 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
118
130
  width: overlayWidth,
119
131
  height: overlayHeight
120
132
  };
133
+ var visibleX = false;
134
+ var visibleY = false;
121
135
  if (transformed.x > 0 &&
122
- transformed.x + transformed.width < window.innerWidth &&
123
- transformed.y > 0 &&
136
+ transformed.x + transformed.width < window.innerWidth) {
137
+ visibleX = true;
138
+ !visiblePlacement.atX && (visiblePlacement.atX = atX);
139
+ !visiblePlacement.myX && (visiblePlacement.myX = myX);
140
+ }
141
+ if (transformed.y > 0 &&
124
142
  transformed.y + transformed.height < window.innerHeight) {
143
+ visibleY = true;
144
+ !visiblePlacement.atY && (visiblePlacement.atY = atY);
145
+ !visiblePlacement.myY && (visiblePlacement.myY = myY);
146
+ }
147
+ if (visibleX && visibleY) {
125
148
  break;
126
149
  }
127
150
  }
@@ -167,7 +190,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
167
190
  else {
168
191
  throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
169
192
  }
170
- var _c = __read(customOffset, 2), _d = _c[0], offSetX = _d === void 0 ? 0 : _d, _e = _c[1], offSetY = _e === void 0 ? 0 : _e;
193
+ var _h = __read(customOffset, 2), _j = _h[0], offSetX = _j === void 0 ? 0 : _j, _k = _h[1], offSetY = _k === void 0 ? 0 : _k;
171
194
  return {
172
195
  positionLeft: (positionLeft + offSetX) / scaleX,
173
196
  positionTop: (positionTop + offSetY) / scaleY,
@@ -185,5 +208,19 @@ function getStyleNumber(element, styleName) {
185
208
  }
186
209
  return (parseInt(getComputedStyle(element).getPropertyValue(styleName), 10) || 0);
187
210
  }
211
+ /** 根据关键字高亮显示文本内容 */
212
+ function renderTextByKeyword(rendererText, curKeyword) {
213
+ if (curKeyword && ~rendererText.indexOf(curKeyword)) {
214
+ var keywordStartIndex = rendererText.indexOf(curKeyword);
215
+ var keywordEndIndex = keywordStartIndex + curKeyword.length;
216
+ return (React.createElement("span", null,
217
+ rendererText.substring(0, keywordStartIndex),
218
+ React.createElement("span", { className: "is-keyword" }, curKeyword),
219
+ rendererText.substring(keywordEndIndex)));
220
+ }
221
+ else {
222
+ return rendererText;
223
+ }
224
+ }
188
225
 
189
- export { calculatePosition, getContainer, getStyleNumber, ownerDocument };
226
+ export { calculatePosition, getContainer, getStyleNumber, ownerDocument, renderTextByKeyword };
@@ -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
 
@@ -8,8 +8,8 @@ import isString from 'lodash/isString';
8
8
  import isBoolean from 'lodash/isBoolean';
9
9
  import { evaluate, getFilters } from 'amis-formula';
10
10
  import { filter } from './tpl.js';
11
- import 'moment';
12
11
  import 'tslib';
12
+ import 'moment';
13
13
  import 'lodash/isPlainObject';
14
14
  import { getVariable } from './getVariable.js';
15
15
  import { resolveVariableAndFilter } from './resolveVariableAndFilter.js';
@@ -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
 
@@ -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.9.0
2
+ * amis-core v3.0.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -597,6 +597,21 @@ function findTree(tree, iterator) {
597
597
  });
598
598
  return result;
599
599
  }
600
+ /**
601
+ * 在树中查找节点。
602
+ * @param tree
603
+ * @param iterator
604
+ */
605
+ function findTreeAll(tree, iterator) {
606
+ var result = [];
607
+ everyTree(tree, function (item, key, level, paths) {
608
+ if (iterator(item, key, level, paths)) {
609
+ result.push(item);
610
+ }
611
+ return true;
612
+ });
613
+ return result;
614
+ }
600
615
  /**
601
616
  * 在树中查找节点, 返回下标数组。
602
617
  * @param tree
@@ -1003,6 +1018,16 @@ function loadScript(src) {
1003
1018
  document.head.appendChild(script);
1004
1019
  });
1005
1020
  }
1021
+ function loadStyle(href) {
1022
+ return new Promise(function (ok, fail) {
1023
+ var link = document.createElement('link');
1024
+ link.rel = 'stylesheet';
1025
+ link.onerror = function (reason) { return fail(reason); };
1026
+ link.onload = function () { return ok(); };
1027
+ link.href = href;
1028
+ document.head.appendChild(link);
1029
+ });
1030
+ }
1006
1031
  var SkipOperation = /** @class */ (function (_super) {
1007
1032
  __extends(SkipOperation, _super);
1008
1033
  function SkipOperation() {
@@ -1177,7 +1202,7 @@ function isClickOnInput(e) {
1177
1202
  var formItem;
1178
1203
  if (!e.currentTarget.contains(target) ||
1179
1204
  ~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
1180
- ((formItem = target.closest("button, a, [data-role=\"form-item\"]")) &&
1205
+ ((formItem = target.closest("button, a, [data-role=\"form-item\"], label[data-role=\"checkbox\"]")) &&
1181
1206
  e.currentTarget.contains(formItem))) {
1182
1207
  return true;
1183
1208
  }
@@ -1258,4 +1283,4 @@ function parseQuery(location) {
1258
1283
  return merge(normalizedQuery, hashQuery);
1259
1284
  }
1260
1285
 
1261
- export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter };
1286
+ export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeAll, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, loadStyle, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter };
@@ -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
 
@@ -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/esm/utils/icon.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
 
@@ -16,6 +16,11 @@ import { isObject } from 'lodash';
16
16
  * @param classNameProp amis 配置里设置的 className
17
17
  */
18
18
  var generateIcon = function (cx, icon, className, classNameProp) {
19
+ if (isObject(icon) &&
20
+ icon.type === 'icon' &&
21
+ icon.icon) {
22
+ icon = icon.icon;
23
+ }
19
24
  if (React.isValidElement(icon)) {
20
25
  return icon;
21
26
  }
@@ -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
 
@@ -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