@teamix/pro 1.1.4 → 1.1.8

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.
Files changed (142) hide show
  1. package/README.md +97 -0
  2. package/dist/212.js +2 -2
  3. package/dist/pro.css +1 -1
  4. package/dist/pro.js +3147 -1872
  5. package/dist/pro.min.css +1 -1
  6. package/dist/pro.min.js +1 -1
  7. package/dist/pro.min.js.LICENSE.txt +1 -1
  8. package/es/actions/dialog-form.d.ts +3 -3
  9. package/es/actions/dialog-table.d.ts +6 -1
  10. package/es/actions/dialog-table.js +10 -1
  11. package/es/actions/drawer-table.d.ts +4 -0
  12. package/es/actions/drawer-table.js +7 -1
  13. package/es/actions/index.d.ts +6 -11
  14. package/es/actions/index.js +41 -21
  15. package/es/actions/index.scss +1 -1
  16. package/es/card/index.d.ts +17 -0
  17. package/es/form/Components/ProField/index.d.ts +8 -0
  18. package/es/form/ProForm/index.d.ts +2 -2
  19. package/es/form/ProForm/index.js +9 -2
  20. package/es/form/ProForm/index.scss +40 -7
  21. package/es/form/SchemaForm/adapterType.js +3 -3
  22. package/es/form/SchemaForm/index.d.ts +2 -2
  23. package/es/form/SchemaForm/index.js +9 -5
  24. package/es/form/SchemaForm/initializeArrayCards.js +10 -55
  25. package/es/form/SchemaForm/initializeArrayCollapse.js +10 -64
  26. package/es/form/SchemaForm/initializeArrayIcon.js +19 -7
  27. package/es/form/SchemaForm/initializeArrayItems.js +16 -75
  28. package/es/form/SchemaForm/initializeArrayTable.js +23 -33
  29. package/es/form/SchemaForm/initializeFormButton.js +35 -38
  30. package/es/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  31. package/es/form/SchemaForm/initializeFormStep.d.ts +4 -2
  32. package/es/form/SchemaForm/initializeFormStep.js +21 -7
  33. package/es/form/SchemaForm/initializeFormTab.d.ts +2 -2
  34. package/es/form/SchemaForm/initializeProField.js +3 -3
  35. package/es/form/SchemaForm/reactions.d.ts +1 -1
  36. package/es/form/SchemaForm/reactions.js +2 -2
  37. package/es/form/index.d.ts +17 -9
  38. package/es/form/index.js +21 -9
  39. package/es/form/typing.d.ts +13 -22
  40. package/es/form/warning.js +2 -6
  41. package/es/index.d.ts +4 -3
  42. package/es/index.js +4 -3
  43. package/es/info/components/FormItem/index.js +4 -4
  44. package/es/info/components/FormItem/index.scss +11 -0
  45. package/es/info/components/InfoGroup/index.js +37 -6
  46. package/es/info/components/InfoGroup/index.scss +6 -0
  47. package/es/info/components/InfoValueItem/index.js +14 -2
  48. package/es/info/components/baseInfo/index.js +10 -9
  49. package/es/info/components/headerInfo/index.js +10 -9
  50. package/es/info/components/tableInfo/index.js +7 -4
  51. package/es/info/components/tableInfo/index.scss +1 -1
  52. package/es/info/index.d.ts +1 -0
  53. package/es/info/index.js +9 -7
  54. package/es/info/index.scss +4 -0
  55. package/es/info/typing.d.ts +17 -3
  56. package/es/info/utils/index.d.ts +11 -2
  57. package/es/info/utils/index.js +21 -0
  58. package/es/nocode/configurators/PageHeader.js +49 -43
  59. package/es/nocode/configurators/ProTable.js +12 -9
  60. package/es/nocode/configurators/common.d.ts +117 -105
  61. package/es/nocode/configurators/common.js +38 -34
  62. package/es/nocode/index.scss +1 -4
  63. package/es/page-header/index.d.ts +3 -0
  64. package/es/page-header/index.js +40 -13
  65. package/es/page-header/index.scss +6 -4
  66. package/es/table/components/Filter/index.js +8 -16
  67. package/es/table/components/Layout/index.js +2 -1
  68. package/es/table/components/Layout/index.scss +1 -1
  69. package/es/table/components/ToolBar/FilterColumnIcon.js +77 -17
  70. package/es/table/components/ToolBar/index.scss +10 -0
  71. package/es/table/index.d.ts +0 -1
  72. package/es/table/index.js +75 -56
  73. package/es/table/index.scss +0 -1
  74. package/es/table/typing.d.ts +3 -1
  75. package/lib/actions/dialog-form.d.ts +3 -3
  76. package/lib/actions/dialog-table.d.ts +6 -1
  77. package/lib/actions/dialog-table.js +20 -1
  78. package/lib/actions/drawer-table.d.ts +4 -0
  79. package/lib/actions/drawer-table.js +14 -1
  80. package/lib/actions/index.d.ts +6 -11
  81. package/lib/actions/index.js +44 -20
  82. package/lib/actions/index.scss +1 -1
  83. package/lib/card/index.d.ts +17 -0
  84. package/lib/form/Components/ProField/index.d.ts +8 -0
  85. package/lib/form/ProForm/index.d.ts +2 -2
  86. package/lib/form/ProForm/index.js +10 -2
  87. package/lib/form/ProForm/index.scss +40 -7
  88. package/lib/form/SchemaForm/adapterType.js +3 -3
  89. package/lib/form/SchemaForm/index.d.ts +2 -2
  90. package/lib/form/SchemaForm/index.js +10 -5
  91. package/lib/form/SchemaForm/initializeArrayCards.js +10 -54
  92. package/lib/form/SchemaForm/initializeArrayCollapse.js +10 -63
  93. package/lib/form/SchemaForm/initializeArrayIcon.js +19 -7
  94. package/lib/form/SchemaForm/initializeArrayItems.js +16 -74
  95. package/lib/form/SchemaForm/initializeArrayTable.js +23 -33
  96. package/lib/form/SchemaForm/initializeFormButton.js +35 -38
  97. package/lib/form/SchemaForm/initializeFormGroup.d.ts +2 -2
  98. package/lib/form/SchemaForm/initializeFormStep.d.ts +4 -2
  99. package/lib/form/SchemaForm/initializeFormStep.js +21 -7
  100. package/lib/form/SchemaForm/initializeFormTab.d.ts +2 -2
  101. package/lib/form/SchemaForm/initializeProField.js +3 -3
  102. package/lib/form/SchemaForm/reactions.d.ts +1 -1
  103. package/lib/form/SchemaForm/reactions.js +2 -2
  104. package/lib/form/index.d.ts +17 -9
  105. package/lib/form/index.js +81 -56
  106. package/lib/form/typing.d.ts +13 -22
  107. package/lib/form/warning.js +2 -6
  108. package/lib/index.d.ts +4 -3
  109. package/lib/index.js +16 -4
  110. package/lib/info/components/FormItem/index.js +4 -4
  111. package/lib/info/components/FormItem/index.scss +11 -0
  112. package/lib/info/components/InfoGroup/index.js +46 -6
  113. package/lib/info/components/InfoGroup/index.scss +6 -0
  114. package/lib/info/components/InfoValueItem/index.js +15 -3
  115. package/lib/info/components/baseInfo/index.js +10 -9
  116. package/lib/info/components/headerInfo/index.js +11 -10
  117. package/lib/info/components/tableInfo/index.js +7 -3
  118. package/lib/info/components/tableInfo/index.scss +1 -1
  119. package/lib/info/index.d.ts +1 -0
  120. package/lib/info/index.js +8 -6
  121. package/lib/info/index.scss +4 -0
  122. package/lib/info/typing.d.ts +17 -3
  123. package/lib/info/utils/index.d.ts +11 -2
  124. package/lib/info/utils/index.js +31 -0
  125. package/lib/nocode/configurators/PageHeader.js +49 -43
  126. package/lib/nocode/configurators/ProTable.js +12 -9
  127. package/lib/nocode/configurators/common.d.ts +117 -105
  128. package/lib/nocode/configurators/common.js +38 -34
  129. package/lib/nocode/index.scss +1 -4
  130. package/lib/page-header/index.d.ts +3 -0
  131. package/lib/page-header/index.js +42 -13
  132. package/lib/page-header/index.scss +6 -4
  133. package/lib/table/components/Filter/index.js +7 -15
  134. package/lib/table/components/Layout/index.js +2 -1
  135. package/lib/table/components/Layout/index.scss +1 -1
  136. package/lib/table/components/ToolBar/FilterColumnIcon.js +75 -16
  137. package/lib/table/components/ToolBar/index.scss +10 -0
  138. package/lib/table/index.d.ts +0 -1
  139. package/lib/table/index.js +76 -65
  140. package/lib/table/index.scss +0 -1
  141. package/lib/table/typing.d.ts +3 -1
  142. package/package.json +5 -5
package/es/form/index.js CHANGED
@@ -1,23 +1,35 @@
1
1
  /**
2
- * 导出全部 @teamix/formily 方法,支持完全自主定义表单
2
+ * 导出ProForm的TS
3
3
  */
4
+ export * from './typing';
5
+ /**
6
+ * 使用别名导出formily相关内容
7
+ */
8
+
4
9
  import * as _formilyCore from '@formily/core';
5
10
  export { _formilyCore as formilyCore };
6
11
  import * as _formilyReact from '@formily/react';
7
12
  export { _formilyReact as formilyReact };
8
- export * from '@teamix/formily';
9
- export * from './Filter';
10
- export * from './typing';
13
+ import * as _formilyReactive from '@formily/reactive';
14
+ export { _formilyReactive as formilyReactive };
15
+ import * as _formilyTeamix from '@teamix/formily';
16
+ export { _formilyTeamix as formilyTeamix };
11
17
  /**
12
- * 导出常用方法等
18
+ * 导出常用formily内容,需谨慎限制
13
19
  */
14
20
 
15
21
  import { createForm, registerValidateRules as registerRules, registerValidateFormats as registerFormats, registerValidateLocale, setValidateLanguage } from '@formily/core';
16
- import { createSchemaField, Field, FormConsumer } from '@formily/react';
17
- import { toJS } from '@formily/reactive';
18
- export { createForm, registerRules, registerFormats, registerValidateLocale, setValidateLanguage, Field, createSchemaField, FormConsumer, toJS };
22
+ import { FormConsumer } from '@formily/react';
23
+ import { FormDialog, FormDrawer, FormStep, FormTab, FormCollapse } from '@teamix/formily';
24
+ export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, FormCollapse, registerRules, registerFormats, registerValidateLocale, setValidateLanguage };
25
+ /**
26
+ * 导出 Filter 组件
27
+ */
28
+
29
+ import { AdvancedFilter, SimpleFilter, QueryFilter } from './Filter';
30
+ export { AdvancedFilter, SimpleFilter, QueryFilter };
19
31
  /**
20
- * 导出封装的 ProForm 组件,支持快速搭建表单
32
+ * 导出 ProForm 组件,支持快速搭建表单
21
33
  */
22
34
 
23
35
  import ProForm from './ProForm';
@@ -1,28 +1,22 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { Method } from 'axios';
3
2
  import type { IFormFeedback, Form as FormType, FieldPatternTypes } from '@formily/core';
4
3
  import type { IFormLayoutProps } from '@teamix/formily';
4
+ import { CommonRequestConfig } from '@teamix/utils';
5
5
  export interface anyObject {
6
6
  [propName: string]: any;
7
7
  }
8
8
  declare type FieldDisplayTypes = 'none' | 'hidden' | 'visible';
9
- export declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker' | 'Percent' | 'Money' | 'Select' | 'MultipleSelect' | 'TreeSelect' | 'Cascader' | 'MultipleCascader' | 'ArbitraryCascader' | 'Radio' | 'Checkbox' | 'Switch' | 'DatePicker' | 'TimePicker' | 'DateTimePicker' | 'WeekPicker' | 'MonthPicker' | 'YearPicker' | 'QuarterPicker' | 'DateRangePicker' | 'TimeRangePicker' | 'DateTimeRangePicker' | 'WeekRangePicker' | 'MonthRangePicker' | 'YearRangePicker' | 'QuarterRangePicker' | 'Transfer' | 'Upload' | 'ColorPicker' | 'ColorRadio' | 'ColorSwatches' | 'ColorTwitter' | 'IconPicker' | 'JsonInput';
9
+ export declare type IBaseComponent = 'Input' | 'Password' | 'TextArea' | 'NumberPicker' | 'Percent' | 'Money' | 'Select' | 'MultipleSelect' | 'TreeSelect' | 'Cascader' | 'MultipleCascader' | 'ArbitraryCascader' | 'Radio' | 'Checkbox' | 'Switch' | 'DatePicker' | 'TimePicker' | 'DateTimePicker' | 'WeekPicker' | 'MonthPicker' | 'YearPicker' | 'QuarterPicker' | 'DateRangePicker' | 'TimeRangePicker' | 'DateTimeRangePicker' | 'WeekRangePicker' | 'MonthRangePicker' | 'YearRangePicker' | 'QuarterRangePicker' | 'Transfer' | 'Upload' | 'ColorPicker' | 'ColorRadio' | 'IconPicker' | 'JsonInput' | 'TagPicker' | 'Range' | 'Search';
10
10
  export declare type IButtonComponent = 'Submit' | 'Reset';
11
11
  export declare type IComboComponent = 'ArrayCards' | 'ArrayCards.Addition' | 'ArrayCards.Remove' | 'ArrayCards.MoveUp' | 'ArrayCards.MoveDown' | 'ArrayCards.Index' | 'ArrayCollapse' | 'ArrayCollapse.CollapsePanel' | 'ArrayCollapse.Addition' | 'ArrayCollapse.Remove' | 'ArrayCollapse.MoveUp' | 'ArrayCollapse.MoveDown' | 'ArrayCollapse.Index' | 'ArrayTable' | 'ArrayTable.Column' | 'ArrayTable.SortHandle' | 'ArrayTable.Addition' | 'ArrayTable.Remove' | 'ArrayTable.MoveDown' | 'ArrayTable.MoveUp' | 'ArrayTable.Index' | 'ArrayItems' | 'ArrayItems.Item' | 'ArrayItems.SortHandle' | 'ArrayItems.Addition' | 'ArrayItems.Remove' | 'ArrayItems.MoveDown' | 'ArrayItems.MoveUp' | 'ArrayItems.Index' | 'Editable' | 'Editable.Popover' | 'Editable.Dialog' | 'Editable.Drawer';
12
12
  export declare type ILayoutComponent = 'FormFlex' | 'FormGrid' | 'FormGroup' | 'FormGroup.GroupPanel' | 'Search' | 'Search.SearchPanel' | 'FormTab' | 'FormTab.TabPane' | 'FormStep' | 'FormStep.StepPane' | 'FormCollapse' | 'FormCollapse.CollapsePanel' | 'FormButtonGroup' | 'FormDialog' | 'FormDrawer' | 'FormDialog.Footer' | 'FormDrawer.Footer';
13
- export interface IRequestConfig {
14
- url?: string;
15
- method?: Method;
16
- params?: any;
17
- data?: any;
13
+ export interface IRequestConfig extends CommonRequestConfig {
18
14
  when?: (field: any) => any;
19
- formatter?: (res: any, utils: any) => any;
20
- successMsg?: string;
21
- errorMsg?: string;
15
+ formatResult?: (res: any, utils?: any) => any;
22
16
  onSuccess?: (res: any, field?: any) => any;
23
- onError?: (error: any) => any;
17
+ onError?: (res: any) => any;
24
18
  }
25
- export interface ISchemaProItem {
19
+ export interface IFormSchemaItem {
26
20
  type?: string;
27
21
  name?: string;
28
22
  description?: React.ReactNode;
@@ -34,8 +28,8 @@ export interface ISchemaProItem {
34
28
  dataSource?: any[];
35
29
  reactions?: any;
36
30
  rules?: any;
37
- items?: ISchemaProItem[];
38
- children?: ISchemaProItem[];
31
+ items?: IFormSchemaItem;
32
+ children?: IFormSchemaItem[];
39
33
  content?: any;
40
34
  tooltip?: string;
41
35
  required?: boolean;
@@ -49,16 +43,13 @@ export interface ISchemaProItem {
49
43
  default?: any;
50
44
  request?: IRequestConfig;
51
45
  }
52
- export declare type ISchemaPro = ISchemaProItem[];
53
- export interface IInitialize {
54
- (items: ISchemaProItem[], props?: any): ISchemaProItem[];
55
- }
46
+ export declare type IFormSchema = IFormSchemaItem[];
56
47
  export interface IInitializeItem {
57
- (items: ISchemaProItem, props?: any): ISchemaProItem;
48
+ (item: IFormSchemaItem, props?: any): IFormSchemaItem;
58
49
  }
59
- export interface IProFormProps extends IFormLayoutProps {
50
+ export interface IFormProps extends IFormLayoutProps {
60
51
  form?: FormType | false;
61
- schema: ISchemaPro;
52
+ schema: IFormSchema;
62
53
  scope?: any;
63
54
  components?: {
64
55
  [key: string]: React.FC | React.ComponentClass;
@@ -70,7 +61,7 @@ export interface IProFormProps extends IFormLayoutProps {
70
61
  onSubmit?: (values: any) => any;
71
62
  onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
72
63
  }
73
- export interface IFilterProps extends IProFormProps {
64
+ export interface IFilterProps extends IFormProps {
74
65
  triggerType?: 'keydown' | 'change' | 'submit';
75
66
  onFilter?: (values: any) => void;
76
67
  onReset?: (payload?: any) => void;
@@ -5,12 +5,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  var warning = function warning(item) {
8
- var newItem = _objectSpread({}, item); // if (newItem.formItem) {
9
- // newItem.decorator = newItem.formItem;
10
- // delete newItem.formItem;
11
- // console.warn(
12
- // '请尽快将“formItem”属性名称升级为“decorator”,正式版将不再支持该名称。',
13
- // );
8
+ var newItem = _objectSpread({}, item); // if (xxx) {
9
+ // console.warn('xxx');
14
10
  // }
15
11
 
16
12
 
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import ProAction from './actions';
1
+ import ProActions from './actions';
2
2
  import ProCard from './card';
3
3
  import ProField from './field';
4
4
  import ProForm from './form';
@@ -15,9 +15,10 @@ export * from './actions';
15
15
  export * from './card';
16
16
  export * from './field';
17
17
  export * from './form';
18
+ export * from './info';
18
19
  export * from './page-container';
19
20
  export * from './page-header';
20
21
  export * from './skeleton';
21
22
  export * from './table';
22
- declare const version = "1.1.3";
23
- export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
23
+ declare const version = "1.1.7";
24
+ export { version, ProActions, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import ProAction from './actions';
1
+ import ProActions from './actions';
2
2
  import ProCard from './card';
3
3
  import ProField from './field';
4
4
  import ProForm from './form';
@@ -19,10 +19,11 @@ export * from './actions';
19
19
  export * from './card';
20
20
  export * from './field';
21
21
  export * from './form';
22
+ export * from './info';
22
23
  export * from './page-container';
23
24
  export * from './page-header';
24
25
  export * from './skeleton';
25
26
  export * from './table';
26
- var version = '1.1.3';
27
- export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
27
+ var version = '1.1.7';
28
+ export { version, ProActions, ProCard, ProField, ProForm, ProInfo, // ProLayout,
28
29
  ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils };
@@ -32,9 +32,7 @@ var FormItem = function FormItem(prop) {
32
32
  span: wrapperCol.span,
33
33
  className: cls('value')
34
34
  }, loading && /*#__PURE__*/React.createElement("div", {
35
- style: {
36
- width: '100%'
37
- }
35
+ className: cls('base-skeleton-box')
38
36
  }, /*#__PURE__*/React.createElement(BaseSkeleton.Info, null)), !loading && /*#__PURE__*/React.createElement("div", null, value))));
39
37
  }
40
38
 
@@ -54,7 +52,9 @@ var FormItem = function FormItem(prop) {
54
52
  style: {
55
53
  marginLeft: labelGutter
56
54
  }
57
- }, loading && /*#__PURE__*/React.createElement(BaseSkeleton.Info, null), !loading && /*#__PURE__*/React.createElement(React.Fragment, null, value))));
55
+ }, loading && /*#__PURE__*/React.createElement("div", {
56
+ className: cls('base-skeleton-box')
57
+ }, /*#__PURE__*/React.createElement(BaseSkeleton.Info, null)), !loading && /*#__PURE__*/React.createElement(React.Fragment, null, value))));
58
58
  }
59
59
 
60
60
  return /*#__PURE__*/React.createElement(React.Fragment, null);
@@ -31,6 +31,7 @@ $item-padding-bottom: 8px;
31
31
  font-size: $text-size;
32
32
  display: unset;
33
33
  width: 100%;
34
+ padding-right: 20px;
34
35
  }
35
36
 
36
37
  .teamix-pro-field-info-form-item-header-label {
@@ -47,3 +48,13 @@ $item-padding-bottom: 8px;
47
48
  display: inline-block;
48
49
  width: 100%;
49
50
  }
51
+
52
+ .teamix-pro-field-info-form-item-base-skeleton-box {
53
+ width: 100%;
54
+ height: 100%;
55
+ display: flex;
56
+ align-items: center;
57
+ span {
58
+ width: 100%
59
+ }
60
+ }
@@ -1,16 +1,47 @@
1
- import React from 'react';
1
+ import React, { useRef } from 'react';
2
+ import { ProInfoGroupContext } from '../../utils';
3
+ import { useSize } from '@teamix/hooks';
2
4
  import './index.scss';
5
+ import useInfoRequest from '../../utils/useInfoRequest';
3
6
 
4
7
  var ProInfoGroup = function ProInfoGroup(props) {
5
- var children = props.children;
6
- return /*#__PURE__*/React.createElement("div", {
7
- className: "teamix-pro-info-group"
8
- }, children === null || children === void 0 ? void 0 : children.map(function (item, index) {
8
+ var children = props.children,
9
+ url = props.url,
10
+ method = props.method,
11
+ params = props.params,
12
+ formatResult = props.formatResult;
13
+ var ref = useRef();
14
+ var size = useSize(ref); // 请求数据
15
+
16
+ var _useInfoRequest = useInfoRequest({
17
+ url: url,
18
+ method: method,
19
+ params: params,
20
+ formatResult: formatResult
21
+ }),
22
+ loading = _useInfoRequest.loading,
23
+ result = _useInfoRequest.result,
24
+ refresh = _useInfoRequest.refresh;
25
+
26
+ return /*#__PURE__*/React.createElement(ProInfoGroupContext.Provider, {
27
+ value: {
28
+ visible: true,
29
+ size: size,
30
+ loading: loading,
31
+ result: result,
32
+ refresh: refresh
33
+ }
34
+ }, /*#__PURE__*/React.createElement("div", {
35
+ className: "teamix-pro-info-group",
36
+ ref: ref
37
+ }, Array.isArray(children) && (children === null || children === void 0 ? void 0 : children.map(function (item, index) {
9
38
  return /*#__PURE__*/React.createElement("div", {
10
39
  className: "teamix-pro-info-group-item",
11
40
  key: index
12
41
  }, item);
13
- }));
42
+ })), !Array.isArray(children) && /*#__PURE__*/React.createElement("div", {
43
+ className: "teamix-pro-info-group-item"
44
+ }, children)));
14
45
  };
15
46
 
16
47
  export default ProInfoGroup;
@@ -1,8 +1,14 @@
1
1
  .teamix-pro-info-group {
2
2
  &-item {
3
+ margin-top: 16px;
3
4
  border-bottom: 1px solid var(--color-line1-1, #eaeaea);
5
+ margin-bottom: 16px;
4
6
  }
5
7
  .teamix-pro-info-group-item:last-child {
6
8
  border-bottom: 0;
9
+ margin-bottom: 0;
10
+ }
11
+ .teamix-pro-info-group-item:first-child {
12
+ margin-top: 0;
7
13
  }
8
14
  }
@@ -28,10 +28,11 @@ import { baseClass, request } from '@teamix/utils';
28
28
  import PopConfirm from '@teamix/pop-confirm';
29
29
  import React, { useMemo, useState } from 'react';
30
30
  import './index.scss';
31
- import ProForm, { createForm, toJS } from '../../../form';
31
+ import ProForm, { createForm, formilyReactive } from '../../../form';
32
32
  import { Message } from '@alicloudfe/components';
33
33
  import { ActionGroup } from '../../../actions';
34
34
  var cls = baseClass('teamix-pro-info');
35
+ var toJS = formilyReactive.toJS;
35
36
 
36
37
  var InfoValueItem = function InfoValueItem(props) {
37
38
  var _props$type = props.type,
@@ -54,7 +55,18 @@ var InfoValueItem = function InfoValueItem(props) {
54
55
  _infoItem$successMess = infoItem.successMessage,
55
56
  successMessage = _infoItem$successMess === void 0 ? 'success' : _infoItem$successMess,
56
57
  actions = infoItem.actions,
57
- extra = infoItem.extra; // 浮层的显隐状态
58
+ extra = infoItem.extra; // 由info接管field中的value。重新实现
59
+ // let fieldRender = render;
60
+ // let newValue = value;
61
+ // if (render && typeof render !== 'function') {
62
+ // const { value, ...others } = render;
63
+ // fieldRender = others;
64
+ // if (value) {
65
+ // newValue = getTargetValue(`${value}`, { ...record, record });
66
+ // console.log("newValue", newValue);
67
+ // }
68
+ // }
69
+ // 浮层的显隐状态
58
70
 
59
71
  var _useState = useState(false),
60
72
  _useState2 = _slicedToArray(_useState, 2),
@@ -6,14 +6,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import { Grid } from '@alicloudfe/components';
8
8
  import { ProCard } from '../../../';
9
- import React, { useRef } from 'react';
9
+ import React, { useContext, useRef } from 'react';
10
10
  import FormItem from '../FormItem';
11
11
  import './index.scss';
12
12
  import { useSize } from '@teamix/hooks';
13
13
  import { getLayout } from '../../utils/utils';
14
- import { getTargetValue } from '@teamix/utils';
15
14
  import defaultLayoutMap from '../../utils/layout';
16
15
  import InfoValueItem from '../InfoValueItem';
16
+ import { getDataIndexValue, ProInfoGroupContext } from '../../utils';
17
17
  var Row = Grid.Row,
18
18
  Col = Grid.Col;
19
19
 
@@ -25,15 +25,15 @@ var ProBaseInfo = function ProBaseInfo(props) {
25
25
  dataSource = props.dataSource,
26
26
  loading = props.loading,
27
27
  result = props.result,
28
- actionRef = props.actionRef; // TODO: 自动响应式。日后会更改成hooks
29
-
28
+ actionRef = props.actionRef;
29
+ var context = useContext(ProInfoGroupContext);
30
30
  var ref = useRef();
31
- var size = useSize(ref);
32
- var defaultLayout = defaultLayoutMap[getLayout((_size$width = size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
31
+ var size = context.visible ? context.size : useSize(ref);
32
+ var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
33
33
 
34
34
  var renderContent = function renderContent() {
35
35
  return columns.map(function (item, index) {
36
- var _item$title, _item$valueType, _item$dataIndex;
36
+ var _item$title, _item$valueType;
37
37
 
38
38
  var span = item.colSpan ? defaultLayout.span * item.colSpan : defaultLayout.span;
39
39
  return /*#__PURE__*/React.createElement(Col, {
@@ -44,7 +44,7 @@ var ProBaseInfo = function ProBaseInfo(props) {
44
44
  loading: loading,
45
45
  value: /*#__PURE__*/React.createElement(InfoValueItem, {
46
46
  type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
47
- value: getTargetValue("{{".concat((_item$dataIndex = item === null || item === void 0 ? void 0 : item.dataIndex) !== null && _item$dataIndex !== void 0 ? _item$dataIndex : '', "}}"), dataSource !== null && dataSource !== void 0 ? dataSource : result),
47
+ value: getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result),
48
48
  render: item.render,
49
49
  dataSource: item.dataSource,
50
50
  infoItem: item,
@@ -61,7 +61,8 @@ var ProBaseInfo = function ProBaseInfo(props) {
61
61
  return /*#__PURE__*/React.createElement("div", {
62
62
  ref: ref,
63
63
  className: "teamix-pro-info"
64
- }, size.width && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
64
+ }, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
65
+ compacted: true,
65
66
  hoveredShadow: false,
66
67
  bordered: false
67
68
  }, header), /*#__PURE__*/React.createElement(Row, {
@@ -6,14 +6,14 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
6
6
 
7
7
  import { Grid } from '@alicloudfe/components';
8
8
  import ProCard from '../../../card';
9
- import { getTargetValue } from '@teamix/utils';
10
- import React, { useRef } from 'react';
9
+ import React, { useContext, useRef } from 'react';
11
10
  import FormItem from '../FormItem';
12
11
  import './index.scss';
13
12
  import defaultLayoutMap from '../../utils/layout';
14
13
  import { useSize } from '@teamix/hooks';
15
14
  import { getLayout } from '../../utils/utils';
16
15
  import InfoValueItem from '../InfoValueItem';
16
+ import { getDataIndexValue, ProInfoGroupContext } from '../../utils';
17
17
  var Row = Grid.Row,
18
18
  Col = Grid.Col;
19
19
 
@@ -26,15 +26,15 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
26
26
  layout = props.layout,
27
27
  loading = props.loading,
28
28
  result = props.result,
29
- actionRef = props.actionRef; // TODO: 自动响应式。日后会更改成hooks
30
-
29
+ actionRef = props.actionRef;
30
+ var context = useContext(ProInfoGroupContext);
31
31
  var ref = useRef();
32
- var size = useSize(ref);
33
- var defaultLayout = defaultLayoutMap[getLayout((_size$width = size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
32
+ var size = context.visible ? context.size : useSize(ref);
33
+ var defaultLayout = defaultLayoutMap[getLayout((_size$width = size === null || size === void 0 ? void 0 : size.width) !== null && _size$width !== void 0 ? _size$width : 0)];
34
34
 
35
35
  var renderContent = function renderContent() {
36
36
  return columns.map(function (item, index) {
37
- var _item$title, _item$valueType, _item$dataIndex;
37
+ var _item$title, _item$valueType;
38
38
 
39
39
  var span = 24;
40
40
 
@@ -56,7 +56,7 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
56
56
  loading: loading,
57
57
  value: /*#__PURE__*/React.createElement(InfoValueItem, {
58
58
  type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
59
- value: getTargetValue("{{".concat((_item$dataIndex = item === null || item === void 0 ? void 0 : item.dataIndex) !== null && _item$dataIndex !== void 0 ? _item$dataIndex : '', "}}"), dataSource !== null && dataSource !== void 0 ? dataSource : result),
59
+ value: getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result),
60
60
  render: item.render,
61
61
  dataSource: item.dataSource,
62
62
  infoItem: item,
@@ -73,7 +73,8 @@ var ProHeaderInfo = function ProHeaderInfo(props) {
73
73
  return /*#__PURE__*/React.createElement("div", {
74
74
  ref: ref,
75
75
  className: "teamix-pro-info"
76
- }, size.width && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
76
+ }, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(ProCard, _objectSpread({
77
+ compacted: true,
77
78
  hoveredShadow: false,
78
79
  bordered: false
79
80
  }, header), /*#__PURE__*/React.createElement(Row, {
@@ -21,15 +21,17 @@ import './index.scss';
21
21
  import { Table } from '@alicloudfe/components';
22
22
  import './index.scss';
23
23
  import ProCard from '../../../card';
24
- import { getTargetValue, LabelIconTip } from '@teamix/utils';
24
+ import { LabelIconTip } from '@teamix/utils';
25
25
  import InfoValueItem from '../InfoValueItem';
26
26
  import { BaseSkeleton } from '../../..';
27
+ import { getDataIndexValue } from '../../utils';
27
28
 
28
29
  var ProTableInfo = function ProTableInfo(props) {
29
30
  var header = props.header,
30
31
  columns = props.columns,
31
32
  dataSource = props.dataSource,
32
- layout = props.layout,
33
+ _props$layout = props.layout,
34
+ layout = _props$layout === void 0 ? {} : _props$layout,
33
35
  loading = props.loading,
34
36
  result = props.result,
35
37
  actionRef = props.actionRef;
@@ -88,7 +90,7 @@ var ProTableInfo = function ProTableInfo(props) {
88
90
  }
89
91
 
90
92
  var itemData = filterColumns.map(function (item, index) {
91
- var _item$title, _item$valueType, _item$dataIndex, _data;
93
+ var _item$title, _item$valueType, _data;
92
94
 
93
95
  var data = (_data = {}, _defineProperty(_data, "label_".concat(index), /*#__PURE__*/React.createElement(LabelIconTip, {
94
96
  label: (_item$title = item === null || item === void 0 ? void 0 : item.title) !== null && _item$title !== void 0 ? _item$title : '',
@@ -96,7 +98,7 @@ var ProTableInfo = function ProTableInfo(props) {
96
98
  icon: item.tooltipIcon
97
99
  })), _defineProperty(_data, "value_".concat(index), /*#__PURE__*/React.createElement(React.Fragment, null, loading && /*#__PURE__*/React.createElement(BaseSkeleton.Info, null), !loading && /*#__PURE__*/React.createElement(InfoValueItem, {
98
100
  type: (_item$valueType = item === null || item === void 0 ? void 0 : item.valueType) !== null && _item$valueType !== void 0 ? _item$valueType : 'text',
99
- value: getTargetValue("{{".concat((_item$dataIndex = item === null || item === void 0 ? void 0 : item.dataIndex) !== null && _item$dataIndex !== void 0 ? _item$dataIndex : '', "}}"), dataSource !== null && dataSource !== void 0 ? dataSource : result),
101
+ value: getDataIndexValue(item.dataIndex, dataSource !== null && dataSource !== void 0 ? dataSource : result),
100
102
  render: item.render,
101
103
  dataSource: item.dataSource,
102
104
  infoItem: item,
@@ -157,6 +159,7 @@ var ProTableInfo = function ProTableInfo(props) {
157
159
  };
158
160
 
159
161
  return /*#__PURE__*/React.createElement(ProCard, _objectSpread({
162
+ compacted: true,
160
163
  hoveredShadow: false,
161
164
  bordered: false
162
165
  }, header), /*#__PURE__*/React.createElement(Table.StickyLock, {
@@ -6,7 +6,7 @@
6
6
  padding: 16px 24px;
7
7
  }
8
8
  .next-table-row.hovered {
9
- background-color:var(--color-white);
9
+ background-color:var(--color-fill1-1);
10
10
  }
11
11
  .next-table-row {
12
12
  color: var(--color-text1-3, #333333);
@@ -4,6 +4,7 @@ import { ProInfoProps } from './typing';
4
4
  export * from './typing';
5
5
  declare const ProInfo: {
6
6
  (props: ProInfoProps): JSX.Element;
7
+ Group: React.FC<import("./typing").InfoGroupProps>;
7
8
  ProInfoGroup: React.FC<import("./typing").InfoGroupProps>;
8
9
  };
9
10
  export default ProInfo;
package/es/info/index.js CHANGED
@@ -10,14 +10,14 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
10
10
 
11
11
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
12
 
13
- import React, { useRef } from 'react';
13
+ import React, { useContext, useRef } from 'react';
14
14
  import ProTableInfo from './components/tableInfo';
15
15
  import ProHeaderInfo from './components/headerInfo';
16
16
  import ProBaseInfo from './components/baseInfo';
17
17
  import ProInfoGroup from './components/InfoGroup';
18
18
  import './index.scss';
19
19
  import useInfoRequest from './utils/useInfoRequest';
20
- import { useActionType } from './utils';
20
+ import { ProInfoGroupContext, useActionType } from './utils';
21
21
  export * from './typing';
22
22
 
23
23
  var ProInfo = function ProInfo(props) {
@@ -29,18 +29,19 @@ var ProInfo = function ProInfo(props) {
29
29
  propsActionRef = props.actionRef,
30
30
  _props$header = props.header,
31
31
  header = _props$header === void 0 ? {} : _props$header,
32
- others = _objectWithoutProperties(props, _excluded); // 请求数据
32
+ others = _objectWithoutProperties(props, _excluded);
33
33
 
34
+ var context = useContext(ProInfoGroupContext); // 请求数据
34
35
 
35
- var _useInfoRequest = useInfoRequest({
36
+ var _ref = context.visible ? context : useInfoRequest({
36
37
  url: url,
37
38
  method: method,
38
39
  params: params,
39
40
  formatResult: formatResult
40
41
  }),
41
- loading = _useInfoRequest.loading,
42
- result = _useInfoRequest.result,
43
- _refresh = _useInfoRequest.refresh;
42
+ loading = _ref.loading,
43
+ result = _ref.result,
44
+ _refresh = _ref.refresh;
44
45
 
45
46
  var actionRef = useRef(); // 将 Actions 绑定到传入的 propsActionRef 中
46
47
 
@@ -81,5 +82,6 @@ var ProInfo = function ProInfo(props) {
81
82
  }));
82
83
  };
83
84
 
85
+ ProInfo.Group = ProInfoGroup;
84
86
  ProInfo.ProInfoGroup = ProInfoGroup;
85
87
  export default ProInfo;
@@ -5,4 +5,8 @@
5
5
  .teamix-pro-card-content {
6
6
  padding-bottom: 8px;
7
7
  }
8
+
9
+ .next-card {
10
+ background: none;
11
+ }
8
12
  }
@@ -3,6 +3,7 @@ import { ActionGroupProps, IActionButton } from '../actions';
3
3
  import { Method } from 'axios';
4
4
  import React from 'react';
5
5
  import { CardProps } from '../card';
6
+ import { IUseInfoRequestResult } from './utils/useInfoRequest';
6
7
  /** ProInfoBaseProps info 基础定义 */
7
8
  export declare type ProInfoBaseProps = {
8
9
  /** ProColums 定义,取代 Table 的 columns */
@@ -57,7 +58,7 @@ export interface ProInfoItemProps {
57
58
  /** 操作组配置 */
58
59
  actionSchema?: ActionGroupProps;
59
60
  /** 指定列对应的字段,支持`a.b`形式的快速取值 和 数组取值 */
60
- dataIndex?: string;
61
+ dataIndex?: string | string[];
61
62
  /** 合并行 */
62
63
  colSpan?: number;
63
64
  /** 是否可被编辑 */
@@ -130,8 +131,8 @@ export declare type HeaderInfoLayoutProps = {
130
131
  };
131
132
  /** infoGroup */
132
133
  export declare type InfoGroupProps = {
133
- children?: React.ReactNode[];
134
- };
134
+ children?: React.ReactNode[] | React.ReactNode;
135
+ } & Pick<ProInfoBaseProps, 'params' | 'method' | 'url' | 'onSuccess' | 'onError' | 'formatResult'>;
135
136
  export declare type TableInfoLayoutProps = {} & HeaderInfoLayoutProps;
136
137
  export declare type InfoValueItemProps = {
137
138
  infoItem: ProInfoItemProps;
@@ -141,3 +142,16 @@ export declare type InfoValueItemProps = {
141
142
  export declare type ProInfoHeaderProps = {
142
143
  extra?: CardProps['extra'] | IActionButton[];
143
144
  } & Omit<CardProps, 'extra'>;
145
+ /** ProInfoGroupContextProps */
146
+ export declare type ProInfoGroupContextProps = {
147
+ /** 因为其他数据都为异步。visible 只用作标识 */
148
+ visible?: boolean;
149
+ result?: any;
150
+ layout?: ProInfoBaseProps['layout'];
151
+ loading?: IUseInfoRequestResult['loading'];
152
+ refresh?: IUseInfoRequestResult['refresh'];
153
+ size?: {
154
+ width?: number;
155
+ height?: number;
156
+ };
157
+ };
@@ -1,3 +1,12 @@
1
- /// <reference types="react" />
2
- import { ProInfoActionType } from '../typing';
1
+ import React from 'react';
2
+ import { ProInfoActionType, ProInfoGroupContextProps, ProInfoItemProps } from '../typing';
3
3
  export declare function useActionType<T>(ref: React.MutableRefObject<ProInfoActionType | undefined>, action: ProInfoActionType): void;
4
+ /** ProInfoGroupContext */
5
+ export declare const ProInfoGroupContext: React.Context<ProInfoGroupContextProps>;
6
+ /**
7
+ * 获取 dataIndex 值
8
+ * @param dataIndex
9
+ * @param dataSource
10
+ * @returns
11
+ */
12
+ export declare function getDataIndexValue(dataIndex: ProInfoItemProps['dataIndex'], dataSource: object): any;