@bchr/bchr-front-lib 0.3.150 → 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.
@@ -1420,18 +1420,22 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
1420
1420
  }, {
1421
1421
  key: "onValuesChange",
1422
1422
  value: function onValuesChange(changedValues, allValues) {
1423
+ var fieldCodeKeyMap = this.state.fieldCodeKeyMap;
1424
+
1423
1425
  for (var attr in changedValues) {
1424
1426
  var value = changedValues[attr];
1427
+ var fieldCodeUIItem = fieldCodeKeyMap[attr];
1428
+ var ui_render_type = fieldCodeUIItem.ui_render_type;
1425
1429
 
1426
- if (attr.endsWith("_date")) {
1427
- value = value ? value.valueOf() : "";
1428
- } else if (attr.indexOf('_date$') !== -1) {
1430
+ if (_consts.UI_RENDER_TYPE.DATE == ui_render_type) {
1429
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) : "";
1430
1436
  }
1431
1437
 
1432
- if (value instanceof _moment["default"] && value._f === 'YYYY' || value instanceof _moment["default"] && value._f === 'YYYYMM') {
1433
- value = value ? value.format(value._f) : '';
1434
- } else if (value instanceof Array) {
1438
+ if (value instanceof Array) {
1435
1439
  value = value ? value.join(",") : null;
1436
1440
  }
1437
1441
 
@@ -129,27 +129,26 @@ var HttpService = /*#__PURE__*/function () {
129
129
 
130
130
  if (!rpcMethodName) {
131
131
  rpcMethodName = "";
132
- } // if (!this.__checkJSONObjectSecurity(jsonObject)) {
133
- //
134
- // }
132
+ }
135
133
 
134
+ if (!this.__checkJSONObjectSecurity(jsonObject)) {
135
+ if (jsonObject) {
136
+ ajaxOptions.data = jsonObject;
137
+ }
136
138
 
137
- if (jsonObject) {
138
- ajaxOptions.data = jsonObject;
139
- }
139
+ if (ajaxOptions.rpcMethodName) {
140
+ delete ajaxOptions.rpcMethodName;
141
+ }
140
142
 
141
- if (ajaxOptions.rpcMethodName) {
142
- delete ajaxOptions.rpcMethodName;
143
- }
143
+ ajaxOptions.type = "post";
144
+ ajaxOptions.dataType = "json";
144
145
 
145
- ajaxOptions.type = "post";
146
- ajaxOptions.dataType = "json";
146
+ if (!ajaxOptions.url) {
147
+ ajaxOptions.url = this.requestContextPath + rpcMethodName;
148
+ }
147
149
 
148
- if (!ajaxOptions.url) {
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
- } // if (!this.__checkJSONObjectSecurity(jsonObject)) {
269
- //
270
- // }
271
-
267
+ }
272
268
 
273
- return this.postJSONWithNotCareSecurity(options, jsonObject, mockOptions);
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|svg).*?<\/\2>/i.test(str);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bchr/bchr-front-lib",
3
- "version": "0.3.150",
3
+ "version": "0.3.151",
4
4
  "description": "bchr front lib",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -1338,18 +1338,22 @@ class FormForModify extends React.Component{
1338
1338
  }
1339
1339
 
1340
1340
  onValuesChange(changedValues, allValues) {
1341
+ let {fieldCodeKeyMap} = this.state;
1341
1342
  for (let attr in changedValues) {
1342
1343
  let value = changedValues[attr];
1343
1344
 
1344
- if (attr.endsWith("_date")) {
1345
- value = value ? value.valueOf() : "";
1346
- }else if (attr.indexOf('_date$') !== -1) {
1345
+ let fieldCodeUIItem = fieldCodeKeyMap[attr];
1346
+ let {ui_render_type} = fieldCodeUIItem;
1347
+
1348
+ if (UI_RENDER_TYPE.DATE == ui_render_type) {
1347
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) : "";
1348
1354
  }
1349
1355
 
1350
- if ((value instanceof moment && value._f === 'YYYY') || (value instanceof moment && value._f === 'YYYYMM')) {
1351
- value = value ? value.format(value._f) : '';
1352
- } else if (value instanceof Array) {
1356
+ if (value instanceof Array) {
1353
1357
  value = value ? value.join(",") : null;
1354
1358
  }
1355
1359
 
@@ -114,25 +114,24 @@ class HttpService {
114
114
  rpcMethodName = "";
115
115
  }
116
116
 
117
- // if (!this.__checkJSONObjectSecurity(jsonObject)) {
118
- //
119
- // }
120
- if (jsonObject) {
121
- ajaxOptions.data = jsonObject;
122
- }
117
+ if (!this.__checkJSONObjectSecurity(jsonObject)) {
118
+ if (jsonObject) {
119
+ ajaxOptions.data = jsonObject;
120
+ }
123
121
 
124
- if (ajaxOptions.rpcMethodName) {
125
- delete ajaxOptions.rpcMethodName;
126
- }
122
+ if (ajaxOptions.rpcMethodName) {
123
+ delete ajaxOptions.rpcMethodName;
124
+ }
127
125
 
128
- ajaxOptions.type = "post";
129
- ajaxOptions.dataType = "json";
126
+ ajaxOptions.type = "post";
127
+ ajaxOptions.dataType = "json";
130
128
 
131
- if (!ajaxOptions.url) {
132
- ajaxOptions.url = this.requestContextPath + rpcMethodName;
133
- }
129
+ if (!ajaxOptions.url) {
130
+ ajaxOptions.url = this.requestContextPath + rpcMethodName;
131
+ }
134
132
 
135
- return $.ajax(ajaxOptions);
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
- // if (!this.__checkJSONObjectSecurity(jsonObject)) {
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|svg).*?<\/\2>/i.test(str);
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
  }