@pisell/materials 1.0.1051 → 1.0.1053

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 (169) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +13 -13
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +13 -13
  11. package/es/components/PisellCards/index.d.ts +6 -6
  12. package/es/components/appVersionControl/index.js +1 -1
  13. package/es/components/calendar/index.d.ts +2 -2
  14. package/es/components/checkbox/index.d.ts +2 -2
  15. package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +3 -3
  16. package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
  17. package/es/components/dataSourceComponents/dataSourceForm/index.js +1 -1
  18. package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +2 -2
  19. package/es/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
  20. package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
  21. package/es/components/dataSourceComponents/dataSourceSubForm/index.d.ts +16 -0
  22. package/es/components/dataSourceComponents/dataSourceSubForm/index.js +329 -0
  23. package/es/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
  24. package/es/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +538 -0
  25. package/es/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
  26. package/es/components/dataSourceComponents/dataSourceSubForm/types.d.ts +121 -0
  27. package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -1
  28. package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
  29. package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -1
  30. package/es/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +1 -1
  31. package/es/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +3 -3
  32. package/es/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +1 -1
  33. package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +1 -1
  34. package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +1 -1
  35. package/es/components/dataSourceComponents/fields/Radio/WithMode.d.ts +2 -2
  36. package/es/components/dataSourceComponents/fields/Radio/WithMode.js +1 -1
  37. package/es/components/dataSourceComponents/fields/RecordListWrapper/README.md +247 -0
  38. package/es/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +39 -0
  39. package/es/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +84 -0
  40. package/es/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +17 -0
  41. package/es/components/dataSourceComponents/fields/RecordListWrapper/index.js +9 -0
  42. package/es/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +91 -0
  43. package/es/components/dataSourceComponents/fields/Select/WithMode.js +1 -1
  44. package/es/components/dataSourceComponents/fields/Select/index.d.ts +3 -3
  45. package/es/components/dataSourceComponents/fields/Tabs/ReadPretty.js +16 -0
  46. package/es/components/dataSourceComponents/fields/Tabs/Tabs.js +75 -0
  47. package/es/components/dataSourceComponents/fields/Tabs/Tabs.less +55 -0
  48. package/es/components/dataSourceComponents/fields/Tabs/WithMode.js +13 -0
  49. package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +19 -0
  50. package/es/components/dataSourceComponents/fields/Tabs/index.js +10 -0
  51. package/es/components/dataSourceComponents/fields/Tabs/type.d.ts +36 -0
  52. package/es/components/dataSourceComponents/fields/index.js +5 -1
  53. package/es/components/dataSourceComponents/fields/utils.js +3 -0
  54. package/es/components/dataSourceComponents/hooks/useActions.js +1 -1
  55. package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +1 -1
  56. package/es/components/date-picker/index.d.ts +2 -2
  57. package/es/components/input/index.d.ts +2 -2
  58. package/es/components/pisell-config-provider/context.d.ts +2 -2
  59. package/es/components/pisellDataSourceContainer/type.d.ts +1 -1
  60. package/es/components/pisellDatePicker/index.d.ts +2 -2
  61. package/es/components/pisellInput/components/Copy/index.js +1 -1
  62. package/es/components/pisellModal/index.d.ts +6 -6
  63. package/es/components/pisellMultipleSelect/PisellMultipleSelect.less +15 -7
  64. package/es/components/pisellQuickFilter/index.d.ts +2 -2
  65. package/es/components/pisellRecordBoard/PisellRecordBoard.js +10 -3
  66. package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +3 -1
  67. package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +4 -2
  68. package/es/components/pisellRecordBoard/types.d.ts +4 -0
  69. package/es/components/pisellSingleSelect/PisellSingleSelect.less +15 -0
  70. package/es/components/pisellWalletPassCard/index.js +1 -1
  71. package/es/components/radio/index.d.ts +2 -2
  72. package/es/components/section-footers/index.d.ts +2 -2
  73. package/es/components/select/index.less +18 -2
  74. package/es/components/skeleton/index.d.ts +2 -2
  75. package/es/components/table/Actions/component/ExportImport/index.js +1 -1
  76. package/es/components/table/Table/fields/select/Edit/index.js +1 -1
  77. package/es/components/table/Table/tableConfig/SortRow/index.js +1 -1
  78. package/es/components/table/Table/tableConfig/body/CellProvider/index.js +1 -1
  79. package/es/components/time-picker/index.d.ts +2 -2
  80. package/es/components/typography/index.d.ts +2 -2
  81. package/es/components/upload/index.d.ts +2 -2
  82. package/es/index.d.ts +5 -1
  83. package/es/index.js +8 -5
  84. package/lib/components/PisellCards/index.d.ts +6 -6
  85. package/lib/components/PisellFields/index.d.ts +12 -12
  86. package/lib/components/PisellLayouts/index.d.ts +9 -9
  87. package/lib/components/PisellMetrics/index.d.ts +4 -4
  88. package/lib/components/appVersionControl/index.js +4 -4
  89. package/lib/components/calendar/index.d.ts +2 -2
  90. package/lib/components/checkbox/index.d.ts +2 -2
  91. package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +3 -3
  92. package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
  93. package/lib/components/dataSourceComponents/dataSourceForm/index.js +1 -1
  94. package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +2 -2
  95. package/lib/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
  96. package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
  97. package/lib/components/dataSourceComponents/dataSourceSubForm/index.d.ts +16 -0
  98. package/lib/components/dataSourceComponents/dataSourceSubForm/index.js +332 -0
  99. package/lib/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
  100. package/lib/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +538 -0
  101. package/lib/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
  102. package/lib/components/dataSourceComponents/dataSourceSubForm/types.d.ts +121 -0
  103. package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -1
  104. package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
  105. package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -1
  106. package/lib/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +1 -1
  107. package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +3 -3
  108. package/lib/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +1 -1
  109. package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +1 -1
  110. package/lib/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
  111. package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +1 -1
  112. package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +2 -2
  113. package/lib/components/dataSourceComponents/fields/Input.TextArea/index.d.ts +2 -2
  114. package/lib/components/dataSourceComponents/fields/Radio/WithMode.d.ts +2 -2
  115. package/lib/components/dataSourceComponents/fields/Radio/WithMode.js +1 -1
  116. package/lib/components/dataSourceComponents/fields/RecordListWrapper/README.md +247 -0
  117. package/lib/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +41 -0
  118. package/lib/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +86 -0
  119. package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +17 -0
  120. package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.js +9 -0
  121. package/lib/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +91 -0
  122. package/lib/components/dataSourceComponents/fields/Select/WithMode.js +1 -1
  123. package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
  124. package/lib/components/dataSourceComponents/fields/Tabs/ReadPretty.js +16 -0
  125. package/lib/components/dataSourceComponents/fields/Tabs/Tabs.js +78 -0
  126. package/lib/components/dataSourceComponents/fields/Tabs/Tabs.less +55 -0
  127. package/lib/components/dataSourceComponents/fields/Tabs/WithMode.js +13 -0
  128. package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +19 -0
  129. package/lib/components/dataSourceComponents/fields/Tabs/index.js +10 -0
  130. package/lib/components/dataSourceComponents/fields/Tabs/type.d.ts +35 -0
  131. package/lib/components/dataSourceComponents/fields/index.js +37 -33
  132. package/lib/components/dataSourceComponents/fields/utils.js +3 -0
  133. package/lib/components/dataSourceComponents/hooks/useActions.js +1 -1
  134. package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +1 -1
  135. package/lib/components/date-picker/index.d.ts +2 -2
  136. package/lib/components/input/index.d.ts +2 -2
  137. package/lib/components/pisell-config-provider/context.d.ts +2 -2
  138. package/lib/components/pisellDataSourceContainer/components/Pagination/index.d.ts +2 -2
  139. package/lib/components/pisellDataSourceContainer/components/Table/index.d.ts +2 -2
  140. package/lib/components/pisellDataSourceContainer/type.d.ts +1 -1
  141. package/lib/components/pisellDatePicker/index.d.ts +2 -2
  142. package/lib/components/pisellInput/components/Copy/index.js +1 -1
  143. package/lib/components/pisellMultipleSelect/PisellMultipleSelect.less +15 -7
  144. package/lib/components/pisellRecordBoard/PisellRecordBoard.js +10 -3
  145. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +3 -1
  146. package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +4 -2
  147. package/lib/components/pisellRecordBoard/types.d.ts +4 -0
  148. package/lib/components/pisellSingleSelect/PisellSingleSelect.less +15 -0
  149. package/lib/components/pisellWalletPassCard/index.js +1 -1
  150. package/lib/components/radio/index.d.ts +2 -2
  151. package/lib/components/section-footers/index.d.ts +2 -2
  152. package/lib/components/select/index.less +18 -2
  153. package/lib/components/skeleton/index.d.ts +2 -2
  154. package/lib/components/table/Actions/component/ExportImport/index.js +1 -1
  155. package/lib/components/table/Table/fields/select/Edit/index.js +1 -1
  156. package/lib/components/table/Table/tableConfig/SortRow/index.js +1 -1
  157. package/lib/components/table/Table/tableConfig/body/CellProvider/index.js +1 -1
  158. package/lib/components/time-picker/index.d.ts +2 -2
  159. package/lib/components/upload/index.d.ts +2 -2
  160. package/lib/index.d.ts +5 -1
  161. package/lib/index.js +256 -250
  162. package/lowcode/data-source-form/constants.ts +3 -0
  163. package/lowcode/data-source-form/utils.ts +19 -5
  164. package/lowcode/data-source-sub-form/meta.ts +274 -0
  165. package/lowcode/data-source-sub-form/snippets.ts +135 -0
  166. package/lowcode/form-item-record-list-wrapper/meta.ts +246 -0
  167. package/lowcode/form-item-record-list-wrapper/snippets.ts +24 -0
  168. package/lowcode/form-item-tabs/meta.ts +172 -0
  169. package/package.json +1 -1
@@ -0,0 +1,121 @@
1
+ import { ModeType } from "../dataSourceForm/type.js";
2
+ import React from "react";
3
+
4
+ //#region src/components/dataSourceComponents/dataSourceSubForm/types.d.ts
5
+ /**
6
+ * @title 字段选项接口
7
+ * @description 用于下拉框、单选框等组件的选项配置
8
+ */
9
+ interface DataSourceSubFormOption {
10
+ label?: React.ReactNode;
11
+ value: string | number;
12
+ }
13
+ /**
14
+ * @title 字段 Schema 接口
15
+ * @description 定义表单字段的结构和配置
16
+ */
17
+ interface DataSourceSubFormFieldSchema {
18
+ /** 字段名称(必填) */
19
+ name: string;
20
+ /** 字段标签 */
21
+ label?: React.ReactNode;
22
+ /** 组件类型(兼容多种命名方式) */
23
+ component?: string;
24
+ componentName?: string;
25
+ /** 字段数据类型 */
26
+ type?: string;
27
+ /** 接口类型,用于映射到具体组件(如 Select、Input 等) */
28
+ interface?: string;
29
+ /** 字段选项列表(用于 Select、Radio 等) */
30
+ options?: DataSourceSubFormOption[];
31
+ /** 组件额外配置 */
32
+ props?: Record<string, any>;
33
+ /** 子字段(用于嵌套结构,如 Input.JSON) */
34
+ children?: DataSourceSubFormFieldSchema[];
35
+ _children?: DataSourceSubFormFieldSchema[];
36
+ /** 字段 Schema 配置 */
37
+ schema?: Record<string, any>;
38
+ /** UI Schema 配置(支持低代码平台的各种配置项) */
39
+ uiSchema?: {
40
+ title?: React.ReactNode;
41
+ enum?: DataSourceSubFormOption[];
42
+ 'x-component'?: string;
43
+ 'x-component-props'?: Record<string, any>;
44
+ 'x-read-pretty'?: boolean;
45
+ 'x-validator'?: string;
46
+ 'x-display'?: 'visible' | 'hidden' | 'none';
47
+ 'x-pattern'?: 'editable' | 'disabled' | 'readPretty';
48
+ 'x-data-source'?: {
49
+ type?: string;
50
+ options?: Array<{
51
+ id?: string;
52
+ label: string | Record<string, any>;
53
+ value: string;
54
+ color?: string;
55
+ }>;
56
+ labelField?: string;
57
+ valueField?: string;
58
+ dataSource?: any;
59
+ extraParams?: Record<string, any>;
60
+ };
61
+ 'x-record-schema'?: DataSourceSubFormSchema | DataSourceSubFormFieldSchema[] | string;
62
+ default?: any;
63
+ type?: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
64
+ };
65
+ }
66
+ /**
67
+ * @title Schema 接口
68
+ * @description 表单字段集合的结构定义
69
+ */
70
+ interface DataSourceSubFormSchema {
71
+ /** 字段列表 */
72
+ fields?: DataSourceSubFormFieldSchema[];
73
+ /** 属性映射(key-value 形式) */
74
+ properties?: Record<string, any>;
75
+ /** 子字段列表 */
76
+ children?: DataSourceSubFormFieldSchema[];
77
+ }
78
+ /**
79
+ * @title DataSourceSubForm 组件 Props
80
+ * @description
81
+ * 独立的子表单组件,用于渲染一组表单字段。
82
+ * 支持通过 xRecordSchema 配置字段,或直接传入 children 低代码子组件。
83
+ */
84
+ interface DataSourceSubFormProps {
85
+ /** 渲染模式:edit(编辑)、disabled(禁用)、preview(预览) */
86
+ renderMode?: ModeType;
87
+ /**
88
+ * 表单值对象
89
+ * @example { "fieldName1": "value1", "fieldName2": "value2" }
90
+ */
91
+ value?: Record<string, any>;
92
+ /**
93
+ * 值变化回调
94
+ * @param value 更新后的表单值对象
95
+ */
96
+ onChange?: (value: Record<string, any>) => void;
97
+ /**
98
+ * xRecordSchema:定义表单字段结构
99
+ * 支持三种格式:
100
+ * 1. JSON 字符串
101
+ * 2. Schema 对象(包含 fields/properties/children)
102
+ * 3. 字段数组
103
+ */
104
+ xRecordSchema?: string | DataSourceSubFormSchema | DataSourceSubFormFieldSchema[];
105
+ /**
106
+ * 容器 children:低代码引擎渲染的子组件节点
107
+ * 优先使用 children,如果没有则回退到 xRecordSchema 渲染
108
+ */
109
+ children?: React.ReactNode;
110
+ /** 低代码设计模式标识 */
111
+ __designMode?: string;
112
+ /** 表单布局方式 */
113
+ layout?: 'horizontal' | 'vertical' | 'inline';
114
+ /** 自定义类名 */
115
+ className?: string;
116
+ /** 自定义样式 */
117
+ style?: React.CSSProperties;
118
+ [key: string]: any;
119
+ }
120
+ //#endregion
121
+ export { DataSourceSubFormProps };
@@ -2,8 +2,8 @@ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js'
2
2
  const require_objectSpread2 = require('../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
3
3
  const require_objectWithoutProperties = require('../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectWithoutProperties.js');
4
4
  const require_asyncToGenerator = require('../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js');
5
- const require_useDataSource = require('../hooks/useDataSource.js');
6
5
  const require_useVariables = require('../hooks/useVariables.js');
6
+ const require_useDataSource = require('../hooks/useDataSource.js');
7
7
  const require_index = require('../../table/index.js');
8
8
  const require_ActionsProvider = require('../provider/actions/ActionsProvider.js');
9
9
  const require_useDrawerState = require('./hooks/useDrawerState.js');
@@ -3,9 +3,9 @@ const require_index = require('../../../../locales/index.js');
3
3
  const require_objectSpread2 = require('../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
4
4
  const require_index$1 = require('../../../pisellModal/index.js');
5
5
  const require_asyncToGenerator = require('../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js');
6
- const require_useDataSource = require('../../hooks/useDataSource.js');
7
6
  const require_index$2 = require('../../../pisellToast/index.js');
8
7
  const require_useVariables = require('../../hooks/useVariables.js');
8
+ const require_useDataSource = require('../../hooks/useDataSource.js');
9
9
  const require_useComponentId = require('../../hooks/useComponentId.js');
10
10
  const require_index$3 = require('../filter/index.js');
11
11
  const require_usePagination = require('./usePagination.js');
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { LocalSettingsType } from "../../table/types.js";
3
2
  import { DataSourceType } from "../provider/dataSource/DataSourceContext.js";
3
+ import { LocalSettingsType } from "../../table/types.js";
4
4
  import { ColumnType } from "antd/es/table";
5
5
 
6
6
  //#region src/components/dataSourceComponents/dataSourceTable/type.d.ts
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.js');
2
- const require_useDataSource = require('../hooks/useDataSource.js');
3
2
  const require_useVariables = require('../hooks/useVariables.js');
3
+ const require_useDataSource = require('../hooks/useDataSource.js');
4
4
  const require_useComponentId = require('../hooks/useComponentId.js');
5
5
  let react = require("react");
6
6
  react = require_rolldown_runtime.__toESM(react);
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { CheckboxGroupProps } from "./type.js";
3
2
  import { WithModeProps } from "../../dataSourceForm/utils.js";
4
- import * as react48 from "react";
3
+ import { CheckboxGroupProps } from "./type.js";
4
+ import * as react50 from "react";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts
7
7
  type CheckboxComponent = React.FC & {
8
8
  Group: typeof CheckboxGroupWithMode;
9
9
  };
10
10
  declare const CheckboxWithMode: CheckboxComponent;
11
- declare const CheckboxGroupWithMode: react48.FC<CheckboxGroupProps & WithModeProps>;
11
+ declare const CheckboxGroupWithMode: react50.FC<CheckboxGroupProps & WithModeProps>;
12
12
  //#endregion
13
13
  export { CheckboxWithMode };
@@ -1,5 +1,5 @@
1
- const require_index = require('../../../date-picker/index.js');
2
1
  const require_utils = require('../../dataSourceForm/utils.js');
2
+ const require_index = require('../../../date-picker/index.js');
3
3
  const require_ReadPretty = require('./ReadPretty.js');
4
4
 
5
5
  //#region src/components/dataSourceComponents/fields/DateRangePicker/WithMode.ts
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
2
2
  const require_objectSpread2 = require('../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
3
3
  const require_objectWithoutProperties = require('../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectWithoutProperties.js');
4
- const require_index = require('../../../select/index.js');
5
4
  const require_useSetRequest = require('../../../../hooks/useSetRequest.js');
6
5
  const require_useTranslationOriginal = require('../../../../hooks/useTranslationOriginal.js');
7
6
  const require_utils = require('../../dataSourceForm/utils.js');
7
+ const require_index = require('../../../select/index.js');
8
8
  const require_serve = require('../Input.Phone/serve.js');
9
9
  const require_ReadPretty = require('./ReadPretty.js');
10
10
  let react = require("react");
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
2
  import React from "react";
3
3
  import * as antd23 from "antd";
4
- import * as antd_es_input3 from "antd/es/input";
4
+ import * as antd_es_input4 from "antd/es/input";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Input.Password/index.d.ts
7
- declare const Password: React.FC<antd_es_input3.PasswordProps & React.RefAttributes<antd23.InputRef> & WithModeProps & WithFormItemProps>;
7
+ declare const Password: React.FC<antd_es_input4.PasswordProps & React.RefAttributes<antd23.InputRef> & WithModeProps & WithFormItemProps>;
8
8
  //#endregion
9
9
  export { Password };
@@ -1,10 +1,10 @@
1
1
  const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
2
2
  const require_objectSpread2 = require('../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
3
3
  const require_objectWithoutProperties = require('../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectWithoutProperties.js');
4
- const require_index = require('../../../select/index.js');
5
4
  const require_useSetRequest = require('../../../../hooks/useSetRequest.js');
6
5
  const require_useTranslationOriginal = require('../../../../hooks/useTranslationOriginal.js');
7
6
  const require_utils = require('../../dataSourceForm/utils.js');
7
+ const require_index = require('../../../select/index.js');
8
8
  const require_serve = require('./serve.js');
9
9
  const require_ReadPretty = require('./ReadPretty.js');
10
10
  let react = require("react");
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
2
  import React from "react";
3
- import * as antd24 from "antd";
3
+ import * as antd19 from "antd";
4
4
 
5
5
  //#region src/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts
6
- declare const Subdomain: React.FC<antd24.InputProps & {
6
+ declare const Subdomain: React.FC<antd19.InputProps & {
7
7
  onChange: (value: string) => void;
8
8
  onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
9
9
  rootDomain: "custom" | "saas" | "xzero";
@@ -1,9 +1,9 @@
1
1
  import { WithFormItemProps, WithModeProps } from "../../dataSourceForm/utils.js";
2
2
  import React from "react";
3
- import * as antd_es_input4 from "antd/es/input";
3
+ import * as antd_es_input3 from "antd/es/input";
4
4
  import * as antd_es_input_TextArea0 from "antd/es/input/TextArea";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Input.TextArea/index.d.ts
7
- declare const TextArea: React.FC<antd_es_input4.TextAreaProps & React.RefAttributes<antd_es_input_TextArea0.TextAreaRef> & WithModeProps & WithFormItemProps>;
7
+ declare const TextArea: React.FC<antd_es_input3.TextAreaProps & React.RefAttributes<antd_es_input_TextArea0.TextAreaRef> & WithModeProps & WithFormItemProps>;
8
8
  //#endregion
9
9
  export { TextArea };
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { WithModeProps } from "../../dataSourceForm/utils.js";
3
3
  import { RadioGroupProps } from "./type.js";
4
- import * as react49 from "react";
4
+ import * as react48 from "react";
5
5
 
6
6
  //#region src/components/dataSourceComponents/fields/Radio/WithMode.d.ts
7
7
  type RadioComponent = React.FC & {
8
8
  Group: typeof RadioGroupWithMode;
9
9
  };
10
10
  declare const RadioWithMode: RadioComponent;
11
- declare const RadioGroupWithMode: react49.FC<RadioGroupProps & WithModeProps>;
11
+ declare const RadioGroupWithMode: react48.FC<RadioGroupProps & WithModeProps>;
12
12
  //#endregion
13
13
  export { RadioWithMode };
@@ -1,5 +1,5 @@
1
- const require_index = require('../../../radio/index.js');
2
1
  const require_utils = require('../../dataSourceForm/utils.js');
2
+ const require_index = require('../../../radio/index.js');
3
3
  const require_ReadPretty = require('./ReadPretty.js');
4
4
 
5
5
  //#region src/components/dataSourceComponents/fields/Radio/WithMode.ts
@@ -0,0 +1,247 @@
1
+ # RecordListWrapper 增强说明
2
+
3
+ ## 概述
4
+
5
+ `RecordListWrapper` 是一个增强的表单组件,用于管理多个记录的表单数据。它支持:
6
+
7
+ 1. **Tab 导航**:通过 `options` 驱动多个记录的切换
8
+ 2. **动态表单**:支持低代码引擎动态添加表单字段
9
+ 3. **Schema 驱动**:通过 `xRecordSchema` 配置字段结构
10
+ 4. **完整的表单能力**:复用 DataSourceForm 的所有能力(验证、格式化、多语言等)
11
+
12
+ ## 核心增强
13
+
14
+ ### 1. 数据源上下文支持
15
+
16
+ 现在 RecordListWrapper 会为子组件提供完整的 Provider 链:
17
+
18
+ - `FormSettingProvider`:提供表单设置(renderMode、size 等)
19
+ - `DataSourceProvider`:提供模拟数据源,让子组件能正常工作
20
+ - `JsonWrapperContext`:提供 JSON 嵌套路径支持
21
+
22
+ ### 2. 字段自动渲染
23
+
24
+ 当配置 `xRecordSchema` 时:
25
+
26
+ ```typescript
27
+ const xRecordSchema = [
28
+ {
29
+ name: 'code',
30
+ uiSchema: {
31
+ title: '代码',
32
+ 'x-component': 'Input',
33
+ 'x-component-props': {
34
+ placeholder: '请输入代码'
35
+ }
36
+ }
37
+ },
38
+ {
39
+ name: 'type',
40
+ interface: 'Select',
41
+ uiSchema: {
42
+ title: '类型',
43
+ enum: [
44
+ { label: '类型A', value: 'a' },
45
+ { label: '类型B', value: 'b' }
46
+ ]
47
+ }
48
+ }
49
+ ];
50
+ ```
51
+
52
+ ### 3. 低代码集成
53
+
54
+ 在低代码平台上:
55
+
56
+ 1. **配置 xRecordSchema**:
57
+ - 打开组件配置面板
58
+ - 找到 "Schema" 分组
59
+ - 在 "记录字段配置" 中输入 JSON 配置
60
+ - 系统会自动解析并生成表单字段
61
+
62
+ 2. **手动添加组件**:
63
+ - RecordListWrapper 是容器组件(`isContainer: true`)
64
+ - 可以直接拖拽表单项到容器中
65
+ - 子组件会自动获得正确的上下文
66
+
67
+ 3. **自定义 Tab 导航**:
68
+ - 可以拖拽自定义组件到 "Tab 区域" 插槽
69
+ - 组件会自动接收 `options`、`value`、`onChange` 属性
70
+
71
+ ## 值结构
72
+
73
+ ```typescript
74
+ // RecordListWrapper 的值是一个 Map 结构:
75
+ {
76
+ // key: option 的 value
77
+ // value: 该 option 对应的表单字段值
78
+ "option1": {
79
+ "code": "ABC",
80
+ "type": "a",
81
+ "name": "名称1"
82
+ },
83
+ "option2": {
84
+ "code": "DEF",
85
+ "type": "b",
86
+ "name": "名称2"
87
+ }
88
+ }
89
+ ```
90
+
91
+ ## 使用示例
92
+
93
+ ### 基础用法
94
+
95
+ ```tsx
96
+ import { FormItemRecordListWrapper } from '@pisell/materials';
97
+
98
+ const options = [
99
+ { label: '记录1', value: '1' },
100
+ { label: '记录2', value: '2' },
101
+ ];
102
+
103
+ const xRecordSchema = [
104
+ {
105
+ name: 'code',
106
+ uiSchema: {
107
+ title: '代码',
108
+ 'x-component': 'Input',
109
+ }
110
+ },
111
+ {
112
+ name: 'name',
113
+ uiSchema: {
114
+ title: '名称',
115
+ 'x-component': 'Input',
116
+ }
117
+ }
118
+ ];
119
+
120
+ <FormItemRecordListWrapper
121
+ name="records"
122
+ label="记录列表"
123
+ options={options}
124
+ xRecordSchema={xRecordSchema}
125
+ renderMode="edit"
126
+ />
127
+ ```
128
+
129
+ ### 在 DataSourceForm 中使用
130
+
131
+ ```tsx
132
+ <DataSourceForm renderMode="add">
133
+ <FormItemRecordListWrapper
134
+ name="channelRecords"
135
+ label="渠道配置"
136
+ options={channelOptions}
137
+ xRecordSchema={channelFieldSchema}
138
+ />
139
+ </DataSourceForm>
140
+ ```
141
+
142
+ ### 低代码平台配置示例
143
+
144
+ 1. **配置选项数据源**:
145
+ - optionSourceType: `api`
146
+ - dataSource: 选择一个表
147
+ - labelField: `name`
148
+ - valueField: `id`
149
+
150
+ 2. **配置 xRecordSchema**:
151
+ ```json
152
+ [
153
+ {
154
+ "name": "productCode",
155
+ "uiSchema": {
156
+ "title": "产品代码",
157
+ "x-component": "Input",
158
+ "x-component-props": {
159
+ "placeholder": "请输入产品代码"
160
+ }
161
+ }
162
+ },
163
+ {
164
+ "name": "priority",
165
+ "uiSchema": {
166
+ "title": "优先级",
167
+ "x-component": "InputNumber",
168
+ "x-component-props": {
169
+ "min": 0,
170
+ "max": 100
171
+ }
172
+ }
173
+ }
174
+ ]
175
+ ```
176
+
177
+ ## 注意事项
178
+
179
+ 1. **字段命名**:
180
+ - xRecordSchema 中的字段名会成为最终提交的 key
181
+ - 避免使用系统保留字段(createdAt、updatedAt 等)
182
+
183
+ 2. **验证规则**:
184
+ - 支持所有 DataSourceForm 的验证规则
185
+ - 可以通过 `uiSchema['x-component-props'].requiredobj` 配置必填
186
+
187
+ 3. **性能优化**:
188
+ - 切换 tab 时不会清空表单,只是切换显示的数据
189
+ - 所有 tab 的数据都会保存在 value 中
190
+
191
+ 4. **嵌套结构**:
192
+ - 支持嵌套的 JSON 字段(通过 Input.JSON 组件)
193
+ - 可以配置 children 来定义嵌套结构
194
+
195
+ ## 常见问题
196
+
197
+ ### Q: 如何动态增减 option?
198
+
199
+ A: 通过修改 `options` prop,RecordListWrapper 会自动更新 tab 导航。新增的 option 会创建空的表单数据。
200
+
201
+ ### Q: 如何验证所有 tab 的数据?
202
+
203
+ A: 将 RecordListWrapper 放在 Form 中,调用 `form.validateFields()` 会自动验证所有 tab 的数据。
204
+
205
+ ### Q: 如何获取所有 tab 的数据?
206
+
207
+ A: 通过 `onChange` 回调或 Form 的 `getFieldValue('fieldName')` 获取完整的 Map 结构。
208
+
209
+ ### Q: 支持哪些字段组件?
210
+
211
+ A: 支持所有 DataSourceForm 支持的组件,但**渲染方式有两种**:
212
+
213
+ #### 方式一:完整支持(推荐)- 在低代码平台配置 xRecordSchema
214
+ 在低代码平台上配置 `xRecordSchema` 后,系统会自动调用 `createFormItemSchema` 生成完整的表单组件,**完全支持**所有类型:
215
+ - ✅ Input 系列(Input、TextArea、Email、Phone、Mobile、URL、Password、Subdomain)
216
+ - ✅ Select、Radio、Radio.Group、Checkbox、Checkbox.Group、Switch
217
+ - ✅ InputNumber、Percent
218
+ - ✅ DatePicker、TimePicker
219
+ - ✅ ColorPicker
220
+ - ✅ Upload
221
+ - ✅ Translation(多语言输入)
222
+ - ✅ Input.JSON(JSON 编辑器)
223
+ - ✅ IconPicker(图标选择器)
224
+ - ✅ RecordListWrapper(支持嵌套)
225
+
226
+ #### 方式二:简化支持(回退方案)- 直接传入 xRecordSchema 不通过低代码平台
227
+ 如果直接在代码中使用 xRecordSchema,会使用简化的 `renderFallbackField` 回退渲染:
228
+ - ✅ Input 系列(基础支持)
229
+ - ✅ Select、Radio.Group、Checkbox.Group、Switch、Checkbox
230
+ - ✅ InputNumber、Percent
231
+ - ✅ DatePicker、TimePicker
232
+ - ✅ ColorPicker
233
+ - ✅ Upload(基础支持)
234
+ - ⚠️ Translation、IconPicker(使用 Input 代替)
235
+ - ⚠️ Input.JSON(使用 TextArea 代替)
236
+
237
+ **推荐做法:**
238
+ 在低代码平台配置 xRecordSchema,让系统自动生成完整的表单组件,这样可以获得最佳体验和完整功能。
239
+
240
+ ## 更新日志
241
+
242
+ ### v1.0.0
243
+ - ✅ 增强渲染能力,支持完整的 Provider 链
244
+ - ✅ 支持低代码引擎动态添加组件
245
+ - ✅ 复用 DataSourceForm 的所有表单能力
246
+ - ✅ 支持 xRecordSchema 配置驱动
247
+ - ✅ 自动提供数据源上下文给子组件
@@ -0,0 +1,41 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
2
+ let react = require("react");
3
+ react = require_rolldown_runtime.__toESM(react);
4
+
5
+ //#region src/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.tsx
6
+ /**
7
+ * @title: RecordListWrapper 只读态
8
+ * @description: 低代码详情模式下展示每个 option 对应的 record 数据。
9
+ * 值结构: { optionValue: { field1: v1, field2: v2 } }
10
+ */
11
+ const RecordListWrapperReadPretty = (props) => {
12
+ const { value, options = [] } = props;
13
+ /** 安全获取 Map 值 */
14
+ const safeValue = value && typeof value === "object" && !Array.isArray(value) ? value : {};
15
+ const entries = Object.entries(safeValue);
16
+ if (!entries.length) return /* @__PURE__ */ react.default.createElement("span", null, "-");
17
+ return /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("div", { style: { marginBottom: 8 } }, "Records: ", entries.length), entries.map(([key, record]) => {
18
+ const option = options.find((o) => String(o.value) === key);
19
+ const label = (option === null || option === void 0 ? void 0 : option.label) || key;
20
+ const displayLabel = typeof label === "object" ? JSON.stringify(label) : label;
21
+ return /* @__PURE__ */ react.default.createElement("div", {
22
+ key,
23
+ style: { marginBottom: 8 }
24
+ }, /* @__PURE__ */ react.default.createElement("div", { style: {
25
+ fontWeight: 500,
26
+ marginBottom: 4
27
+ } }, displayLabel), /* @__PURE__ */ react.default.createElement("pre", { style: {
28
+ margin: 0,
29
+ padding: 8,
30
+ background: "#f7f8fa",
31
+ borderRadius: 4,
32
+ fontSize: 12,
33
+ maxHeight: 200,
34
+ overflow: "auto"
35
+ } }, JSON.stringify(record, null, 2)));
36
+ }));
37
+ };
38
+ var ReadPretty_default = RecordListWrapperReadPretty;
39
+
40
+ //#endregion
41
+ exports.default = ReadPretty_default;
@@ -0,0 +1,86 @@
1
+ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.js');
2
+ const require_objectSpread2 = require('../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js');
3
+ const require_index = require('../../dataSourceSubForm/index.js');
4
+ const require_utils = require('../../dataSourceForm/utils.js');
5
+ const require_ReadPretty = require('./ReadPretty.js');
6
+ const require_Tabs = require('../Tabs/Tabs.js');
7
+ let react = require("react");
8
+ react = require_rolldown_runtime.__toESM(react);
9
+
10
+ //#region src/components/dataSourceComponents/fields/RecordListWrapper/WithMode.tsx
11
+ /**
12
+ * @title RecordListWrapper 编辑器
13
+ * @description
14
+ * 上部为插槽区域(topSlot),通过 cloneElement 注入 options/value/onChange,默认展示 Tabs 导航。
15
+ * 下部委托给 DataSourceSubForm 渲染当前 activeKey 对应的子表单。
16
+ * 切换 tab 时通过 key={activeKey} 强制重新挂载 DataSourceSubForm,实现值自动同步。
17
+ *
18
+ * 值结构: { [optionValue]: { field1: v1, field2: v2 } }
19
+ */
20
+ const RecordListWrapperBase = (props) => {
21
+ const { value, onChange, options = [], children, xRecordSchema, topSlot, slot, renderMode, __designMode, defaultValue } = props;
22
+ console.log("defaultActiveKey77777", defaultValue);
23
+ /** value 是 Map: { optionValue: { field1: v1 } } */
24
+ const safeValue = (0, react.useMemo)(() => {
25
+ if (value && typeof value === "object" && !Array.isArray(value)) return value;
26
+ return {};
27
+ }, [value]);
28
+ /**
29
+ * 当前选中的 option key
30
+ * 优先级:defaultActiveKey > options[0].value
31
+ */
32
+ const [activeKey, setActiveKey] = (0, react.useState)(() => {
33
+ var _options$;
34
+ if (defaultValue != null) return String(defaultValue);
35
+ return String(((_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value) || "");
36
+ });
37
+ /** defaultValue 变化时同步更新 activeKey */
38
+ (0, react.useEffect)(() => {
39
+ if (defaultValue != null) setActiveKey(String(defaultValue));
40
+ }, [defaultValue]);
41
+ /** options 变化时校正 activeKey(仅在无 defaultValue 且当前 key 不合法时回退) */
42
+ (0, react.useEffect)(() => {
43
+ if (options.length && !options.find((o) => String(o.value) === activeKey)) {
44
+ var _options$2;
45
+ setActiveKey(defaultValue != null ? String(defaultValue) : String(((_options$2 = options[0]) === null || _options$2 === void 0 ? void 0 : _options$2.value) || ""));
46
+ }
47
+ }, [options]);
48
+ const renderTopSlot = () => {
49
+ const slotElement = topSlot || slot;
50
+ if (slotElement && react.default.isValidElement(slotElement)) return react.default.cloneElement(slotElement, {
51
+ options,
52
+ value: activeKey,
53
+ onChange: setActiveKey
54
+ });
55
+ const tabOptions = options.map((o) => {
56
+ var _o$label;
57
+ return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, o), {}, { label: (_o$label = o.label) !== null && _o$label !== void 0 ? _o$label : String(o.value) });
58
+ });
59
+ return /* @__PURE__ */ react.default.createElement(require_Tabs.default, {
60
+ options: tabOptions,
61
+ value: activeKey,
62
+ onChange: (key) => setActiveKey(String(key)),
63
+ disabled: renderMode === "disabled"
64
+ });
65
+ };
66
+ const renderBottom = () => {
67
+ if (!options.length) return /* @__PURE__ */ react.default.createElement("div", { style: {
68
+ color: "#999",
69
+ fontSize: 12
70
+ } }, "No options available. Configure xDataSource options first.");
71
+ return /* @__PURE__ */ react.default.createElement(require_index.default, {
72
+ key: activeKey,
73
+ value: safeValue[activeKey],
74
+ onChange: (recordValue) => onChange === null || onChange === void 0 ? void 0 : onChange(require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, safeValue), {}, { [activeKey]: recordValue })),
75
+ xRecordSchema,
76
+ renderMode,
77
+ __designMode
78
+ }, children);
79
+ };
80
+ return /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("div", { style: { marginBottom: 12 } }, renderTopSlot()), renderBottom());
81
+ };
82
+ const RecordListWrapperWithMode = require_utils.withMode(RecordListWrapperBase, require_ReadPretty.default);
83
+ var WithMode_default = RecordListWrapperWithMode;
84
+
85
+ //#endregion
86
+ exports.default = WithMode_default;