amis-core 3.0.0 → 3.1.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 (323) hide show
  1. package/esm/Root.d.ts +89 -4
  2. package/esm/Root.js +15 -4
  3. package/esm/RootRenderer.d.ts +3 -1
  4. package/esm/RootRenderer.js +9 -3
  5. package/esm/SchemaRenderer.d.ts +3 -2
  6. package/esm/SchemaRenderer.js +26 -20
  7. package/esm/Scoped.d.ts +8 -0
  8. package/esm/Scoped.js +20 -5
  9. package/esm/StatusScoped.d.ts +58 -0
  10. package/esm/StatusScoped.js +54 -0
  11. package/esm/WithRootStore.d.ts +2 -2
  12. package/esm/WithRootStore.js +1 -1
  13. package/esm/WithStore.js +6 -2
  14. package/esm/actions/Action.d.ts +1 -0
  15. package/esm/actions/Action.js +12 -4
  16. package/esm/actions/AjaxAction.js +1 -1
  17. package/esm/actions/BreakAction.js +1 -1
  18. package/esm/actions/BroadcastAction.js +1 -1
  19. package/esm/actions/CmptAction.js +8 -7
  20. package/esm/actions/ContinueAction.js +1 -1
  21. package/esm/actions/CopyAction.js +1 -1
  22. package/esm/actions/CustomAction.js +4 -4
  23. package/esm/actions/DialogAction.d.ts +16 -2
  24. package/esm/actions/DialogAction.js +19 -7
  25. package/esm/actions/DrawerAction.js +1 -1
  26. package/esm/actions/EmailAction.js +1 -1
  27. package/esm/actions/LinkAction.js +1 -1
  28. package/esm/actions/LoopAction.js +1 -1
  29. package/esm/actions/PageAction.js +1 -1
  30. package/esm/actions/ParallelAction.js +1 -1
  31. package/esm/actions/SwitchAction.js +1 -1
  32. package/esm/actions/ToastAction.js +1 -1
  33. package/esm/components/CustomStyle.d.ts +13 -0
  34. package/esm/components/CustomStyle.js +18 -0
  35. package/esm/components/LazyComponent.d.ts +1 -1
  36. package/esm/components/LazyComponent.js +1 -1
  37. package/esm/components/Overlay.d.ts +1 -1
  38. package/esm/components/Overlay.js +1 -1
  39. package/esm/components/PopOver.d.ts +2 -2
  40. package/esm/components/PopOver.js +1 -1
  41. package/esm/env.d.ts +10 -2
  42. package/esm/env.js +1 -1
  43. package/esm/envOverwrite.js +1 -5
  44. package/esm/factory.d.ts +3 -2
  45. package/esm/factory.js +1 -1
  46. package/esm/index.d.ts +4 -2
  47. package/esm/index.js +49 -28
  48. package/esm/locale.d.ts +2 -2
  49. package/esm/locale.js +10 -3
  50. package/esm/renderers/Form.d.ts +2 -1
  51. package/esm/renderers/Form.js +216 -180
  52. package/esm/renderers/Item.d.ts +55 -41
  53. package/esm/renderers/Item.js +24 -16
  54. package/esm/renderers/Options.js +9 -2
  55. package/esm/renderers/Placeholder.js +1 -1
  56. package/esm/renderers/builtin.js +1 -1
  57. package/esm/renderers/register.js +1 -1
  58. package/esm/renderers/wrapControl.d.ts +2 -2
  59. package/esm/renderers/wrapControl.js +13 -16
  60. package/esm/store/app.d.ts +1 -0
  61. package/esm/store/app.js +1 -1
  62. package/esm/store/combo.d.ts +3 -0
  63. package/esm/store/combo.js +1 -1
  64. package/esm/store/crud.d.ts +2 -0
  65. package/esm/store/crud.js +12 -4
  66. package/esm/store/form.d.ts +1 -0
  67. package/esm/store/form.js +10 -4
  68. package/esm/store/formItem.js +1 -1
  69. package/esm/store/iRenderer.d.ts +1 -0
  70. package/esm/store/iRenderer.js +54 -13
  71. package/esm/store/index.js +1 -1
  72. package/esm/store/list.d.ts +1 -0
  73. package/esm/store/list.js +7 -3
  74. package/esm/store/manager.js +1 -1
  75. package/esm/store/modal.d.ts +1 -0
  76. package/esm/store/modal.js +1 -1
  77. package/esm/store/node.js +1 -1
  78. package/esm/store/pagination.d.ts +1 -0
  79. package/esm/store/pagination.js +1 -1
  80. package/esm/store/root.d.ts +4 -6
  81. package/esm/store/root.js +53 -24
  82. package/esm/store/service.d.ts +1 -0
  83. package/esm/store/service.js +1 -1
  84. package/esm/store/status.d.ts +12 -0
  85. package/esm/store/status.js +38 -0
  86. package/esm/store/table.d.ts +4 -0
  87. package/esm/store/table.js +10 -2
  88. package/esm/store/table2.d.ts +2 -1
  89. package/esm/store/table2.js +6 -6
  90. package/esm/theme.d.ts +1 -1
  91. package/esm/theme.js +1 -1
  92. package/esm/types.d.ts +1 -1
  93. package/esm/utils/Animation.js +1 -1
  94. package/esm/utils/ColorScale.js +1 -1
  95. package/esm/utils/DataSchema.js +1 -1
  96. package/esm/utils/DataScope.d.ts +3 -5
  97. package/esm/utils/DataScope.js +88 -31
  98. package/esm/utils/RootClose.js +1 -1
  99. package/esm/utils/SimpleMap.js +1 -1
  100. package/esm/utils/api.js +6 -4
  101. package/esm/utils/attachmentAdpator.js +2 -2
  102. package/esm/utils/autobind.js +1 -1
  103. package/esm/utils/columnsSplit.js +1 -1
  104. package/esm/utils/dataMapping.js +1 -1
  105. package/esm/utils/date.d.ts +7 -0
  106. package/esm/utils/date.js +34 -2
  107. package/esm/utils/debug.js +1 -1
  108. package/esm/utils/decodeEntity.js +1 -1
  109. package/esm/utils/dom.d.ts +2 -1
  110. package/esm/utils/dom.js +1 -1
  111. package/esm/utils/errors.js +1 -1
  112. package/esm/utils/escapeHtml.js +1 -1
  113. package/esm/utils/filter-schema.js +1 -1
  114. package/esm/utils/filter.js +1 -1
  115. package/esm/utils/formatDuration.js +1 -1
  116. package/esm/utils/formula.js +1 -1
  117. package/esm/utils/getVariable.js +1 -1
  118. package/esm/utils/grammar.js +3 -3
  119. package/esm/utils/handleAction.js +1 -1
  120. package/esm/utils/helper.d.ts +2 -2
  121. package/esm/utils/helper.js +25 -18
  122. package/esm/utils/highlight.js +1 -1
  123. package/esm/utils/icon.d.ts +1 -1
  124. package/esm/utils/icon.js +1 -1
  125. package/esm/utils/image.js +1 -1
  126. package/esm/utils/isPureVariable.js +3 -3
  127. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  128. package/esm/utils/keyToPath.js +1 -1
  129. package/esm/utils/makeSorter.js +1 -1
  130. package/esm/utils/memoryParse.d.ts +17 -0
  131. package/esm/utils/memoryParse.js +26 -0
  132. package/esm/utils/normalizeLink.js +1 -1
  133. package/esm/utils/normalizeOptions.js +4 -2
  134. package/esm/utils/object.d.ts +2 -0
  135. package/esm/utils/object.js +27 -2
  136. package/esm/utils/offset.js +1 -1
  137. package/esm/utils/offsetParent.js +1 -1
  138. package/esm/utils/optionValueCompare.js +1 -1
  139. package/esm/utils/position.js +1 -1
  140. package/esm/utils/prettyBytes.js +1 -1
  141. package/esm/utils/renderer-event.js +1 -1
  142. package/esm/utils/replaceText.js +1 -1
  143. package/esm/utils/resize-sensor.js +1 -1
  144. package/esm/utils/resolveCondition.js +1 -1
  145. package/esm/utils/resolveVariable.js +4 -3
  146. package/esm/utils/resolveVariableAndFilter.js +1 -1
  147. package/esm/utils/resolveVariableAndFilterForAsync.js +5 -4
  148. package/esm/utils/scrollPosition.js +1 -1
  149. package/esm/utils/string2regExp.js +1 -1
  150. package/esm/utils/stripNumber.js +1 -1
  151. package/esm/utils/style-helper.d.ts +5 -2
  152. package/esm/utils/style-helper.js +18 -6
  153. package/esm/utils/style.js +1 -1
  154. package/esm/utils/toNumber.js +1 -1
  155. package/esm/utils/tokenize.d.ts +0 -1
  156. package/esm/utils/tokenize.js +3 -34
  157. package/esm/utils/tpl-builtin.js +5 -3
  158. package/esm/utils/tpl-lodash.js +1 -1
  159. package/esm/utils/tpl.js +1 -1
  160. package/esm/utils/uncontrollable.js +1 -1
  161. package/esm/utils/validations.js +1 -1
  162. package/lib/Root.d.ts +89 -4
  163. package/lib/Root.js +15 -4
  164. package/lib/RootRenderer.d.ts +3 -1
  165. package/lib/RootRenderer.js +8 -2
  166. package/lib/SchemaRenderer.d.ts +3 -2
  167. package/lib/SchemaRenderer.js +26 -20
  168. package/lib/Scoped.d.ts +8 -0
  169. package/lib/Scoped.js +20 -4
  170. package/lib/StatusScoped.d.ts +58 -0
  171. package/lib/StatusScoped.js +63 -0
  172. package/lib/WithRootStore.d.ts +2 -2
  173. package/lib/WithRootStore.js +1 -1
  174. package/lib/WithStore.js +6 -2
  175. package/lib/actions/Action.d.ts +1 -0
  176. package/lib/actions/Action.js +12 -4
  177. package/lib/actions/AjaxAction.js +1 -1
  178. package/lib/actions/BreakAction.js +1 -1
  179. package/lib/actions/BroadcastAction.js +1 -1
  180. package/lib/actions/CmptAction.js +8 -7
  181. package/lib/actions/ContinueAction.js +1 -1
  182. package/lib/actions/CopyAction.js +1 -1
  183. package/lib/actions/CustomAction.js +4 -4
  184. package/lib/actions/DialogAction.d.ts +16 -2
  185. package/lib/actions/DialogAction.js +19 -7
  186. package/lib/actions/DrawerAction.js +1 -1
  187. package/lib/actions/EmailAction.js +1 -1
  188. package/lib/actions/LinkAction.js +1 -1
  189. package/lib/actions/LoopAction.js +1 -1
  190. package/lib/actions/PageAction.js +1 -1
  191. package/lib/actions/ParallelAction.js +1 -1
  192. package/lib/actions/SwitchAction.js +1 -1
  193. package/lib/actions/ToastAction.js +1 -1
  194. package/lib/components/CustomStyle.d.ts +13 -0
  195. package/lib/components/CustomStyle.js +22 -0
  196. package/lib/components/LazyComponent.d.ts +1 -1
  197. package/lib/components/LazyComponent.js +1 -1
  198. package/lib/components/Overlay.d.ts +1 -1
  199. package/lib/components/Overlay.js +1 -1
  200. package/lib/components/PopOver.d.ts +2 -2
  201. package/lib/components/PopOver.js +1 -1
  202. package/lib/env.d.ts +10 -2
  203. package/lib/env.js +1 -1
  204. package/lib/envOverwrite.js +1 -5
  205. package/lib/factory.d.ts +3 -2
  206. package/lib/factory.js +1 -1
  207. package/lib/index.d.ts +4 -2
  208. package/lib/index.js +50 -24
  209. package/lib/locale.d.ts +2 -2
  210. package/lib/locale.js +10 -3
  211. package/lib/renderers/Form.d.ts +2 -1
  212. package/lib/renderers/Form.js +215 -179
  213. package/lib/renderers/Item.d.ts +55 -41
  214. package/lib/renderers/Item.js +24 -16
  215. package/lib/renderers/Options.js +9 -2
  216. package/lib/renderers/Placeholder.js +1 -1
  217. package/lib/renderers/builtin.js +1 -1
  218. package/lib/renderers/register.js +1 -1
  219. package/lib/renderers/wrapControl.d.ts +2 -2
  220. package/lib/renderers/wrapControl.js +12 -15
  221. package/lib/store/app.d.ts +1 -0
  222. package/lib/store/app.js +1 -1
  223. package/lib/store/combo.d.ts +3 -0
  224. package/lib/store/combo.js +1 -1
  225. package/lib/store/crud.d.ts +2 -0
  226. package/lib/store/crud.js +12 -4
  227. package/lib/store/form.d.ts +1 -0
  228. package/lib/store/form.js +10 -4
  229. package/lib/store/formItem.js +1 -1
  230. package/lib/store/iRenderer.d.ts +1 -0
  231. package/lib/store/iRenderer.js +53 -12
  232. package/lib/store/index.js +1 -1
  233. package/lib/store/list.d.ts +1 -0
  234. package/lib/store/list.js +7 -3
  235. package/lib/store/manager.js +1 -1
  236. package/lib/store/modal.d.ts +1 -0
  237. package/lib/store/modal.js +1 -1
  238. package/lib/store/node.js +1 -1
  239. package/lib/store/pagination.d.ts +1 -0
  240. package/lib/store/pagination.js +1 -1
  241. package/lib/store/root.d.ts +4 -6
  242. package/lib/store/root.js +52 -23
  243. package/lib/store/service.d.ts +1 -0
  244. package/lib/store/service.js +1 -1
  245. package/lib/store/status.d.ts +12 -0
  246. package/lib/store/status.js +42 -0
  247. package/lib/store/table.d.ts +4 -0
  248. package/lib/store/table.js +10 -2
  249. package/lib/store/table2.d.ts +2 -1
  250. package/lib/store/table2.js +6 -6
  251. package/lib/theme.d.ts +1 -1
  252. package/lib/theme.js +1 -1
  253. package/lib/types.d.ts +1 -1
  254. package/lib/utils/Animation.js +1 -1
  255. package/lib/utils/ColorScale.js +1 -1
  256. package/lib/utils/DataSchema.js +1 -1
  257. package/lib/utils/DataScope.d.ts +3 -5
  258. package/lib/utils/DataScope.js +86 -29
  259. package/lib/utils/RootClose.js +1 -1
  260. package/lib/utils/SimpleMap.js +1 -1
  261. package/lib/utils/api.js +5 -3
  262. package/lib/utils/attachmentAdpator.js +2 -2
  263. package/lib/utils/autobind.js +1 -1
  264. package/lib/utils/columnsSplit.js +1 -1
  265. package/lib/utils/dataMapping.js +1 -1
  266. package/lib/utils/date.d.ts +7 -0
  267. package/lib/utils/date.js +34 -1
  268. package/lib/utils/debug.js +1 -1
  269. package/lib/utils/decodeEntity.js +1 -1
  270. package/lib/utils/dom.d.ts +2 -1
  271. package/lib/utils/dom.js +1 -1
  272. package/lib/utils/errors.js +1 -1
  273. package/lib/utils/escapeHtml.js +1 -1
  274. package/lib/utils/filter-schema.js +1 -1
  275. package/lib/utils/filter.js +1 -1
  276. package/lib/utils/formatDuration.js +1 -1
  277. package/lib/utils/formula.js +1 -1
  278. package/lib/utils/getVariable.js +1 -1
  279. package/lib/utils/grammar.js +3 -3
  280. package/lib/utils/handleAction.js +1 -1
  281. package/lib/utils/helper.d.ts +2 -2
  282. package/lib/utils/helper.js +25 -18
  283. package/lib/utils/highlight.js +1 -1
  284. package/lib/utils/icon.d.ts +1 -1
  285. package/lib/utils/icon.js +1 -1
  286. package/lib/utils/image.js +1 -1
  287. package/lib/utils/isPureVariable.js +3 -3
  288. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  289. package/lib/utils/keyToPath.js +1 -1
  290. package/lib/utils/makeSorter.js +1 -1
  291. package/lib/utils/memoryParse.d.ts +17 -0
  292. package/lib/utils/memoryParse.js +30 -0
  293. package/lib/utils/normalizeLink.js +1 -1
  294. package/lib/utils/normalizeOptions.js +4 -2
  295. package/lib/utils/object.d.ts +2 -0
  296. package/lib/utils/object.js +28 -1
  297. package/lib/utils/offset.js +1 -1
  298. package/lib/utils/offsetParent.js +1 -1
  299. package/lib/utils/optionValueCompare.js +1 -1
  300. package/lib/utils/position.js +1 -1
  301. package/lib/utils/prettyBytes.js +1 -1
  302. package/lib/utils/renderer-event.js +1 -1
  303. package/lib/utils/replaceText.js +1 -1
  304. package/lib/utils/resize-sensor.js +1 -1
  305. package/lib/utils/resolveCondition.js +1 -1
  306. package/lib/utils/resolveVariable.js +3 -2
  307. package/lib/utils/resolveVariableAndFilter.js +1 -1
  308. package/lib/utils/resolveVariableAndFilterForAsync.js +4 -3
  309. package/lib/utils/scrollPosition.js +1 -1
  310. package/lib/utils/string2regExp.js +1 -1
  311. package/lib/utils/stripNumber.js +1 -1
  312. package/lib/utils/style-helper.d.ts +5 -2
  313. package/lib/utils/style-helper.js +18 -6
  314. package/lib/utils/style.js +1 -1
  315. package/lib/utils/toNumber.js +1 -1
  316. package/lib/utils/tokenize.d.ts +0 -1
  317. package/lib/utils/tokenize.js +1 -33
  318. package/lib/utils/tpl-builtin.js +4 -2
  319. package/lib/utils/tpl-lodash.js +1 -1
  320. package/lib/utils/tpl.js +1 -1
  321. package/lib/utils/uncontrollable.js +1 -1
  322. package/lib/utils/validations.js +1 -1
  323. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -0,0 +1,17 @@
1
+ export declare function memoryParse(input: string, options?: {
2
+ /**
3
+ * 直接是运算表达式?还是从模板开始 ${} 里面才算运算表达式
4
+ */
5
+ evalMode?: boolean;
6
+ /**
7
+ * 只支持取变量。
8
+ */
9
+ variableMode?: boolean;
10
+ /**
11
+ * 是否允许 filter 语法,比如:
12
+ *
13
+ * ${abc | html}
14
+ */
15
+ allowFilter?: boolean;
16
+ variableNamespaces?: Array<string>;
17
+ }): any;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * amis-core v3.1.0
3
+ * Copyright 2018-2023 fex
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ Object.defineProperty(exports, '__esModule', { value: true });
9
+
10
+ var amisFormula = require('amis-formula');
11
+
12
+ var cache = {};
13
+ function memoryParse(input, options) {
14
+ if (options === void 0) { options = {
15
+ evalMode: false
16
+ }; }
17
+ // @todo 优化内存缓存释放,比如只缓存最高频的模版
18
+ if (typeof input !== 'string') {
19
+ return;
20
+ }
21
+ var key = input + JSON.stringify(options);
22
+ if (cache[key]) {
23
+ return cache[key];
24
+ }
25
+ var ast = amisFormula.parse(input, options);
26
+ cache[key] = ast;
27
+ return ast;
28
+ }
29
+
30
+ exports.memoryParse = memoryParse;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -58,7 +58,9 @@ function normalizeOptions(options, share, valueField) {
58
58
  });
59
59
  }
60
60
  else if (Array.isArray(options)) {
61
- return options.map(function (item) {
61
+ return options
62
+ .filter(function (item) { return item !== null && item !== undefined; })
63
+ .map(function (item) {
62
64
  var _a;
63
65
  var value = item && item[valueField];
64
66
  var idx = value !== undefined && !item.children
@@ -3,6 +3,8 @@ export declare function createObject(superProps?: {
3
3
  }, props?: {
4
4
  [propName: string]: any;
5
5
  }, properties?: any): object;
6
+ export declare function extractObjectChain(value: any): object[];
7
+ export declare function createObjectFromChain(chain: Array<object>): object;
6
8
  export declare function cloneObject(target: any, persistOwnProps?: boolean): any;
7
9
  export declare function extendObject(target: any, src?: any, persistOwnProps?: boolean): any;
8
10
  export declare function isObject(obj: any): any;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -33,6 +33,31 @@ function createObject(superProps, props, properties) {
33
33
  Object.keys(props).forEach(function (key) { return (obj[key] = props[key]); });
34
34
  return obj;
35
35
  }
36
+ function extractObjectChain(value) {
37
+ var result = value ? [value] : [];
38
+ while (value === null || value === void 0 ? void 0 : value.__super) {
39
+ result.unshift(value.__super);
40
+ value = value.__super;
41
+ }
42
+ return result;
43
+ }
44
+ function createObjectFromChain(chain) {
45
+ return chain
46
+ .filter(function (item) { return item; })
47
+ .reduce(function (proto, value) {
48
+ proto = proto || Object.prototype;
49
+ if (Object.isFrozen(proto)) {
50
+ proto = cloneObject(proto);
51
+ }
52
+ return Object.assign(Object.create(proto, {
53
+ __super: {
54
+ value: proto,
55
+ writable: false,
56
+ enumerable: false
57
+ }
58
+ }), value);
59
+ });
60
+ }
36
61
  function cloneObject(target, persistOwnProps) {
37
62
  if (persistOwnProps === void 0) { persistOwnProps = true; }
38
63
  var obj = target && target.__super
@@ -149,8 +174,10 @@ function pickValues(names, data) {
149
174
 
150
175
  exports.cloneObject = cloneObject;
151
176
  exports.createObject = createObject;
177
+ exports.createObjectFromChain = createObjectFromChain;
152
178
  exports.deleteVariable = deleteVariable;
153
179
  exports.extendObject = extendObject;
180
+ exports.extractObjectChain = extractObjectChain;
154
181
  exports.isObject = isObject;
155
182
  exports.pickValues = pickValues;
156
183
  exports.setVariable = setVariable;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -9,6 +9,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  var amisFormula = require('amis-formula');
11
11
  var getVariable = require('./getVariable.js');
12
+ var memoryParse = require('./memoryParse.js');
12
13
 
13
14
  function resolveVariable(path, data, canAccessSuper) {
14
15
  if (data === void 0) { data = {}; }
@@ -26,7 +27,7 @@ function resolveVariable(path, data, canAccessSuper) {
26
27
  // 带 namespace 的用公式
27
28
  // 主要是用公式会严格点,不能出现奇怪的变量名
28
29
  try {
29
- return new amisFormula.Evaluator(data).evalute(amisFormula.parse(path, {
30
+ return new amisFormula.Evaluator(data).evalute(memoryParse.memoryParse(path, {
30
31
  variableMode: true,
31
32
  allowFilter: false
32
33
  }));
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -9,6 +9,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
10
  var tslib = require('tslib');
11
11
  var amisFormula = require('amis-formula');
12
+ var memoryParse = require('./memoryParse.js');
12
13
 
13
14
  var formulaEvalErrorHandler;
14
15
  /**
@@ -34,7 +35,7 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
34
35
  _a.label = 1;
35
36
  case 1:
36
37
  _a.trys.push([1, 3, , 4]);
37
- ast = amisFormula.parse(path, {
38
+ ast = memoryParse.memoryParse(path, {
38
39
  evalMode: false,
39
40
  allowFilter: true
40
41
  });
@@ -48,7 +49,6 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
48
49
  : ret];
49
50
  case 3:
50
51
  e_1 = _a.sent();
51
- console.warn(e_1);
52
52
  if (e_1.name === 'FormulaEvalError') {
53
53
  if (!skipFormulaEvalErrorHandler) {
54
54
  // 无法解析时,执行handler自定义解析逻辑
@@ -57,6 +57,7 @@ var resolveVariableAndFilterForAsync = function (path, data, defaultFilter, fall
57
57
  // 跳过自定义解析逻辑,则直接抛异常
58
58
  throw e_1;
59
59
  }
60
+ console.warn(e_1);
60
61
  return [2 /*return*/, undefined];
61
62
  case 4: return [2 /*return*/];
62
63
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -2,6 +2,8 @@ import { PlainObject } from '../types';
2
2
  export declare const valueMap: PlainObject;
3
3
  export declare const inheritValueMap: PlainObject;
4
4
  interface extra {
5
+ important?: boolean;
6
+ inner?: string;
5
7
  pre?: string;
6
8
  suf?: string;
7
9
  }
@@ -24,7 +26,7 @@ export declare function formatStyle(themeCss: any, classNames: {
24
26
  content: string;
25
27
  }[];
26
28
  };
27
- export declare function insertCustomStyle(themeCss: any, classNames: {
29
+ export interface CustomStyleClassName {
28
30
  key: string;
29
31
  value?: string;
30
32
  weights?: {
@@ -33,7 +35,8 @@ export declare function insertCustomStyle(themeCss: any, classNames: {
33
35
  active?: extra;
34
36
  disabled?: extra;
35
37
  };
36
- }[], id?: string, defaultData?: any): void;
38
+ }
39
+ export declare function insertCustomStyle(themeCss: any, classNames: CustomStyleClassName[], id?: string, defaultData?: any, customStyleClassPrefix?: string): void;
37
40
  /**
38
41
  * 根据路径获取默认值
39
42
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -123,7 +123,7 @@ function formatStyle(themeCss, classNames, id, defaultData) {
123
123
  }
124
124
  list === null || list === void 0 ? void 0 : list.forEach(function (n) {
125
125
  if (/(\S*[C|c]lassName-\S*)/.test(n) &&
126
- !!~n.indexOf((id === null || id === void 0 ? void 0 : id.replace('u:', '').replace('-label', '').replace('-description', '').replace('-addOn', '').replace('-icon', '')) || '')) {
126
+ !!~n.indexOf((id === null || id === void 0 ? void 0 : id.replace('u:', '').replace('-label', '').replace('-description', '').replace('-addOn', '').replace('-icon', '').replace('-inner', '')) || '')) {
127
127
  classNameList.push(n);
128
128
  }
129
129
  });
@@ -193,14 +193,23 @@ function formatStyle(themeCss, classNames, id, defaultData) {
193
193
  }
194
194
  else {
195
195
  var value = style;
196
- value && fn(key, value);
196
+ if (key === 'iconSize') {
197
+ fn('width', value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
198
+ fn('height', value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
199
+ fn('font-size', value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
200
+ }
201
+ else {
202
+ value &&
203
+ fn(key, value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
204
+ }
197
205
  }
198
206
  }
199
207
  if (styles.length > 0) {
200
208
  var cx = ((weights === null || weights === void 0 ? void 0 : weights.pre) || '') + className + ((weights === null || weights === void 0 ? void 0 : weights.suf) || '');
209
+ var inner = (weights === null || weights === void 0 ? void 0 : weights.inner) || '';
201
210
  res.push({
202
- className: cx + status2string[status_1],
203
- content: ".".concat(cx + status2string[status_1], " {\n ").concat(styles.join('\n '), "\n}")
211
+ className: cx + status2string[status_1] + inner,
212
+ content: ".".concat(cx + status2string[status_1], " ").concat(inner, "{\n ").concat(styles.join('\n '), "\n}")
204
213
  });
205
214
  // TODO:切换状态暂时先不改变组件的样式
206
215
  // if (['hover', 'active', 'disabled'].includes(status)) {
@@ -242,12 +251,15 @@ function formatStyle(themeCss, classNames, id, defaultData) {
242
251
  origin: res
243
252
  };
244
253
  }
245
- function insertCustomStyle(themeCss, classNames, id, defaultData) {
254
+ function insertCustomStyle(themeCss, classNames, id, defaultData, customStyleClassPrefix) {
246
255
  if (!themeCss) {
247
256
  return;
248
257
  }
249
258
  var value = formatStyle(themeCss, classNames, id, defaultData).value;
250
259
  if (value) {
260
+ value = customStyleClassPrefix
261
+ ? "".concat(customStyleClassPrefix, " ").concat(value)
262
+ : value;
251
263
  insertStyle(value, (id === null || id === void 0 ? void 0 : id.replace('u:', '')) || helper.uuid());
252
264
  }
253
265
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,2 +1 @@
1
1
  export declare const tokenize: (str: string, data: object, defaultFilter?: string) => string;
2
- export declare const asyncTokenize: (str: string, data: object, defaultFilter?: string) => Promise<string>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -7,7 +7,6 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
- var tslib = require('tslib');
11
10
  var amisFormula = require('amis-formula');
12
11
 
13
12
  var tokenize = function (str, data, defaultFilter) {
@@ -30,36 +29,5 @@ var tokenize = function (str, data, defaultFilter) {
30
29
  return str;
31
30
  }
32
31
  };
33
- var asyncTokenize = function (str, data, defaultFilter) {
34
- if (defaultFilter === void 0) { defaultFilter = '| html'; }
35
- return tslib.__awaiter(void 0, void 0, void 0, function () {
36
- var ast, result, e_1;
37
- return tslib.__generator(this, function (_a) {
38
- switch (_a.label) {
39
- case 0:
40
- if (!str || typeof str !== 'string') {
41
- return [2 /*return*/, str];
42
- }
43
- _a.label = 1;
44
- case 1:
45
- _a.trys.push([1, 3, , 4]);
46
- ast = amisFormula.parse(str, {
47
- evalMode: false,
48
- allowFilter: true
49
- });
50
- return [4 /*yield*/, amisFormula.evaluateForAsync(ast, data, { defaultFilter: defaultFilter })];
51
- case 2:
52
- result = _a.sent();
53
- return [2 /*return*/, "".concat(result == null ? '' : result)];
54
- case 3:
55
- e_1 = _a.sent();
56
- console.warn(e_1);
57
- return [2 /*return*/, str];
58
- case 4: return [2 /*return*/];
59
- }
60
- });
61
- });
62
- };
63
32
 
64
- exports.asyncTokenize = asyncTokenize;
65
33
  exports.tokenize = tokenize;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -12,6 +12,7 @@ var amisFormula = require('amis-formula');
12
12
  require('moment');
13
13
  require('lodash/isPlainObject');
14
14
  var tokenize = require('./tokenize.js');
15
+ var resolveVariableAndFilterForAsync = require('./resolveVariableAndFilterForAsync.js');
15
16
  require('./filter.js');
16
17
 
17
18
  function matchSynatax(str) {
@@ -62,7 +63,7 @@ function register() {
62
63
  return tslib.__awaiter(_this, void 0, void 0, function () {
63
64
  return tslib.__generator(this, function (_a) {
64
65
  try {
65
- return [2 /*return*/, tokenize.asyncTokenize(str, data, defaultFilter)];
66
+ return [2 /*return*/, resolveVariableAndFilterForAsync.resolveVariableAndFilterForAsync(str, data, defaultFilter)];
66
67
  }
67
68
  catch (e) {
68
69
  return [2 /*return*/, "error: ".concat(e.message)];
@@ -87,4 +88,5 @@ Object.defineProperty(exports, 'registerFunction', {
87
88
  get: function () { return amisFormula.registerFunction; }
88
89
  });
89
90
  exports.tokenize = tokenize.tokenize;
91
+ exports.resolveVariableAndFilterForAsync = resolveVariableAndFilterForAsync.resolveVariableAndFilterForAsync;
90
92
  exports.register = register;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/lib/utils/tpl.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v3.0.0
2
+ * amis-core v3.1.0
3
3
  * Copyright 2018-2023 fex
4
4
  */
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amis-core",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "amis-core",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -45,7 +45,7 @@
45
45
  "esm"
46
46
  ],
47
47
  "dependencies": {
48
- "amis-formula": "^3.0.0",
48
+ "amis-formula": "^3.1.0",
49
49
  "classnames": "2.3.1",
50
50
  "file-saver": "^2.0.2",
51
51
  "hoist-non-react-statics": "^3.3.2",
@@ -101,5 +101,5 @@
101
101
  "/.rollup.cache/"
102
102
  ]
103
103
  },
104
- "gitHead": "9220b4c13f4d042ebf2bf1dd8ee8e24d11e39141"
104
+ "gitHead": "020b12d0be43215664e0c0e53cd33486c43fde86"
105
105
  }