@zhubangyun/lowcode-core 5.10.220 → 5.12.10
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/es/index.less +10 -0
- package/es/utils/api/file-api.d.ts +17 -5
- package/es/utils/api/file-api.js +10 -7
- package/es/utils/api/form-api.d.ts +1 -1
- package/es/utils/api/form-api.js +70 -66
- package/es/utils/api/form-api.utils.d.ts +5 -5
- package/es/utils/api/form-api.utils.js +55 -36
- package/es/utils/api/index.d.ts +4 -3
- package/es/utils/api/index.js +9 -2
- package/es/utils/api/rest-api.d.ts +6 -5
- package/es/utils/api/rest-api.js +1 -1
- package/es/utils/api/schema.util.d.ts +14 -0
- package/es/utils/api/schema.util.js +32 -0
- package/es/utils/api/script-api.js +1 -1
- package/es/utils/api/user-info.d.ts +16 -6
- package/es/utils/api/user-info.js +31 -20
- package/es/utils/cache/index.d.ts +6 -6
- package/es/utils/cache/index.js +56 -24
- package/es/utils/cache/schema.d.ts +0 -2
- package/es/utils/cache/schema.js +0 -388
- package/es/utils/formIds.d.ts +3 -0
- package/es/utils/formIds.js +3 -0
- package/es/utils/page/index.d.ts +2 -0
- package/es/utils/page/index.js +2 -0
- package/es/utils/page/page-form-data-manager-group.d.ts +2 -0
- package/es/utils/page/page-form-data-manager-group.js +3 -7
- package/es/utils/page/page-form-data-manager.d.ts +2 -1
- package/es/utils/page/page-form-data-manager.js +1 -0
- package/es/utils/page/page-form-group.d.ts +17 -0
- package/es/utils/page/page-form-group.js +97 -0
- package/es/utils/page/page-form.d.ts +2 -1
- package/es/utils/page/page-form.js +3 -3
- package/es/utils/page/page-show.d.ts +1 -0
- package/es/utils/page/print-form.d.ts +8 -0
- package/es/utils/page/print-form.js +147 -0
- package/lib/index.less +10 -0
- package/lib/utils/api/file-api.d.ts +17 -5
- package/lib/utils/api/file-api.js +10 -7
- package/lib/utils/api/form-api.d.ts +1 -1
- package/lib/utils/api/form-api.js +70 -66
- package/lib/utils/api/form-api.utils.d.ts +5 -5
- package/lib/utils/api/form-api.utils.js +55 -36
- package/lib/utils/api/index.d.ts +4 -3
- package/lib/utils/api/index.js +10 -3
- package/lib/utils/api/rest-api.d.ts +6 -5
- package/lib/utils/api/rest-api.js +1 -1
- package/lib/utils/api/schema.util.d.ts +14 -0
- package/lib/utils/api/schema.util.js +37 -0
- package/lib/utils/api/script-api.js +1 -1
- package/lib/utils/api/user-info.d.ts +16 -6
- package/lib/utils/api/user-info.js +32 -21
- package/lib/utils/cache/index.d.ts +6 -6
- package/lib/utils/cache/index.js +57 -24
- package/lib/utils/cache/schema.d.ts +0 -2
- package/lib/utils/cache/schema.js +0 -390
- package/lib/utils/formIds.d.ts +3 -0
- package/lib/utils/formIds.js +7 -0
- package/lib/utils/page/index.d.ts +2 -0
- package/lib/utils/page/index.js +7 -1
- package/lib/utils/page/page-form-data-manager-group.d.ts +2 -0
- package/lib/utils/page/page-form-data-manager-group.js +3 -7
- package/lib/utils/page/page-form-data-manager.d.ts +2 -1
- package/lib/utils/page/page-form-data-manager.js +1 -0
- package/lib/utils/page/page-form-group.d.ts +17 -0
- package/lib/utils/page/page-form-group.js +104 -0
- package/lib/utils/page/page-form.d.ts +2 -1
- package/lib/utils/page/page-form.js +3 -3
- package/lib/utils/page/page-show.d.ts +1 -0
- package/lib/utils/page/print-form.d.ts +8 -0
- package/lib/utils/page/print-form.js +153 -0
- package/package.json +1 -1
|
@@ -8,7 +8,6 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
8
8
|
import { PageLayout } from "./page-layout";
|
|
9
9
|
import React, { Component } from "react";
|
|
10
10
|
import { ReactRender } from "../../components/react-render";
|
|
11
|
-
import { cloneDataView } from "./page-schema-utils";
|
|
12
11
|
import { renderElement } from "./page-render";
|
|
13
12
|
import { v4 } from "uuid";
|
|
14
13
|
export function showFormDataManagerGroup(_x) {
|
|
@@ -72,11 +71,6 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
72
71
|
(_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
|
|
73
72
|
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
|
|
74
73
|
};
|
|
75
|
-
var fdmItems = (items === null || items === void 0 ? void 0 : items.map(function (item) {
|
|
76
|
-
return _extends({}, item, {
|
|
77
|
-
dataView: cloneDataView(_this2.props.extraProps, item.dataView)
|
|
78
|
-
});
|
|
79
|
-
})) || [];
|
|
80
74
|
return /*#__PURE__*/React.createElement(PageLayout, {
|
|
81
75
|
layout: layout,
|
|
82
76
|
ref: function ref(layout) {
|
|
@@ -92,9 +86,11 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
92
86
|
children: [{
|
|
93
87
|
componentName: "PageFdmGroup",
|
|
94
88
|
props: {
|
|
89
|
+
layout: layout,
|
|
90
|
+
title: restProps.title,
|
|
95
91
|
mode: restProps.mode,
|
|
96
92
|
defaultSelectedRows: restProps.defaultSelectedRows,
|
|
97
|
-
items:
|
|
93
|
+
items: items
|
|
98
94
|
}
|
|
99
95
|
}]
|
|
100
96
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PageLayoutType } from "./page-layout";
|
|
2
2
|
import { FilterRule } from "../api/rest-api";
|
|
3
|
-
export type PageFormDataManagerModeType = "associationField" | "dataManager" | "selectOne" | "
|
|
3
|
+
export type PageFormDataManagerModeType = "associationField" | "dataManager" | "selectOne" | "selectMany";
|
|
4
4
|
export interface ShowPageFormDataManagerProps {
|
|
5
5
|
container?: HTMLDivElement;
|
|
6
6
|
layout?: PageLayoutType;
|
|
@@ -21,5 +21,6 @@ export interface ShowPageFormDataManagerProps {
|
|
|
21
21
|
data: any[];
|
|
22
22
|
total: number;
|
|
23
23
|
}) => void | Promise<void>;
|
|
24
|
+
pageRef?: (page: any) => void;
|
|
24
25
|
}
|
|
25
26
|
export declare function showFormDataManager(options: ShowPageFormDataManagerProps): Promise<any | any[]>;
|
|
@@ -92,6 +92,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
92
92
|
return true;
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
+
fdmSchema.app = schema.app;
|
|
95
96
|
return /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
|
|
96
97
|
schema: fdmSchema,
|
|
97
98
|
components: window._components || window.components || window.__components
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PageLayoutType } from "./page-layout";
|
|
2
|
+
import { PageFormModeType } from "./page-form";
|
|
3
|
+
export interface ShowFormGroupProps {
|
|
4
|
+
container?: HTMLDivElement;
|
|
5
|
+
layout?: PageLayoutType;
|
|
6
|
+
form?: {
|
|
7
|
+
id: string;
|
|
8
|
+
fieldId?: string;
|
|
9
|
+
};
|
|
10
|
+
items?: any[];
|
|
11
|
+
mode?: PageFormModeType;
|
|
12
|
+
onSubmitOk?: (data: any) => void;
|
|
13
|
+
onRemoveOk?: () => void;
|
|
14
|
+
onClose?: () => void | Promise<void>;
|
|
15
|
+
pageRef?: (page: any) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function showFormGroup(options: ShowFormGroupProps): Promise<any>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
+
var _excluded = ["layout", "form", "items", "onClose"],
|
|
6
|
+
_excluded2 = ["container", "onClose"];
|
|
7
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
import { PageLayout } from "./page-layout";
|
|
9
|
+
import { renderElement } from "./page-render";
|
|
10
|
+
import React, { Component } from "react";
|
|
11
|
+
import { ReactRender } from "../../components/react-render";
|
|
12
|
+
import { v4 } from "uuid";
|
|
13
|
+
import { PageLoadSchema } from "./page-load-schema";
|
|
14
|
+
export function showFormGroup(_x) {
|
|
15
|
+
return _showFormGroup.apply(this, arguments);
|
|
16
|
+
}
|
|
17
|
+
function _showFormGroup() {
|
|
18
|
+
_showFormGroup = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
19
|
+
var container, onClose, props;
|
|
20
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
container = options.container, onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
|
|
24
|
+
return _context.abrupt("return", renderElement({
|
|
25
|
+
container: container,
|
|
26
|
+
onClose: onClose,
|
|
27
|
+
element: {
|
|
28
|
+
component: FormGroupRender,
|
|
29
|
+
props: props
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
case 2:
|
|
33
|
+
case "end":
|
|
34
|
+
return _context.stop();
|
|
35
|
+
}
|
|
36
|
+
}, _callee);
|
|
37
|
+
}));
|
|
38
|
+
return _showFormGroup.apply(this, arguments);
|
|
39
|
+
}
|
|
40
|
+
var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
41
|
+
function FormGroupRender() {
|
|
42
|
+
var _this;
|
|
43
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
|
+
args[_key] = arguments[_key];
|
|
45
|
+
}
|
|
46
|
+
_this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
|
47
|
+
_this.layoutRef = void 0;
|
|
48
|
+
return _this;
|
|
49
|
+
}
|
|
50
|
+
_inheritsLoose(FormGroupRender, _Component);
|
|
51
|
+
var _proto = FormGroupRender.prototype;
|
|
52
|
+
_proto.render = function render() {
|
|
53
|
+
var _this2 = this;
|
|
54
|
+
var self = this;
|
|
55
|
+
var _this$props = this.props,
|
|
56
|
+
layout = _this$props.layout,
|
|
57
|
+
form = _this$props.form,
|
|
58
|
+
items = _this$props.items,
|
|
59
|
+
onClose = _this$props.onClose,
|
|
60
|
+
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
restProps.layout = layout || "modal";
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
restProps.onClose = function () {
|
|
65
|
+
var _self$layoutRef;
|
|
66
|
+
(_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
|
|
67
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/React.createElement(PageLayout, {
|
|
70
|
+
layout: layout,
|
|
71
|
+
ref: function ref(layout) {
|
|
72
|
+
return _this2.layoutRef = layout;
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/React.createElement(PageLoadSchema, {
|
|
75
|
+
pageId: form === null || form === void 0 ? void 0 : form.id
|
|
76
|
+
}, function (schema) {
|
|
77
|
+
return /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
|
|
78
|
+
components: window._components || window.components || window.__components,
|
|
79
|
+
schema: {
|
|
80
|
+
id: v4(),
|
|
81
|
+
componentName: "Page",
|
|
82
|
+
props: {},
|
|
83
|
+
state: {},
|
|
84
|
+
children: [{
|
|
85
|
+
componentName: "PageFormGroup",
|
|
86
|
+
props: {
|
|
87
|
+
title: schema.label,
|
|
88
|
+
form: form,
|
|
89
|
+
items: items
|
|
90
|
+
}
|
|
91
|
+
}]
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
return FormGroupRender;
|
|
97
|
+
}(Component);
|
|
@@ -10,8 +10,9 @@ export interface ShowFormProps {
|
|
|
10
10
|
mode?: PageFormModeType;
|
|
11
11
|
lockMode?: boolean;
|
|
12
12
|
dataId?: string;
|
|
13
|
-
onSubmitOk?: () => void;
|
|
13
|
+
onSubmitOk?: (data: any) => void;
|
|
14
14
|
onRemoveOk?: () => void;
|
|
15
15
|
onClose?: () => void | Promise<void>;
|
|
16
|
+
pageRef?: (page: any) => void;
|
|
16
17
|
}
|
|
17
18
|
export declare function showForm(options: ShowFormProps): Promise<any>;
|
|
@@ -16,7 +16,7 @@ export function showForm(_x) {
|
|
|
16
16
|
}
|
|
17
17
|
function _showForm() {
|
|
18
18
|
_showForm = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
19
|
-
var container, onClose, props, _options$form, paths, mode, dataId, params, url,
|
|
19
|
+
var container, onClose, props, _options$form, paths, mode, dataId, params, url, _page;
|
|
20
20
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
21
21
|
while (1) switch (_context.prev = _context.next) {
|
|
22
22
|
case 0:
|
|
@@ -35,8 +35,8 @@ function _showForm() {
|
|
|
35
35
|
_context.next = 9;
|
|
36
36
|
return openPage(url, url);
|
|
37
37
|
case 9:
|
|
38
|
-
|
|
39
|
-
console.debug("openPage",
|
|
38
|
+
_page = _context.sent;
|
|
39
|
+
console.debug("openPage", _page);
|
|
40
40
|
return _context.abrupt("return");
|
|
41
41
|
case 12:
|
|
42
42
|
return _context.abrupt("return", renderElement({
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import _message from "antd/es/message";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { apiRequest } from "../api";
|
|
5
|
+
import { FormIds } from "../formIds";
|
|
6
|
+
import { hideLoading, showLoading } from "./index";
|
|
7
|
+
export function getFormPrintTemplates(_x) {
|
|
8
|
+
return _getFormPrintTemplates.apply(this, arguments);
|
|
9
|
+
}
|
|
10
|
+
function _getFormPrintTemplates() {
|
|
11
|
+
_getFormPrintTemplates = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(formId) {
|
|
12
|
+
var res;
|
|
13
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
14
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
_context.next = 2;
|
|
17
|
+
return apiRequest.get("forms/search", {
|
|
18
|
+
params: {
|
|
19
|
+
formId: FormIds.printTemplate,
|
|
20
|
+
filterRules: [{
|
|
21
|
+
key: "page",
|
|
22
|
+
operator: "eq",
|
|
23
|
+
value: formId
|
|
24
|
+
}],
|
|
25
|
+
pageSize: 1000
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
case 2:
|
|
29
|
+
res = _context.sent;
|
|
30
|
+
if (!res.success) {
|
|
31
|
+
_context.next = 7;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
return _context.abrupt("return", res.data);
|
|
35
|
+
case 7:
|
|
36
|
+
return _context.abrupt("return", []);
|
|
37
|
+
case 8:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}, _callee);
|
|
42
|
+
}));
|
|
43
|
+
return _getFormPrintTemplates.apply(this, arguments);
|
|
44
|
+
}
|
|
45
|
+
export function print(_x2) {
|
|
46
|
+
return _print.apply(this, arguments);
|
|
47
|
+
}
|
|
48
|
+
function _print() {
|
|
49
|
+
_print = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(options) {
|
|
50
|
+
var templateId, iw;
|
|
51
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
52
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
53
|
+
case 0:
|
|
54
|
+
_context2.prev = 0;
|
|
55
|
+
_context2.next = 3;
|
|
56
|
+
return showLoading();
|
|
57
|
+
case 3:
|
|
58
|
+
templateId = options === null || options === void 0 ? void 0 : options.templateId;
|
|
59
|
+
if (templateId) {
|
|
60
|
+
_context2.next = 7;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
_message.error("\u6253\u5370\u5931\u8D25!\u6A21\u677Fid\u4E0D\u53EF\u4E3A\u7A7A!");
|
|
64
|
+
return _context2.abrupt("return");
|
|
65
|
+
case 7:
|
|
66
|
+
_context2.next = 9;
|
|
67
|
+
return openPrint(templateId);
|
|
68
|
+
case 9:
|
|
69
|
+
iw = _context2.sent;
|
|
70
|
+
if (iw) {
|
|
71
|
+
_context2.next = 13;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
_message.error("\u6253\u5370\u5931\u8D25!\u6253\u5370\u7A97\u53E3\u4E0D\u53EF\u4E3A\u7A7A!");
|
|
75
|
+
return _context2.abrupt("return");
|
|
76
|
+
case 13:
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
iw.printOptions = options;
|
|
79
|
+
_context2.next = 19;
|
|
80
|
+
break;
|
|
81
|
+
case 16:
|
|
82
|
+
_context2.prev = 16;
|
|
83
|
+
_context2.t0 = _context2["catch"](0);
|
|
84
|
+
console.log("打印失败", _context2.t0);
|
|
85
|
+
case 19:
|
|
86
|
+
_context2.prev = 19;
|
|
87
|
+
return _context2.finish(19);
|
|
88
|
+
case 21:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context2.stop();
|
|
91
|
+
}
|
|
92
|
+
}, _callee2, null, [[0, 16, 19, 21]]);
|
|
93
|
+
}));
|
|
94
|
+
return _print.apply(this, arguments);
|
|
95
|
+
}
|
|
96
|
+
function openPrint(_x3) {
|
|
97
|
+
return _openPrint.apply(this, arguments);
|
|
98
|
+
}
|
|
99
|
+
function _openPrint() {
|
|
100
|
+
_openPrint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(templateId) {
|
|
101
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
102
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
103
|
+
case 0:
|
|
104
|
+
return _context4.abrupt("return", new Promise( /*#__PURE__*/function () {
|
|
105
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(resolve, reject) {
|
|
106
|
+
var iframe, iframeWindow;
|
|
107
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
108
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
109
|
+
case 0:
|
|
110
|
+
iframe = document.createElement("iframe");
|
|
111
|
+
iframe.src = "/print/" + templateId;
|
|
112
|
+
iframe.style.display = "none";
|
|
113
|
+
document.body.appendChild(iframe);
|
|
114
|
+
iframeWindow = iframe.contentWindow;
|
|
115
|
+
if (iframeWindow) {
|
|
116
|
+
_context3.next = 8;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
reject("创建Iframe失败!");
|
|
120
|
+
return _context3.abrupt("return");
|
|
121
|
+
case 8:
|
|
122
|
+
iframeWindow.onload = function () {
|
|
123
|
+
resolve(iframeWindow);
|
|
124
|
+
};
|
|
125
|
+
iframeWindow.addEventListener("beforeprint", function () {});
|
|
126
|
+
iframeWindow.addEventListener("afterprint", function () {
|
|
127
|
+
hideLoading();
|
|
128
|
+
iframe.remove();
|
|
129
|
+
});
|
|
130
|
+
case 11:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context3.stop();
|
|
133
|
+
}
|
|
134
|
+
}, _callee3);
|
|
135
|
+
}));
|
|
136
|
+
return function (_x4, _x5) {
|
|
137
|
+
return _ref.apply(this, arguments);
|
|
138
|
+
};
|
|
139
|
+
}()));
|
|
140
|
+
case 1:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context4.stop();
|
|
143
|
+
}
|
|
144
|
+
}, _callee4);
|
|
145
|
+
}));
|
|
146
|
+
return _openPrint.apply(this, arguments);
|
|
147
|
+
}
|
package/lib/index.less
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { AxiosProgressEvent } from "axios";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
interface File {
|
|
4
|
+
id?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
status?: "done" | "uploading" | "error";
|
|
9
|
+
url: string;
|
|
10
|
+
percent?: number;
|
|
11
|
+
buffer?: Buffer;
|
|
12
|
+
}
|
|
13
|
+
export declare function upload(file: File, options?: {
|
|
14
|
+
onProgress?: (evt: AxiosProgressEvent) => void;
|
|
15
|
+
onFinished?: () => void;
|
|
16
|
+
onError?: (e: any) => void;
|
|
17
|
+
}): Promise<File>;
|
|
7
18
|
export declare function update(file: any): Promise<void>;
|
|
19
|
+
export {};
|
|
@@ -20,10 +20,11 @@ function _upload() {
|
|
|
20
20
|
_context.next = 2;
|
|
21
21
|
break;
|
|
22
22
|
}
|
|
23
|
-
return _context.abrupt("return");
|
|
23
|
+
return _context.abrupt("return", file);
|
|
24
24
|
case 2:
|
|
25
25
|
_context.next = 4;
|
|
26
26
|
return _index.apiRequest.post("files/signature", {
|
|
27
|
+
id: file.id,
|
|
27
28
|
size: file.size,
|
|
28
29
|
name: file.name,
|
|
29
30
|
type: file.type
|
|
@@ -41,7 +42,7 @@ function _upload() {
|
|
|
41
42
|
file.status = "uploading";
|
|
42
43
|
_context.prev = 10;
|
|
43
44
|
_context.next = 13;
|
|
44
|
-
return _index.apiRequest.put(ossFile.uploadUrl, file, {
|
|
45
|
+
return _index.apiRequest.put(ossFile.uploadUrl, (file === null || file === void 0 ? void 0 : file.buffer) || file, {
|
|
45
46
|
headers: {
|
|
46
47
|
'Content-Type': file.type
|
|
47
48
|
},
|
|
@@ -54,18 +55,20 @@ function _upload() {
|
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
case 13:
|
|
58
|
+
file.status = "done";
|
|
57
59
|
options === null || options === void 0 ? void 0 : (_options$onFinished = options.onFinished) === null || _options$onFinished === void 0 ? void 0 : _options$onFinished.call(options);
|
|
58
|
-
_context.next =
|
|
60
|
+
_context.next = 21;
|
|
59
61
|
break;
|
|
60
|
-
case
|
|
61
|
-
_context.prev =
|
|
62
|
+
case 17:
|
|
63
|
+
_context.prev = 17;
|
|
62
64
|
_context.t0 = _context["catch"](10);
|
|
65
|
+
file.status = "error";
|
|
63
66
|
options === null || options === void 0 ? void 0 : (_options$onError = options.onError) === null || _options$onError === void 0 ? void 0 : _options$onError.call(options, _context.t0);
|
|
64
|
-
case
|
|
67
|
+
case 21:
|
|
65
68
|
case "end":
|
|
66
69
|
return _context.stop();
|
|
67
70
|
}
|
|
68
|
-
}, _callee, null, [[10,
|
|
71
|
+
}, _callee, null, [[10, 17]]);
|
|
69
72
|
}));
|
|
70
73
|
return _upload.apply(this, arguments);
|
|
71
74
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseRequestOptions, ManyResult, OneResult, RestApi, RestSearchParams } from "./rest-api";
|
|
2
2
|
import { AxiosRequestConfig } from "axios";
|
|
3
|
-
export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean): RestFormApi<any
|
|
3
|
+
export declare function getFormApi(formId: string, fieldId?: string, mock?: boolean): Promise<RestFormApi<any>>;
|
|
4
4
|
export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
5
5
|
private readonly formId;
|
|
6
6
|
private readonly fieldId?;
|