@zhubangyun/lowcode-core 6.1.90 → 6.2.30
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.js +12 -34
- package/es/index.less +11 -0
- package/es/init/init.bar-height.d.ts +1 -0
- package/es/init/init.bar-height.js +37 -0
- package/es/init/init.mobile-class.d.ts +1 -0
- package/es/init/init.mobile-class.js +10 -0
- package/es/init/init.scroll-size.d.ts +5 -0
- package/es/init/init.scroll-size.js +26 -0
- package/es/style.js +1 -1
- package/es/utils/api/form-api.d.ts +1 -0
- package/es/utils/api/form-api.js +101 -19
- package/es/utils/api/index.js +3 -2
- package/es/utils/common/index.d.ts +1 -1
- package/es/utils/common/index.js +5 -1
- package/es/utils/page/index.js +10 -6
- package/es/utils/page/page-form-data-manager-group.js +8 -8
- package/es/utils/page/page-form-data-manager.js +8 -8
- package/es/utils/page/page-form.js +4 -6
- package/es/utils/page/page-layout.d.ts +2 -1
- package/es/utils/page/page-layout.js +23 -3
- package/es/utils/page/page-render.js +4 -5
- package/es/utils/page/page-show.js +4 -4
- package/es/utils/page/print-form.d.ts +3 -2
- package/es/utils/page/print-form.js +184 -54
- package/es/utils/uni-bridge.d.ts +2 -0
- package/es/utils/uni-bridge.js +78 -36
- package/es/utils/utils.scrollbar-size.js +0 -0
- package/lib/index.js +12 -34
- package/lib/index.less +11 -0
- package/lib/init/init.bar-height.d.ts +1 -0
- package/lib/init/init.bar-height.js +42 -0
- package/lib/init/init.mobile-class.d.ts +1 -0
- package/lib/init/init.mobile-class.js +14 -0
- package/lib/init/init.scroll-size.d.ts +5 -0
- package/lib/init/init.scroll-size.js +31 -0
- package/lib/style.js +1 -1
- package/lib/utils/api/form-api.d.ts +1 -0
- package/lib/utils/api/form-api.js +100 -18
- package/lib/utils/api/index.js +3 -2
- package/lib/utils/common/index.d.ts +1 -1
- package/lib/utils/common/index.js +5 -1
- package/lib/utils/page/index.js +10 -6
- package/lib/utils/page/page-form-data-manager-group.js +8 -8
- package/lib/utils/page/page-form-data-manager.js +8 -8
- package/lib/utils/page/page-form.js +4 -6
- package/lib/utils/page/page-layout.d.ts +2 -1
- package/lib/utils/page/page-layout.js +23 -3
- package/lib/utils/page/page-render.js +4 -5
- package/lib/utils/page/page-show.js +4 -4
- package/lib/utils/page/print-form.d.ts +3 -2
- package/lib/utils/page/print-form.js +184 -54
- package/lib/utils/uni-bridge.d.ts +2 -0
- package/lib/utils/uni-bridge.js +78 -36
- package/lib/utils/utils.scrollbar-size.js +1 -0
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
1
|
+
import _message from "antd/es/message";
|
|
3
2
|
import "./index.less";
|
|
4
3
|
import { ReactRender } from "./components/react-render";
|
|
5
4
|
import * as lodash from "lodash";
|
|
@@ -10,6 +9,9 @@ export { Layout } from "./components/layout";
|
|
|
10
9
|
export { ReactRender } from "./components/react-render";
|
|
11
10
|
import utils from "./utils/index";
|
|
12
11
|
import { uniBridge } from "./utils/uni-bridge";
|
|
12
|
+
import { initBarHeight } from "./init/init.bar-height";
|
|
13
|
+
import { initScrollSize } from "./init/init.scroll-size";
|
|
14
|
+
import { initMobileClass } from "./init/init.mobile-class";
|
|
13
15
|
// @ts-ignore
|
|
14
16
|
window.__ReactRender = ReactRender;
|
|
15
17
|
// @ts-ignore
|
|
@@ -22,41 +24,17 @@ if (!window.utils) {
|
|
|
22
24
|
// @ts-ignore
|
|
23
25
|
window.utils = utils;
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var classList = window.document.body.classList;
|
|
28
|
-
if (!classList.contains("mobile")) {
|
|
29
|
-
classList.add("mobile");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
var bar_height_key = "bar_height";
|
|
27
|
+
initMobileClass();
|
|
28
|
+
|
|
33
29
|
// @ts-ignore
|
|
34
30
|
utils.uniBridge = uniBridge;
|
|
35
31
|
// @ts-ignore
|
|
36
32
|
window.uniBridge = uniBridge;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
while (1) switch (_context.prev = _context.next) {
|
|
42
|
-
case 0:
|
|
43
|
-
_context.next = 1;
|
|
44
|
-
return uniBridge.getBarHeight();
|
|
45
|
-
case 1:
|
|
46
|
-
height = _context.sent;
|
|
47
|
-
localStorage.setItem(bar_height_key, height);
|
|
48
|
-
updateBarHeight();
|
|
49
|
-
case 2:
|
|
50
|
-
case "end":
|
|
51
|
-
return _context.stop();
|
|
52
|
-
}
|
|
53
|
-
}, _callee);
|
|
54
|
-
})), 100);
|
|
33
|
+
_message.config({
|
|
34
|
+
top: 150,
|
|
35
|
+
duration: 5,
|
|
36
|
+
maxCount: 3
|
|
55
37
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
document.documentElement.style.setProperty('--bar-height', localStorage.getItem(bar_height_key));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
updateBarHeight();
|
|
38
|
+
initBarHeight();
|
|
39
|
+
initScrollSize();
|
|
62
40
|
export { utils, lodash };
|
package/es/index.less
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--scroll-bar-width: 15px;
|
|
3
|
+
--scroll-bar-height: 15px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ant-table-cell-scrollbar {
|
|
7
|
+
padding: 0 !important;
|
|
8
|
+
width: var(--scroll-bar-width);
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
[componentname="Page"] {
|
|
2
12
|
height: 100%;
|
|
3
13
|
}
|
|
4
14
|
|
|
15
|
+
|
|
5
16
|
ul {
|
|
6
17
|
margin-bottom: 0;
|
|
7
18
|
padding-left: 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initBarHeight(): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { uniBridge } from "../utils/uni-bridge";
|
|
4
|
+
var bar_height_key = "bar_height";
|
|
5
|
+
export function initBarHeight() {
|
|
6
|
+
updateBarHeight();
|
|
7
|
+
window.onload = function () {
|
|
8
|
+
setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
9
|
+
var height;
|
|
10
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
11
|
+
while (1) switch (_context.prev = _context.next) {
|
|
12
|
+
case 0:
|
|
13
|
+
if (!window.uni) {
|
|
14
|
+
_context.next = 2;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
_context.next = 1;
|
|
18
|
+
return uniBridge.getBarHeight();
|
|
19
|
+
case 1:
|
|
20
|
+
height = _context.sent;
|
|
21
|
+
localStorage.setItem(bar_height_key, height);
|
|
22
|
+
updateBarHeight();
|
|
23
|
+
case 2:
|
|
24
|
+
case "end":
|
|
25
|
+
return _context.stop();
|
|
26
|
+
}
|
|
27
|
+
}, _callee);
|
|
28
|
+
})), 100);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function updateBarHeight() {
|
|
32
|
+
var style = document.documentElement.style;
|
|
33
|
+
var barHeight = localStorage.getItem(bar_height_key);
|
|
34
|
+
if (barHeight) {
|
|
35
|
+
style.setProperty('--bar-height', barHeight);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initMobileClass(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isMobile } from "../utils/common";
|
|
2
|
+
export function initMobileClass() {
|
|
3
|
+
window.isMobile = isMobile();
|
|
4
|
+
if (window.isMobile) {
|
|
5
|
+
var classList = window.document.body.classList;
|
|
6
|
+
if (!classList.contains("mobile")) {
|
|
7
|
+
classList.add("mobile");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var scrollbarSize = {};
|
|
2
|
+
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
window.scrollbarSize = scrollbarSize;
|
|
5
|
+
export function initScrollSize() {
|
|
6
|
+
var size = getScrollbarSize();
|
|
7
|
+
var style = document.documentElement.style;
|
|
8
|
+
style.setProperty('--scroll-bar-height', size.height + "px");
|
|
9
|
+
style.setProperty('--scroll-bar-width', size.width + "px");
|
|
10
|
+
}
|
|
11
|
+
export function getScrollbarSize() {
|
|
12
|
+
if (typeof scrollbarSize.height == "number" && typeof scrollbarSize.width == "number") {
|
|
13
|
+
return scrollbarSize;
|
|
14
|
+
}
|
|
15
|
+
var outer = document.createElement('div');
|
|
16
|
+
outer.style.cssText = "\n visibility: hidden;\n overflow: scroll;\n position: absolute;\n top: -9999px;\n width: 50px;\n height: 50px;\n ";
|
|
17
|
+
document.body.appendChild(outer);
|
|
18
|
+
var inner = document.createElement('div');
|
|
19
|
+
inner.style.width = '100%';
|
|
20
|
+
inner.style.height = '100%';
|
|
21
|
+
outer.appendChild(inner);
|
|
22
|
+
scrollbarSize.width = outer.offsetWidth - inner.offsetWidth;
|
|
23
|
+
scrollbarSize.height = outer.offsetHeight - inner.offsetHeight;
|
|
24
|
+
document.body.removeChild(outer);
|
|
25
|
+
return scrollbarSize;
|
|
26
|
+
}
|
package/es/style.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import 'antd/es/message/style';
|
|
1
2
|
import 'antd/es/config-provider/style';
|
|
2
3
|
|
|
3
4
|
import 'antd/es/notification/style';
|
|
4
5
|
import 'antd/es/modal/style';
|
|
5
|
-
import 'antd/es/message/style';
|
|
6
6
|
import 'antd/es/typography/style';
|
|
7
7
|
import 'antd/es/drawer/style';
|
|
8
8
|
import 'antd/es/result/style';
|
|
@@ -16,5 +16,6 @@ export declare class RestFormApi<DataType> extends RestApi<DataType> {
|
|
|
16
16
|
save(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
17
17
|
create(data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
18
18
|
update(id: string, data: DataType, options?: BaseRequestOptions<DataType>): Promise<OneResult<DataType>>;
|
|
19
|
+
fieldFilters(searchParams?: RestSearchParams): Promise<ManyResult<DataType>>;
|
|
19
20
|
serviceUpdate(data: DataType, options?: BaseRequestOptions<DataType>): Promise<import("axios").AxiosResponse<any, any, {}>>;
|
|
20
21
|
}
|
package/es/utils/api/form-api.js
CHANGED
|
@@ -6,15 +6,15 @@ import { RestApi } from "./rest-api";
|
|
|
6
6
|
import { assembleAssociationField, convertSaveData, handleFilterRules } from "./form-api.utils";
|
|
7
7
|
import { formApi } from "../cache";
|
|
8
8
|
import { getSchemaFromCache } from "./schema-api";
|
|
9
|
-
import { uuid } from "../common";
|
|
9
|
+
import { uuid, uuidVersion } from "../common";
|
|
10
10
|
export function getFormApi(_x, _x2, _x3) {
|
|
11
11
|
return _getFormApi.apply(this, arguments);
|
|
12
12
|
}
|
|
13
13
|
function _getFormApi() {
|
|
14
|
-
_getFormApi = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
14
|
+
_getFormApi = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(formId, fieldId, mock) {
|
|
15
15
|
var key;
|
|
16
|
-
return _regeneratorRuntime.wrap(function (
|
|
17
|
-
while (1) switch (
|
|
16
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
17
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
18
18
|
case 0:
|
|
19
19
|
if (typeof mock != "boolean") {
|
|
20
20
|
if (typeof window.__mock == "boolean") {
|
|
@@ -24,16 +24,16 @@ function _getFormApi() {
|
|
|
24
24
|
key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
25
25
|
return !!key;
|
|
26
26
|
}).join("_");
|
|
27
|
-
return
|
|
27
|
+
return _context1.abrupt("return", formApi.getInstance(key, {
|
|
28
28
|
mock: mock,
|
|
29
29
|
fieldId: fieldId,
|
|
30
30
|
formId: formId
|
|
31
31
|
}));
|
|
32
32
|
case 1:
|
|
33
33
|
case "end":
|
|
34
|
-
return
|
|
34
|
+
return _context1.stop();
|
|
35
35
|
}
|
|
36
|
-
},
|
|
36
|
+
}, _callee1);
|
|
37
37
|
}));
|
|
38
38
|
return _getFormApi.apply(this, arguments);
|
|
39
39
|
}
|
|
@@ -184,22 +184,59 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
184
184
|
}();
|
|
185
185
|
_proto.getById = /*#__PURE__*/function () {
|
|
186
186
|
var _getById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, options) {
|
|
187
|
-
var res;
|
|
187
|
+
var searchId, url, res, _t;
|
|
188
188
|
return _regeneratorRuntime.wrap(function (_context4) {
|
|
189
189
|
while (1) switch (_context4.prev = _context4.next) {
|
|
190
190
|
case 0:
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
if (id) {
|
|
192
|
+
_context4.next = 1;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
return _context4.abrupt("return", {
|
|
196
|
+
success: false,
|
|
197
|
+
message: "数据Id不可为空!"
|
|
198
|
+
});
|
|
193
199
|
case 1:
|
|
200
|
+
searchId = id;
|
|
201
|
+
if (!id.startsWith("http")) {
|
|
202
|
+
_context4.next = 2;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
url = new URL(searchId);
|
|
206
|
+
searchId = url.searchParams.get("dataId");
|
|
207
|
+
if (searchId) {
|
|
208
|
+
_context4.next = 2;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
return _context4.abrupt("return", {
|
|
212
|
+
success: false,
|
|
213
|
+
message: "数据Id不可为空!"
|
|
214
|
+
});
|
|
215
|
+
case 2:
|
|
216
|
+
_context4.prev = 2;
|
|
217
|
+
uuidVersion(searchId);
|
|
218
|
+
_context4.next = 4;
|
|
219
|
+
break;
|
|
220
|
+
case 3:
|
|
221
|
+
_context4.prev = 3;
|
|
222
|
+
_t = _context4["catch"](2);
|
|
223
|
+
return _context4.abrupt("return", {
|
|
224
|
+
success: false,
|
|
225
|
+
message: "\u975E\u6CD5\u7684\u6570\u636EID:" + searchId
|
|
226
|
+
});
|
|
227
|
+
case 4:
|
|
228
|
+
_context4.next = 5;
|
|
229
|
+
return _RestApi.prototype.getById.call(this, searchId, options);
|
|
230
|
+
case 5:
|
|
194
231
|
res = _context4.sent;
|
|
195
232
|
assembleAssociationField(res.data, res.refs);
|
|
196
233
|
console.debug("formApi.getById", res);
|
|
197
234
|
return _context4.abrupt("return", res);
|
|
198
|
-
case
|
|
235
|
+
case 6:
|
|
199
236
|
case "end":
|
|
200
237
|
return _context4.stop();
|
|
201
238
|
}
|
|
202
|
-
}, _callee4, this);
|
|
239
|
+
}, _callee4, this, [[2, 3]]);
|
|
203
240
|
}));
|
|
204
241
|
function getById(_x6, _x7) {
|
|
205
242
|
return _getById.apply(this, arguments);
|
|
@@ -295,30 +332,75 @@ export var RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
295
332
|
}
|
|
296
333
|
return update;
|
|
297
334
|
}();
|
|
298
|
-
_proto.
|
|
299
|
-
var
|
|
300
|
-
var
|
|
335
|
+
_proto.fieldFilters = /*#__PURE__*/function () {
|
|
336
|
+
var _fieldFilters = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(searchParams) {
|
|
337
|
+
var _searchParams3, _searchParams4;
|
|
338
|
+
var params, config, res;
|
|
301
339
|
return _regeneratorRuntime.wrap(function (_context9) {
|
|
302
340
|
while (1) switch (_context9.prev = _context9.next) {
|
|
303
341
|
case 0:
|
|
342
|
+
searchParams = searchParams || {};
|
|
304
343
|
params = {
|
|
305
344
|
formId: this.formId,
|
|
306
345
|
fieldId: this.fieldId
|
|
307
346
|
};
|
|
308
347
|
if (__mock) {
|
|
309
|
-
params.mock = true;
|
|
310
348
|
params.description = (this.title || "表单") + ".\u67E5\u8BE2";
|
|
311
349
|
}
|
|
312
|
-
|
|
350
|
+
config = {
|
|
313
351
|
params: params
|
|
314
|
-
}
|
|
352
|
+
};
|
|
353
|
+
_context9.next = 1;
|
|
354
|
+
return this.handleRequestConfig(config);
|
|
315
355
|
case 1:
|
|
356
|
+
searchParams.filterRules = handleFilterRules(((_searchParams3 = searchParams) === null || _searchParams3 === void 0 ? void 0 : _searchParams3.filterRules) || [], {
|
|
357
|
+
filterNullValue: false
|
|
358
|
+
});
|
|
359
|
+
searchParams.searchFields = handleFilterRules(((_searchParams4 = searchParams) === null || _searchParams4 === void 0 ? void 0 : _searchParams4.searchFields) || [], {
|
|
360
|
+
filterNullValue: true
|
|
361
|
+
});
|
|
362
|
+
config.params = _extends({}, params, searchParams);
|
|
363
|
+
_context9.next = 2;
|
|
364
|
+
return this.request.get("fieldFilters", config);
|
|
365
|
+
case 2:
|
|
366
|
+
res = _context9.sent;
|
|
367
|
+
console.debug("form.fieldFilters:", res);
|
|
368
|
+
return _context9.abrupt("return", res);
|
|
369
|
+
case 3:
|
|
316
370
|
case "end":
|
|
317
371
|
return _context9.stop();
|
|
318
372
|
}
|
|
319
373
|
}, _callee9, this);
|
|
320
374
|
}));
|
|
321
|
-
function
|
|
375
|
+
function fieldFilters(_x15) {
|
|
376
|
+
return _fieldFilters.apply(this, arguments);
|
|
377
|
+
}
|
|
378
|
+
return fieldFilters;
|
|
379
|
+
}();
|
|
380
|
+
_proto.serviceUpdate = /*#__PURE__*/function () {
|
|
381
|
+
var _serviceUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(data, options) {
|
|
382
|
+
var params;
|
|
383
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
384
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
385
|
+
case 0:
|
|
386
|
+
params = {
|
|
387
|
+
formId: this.formId,
|
|
388
|
+
fieldId: this.fieldId
|
|
389
|
+
};
|
|
390
|
+
if (__mock) {
|
|
391
|
+
params.mock = true;
|
|
392
|
+
params.description = (this.title || "表单") + ".\u67E5\u8BE2";
|
|
393
|
+
}
|
|
394
|
+
return _context0.abrupt("return", this.request.post("serviceUpdate", data, {
|
|
395
|
+
params: params
|
|
396
|
+
}));
|
|
397
|
+
case 1:
|
|
398
|
+
case "end":
|
|
399
|
+
return _context0.stop();
|
|
400
|
+
}
|
|
401
|
+
}, _callee0, this);
|
|
402
|
+
}));
|
|
403
|
+
function serviceUpdate(_x16, _x17) {
|
|
322
404
|
return _serviceUpdate.apply(this, arguments);
|
|
323
405
|
}
|
|
324
406
|
return serviceUpdate;
|
package/es/utils/api/index.js
CHANGED
|
@@ -31,13 +31,14 @@ export function onFulfilled(res) {
|
|
|
31
31
|
export function onRejected(error) {
|
|
32
32
|
var _error$response = error.response,
|
|
33
33
|
status = _error$response.status,
|
|
34
|
-
statusText = _error$response.statusText
|
|
34
|
+
statusText = _error$response.statusText,
|
|
35
|
+
data = _error$response.data;
|
|
35
36
|
console.error("请求失败!", error);
|
|
36
37
|
if (status == 400) {
|
|
37
38
|
return error.response.data || {};
|
|
38
39
|
}
|
|
39
40
|
return {
|
|
40
41
|
success: false,
|
|
41
|
-
message: statusText
|
|
42
|
+
message: (data === null || data === void 0 ? void 0 : data.message) || statusText
|
|
42
43
|
};
|
|
43
44
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { loadPlugins } from "./LoadPlugins";
|
|
2
2
|
export declare function uuid(prefix?: string, separator?: string): string;
|
|
3
|
-
export declare function uuidVersion(id: string): number;
|
|
3
|
+
export declare function uuidVersion(id: string): number | false;
|
|
4
4
|
export declare function toArray(data: any): any[];
|
|
5
5
|
export declare function isLocalhost(): boolean;
|
|
6
6
|
export declare function isMobile(): boolean;
|
package/es/utils/common/index.js
CHANGED
package/es/utils/page/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { uniBridge } from "../uni-bridge";
|
|
3
4
|
export { print, getFormPrintTemplates } from "./print-form";
|
|
4
5
|
export { showForm } from "./page-form";
|
|
5
6
|
export { showFormGroup } from "./page-form-group";
|
|
@@ -27,6 +28,7 @@ function _showLoading() {
|
|
|
27
28
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
28
29
|
while (1) switch (_context.prev = _context.next) {
|
|
29
30
|
case 0:
|
|
31
|
+
console.log("page.show.loading");
|
|
30
32
|
loading = document.getElementById("fullscreen-loading");
|
|
31
33
|
if (loading) {
|
|
32
34
|
loading.style.display = "flex";
|
|
@@ -53,6 +55,7 @@ function _hideLoading() {
|
|
|
53
55
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
54
56
|
while (1) switch (_context2.prev = _context2.next) {
|
|
55
57
|
case 0:
|
|
58
|
+
console.log("page.hide.loading");
|
|
56
59
|
loading = document.getElementById("fullscreen-loading");
|
|
57
60
|
if (loading) {
|
|
58
61
|
loading.style.display = "none";
|
|
@@ -87,14 +90,15 @@ function _openPage() {
|
|
|
87
90
|
url: url
|
|
88
91
|
});
|
|
89
92
|
case 1:
|
|
90
|
-
|
|
91
|
-
_context3.next = 3;
|
|
92
|
-
break;
|
|
93
|
+
return _context3.abrupt("return", _context3.sent);
|
|
93
94
|
case 2:
|
|
94
|
-
|
|
95
|
+
if (!isMobile) {
|
|
96
|
+
_context3.next = 3;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
return _context3.abrupt("return", uniBridge.navigateTo(url));
|
|
95
100
|
case 3:
|
|
96
|
-
|
|
97
|
-
return _context3.abrupt("return", page);
|
|
101
|
+
return _context3.abrupt("return", window.open(url, target));
|
|
98
102
|
case 4:
|
|
99
103
|
case "end":
|
|
100
104
|
return _context3.stop();
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
var _excluded = ["layout", "items", "onSelectOk", "onClose"],
|
|
6
|
-
_excluded2 = ["
|
|
5
|
+
var _excluded = ["layout", "items", "onSelectOk", "container", "onClose"],
|
|
6
|
+
_excluded2 = ["onClose"];
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { PageLayout } from "./page-layout";
|
|
9
9
|
import React, { Component } from "react";
|
|
@@ -15,13 +15,13 @@ export function showFormDataManagerGroup(_x) {
|
|
|
15
15
|
}
|
|
16
16
|
function _showFormDataManagerGroup() {
|
|
17
17
|
_showFormDataManagerGroup = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
18
|
-
var
|
|
18
|
+
var onClose, props;
|
|
19
19
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
20
20
|
while (1) switch (_context.prev = _context.next) {
|
|
21
21
|
case 0:
|
|
22
|
-
|
|
22
|
+
onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
|
|
23
23
|
return _context.abrupt("return", renderElement({
|
|
24
|
-
container: container,
|
|
24
|
+
container: props.container,
|
|
25
25
|
onClose: onClose,
|
|
26
26
|
element: {
|
|
27
27
|
component: FormDataManagerRender,
|
|
@@ -55,6 +55,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
55
55
|
layout = _this$props.layout,
|
|
56
56
|
items = _this$props.items,
|
|
57
57
|
onSelectOk = _this$props.onSelectOk,
|
|
58
|
+
container = _this$props.container,
|
|
58
59
|
onClose = _this$props.onClose,
|
|
59
60
|
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
60
61
|
// @ts-ignore
|
|
@@ -72,13 +73,12 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
72
73
|
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
|
|
73
74
|
};
|
|
74
75
|
return /*#__PURE__*/React.createElement(PageLayout, {
|
|
76
|
+
container: container,
|
|
75
77
|
ref: function ref(layout) {
|
|
76
78
|
return _this2.layoutRef = layout;
|
|
77
79
|
},
|
|
78
80
|
layout: layout,
|
|
79
|
-
onClose:
|
|
80
|
-
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
|
|
81
|
-
}
|
|
81
|
+
onClose: onClose
|
|
82
82
|
}, /*#__PURE__*/React.createElement(ReactRender, _extends({}, restProps, {
|
|
83
83
|
components: window._components || window.components || window.__components,
|
|
84
84
|
schema: {
|
|
@@ -2,8 +2,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
var _excluded = ["layout", "form", "onSelectOk", "onClose"],
|
|
6
|
-
_excluded2 = ["
|
|
5
|
+
var _excluded = ["layout", "form", "onSelectOk", "onClose", "container"],
|
|
6
|
+
_excluded2 = ["onClose"];
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { PageLayout } from "./page-layout";
|
|
9
9
|
import React, { Component } from "react";
|
|
@@ -17,13 +17,13 @@ export function showFormDataManager(_x) {
|
|
|
17
17
|
}
|
|
18
18
|
function _showFormDataManager() {
|
|
19
19
|
_showFormDataManager = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(options) {
|
|
20
|
-
var
|
|
20
|
+
var onClose, props;
|
|
21
21
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
22
22
|
while (1) switch (_context.prev = _context.next) {
|
|
23
23
|
case 0:
|
|
24
|
-
|
|
24
|
+
onClose = options.onClose, props = _objectWithoutPropertiesLoose(options, _excluded2);
|
|
25
25
|
return _context.abrupt("return", renderElement({
|
|
26
|
-
container: container,
|
|
26
|
+
container: props.container,
|
|
27
27
|
onClose: onClose,
|
|
28
28
|
element: {
|
|
29
29
|
component: FormDataManagerRender,
|
|
@@ -58,6 +58,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
58
58
|
form = _this$props.form,
|
|
59
59
|
onSelectOk = _this$props.onSelectOk,
|
|
60
60
|
onClose = _this$props.onClose,
|
|
61
|
+
container = _this$props.container,
|
|
61
62
|
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
62
63
|
// @ts-ignore
|
|
63
64
|
restProps.layout = layout || "modal";
|
|
@@ -75,13 +76,12 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
75
76
|
};
|
|
76
77
|
var dataView = cloneDataView(this.props.dataView, this.props.extraProps);
|
|
77
78
|
return /*#__PURE__*/React.createElement(PageLayout, {
|
|
79
|
+
container: container,
|
|
78
80
|
ref: function ref(layout) {
|
|
79
81
|
return _this2.layoutRef = layout;
|
|
80
82
|
},
|
|
81
83
|
layout: layout,
|
|
82
|
-
onClose:
|
|
83
|
-
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
|
|
84
|
-
}
|
|
84
|
+
onClose: onClose
|
|
85
85
|
}, /*#__PURE__*/React.createElement(PageLoadSchema, {
|
|
86
86
|
pageId: form === null || form === void 0 ? void 0 : form.id
|
|
87
87
|
}, function (schema) {
|
|
@@ -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, _options$form2, url
|
|
19
|
+
var container, onClose, props, _options$form, paths, mode, dataId, params, _options$form2, url;
|
|
20
20
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
21
21
|
while (1) switch (_context.prev = _context.next) {
|
|
22
22
|
case 0:
|
|
@@ -37,16 +37,14 @@ function _showForm() {
|
|
|
37
37
|
if (dataId) {
|
|
38
38
|
params.set("dataId", dataId);
|
|
39
39
|
}
|
|
40
|
-
url = "/
|
|
41
|
-
if (paths[1] == "
|
|
42
|
-
url = "/pages?" + params.toString();
|
|
40
|
+
url = "/pages?" + params.toString();
|
|
41
|
+
if (paths[1] == "admin") {
|
|
42
|
+
url = "/admin/pages?" + params.toString();
|
|
43
43
|
}
|
|
44
44
|
//const url = `/${paths[1]}/${paths[2]}/${options.form?.id}/${mode}?${params.toString()}`;
|
|
45
45
|
_context.next = 1;
|
|
46
46
|
return openPage(url, url);
|
|
47
47
|
case 1:
|
|
48
|
-
page = _context.sent;
|
|
49
|
-
console.debug("openPage", page);
|
|
50
48
|
return _context.abrupt("return");
|
|
51
49
|
case 2:
|
|
52
50
|
return _context.abrupt("return", renderElement({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Component } from "react";
|
|
2
2
|
export type PageLayoutType = "page" | "modal" | "drawer";
|
|
3
3
|
interface PageLayoutProps {
|
|
4
|
+
container?: any;
|
|
4
5
|
layout?: PageLayoutType;
|
|
5
|
-
onClose?: (
|
|
6
|
+
onClose?: () => void;
|
|
6
7
|
keyboard?: boolean;
|
|
7
8
|
children: any;
|
|
8
9
|
}
|
|
@@ -41,6 +41,7 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
41
41
|
window.removeEventListener("resize", this.handleResize);
|
|
42
42
|
};
|
|
43
43
|
_proto.render = function render() {
|
|
44
|
+
var _this2 = this;
|
|
44
45
|
var _this$props = this.props,
|
|
45
46
|
children = _this$props.children,
|
|
46
47
|
extraProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
@@ -65,19 +66,38 @@ export var PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
65
66
|
padding: 0
|
|
66
67
|
}
|
|
67
68
|
},
|
|
68
|
-
maskClosable:
|
|
69
|
+
maskClosable: isMobile
|
|
69
70
|
});
|
|
70
71
|
var loadChildren = /*#__PURE__*/React.createElement(LoadMaterialChildren, null, children);
|
|
71
72
|
if (layout == "modal") {
|
|
72
73
|
restProps.style.top = 64;
|
|
73
74
|
restProps.styles.body.height = "calc(100vh - 120px)";
|
|
74
|
-
return /*#__PURE__*/React.createElement(_Modal, restProps,
|
|
75
|
+
return /*#__PURE__*/React.createElement(_Modal, _extends({}, restProps, {
|
|
76
|
+
getContainer: function getContainer() {
|
|
77
|
+
return _this2.props.container || window.document.body;
|
|
78
|
+
},
|
|
79
|
+
afterOpenChange: function afterOpenChange(open) {
|
|
80
|
+
if (!open) {
|
|
81
|
+
var _this2$props$onClose, _this2$props;
|
|
82
|
+
(_this2$props$onClose = (_this2$props = _this2.props).onClose) === null || _this2$props$onClose === void 0 ? void 0 : _this2$props$onClose.call(_this2$props);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}), loadChildren);
|
|
75
86
|
} else if (layout == "drawer") {
|
|
76
87
|
if (window.isMobile) {
|
|
77
88
|
restProps.placement = "bottom";
|
|
78
89
|
}
|
|
79
90
|
return /*#__PURE__*/React.createElement(_Drawer, _extends({}, restProps, {
|
|
80
|
-
|
|
91
|
+
getContainer: function getContainer() {
|
|
92
|
+
return _this2.props.container || window.document.body;
|
|
93
|
+
},
|
|
94
|
+
height: "75vh",
|
|
95
|
+
afterVisibleChange: function afterVisibleChange(open) {
|
|
96
|
+
if (!open) {
|
|
97
|
+
var _this2$props$onClose2, _this2$props2;
|
|
98
|
+
(_this2$props$onClose2 = (_this2$props2 = _this2.props).onClose) === null || _this2$props$onClose2 === void 0 ? void 0 : _this2$props$onClose2.call(_this2$props2);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
81
101
|
}), loadChildren);
|
|
82
102
|
}
|
|
83
103
|
return loadChildren;
|