amis-core 1.0.0-beta.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/dist/Root.js +94 -0
- package/dist/RootRenderer.js +288 -0
- package/dist/SchemaRenderer.js +323 -0
- package/dist/Scoped.js +252 -0
- package/dist/WithRootStore.js +44 -0
- package/dist/WithStore.js +179 -0
- package/dist/__tests__/compat.test.d.ts +1 -0
- package/dist/__tests__/factory.test.d.ts +1 -0
- package/dist/__tests__/filter.test.d.ts +1 -0
- package/dist/__tests__/helper.d.ts +13 -0
- package/dist/__tests__/tokenize.test.d.ts +1 -0
- package/dist/actions/Action.js +119 -0
- package/dist/actions/AjaxAction.js +96 -0
- package/dist/actions/BreakAction.js +35 -0
- package/dist/actions/BroadcastAction.js +49 -0
- package/dist/actions/CmptAction.js +60 -0
- package/dist/actions/ContinueAction.js +35 -0
- package/dist/actions/CopyAction.js +43 -0
- package/dist/actions/CustomAction.js +49 -0
- package/dist/actions/DialogAction.js +104 -0
- package/dist/actions/DrawerAction.js +66 -0
- package/dist/actions/EmailAction.js +48 -0
- package/dist/actions/LinkAction.js +52 -0
- package/dist/actions/LoopAction.js +107 -0
- package/dist/actions/PageAction.js +80 -0
- package/dist/actions/ParallelAction.js +40 -0
- package/dist/actions/SwitchAction.js +52 -0
- package/dist/actions/ToastAction.js +35 -0
- package/dist/components/LazyComponent.js +99 -0
- package/dist/env.js +20 -0
- package/dist/envOverwrite.js +43 -0
- package/dist/factory.js +308 -0
- package/dist/index.js +218 -0
- package/dist/index2.js +255 -0
- package/dist/locale.js +114 -0
- package/dist/renderers/Form.js +1162 -0
- package/dist/renderers/Item.js +636 -0
- package/dist/renderers/Options.js +881 -0
- package/dist/renderers/Placeholder.js +31 -0
- package/dist/renderers/builtin.js +27 -0
- package/dist/renderers/wrapControl.js +507 -0
- package/dist/src/Root.d.ts +37 -0
- package/dist/src/RootRenderer.d.ts +27 -0
- package/dist/src/SchemaRenderer.d.ts +37 -0
- package/dist/src/Scoped.d.ts +38 -0
- package/dist/src/WithRootStore.d.ts +737 -0
- package/dist/src/WithStore.d.ts +5 -0
- package/dist/src/actions/Action.d.ts +38 -0
- package/dist/src/actions/AjaxAction.d.ts +25 -0
- package/dist/src/actions/BreakAction.d.ts +15 -0
- package/dist/src/actions/BroadcastAction.d.ts +16 -0
- package/dist/src/actions/CmptAction.d.ts +20 -0
- package/dist/src/actions/ContinueAction.d.ts +15 -0
- package/dist/src/actions/CopyAction.d.ts +20 -0
- package/dist/src/actions/CustomAction.d.ts +17 -0
- package/dist/src/actions/Decorators.d.ts +25 -0
- package/dist/src/actions/DialogAction.d.ts +57 -0
- package/dist/src/actions/DrawerAction.d.ts +30 -0
- package/dist/src/actions/EmailAction.d.ts +23 -0
- package/dist/src/actions/LinkAction.d.ts +24 -0
- package/dist/src/actions/LoopAction.d.ts +19 -0
- package/dist/src/actions/PageAction.d.ts +39 -0
- package/dist/src/actions/ParallelAction.d.ts +8 -0
- package/dist/src/actions/SwitchAction.d.ts +11 -0
- package/dist/src/actions/ToastAction.d.ts +19 -0
- package/dist/src/actions/index.d.ts +21 -0
- package/dist/src/components/LazyComponent.d.ts +32 -0
- package/dist/src/env.d.ts +172 -0
- package/dist/src/envOverwrite.d.ts +4 -0
- package/dist/src/factory.d.ts +78 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/locale.d.ts +82 -0
- package/dist/src/renderers/Form.d.ts +352 -0
- package/dist/src/renderers/Item.d.ts +795 -0
- package/dist/src/renderers/Options.d.ts +150 -0
- package/dist/src/renderers/Placeholder.d.ts +6 -0
- package/dist/src/renderers/builtin.d.ts +1 -0
- package/dist/src/renderers/wrapControl.d.ts +446 -0
- package/dist/src/schema.d.ts +369 -0
- package/dist/src/store/app.d.ts +89 -0
- package/dist/src/store/combo.d.ts +8504 -0
- package/dist/src/store/crud.d.ts +124 -0
- package/dist/src/store/form.d.ts +3394 -0
- package/dist/src/store/formItem.d.ts +130 -0
- package/dist/src/store/iRenderer.d.ts +46 -0
- package/dist/src/store/index.d.ts +105 -0
- package/dist/src/store/list.d.ts +270 -0
- package/dist/src/store/manager.d.ts +115 -0
- package/dist/src/store/modal.d.ts +84 -0
- package/dist/src/store/node.d.ts +22 -0
- package/dist/src/store/pagination.d.ts +58 -0
- package/dist/src/store/root.d.ts +79 -0
- package/dist/src/store/service.d.ts +71 -0
- package/dist/src/store/table-v2.d.ts +309 -0
- package/dist/src/store/table.d.ts +8334 -0
- package/dist/src/theme.d.ts +83 -0
- package/dist/src/types.d.ts +217 -0
- package/dist/src/utils/Animation.d.ts +22 -0
- package/dist/src/utils/ColorScale.d.ts +19 -0
- package/dist/src/utils/DataSchema.d.ts +25 -0
- package/dist/src/utils/DataScope.d.ts +23 -0
- package/dist/src/utils/RootClose.d.ts +4 -0
- package/dist/src/utils/SimpleMap.d.ts +8 -0
- package/dist/src/utils/api.d.ts +27 -0
- package/dist/src/utils/attachmentAdpator.d.ts +7 -0
- package/dist/src/utils/autobind.d.ts +7 -0
- package/dist/src/utils/columnsSplit.d.ts +1 -0
- package/dist/src/utils/dataMapping.d.ts +3 -0
- package/dist/src/utils/date.d.ts +4 -0
- package/dist/src/utils/debug.d.ts +26 -0
- package/dist/src/utils/dom.d.ts +13 -0
- package/dist/src/utils/errors.d.ts +6 -0
- package/dist/src/utils/escapeHtml.d.ts +1 -0
- package/dist/src/utils/filter-schema.d.ts +12 -0
- package/dist/src/utils/filter.d.ts +1 -0
- package/dist/src/utils/formatDuration.d.ts +1 -0
- package/dist/src/utils/formula.d.ts +16 -0
- package/dist/src/utils/getVariable.d.ts +3 -0
- package/dist/src/utils/grammar.d.ts +4 -0
- package/dist/src/utils/handleAction.d.ts +6 -0
- package/dist/src/utils/helper.d.ts +286 -0
- package/dist/src/utils/icon.d.ts +12 -0
- package/dist/src/utils/image.d.ts +17 -0
- package/dist/src/utils/index.d.ts +12 -0
- package/dist/src/utils/isPureVariable.d.ts +1 -0
- package/dist/src/utils/json-schema-2-amis-schema.d.ts +6 -0
- package/dist/src/utils/keyToPath.d.ts +6 -0
- package/dist/src/utils/makeSorter.d.ts +1 -0
- package/dist/src/utils/markdown.d.ts +5 -0
- package/dist/src/utils/normalizeLink.d.ts +1 -0
- package/dist/src/utils/normalizeOptions.d.ts +7 -0
- package/dist/src/utils/object.d.ts +15 -0
- package/dist/src/utils/offset.d.ts +14 -0
- package/dist/src/utils/offsetParent.d.ts +4 -0
- package/dist/src/utils/optionValueCompare.d.ts +3 -0
- package/dist/src/utils/position.d.ts +15 -0
- package/dist/src/utils/prettyBytes.d.ts +1 -0
- package/dist/src/utils/renderer-event.d.ts +44 -0
- package/dist/src/utils/replaceText.d.ts +6 -0
- package/dist/src/utils/resize-sensor.d.ts +6 -0
- package/dist/src/utils/resolveVariable.d.ts +1 -0
- package/dist/src/utils/resolveVariableAndFilter.d.ts +1 -0
- package/dist/src/utils/scrollPosition.d.ts +6 -0
- package/dist/src/utils/string2regExp.d.ts +1 -0
- package/dist/src/utils/stripNumber.d.ts +1 -0
- package/dist/src/utils/style.d.ts +10 -0
- package/dist/src/utils/tokenize.d.ts +1 -0
- package/dist/src/utils/tpl-builtin.d.ts +18 -0
- package/dist/src/utils/tpl-lodash.d.ts +4 -0
- package/dist/src/utils/tpl.d.ts +11 -0
- package/dist/src/utils/validations.d.ts +39 -0
- package/dist/store/app.js +190 -0
- package/dist/store/combo.js +154 -0
- package/dist/store/crud.js +413 -0
- package/dist/store/form.js +579 -0
- package/dist/store/formItem.js +846 -0
- package/dist/store/iRenderer.js +189 -0
- package/dist/store/index.js +103 -0
- package/dist/store/list.js +248 -0
- package/dist/store/manager.js +56 -0
- package/dist/store/modal.js +54 -0
- package/dist/store/node.js +93 -0
- package/dist/store/pagination.js +60 -0
- package/dist/store/root.js +45 -0
- package/dist/store/service.js +415 -0
- package/dist/store/table-v2.js +471 -0
- package/dist/store/table.js +1105 -0
- package/dist/theme.js +93 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/Animation.js +290 -0
- package/dist/utils/DataSchema.js +120 -0
- package/dist/utils/DataScope.js +151 -0
- package/dist/utils/SimpleMap.js +46 -0
- package/dist/utils/api.js +555 -0
- package/dist/utils/autobind.js +94 -0
- package/dist/utils/dataMapping.js +136 -0
- package/dist/utils/date.js +90 -0
- package/dist/utils/debug.js +343 -0
- package/dist/utils/errors.js +23 -0
- package/dist/utils/escapeHtml.js +24 -0
- package/dist/utils/filter-schema.js +75 -0
- package/dist/utils/filter.js +481 -0
- package/dist/utils/formatDuration.js +27 -0
- package/dist/utils/formula.js +165 -0
- package/dist/utils/getVariable.js +29 -0
- package/dist/utils/grammar.js +54 -0
- package/dist/utils/helper.js +1283 -0
- package/dist/utils/isPureVariable.js +16 -0
- package/dist/utils/keyToPath.js +34 -0
- package/dist/utils/makeSorter.js +30 -0
- package/dist/utils/normalizeLink.js +47 -0
- package/dist/utils/normalizeOptions.js +92 -0
- package/dist/utils/object.js +156 -0
- package/dist/utils/offset.js +36 -0
- package/dist/utils/offsetParent.js +27 -0
- package/dist/utils/optionValueCompare.js +25 -0
- package/dist/utils/position.js +50 -0
- package/dist/utils/prettyBytes.js +28 -0
- package/dist/utils/renderer-event.js +131 -0
- package/dist/utils/replaceText.js +35 -0
- package/dist/utils/resize-sensor.js +177 -0
- package/dist/utils/resolveVariable.js +39 -0
- package/dist/utils/resolveVariableAndFilter.js +37 -0
- package/dist/utils/string2regExp.js +18 -0
- package/dist/utils/stripNumber.js +20 -0
- package/dist/utils/tokenize.js +33 -0
- package/dist/utils/tpl-builtin.js +71 -0
- package/dist/utils/tpl-lodash.js +71 -0
- package/dist/utils/tpl.js +140 -0
- package/dist/utils/validations.js +377 -0
- package/package.json +121 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var Action = require('./Action.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 自定义动作,JS脚本
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @class CustomAction
|
|
18
|
+
* @implements {Action}
|
|
19
|
+
*/
|
|
20
|
+
var CustomAction = /** @class */ (function () {
|
|
21
|
+
function CustomAction() {
|
|
22
|
+
}
|
|
23
|
+
CustomAction.prototype.run = function (action, renderer, event) {
|
|
24
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
25
|
+
var scriptFunc;
|
|
26
|
+
return tslib.__generator(this, function (_a) {
|
|
27
|
+
switch (_a.label) {
|
|
28
|
+
case 0:
|
|
29
|
+
scriptFunc = action.script;
|
|
30
|
+
if (typeof scriptFunc === 'string') {
|
|
31
|
+
scriptFunc = new Function('context', 'doAction', 'event', scriptFunc);
|
|
32
|
+
}
|
|
33
|
+
// 外部可以直接调用doAction来完成动作调用
|
|
34
|
+
// 可以通过上下文直接编排动作调用,通过event来进行动作干预
|
|
35
|
+
return [4 /*yield*/, (scriptFunc === null || scriptFunc === void 0 ? void 0 : scriptFunc.call(null, renderer, function (action) { return Action.runActions(action, renderer, event); }, event, action))];
|
|
36
|
+
case 1:
|
|
37
|
+
// 外部可以直接调用doAction来完成动作调用
|
|
38
|
+
// 可以通过上下文直接编排动作调用,通过event来进行动作干预
|
|
39
|
+
_a.sent();
|
|
40
|
+
return [2 /*return*/];
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
return CustomAction;
|
|
46
|
+
}());
|
|
47
|
+
Action.registerAction('custom', new CustomAction());
|
|
48
|
+
|
|
49
|
+
exports.CustomAction = CustomAction;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var Action = require('./Action.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 打开弹窗动作
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @class DialogAction
|
|
18
|
+
* @implements {Action}
|
|
19
|
+
*/
|
|
20
|
+
var DialogAction = /** @class */ (function () {
|
|
21
|
+
function DialogAction() {
|
|
22
|
+
}
|
|
23
|
+
DialogAction.prototype.run = function (action, renderer, event) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
26
|
+
return tslib.__generator(this, function (_c) {
|
|
27
|
+
(_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, action, action.args);
|
|
28
|
+
return [2 /*return*/];
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return DialogAction;
|
|
33
|
+
}());
|
|
34
|
+
/**
|
|
35
|
+
* 关闭弹窗动作
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @class CloseDialogAction
|
|
39
|
+
* @implements {Action}
|
|
40
|
+
*/
|
|
41
|
+
var CloseDialogAction = /** @class */ (function () {
|
|
42
|
+
function CloseDialogAction() {
|
|
43
|
+
}
|
|
44
|
+
CloseDialogAction.prototype.run = function (action, renderer, event) {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
47
|
+
return tslib.__generator(this, function (_c) {
|
|
48
|
+
if (action.componentId) {
|
|
49
|
+
// 关闭指定弹窗
|
|
50
|
+
event.context.scoped.closeById(action.componentId);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// 关闭当前弹窗
|
|
54
|
+
(_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, tslib.__assign(tslib.__assign({}, action), { actionType: 'close' }), action.args);
|
|
55
|
+
}
|
|
56
|
+
return [2 /*return*/];
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return CloseDialogAction;
|
|
61
|
+
}());
|
|
62
|
+
/**
|
|
63
|
+
* alert提示动作
|
|
64
|
+
*/
|
|
65
|
+
var AlertAction = /** @class */ (function () {
|
|
66
|
+
function AlertAction() {
|
|
67
|
+
}
|
|
68
|
+
AlertAction.prototype.run = function (action, renderer, event) {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
71
|
+
return tslib.__generator(this, function (_d) {
|
|
72
|
+
(_b = (_a = event.context.env).alert) === null || _b === void 0 ? void 0 : _b.call(_a, (_c = action.args) === null || _c === void 0 ? void 0 : _c.msg);
|
|
73
|
+
return [2 /*return*/];
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
return AlertAction;
|
|
78
|
+
}());
|
|
79
|
+
/**
|
|
80
|
+
* confirm确认提示动作
|
|
81
|
+
*/
|
|
82
|
+
var ConfirmAction = /** @class */ (function () {
|
|
83
|
+
function ConfirmAction() {
|
|
84
|
+
}
|
|
85
|
+
ConfirmAction.prototype.run = function (action, renderer, event) {
|
|
86
|
+
var _a, _b, _c, _d;
|
|
87
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
88
|
+
return tslib.__generator(this, function (_e) {
|
|
89
|
+
(_b = (_a = event.context.env).confirm) === null || _b === void 0 ? void 0 : _b.call(_a, (_c = action.args) === null || _c === void 0 ? void 0 : _c.msg, (_d = action.args) === null || _d === void 0 ? void 0 : _d.title);
|
|
90
|
+
return [2 /*return*/];
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
return ConfirmAction;
|
|
95
|
+
}());
|
|
96
|
+
Action.registerAction('dialog', new DialogAction());
|
|
97
|
+
Action.registerAction('closeDialog', new CloseDialogAction());
|
|
98
|
+
Action.registerAction('alert', new AlertAction());
|
|
99
|
+
Action.registerAction('confirmDialog', new ConfirmAction());
|
|
100
|
+
|
|
101
|
+
exports.AlertAction = AlertAction;
|
|
102
|
+
exports.CloseDialogAction = CloseDialogAction;
|
|
103
|
+
exports.ConfirmAction = ConfirmAction;
|
|
104
|
+
exports.DialogAction = DialogAction;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var Action = require('./Action.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 打开抽屉动作
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @class DrawerAction
|
|
18
|
+
* @implements {Action}
|
|
19
|
+
*/
|
|
20
|
+
var DrawerAction = /** @class */ (function () {
|
|
21
|
+
function DrawerAction() {
|
|
22
|
+
}
|
|
23
|
+
DrawerAction.prototype.run = function (action, renderer, event) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
26
|
+
return tslib.__generator(this, function (_c) {
|
|
27
|
+
(_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, action, action.args);
|
|
28
|
+
return [2 /*return*/];
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
return DrawerAction;
|
|
33
|
+
}());
|
|
34
|
+
/**
|
|
35
|
+
* 关闭抽屉动作
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @class CloseDrawerAction
|
|
39
|
+
* @implements {Action}
|
|
40
|
+
*/
|
|
41
|
+
var CloseDrawerAction = /** @class */ (function () {
|
|
42
|
+
function CloseDrawerAction() {
|
|
43
|
+
}
|
|
44
|
+
CloseDrawerAction.prototype.run = function (action, renderer, event) {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
47
|
+
return tslib.__generator(this, function (_c) {
|
|
48
|
+
if (action.componentId) {
|
|
49
|
+
// 关闭指定抽屉
|
|
50
|
+
event.context.scoped.closeById(action.componentId);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// 关闭当前抽屉
|
|
54
|
+
(_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, tslib.__assign(tslib.__assign({}, action), { actionType: 'close' }), action.args);
|
|
55
|
+
}
|
|
56
|
+
return [2 /*return*/];
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return CloseDrawerAction;
|
|
61
|
+
}());
|
|
62
|
+
Action.registerAction('drawer', new DrawerAction());
|
|
63
|
+
Action.registerAction('closeDrawer', new CloseDrawerAction());
|
|
64
|
+
|
|
65
|
+
exports.CloseDrawerAction = CloseDrawerAction;
|
|
66
|
+
exports.DrawerAction = DrawerAction;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var pick = require('lodash/pick');
|
|
12
|
+
var qs = require('qs');
|
|
13
|
+
var Action = require('./Action.js');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
|
|
18
|
+
var qs__default = /*#__PURE__*/_interopDefaultLegacy(qs);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 邮件动作
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
* @class EmailAction
|
|
25
|
+
* @implements {Action}
|
|
26
|
+
*/
|
|
27
|
+
var EmailAction = /** @class */ (function () {
|
|
28
|
+
function EmailAction() {
|
|
29
|
+
}
|
|
30
|
+
EmailAction.prototype.run = function (action, renderer, event) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
33
|
+
var mailTo, mailInfo, mailStr, mailto;
|
|
34
|
+
return tslib.__generator(this, function (_c) {
|
|
35
|
+
mailTo = (_a = action.args) === null || _a === void 0 ? void 0 : _a.to;
|
|
36
|
+
mailInfo = pick__default["default"]((_b = action.args) !== null && _b !== void 0 ? _b : {}, 'cc', 'bcc', 'subject', 'body');
|
|
37
|
+
mailStr = qs__default["default"].stringify(mailInfo);
|
|
38
|
+
mailto = "mailto:".concat(mailTo, "?").concat(mailStr);
|
|
39
|
+
window.open(mailto);
|
|
40
|
+
return [2 /*return*/];
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
return EmailAction;
|
|
45
|
+
}());
|
|
46
|
+
Action.registerAction('email', new EmailAction());
|
|
47
|
+
|
|
48
|
+
exports.EmailAction = EmailAction;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var api = require('../utils/api.js');
|
|
12
|
+
var omit = require('lodash/omit');
|
|
13
|
+
var Action = require('./Action.js');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var omit__default = /*#__PURE__*/_interopDefaultLegacy(omit);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 打开页面动作
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @class LinkAction
|
|
24
|
+
* @implements {Action}
|
|
25
|
+
*/
|
|
26
|
+
var LinkAction = /** @class */ (function () {
|
|
27
|
+
function LinkAction() {
|
|
28
|
+
}
|
|
29
|
+
LinkAction.prototype.run = function (action, renderer, event) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f;
|
|
31
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
32
|
+
var urlObj;
|
|
33
|
+
return tslib.__generator(this, function (_g) {
|
|
34
|
+
if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
|
|
35
|
+
throw new Error('env.jumpTo is required!');
|
|
36
|
+
}
|
|
37
|
+
urlObj = api.buildApi({
|
|
38
|
+
url: (((_b = action.args) === null || _b === void 0 ? void 0 : _b.url) || ((_c = action.args) === null || _c === void 0 ? void 0 : _c.link)),
|
|
39
|
+
method: 'get'
|
|
40
|
+
}, tslib.__assign(tslib.__assign({}, ((_e = (_d = action.args) === null || _d === void 0 ? void 0 : _d.params) !== null && _e !== void 0 ? _e : {})), omit__default["default"]((_f = action.args) !== null && _f !== void 0 ? _f : {}, ['params', 'blank', 'url', 'link'])), {
|
|
41
|
+
autoAppend: true
|
|
42
|
+
});
|
|
43
|
+
renderer.props.env.jumpTo(urlObj.url, tslib.__assign({ actionType: action.actionType, type: 'button' }, action.args), action.args);
|
|
44
|
+
return [2 /*return*/];
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
return LinkAction;
|
|
49
|
+
}());
|
|
50
|
+
Action.registerAction('openlink', new LinkAction());
|
|
51
|
+
|
|
52
|
+
exports.LinkAction = LinkAction;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
require('../utils/helper.js');
|
|
12
|
+
var Action = require('./Action.js');
|
|
13
|
+
require('amis-formula');
|
|
14
|
+
require('moment');
|
|
15
|
+
var object = require('../utils/object.js');
|
|
16
|
+
var resolveVariable = require('../utils/resolveVariable.js');
|
|
17
|
+
require('lodash/isPlainObject');
|
|
18
|
+
require('../utils/filter.js');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 循环动作
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
* @class LoopAction
|
|
25
|
+
* @implements {Action}
|
|
26
|
+
*/
|
|
27
|
+
var LoopAction = /** @class */ (function () {
|
|
28
|
+
function LoopAction() {
|
|
29
|
+
}
|
|
30
|
+
LoopAction.prototype.run = function (action, renderer, event, mergeData) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
33
|
+
var loopName, loopData, protoData, _i, loopData_1, data, _c, _d, subAction;
|
|
34
|
+
return tslib.__generator(this, function (_e) {
|
|
35
|
+
switch (_e.label) {
|
|
36
|
+
case 0:
|
|
37
|
+
loopName = (_a = action.args) === null || _a === void 0 ? void 0 : _a.loopName;
|
|
38
|
+
if (typeof loopName !== 'string') {
|
|
39
|
+
console.error('loopName 必须是字符串类型');
|
|
40
|
+
return [2 /*return*/];
|
|
41
|
+
}
|
|
42
|
+
loopData = resolveVariable.resolveVariable(loopName, mergeData) || [];
|
|
43
|
+
if (!!loopData) return [3 /*break*/, 1];
|
|
44
|
+
console.error("\u6CA1\u6709\u627E\u5230\u6570\u636E ".concat(loopName));
|
|
45
|
+
return [3 /*break*/, 10];
|
|
46
|
+
case 1:
|
|
47
|
+
if (!!Array.isArray(loopData)) return [3 /*break*/, 2];
|
|
48
|
+
console.error("".concat(loopName, " \u6570\u636E\u4E0D\u662F\u6570\u7EC4"));
|
|
49
|
+
return [3 /*break*/, 10];
|
|
50
|
+
case 2:
|
|
51
|
+
if (!((_b = action.children) === null || _b === void 0 ? void 0 : _b.length)) return [3 /*break*/, 10];
|
|
52
|
+
protoData = event.data;
|
|
53
|
+
_i = 0, loopData_1 = loopData;
|
|
54
|
+
_e.label = 3;
|
|
55
|
+
case 3:
|
|
56
|
+
if (!(_i < loopData_1.length)) return [3 /*break*/, 9];
|
|
57
|
+
data = loopData_1[_i];
|
|
58
|
+
renderer.loopStatus = Action.LoopStatus.NORMAL;
|
|
59
|
+
// 追加逻辑处理中的数据,事件数据优先,用完还要还原
|
|
60
|
+
event.setData(object.createObject(event.data, data));
|
|
61
|
+
_c = 0, _d = action.children;
|
|
62
|
+
_e.label = 4;
|
|
63
|
+
case 4:
|
|
64
|
+
if (!(_c < _d.length)) return [3 /*break*/, 7];
|
|
65
|
+
subAction = _d[_c];
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
if (renderer.loopStatus === Action.LoopStatus.CONTINUE) {
|
|
68
|
+
return [3 /*break*/, 6];
|
|
69
|
+
}
|
|
70
|
+
return [4 /*yield*/, Action.runActions(subAction, renderer, event)];
|
|
71
|
+
case 5:
|
|
72
|
+
_e.sent();
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
if (renderer.loopStatus === Action.LoopStatus.BREAK || event.stoped) {
|
|
75
|
+
// 还原事件数据
|
|
76
|
+
event.setData(protoData);
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
return [3 /*break*/, 7];
|
|
79
|
+
}
|
|
80
|
+
_e.label = 6;
|
|
81
|
+
case 6:
|
|
82
|
+
_c++;
|
|
83
|
+
return [3 /*break*/, 4];
|
|
84
|
+
case 7:
|
|
85
|
+
if (event.stoped) {
|
|
86
|
+
// 还原事件数据
|
|
87
|
+
event.setData(protoData);
|
|
88
|
+
return [3 /*break*/, 9];
|
|
89
|
+
}
|
|
90
|
+
_e.label = 8;
|
|
91
|
+
case 8:
|
|
92
|
+
_i++;
|
|
93
|
+
return [3 /*break*/, 3];
|
|
94
|
+
case 9:
|
|
95
|
+
renderer.loopStatus = Action.LoopStatus.NORMAL;
|
|
96
|
+
event.setData(protoData);
|
|
97
|
+
_e.label = 10;
|
|
98
|
+
case 10: return [2 /*return*/];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
return LoopAction;
|
|
104
|
+
}());
|
|
105
|
+
Action.registerAction('loop', new LoopAction());
|
|
106
|
+
|
|
107
|
+
exports.LoopAction = LoopAction;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var Action = require('./Action.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 返回上个页面
|
|
15
|
+
*
|
|
16
|
+
* @export
|
|
17
|
+
* @class PageGoBackAction
|
|
18
|
+
* @implements {Action}
|
|
19
|
+
*/
|
|
20
|
+
var PageGoBackAction = /** @class */ (function () {
|
|
21
|
+
function PageGoBackAction() {
|
|
22
|
+
}
|
|
23
|
+
PageGoBackAction.prototype.run = function (action, renderer, event) {
|
|
24
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
25
|
+
return tslib.__generator(this, function (_a) {
|
|
26
|
+
window.history.back();
|
|
27
|
+
return [2 /*return*/];
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
return PageGoBackAction;
|
|
32
|
+
}());
|
|
33
|
+
/**
|
|
34
|
+
* 到指定页面
|
|
35
|
+
*
|
|
36
|
+
* @export
|
|
37
|
+
* @class PageGoAction
|
|
38
|
+
* @implements {Action}
|
|
39
|
+
*/
|
|
40
|
+
var PageGoAction = /** @class */ (function () {
|
|
41
|
+
function PageGoAction() {
|
|
42
|
+
}
|
|
43
|
+
PageGoAction.prototype.run = function (action, renderer, event) {
|
|
44
|
+
var _a;
|
|
45
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
46
|
+
return tslib.__generator(this, function (_b) {
|
|
47
|
+
window.history.go(((_a = action.args) === null || _a === void 0 ? void 0 : _a.delta) || 0);
|
|
48
|
+
return [2 /*return*/];
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
return PageGoAction;
|
|
53
|
+
}());
|
|
54
|
+
/**
|
|
55
|
+
* 浏览器刷新
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
* @class PageRefreshAction
|
|
59
|
+
* @implements {Action}
|
|
60
|
+
*/
|
|
61
|
+
var PageRefreshAction = /** @class */ (function () {
|
|
62
|
+
function PageRefreshAction() {
|
|
63
|
+
}
|
|
64
|
+
PageRefreshAction.prototype.run = function (action, renderer, event) {
|
|
65
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
66
|
+
return tslib.__generator(this, function (_a) {
|
|
67
|
+
window.location.reload();
|
|
68
|
+
return [2 /*return*/];
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return PageRefreshAction;
|
|
73
|
+
}());
|
|
74
|
+
Action.registerAction('goBack', new PageGoBackAction());
|
|
75
|
+
Action.registerAction('refresh', new PageRefreshAction());
|
|
76
|
+
Action.registerAction('goPage', new PageGoAction());
|
|
77
|
+
|
|
78
|
+
exports.PageGoAction = PageGoAction;
|
|
79
|
+
exports.PageGoBackAction = PageGoBackAction;
|
|
80
|
+
exports.PageRefreshAction = PageRefreshAction;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var Action = require('./Action.js');
|
|
12
|
+
|
|
13
|
+
var ParallelAction = /** @class */ (function () {
|
|
14
|
+
function ParallelAction() {
|
|
15
|
+
}
|
|
16
|
+
ParallelAction.prototype.run = function (action, renderer, event) {
|
|
17
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
18
|
+
var childActions;
|
|
19
|
+
return tslib.__generator(this, function (_a) {
|
|
20
|
+
switch (_a.label) {
|
|
21
|
+
case 0:
|
|
22
|
+
if (!(action.children && action.children.length)) return [3 /*break*/, 2];
|
|
23
|
+
childActions = action.children.map(function (child) {
|
|
24
|
+
// 并行动作互不干扰,但不管哪个存在干预都对后续动作生效
|
|
25
|
+
return Action.runActions(child, renderer, event);
|
|
26
|
+
});
|
|
27
|
+
return [4 /*yield*/, Promise.all(childActions)];
|
|
28
|
+
case 1:
|
|
29
|
+
_a.sent();
|
|
30
|
+
_a.label = 2;
|
|
31
|
+
case 2: return [2 /*return*/];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return ParallelAction;
|
|
37
|
+
}());
|
|
38
|
+
Action.registerAction('parallel', new ParallelAction());
|
|
39
|
+
|
|
40
|
+
exports.ParallelAction = ParallelAction;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var tpl = require('../utils/tpl.js');
|
|
12
|
+
var Action = require('./Action.js');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 排他动作
|
|
16
|
+
*/
|
|
17
|
+
var SwitchAction = /** @class */ (function () {
|
|
18
|
+
function SwitchAction() {
|
|
19
|
+
}
|
|
20
|
+
SwitchAction.prototype.run = function (action, renderer, event, mergeData) {
|
|
21
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
22
|
+
var _i, _a, branch;
|
|
23
|
+
return tslib.__generator(this, function (_b) {
|
|
24
|
+
switch (_b.label) {
|
|
25
|
+
case 0:
|
|
26
|
+
_i = 0, _a = action.children || [];
|
|
27
|
+
_b.label = 1;
|
|
28
|
+
case 1:
|
|
29
|
+
if (!(_i < _a.length)) return [3 /*break*/, 4];
|
|
30
|
+
branch = _a[_i];
|
|
31
|
+
if (!branch.expression) {
|
|
32
|
+
return [3 /*break*/, 3];
|
|
33
|
+
}
|
|
34
|
+
if (!tpl.evalExpression(branch.expression, mergeData)) return [3 /*break*/, 3];
|
|
35
|
+
return [4 /*yield*/, Action.runActions(branch, renderer, event)];
|
|
36
|
+
case 2:
|
|
37
|
+
_b.sent();
|
|
38
|
+
// 去掉runAllMatch,这里只做排他,多个可以直接通过expression
|
|
39
|
+
return [3 /*break*/, 4];
|
|
40
|
+
case 3:
|
|
41
|
+
_i++;
|
|
42
|
+
return [3 /*break*/, 1];
|
|
43
|
+
case 4: return [2 /*return*/];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
return SwitchAction;
|
|
49
|
+
}());
|
|
50
|
+
Action.registerAction('switch', new SwitchAction());
|
|
51
|
+
|
|
52
|
+
exports.SwitchAction = SwitchAction;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v1.0.0-beta.0
|
|
3
|
+
* Copyright 2018-2022 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var Action = require('./Action.js');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 全局toast
|
|
15
|
+
*/
|
|
16
|
+
var ToastAction = /** @class */ (function () {
|
|
17
|
+
function ToastAction() {
|
|
18
|
+
}
|
|
19
|
+
ToastAction.prototype.run = function (action, renderer, event) {
|
|
20
|
+
var _a, _b, _c, _d, _e;
|
|
21
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
22
|
+
return tslib.__generator(this, function (_f) {
|
|
23
|
+
if (!((_a = renderer.props.env) === null || _a === void 0 ? void 0 : _a.notify)) {
|
|
24
|
+
throw new Error('env.notify is required!');
|
|
25
|
+
}
|
|
26
|
+
(_c = (_b = event.context.env).notify) === null || _c === void 0 ? void 0 : _c.call(_b, ((_d = action.args) === null || _d === void 0 ? void 0 : _d.msgType) || 'info', String((_e = action.args) === null || _e === void 0 ? void 0 : _e.msg), action.args);
|
|
27
|
+
return [2 /*return*/];
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
return ToastAction;
|
|
32
|
+
}());
|
|
33
|
+
Action.registerAction('toast', new ToastAction());
|
|
34
|
+
|
|
35
|
+
exports.ToastAction = ToastAction;
|