@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/lib/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,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
exports.__esModule = true;
|
|
5
|
+
exports.initBarHeight = initBarHeight;
|
|
6
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
var _uniBridge = require("../utils/uni-bridge");
|
|
9
|
+
var bar_height_key = "bar_height";
|
|
10
|
+
function initBarHeight() {
|
|
11
|
+
updateBarHeight();
|
|
12
|
+
window.onload = function () {
|
|
13
|
+
setTimeout(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
14
|
+
var height;
|
|
15
|
+
return _regenerator["default"].wrap(function (_context) {
|
|
16
|
+
while (1) switch (_context.prev = _context.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
if (!window.uni) {
|
|
19
|
+
_context.next = 2;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
_context.next = 1;
|
|
23
|
+
return _uniBridge.uniBridge.getBarHeight();
|
|
24
|
+
case 1:
|
|
25
|
+
height = _context.sent;
|
|
26
|
+
localStorage.setItem(bar_height_key, height);
|
|
27
|
+
updateBarHeight();
|
|
28
|
+
case 2:
|
|
29
|
+
case "end":
|
|
30
|
+
return _context.stop();
|
|
31
|
+
}
|
|
32
|
+
}, _callee);
|
|
33
|
+
})), 100);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function updateBarHeight() {
|
|
37
|
+
var style = document.documentElement.style;
|
|
38
|
+
var barHeight = localStorage.getItem(bar_height_key);
|
|
39
|
+
if (barHeight) {
|
|
40
|
+
style.setProperty('--bar-height', barHeight);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function initMobileClass(): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.initMobileClass = initMobileClass;
|
|
5
|
+
var _common = require("../utils/common");
|
|
6
|
+
function initMobileClass() {
|
|
7
|
+
window.isMobile = (0, _common.isMobile)();
|
|
8
|
+
if (window.isMobile) {
|
|
9
|
+
var classList = window.document.body.classList;
|
|
10
|
+
if (!classList.contains("mobile")) {
|
|
11
|
+
classList.add("mobile");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getScrollbarSize = getScrollbarSize;
|
|
5
|
+
exports.initScrollSize = initScrollSize;
|
|
6
|
+
var scrollbarSize = {};
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
window.scrollbarSize = scrollbarSize;
|
|
10
|
+
function initScrollSize() {
|
|
11
|
+
var size = getScrollbarSize();
|
|
12
|
+
var style = document.documentElement.style;
|
|
13
|
+
style.setProperty('--scroll-bar-height', size.height + "px");
|
|
14
|
+
style.setProperty('--scroll-bar-width', size.width + "px");
|
|
15
|
+
}
|
|
16
|
+
function getScrollbarSize() {
|
|
17
|
+
if (typeof scrollbarSize.height == "number" && typeof scrollbarSize.width == "number") {
|
|
18
|
+
return scrollbarSize;
|
|
19
|
+
}
|
|
20
|
+
var outer = document.createElement('div');
|
|
21
|
+
outer.style.cssText = "\n visibility: hidden;\n overflow: scroll;\n position: absolute;\n top: -9999px;\n width: 50px;\n height: 50px;\n ";
|
|
22
|
+
document.body.appendChild(outer);
|
|
23
|
+
var inner = document.createElement('div');
|
|
24
|
+
inner.style.width = '100%';
|
|
25
|
+
inner.style.height = '100%';
|
|
26
|
+
outer.appendChild(inner);
|
|
27
|
+
scrollbarSize.width = outer.offsetWidth - inner.offsetWidth;
|
|
28
|
+
scrollbarSize.height = outer.offsetHeight - inner.offsetHeight;
|
|
29
|
+
document.body.removeChild(outer);
|
|
30
|
+
return scrollbarSize;
|
|
31
|
+
}
|
package/lib/style.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
require('antd/lib/message/style');
|
|
1
2
|
require('antd/lib/config-provider/style');
|
|
2
3
|
|
|
3
4
|
require('antd/lib/notification/style');
|
|
4
5
|
require('antd/lib/modal/style');
|
|
5
|
-
require('antd/lib/message/style');
|
|
6
6
|
require('antd/lib/typography/style');
|
|
7
7
|
require('antd/lib/drawer/style');
|
|
8
8
|
require('antd/lib/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
|
}
|
|
@@ -17,10 +17,10 @@ function getFormApi(_x, _x2, _x3) {
|
|
|
17
17
|
return _getFormApi.apply(this, arguments);
|
|
18
18
|
}
|
|
19
19
|
function _getFormApi() {
|
|
20
|
-
_getFormApi = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function
|
|
20
|
+
_getFormApi = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee1(formId, fieldId, mock) {
|
|
21
21
|
var key;
|
|
22
|
-
return _regenerator["default"].wrap(function (
|
|
23
|
-
while (1) switch (
|
|
22
|
+
return _regenerator["default"].wrap(function (_context1) {
|
|
23
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
24
24
|
case 0:
|
|
25
25
|
if (typeof mock != "boolean") {
|
|
26
26
|
if (typeof window.__mock == "boolean") {
|
|
@@ -30,16 +30,16 @@ function _getFormApi() {
|
|
|
30
30
|
key = [formId, fieldId, mock ? "mock" : ""].filter(function (key) {
|
|
31
31
|
return !!key;
|
|
32
32
|
}).join("_");
|
|
33
|
-
return
|
|
33
|
+
return _context1.abrupt("return", _cache.formApi.getInstance(key, {
|
|
34
34
|
mock: mock,
|
|
35
35
|
fieldId: fieldId,
|
|
36
36
|
formId: formId
|
|
37
37
|
}));
|
|
38
38
|
case 1:
|
|
39
39
|
case "end":
|
|
40
|
-
return
|
|
40
|
+
return _context1.stop();
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, _callee1);
|
|
43
43
|
}));
|
|
44
44
|
return _getFormApi.apply(this, arguments);
|
|
45
45
|
}
|
|
@@ -190,22 +190,59 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
190
190
|
}();
|
|
191
191
|
_proto.getById = /*#__PURE__*/function () {
|
|
192
192
|
var _getById = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee4(id, options) {
|
|
193
|
-
var res;
|
|
193
|
+
var searchId, url, res, _t;
|
|
194
194
|
return _regenerator["default"].wrap(function (_context4) {
|
|
195
195
|
while (1) switch (_context4.prev = _context4.next) {
|
|
196
196
|
case 0:
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
if (id) {
|
|
198
|
+
_context4.next = 1;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
return _context4.abrupt("return", {
|
|
202
|
+
success: false,
|
|
203
|
+
message: "数据Id不可为空!"
|
|
204
|
+
});
|
|
199
205
|
case 1:
|
|
206
|
+
searchId = id;
|
|
207
|
+
if (!id.startsWith("http")) {
|
|
208
|
+
_context4.next = 2;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
url = new URL(searchId);
|
|
212
|
+
searchId = url.searchParams.get("dataId");
|
|
213
|
+
if (searchId) {
|
|
214
|
+
_context4.next = 2;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
return _context4.abrupt("return", {
|
|
218
|
+
success: false,
|
|
219
|
+
message: "数据Id不可为空!"
|
|
220
|
+
});
|
|
221
|
+
case 2:
|
|
222
|
+
_context4.prev = 2;
|
|
223
|
+
(0, _common.uuidVersion)(searchId);
|
|
224
|
+
_context4.next = 4;
|
|
225
|
+
break;
|
|
226
|
+
case 3:
|
|
227
|
+
_context4.prev = 3;
|
|
228
|
+
_t = _context4["catch"](2);
|
|
229
|
+
return _context4.abrupt("return", {
|
|
230
|
+
success: false,
|
|
231
|
+
message: "\u975E\u6CD5\u7684\u6570\u636EID:" + searchId
|
|
232
|
+
});
|
|
233
|
+
case 4:
|
|
234
|
+
_context4.next = 5;
|
|
235
|
+
return _RestApi.prototype.getById.call(this, searchId, options);
|
|
236
|
+
case 5:
|
|
200
237
|
res = _context4.sent;
|
|
201
238
|
(0, _formApi.assembleAssociationField)(res.data, res.refs);
|
|
202
239
|
console.debug("formApi.getById", res);
|
|
203
240
|
return _context4.abrupt("return", res);
|
|
204
|
-
case
|
|
241
|
+
case 6:
|
|
205
242
|
case "end":
|
|
206
243
|
return _context4.stop();
|
|
207
244
|
}
|
|
208
|
-
}, _callee4, this);
|
|
245
|
+
}, _callee4, this, [[2, 3]]);
|
|
209
246
|
}));
|
|
210
247
|
function getById(_x6, _x7) {
|
|
211
248
|
return _getById.apply(this, arguments);
|
|
@@ -301,30 +338,75 @@ var RestFormApi = exports.RestFormApi = /*#__PURE__*/function (_RestApi) {
|
|
|
301
338
|
}
|
|
302
339
|
return update;
|
|
303
340
|
}();
|
|
304
|
-
_proto.
|
|
305
|
-
var
|
|
306
|
-
var
|
|
341
|
+
_proto.fieldFilters = /*#__PURE__*/function () {
|
|
342
|
+
var _fieldFilters = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee9(searchParams) {
|
|
343
|
+
var _searchParams3, _searchParams4;
|
|
344
|
+
var params, config, res;
|
|
307
345
|
return _regenerator["default"].wrap(function (_context9) {
|
|
308
346
|
while (1) switch (_context9.prev = _context9.next) {
|
|
309
347
|
case 0:
|
|
348
|
+
searchParams = searchParams || {};
|
|
310
349
|
params = {
|
|
311
350
|
formId: this.formId,
|
|
312
351
|
fieldId: this.fieldId
|
|
313
352
|
};
|
|
314
353
|
if (__mock) {
|
|
315
|
-
params.mock = true;
|
|
316
354
|
params.description = (this.title || "表单") + ".\u67E5\u8BE2";
|
|
317
355
|
}
|
|
318
|
-
|
|
356
|
+
config = {
|
|
319
357
|
params: params
|
|
320
|
-
}
|
|
358
|
+
};
|
|
359
|
+
_context9.next = 1;
|
|
360
|
+
return this.handleRequestConfig(config);
|
|
321
361
|
case 1:
|
|
362
|
+
searchParams.filterRules = (0, _formApi.handleFilterRules)(((_searchParams3 = searchParams) === null || _searchParams3 === void 0 ? void 0 : _searchParams3.filterRules) || [], {
|
|
363
|
+
filterNullValue: false
|
|
364
|
+
});
|
|
365
|
+
searchParams.searchFields = (0, _formApi.handleFilterRules)(((_searchParams4 = searchParams) === null || _searchParams4 === void 0 ? void 0 : _searchParams4.searchFields) || [], {
|
|
366
|
+
filterNullValue: true
|
|
367
|
+
});
|
|
368
|
+
config.params = (0, _extends2["default"])({}, params, searchParams);
|
|
369
|
+
_context9.next = 2;
|
|
370
|
+
return this.request.get("fieldFilters", config);
|
|
371
|
+
case 2:
|
|
372
|
+
res = _context9.sent;
|
|
373
|
+
console.debug("form.fieldFilters:", res);
|
|
374
|
+
return _context9.abrupt("return", res);
|
|
375
|
+
case 3:
|
|
322
376
|
case "end":
|
|
323
377
|
return _context9.stop();
|
|
324
378
|
}
|
|
325
379
|
}, _callee9, this);
|
|
326
380
|
}));
|
|
327
|
-
function
|
|
381
|
+
function fieldFilters(_x15) {
|
|
382
|
+
return _fieldFilters.apply(this, arguments);
|
|
383
|
+
}
|
|
384
|
+
return fieldFilters;
|
|
385
|
+
}();
|
|
386
|
+
_proto.serviceUpdate = /*#__PURE__*/function () {
|
|
387
|
+
var _serviceUpdate = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee0(data, options) {
|
|
388
|
+
var params;
|
|
389
|
+
return _regenerator["default"].wrap(function (_context0) {
|
|
390
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
391
|
+
case 0:
|
|
392
|
+
params = {
|
|
393
|
+
formId: this.formId,
|
|
394
|
+
fieldId: this.fieldId
|
|
395
|
+
};
|
|
396
|
+
if (__mock) {
|
|
397
|
+
params.mock = true;
|
|
398
|
+
params.description = (this.title || "表单") + ".\u67E5\u8BE2";
|
|
399
|
+
}
|
|
400
|
+
return _context0.abrupt("return", this.request.post("serviceUpdate", data, {
|
|
401
|
+
params: params
|
|
402
|
+
}));
|
|
403
|
+
case 1:
|
|
404
|
+
case "end":
|
|
405
|
+
return _context0.stop();
|
|
406
|
+
}
|
|
407
|
+
}, _callee0, this);
|
|
408
|
+
}));
|
|
409
|
+
function serviceUpdate(_x16, _x17) {
|
|
328
410
|
return _serviceUpdate.apply(this, arguments);
|
|
329
411
|
}
|
|
330
412
|
return serviceUpdate;
|
package/lib/utils/api/index.js
CHANGED
|
@@ -45,13 +45,14 @@ function onFulfilled(res) {
|
|
|
45
45
|
function onRejected(error) {
|
|
46
46
|
var _error$response = error.response,
|
|
47
47
|
status = _error$response.status,
|
|
48
|
-
statusText = _error$response.statusText
|
|
48
|
+
statusText = _error$response.statusText,
|
|
49
|
+
data = _error$response.data;
|
|
49
50
|
console.error("请求失败!", error);
|
|
50
51
|
if (status == 400) {
|
|
51
52
|
return error.response.data || {};
|
|
52
53
|
}
|
|
53
54
|
return {
|
|
54
55
|
success: false,
|
|
55
|
-
message: statusText
|
|
56
|
+
message: (data === null || data === void 0 ? void 0 : data.message) || statusText
|
|
56
57
|
};
|
|
57
58
|
}
|
|
@@ -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/lib/utils/page/index.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.showFormGroup = exports.showFormDataManagerGroup = exports.showFormDataM
|
|
|
10
10
|
exports.showLoading = showLoading;
|
|
11
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
var _uniBridge = require("../uni-bridge");
|
|
13
14
|
var _printForm = require("./print-form");
|
|
14
15
|
exports.print = _printForm.print;
|
|
15
16
|
exports.getFormPrintTemplates = _printForm.getFormPrintTemplates;
|
|
@@ -44,6 +45,7 @@ function _showLoading() {
|
|
|
44
45
|
return _regenerator["default"].wrap(function (_context) {
|
|
45
46
|
while (1) switch (_context.prev = _context.next) {
|
|
46
47
|
case 0:
|
|
48
|
+
console.log("page.show.loading");
|
|
47
49
|
loading = document.getElementById("fullscreen-loading");
|
|
48
50
|
if (loading) {
|
|
49
51
|
loading.style.display = "flex";
|
|
@@ -70,6 +72,7 @@ function _hideLoading() {
|
|
|
70
72
|
return _regenerator["default"].wrap(function (_context2) {
|
|
71
73
|
while (1) switch (_context2.prev = _context2.next) {
|
|
72
74
|
case 0:
|
|
75
|
+
console.log("page.hide.loading");
|
|
73
76
|
loading = document.getElementById("fullscreen-loading");
|
|
74
77
|
if (loading) {
|
|
75
78
|
loading.style.display = "none";
|
|
@@ -104,14 +107,15 @@ function _openPage() {
|
|
|
104
107
|
url: url
|
|
105
108
|
});
|
|
106
109
|
case 1:
|
|
107
|
-
|
|
108
|
-
_context3.next = 3;
|
|
109
|
-
break;
|
|
110
|
+
return _context3.abrupt("return", _context3.sent);
|
|
110
111
|
case 2:
|
|
111
|
-
|
|
112
|
+
if (!isMobile) {
|
|
113
|
+
_context3.next = 3;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
return _context3.abrupt("return", _uniBridge.uniBridge.navigateTo(url));
|
|
112
117
|
case 3:
|
|
113
|
-
|
|
114
|
-
return _context3.abrupt("return", page);
|
|
118
|
+
return _context3.abrupt("return", window.open(url, target));
|
|
115
119
|
case 4:
|
|
116
120
|
case "end":
|
|
117
121
|
return _context3.stop();
|
|
@@ -13,21 +13,21 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _reactRender = require("../../components/react-render");
|
|
14
14
|
var _pageRender = require("./page-render");
|
|
15
15
|
var _common = require("../common");
|
|
16
|
-
var _excluded = ["layout", "items", "onSelectOk", "onClose"],
|
|
17
|
-
_excluded2 = ["
|
|
16
|
+
var _excluded = ["layout", "items", "onSelectOk", "container", "onClose"],
|
|
17
|
+
_excluded2 = ["onClose"];
|
|
18
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
19
|
function showFormDataManagerGroup(_x) {
|
|
20
20
|
return _showFormDataManagerGroup.apply(this, arguments);
|
|
21
21
|
}
|
|
22
22
|
function _showFormDataManagerGroup() {
|
|
23
23
|
_showFormDataManagerGroup = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
24
|
-
var
|
|
24
|
+
var onClose, props;
|
|
25
25
|
return _regenerator["default"].wrap(function (_context) {
|
|
26
26
|
while (1) switch (_context.prev = _context.next) {
|
|
27
27
|
case 0:
|
|
28
|
-
|
|
28
|
+
onClose = options.onClose, props = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded2);
|
|
29
29
|
return _context.abrupt("return", (0, _pageRender.renderElement)({
|
|
30
|
-
container: container,
|
|
30
|
+
container: props.container,
|
|
31
31
|
onClose: onClose,
|
|
32
32
|
element: {
|
|
33
33
|
component: FormDataManagerRender,
|
|
@@ -61,6 +61,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
61
61
|
layout = _this$props.layout,
|
|
62
62
|
items = _this$props.items,
|
|
63
63
|
onSelectOk = _this$props.onSelectOk,
|
|
64
|
+
container = _this$props.container,
|
|
64
65
|
onClose = _this$props.onClose,
|
|
65
66
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
66
67
|
// @ts-ignore
|
|
@@ -78,13 +79,12 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
78
79
|
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(data);
|
|
79
80
|
};
|
|
80
81
|
return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
|
|
82
|
+
container: container,
|
|
81
83
|
ref: function ref(layout) {
|
|
82
84
|
return _this2.layoutRef = layout;
|
|
83
85
|
},
|
|
84
86
|
layout: layout,
|
|
85
|
-
onClose:
|
|
86
|
-
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
|
|
87
|
-
}
|
|
87
|
+
onClose: onClose
|
|
88
88
|
}, /*#__PURE__*/_react["default"].createElement(_reactRender.ReactRender, (0, _extends2["default"])({}, restProps, {
|
|
89
89
|
components: window._components || window.components || window.__components,
|
|
90
90
|
schema: {
|
|
@@ -15,21 +15,21 @@ var _reactRender = require("../../components/react-render");
|
|
|
15
15
|
var _pageSchemaUtils = require("./page-schema-utils");
|
|
16
16
|
var _pageRender = require("./page-render");
|
|
17
17
|
var _schema = require("../api/schema.util");
|
|
18
|
-
var _excluded = ["layout", "form", "onSelectOk", "onClose"],
|
|
19
|
-
_excluded2 = ["
|
|
18
|
+
var _excluded = ["layout", "form", "onSelectOk", "onClose", "container"],
|
|
19
|
+
_excluded2 = ["onClose"];
|
|
20
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
21
21
|
function showFormDataManager(_x) {
|
|
22
22
|
return _showFormDataManager.apply(this, arguments);
|
|
23
23
|
}
|
|
24
24
|
function _showFormDataManager() {
|
|
25
25
|
_showFormDataManager = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
26
|
-
var
|
|
26
|
+
var onClose, props;
|
|
27
27
|
return _regenerator["default"].wrap(function (_context) {
|
|
28
28
|
while (1) switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
30
|
-
|
|
30
|
+
onClose = options.onClose, props = (0, _objectWithoutPropertiesLoose2["default"])(options, _excluded2);
|
|
31
31
|
return _context.abrupt("return", (0, _pageRender.renderElement)({
|
|
32
|
-
container: container,
|
|
32
|
+
container: props.container,
|
|
33
33
|
onClose: onClose,
|
|
34
34
|
element: {
|
|
35
35
|
component: FormDataManagerRender,
|
|
@@ -64,6 +64,7 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
64
64
|
form = _this$props.form,
|
|
65
65
|
onSelectOk = _this$props.onSelectOk,
|
|
66
66
|
onClose = _this$props.onClose,
|
|
67
|
+
container = _this$props.container,
|
|
67
68
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
68
69
|
// @ts-ignore
|
|
69
70
|
restProps.layout = layout || "modal";
|
|
@@ -81,13 +82,12 @@ var FormDataManagerRender = /*#__PURE__*/function (_Component) {
|
|
|
81
82
|
};
|
|
82
83
|
var dataView = (0, _pageSchemaUtils.cloneDataView)(this.props.dataView, this.props.extraProps);
|
|
83
84
|
return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
|
|
85
|
+
container: container,
|
|
84
86
|
ref: function ref(layout) {
|
|
85
87
|
return _this2.layoutRef = layout;
|
|
86
88
|
},
|
|
87
89
|
layout: layout,
|
|
88
|
-
onClose:
|
|
89
|
-
onSelectOk === null || onSelectOk === void 0 ? void 0 : onSelectOk(undefined);
|
|
90
|
-
}
|
|
90
|
+
onClose: onClose
|
|
91
91
|
}, /*#__PURE__*/_react["default"].createElement(_pageLoadSchema.PageLoadSchema, {
|
|
92
92
|
pageId: form === null || form === void 0 ? void 0 : form.id
|
|
93
93
|
}, function (schema) {
|
|
@@ -22,7 +22,7 @@ function showForm(_x) {
|
|
|
22
22
|
}
|
|
23
23
|
function _showForm() {
|
|
24
24
|
_showForm = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
|
|
25
|
-
var container, onClose, props, _options$form, paths, mode, dataId, params, _options$form2, url
|
|
25
|
+
var container, onClose, props, _options$form, paths, mode, dataId, params, _options$form2, url;
|
|
26
26
|
return _regenerator["default"].wrap(function (_context) {
|
|
27
27
|
while (1) switch (_context.prev = _context.next) {
|
|
28
28
|
case 0:
|
|
@@ -43,16 +43,14 @@ function _showForm() {
|
|
|
43
43
|
if (dataId) {
|
|
44
44
|
params.set("dataId", dataId);
|
|
45
45
|
}
|
|
46
|
-
url = "/
|
|
47
|
-
if (paths[1] == "
|
|
48
|
-
url = "/pages?" + params.toString();
|
|
46
|
+
url = "/pages?" + params.toString();
|
|
47
|
+
if (paths[1] == "admin") {
|
|
48
|
+
url = "/admin/pages?" + params.toString();
|
|
49
49
|
}
|
|
50
50
|
//const url = `/${paths[1]}/${paths[2]}/${options.form?.id}/${mode}?${params.toString()}`;
|
|
51
51
|
_context.next = 1;
|
|
52
52
|
return (0, _index.openPage)(url, url);
|
|
53
53
|
case 1:
|
|
54
|
-
page = _context.sent;
|
|
55
|
-
console.debug("openPage", page);
|
|
56
54
|
return _context.abrupt("return");
|
|
57
55
|
case 2:
|
|
58
56
|
return _context.abrupt("return", (0, _pageRender.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
|
}
|
|
@@ -47,6 +47,7 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
47
47
|
window.removeEventListener("resize", this.handleResize);
|
|
48
48
|
};
|
|
49
49
|
_proto.render = function render() {
|
|
50
|
+
var _this2 = this;
|
|
50
51
|
var _this$props = this.props,
|
|
51
52
|
children = _this$props.children,
|
|
52
53
|
extraProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
@@ -71,19 +72,38 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
71
72
|
padding: 0
|
|
72
73
|
}
|
|
73
74
|
},
|
|
74
|
-
maskClosable:
|
|
75
|
+
maskClosable: isMobile
|
|
75
76
|
});
|
|
76
77
|
var loadChildren = /*#__PURE__*/_react["default"].createElement(LoadMaterialChildren, null, children);
|
|
77
78
|
if (layout == "modal") {
|
|
78
79
|
restProps.style.top = 64;
|
|
79
80
|
restProps.styles.body.height = "calc(100vh - 120px)";
|
|
80
|
-
return /*#__PURE__*/_react["default"].createElement(_modal["default"], restProps,
|
|
81
|
+
return /*#__PURE__*/_react["default"].createElement(_modal["default"], (0, _extends2["default"])({}, restProps, {
|
|
82
|
+
getContainer: function getContainer() {
|
|
83
|
+
return _this2.props.container || window.document.body;
|
|
84
|
+
},
|
|
85
|
+
afterOpenChange: function afterOpenChange(open) {
|
|
86
|
+
if (!open) {
|
|
87
|
+
var _this2$props$onClose, _this2$props;
|
|
88
|
+
(_this2$props$onClose = (_this2$props = _this2.props).onClose) === null || _this2$props$onClose === void 0 ? void 0 : _this2$props$onClose.call(_this2$props);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}), loadChildren);
|
|
81
92
|
} else if (layout == "drawer") {
|
|
82
93
|
if (window.isMobile) {
|
|
83
94
|
restProps.placement = "bottom";
|
|
84
95
|
}
|
|
85
96
|
return /*#__PURE__*/_react["default"].createElement(_drawer["default"], (0, _extends2["default"])({}, restProps, {
|
|
86
|
-
|
|
97
|
+
getContainer: function getContainer() {
|
|
98
|
+
return _this2.props.container || window.document.body;
|
|
99
|
+
},
|
|
100
|
+
height: "75vh",
|
|
101
|
+
afterVisibleChange: function afterVisibleChange(open) {
|
|
102
|
+
if (!open) {
|
|
103
|
+
var _this2$props$onClose2, _this2$props2;
|
|
104
|
+
(_this2$props$onClose2 = (_this2$props2 = _this2.props).onClose) === null || _this2$props$onClose2 === void 0 ? void 0 : _this2$props$onClose2.call(_this2$props2);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
87
107
|
}), loadChildren);
|
|
88
108
|
}
|
|
89
109
|
return loadChildren;
|
|
@@ -11,13 +11,13 @@ var _client = require("react-dom/client");
|
|
|
11
11
|
function renderElement(options) {
|
|
12
12
|
return new Promise(/*#__PURE__*/function () {
|
|
13
13
|
var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(resolve, reject) {
|
|
14
|
-
var container, _onClose, _options$element, component, props,
|
|
14
|
+
var container, _onClose, _options$element, component, props, needUnmount, root, element;
|
|
15
15
|
return _regenerator["default"].wrap(function (_context) {
|
|
16
16
|
while (1) switch (_context.prev = _context.next) {
|
|
17
17
|
case 0:
|
|
18
18
|
container = options.container, _onClose = options.onClose;
|
|
19
19
|
_options$element = options.element, component = _options$element.component, props = _options$element.props;
|
|
20
|
-
|
|
20
|
+
needUnmount = !container;
|
|
21
21
|
if (!container) {
|
|
22
22
|
container = document.createElement("div");
|
|
23
23
|
document.body.append(container);
|
|
@@ -32,12 +32,11 @@ function renderElement(options) {
|
|
|
32
32
|
//等待动画结束
|
|
33
33
|
setTimeout(function () {
|
|
34
34
|
root.unmount();
|
|
35
|
-
if (
|
|
35
|
+
if (needUnmount) {
|
|
36
36
|
var _container;
|
|
37
|
-
//移除
|
|
38
37
|
(_container = container) === null || _container === void 0 ? void 0 : _container.remove();
|
|
39
38
|
}
|
|
40
|
-
},
|
|
39
|
+
}, 150);
|
|
41
40
|
_onClose === null || _onClose === void 0 ? void 0 : _onClose();
|
|
42
41
|
}
|
|
43
42
|
}));
|