amis-core 2.0.0-rc.9 → 2.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.
- package/esm/Root.js +3 -2
- 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/_virtual/index.js +8 -0
- package/esm/_virtual/index2.js +8 -0
- package/esm/_virtual/react-is.development.js +8 -0
- package/esm/_virtual/react-is.production.min.js +8 -0
- package/esm/actions/Action.js +9 -5
- package/esm/actions/AjaxAction.d.ts +2 -0
- package/esm/actions/AjaxAction.js +24 -16
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +1 -1
- package/esm/actions/Decorators.d.ts +1 -1
- package/esm/actions/Decorators.js +14 -7
- 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.d.ts +41 -0
- package/esm/components/Overlay.js +234 -0
- package/esm/components/PopOver.d.ts +90 -0
- package/esm/components/PopOver.js +118 -0
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +3 -1
- package/esm/index.js +3 -1
- package/esm/index2.js +6 -2
- package/esm/locale.js +1 -1
- package/esm/node_modules/@restart/hooks/esm/useCommittedRef.js +1 -1
- package/esm/node_modules/@restart/hooks/esm/useEventCallback.js +1 -1
- package/esm/node_modules/dom-helpers/esm/addEventListener.js +1 -1
- package/esm/node_modules/dom-helpers/esm/canUseDOM.js +1 -1
- package/esm/node_modules/dom-helpers/esm/contains.js +1 -1
- package/esm/node_modules/dom-helpers/esm/listen.js +1 -1
- package/esm/node_modules/dom-helpers/esm/ownerDocument.js +1 -1
- package/esm/node_modules/dom-helpers/esm/removeEventListener.js +1 -1
- package/esm/node_modules/object-assign/index.js +104 -0
- package/esm/node_modules/prop-types/checkPropTypes.js +120 -0
- package/esm/node_modules/prop-types/factoryWithThrowingShims.js +79 -0
- package/esm/node_modules/prop-types/factoryWithTypeCheckers.js +630 -0
- package/esm/node_modules/prop-types/index.js +32 -0
- package/esm/node_modules/prop-types/lib/ReactPropTypesSecret.js +26 -0
- package/esm/node_modules/prop-types/lib/has.js +16 -0
- package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +195 -0
- package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +31 -0
- package/esm/node_modules/prop-types/node_modules/react-is/index.js +26 -0
- package/esm/node_modules/react-overlays/esm/Portal.js +35 -0
- package/esm/node_modules/react-overlays/esm/ownerDocument.js +1 -1
- package/esm/node_modules/react-overlays/esm/safeFindDOMNode.js +1 -1
- package/esm/node_modules/react-overlays/esm/useRootClose.js +1 -1
- package/esm/node_modules/react-overlays/esm/useWaitForDOMRef.js +46 -0
- package/esm/node_modules/warning/warning.js +1 -1
- package/esm/renderers/Form.d.ts +10 -4
- package/esm/renderers/Form.js +260 -249
- package/esm/renderers/Item.d.ts +89 -3
- package/esm/renderers/Item.js +253 -40
- package/esm/renderers/Options.js +13 -9
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/wrapControl.js +1 -1
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +1837 -143
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +3 -0
- package/esm/store/crud.js +37 -10
- package/esm/store/form.d.ts +856 -9
- package/esm/store/form.js +49 -12
- package/esm/store/formItem.d.ts +3 -1
- package/esm/store/formItem.js +5 -7
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +2 -0
- package/esm/store/list.js +9 -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-v2.d.ts +1 -0
- package/esm/store/table-v2.js +19 -3
- package/esm/store/table.d.ts +1818 -132
- package/esm/store/table.js +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +1 -1
- 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.d.ts +5 -1
- package/esm/utils/DataScope.js +18 -7
- 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 +8 -2
- 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 +1 -1
- package/esm/utils/helper.js +6 -4
- 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 +14 -4
- 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.js +1 -1
- 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/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 +3 -2
- 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/_virtual/index.js +12 -0
- package/lib/_virtual/index2.js +12 -0
- package/lib/_virtual/react-is.development.js +12 -0
- package/lib/_virtual/react-is.production.min.js +12 -0
- package/lib/actions/Action.js +8 -4
- package/lib/actions/AjaxAction.d.ts +2 -0
- package/lib/actions/AjaxAction.js +24 -16
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +1 -1
- package/lib/actions/Decorators.d.ts +1 -1
- package/lib/actions/Decorators.js +14 -7
- 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.d.ts +41 -0
- package/lib/components/Overlay.js +244 -0
- package/lib/components/PopOver.d.ts +90 -0
- package/lib/components/PopOver.js +127 -0
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +2 -2
- package/lib/index.d.ts +3 -1
- package/lib/index.js +5 -1
- package/lib/index2.js +8 -4
- package/lib/locale.js +1 -1
- package/lib/node_modules/@restart/hooks/esm/useCommittedRef.js +1 -1
- package/lib/node_modules/@restart/hooks/esm/useEventCallback.js +1 -1
- package/lib/node_modules/dom-helpers/esm/addEventListener.js +1 -1
- package/lib/node_modules/dom-helpers/esm/canUseDOM.js +1 -1
- package/lib/node_modules/dom-helpers/esm/contains.js +1 -1
- package/lib/node_modules/dom-helpers/esm/listen.js +1 -1
- package/lib/node_modules/dom-helpers/esm/ownerDocument.js +1 -1
- package/lib/node_modules/dom-helpers/esm/removeEventListener.js +1 -1
- package/lib/node_modules/object-assign/index.js +108 -0
- package/lib/node_modules/prop-types/checkPropTypes.js +124 -0
- package/lib/node_modules/prop-types/factoryWithThrowingShims.js +83 -0
- package/lib/node_modules/prop-types/factoryWithTypeCheckers.js +634 -0
- package/lib/node_modules/prop-types/index.js +35 -0
- package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js +30 -0
- package/lib/node_modules/prop-types/lib/has.js +20 -0
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +199 -0
- package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +35 -0
- package/lib/node_modules/prop-types/node_modules/react-is/index.js +30 -0
- package/lib/node_modules/react-overlays/esm/Portal.js +44 -0
- package/lib/node_modules/react-overlays/esm/ownerDocument.js +1 -1
- package/lib/node_modules/react-overlays/esm/safeFindDOMNode.js +1 -1
- package/lib/node_modules/react-overlays/esm/useRootClose.js +1 -1
- package/lib/node_modules/react-overlays/esm/useWaitForDOMRef.js +51 -0
- package/lib/node_modules/warning/warning.js +1 -1
- package/lib/renderers/Form.d.ts +10 -4
- package/lib/renderers/Form.js +260 -249
- package/lib/renderers/Item.d.ts +89 -3
- package/lib/renderers/Item.js +252 -39
- package/lib/renderers/Options.js +12 -8
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/wrapControl.js +1 -1
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +1837 -143
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +3 -0
- package/lib/store/crud.js +37 -10
- package/lib/store/form.d.ts +856 -9
- package/lib/store/form.js +50 -12
- package/lib/store/formItem.d.ts +3 -1
- package/lib/store/formItem.js +5 -7
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +2 -0
- package/lib/store/list.js +9 -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-v2.d.ts +1 -0
- package/lib/store/table-v2.js +19 -3
- package/lib/store/table.d.ts +1818 -132
- package/lib/store/table.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +1 -1
- 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.d.ts +5 -1
- package/lib/utils/DataScope.js +17 -6
- 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 +8 -2
- 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 +1 -1
- package/lib/utils/helper.js +6 -4
- 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 +14 -4
- 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.js +1 -1
- 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/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 +4 -2
package/esm/Root.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.0.0
|
|
2
|
+
* amis-core v2.0.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -55,8 +55,9 @@ var Root = /** @class */ (function (_super) {
|
|
|
55
55
|
}(React.Component));
|
|
56
56
|
function renderChildren(prefix, node, props) {
|
|
57
57
|
if (Array.isArray(node)) {
|
|
58
|
+
var elemKey = props.key || props.propKey || props.id || '';
|
|
58
59
|
return node.map(function (node, index) {
|
|
59
|
-
return renderChild("".concat(prefix, "/").concat(index), node, __assign(__assign({}, props), { key: "".concat(
|
|
60
|
+
return renderChild("".concat(prefix, "/").concat(index), node, __assign(__assign({}, props), { key: "".concat(elemKey ? "".concat(elemKey, "-") : '').concat(index) }));
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
return renderChild(prefix, node, props);
|
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,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.0.0
|
|
2
|
+
* amis-core v2.0.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,7 +8,7 @@ import '../utils/helper.js';
|
|
|
8
8
|
import { evalExpression } from '../utils/tpl.js';
|
|
9
9
|
import 'amis-formula';
|
|
10
10
|
import 'moment';
|
|
11
|
-
import {
|
|
11
|
+
import { createObject } from '../utils/object.js';
|
|
12
12
|
import { dataMapping } from '../utils/dataMapping.js';
|
|
13
13
|
import '../utils/filter.js';
|
|
14
14
|
|
|
@@ -80,9 +80,13 @@ var runAction = function (actionInstrance, actionConfig, renderer, event) { retu
|
|
|
80
80
|
return __generator(this, function (_b) {
|
|
81
81
|
switch (_b.label) {
|
|
82
82
|
case 0:
|
|
83
|
-
mergeData =
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
mergeData = renderer.props.data.__super
|
|
84
|
+
? createObject(createObject(renderer.props.data.__super, {
|
|
85
|
+
event: event
|
|
86
|
+
}), renderer.props.data)
|
|
87
|
+
: createObject({
|
|
88
|
+
event: event
|
|
89
|
+
}, renderer.props.data);
|
|
86
90
|
expression = (_a = actionConfig.expression) !== null && _a !== void 0 ? _a : actionConfig.execOn;
|
|
87
91
|
if (expression && !evalExpression(expression, mergeData)) {
|
|
88
92
|
return [2 /*return*/];
|
|
@@ -21,5 +21,7 @@ export interface IAjaxAction extends ListenerAction {
|
|
|
21
21
|
* @implements {Action}
|
|
22
22
|
*/
|
|
23
23
|
export declare class AjaxAction implements RendererAction {
|
|
24
|
+
fetcherType: string;
|
|
25
|
+
constructor(fetcherType?: string);
|
|
24
26
|
run(action: IAjaxAction, renderer: ListenerContext, event: RendererEvent<any>): Promise<any>;
|
|
25
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.0.0
|
|
2
|
+
* amis-core v2.0.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -19,39 +19,46 @@ import { createObject } from '../utils/object.js';
|
|
|
19
19
|
* @implements {Action}
|
|
20
20
|
*/
|
|
21
21
|
var AjaxAction = /** @class */ (function () {
|
|
22
|
-
function AjaxAction() {
|
|
22
|
+
function AjaxAction(fetcherType) {
|
|
23
|
+
if (fetcherType === void 0) { fetcherType = 'ajax'; }
|
|
24
|
+
this.fetcherType = fetcherType;
|
|
23
25
|
}
|
|
24
26
|
AjaxAction.prototype.run = function (action, renderer, event) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
26
28
|
return __awaiter(this, void 0, void 0, function () {
|
|
27
29
|
var env, result, responseData, msg, e_1, result;
|
|
28
|
-
var
|
|
29
|
-
return __generator(this, function (
|
|
30
|
-
switch (
|
|
30
|
+
var _o;
|
|
31
|
+
return __generator(this, function (_p) {
|
|
32
|
+
switch (_p.label) {
|
|
31
33
|
case 0:
|
|
32
34
|
if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.fetcher)) {
|
|
33
35
|
throw new Error('env.fetcher is required!');
|
|
34
36
|
}
|
|
37
|
+
if (this.fetcherType === 'download' && action.actionType === 'download') {
|
|
38
|
+
if ((_b = action.args) === null || _b === void 0 ? void 0 : _b.api) {
|
|
39
|
+
action.args.api.responseType = 'blob';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
35
42
|
env = event.context.env;
|
|
36
|
-
|
|
43
|
+
_p.label = 1;
|
|
37
44
|
case 1:
|
|
38
|
-
|
|
39
|
-
return [4 /*yield*/, env.fetcher((
|
|
45
|
+
_p.trys.push([1, 3, , 4]);
|
|
46
|
+
return [4 /*yield*/, env.fetcher((_c = action.args) === null || _c === void 0 ? void 0 : _c.api, omit((_d = action.args) !== null && _d !== void 0 ? _d : {}, ['api', 'options', 'messages']), (_f = (_e = action.args) === null || _e === void 0 ? void 0 : _e.options) !== null && _f !== void 0 ? _f : {})];
|
|
40
47
|
case 2:
|
|
41
|
-
result =
|
|
48
|
+
result = _p.sent();
|
|
42
49
|
if (!isEmpty(result.data) || result.ok) {
|
|
43
50
|
responseData = normalizeApiResponseData(result.data);
|
|
44
51
|
// 记录请求返回的数据
|
|
45
52
|
event.setData(createObject(event.data, action.outputVar
|
|
46
|
-
? (
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
? (_o = {},
|
|
54
|
+
_o["".concat(action.outputVar)] = responseData,
|
|
55
|
+
_o) : responseData));
|
|
49
56
|
}
|
|
50
57
|
if (!result.ok) {
|
|
51
|
-
throw new ServerError((
|
|
58
|
+
throw new ServerError((_j = (_h = (_g = action.args) === null || _g === void 0 ? void 0 : _g.messages) === null || _h === void 0 ? void 0 : _h.failed) !== null && _j !== void 0 ? _j : result.msg, result);
|
|
52
59
|
}
|
|
53
60
|
else {
|
|
54
|
-
msg = (
|
|
61
|
+
msg = (_m = (_l = (_k = action.args) === null || _k === void 0 ? void 0 : _k.messages) === null || _l === void 0 ? void 0 : _l.success) !== null && _m !== void 0 ? _m : result.msg;
|
|
55
62
|
msg &&
|
|
56
63
|
env.notify('success', msg, result.msgTimeout !== undefined
|
|
57
64
|
? {
|
|
@@ -62,7 +69,7 @@ var AjaxAction = /** @class */ (function () {
|
|
|
62
69
|
}
|
|
63
70
|
return [2 /*return*/, result.data];
|
|
64
71
|
case 3:
|
|
65
|
-
e_1 =
|
|
72
|
+
e_1 = _p.sent();
|
|
66
73
|
if (e_1.type === 'ServerError') {
|
|
67
74
|
result = e_1.response;
|
|
68
75
|
env.notify('error', e_1.message, result.msgTimeout !== undefined
|
|
@@ -84,5 +91,6 @@ var AjaxAction = /** @class */ (function () {
|
|
|
84
91
|
return AjaxAction;
|
|
85
92
|
}());
|
|
86
93
|
registerAction('ajax', new AjaxAction());
|
|
94
|
+
registerAction('download', new AjaxAction('download'));
|
|
87
95
|
|
|
88
96
|
export { AjaxAction };
|
|
@@ -15,7 +15,7 @@ export declare function rendererEventDispatcher<T extends FormControlProps, E =
|
|
|
15
15
|
* @param ctx 上下文数据
|
|
16
16
|
* @returns {Function}
|
|
17
17
|
*/
|
|
18
|
-
export declare function bindRendererEvent<T extends FormControlProps, E = any>(event: E, ctx?: Record<string, any
|
|
18
|
+
export declare function bindRendererEvent<T extends FormControlProps, E = any>(event: E, ctx?: Record<string, any>, preventable?: boolean): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<any>) => {
|
|
19
19
|
value: (...params: any[]) => Promise<any>;
|
|
20
20
|
enumerable?: boolean | undefined;
|
|
21
21
|
configurable?: boolean | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.0.0
|
|
2
|
+
* amis-core v2.0.0
|
|
3
3
|
* Copyright 2018-2022 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -31,7 +31,8 @@ function rendererEventDispatcher(props, e, ctx) {
|
|
|
31
31
|
* @param ctx 上下文数据
|
|
32
32
|
* @returns {Function}
|
|
33
33
|
*/
|
|
34
|
-
function bindRendererEvent(event, ctx) {
|
|
34
|
+
function bindRendererEvent(event, ctx, preventable) {
|
|
35
|
+
if (preventable === void 0) { preventable = true; }
|
|
35
36
|
return function (target, propertyKey, descriptor) {
|
|
36
37
|
var fn = descriptor.value && typeof descriptor.value === 'function'
|
|
37
38
|
? descriptor.value
|
|
@@ -57,15 +58,21 @@ function bindRendererEvent(event, ctx) {
|
|
|
57
58
|
if (typeof event === 'string' && event === 'clear') {
|
|
58
59
|
value = triggerProps === null || triggerProps === void 0 ? void 0 : triggerProps.resetValue;
|
|
59
60
|
}
|
|
60
|
-
return [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
if (!(preventable === false)) return [3 /*break*/, 1];
|
|
62
|
+
rendererEventDispatcher(triggerProps, event, {
|
|
63
|
+
value: value
|
|
64
|
+
});
|
|
65
|
+
return [3 /*break*/, 3];
|
|
66
|
+
case 1: return [4 /*yield*/, rendererEventDispatcher(triggerProps, event, {
|
|
67
|
+
value: value
|
|
68
|
+
})];
|
|
69
|
+
case 2:
|
|
64
70
|
dispatcher = _a.sent();
|
|
65
71
|
if (dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented) {
|
|
66
72
|
return [2 /*return*/];
|
|
67
73
|
}
|
|
68
|
-
|
|
74
|
+
_a.label = 3;
|
|
75
|
+
case 3: return [2 /*return*/, fn.apply(this, __spreadArray([], params, true))];
|
|
69
76
|
}
|
|
70
77
|
});
|
|
71
78
|
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Overlay
|
|
3
|
+
* @description
|
|
4
|
+
* @author fex
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
interface OverlayProps {
|
|
8
|
+
placement?: string;
|
|
9
|
+
show?: boolean;
|
|
10
|
+
transition?: React.ElementType;
|
|
11
|
+
containerPadding?: number;
|
|
12
|
+
shouldUpdatePosition?: boolean;
|
|
13
|
+
rootClose?: boolean;
|
|
14
|
+
onHide?(props: any, ...args: any[]): any;
|
|
15
|
+
container?: React.ReactNode | Function;
|
|
16
|
+
target?: React.ReactNode | Function;
|
|
17
|
+
watchTargetSizeChange?: boolean;
|
|
18
|
+
offset?: [number, number];
|
|
19
|
+
onEnter?(node: HTMLElement): any;
|
|
20
|
+
onEntering?(node: HTMLElement): any;
|
|
21
|
+
onEntered?(node: HTMLElement): any;
|
|
22
|
+
onExit?(node: HTMLElement): any;
|
|
23
|
+
onExiting?(node: HTMLElement): any;
|
|
24
|
+
onExited?(node: HTMLElement): any;
|
|
25
|
+
}
|
|
26
|
+
interface OverlayState {
|
|
27
|
+
exited: boolean;
|
|
28
|
+
}
|
|
29
|
+
export default class Overlay extends React.Component<OverlayProps, OverlayState> {
|
|
30
|
+
static defaultProps: {
|
|
31
|
+
placement: string;
|
|
32
|
+
};
|
|
33
|
+
constructor(props: OverlayProps);
|
|
34
|
+
position: any;
|
|
35
|
+
positionRef: (position: any) => void;
|
|
36
|
+
updatePosition(): void;
|
|
37
|
+
componentDidUpdate(prevProps: OverlayProps): void;
|
|
38
|
+
onHiddenListener(node: HTMLElement): void;
|
|
39
|
+
render(): JSX.Element | null;
|
|
40
|
+
}
|
|
41
|
+
export {};
|