amis-core 2.5.1 → 2.5.2
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.
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.js +1 -1
- package/esm/SchemaRenderer.js +1 -1
- package/esm/Scoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.js +1 -1
- package/esm/actions/AjaxAction.js +1 -1
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.d.ts +1 -1
- package/esm/actions/CmptAction.js +16 -12
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -1
- package/esm/actions/DialogAction.js +1 -1
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +2 -1
- package/esm/components/PopOver.js +2 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +3 -2
- package/esm/locale.js +7 -3
- package/esm/renderers/Form.js +3 -3
- package/esm/renderers/Item.js +9 -5
- package/esm/renderers/Options.js +1 -1
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/register.d.ts +6 -0
- package/esm/renderers/register.js +78 -0
- package/esm/renderers/wrapControl.js +3 -3
- package/esm/store/app.js +1 -1
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +1 -1
- package/esm/store/form.js +3 -3
- package/esm/store/formItem.js +1 -1
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +1 -1
- package/esm/store/service.js +1 -1
- package/esm/store/table.js +1 -1
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +2 -0
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.js +1 -1
- package/esm/utils/DataScope.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +1 -1
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +1 -1
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.js +1 -1
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.js +1 -1
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.js +1 -1
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.d.ts +11 -0
- package/esm/utils/renderer-event.js +78 -13
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/scrollPosition.js +1 -1
- package/esm/utils/string2regExp.js +1 -1
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +1 -1
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.js +1 -1
- package/lib/SchemaRenderer.js +1 -1
- package/lib/Scoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.js +1 -1
- package/lib/actions/AjaxAction.js +1 -1
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.d.ts +1 -1
- package/lib/actions/CmptAction.js +16 -12
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +2 -1
- package/lib/actions/DialogAction.js +1 -1
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +2 -1
- package/lib/components/PopOver.js +2 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -2
- package/lib/locale.js +7 -3
- package/lib/renderers/Form.js +4 -4
- package/lib/renderers/Item.js +10 -6
- package/lib/renderers/Options.js +1 -1
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/register.d.ts +6 -0
- package/lib/renderers/register.js +82 -0
- package/lib/renderers/wrapControl.js +4 -4
- package/lib/store/app.js +1 -1
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +1 -1
- package/lib/store/form.js +4 -4
- package/lib/store/formItem.js +1 -1
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +1 -1
- package/lib/store/service.js +1 -1
- package/lib/store/table.js +1 -1
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +2 -0
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.js +1 -1
- package/lib/utils/DataScope.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +1 -1
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +1 -1
- package/lib/utils/errors.js +1 -1
- package/lib/utils/escapeHtml.js +1 -1
- package/lib/utils/filter-schema.js +1 -1
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.js +1 -1
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.js +1 -1
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.js +1 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.d.ts +11 -0
- package/lib/utils/renderer-event.js +82 -13
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/scrollPosition.js +1 -1
- package/lib/utils/string2regExp.js +1 -1
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.js +1 -1
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +1 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +3 -3
package/esm/Root.js
CHANGED
package/esm/RootRenderer.js
CHANGED
package/esm/SchemaRenderer.js
CHANGED
package/esm/Scoped.js
CHANGED
package/esm/WithRootStore.js
CHANGED
package/esm/WithStore.js
CHANGED
package/esm/actions/Action.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RendererEvent } from '../utils/renderer-event';
|
|
2
2
|
import { RendererAction, ListenerAction, ListenerContext } from './Action';
|
|
3
3
|
export interface ICmptAction extends ListenerAction {
|
|
4
|
-
actionType: 'setValue' | 'static' | 'nonstatic' | 'show' | 'hidden' | 'enabled' | 'disabled' | 'reload';
|
|
4
|
+
actionType: 'setValue' | 'static' | 'nonstatic' | 'show' | 'visibility' | 'hidden' | 'enabled' | 'disabled' | 'usability' | 'reload';
|
|
5
5
|
args: {
|
|
6
6
|
value?: string | {
|
|
7
7
|
[key: string]: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -17,39 +17,43 @@ var CmptAction = /** @class */ (function () {
|
|
|
17
17
|
function CmptAction() {
|
|
18
18
|
}
|
|
19
19
|
CmptAction.prototype.run = function (action, renderer, event) {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
21
21
|
return __awaiter(this, void 0, void 0, function () {
|
|
22
|
-
var component, dataMergeMode;
|
|
23
|
-
return __generator(this, function (
|
|
22
|
+
var component, dataMergeMode, visibility, usability;
|
|
23
|
+
return __generator(this, function (_l) {
|
|
24
24
|
component = action.componentId && renderer.props.$schema.id !== action.componentId
|
|
25
25
|
? (_a = event.context.scoped) === null || _a === void 0 ? void 0 : _a.getComponentById(action.componentId)
|
|
26
26
|
: renderer;
|
|
27
27
|
dataMergeMode = action.dataMergeMode || 'merge';
|
|
28
28
|
// 显隐&状态控制
|
|
29
|
-
if (['show', 'hidden'].includes(action.actionType)) {
|
|
30
|
-
|
|
29
|
+
if (['show', 'hidden', 'visibility'].includes(action.actionType)) {
|
|
30
|
+
visibility = action.actionType === 'visibility'
|
|
31
|
+
? (_b = action.args) === null || _b === void 0 ? void 0 : _b.value : action.actionType === 'show';
|
|
32
|
+
return [2 /*return*/, renderer.props.topStore.setVisible(action.componentId, visibility)];
|
|
31
33
|
}
|
|
32
34
|
else if (['static', 'nonstatic'].includes(action.actionType)) {
|
|
33
35
|
return [2 /*return*/, renderer.props.topStore.setStatic(action.componentId, action.actionType === 'static')];
|
|
34
36
|
}
|
|
35
|
-
else if (['enabled', 'disabled'].includes(action.actionType)) {
|
|
36
|
-
|
|
37
|
+
else if (['enabled', 'disabled', 'usability'].includes(action.actionType)) {
|
|
38
|
+
usability = action.actionType === 'usability'
|
|
39
|
+
? !((_c = action.args) === null || _c === void 0 ? void 0 : _c.value) : action.actionType === 'disabled';
|
|
40
|
+
return [2 /*return*/, renderer.props.topStore.setDisable(action.componentId, usability)];
|
|
37
41
|
}
|
|
38
42
|
// 数据更新
|
|
39
43
|
if (action.actionType === 'setValue') {
|
|
40
44
|
if (component === null || component === void 0 ? void 0 : component.setData) {
|
|
41
|
-
return [2 /*return*/, component === null || component === void 0 ? void 0 : component.setData((
|
|
45
|
+
return [2 /*return*/, component === null || component === void 0 ? void 0 : component.setData((_d = action.args) === null || _d === void 0 ? void 0 : _d.value, dataMergeMode === 'override', (_e = action.args) === null || _e === void 0 ? void 0 : _e.index)];
|
|
42
46
|
}
|
|
43
47
|
else {
|
|
44
|
-
return [2 /*return*/, (
|
|
48
|
+
return [2 /*return*/, (_g = component === null || component === void 0 ? void 0 : (_f = component.props).onChange) === null || _g === void 0 ? void 0 : _g.call(_f, (_h = action.args) === null || _h === void 0 ? void 0 : _h.value)];
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
// 刷新
|
|
48
52
|
if (action.actionType === 'reload') {
|
|
49
|
-
return [2 /*return*/, (
|
|
53
|
+
return [2 /*return*/, (_j = component === null || component === void 0 ? void 0 : component.reload) === null || _j === void 0 ? void 0 : _j.call(component, undefined, action.data, undefined, undefined, dataMergeMode === 'override', action.args)];
|
|
50
54
|
}
|
|
51
55
|
// 执行组件动作
|
|
52
|
-
return [2 /*return*/, (
|
|
56
|
+
return [2 /*return*/, (_k = component === null || component === void 0 ? void 0 : component.doAction) === null || _k === void 0 ? void 0 : _k.call(component, action, action.args)];
|
|
53
57
|
});
|
|
54
58
|
});
|
|
55
59
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -26,6 +26,7 @@ import 'lodash/isBoolean';
|
|
|
26
26
|
import 'lodash';
|
|
27
27
|
import '../utils/image.js';
|
|
28
28
|
import { registerAction, runActions } from './Action.js';
|
|
29
|
+
import 'lodash/debounce';
|
|
29
30
|
import '../utils/resize-sensor.js';
|
|
30
31
|
import 'react-overlays/useRootClose';
|
|
31
32
|
import '../utils/SimpleMap.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -28,6 +28,7 @@ import 'lodash/isBoolean';
|
|
|
28
28
|
import 'lodash';
|
|
29
29
|
import '../utils/image.js';
|
|
30
30
|
import '../actions/Action.js';
|
|
31
|
+
import 'lodash/debounce';
|
|
31
32
|
import { getComputedStyle, resizeSensor } from '../utils/resize-sensor.js';
|
|
32
33
|
import { RootClose } from '../utils/RootClose.js';
|
|
33
34
|
import '../utils/SimpleMap.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -27,6 +27,7 @@ import 'lodash/isBoolean';
|
|
|
27
27
|
import 'lodash';
|
|
28
28
|
import '../utils/image.js';
|
|
29
29
|
import '../actions/Action.js';
|
|
30
|
+
import 'lodash/debounce';
|
|
30
31
|
import '../utils/resize-sensor.js';
|
|
31
32
|
import 'react-overlays/useRootClose';
|
|
32
33
|
import '../utils/SimpleMap.js';
|
package/esm/env.js
CHANGED
package/esm/envOverwrite.js
CHANGED
package/esm/factory.js
CHANGED
package/esm/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import { Renderer, getRendererByName, getRenderers, registerRenderer, unRegisterRenderer, resolveRenderer, filterSchema, clearStoresCache, updateEnv, addSchemaFilter, extendDefaultEnv } from './factory';
|
|
10
10
|
import type { RenderOptions, RendererConfig, RendererProps } from './factory';
|
|
11
11
|
import './renderers/builtin';
|
|
12
|
+
import './renderers/register';
|
|
12
13
|
export * from './utils/index';
|
|
13
14
|
export * from './types';
|
|
14
15
|
export * from './store';
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@ import { __assign } from 'tslib';
|
|
|
7
7
|
import { stores, defaultOptions } from './factory.js';
|
|
8
8
|
export { Renderer, addSchemaFilter, clearStoresCache, extendDefaultEnv, filterSchema, getRendererByName, getRenderers, registerRenderer, resolveRenderer, unRegisterRenderer, updateEnv } from './factory.js';
|
|
9
9
|
import './renderers/builtin.js';
|
|
10
|
+
import './renderers/register.js';
|
|
10
11
|
import { wrapFetcher } from './utils/api.js';
|
|
11
12
|
export { buildApi, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher } from './utils/api.js';
|
|
12
13
|
export { attachmentAdpator } from './utils/attachmentAdpator.js';
|
|
@@ -122,7 +123,7 @@ export { StoreNode } from './store/node.js';
|
|
|
122
123
|
|
|
123
124
|
var classPrefix = getClassPrefix();
|
|
124
125
|
// @ts-ignore
|
|
125
|
-
var version = '2.5.
|
|
126
|
+
var version = '2.5.2';
|
|
126
127
|
function render(schema, props, options, pathPrefix) {
|
|
127
128
|
if (props === void 0) { props = {}; }
|
|
128
129
|
if (options === void 0) { options = {}; }
|
package/esm/locale.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -35,6 +35,7 @@ function makeTranslator(locale) {
|
|
|
35
35
|
return fns[locale];
|
|
36
36
|
}
|
|
37
37
|
var fn = function (str) {
|
|
38
|
+
var _a, _b, _c;
|
|
38
39
|
var args = [];
|
|
39
40
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
40
41
|
args[_i - 1] = arguments[_i];
|
|
@@ -42,8 +43,11 @@ function makeTranslator(locale) {
|
|
|
42
43
|
if (!str || typeof str !== 'string') {
|
|
43
44
|
return str;
|
|
44
45
|
}
|
|
45
|
-
var
|
|
46
|
-
|
|
46
|
+
var value = ((_a = locales[locale]) === null || _a === void 0 ? void 0 : _a[str]) ||
|
|
47
|
+
((_b = locales[defaultLocale]) === null || _b === void 0 ? void 0 : _b[str]) ||
|
|
48
|
+
((_c = locales['zh-CN']) === null || _c === void 0 ? void 0 : _c[str]) ||
|
|
49
|
+
str;
|
|
50
|
+
return format.apply(void 0, __spreadArray([value], args, false));
|
|
47
51
|
};
|
|
48
52
|
locale && (fns[locale] = fn);
|
|
49
53
|
return fn;
|
package/esm/renderers/Form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -11,7 +11,7 @@ import { FormStore } from '../store/form.js';
|
|
|
11
11
|
import { evalExpression, filter } from '../utils/tpl.js';
|
|
12
12
|
import { getExprProperties } from '../utils/filter-schema.js';
|
|
13
13
|
import { promisify, isEmpty, until, noop, isVisible, SkipOperation, difference, repeatCount, qsparse, isObjectShallowModified } from '../utils/helper.js';
|
|
14
|
-
import
|
|
14
|
+
import debounce from 'lodash/debounce';
|
|
15
15
|
import flatten from 'lodash/flatten';
|
|
16
16
|
import find from 'lodash/find';
|
|
17
17
|
import { ScopedContext } from '../Scoped.js';
|
|
@@ -31,7 +31,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
31
31
|
var _this = _super.call(this, props) || this;
|
|
32
32
|
_this.hooks = {};
|
|
33
33
|
_this.shouldLoadInitApi = false;
|
|
34
|
-
_this.lazyEmitChange =
|
|
34
|
+
_this.lazyEmitChange = debounce(_this.emitChange.bind(_this), 250, {
|
|
35
35
|
trailing: true,
|
|
36
36
|
leading: false
|
|
37
37
|
});
|
package/esm/renderers/Item.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -13,7 +13,7 @@ import { observer } from 'mobx-react';
|
|
|
13
13
|
import { filter } from '../utils/tpl.js';
|
|
14
14
|
import { HocStoreFactory } from '../WithStore.js';
|
|
15
15
|
import { wrapControl } from './wrapControl.js';
|
|
16
|
-
import
|
|
16
|
+
import debounce from 'lodash/debounce';
|
|
17
17
|
import { isEffectiveApi, isApiOutdated } from '../utils/api.js';
|
|
18
18
|
import { findDOMNode } from 'react-dom';
|
|
19
19
|
import '../utils/ColorScale.js';
|
|
@@ -64,7 +64,7 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
64
64
|
function FormItemWrap(props) {
|
|
65
65
|
var _this = _super.call(this, props) || this;
|
|
66
66
|
_this.reaction = [];
|
|
67
|
-
_this.syncAutoFill =
|
|
67
|
+
_this.syncAutoFill = debounce(function (term, reload) {
|
|
68
68
|
(function (term, reload) { return __awaiter(_this, void 0, void 0, function () {
|
|
69
69
|
var _a, autoFill, onBulkChange, formItem, data, itemName, ctx, result;
|
|
70
70
|
var _b;
|
|
@@ -323,7 +323,9 @@ var FormItemWrap = /** @class */ (function (_super) {
|
|
|
323
323
|
};
|
|
324
324
|
FormItemWrap.prototype.renderControl = function () {
|
|
325
325
|
var _a;
|
|
326
|
-
var _b = this.props
|
|
326
|
+
var _b = this.props;
|
|
327
|
+
// 这里解构,不可轻易删除,避免被rest传到子组件
|
|
328
|
+
_b.inputClassName; var model = _b.formItem, cx = _b.classnames; _b.children; var type = _b.type, renderControl = _b.renderControl; _b.formItemConfig; var sizeMutable = _b.sizeMutable, size = _b.size, defaultSize = _b.defaultSize, useMobileUI = _b.useMobileUI, rest = __rest(_b, ["inputClassName", "formItem", "classnames", "children", "type", "renderControl", "formItemConfig", "sizeMutable", "size", "defaultSize", "useMobileUI"]);
|
|
327
329
|
var mobileUI = useMobileUI && isMobile();
|
|
328
330
|
if (renderControl) {
|
|
329
331
|
var controlSize = size || defaultSize;
|
|
@@ -807,7 +809,9 @@ function asFormItem(config) {
|
|
|
807
809
|
};
|
|
808
810
|
class_1.prototype.renderControl = function () {
|
|
809
811
|
var _a;
|
|
810
|
-
var _b = this.props
|
|
812
|
+
var _b = this.props;
|
|
813
|
+
// 这里解构,不可轻易删除,避免被rest传到子组件
|
|
814
|
+
_b.inputClassName; var model = _b.formItem, cx = _b.classnames; _b.children; var type = _b.type, size = _b.size, defaultSize = _b.defaultSize, useMobileUI = _b.useMobileUI, rest = __rest(_b, ["inputClassName", "formItem", "classnames", "children", "type", "size", "defaultSize", "useMobileUI"]);
|
|
811
815
|
var controlSize = size || defaultSize;
|
|
812
816
|
var mobileUI = useMobileUI && isMobile();
|
|
813
817
|
//@ts-ignore
|
package/esm/renderers/Options.js
CHANGED
package/esm/renderers/builtin.js
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v2.5.2
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { renderersMap, Renderer } from '../factory.js';
|
|
7
|
+
import { OptionsControl } from './Options.js';
|
|
8
|
+
import { FormItem } from './Item.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 提供两种特殊的注册渲染器的方式
|
|
12
|
+
* 1、自动加载预先注册的自定义渲染器:自动加载并注册 window.AmisCustomRenderers 中的渲染器
|
|
13
|
+
* 2、通过 postMessage 告知 amis 注册一个新的渲染器:间接注册渲染器,无需直接依赖 amis。
|
|
14
|
+
*/
|
|
15
|
+
// 自动加载预先注册的自定义渲染器
|
|
16
|
+
function autoPreRegisterAmisCustomRenderers() {
|
|
17
|
+
if (window.AmisCustomRenderers) {
|
|
18
|
+
Object.keys(window.AmisCustomRenderers).forEach(function (rendererType) {
|
|
19
|
+
if (renderersMap[rendererType]) {
|
|
20
|
+
console.warn("[amis-core]\uFF1A\u9884\u6CE8\u518C\u6E32\u67D3\u5668\u5931\u8D25\uFF0C\u5F53\u524D\u5DF2\u5B58\u5728\u91CD\u540D\u6E32\u67D3\u5668\uFF08".concat(rendererType, "\uFF09\u3002"));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
var curAmisRenderer = window.AmisCustomRenderers[rendererType];
|
|
24
|
+
if (curAmisRenderer) {
|
|
25
|
+
registerAmisRendererByUsage(rendererType, curAmisRenderer);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// 自动加载并注册 window.AmisCustomRenderers 中的渲染器
|
|
32
|
+
autoPreRegisterAmisCustomRenderers();
|
|
33
|
+
// postMessage 渲染器动态注册机制
|
|
34
|
+
window.addEventListener('message', function (event) {
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
if (!event.data) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (((_a = event.data) === null || _a === void 0 ? void 0 : _a.type) === 'amis-renderer-register-event' &&
|
|
40
|
+
((_b = event.data) === null || _b === void 0 ? void 0 : _b.amisRenderer) &&
|
|
41
|
+
event.data.amisRenderer.type) {
|
|
42
|
+
var curAmisRenderer = (_c = event.data) === null || _c === void 0 ? void 0 : _c.amisRenderer;
|
|
43
|
+
var curUsage = (curAmisRenderer === null || curAmisRenderer === void 0 ? void 0 : curAmisRenderer.usage) || 'renderer';
|
|
44
|
+
if (renderersMap[curAmisRenderer.type]) {
|
|
45
|
+
console.warn("[amis-core]\uFF1A\u52A8\u6001\u6CE8\u518C\u6E32\u67D3\u5668\u5931\u8D25\uFF0C\u5F53\u524D\u5DF2\u5B58\u5728\u91CD\u540D\u6E32\u67D3\u5668\uFF08".concat(curAmisRenderer.type, "\uFF09\u3002"));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
console.info('[amis-core]响应动态注册渲染器事件:', curAmisRenderer.type);
|
|
49
|
+
registerAmisRendererByUsage(curUsage, curAmisRenderer);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}, false);
|
|
53
|
+
// 根据类型(usage)进行注册 amis渲染器
|
|
54
|
+
function registerAmisRendererByUsage(curUsage, curAmisRenderer) {
|
|
55
|
+
// 当前支持注册的渲染器类型
|
|
56
|
+
var registerMap = {
|
|
57
|
+
renderer: Renderer,
|
|
58
|
+
formitem: FormItem,
|
|
59
|
+
options: OptionsControl,
|
|
60
|
+
};
|
|
61
|
+
var curAmisRendererComponent = curAmisRenderer.component;
|
|
62
|
+
if (!curAmisRendererComponent &&
|
|
63
|
+
window.AmisCustomRenderers &&
|
|
64
|
+
window.AmisCustomRenderers[curAmisRenderer.type] &&
|
|
65
|
+
window.AmisCustomRenderers[curAmisRenderer.type].component) {
|
|
66
|
+
curAmisRendererComponent = window.AmisCustomRenderers[curAmisRenderer.type].component;
|
|
67
|
+
}
|
|
68
|
+
if (curAmisRendererComponent &&
|
|
69
|
+
['renderer', 'formitem', 'options'].includes(curUsage) &&
|
|
70
|
+
registerMap[curUsage]) {
|
|
71
|
+
registerMap[curUsage]({
|
|
72
|
+
type: curAmisRenderer.type,
|
|
73
|
+
weight: curAmisRenderer.weight || 0,
|
|
74
|
+
})(curAmisRendererComponent);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { autoPreRegisterAmisCustomRenderers };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __extends, __awaiter, __generator, __assign } from 'tslib';
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
8
|
+
import debounce from 'lodash/debounce';
|
|
9
9
|
import isEqual from 'lodash/isEqual';
|
|
10
10
|
import { ComboStore } from '../store/combo.js';
|
|
11
11
|
import { guid, promisify, anyChanged } from '../utils/helper.js';
|
|
@@ -28,7 +28,7 @@ function wrapControl(ComposedComponent) {
|
|
|
28
28
|
var _a, _b;
|
|
29
29
|
_this = _super.call(this, props) || this;
|
|
30
30
|
_this.value = undefined;
|
|
31
|
-
_this.lazyEmitChange =
|
|
31
|
+
_this.lazyEmitChange = debounce(_this.emitChange.bind(_this), 250, {
|
|
32
32
|
trailing: true,
|
|
33
33
|
leading: false
|
|
34
34
|
});
|
package/esm/store/app.js
CHANGED
package/esm/store/combo.js
CHANGED
package/esm/store/crud.js
CHANGED
package/esm/store/form.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.5.
|
|
2
|
+
* amis-core v2.5.2
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __generator, __assign } from 'tslib';
|
|
7
7
|
import { types, flow, isAlive, getEnv } from 'mobx-state-tree';
|
|
8
|
-
import
|
|
8
|
+
import debounce from 'lodash/debounce';
|
|
9
9
|
import toPairs from 'lodash/toPairs';
|
|
10
10
|
import pick from 'lodash/pick';
|
|
11
11
|
import { ServiceStore } from './service.js';
|
|
@@ -217,7 +217,7 @@ var FormStore = ServiceStore.named('FormStore')
|
|
|
217
217
|
});
|
|
218
218
|
self.updateData(data);
|
|
219
219
|
}
|
|
220
|
-
var syncOptions =
|
|
220
|
+
var syncOptions = debounce(function () { return self.items.forEach(function (item) { return item.syncOptions(undefined, self.data); }); }, 250, {
|
|
221
221
|
trailing: true,
|
|
222
222
|
leading: false
|
|
223
223
|
});
|