@bchr/bchr-front-lib 0.3.148 → 0.3.151
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/lib/base/layout/ui_tpl/form/FormForModify.js +15 -8
- package/lib/base/layout/ui_tpl/modal/FormModifyModal.js +1 -1
- package/lib/services/HttpService.js +19 -21
- package/package.json +1 -1
- package/src/base/layout/ui_tpl/form/FormForModify.js +15 -8
- package/src/base/layout/ui_tpl/modal/FormModifyModal.js +2 -2
- package/src/services/HttpService.js +18 -21
|
@@ -484,7 +484,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
484
484
|
initialValue = initialValue || [];
|
|
485
485
|
|
|
486
486
|
if (_typeof(initialValue) !== "object") {
|
|
487
|
-
initialValue = initialValue ?
|
|
487
|
+
initialValue = initialValue ? initialValue.split(",") : [];
|
|
488
488
|
}
|
|
489
489
|
} else {
|
|
490
490
|
if (typeof initialValue === 'number') {
|
|
@@ -514,7 +514,7 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
514
514
|
initialValue = data[code] || [];
|
|
515
515
|
|
|
516
516
|
if (_typeof(initialValue) !== "object") {
|
|
517
|
-
initialValue = initialValue ?
|
|
517
|
+
initialValue = initialValue ? initialValue.split(",") : [];
|
|
518
518
|
}
|
|
519
519
|
} else {
|
|
520
520
|
initialValue = data[code] && data[code] > 0 ? data[code] + "" : null;
|
|
@@ -1220,7 +1220,8 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1220
1220
|
value: function treeSelectOnChange(ref, config, callback, value, label, extra) {
|
|
1221
1221
|
var display_code = config.display_code;
|
|
1222
1222
|
label = extra.allCheckedNodes.map(function (item) {
|
|
1223
|
-
var
|
|
1223
|
+
var node = item.node;
|
|
1224
|
+
var props = node ? item.node.props : item.node;
|
|
1224
1225
|
var ext_attr_value = props.ext_attr_value,
|
|
1225
1226
|
title = props.title;
|
|
1226
1227
|
|
|
@@ -1419,17 +1420,23 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
|
|
|
1419
1420
|
}, {
|
|
1420
1421
|
key: "onValuesChange",
|
|
1421
1422
|
value: function onValuesChange(changedValues, allValues) {
|
|
1423
|
+
var fieldCodeKeyMap = this.state.fieldCodeKeyMap;
|
|
1424
|
+
|
|
1422
1425
|
for (var attr in changedValues) {
|
|
1423
1426
|
var value = changedValues[attr];
|
|
1427
|
+
var fieldCodeUIItem = fieldCodeKeyMap[attr];
|
|
1428
|
+
var ui_render_type = fieldCodeUIItem.ui_render_type;
|
|
1424
1429
|
|
|
1425
|
-
if (
|
|
1426
|
-
value = value ? value.valueOf() : "";
|
|
1427
|
-
} else if (attr.indexOf('_date$') !== -1) {
|
|
1430
|
+
if (_consts.UI_RENDER_TYPE.DATE == ui_render_type) {
|
|
1428
1431
|
value = value ? value.format("YYYY-MM-DD") : "";
|
|
1432
|
+
} else if (_consts.UI_RENDER_TYPE.DATE_YEAR == ui_render_type) {
|
|
1433
|
+
value = value ? value.format("YYYY") : "";
|
|
1434
|
+
} else if (_consts.UI_RENDER_TYPE.DATE_MONTH == ui_render_type) {
|
|
1435
|
+
value = value ? value.format(value._f) : "";
|
|
1429
1436
|
}
|
|
1430
1437
|
|
|
1431
|
-
if (value instanceof
|
|
1432
|
-
value = value ? value.
|
|
1438
|
+
if (value instanceof Array) {
|
|
1439
|
+
value = value ? value.join(",") : null;
|
|
1433
1440
|
}
|
|
1434
1441
|
|
|
1435
1442
|
this.props.data[attr] = value;
|
|
@@ -42,7 +42,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
42
42
|
var ButtonGroup = _antd.Button.Group;
|
|
43
43
|
|
|
44
44
|
var FormModifyModal = function FormModifyModal(props, ref) {
|
|
45
|
-
(0, _react.
|
|
45
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
46
46
|
return {
|
|
47
47
|
closeLoading: closeLoading
|
|
48
48
|
};
|
|
@@ -129,27 +129,26 @@ var HttpService = /*#__PURE__*/function () {
|
|
|
129
129
|
|
|
130
130
|
if (!rpcMethodName) {
|
|
131
131
|
rpcMethodName = "";
|
|
132
|
-
}
|
|
133
|
-
//
|
|
134
|
-
// }
|
|
132
|
+
}
|
|
135
133
|
|
|
134
|
+
if (!this.__checkJSONObjectSecurity(jsonObject)) {
|
|
135
|
+
if (jsonObject) {
|
|
136
|
+
ajaxOptions.data = jsonObject;
|
|
137
|
+
}
|
|
136
138
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
if (ajaxOptions.rpcMethodName) {
|
|
140
|
+
delete ajaxOptions.rpcMethodName;
|
|
141
|
+
}
|
|
140
142
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
143
|
+
ajaxOptions.type = "post";
|
|
144
|
+
ajaxOptions.dataType = "json";
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
if (!ajaxOptions.url) {
|
|
147
|
+
ajaxOptions.url = this.requestContextPath + rpcMethodName;
|
|
148
|
+
}
|
|
147
149
|
|
|
148
|
-
|
|
149
|
-
ajaxOptions.url = this.requestContextPath + rpcMethodName;
|
|
150
|
+
return _jquery["default"].ajax(ajaxOptions);
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
-
return _jquery["default"].ajax(ajaxOptions);
|
|
153
152
|
}
|
|
154
153
|
}, {
|
|
155
154
|
key: "__postForMock",
|
|
@@ -265,12 +264,11 @@ var HttpService = /*#__PURE__*/function () {
|
|
|
265
264
|
|
|
266
265
|
if (_jquery["default"].isPlainObject(ajaxOptions.data)) {
|
|
267
266
|
jsonObject = ajaxOptions.data;
|
|
268
|
-
}
|
|
269
|
-
//
|
|
270
|
-
// }
|
|
271
|
-
|
|
267
|
+
}
|
|
272
268
|
|
|
273
|
-
|
|
269
|
+
if (!this.__checkJSONObjectSecurity(jsonObject)) {
|
|
270
|
+
return this.postJSONWithNotCareSecurity(options, jsonObject, mockOptions);
|
|
271
|
+
}
|
|
274
272
|
}
|
|
275
273
|
}, {
|
|
276
274
|
key: "postJSONAllowHTML",
|
|
@@ -363,7 +361,7 @@ var HttpService = /*#__PURE__*/function () {
|
|
|
363
361
|
return;
|
|
364
362
|
}
|
|
365
363
|
|
|
366
|
-
var containsHTML = /<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE).*?>|<(a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video
|
|
364
|
+
var containsHTML = /<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE).*?>|<(a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video).*?<\/\2>/i.test(str);
|
|
367
365
|
|
|
368
366
|
if (containsHTML) {
|
|
369
367
|
throw new Error("不安全的输入,请检查!");
|
package/package.json
CHANGED
|
@@ -528,7 +528,7 @@ class FormForModify extends React.Component{
|
|
|
528
528
|
if (b_multiple) {
|
|
529
529
|
initialValue = initialValue || [];
|
|
530
530
|
if (typeof initialValue !== "object") {
|
|
531
|
-
initialValue = initialValue ?
|
|
531
|
+
initialValue = initialValue ? initialValue.split(",") : [];
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
else {
|
|
@@ -568,7 +568,7 @@ class FormForModify extends React.Component{
|
|
|
568
568
|
if (b_multiple) {
|
|
569
569
|
initialValue = data[code] || [];
|
|
570
570
|
if (typeof initialValue !== "object") {
|
|
571
|
-
initialValue = initialValue ?
|
|
571
|
+
initialValue = initialValue ? initialValue.split(",") : [];
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
else {
|
|
@@ -1041,7 +1041,8 @@ class FormForModify extends React.Component{
|
|
|
1041
1041
|
let {display_code} = config;
|
|
1042
1042
|
|
|
1043
1043
|
label = extra.allCheckedNodes.map(item => {
|
|
1044
|
-
let
|
|
1044
|
+
let node = item.node;
|
|
1045
|
+
let props = node ? item.node.props : item.node;
|
|
1045
1046
|
let {ext_attr_value, title} = props;
|
|
1046
1047
|
|
|
1047
1048
|
if (ext_attr_value != null && ext_attr_value.length > 0 && title.indexOf(ext_attr_value) === 0) {
|
|
@@ -1337,17 +1338,23 @@ class FormForModify extends React.Component{
|
|
|
1337
1338
|
}
|
|
1338
1339
|
|
|
1339
1340
|
onValuesChange(changedValues, allValues) {
|
|
1341
|
+
let {fieldCodeKeyMap} = this.state;
|
|
1340
1342
|
for (let attr in changedValues) {
|
|
1341
1343
|
let value = changedValues[attr];
|
|
1342
1344
|
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1345
|
+
let fieldCodeUIItem = fieldCodeKeyMap[attr];
|
|
1346
|
+
let {ui_render_type} = fieldCodeUIItem;
|
|
1347
|
+
|
|
1348
|
+
if (UI_RENDER_TYPE.DATE == ui_render_type) {
|
|
1346
1349
|
value = value ? value.format("YYYY-MM-DD") : "";
|
|
1350
|
+
} else if (UI_RENDER_TYPE.DATE_YEAR == ui_render_type) {
|
|
1351
|
+
value = value ? value.format("YYYY") : "";
|
|
1352
|
+
} else if (UI_RENDER_TYPE.DATE_MONTH == ui_render_type) {
|
|
1353
|
+
value = value ? value.format(value._f) : "";
|
|
1347
1354
|
}
|
|
1348
1355
|
|
|
1349
|
-
if (
|
|
1350
|
-
value = value ? value.
|
|
1356
|
+
if (value instanceof Array) {
|
|
1357
|
+
value = value ? value.join(",") : null;
|
|
1351
1358
|
}
|
|
1352
1359
|
|
|
1353
1360
|
this.props.data[attr] = value;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useEffect, useState, forwardRef,
|
|
1
|
+
import React, {useEffect, useState, forwardRef, useImperativeHandle} from 'react';
|
|
2
2
|
import SModal from "../../modal/SModal";
|
|
3
3
|
import {Button, message, Spin} from "antd";
|
|
4
4
|
import FormForModify from "../form/FormForModify";
|
|
@@ -7,7 +7,7 @@ import $ from 'jquery';
|
|
|
7
7
|
const ButtonGroup = Button.Group;
|
|
8
8
|
const FormModifyModal = (props, ref) => {
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
useImperativeHandle(ref, () => ({
|
|
11
11
|
closeLoading
|
|
12
12
|
}));
|
|
13
13
|
|
|
@@ -114,25 +114,24 @@ class HttpService {
|
|
|
114
114
|
rpcMethodName = "";
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
ajaxOptions.data = jsonObject;
|
|
122
|
-
}
|
|
117
|
+
if (!this.__checkJSONObjectSecurity(jsonObject)) {
|
|
118
|
+
if (jsonObject) {
|
|
119
|
+
ajaxOptions.data = jsonObject;
|
|
120
|
+
}
|
|
123
121
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
if (ajaxOptions.rpcMethodName) {
|
|
123
|
+
delete ajaxOptions.rpcMethodName;
|
|
124
|
+
}
|
|
127
125
|
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
ajaxOptions.type = "post";
|
|
127
|
+
ajaxOptions.dataType = "json";
|
|
130
128
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
if (!ajaxOptions.url) {
|
|
130
|
+
ajaxOptions.url = this.requestContextPath + rpcMethodName;
|
|
131
|
+
}
|
|
134
132
|
|
|
135
|
-
|
|
133
|
+
return $.ajax(ajaxOptions);
|
|
134
|
+
}
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
__postForMock(mockOptions) {
|
|
@@ -251,11 +250,9 @@ class HttpService {
|
|
|
251
250
|
jsonObject = ajaxOptions.data;
|
|
252
251
|
}
|
|
253
252
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return this.postJSONWithNotCareSecurity(options, jsonObject, mockOptions);
|
|
253
|
+
if (!this.__checkJSONObjectSecurity(jsonObject)) {
|
|
254
|
+
return this.postJSONWithNotCareSecurity(options, jsonObject, mockOptions);
|
|
255
|
+
}
|
|
259
256
|
}
|
|
260
257
|
|
|
261
258
|
postJSONAllowHTML(options, jsonObject, mockOptions) {
|
|
@@ -342,7 +339,7 @@ class HttpService {
|
|
|
342
339
|
return;
|
|
343
340
|
}
|
|
344
341
|
|
|
345
|
-
let containsHTML = /<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE).*?>|<(a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video
|
|
342
|
+
let containsHTML = /<(br|basefont|hr|input|source|frame|param|area|meta|!--|col|link|option|base|img|wbr|!DOCTYPE).*?>|<(a|abbr|acronym|address|applet|article|aside|audio|b|bdi|bdo|big|blockquote|body|button|canvas|caption|center|cite|code|colgroup|command|datalist|dd|del|details|dfn|dialog|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frameset|head|header|hgroup|h1|h2|h3|h4|h5|h6|html|i|iframe|ins|kbd|keygen|label|legend|li|map|mark|menu|meter|nav|noframes|noscript|object|ol|optgroup|output|p|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|track|tt|u|ul|var|video).*?<\/\2>/i.test(str);
|
|
346
343
|
if (containsHTML) {
|
|
347
344
|
throw new Error("不安全的输入,请检查!");
|
|
348
345
|
}
|