ronds-metadata 1.1.49 → 1.1.51

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.
@@ -1,77 +1,77 @@
1
- .markdown-navigation {
2
- font-size: 14px;
3
- font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Helvetica', 'Arial', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
4
- 'WenQuanYi Micro Hei', sans-serif;
5
- width: 100%;
6
- overflow-x: hidden;
7
- overflow-y: scroll;
8
- scrollbar-width: 0;
9
- width: 200px;
10
- }
11
- .markdown-navigation::-webkit-scrollbar {
12
- width: 0;
13
- }
14
-
15
- .markdown-navigation .title-anchor {
16
- display: block;
17
- color: #bbb;
18
- transition: all 0.2s;
19
- margin: 0.8em 0;
20
- font-weight: lighter;
21
- line-height: 2em;
22
- padding-right: 1.8em;
23
- cursor: pointer;
24
- }
25
-
26
- .markdown-navigation .title-anchor:hover,
27
- .markdown-navigation .title-anchor.active {
28
- background-color: #f8f8f8;
29
- text-decoration: inherit;
30
- }
31
-
32
- .markdown-navigation .title-anchor.active {
33
- color: #007fff;
34
- }
35
-
36
- .markdown-navigation .title-anchor small {
37
- margin: 0 0.8em;
38
- }
39
-
40
- .markdown-navigation .title-level1 {
41
- color: #000;
42
- font-size: 1.2em;
43
- padding-left: 1em;
44
- font-weight: normal;
45
- }
46
-
47
- .markdown-navigation .title-level2 {
48
- color: #000;
49
- font-size: 1em;
50
- padding-left: 1em;
51
- font-weight: normal;
52
- }
53
-
54
- .markdown-navigation .title-level3 {
55
- color: #000;
56
- font-size: 0.8em;
57
- padding-left: 3em;
58
- font-weight: normal;
59
- }
60
-
61
- .markdown-navigation .title-level4 {
62
- color: #000;
63
- font-size: 0.72em;
64
- padding-left: 5em;
65
- }
66
-
67
- .markdown-navigation .title-level5 {
68
- color: #000;
69
- font-size: 0.72em;
70
- padding-left: 7em;
71
- }
72
-
73
- .markdown-navigation .title-level6 {
74
- color: #000;
75
- font-size: 0.72em;
76
- padding-left: 9em;
77
- }
1
+ .markdown-navigation {
2
+ font-size: 14px;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Helvetica', 'Arial', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei',
4
+ 'WenQuanYi Micro Hei', sans-serif;
5
+ width: 100%;
6
+ overflow-x: hidden;
7
+ overflow-y: scroll;
8
+ scrollbar-width: 0;
9
+ width: 200px;
10
+ }
11
+ .markdown-navigation::-webkit-scrollbar {
12
+ width: 0;
13
+ }
14
+
15
+ .markdown-navigation .title-anchor {
16
+ display: block;
17
+ color: #bbb;
18
+ transition: all 0.2s;
19
+ margin: 0.8em 0;
20
+ font-weight: lighter;
21
+ line-height: 2em;
22
+ padding-right: 1.8em;
23
+ cursor: pointer;
24
+ }
25
+
26
+ .markdown-navigation .title-anchor:hover,
27
+ .markdown-navigation .title-anchor.active {
28
+ background-color: #f8f8f8;
29
+ text-decoration: inherit;
30
+ }
31
+
32
+ .markdown-navigation .title-anchor.active {
33
+ color: #007fff;
34
+ }
35
+
36
+ .markdown-navigation .title-anchor small {
37
+ margin: 0 0.8em;
38
+ }
39
+
40
+ .markdown-navigation .title-level1 {
41
+ color: #000;
42
+ font-size: 1.2em;
43
+ padding-left: 1em;
44
+ font-weight: normal;
45
+ }
46
+
47
+ .markdown-navigation .title-level2 {
48
+ color: #000;
49
+ font-size: 1em;
50
+ padding-left: 1em;
51
+ font-weight: normal;
52
+ }
53
+
54
+ .markdown-navigation .title-level3 {
55
+ color: #000;
56
+ font-size: 0.8em;
57
+ padding-left: 3em;
58
+ font-weight: normal;
59
+ }
60
+
61
+ .markdown-navigation .title-level4 {
62
+ color: #000;
63
+ font-size: 0.72em;
64
+ padding-left: 5em;
65
+ }
66
+
67
+ .markdown-navigation .title-level5 {
68
+ color: #000;
69
+ font-size: 0.72em;
70
+ padding-left: 7em;
71
+ }
72
+
73
+ .markdown-navigation .title-level6 {
74
+ color: #000;
75
+ font-size: 0.72em;
76
+ padding-left: 9em;
77
+ }
@@ -3,3 +3,4 @@ import { IMetaFormProps } from '../interface';
3
3
  declare function Index(props: IMetaFormProps): JSX.Element;
4
4
  declare const _default: React.MemoExoticComponent<typeof Index>;
5
5
  export default _default;
6
+ export declare const DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss";
@@ -60,6 +60,7 @@ function Index(props) {
60
60
  case 'datePicker':
61
61
  return /*#__PURE__*/React.createElement(_DatePicker, {
62
62
  showTime: true,
63
+ format: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.format) || DEFAULT_DATE_FORMAT,
63
64
  disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
64
65
  placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
65
66
  });
@@ -125,4 +126,5 @@ function Index(props) {
125
126
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
126
127
  }
127
128
 
128
- export default /*#__PURE__*/React.memo(Index);
129
+ export default /*#__PURE__*/React.memo(Index);
130
+ export var DEFAULT_DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss';
@@ -232,7 +232,7 @@ function Index(props) {
232
232
  value: {
233
233
  fields: refFieldsRef.current
234
234
  }
235
- }, renderForm(schema, formOptions, formContext.stream$))));
235
+ }, renderForm(schema, formOptions, formContext.colSpan))));
236
236
  }
237
237
 
238
238
  if (isRefForm && field && schema.length > 0) {
@@ -247,7 +247,7 @@ function Index(props) {
247
247
  value: {
248
248
  fields: refFieldsRef.current
249
249
  }
250
- }, renderForm(schema, formOptions, formContext.stream$))));
250
+ }, renderForm(schema, formOptions, formContext.colSpan))));
251
251
  }
252
252
 
253
253
  return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
@@ -12,6 +12,7 @@ import { MetadataService } from '../../framework/metadata/MetadataService';
12
12
  import useMemoSubject from '../../framework/rxjs-hooks/useMemoSubject';
13
13
  import useObservable from '../../framework/rxjs-hooks/useObservable';
14
14
  import moment from 'moment';
15
+ import { DEFAULT_DATE_FORMAT } from './DataCell/Input';
15
16
 
16
17
  var MetadataForm = function MetadataForm(props) {
17
18
  var _Form$useForm = _Form.useForm(),
@@ -85,6 +86,16 @@ var MetadataForm = function MetadataForm(props) {
85
86
  var e = form.setFieldsValue;
86
87
 
87
88
  var setFieldsValue = function setFieldsValue(vals) {
89
+ // 处理时间格式
90
+ fields.forEach(function (v, k) {
91
+ var _v$text;
92
+
93
+ if ((v === null || v === void 0 ? void 0 : (_v$text = v.text) === null || _v$text === void 0 ? void 0 : _v$text.type) === 'datePicker' && vals[k]) {
94
+ var _v$text2;
95
+
96
+ vals[k] = moment(vals[k], (v === null || v === void 0 ? void 0 : (_v$text2 = v.text) === null || _v$text2 === void 0 ? void 0 : _v$text2.format) || DEFAULT_DATE_FORMAT);
97
+ }
98
+ });
88
99
  e(vals);
89
100
  stream$.next({
90
101
  type: 'setFieldsValue',
@@ -135,10 +146,12 @@ var MetadataForm = function MetadataForm(props) {
135
146
  try {
136
147
  // 处理时间格式
137
148
  fields.forEach(function (v, k) {
138
- var _v$text;
149
+ var _v$text3;
150
+
151
+ if ((v === null || v === void 0 ? void 0 : (_v$text3 = v.text) === null || _v$text3 === void 0 ? void 0 : _v$text3.type) === 'datePicker' && initialValues[k]) {
152
+ var _v$text4;
139
153
 
140
- if ((v === null || v === void 0 ? void 0 : (_v$text = v.text) === null || _v$text === void 0 ? void 0 : _v$text.type) === 'datePicker' && initialValues[k]) {
141
- initialValues[k] = moment(initialValues[k], 'YYYY-MM-DD HH:mm:ss');
154
+ initialValues[k] = moment(initialValues[k], (v === null || v === void 0 ? void 0 : (_v$text4 = v.text) === null || _v$text4 === void 0 ? void 0 : _v$text4.format) || DEFAULT_DATE_FORMAT);
142
155
  }
143
156
  });
144
157
  form.setFieldsValue(_objectSpread({}, initialValues));
@@ -161,8 +174,10 @@ var MetadataForm = function MetadataForm(props) {
161
174
  var extra = fields.get(key[0]);
162
175
 
163
176
  if ((extra === null || extra === void 0 ? void 0 : (_extra$text = extra.text) === null || _extra$text === void 0 ? void 0 : _extra$text.type) === 'datePicker') {
164
- value[key[0]] = moment(value[key[0]]).format('YYYY-MM-DD HH:mm:ss');
165
- allValues[key[0]] = moment(value[key[0]]).format('YYYY-MM-DD HH:mm:ss');
177
+ var _extra$text2, _extra$text3;
178
+
179
+ value[key[0]] = moment(value[key[0]]).format((extra === null || extra === void 0 ? void 0 : (_extra$text2 = extra.text) === null || _extra$text2 === void 0 ? void 0 : _extra$text2.format) || DEFAULT_DATE_FORMAT);
180
+ allValues[key[0]] = moment(value[key[0]]).format((extra === null || extra === void 0 ? void 0 : (_extra$text3 = extra.text) === null || _extra$text3 === void 0 ? void 0 : _extra$text3.format) || DEFAULT_DATE_FORMAT);
166
181
  }
167
182
 
168
183
  onValuesChange && onValuesChange(value, allValues);
@@ -171,10 +186,12 @@ var MetadataForm = function MetadataForm(props) {
171
186
  var onMyFinish = function onMyFinish(values) {
172
187
  // 处理时间格式
173
188
  fields.forEach(function (v, k) {
174
- var _v$text2;
189
+ var _v$text5;
190
+
191
+ if ((v === null || v === void 0 ? void 0 : (_v$text5 = v.text) === null || _v$text5 === void 0 ? void 0 : _v$text5.type) === 'datePicker' && values[k]) {
192
+ var _v$text6;
175
193
 
176
- if ((v === null || v === void 0 ? void 0 : (_v$text2 = v.text) === null || _v$text2 === void 0 ? void 0 : _v$text2.type) === 'datePicker' && values[k]) {
177
- values[k] = moment(values[k]).format('YYYY-MM-DD HH:mm:ss');
194
+ values[k] = moment(values[k]).format((v === null || v === void 0 ? void 0 : (_v$text6 = v.text) === null || _v$text6 === void 0 ? void 0 : _v$text6.format) || DEFAULT_DATE_FORMAT);
178
195
  }
179
196
  });
180
197
  onFinish && onFinish(values);
@@ -183,6 +200,7 @@ var MetadataForm = function MetadataForm(props) {
183
200
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MetadataFormContext.Provider, {
184
201
  value: {
185
202
  fields: fields,
203
+ colSpan: colSpan,
186
204
  form: form,
187
205
  stream$: stream$,
188
206
  initialValues: initialValues,
@@ -3,6 +3,7 @@ import { FormInstance } from 'antd/lib/form/hooks/useForm';
3
3
  import { IMetaData } from '../../framework/metadata/types';
4
4
  export interface IMetadataFormContextProps {
5
5
  fields: any;
6
+ colSpan: number;
6
7
  form: FormInstance;
7
8
  stream$: any;
8
9
  initialValues: any;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author:wangxian
3
3
  * @Date: 2021-09-18 14:15:04
4
- * @LastEditTime: 2022-06-08 15:45:36
4
+ * @LastEditTime: 2022-11-02 10:58:49
5
5
  */
6
6
  import React from 'react';
7
7
  export var MetadataFormContext = /*#__PURE__*/React.createContext(null);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.1.49",
4
+ "version": "1.1.51",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",