ronds-metadata 1.2.45 → 1.2.46

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,12 +16,13 @@ import _Input from "antd/es/input";
16
16
  /*
17
17
  * @Author: wangxian
18
18
  * @Date: 2021-09-18 14:15:04
19
- * @LastEditTime: 2023-05-10 15:46:56
19
+ * @LastEditTime: 2023-05-11 08:26:41
20
20
  */
21
21
  import React from 'react';
22
22
  import { UploadOutlined } from '@ant-design/icons';
23
23
  import { MetadataFormContext, MetadataRefContext } from '../interface';
24
24
  import { useGetExtraInfo } from '../hooks';
25
+ import useObservable from '@/framework/rxjs-hooks/useObservable';
25
26
  var TextArea = _Input.TextArea;
26
27
  function Index(props) {
27
28
  var _extraInfo$addonAfter7;
@@ -44,17 +45,21 @@ function Index(props) {
44
45
  _React$useState4 = _slicedToArray(_React$useState3, 2),
45
46
  rules = _React$useState4[0],
46
47
  setRules = _React$useState4[1];
47
- React.useEffect(function () {
48
- if ((formContext === null || formContext === void 0 ? void 0 : formContext.form) && name && id) {
49
- var _formContext$form, _extraInfo$addonAfter;
50
- var _title = formContext === null || formContext === void 0 ? void 0 : (_formContext$form = formContext.form) === null || _formContext$form === void 0 ? void 0 : _formContext$form.getFieldsValue(name)[id];
48
+ useObservable(function (p) {
49
+ if ((p === null || p === void 0 ? void 0 : p.type) === 'onValuesChange') {
50
+ var _extraInfo$addonAfter;
51
+ var evalString = '';
52
+ for (var i = 0; i < name.length; i++) {
53
+ evalString = "".concat(evalString, "[name[").concat(i, "]]");
54
+ }
55
+ var _value = eval("p?.payload?.allVals".concat(evalString));
51
56
  if (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter = extraInfo.addonAfter) === null || _extraInfo$addonAfter === void 0 ? void 0 : _extraInfo$addonAfter.key) {
52
- setValueTitle(_title === null || _title === void 0 ? void 0 : _title.value);
57
+ setValueTitle(_value === null || _value === void 0 ? void 0 : _value.value);
53
58
  } else {
54
- setValueTitle(_title);
59
+ setValueTitle(_value);
55
60
  }
56
61
  }
57
- }, [formContext === null || formContext === void 0 ? void 0 : formContext.form, extraInfo.addonAfter, name, id]);
62
+ }, [formContext.stream$, name, extraInfo]);
58
63
  React.useEffect(function () {
59
64
  var _rules = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rules;
60
65
  if (_rules) {
@@ -108,7 +113,6 @@ function Index(props) {
108
113
  }, "\u4E0A\u4F20"));
109
114
  default:
110
115
  return /*#__PURE__*/React.createElement(_Input, {
111
- title: valueTitle,
112
116
  addonAfter: ((_extraInfo$addonAfter2 = extraInfo.addonAfter) === null || _extraInfo$addonAfter2 === void 0 ? void 0 : _extraInfo$addonAfter2.key) ? /*#__PURE__*/React.createElement(_Form.Item, {
113
117
  name: [].concat(_toConsumableArray(name), [(_extraInfo$addonAfter3 = extraInfo.addonAfter) === null || _extraInfo$addonAfter3 === void 0 ? void 0 : _extraInfo$addonAfter3.key]),
114
118
  noStyle: true,
@@ -123,6 +127,7 @@ function Index(props) {
123
127
  maxLength: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.maxLength,
124
128
  disabled: (_extraInfo$disabled6 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled6 !== void 0 ? _extraInfo$disabled6 : disabled,
125
129
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
130
+ title: valueTitle,
126
131
  allowClear: true
127
132
  });
128
133
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.2.45",
4
+ "version": "1.2.46",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",