amis-core 3.6.2 → 6.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 +1 -1
- package/esm/RootRenderer.js +1 -1
- package/esm/SchemaRenderer.js +1 -1
- package/esm/Scoped.js +2 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.js +31 -27
- 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.js +65 -26
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +3 -2
- 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/ErrorBoundary.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +2 -1
- package/esm/components/Overlay.js +21 -6
- package/esm/components/PopOver.js +6 -3
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +1 -1
- package/esm/index.js +4 -2
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.js +125 -111
- package/esm/renderers/Item.js +4 -3
- package/esm/renderers/Options.js +163 -49
- 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 +4 -3
- package/esm/store/app.d.ts +2 -2
- package/esm/store/app.js +3 -2
- package/esm/store/combo.d.ts +7 -7
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +3 -2
- package/esm/store/crud.js +18 -4
- package/esm/store/form.d.ts +3 -3
- package/esm/store/form.js +5 -5
- package/esm/store/formItem.js +1 -1
- package/esm/store/iRenderer.d.ts +1 -1
- package/esm/store/iRenderer.js +7 -2
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -1
- package/esm/store/list.js +18 -13
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +2 -2
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +2 -1
- package/esm/store/pagination.js +3 -2
- package/esm/store/root.d.ts +2 -2
- package/esm/store/root.js +3 -2
- package/esm/store/service.d.ts +2 -2
- package/esm/store/service.js +11 -7
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +7 -7
- package/esm/store/table.js +26 -11
- package/esm/store/table2.d.ts +14 -3
- package/esm/store/table2.js +22 -9
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +7 -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/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/browser.d.ts +1 -0
- package/esm/utils/browser.js +11 -0
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/concatData.d.ts +8 -0
- package/esm/utils/concatData.js +39 -0
- 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 +6 -1
- package/esm/utils/helper.js +23 -6
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +2 -0
- 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.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +19 -3
- 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 +4 -6
- 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 +2 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.js +31 -27
- 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.js +65 -26
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +3 -2
- 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/ErrorBoundary.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +2 -1
- package/lib/components/Overlay.js +21 -5
- package/lib/components/PopOver.js +6 -3
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +1 -1
- package/lib/index.js +6 -2
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.js +125 -111
- package/lib/renderers/Item.js +4 -3
- package/lib/renderers/Options.js +163 -49
- 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 +4 -3
- package/lib/store/app.d.ts +2 -2
- package/lib/store/app.js +3 -2
- package/lib/store/combo.d.ts +7 -7
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +3 -2
- package/lib/store/crud.js +18 -4
- package/lib/store/form.d.ts +3 -3
- package/lib/store/form.js +5 -5
- package/lib/store/formItem.js +1 -1
- package/lib/store/iRenderer.d.ts +1 -1
- package/lib/store/iRenderer.js +7 -2
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -1
- package/lib/store/list.js +18 -14
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +2 -2
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +2 -1
- package/lib/store/pagination.js +3 -2
- package/lib/store/root.d.ts +2 -2
- package/lib/store/root.js +3 -2
- package/lib/store/service.d.ts +2 -2
- package/lib/store/service.js +11 -7
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +7 -7
- package/lib/store/table.js +26 -12
- package/lib/store/table2.d.ts +14 -3
- package/lib/store/table2.js +22 -9
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +7 -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/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/browser.d.ts +1 -0
- package/lib/utils/browser.js +15 -0
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/concatData.d.ts +8 -0
- package/lib/utils/concatData.js +43 -0
- 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 +6 -1
- package/lib/utils/helper.js +23 -6
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +2 -0
- 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.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +19 -3
- 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 +4 -6
- 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 +4 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,10 +8,11 @@ import React from 'react';
|
|
|
8
8
|
import { findDOMNode } from 'react-dom';
|
|
9
9
|
import { themeable } from '../theme.js';
|
|
10
10
|
import '../utils/api.js';
|
|
11
|
+
import '../utils/browser.js';
|
|
11
12
|
import '../utils/ColorScale.js';
|
|
12
13
|
import 'lodash/chunk';
|
|
13
|
-
import 'amis-formula';
|
|
14
14
|
import 'lodash/isPlainObject';
|
|
15
|
+
import 'amis-formula';
|
|
15
16
|
import '../utils/DataSchema.js';
|
|
16
17
|
import '../utils/DataScope.js';
|
|
17
18
|
import 'moment';
|
|
@@ -42,6 +43,7 @@ import '../utils/validations.js';
|
|
|
42
43
|
import '../utils/resolveCondition.js';
|
|
43
44
|
import 'mobx';
|
|
44
45
|
import '../utils/Animation.js';
|
|
46
|
+
import { SubPopoverDisplayedID } from './Overlay.js';
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* @file PopOver
|
|
@@ -101,6 +103,7 @@ var PopOver = /** @class */ (function (_super) {
|
|
|
101
103
|
closeOnOutside &&
|
|
102
104
|
target &&
|
|
103
105
|
this.wrapperRef.current &&
|
|
106
|
+
!this.wrapperRef.current.getAttribute(SubPopoverDisplayedID) &&
|
|
104
107
|
((!this.wrapperRef.current.contains(target) &&
|
|
105
108
|
!target.closest('[role=dialog]')) ||
|
|
106
109
|
(target.matches(".".concat(ns, "Modal")) && target === this.wrapperRef.current))); // 干脆过滤掉来自弹框里面的点击
|
|
@@ -150,7 +153,7 @@ var PopOver = /** @class */ (function (_super) {
|
|
|
150
153
|
var _b = this.state, xOffset = _b.xOffset, yOffset = _b.yOffset;
|
|
151
154
|
var outerStyle = __assign(__assign({ display: 'block' }, style), { top: positionTop + yOffset, left: positionLeft + xOffset });
|
|
152
155
|
var placements = typeof activePlacement === 'string' ? activePlacement.split('-') : [];
|
|
153
|
-
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),
|
|
156
|
+
return (React.createElement("div", __assign({ ref: this.wrapperRef, role: "popover", className: cx("PopOver", className, "PopOver--".concat(camel(activePlacement)), placements[3] ? "PopOver--v-".concat(placements[3]) : ''), style: outerStyle }, rest),
|
|
154
157
|
overlay ? (React.createElement("div", { className: "".concat(ns, "PopOver-overlay"), onClick: onHide })) : null,
|
|
155
158
|
children));
|
|
156
159
|
};
|
package/esm/env.js
CHANGED
package/esm/envOverwrite.js
CHANGED
package/esm/factory.js
CHANGED
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -13,8 +13,10 @@ import { wrapFetcher } from './utils/api.js';
|
|
|
13
13
|
export { buildApi, callStrFunction, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher } from './utils/api.js';
|
|
14
14
|
export { attachmentAdpator } from './utils/attachmentAdpator.js';
|
|
15
15
|
export { autobindMethod, bind } from './utils/autobind.js';
|
|
16
|
+
export { chromeVersion } from './utils/browser.js';
|
|
16
17
|
export { ColorScale } from './utils/ColorScale.js';
|
|
17
18
|
export { columnsSplit } from './utils/columnsSplit.js';
|
|
19
|
+
export { concatData } from './utils/concatData.js';
|
|
18
20
|
export { dataMapping, resolveMapping, resolveMappingObject } from './utils/dataMapping.js';
|
|
19
21
|
export { DataSchema } from './utils/DataSchema.js';
|
|
20
22
|
export { DATASCHEMA_TYPE_MAP, DataScope } from './utils/DataScope.js';
|
|
@@ -141,7 +143,7 @@ export { StoreNode } from './store/node.js';
|
|
|
141
143
|
*/
|
|
142
144
|
var classPrefix = getClassPrefix();
|
|
143
145
|
// @ts-ignore
|
|
144
|
-
var version = '
|
|
146
|
+
var version = '6.0.0';
|
|
145
147
|
function render(schema, props, options, pathPrefix) {
|
|
146
148
|
if (props === void 0) { props = {}; }
|
|
147
149
|
if (options === void 0) { options = {}; }
|
package/esm/locale.js
CHANGED
package/esm/polyfills.js
CHANGED
package/esm/renderers/Form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -22,6 +22,7 @@ import '../utils/filter.js';
|
|
|
22
22
|
import { isEffectiveApi, isApiOutdated } from '../utils/api.js';
|
|
23
23
|
import LazyComponent from '../components/LazyComponent.js';
|
|
24
24
|
import { isAlive } from 'mobx-state-tree';
|
|
25
|
+
import '../utils/browser.js';
|
|
25
26
|
import '../utils/ColorScale.js';
|
|
26
27
|
import 'lodash/chunk';
|
|
27
28
|
import '../utils/DataSchema.js';
|
|
@@ -610,119 +611,132 @@ var Form = /** @class */ (function (_super) {
|
|
|
610
611
|
else if (action.actionType === 'clear-and-submit') {
|
|
611
612
|
store.clear(this.handleReset(action));
|
|
612
613
|
}
|
|
613
|
-
return [2 /*return*/, this.submit(function (values) {
|
|
614
|
+
return [2 /*return*/, this.submit(function (values) { return __awaiter(_this, void 0, void 0, function () {
|
|
615
|
+
var result, finnalAsyncApi_1;
|
|
614
616
|
var _a;
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
617
|
+
var _this = this;
|
|
618
|
+
return __generator(this, function (_b) {
|
|
619
|
+
switch (_b.label) {
|
|
620
|
+
case 0:
|
|
621
|
+
if (!onSubmit) return [3 /*break*/, 2];
|
|
622
|
+
return [4 /*yield*/, onSubmit(values, action)];
|
|
623
|
+
case 1:
|
|
624
|
+
result = _b.sent();
|
|
625
|
+
if (result === false) {
|
|
626
|
+
return [2 /*return*/, Promise.resolve(false)];
|
|
627
|
+
}
|
|
628
|
+
_b.label = 2;
|
|
629
|
+
case 2:
|
|
630
|
+
// 走到这里代表校验成功了
|
|
631
|
+
dispatchEvent_1('validateSucc', this.props.data);
|
|
632
|
+
if (target) {
|
|
633
|
+
this.submitToTarget(filterTarget(target, values), values);
|
|
634
|
+
/** 可能配置页面跳转事件,页面路由变化导致persistKey不一致,无法清除持久化数据,所以提交成功事件之前先清理一下 */
|
|
635
|
+
clearPersistDataAfterSubmit && store.clearLocalPersistData();
|
|
636
|
+
dispatchEvent_1('submitSucc', createObject(this.props.data, values));
|
|
637
|
+
}
|
|
638
|
+
else if (action.actionType === 'reload') {
|
|
639
|
+
action.target &&
|
|
640
|
+
this.reloadTarget(filterTarget(action.target, values), values);
|
|
641
|
+
}
|
|
642
|
+
else if (action.actionType === 'dialog') {
|
|
643
|
+
store.openDialog(data, undefined, action.callback, delegate || this.context);
|
|
644
|
+
}
|
|
645
|
+
else if (action.actionType === 'drawer') {
|
|
646
|
+
store.openDrawer(data);
|
|
647
|
+
}
|
|
648
|
+
else if (isEffectiveApi(action.api || api, values)) {
|
|
649
|
+
finnalAsyncApi_1 = action.asyncApi || asyncApi;
|
|
650
|
+
isEffectiveApi(finnalAsyncApi_1, store.data) &&
|
|
651
|
+
store.updateData((_a = {},
|
|
652
|
+
_a[finishedField || 'finished'] = false,
|
|
653
|
+
_a));
|
|
654
|
+
return [2 /*return*/, store
|
|
655
|
+
.saveRemote(action.api || api, values, {
|
|
656
|
+
successMessage: typeof saveSuccess === 'string'
|
|
657
|
+
? filter(saveSuccess, store.data)
|
|
658
|
+
: undefined,
|
|
659
|
+
errorMessage: typeof saveFailed === 'string'
|
|
660
|
+
? filter(saveFailed, store.data)
|
|
661
|
+
: undefined,
|
|
662
|
+
onSuccess: function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
663
|
+
var dispatcher, cbResult;
|
|
664
|
+
var _this = this;
|
|
665
|
+
return __generator(this, function (_a) {
|
|
666
|
+
switch (_a.label) {
|
|
667
|
+
case 0:
|
|
668
|
+
clearPersistDataAfterSubmit && store.clearLocalPersistData();
|
|
669
|
+
return [4 /*yield*/, dispatchEvent_1('submitSucc', createObject(this.props.data, { result: result }))];
|
|
670
|
+
case 1:
|
|
671
|
+
dispatcher = _a.sent();
|
|
672
|
+
if (!isEffectiveApi(finnalAsyncApi_1, store.data) ||
|
|
673
|
+
store.data[finishedField || 'finished']) {
|
|
674
|
+
return [2 /*return*/, {
|
|
675
|
+
cbResult: null,
|
|
676
|
+
dispatcher: dispatcher
|
|
677
|
+
}];
|
|
678
|
+
}
|
|
679
|
+
cbResult = until(function () { return store.checkRemote(finnalAsyncApi_1, store.data); }, function (ret) { return ret && ret[finishedField || 'finished']; }, function (cancel) { return (_this.asyncCancel = cancel); }, checkInterval).then(function (value) {
|
|
680
|
+
// 派发asyncApiFinished事件
|
|
681
|
+
dispatchEvent_1('asyncApiFinished', store.data);
|
|
682
|
+
});
|
|
683
|
+
return [2 /*return*/, {
|
|
684
|
+
cbResult: cbResult,
|
|
685
|
+
dispatcher: dispatcher
|
|
686
|
+
}];
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
}); },
|
|
690
|
+
onFailed: function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
691
|
+
var dispatcher;
|
|
692
|
+
return __generator(this, function (_a) {
|
|
693
|
+
switch (_a.label) {
|
|
694
|
+
case 0: return [4 /*yield*/, dispatchEvent_1('submitFail', createObject(this.props.data, { error: result }))];
|
|
695
|
+
case 1:
|
|
696
|
+
dispatcher = _a.sent();
|
|
697
|
+
return [2 /*return*/, {
|
|
698
|
+
dispatcher: dispatcher
|
|
699
|
+
}];
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
}); }
|
|
703
|
+
})
|
|
704
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
705
|
+
var feedback, confirmed;
|
|
706
|
+
return __generator(this, function (_a) {
|
|
707
|
+
switch (_a.label) {
|
|
708
|
+
case 0:
|
|
709
|
+
onSaved && onSaved(values, response);
|
|
710
|
+
feedback = action.feedback || this.props.feedback;
|
|
711
|
+
if (!(feedback && isVisible(feedback, store.data))) return [3 /*break*/, 2];
|
|
712
|
+
return [4 /*yield*/, this.openFeedback(feedback, store.data)];
|
|
713
|
+
case 1:
|
|
714
|
+
confirmed = _a.sent();
|
|
715
|
+
// 如果 feedback 配置了,取消就跳过原有逻辑。
|
|
716
|
+
if (feedback.skipRestOnCancel && !confirmed) {
|
|
717
|
+
throw new SkipOperation();
|
|
718
|
+
}
|
|
719
|
+
else if (feedback.skipRestOnConfirm && confirmed) {
|
|
720
|
+
throw new SkipOperation();
|
|
721
|
+
}
|
|
722
|
+
_a.label = 2;
|
|
723
|
+
case 2: return [2 /*return*/, injectObjectChain(store.data, {
|
|
724
|
+
__payload: values,
|
|
725
|
+
__response: response
|
|
726
|
+
})];
|
|
727
|
+
}
|
|
670
728
|
});
|
|
671
|
-
|
|
672
|
-
cbResult: cbResult,
|
|
673
|
-
dispatcher: dispatcher
|
|
674
|
-
}];
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
}); },
|
|
678
|
-
onFailed: function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
679
|
-
var dispatcher;
|
|
680
|
-
return __generator(this, function (_a) {
|
|
681
|
-
switch (_a.label) {
|
|
682
|
-
case 0: return [4 /*yield*/, dispatchEvent_1('submitFail', createObject(this.props.data, { error: result }))];
|
|
683
|
-
case 1:
|
|
684
|
-
dispatcher = _a.sent();
|
|
685
|
-
return [2 /*return*/, {
|
|
686
|
-
dispatcher: dispatcher
|
|
687
|
-
}];
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
}); }
|
|
691
|
-
})
|
|
692
|
-
.then(function (response) { return __awaiter(_this, void 0, void 0, function () {
|
|
693
|
-
var feedback, confirmed;
|
|
694
|
-
return __generator(this, function (_a) {
|
|
695
|
-
switch (_a.label) {
|
|
696
|
-
case 0:
|
|
697
|
-
onSaved && onSaved(values, response);
|
|
698
|
-
feedback = action.feedback || this.props.feedback;
|
|
699
|
-
if (!(feedback && isVisible(feedback, store.data))) return [3 /*break*/, 2];
|
|
700
|
-
return [4 /*yield*/, this.openFeedback(feedback, store.data)];
|
|
701
|
-
case 1:
|
|
702
|
-
confirmed = _a.sent();
|
|
703
|
-
// 如果 feedback 配置了,取消就跳过原有逻辑。
|
|
704
|
-
if (feedback.skipRestOnCancel && !confirmed) {
|
|
705
|
-
throw new SkipOperation();
|
|
706
|
-
}
|
|
707
|
-
else if (feedback.skipRestOnConfirm && confirmed) {
|
|
708
|
-
throw new SkipOperation();
|
|
709
|
-
}
|
|
710
|
-
_a.label = 2;
|
|
711
|
-
case 2: return [2 /*return*/, injectObjectChain(store.data, {
|
|
712
|
-
__payload: values,
|
|
713
|
-
__response: response
|
|
714
|
-
})];
|
|
729
|
+
}); })];
|
|
715
730
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
}, throwErrors)
|
|
731
|
+
else {
|
|
732
|
+
clearPersistDataAfterSubmit && store.clearLocalPersistData();
|
|
733
|
+
// type为submit,但是没有配api以及target时,只派发事件
|
|
734
|
+
dispatchEvent_1('submitSucc', createObject(this.props.data, values));
|
|
735
|
+
}
|
|
736
|
+
return [2 /*return*/, Promise.resolve(null)];
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
}); }, throwErrors)
|
|
726
740
|
.then(function (values) {
|
|
727
741
|
// 有可能 onSubmit return false 了,那么后面的就不应该再执行了。
|
|
728
742
|
if (values === false) {
|
package/esm/renderers/Item.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -15,13 +15,15 @@ import { wrapControl } from './wrapControl.js';
|
|
|
15
15
|
import debounce from 'lodash/debounce';
|
|
16
16
|
import { isEffectiveApi, isApiOutdated } from '../utils/api.js';
|
|
17
17
|
import { findDOMNode } from 'react-dom';
|
|
18
|
+
import '../utils/browser.js';
|
|
18
19
|
import '../utils/ColorScale.js';
|
|
19
20
|
import 'lodash/chunk';
|
|
21
|
+
import { getVariable } from '../utils/getVariable.js';
|
|
22
|
+
import { createObject } from '../utils/object.js';
|
|
20
23
|
import { dataMapping } from '../utils/dataMapping.js';
|
|
21
24
|
import '../utils/DataSchema.js';
|
|
22
25
|
import '../utils/DataScope.js';
|
|
23
26
|
import 'moment';
|
|
24
|
-
import { createObject } from '../utils/object.js';
|
|
25
27
|
import 'amis-formula';
|
|
26
28
|
import '../utils/debug.js';
|
|
27
29
|
import '../utils/errors.js';
|
|
@@ -31,7 +33,6 @@ import '../utils/filter.js';
|
|
|
31
33
|
import 'lodash/isObject';
|
|
32
34
|
import 'lodash/isString';
|
|
33
35
|
import 'lodash/isBoolean';
|
|
34
|
-
import { getVariable } from '../utils/getVariable.js';
|
|
35
36
|
import '../utils/image.js';
|
|
36
37
|
import 'lodash/isEqual';
|
|
37
38
|
import '../actions/Action.js';
|