@bchr/bchr-front-lib 0.3.147 → 0.3.150

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.
@@ -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 ? JSON.parse(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 ? JSON.parse(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 props = item.node.props;
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
 
@@ -1430,6 +1431,8 @@ var FormForModify = /*#__PURE__*/function (_React$Component) {
1430
1431
 
1431
1432
  if (value instanceof _moment["default"] && value._f === 'YYYY' || value instanceof _moment["default"] && value._f === 'YYYYMM') {
1432
1433
  value = value ? value.format(value._f) : '';
1434
+ } else if (value instanceof Array) {
1435
+ value = value ? value.join(",") : null;
1433
1436
  }
1434
1437
 
1435
1438
  this.props.data[attr] = value;
@@ -41,7 +41,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
41
 
42
42
  var ButtonGroup = _antd.Button.Group;
43
43
 
44
- var FormModifyModal = function FormModifyModal(props) {
44
+ var FormModifyModal = function FormModifyModal(props, ref) {
45
+ (0, _react.useImperativeHandle)(ref, function () {
46
+ return {
47
+ closeLoading: closeLoading
48
+ };
49
+ });
45
50
  var formref = props.formref,
46
51
  onOk = props.onOk,
47
52
  data = props.data,
@@ -130,5 +135,6 @@ var FormModifyModal = function FormModifyModal(props) {
130
135
  })))));
131
136
  };
132
137
 
133
- var _default = FormModifyModal;
138
+ var _default = /*#__PURE__*/(0, _react.forwardRef)(FormModifyModal);
139
+
134
140
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bchr/bchr-front-lib",
3
- "version": "0.3.147",
3
+ "version": "0.3.150",
4
4
  "description": "bchr front lib",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -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 ? JSON.parse(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 ? JSON.parse(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 props = item.node.props;
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) {
@@ -1348,6 +1349,8 @@ class FormForModify extends React.Component{
1348
1349
 
1349
1350
  if ((value instanceof moment && value._f === 'YYYY') || (value instanceof moment && value._f === 'YYYYMM')) {
1350
1351
  value = value ? value.format(value._f) : '';
1352
+ } else if (value instanceof Array) {
1353
+ value = value ? value.join(",") : null;
1351
1354
  }
1352
1355
 
1353
1356
  this.props.data[attr] = value;
@@ -1,11 +1,16 @@
1
- import React, {useEffect, useState} from 'react';
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";
5
5
  import $ from 'jquery';
6
6
 
7
7
  const ButtonGroup = Button.Group;
8
- const FormModifyModal = (props) => {
8
+ const FormModifyModal = (props, ref) => {
9
+
10
+ useImperativeHandle(ref, () => ({
11
+ closeLoading
12
+ }));
13
+
9
14
  let {
10
15
  formref,
11
16
  onOk,
@@ -77,4 +82,4 @@ const FormModifyModal = (props) => {
77
82
  )
78
83
  }
79
84
 
80
- export default FormModifyModal;
85
+ export default forwardRef(FormModifyModal);