amis-core 3.3.0 → 3.4.0-beta.12
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/LICENSE +1 -1
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.js +3 -3
- package/esm/SchemaRenderer.d.ts +1 -0
- package/esm/SchemaRenderer.js +10 -5
- package/esm/Scoped.js +1 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +42 -24
- package/esm/actions/AjaxAction.js +12 -4
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +9 -3
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +1 -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/StatusAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.js +3 -2
- package/esm/env.d.ts +2 -0
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +1 -0
- package/esm/factory.js +4 -3
- package/esm/index.js +5 -5
- package/esm/locale.js +10 -4
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.js +50 -11
- package/esm/renderers/Item.js +18 -20
- package/esm/renderers/Options.d.ts +4 -0
- 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.js +1 -1
- package/esm/renderers/wrapControl.js +5 -4
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +120 -120
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +1 -1
- package/esm/store/form.d.ts +50 -50
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.d.ts +1 -1
- package/esm/store/formItem.js +95 -52
- 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/status.js +1 -1
- package/esm/store/table.d.ts +226 -125
- package/esm/store/table.js +109 -43
- package/esm/store/table2.js +2 -2
- package/esm/theme.d.ts +2 -0
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +6 -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 +6 -11
- package/esm/utils/arraySlice.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.d.ts +17 -10
- package/esm/utils/helper.js +164 -68
- 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/math.js +1 -1
- package/esm/utils/memoryParse.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.d.ts +2 -0
- package/esm/utils/optionValueCompare.js +15 -5
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +1 -1
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.js +1 -1
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.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-helper.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 +3 -3
- package/lib/SchemaRenderer.d.ts +1 -0
- package/lib/SchemaRenderer.js +9 -4
- package/lib/Scoped.js +1 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +42 -24
- package/lib/actions/AjaxAction.js +11 -3
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +9 -3
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +1 -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/StatusAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.js +3 -2
- package/lib/env.d.ts +2 -0
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +1 -0
- package/lib/factory.js +3 -2
- package/lib/index.js +6 -3
- package/lib/locale.js +11 -4
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.js +50 -11
- package/lib/renderers/Item.js +17 -19
- package/lib/renderers/Options.d.ts +4 -0
- 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.js +1 -1
- package/lib/renderers/wrapControl.js +5 -4
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +144 -144
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +1 -1
- package/lib/store/form.d.ts +60 -60
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.d.ts +1 -1
- package/lib/store/formItem.js +94 -50
- 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/status.js +1 -1
- package/lib/store/table.d.ts +246 -145
- package/lib/store/table.js +109 -43
- package/lib/store/table2.js +2 -2
- package/lib/theme.d.ts +2 -0
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +6 -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 +5 -10
- package/lib/utils/arraySlice.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.d.ts +17 -10
- package/lib/utils/helper.js +169 -70
- 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/math.js +1 -1
- package/lib/utils/memoryParse.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.d.ts +2 -0
- package/lib/utils/optionValueCompare.js +16 -4
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +1 -1
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.js +1 -1
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.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-helper.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/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2023 Baidu
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/esm/Root.js
CHANGED
package/esm/RootRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.4.0-beta.12
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -82,7 +82,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
82
82
|
var _this = this;
|
|
83
83
|
var _a, _b;
|
|
84
84
|
if (throwErrors === void 0) { throwErrors = false; }
|
|
85
|
-
var _c = this.props, env = _c.env, messages = _c.messages, onAction = _c.onAction, render = _c.render;
|
|
85
|
+
var _c = this.props, env = _c.env, messages = _c.messages, onAction = _c.onAction, mobileUI = _c.mobileUI, render = _c.render;
|
|
86
86
|
var store = this.store;
|
|
87
87
|
if ((onAction === null || onAction === void 0 ? void 0 : onAction(e, action, ctx, throwErrors, delegate || this.context)) ===
|
|
88
88
|
false) {
|
|
@@ -129,7 +129,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
129
129
|
? render('body', item.body, __assign(__assign({}, _this.props), { data: ctx }))
|
|
130
130
|
: '', __assign(__assign(__assign({}, action.toast), item), { title: item.title
|
|
131
131
|
? render('title', item.title, __assign(__assign({}, _this.props), { data: ctx }))
|
|
132
|
-
: null,
|
|
132
|
+
: null, mobileUI: mobileUI }));
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
else if (action.actionType === 'ajax') {
|
package/esm/SchemaRenderer.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class SchemaRenderer extends React.Component<SchemaRendererProps,
|
|
|
21
21
|
path: string;
|
|
22
22
|
reaction: any;
|
|
23
23
|
unbindEvent: (() => void) | undefined;
|
|
24
|
+
isStatic: any;
|
|
24
25
|
constructor(props: SchemaRendererProps);
|
|
25
26
|
componentDidMount(): void;
|
|
26
27
|
componentWillUnmount(): void;
|
package/esm/SchemaRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.4.0-beta.12
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -24,7 +24,7 @@ import 'lodash/isPlainObject';
|
|
|
24
24
|
import { resolveVariableAndFilter } from './utils/resolveVariableAndFilter.js';
|
|
25
25
|
import './utils/filter.js';
|
|
26
26
|
import { buildStyle } from './utils/style.js';
|
|
27
|
-
import { filter } from './utils/tpl.js';
|
|
27
|
+
import { filter, evalExpression } from './utils/tpl.js';
|
|
28
28
|
|
|
29
29
|
var RENDERER_TRANSMISSION_OMIT_PROPS = [
|
|
30
30
|
'type',
|
|
@@ -66,6 +66,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
66
66
|
var _this = _super.call(this, props) || this;
|
|
67
67
|
_this.rendererKey = '';
|
|
68
68
|
_this.unbindEvent = undefined;
|
|
69
|
+
_this.isStatic = undefined;
|
|
69
70
|
_this.refFn = _this.refFn.bind(_this);
|
|
70
71
|
_this.renderChild = _this.renderChild.bind(_this);
|
|
71
72
|
_this.reRender = _this.reRender.bind(_this);
|
|
@@ -175,8 +176,9 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
175
176
|
});
|
|
176
177
|
};
|
|
177
178
|
SchemaRenderer.prototype.renderChild = function (region, node, subProps) {
|
|
179
|
+
var _a, _b;
|
|
178
180
|
if (subProps === void 0) { subProps = {}; }
|
|
179
|
-
var
|
|
181
|
+
var _c = this.props, _ = _c.schema; _c.$path; var env = _c.env, render = _c.render, rest = __rest(_c, ["schema", "$path", "env", "render"]);
|
|
180
182
|
var $path = this.resolveRenderer(this.props).path;
|
|
181
183
|
var omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
|
|
182
184
|
if (this.renderer) {
|
|
@@ -184,7 +186,9 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
184
186
|
Component.propsList &&
|
|
185
187
|
omitList.push.apply(omitList, Component.propsList);
|
|
186
188
|
}
|
|
187
|
-
return render("".concat($path).concat(region ? "/".concat(region) : ''), node || '', __assign(__assign(__assign({}, omit(rest, omitList)),
|
|
189
|
+
return render("".concat($path).concat(region ? "/".concat(region) : ''), node || '', __assign(__assign(__assign(__assign({}, omit(rest, omitList)), { defaultStatic: (_a = this.isStatic) !== null && _a !== void 0 ? _a : (_.staticOn
|
|
190
|
+
? evalExpression(_.staticOn, rest.data)
|
|
191
|
+
: (_b = _.static) !== null && _b !== void 0 ? _b : rest.defaultStatic) }), subProps), { data: subProps.data || rest.data, env: env }));
|
|
188
192
|
};
|
|
189
193
|
SchemaRenderer.prototype.reRender = function () {
|
|
190
194
|
this.resolveRenderer(this.props, true);
|
|
@@ -220,6 +224,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
220
224
|
var isStatic = isAlive(statusStore)
|
|
221
225
|
? (_d = statusStore.staticState[id]) !== null && _d !== void 0 ? _d : statusStore.staticState[name]
|
|
222
226
|
: undefined;
|
|
227
|
+
this.isStatic = isStatic;
|
|
223
228
|
if (visible === false ||
|
|
224
229
|
(visible !== true &&
|
|
225
230
|
exprProps &&
|
|
@@ -300,7 +305,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
300
305
|
var $schema = __assign(__assign({}, schema), exprProps);
|
|
301
306
|
var props = __assign(__assign(__assign(__assign(__assign({}, theme.getRendererConfig(renderer.name)), restSchema), chainEvents(rest, restSchema)), exprProps), {
|
|
302
307
|
// value: defaultValue, // 备注: 此处并没有将value传递给渲染器
|
|
303
|
-
defaultData: (_f = restSchema.defaultData) !== null && _f !== void 0 ? _f : defaultData, defaultValue: (_g = restSchema.defaultValue) !== null && _g !== void 0 ? _g : defaultValue, defaultActiveKey: defaultActiveKey, propKey: propKey, $path: $path, $schema: $schema, ref: this.refFn, render: this.renderChild, rootStore: rootStore, statusStore: statusStore, dispatchEvent: this.dispatchEvent });
|
|
308
|
+
defaultData: (_f = restSchema.defaultData) !== null && _f !== void 0 ? _f : defaultData, defaultValue: (_g = restSchema.defaultValue) !== null && _g !== void 0 ? _g : defaultValue, defaultActiveKey: defaultActiveKey, propKey: propKey, $path: $path, $schema: $schema, ref: this.refFn, render: this.renderChild, rootStore: rootStore, statusStore: statusStore, dispatchEvent: this.dispatchEvent, mobileUI: schema.useMobileUI === false ? false : rest.mobileUI });
|
|
304
309
|
if (disable !== undefined) {
|
|
305
310
|
props.disabled = disable;
|
|
306
311
|
}
|
package/esm/Scoped.js
CHANGED
package/esm/StatusScoped.js
CHANGED
package/esm/WithRootStore.js
CHANGED
package/esm/WithStore.js
CHANGED
package/esm/actions/Action.d.ts
CHANGED
package/esm/actions/Action.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.4.0-beta.12
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -52,6 +52,7 @@ var getOmitActionProp = function (type) {
|
|
|
52
52
|
omitList = ['msg', 'title'];
|
|
53
53
|
break;
|
|
54
54
|
case 'ajax':
|
|
55
|
+
case 'download':
|
|
55
56
|
omitList = ['api', 'messages', 'options'];
|
|
56
57
|
break;
|
|
57
58
|
case 'setValue':
|
|
@@ -97,21 +98,22 @@ var getOmitActionProp = function (type) {
|
|
|
97
98
|
return omitList;
|
|
98
99
|
};
|
|
99
100
|
var runActions = function (actions, renderer, event) { return __awaiter(void 0, void 0, void 0, function () {
|
|
100
|
-
var actions_1, actions_1_1, actionConfig, actionInstrance,
|
|
101
|
-
var
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
var actions_1, actions_1_1, actionConfig, actionInstrance, e_1, ignore, e_2_1;
|
|
102
|
+
var e_2, _a;
|
|
103
|
+
var _b;
|
|
104
|
+
return __generator(this, function (_c) {
|
|
105
|
+
switch (_c.label) {
|
|
104
106
|
case 0:
|
|
105
107
|
if (!Array.isArray(actions)) {
|
|
106
108
|
actions = [actions];
|
|
107
109
|
}
|
|
108
|
-
|
|
110
|
+
_c.label = 1;
|
|
109
111
|
case 1:
|
|
110
|
-
|
|
112
|
+
_c.trys.push([1, 9, 10, 11]);
|
|
111
113
|
actions_1 = __values(actions), actions_1_1 = actions_1.next();
|
|
112
|
-
|
|
114
|
+
_c.label = 2;
|
|
113
115
|
case 2:
|
|
114
|
-
if (!!actions_1_1.done) return [3 /*break*/,
|
|
116
|
+
if (!!actions_1_1.done) return [3 /*break*/, 8];
|
|
115
117
|
actionConfig = actions_1_1.value;
|
|
116
118
|
actionInstrance = getActionByType(actionConfig.actionType);
|
|
117
119
|
// 如果存在指定组件ID,说明是组件专有动作
|
|
@@ -138,30 +140,42 @@ var runActions = function (actions, renderer, event) { return __awaiter(void 0,
|
|
|
138
140
|
if (!actionInstrance) {
|
|
139
141
|
actionInstrance = getActionByType('component');
|
|
140
142
|
}
|
|
143
|
+
_c.label = 3;
|
|
144
|
+
case 3:
|
|
145
|
+
_c.trys.push([3, 5, , 6]);
|
|
141
146
|
// 这些节点的子节点运行逻辑由节点内部实现
|
|
142
147
|
return [4 /*yield*/, runAction(actionInstrance, actionConfig, renderer, event)];
|
|
143
|
-
case
|
|
148
|
+
case 4:
|
|
144
149
|
// 这些节点的子节点运行逻辑由节点内部实现
|
|
145
|
-
|
|
150
|
+
_c.sent();
|
|
151
|
+
return [3 /*break*/, 6];
|
|
152
|
+
case 5:
|
|
153
|
+
e_1 = _c.sent();
|
|
154
|
+
ignore = (_b = actionConfig.ignoreError) !== null && _b !== void 0 ? _b : false;
|
|
155
|
+
if (!ignore) {
|
|
156
|
+
throw Error("".concat(actionConfig.actionType, " \u52A8\u4F5C\u6267\u884C\u5931\u8D25\uFF0C\u539F\u56E0\uFF1A").concat(e_1.message || '未知'));
|
|
157
|
+
}
|
|
158
|
+
return [3 /*break*/, 6];
|
|
159
|
+
case 6:
|
|
146
160
|
if (event.stoped) {
|
|
147
|
-
return [3 /*break*/,
|
|
161
|
+
return [3 /*break*/, 8];
|
|
148
162
|
}
|
|
149
|
-
|
|
150
|
-
case
|
|
163
|
+
_c.label = 7;
|
|
164
|
+
case 7:
|
|
151
165
|
actions_1_1 = actions_1.next();
|
|
152
166
|
return [3 /*break*/, 2];
|
|
153
|
-
case
|
|
154
|
-
case
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return [3 /*break*/,
|
|
158
|
-
case
|
|
167
|
+
case 8: return [3 /*break*/, 11];
|
|
168
|
+
case 9:
|
|
169
|
+
e_2_1 = _c.sent();
|
|
170
|
+
e_2 = { error: e_2_1 };
|
|
171
|
+
return [3 /*break*/, 11];
|
|
172
|
+
case 10:
|
|
159
173
|
try {
|
|
160
174
|
if (actions_1_1 && !actions_1_1.done && (_a = actions_1.return)) _a.call(actions_1);
|
|
161
175
|
}
|
|
162
|
-
finally { if (
|
|
176
|
+
finally { if (e_2) throw e_2.error; }
|
|
163
177
|
return [7 /*endfinally*/];
|
|
164
|
-
case
|
|
178
|
+
case 11: return [2 /*return*/];
|
|
165
179
|
}
|
|
166
180
|
});
|
|
167
181
|
}); };
|
|
@@ -218,7 +232,7 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
218
232
|
action.drawer = __assign({}, ((_e = action.drawer) !== null && _e !== void 0 ? _e : (_f = action.args) === null || _f === void 0 ? void 0 : _f.drawer));
|
|
219
233
|
(_g = action.args) === null || _g === void 0 ? true : delete _g.drawer;
|
|
220
234
|
}
|
|
221
|
-
else if (action.actionType
|
|
235
|
+
else if (['ajax', 'download'].includes(action.actionType)) {
|
|
222
236
|
api = (_h = action.api) !== null && _h !== void 0 ? _h : (_j = action.args) === null || _j === void 0 ? void 0 : _j.api;
|
|
223
237
|
action.api = typeof api === 'string' ? api : __assign({}, api);
|
|
224
238
|
action.options = __assign({}, ((_k = action.options) !== null && _k !== void 0 ? _k : (_l = action.args) === null || _l === void 0 ? void 0 : _l.options));
|
|
@@ -240,7 +254,10 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
240
254
|
actionData = args && Object.keys(args).length
|
|
241
255
|
? omit(__assign(__assign({}, args), (afterMappingData !== null && afterMappingData !== void 0 ? afterMappingData : {})), getOmitActionProp(action.actionType))
|
|
242
256
|
: afterMappingData;
|
|
243
|
-
data = actionData !== undefined
|
|
257
|
+
data = actionData !== undefined &&
|
|
258
|
+
!['ajax', 'download', 'dialog', 'drawer'].includes(action.actionType) // 避免非法配置影响对actionData的判断,导致动作配置中的数据映射失败
|
|
259
|
+
? actionData
|
|
260
|
+
: mergeData;
|
|
244
261
|
(_s = console.group) === null || _s === void 0 ? void 0 : _s.call(console, "run action ".concat(action.actionType));
|
|
245
262
|
console.debug("[".concat(action.actionType, "] action args, data"), args, data);
|
|
246
263
|
stopped = false;
|
|
@@ -250,6 +267,7 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
250
267
|
// 二次确认弹窗如果取消,则终止后续动作
|
|
251
268
|
if ((action === null || action === void 0 ? void 0 : action.actionType) === 'confirmDialog' && !actionResult) {
|
|
252
269
|
stopped = true;
|
|
270
|
+
preventDefault = true; // 这种对表单项change比较有意义,例如switch切换时弹确认弹窗,如果取消后不能把switch修改了
|
|
253
271
|
}
|
|
254
272
|
stopPropagation = false;
|
|
255
273
|
if (!action.stopPropagation) return [3 /*break*/, 7];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.4.0-beta.12
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __awaiter, __generator, __assign } from 'tslib';
|
|
7
|
-
import { normalizeApiResponseData } from '../utils/api.js';
|
|
7
|
+
import { normalizeApiResponseData, normalizeApi } from '../utils/api.js';
|
|
8
8
|
import { ServerError } from '../utils/errors.js';
|
|
9
9
|
import { isEmpty } from '../utils/helper.js';
|
|
10
10
|
import { registerAction } from './Action.js';
|
|
@@ -25,7 +25,7 @@ var AjaxAction = /** @class */ (function () {
|
|
|
25
25
|
AjaxAction.prototype.run = function (action, renderer, event) {
|
|
26
26
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
27
27
|
return __awaiter(this, void 0, void 0, function () {
|
|
28
|
-
var env, silent, messages, result, responseData, msg, e_1, result;
|
|
28
|
+
var env, silent, messages, api, result, responseData, msg, e_1, result;
|
|
29
29
|
var _o;
|
|
30
30
|
return __generator(this, function (_p) {
|
|
31
31
|
switch (_p.label) {
|
|
@@ -33,6 +33,9 @@ var AjaxAction = /** @class */ (function () {
|
|
|
33
33
|
if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.fetcher)) {
|
|
34
34
|
throw new Error('env.fetcher is required!');
|
|
35
35
|
}
|
|
36
|
+
if (!action.api) {
|
|
37
|
+
throw new Error('api is required!');
|
|
38
|
+
}
|
|
36
39
|
if (this.fetcherType === 'download' && action.actionType === 'download') {
|
|
37
40
|
if (action.api) {
|
|
38
41
|
action.api.responseType = 'blob';
|
|
@@ -41,10 +44,15 @@ var AjaxAction = /** @class */ (function () {
|
|
|
41
44
|
env = event.context.env;
|
|
42
45
|
silent = (_b = action === null || action === void 0 ? void 0 : action.options) === null || _b === void 0 ? void 0 : _b.silent;
|
|
43
46
|
messages = (_c = action === null || action === void 0 ? void 0 : action.api) === null || _c === void 0 ? void 0 : _c.messages;
|
|
47
|
+
api = normalizeApi(action.api);
|
|
48
|
+
// 如果没配置data数据映射,则给一个空对象,避免将当前数据域作为接口请求参数
|
|
49
|
+
if ((api === null || api === void 0 ? void 0 : api.data) == undefined) {
|
|
50
|
+
api = __assign(__assign({}, api), { data: {} });
|
|
51
|
+
}
|
|
44
52
|
_p.label = 1;
|
|
45
53
|
case 1:
|
|
46
54
|
_p.trys.push([1, 3, , 4]);
|
|
47
|
-
return [4 /*yield*/, env.fetcher(
|
|
55
|
+
return [4 /*yield*/, env.fetcher(api, (_d = action.data) !== null && _d !== void 0 ? _d : {}, (_e = action === null || action === void 0 ? void 0 : action.options) !== null && _e !== void 0 ? _e : {})];
|
|
48
56
|
case 2:
|
|
49
57
|
result = _p.sent();
|
|
50
58
|
responseData = !isEmpty(result.data) || result.ok
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.4.0-beta.12
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ var CmptAction = /** @class */ (function () {
|
|
|
21
21
|
CmptAction.prototype.run = function (action, renderer, event) {
|
|
22
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
23
23
|
return __awaiter(this, void 0, void 0, function () {
|
|
24
|
-
var key, dataMergeMode, component, beforeSetData, path, res, result, e_1;
|
|
24
|
+
var key, dataMergeMode, component, msg, beforeSetData, path, res, result, e_1;
|
|
25
25
|
var _s, _t;
|
|
26
26
|
return __generator(this, function (_u) {
|
|
27
27
|
switch (_u.label) {
|
|
@@ -32,7 +32,13 @@ var CmptAction = /** @class */ (function () {
|
|
|
32
32
|
? (_a = event.context.scoped) === null || _a === void 0 ? void 0 : _a[action.componentId ? 'getComponentById' : 'getComponentByName'](key)
|
|
33
33
|
: null;
|
|
34
34
|
if (key && !component) {
|
|
35
|
-
|
|
35
|
+
msg = '尝试执行一个不存在的目标组件动作,请检查目标组件非隐藏状态,且正确指定了componentId或componentName';
|
|
36
|
+
if (action.ignoreError === false) {
|
|
37
|
+
throw Error(msg);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
console.warn(msg);
|
|
41
|
+
}
|
|
36
42
|
}
|
|
37
43
|
if (!(action.actionType === 'setValue')) return [3 /*break*/, 3];
|
|
38
44
|
beforeSetData = (_c = (_b = renderer === null || renderer === void 0 ? void 0 : renderer.props) === null || _b === void 0 ? void 0 : _b.env) === null || _c === void 0 ? void 0 : _c.beforeSetData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.4.0-beta.12
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -102,7 +102,8 @@ var PopOver = /** @class */ (function (_super) {
|
|
|
102
102
|
var _a = this.props; _a.placement; var activePlacement = _a.activePlacement, positionTop = _a.positionTop, positionLeft = _a.positionLeft; _a.arrowOffsetLeft; _a.arrowOffsetTop; var style = _a.style, children = _a.children; _a.offset; var overlay = _a.overlay, onHide = _a.onHide, ns = _a.classPrefix, cx = _a.classnames, className = _a.className, rest = __rest(_a, ["placement", "activePlacement", "positionTop", "positionLeft", "arrowOffsetLeft", "arrowOffsetTop", "style", "children", "offset", "overlay", "onHide", "classPrefix", "classnames", "className"]);
|
|
103
103
|
var _b = this.state, xOffset = _b.xOffset, yOffset = _b.yOffset;
|
|
104
104
|
var outerStyle = __assign(__assign({ display: 'block' }, style), { top: positionTop + yOffset, left: positionLeft + xOffset });
|
|
105
|
-
|
|
105
|
+
var placements = typeof activePlacement === 'string' ? activePlacement.split('-') : [];
|
|
106
|
+
return (React.createElement("div", __assign({ ref: this.wrapperRef, className: cx("PopOver", className, "PopOver--".concat(camel(activePlacement)), placements[3] ? "PopOver--v-".concat(placements[3]) : ''), style: outerStyle }, rest),
|
|
106
107
|
overlay ? (React.createElement("div", { className: "".concat(ns, "PopOver-overlay"), onClick: onHide })) : null,
|
|
107
108
|
children));
|
|
108
109
|
};
|
package/esm/env.d.ts
CHANGED
|
@@ -57,7 +57,9 @@ export interface RendererEnv {
|
|
|
57
57
|
richTextToken: string;
|
|
58
58
|
loadRenderer: (schema: Schema, path: string, reRender: Function) => Promise<React.ElementType> | React.ElementType | JSX.Element | void;
|
|
59
59
|
loadChartExtends?: () => void | Promise<void>;
|
|
60
|
+
loadTinymcePlugin?: (tinymce: any) => void | Promise<void>;
|
|
60
61
|
useMobileUI?: boolean;
|
|
62
|
+
isMobile: () => boolean;
|
|
61
63
|
/**
|
|
62
64
|
* 过滤 html 标签,可用来添加 xss 保护逻辑
|
|
63
65
|
*/
|
package/esm/env.js
CHANGED
package/esm/envOverwrite.js
CHANGED
package/esm/factory.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface RendererProps extends ThemeProps, LocaleProps, OnEventProps, St
|
|
|
37
37
|
[propName: string]: any;
|
|
38
38
|
};
|
|
39
39
|
onBroadcast?: (type: string, rawEvent: RendererEvent<any>, ctx: any) => any;
|
|
40
|
+
mobileUI?: boolean;
|
|
40
41
|
[propName: string]: any;
|
|
41
42
|
}
|
|
42
43
|
export type RendererComponent = React.ComponentType<RendererProps> & {
|
package/esm/factory.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.4.0-beta.12
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ import { RendererStore } from './store/index.js';
|
|
|
9
9
|
import { destroy, getEnv } from 'mobx-state-tree';
|
|
10
10
|
import { wrapFetcher } from './utils/api.js';
|
|
11
11
|
import { normalizeLink } from './utils/normalizeLink.js';
|
|
12
|
-
import { qsparse, parseQuery, findIndex, promisify } from './utils/helper.js';
|
|
12
|
+
import { qsparse, parseQuery, isMobile, findIndex, promisify } from './utils/helper.js';
|
|
13
13
|
import { observer } from 'mobx-react';
|
|
14
14
|
import { HocScoped } from './Scoped.js';
|
|
15
15
|
import find from 'lodash/find';
|
|
@@ -203,7 +203,8 @@ var defaultOptions = {
|
|
|
203
203
|
/**
|
|
204
204
|
* 过滤 html 标签,可用来添加 xss 保护逻辑
|
|
205
205
|
*/
|
|
206
|
-
filterHtml: function (input) { return input; }
|
|
206
|
+
filterHtml: function (input) { return input; },
|
|
207
|
+
isMobile: isMobile
|
|
207
208
|
};
|
|
208
209
|
var stores = {};
|
|
209
210
|
// 默认 env 会被缓存,所以新传入的 env 不会替换旧的。
|