@pisell/materials 3.3.87 → 3.3.88
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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +4 -4
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +25 -25
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +15 -15
- package/es/components/PisellLayouts/index.d.ts +0 -1
- package/es/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceSubForm/index.d.ts +13 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/index.js +274 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +544 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/types.d.ts +117 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/types.js +1 -0
- package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.d.ts +9 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +61 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/WithMode.d.ts +4 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +176 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +12 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.js +11 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +87 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Tabs/ReadPretty.d.ts +9 -0
- package/es/components/dataSourceComponents/fields/Tabs/ReadPretty.js +16 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.d.ts +23 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.js +93 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.less +64 -0
- package/es/components/dataSourceComponents/fields/Tabs/WithMode.d.ts +6 -0
- package/es/components/dataSourceComponents/fields/Tabs/WithMode.js +9 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +12 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.js +18 -0
- package/es/components/dataSourceComponents/fields/Tabs/type.d.ts +38 -0
- package/es/components/dataSourceComponents/fields/Tabs/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +44 -7
- package/es/components/dataSourceComponents/fields/index.js +5 -1
- package/es/components/dataSourceComponents/fields/utils.js +3 -0
- package/es/components/pisellLookup/PisellLookup.d.ts +4 -0
- package/es/components/pisellLookup/PisellLookup.js +8 -1
- package/es/components/productCard/components/Packages/utils.d.ts +2 -2
- package/es/index.d.ts +4 -0
- package/es/index.js +3 -0
- package/lib/components/PisellLayouts/index.d.ts +0 -1
- package/lib/components/dataSourceComponents/dataSourceForm/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.d.ts +13 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.js +229 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +544 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/types.d.ts +117 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/types.js +17 -0
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.d.ts +9 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +64 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/WithMode.d.ts +4 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +157 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +12 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.js +40 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +87 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Tabs/ReadPretty.d.ts +9 -0
- package/lib/components/dataSourceComponents/fields/Tabs/ReadPretty.js +45 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.d.ts +23 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.js +95 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.less +64 -0
- package/lib/components/dataSourceComponents/fields/Tabs/WithMode.d.ts +6 -0
- package/lib/components/dataSourceComponents/fields/Tabs/WithMode.js +39 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +12 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.js +40 -0
- package/lib/components/dataSourceComponents/fields/Tabs/type.d.ts +38 -0
- package/lib/components/dataSourceComponents/fields/Tabs/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +44 -7
- package/lib/components/dataSourceComponents/fields/index.js +5 -1
- package/lib/components/dataSourceComponents/fields/utils.js +3 -0
- package/lib/components/pisellLookup/PisellLookup.d.ts +4 -0
- package/lib/components/pisellLookup/PisellLookup.js +5 -1
- package/lib/components/productCard/components/Packages/utils.d.ts +2 -2
- package/lib/index.d.ts +4 -0
- package/lib/index.js +9 -0
- package/lowcode/auto-resize-text/meta.ts +9 -9
- package/lowcode/data-source-form/constants.ts +3 -0
- package/lowcode/data-source-form/utils.ts +31 -5
- package/lowcode/data-source-sub-form/meta.ts +259 -0
- package/lowcode/data-source-sub-form/snippets.ts +21 -0
- package/lowcode/form-item-record-list-wrapper/meta.ts +180 -0
- package/lowcode/form-item-record-list-wrapper/snippets.ts +18 -0
- package/lowcode/form-item-tabs/meta.ts +172 -0
- package/package.json +3 -3
- package/es/components/PisellCards/components/GraphicTextCard/components/BadgeWrapper.d.ts +0 -5
- package/es/components/PisellCards/components/GraphicTextCard/components/TextContent.d.ts +0 -27
- package/es/components/PisellCards/components/GraphicTextCard/hooks/index.d.ts +0 -5
- package/es/components/PisellCards/components/GraphicTextCard/hooks/useGraphicTextCardClick.d.ts +0 -15
- package/es/components/PisellCards/components/GraphicTextCard/hooks/useGraphicTextCardStyle.d.ts +0 -18
- package/es/components/PisellCards/components/GraphicTextCard/types.d.ts +0 -290
- package/es/components/PisellCards/components/GraphicTextCard/utils/index.d.ts +0 -19
- package/es/components/PisellCards/components/TextCard/TextCard.d.ts +0 -8
- package/es/components/PisellCards/components/TextCard/components/BadgeWrapper.d.ts +0 -26
- package/es/components/PisellCards/components/TextCard/components/IconWrapper.d.ts +0 -17
- package/es/components/PisellCards/components/TextCard/components/TextContent.d.ts +0 -21
- package/es/components/PisellCards/components/TextCard/components/index.d.ts +0 -6
- package/es/components/PisellCards/components/TextCard/index.d.ts +0 -5
- package/es/components/PisellCards/components/TextCard/types.d.ts +0 -270
- package/es/components/PisellCards/index.d.ts +0 -15
- package/es/components/config-provider/index.d.ts +0 -10
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -84
- package/es/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +0 -27
- package/es/components/dataSourceComponents/fields/Upload/constants.d.ts +0 -9
- package/es/components/drag-sort-tree/index.d.ts +0 -5
- package/es/components/filter/components/Dropdown/types.d.ts +0 -13
- package/es/components/filter/components/FilterButton/types.d.ts +0 -24
- package/es/components/filter/types.d.ts +0 -48
- package/es/components/login-and-register/index.d.ts +0 -82
- package/es/components/pisellCurrency/PisellCurrency.d.ts +0 -39
- package/es/components/pisellDateTimeDisplay/utils/relativeDay.d.ts +0 -24
- package/es/components/pisellEmail/PisellEmail.d.ts +0 -37
- package/es/components/pisellFilter/type.d.ts +0 -5
- package/es/components/pisellGridPro/index.d.ts +0 -4
- package/es/components/pisellLongText/PisellLongText.d.ts +0 -39
- package/es/components/pisellMultipleSelect/PisellMultipleSelect.d.ts +0 -9
- package/es/components/pisellMultipleSelect/components/EditView.d.ts +0 -8
- package/es/components/pisellNumber/PisellNumber.d.ts +0 -42
- package/es/components/pisellPhone/PisellPhone.d.ts +0 -36
- package/es/components/pisellPhone/components/EditView.d.ts +0 -19
- package/es/components/pisellPhone/constants/countryCodes.d.ts +0 -20
- package/es/components/pisellPhone/types.d.ts +0 -209
- package/es/components/pisellPhone/utils/countryCodeHelper.d.ts +0 -35
- package/es/components/pisellQuickFilter/type.d.ts +0 -12
- package/es/components/pisellRating/PisellRating.d.ts +0 -31
- package/es/components/pisellRecordBoard/shellFrame/BatchActionBar/index.d.ts +0 -8
- package/es/components/pisellRecordBoard/shellFrame/Search/index.d.ts +0 -10
- package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.d.ts +0 -16
- package/es/components/pisellSingleLineText/PisellSingleLineText.d.ts +0 -40
- package/es/components/pisellSingleSelect/PisellSingleSelect.d.ts +0 -9
- package/es/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.d.ts +0 -32
- package/es/components/pisellUrl/PisellUrl.d.ts +0 -37
- package/es/components/productCard/components/Header/DeleteButton/index.d.ts +0 -4
- package/es/components/productCard/components/Time/components/SelectHolder/index.d.ts +0 -4
- package/es/components/productCard/components/Time/components/SelectResource/index.d.ts +0 -19
- package/es/components/sort/index.d.ts +0 -5
- package/es/components/table/Actions/component/ViewMode/index.d.ts +0 -9
- package/es/components/table/Gallery/components/GalleryItem/index.d.ts +0 -14
- package/es/components/table/types.d.ts +0 -268
- package/es/components/translation/index.d.ts +0 -17
- package/es/components/translation/utils.d.ts +0 -9
- package/lib/components/PisellCards/components/GraphicTextCard/components/BadgeWrapper.d.ts +0 -5
- package/lib/components/PisellCards/components/GraphicTextCard/components/TextContent.d.ts +0 -27
- package/lib/components/PisellCards/components/GraphicTextCard/hooks/index.d.ts +0 -5
- package/lib/components/PisellCards/components/GraphicTextCard/hooks/useGraphicTextCardClick.d.ts +0 -15
- package/lib/components/PisellCards/components/GraphicTextCard/hooks/useGraphicTextCardStyle.d.ts +0 -18
- package/lib/components/PisellCards/components/GraphicTextCard/types.d.ts +0 -290
- package/lib/components/PisellCards/components/GraphicTextCard/utils/index.d.ts +0 -19
- package/lib/components/PisellCards/components/TextCard/TextCard.d.ts +0 -8
- package/lib/components/PisellCards/components/TextCard/components/BadgeWrapper.d.ts +0 -26
- package/lib/components/PisellCards/components/TextCard/components/IconWrapper.d.ts +0 -17
- package/lib/components/PisellCards/components/TextCard/components/TextContent.d.ts +0 -21
- package/lib/components/PisellCards/components/TextCard/components/index.d.ts +0 -6
- package/lib/components/PisellCards/components/TextCard/index.d.ts +0 -5
- package/lib/components/PisellCards/components/TextCard/types.d.ts +0 -270
- package/lib/components/PisellCards/index.d.ts +0 -15
- package/lib/components/config-provider/index.d.ts +0 -10
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +0 -84
- package/lib/components/dataSourceComponents/fields/Input.Phone/serve.d.ts +0 -27
- package/lib/components/dataSourceComponents/fields/Upload/constants.d.ts +0 -9
- package/lib/components/drag-sort-tree/index.d.ts +0 -5
- package/lib/components/filter/components/Dropdown/types.d.ts +0 -13
- package/lib/components/filter/components/FilterButton/types.d.ts +0 -24
- package/lib/components/filter/types.d.ts +0 -48
- package/lib/components/login-and-register/index.d.ts +0 -82
- package/lib/components/pisellCurrency/PisellCurrency.d.ts +0 -39
- package/lib/components/pisellDateTimeDisplay/utils/relativeDay.d.ts +0 -24
- package/lib/components/pisellEmail/PisellEmail.d.ts +0 -37
- package/lib/components/pisellFilter/type.d.ts +0 -5
- package/lib/components/pisellGridPro/index.d.ts +0 -4
- package/lib/components/pisellLongText/PisellLongText.d.ts +0 -39
- package/lib/components/pisellMultipleSelect/PisellMultipleSelect.d.ts +0 -9
- package/lib/components/pisellMultipleSelect/components/EditView.d.ts +0 -8
- package/lib/components/pisellNumber/PisellNumber.d.ts +0 -42
- package/lib/components/pisellPhone/PisellPhone.d.ts +0 -36
- package/lib/components/pisellPhone/components/EditView.d.ts +0 -19
- package/lib/components/pisellPhone/constants/countryCodes.d.ts +0 -20
- package/lib/components/pisellPhone/types.d.ts +0 -209
- package/lib/components/pisellPhone/utils/countryCodeHelper.d.ts +0 -35
- package/lib/components/pisellQuickFilter/type.d.ts +0 -12
- package/lib/components/pisellRating/PisellRating.d.ts +0 -31
- package/lib/components/pisellRecordBoard/shellFrame/BatchActionBar/index.d.ts +0 -8
- package/lib/components/pisellRecordBoard/shellFrame/Search/index.d.ts +0 -10
- package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.d.ts +0 -16
- package/lib/components/pisellSingleLineText/PisellSingleLineText.d.ts +0 -40
- package/lib/components/pisellSingleSelect/PisellSingleSelect.d.ts +0 -9
- package/lib/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.d.ts +0 -32
- package/lib/components/pisellUrl/PisellUrl.d.ts +0 -37
- package/lib/components/productCard/components/Header/DeleteButton/index.d.ts +0 -4
- package/lib/components/productCard/components/Time/components/SelectHolder/index.d.ts +0 -4
- package/lib/components/productCard/components/Time/components/SelectResource/index.d.ts +0 -19
- package/lib/components/sort/index.d.ts +0 -5
- package/lib/components/table/Actions/component/ViewMode/index.d.ts +0 -9
- package/lib/components/table/Gallery/components/GalleryItem/index.d.ts +0 -14
- package/lib/components/table/types.d.ts +0 -268
- package/lib/components/translation/index.d.ts +0 -17
- package/lib/components/translation/utils.d.ts +0 -9
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.pisell-form-tabs {
|
|
2
|
+
height: 40px;
|
|
3
|
+
width: 100%;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
background-color: #f5f5f5;
|
|
7
|
+
border-radius: 8px;
|
|
8
|
+
padding: 2px;
|
|
9
|
+
gap: 2px;
|
|
10
|
+
flex-wrap: nowrap;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
color: rgba(0, 0, 0, .65);
|
|
13
|
+
background-color: rgba(0, 0, 0, .04);
|
|
14
|
+
overflow-x: auto;
|
|
15
|
+
|
|
16
|
+
/* 隐藏滚动条:兼容 WebKit(Chrome/Safari/Edge)、Firefox、IE/Edge 旧版 */
|
|
17
|
+
-ms-overflow-style: none;
|
|
18
|
+
scrollbar-width: none;
|
|
19
|
+
|
|
20
|
+
&::-webkit-scrollbar {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&-item {
|
|
25
|
+
min-height: 36px;
|
|
26
|
+
min-width: 90px;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
padding: 0 12px;
|
|
31
|
+
border-radius: 6px;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
transition: background-color 0.2s ease, box-shadow 0.2s ease,
|
|
34
|
+
color 0.2s ease;
|
|
35
|
+
user-select: none;
|
|
36
|
+
white-space: nowrap;
|
|
37
|
+
flex: 0 0 auto;
|
|
38
|
+
outline: none;
|
|
39
|
+
|
|
40
|
+
&-label {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
color: rgba(0, 0, 0, 0.65);
|
|
43
|
+
font-weight: 400;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:hover:not(&--active):not(&--disabled) {
|
|
47
|
+
background-color: rgba(0, 0, 0, 0.06);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--active {
|
|
51
|
+
background-color: #ffffff;
|
|
52
|
+
|
|
53
|
+
.pisell-form-tabs-item-label {
|
|
54
|
+
color: #262626;
|
|
55
|
+
font-weight: 500;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&--disabled {
|
|
60
|
+
cursor: not-allowed;
|
|
61
|
+
opacity: 0.4;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** 包装 DataSource 层(提供数据源上下文) */
|
|
2
|
+
declare const FormItemTabs: (props: import("./type").TabsProps & import("../../dataSourceForm/utils").WithModeProps & import("../../dataSourceForm/utils").WithFormItemProps & {
|
|
3
|
+
options?: any;
|
|
4
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
5
|
+
labelField: string;
|
|
6
|
+
valueField: string;
|
|
7
|
+
extraParams?: Record<string, any> | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
dataSource?: any;
|
|
10
|
+
extraParams?: Record<string, any> | undefined;
|
|
11
|
+
}) => import("react").JSX.Element;
|
|
12
|
+
export default FormItemTabs;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { withFormItem, withDataSource, withOptions } from "../../dataSourceForm/utils";
|
|
2
|
+
import TabsWithMode from "./WithMode";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* FormItemTabs
|
|
6
|
+
* @description 表单字段 Tabs 组件,提供胶囊风格选项卡交互。
|
|
7
|
+
* 支持自定义选项、API 数据源、多种渲染模式(编辑/查看/禁用/隐藏)。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** 包装 FormItem 层 */
|
|
11
|
+
var TabsWithFormItem = withFormItem(TabsWithMode);
|
|
12
|
+
|
|
13
|
+
/** 包装 Options 层(支持 API 数据源转换) */
|
|
14
|
+
var TabsWithOptions = withOptions(TabsWithFormItem);
|
|
15
|
+
|
|
16
|
+
/** 包装 DataSource 层(提供数据源上下文) */
|
|
17
|
+
var FormItemTabs = withDataSource(TabsWithOptions);
|
|
18
|
+
export default FormItemTabs;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ModeType } from '../../dataSourceForm/type';
|
|
3
|
+
/**
|
|
4
|
+
* Tabs 选项配置
|
|
5
|
+
*/
|
|
6
|
+
export interface TabOption {
|
|
7
|
+
/** 选项显示文本 */
|
|
8
|
+
label: React.ReactNode;
|
|
9
|
+
/** 选项对应的值 */
|
|
10
|
+
value: string | number;
|
|
11
|
+
/** 是否禁用该选项 */
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Tabs 基础 Props(编辑态组件使用,不含 renderMode)
|
|
16
|
+
*/
|
|
17
|
+
export interface TabsProps {
|
|
18
|
+
/** 当前选中的值(受控) */
|
|
19
|
+
value?: string | number;
|
|
20
|
+
/** 默认选中的值(非受控) */
|
|
21
|
+
defaultValue?: string | number;
|
|
22
|
+
/** 选项列表 */
|
|
23
|
+
options?: TabOption[];
|
|
24
|
+
/** 是否禁用整个组件 */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** 选中值变化时的回调 */
|
|
27
|
+
onChange?: (value: string | number) => void;
|
|
28
|
+
/** 自定义类名 */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** 自定义样式 */
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Tabs ReadPretty Props(只读态组件使用,包含必填 renderMode)
|
|
35
|
+
*/
|
|
36
|
+
export interface TabsReadPrettyProps extends TabsProps {
|
|
37
|
+
renderMode: ModeType;
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,4 +15,4 @@ export declare const getFileMetadataParams: (file: RcFile & {
|
|
|
15
15
|
metadata?: MediaMetadata;
|
|
16
16
|
}) => Record<string, any>;
|
|
17
17
|
export declare const isValueEqual: (value: any, fileListValue: any) => boolean;
|
|
18
|
-
export declare const getBaseTime: (size: number) =>
|
|
18
|
+
export declare const getBaseTime: (size: number) => 2000 | 1000 | 4000 | 8000;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
declare const formFieldMap: {
|
|
3
2
|
FormItemCheckbox: import("react").FC<{}> & {
|
|
4
3
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -20,7 +19,7 @@ declare const formFieldMap: {
|
|
|
20
19
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
21
20
|
onChange: (value: string) => void;
|
|
22
21
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
23
|
-
rootDomain: "
|
|
22
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
24
23
|
customDomain?: string | undefined;
|
|
25
24
|
value?: string | undefined;
|
|
26
25
|
tenantId: string;
|
|
@@ -35,7 +34,7 @@ declare const formFieldMap: {
|
|
|
35
34
|
};
|
|
36
35
|
FormItemSelect: (props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
37
36
|
options?: any;
|
|
38
|
-
optionSourceType?: "default" | "
|
|
37
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
39
38
|
labelField: string;
|
|
40
39
|
valueField: string;
|
|
41
40
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -60,8 +59,37 @@ declare const formFieldMap: {
|
|
|
60
59
|
FormItemUpload: import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
61
60
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
62
61
|
FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
62
|
+
FormItemRecordListWrapper: (props: import("./RecordListWrapper/type").RecordListWrapperProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
63
|
+
options?: any;
|
|
64
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
65
|
+
labelField: string;
|
|
66
|
+
valueField: string;
|
|
67
|
+
extraParams?: Record<string, any> | undefined;
|
|
68
|
+
} & {
|
|
69
|
+
dataSource?: any;
|
|
70
|
+
extraParams?: Record<string, any> | undefined;
|
|
71
|
+
}) => import("react").JSX.Element;
|
|
72
|
+
FormItemTabs: (props: import("./Tabs/type").TabsProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
73
|
+
options?: any;
|
|
74
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
75
|
+
labelField: string;
|
|
76
|
+
valueField: string;
|
|
77
|
+
extraParams?: Record<string, any> | undefined;
|
|
78
|
+
} & {
|
|
79
|
+
dataSource?: any;
|
|
80
|
+
extraParams?: Record<string, any> | undefined;
|
|
81
|
+
}) => import("react").JSX.Element;
|
|
63
82
|
};
|
|
64
|
-
declare const getFieldComponent: (fieldComponent: string) =>
|
|
83
|
+
declare const getFieldComponent: (fieldComponent: string) => ((props: import("./RecordListWrapper/type").RecordListWrapperProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
84
|
+
options?: any;
|
|
85
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
86
|
+
labelField: string;
|
|
87
|
+
valueField: string;
|
|
88
|
+
extraParams?: Record<string, any> | undefined;
|
|
89
|
+
} & {
|
|
90
|
+
dataSource?: any;
|
|
91
|
+
extraParams?: Record<string, any> | undefined;
|
|
92
|
+
}) => import("react").JSX.Element) | (import("react").FC<{}> & {
|
|
65
93
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
66
94
|
} & {
|
|
67
95
|
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -78,7 +106,7 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
78
106
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
79
107
|
onChange: (value: string) => void;
|
|
80
108
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
81
|
-
rootDomain: "
|
|
109
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
82
110
|
customDomain?: string | undefined;
|
|
83
111
|
value?: string | undefined;
|
|
84
112
|
tenantId: string;
|
|
@@ -91,7 +119,7 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
91
119
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
92
120
|
}) | ((props: import("antd").SelectProps<any, import("antd/es/select").DefaultOptionType> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
93
121
|
options?: any;
|
|
94
|
-
optionSourceType?: "default" | "
|
|
122
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
95
123
|
labelField: string;
|
|
96
124
|
valueField: string;
|
|
97
125
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -100,5 +128,14 @@ declare const getFieldComponent: (fieldComponent: string) => import("react").FC<
|
|
|
100
128
|
extraParams?: Record<string, any> | undefined;
|
|
101
129
|
}) => import("react").JSX.Element) | import("react").FC<any> | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Phone/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Input.Mobile/WithMode").PhoneInputProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
102
130
|
onChange: (value: string) => void;
|
|
103
|
-
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps
|
|
131
|
+
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | import("react").FC<import("./DateRangePicker/type").DateRangePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Upload/type").UploadProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | ((props: import("./Tabs/type").TabsProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps & {
|
|
132
|
+
options?: any;
|
|
133
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
134
|
+
labelField: string;
|
|
135
|
+
valueField: string;
|
|
136
|
+
extraParams?: Record<string, any> | undefined;
|
|
137
|
+
} & {
|
|
138
|
+
dataSource?: any;
|
|
139
|
+
extraParams?: Record<string, any> | undefined;
|
|
140
|
+
}) => import("react").JSX.Element);
|
|
104
141
|
export { getFieldComponent, formFieldMap };
|
|
@@ -10,6 +10,8 @@ import DateRangePicker from "./DateRangePicker";
|
|
|
10
10
|
import Upload from "./Upload";
|
|
11
11
|
import Translation from "./Translation";
|
|
12
12
|
import IconSelect from "./IconSelect";
|
|
13
|
+
import RecordListWrapper from "./RecordListWrapper";
|
|
14
|
+
import Tabs from "./Tabs";
|
|
13
15
|
|
|
14
16
|
// 表单字段组件映射 增加时需要同步更新 utils 中的 formFieldFilterFuncMap
|
|
15
17
|
var formFieldMap = {
|
|
@@ -33,7 +35,9 @@ var formFieldMap = {
|
|
|
33
35
|
FormItemDateRangePicker: DateRangePicker,
|
|
34
36
|
FormItemUpload: Upload,
|
|
35
37
|
FormItemTranslation: Translation,
|
|
36
|
-
FormItemIconSelect: IconSelect
|
|
38
|
+
FormItemIconSelect: IconSelect,
|
|
39
|
+
FormItemRecordListWrapper: RecordListWrapper,
|
|
40
|
+
FormItemTabs: Tabs
|
|
37
41
|
};
|
|
38
42
|
var getFieldComponent = function getFieldComponent(fieldComponent) {
|
|
39
43
|
return formFieldMap[fieldComponent];
|
|
@@ -428,15 +428,22 @@ var PisellLookupComponent = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
428
428
|
|
|
429
429
|
/**
|
|
430
430
|
* 处理扫码
|
|
431
|
+
* 标记为手动操作,避免 setKeyword 触发的重渲染时防抖 effect 仍用旧的 debouncedKeyword('') 再触发一次 onSearch('')
|
|
431
432
|
*/
|
|
432
433
|
var handleScan = useCallback(function (code) {
|
|
434
|
+
// 标记为手动操作,阻止实时搜索防抖在本次更新后误触 onSearch('')
|
|
435
|
+
isManualSelectRef.current = true;
|
|
433
436
|
// 将扫码结果填入关键词
|
|
434
437
|
setKeyword(code);
|
|
435
438
|
// 触发搜索并保存历史记录
|
|
436
439
|
handleConfirmSearch(code);
|
|
437
440
|
// 触发扫码回调
|
|
438
441
|
onScan === null || onScan === void 0 || onScan(code);
|
|
439
|
-
|
|
442
|
+
// 延迟重置标记(与 handleClear 一致,等待防抖周期结束)
|
|
443
|
+
setTimeout(function () {
|
|
444
|
+
isManualSelectRef.current = false;
|
|
445
|
+
}, debounceTime + 100);
|
|
446
|
+
}, [setKeyword, handleConfirmSearch, onScan, debounceTime]);
|
|
440
447
|
|
|
441
448
|
/**
|
|
442
449
|
* 处理选择辅助项(历史/联想词/热门搜索)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @Author: WangHan
|
|
7
7
|
* @Date: 2024-11-22 10:01
|
|
8
8
|
*/
|
|
9
|
-
export declare const minusSign: (item: any, type?: string) => "
|
|
9
|
+
export declare const minusSign: (item: any, type?: string) => "" | "-";
|
|
10
10
|
/**
|
|
11
11
|
* @title: 金额格式化
|
|
12
12
|
* @description:
|
|
@@ -17,4 +17,4 @@ export declare const minusSign: (item: any, type?: string) => "-" | "";
|
|
|
17
17
|
* @Author: WangHan
|
|
18
18
|
* @Date: 2024-11-22 10:58
|
|
19
19
|
*/
|
|
20
|
-
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) =>
|
|
20
|
+
export declare const _formatAmount: (price?: number, amountSymbol?: string, digit?: number) => any;
|
package/es/index.d.ts
CHANGED
|
@@ -166,6 +166,10 @@ export { default as FormItemTranslation } from './components/dataSourceComponent
|
|
|
166
166
|
export { default as FormItemUpload } from './components/dataSourceComponents/fields/Upload';
|
|
167
167
|
export { default as FormItemIconSelect } from './components/dataSourceComponents/fields/IconSelect';
|
|
168
168
|
export { default as BaseTranslation } from './components/dataSourceComponents/fields/Translation/BaseTranslation';
|
|
169
|
+
export { default as DataSourceSubForm } from './components/dataSourceComponents/dataSourceSubForm';
|
|
170
|
+
export type { DataSourceSubFormProps } from './components/dataSourceComponents/dataSourceSubForm/types';
|
|
171
|
+
export { default as FormItemRecordListWrapper } from './components/dataSourceComponents/fields/RecordListWrapper';
|
|
172
|
+
export { default as FormItemTabs } from './components/dataSourceComponents/fields/Tabs';
|
|
169
173
|
export { default as PisellMenu } from './components/pisellMenu';
|
|
170
174
|
export type { PisellMenuProps } from './components/pisellMenu/types';
|
|
171
175
|
export { default as PisellNavigationMenu } from './components/pisellNavigationMenu';
|
package/es/index.js
CHANGED
|
@@ -182,6 +182,9 @@ export { default as FormItemTranslation } from "./components/dataSourceComponent
|
|
|
182
182
|
export { default as FormItemUpload } from "./components/dataSourceComponents/fields/Upload";
|
|
183
183
|
export { default as FormItemIconSelect } from "./components/dataSourceComponents/fields/IconSelect";
|
|
184
184
|
export { default as BaseTranslation } from "./components/dataSourceComponents/fields/Translation/BaseTranslation";
|
|
185
|
+
export { default as DataSourceSubForm } from "./components/dataSourceComponents/dataSourceSubForm";
|
|
186
|
+
export { default as FormItemRecordListWrapper } from "./components/dataSourceComponents/fields/RecordListWrapper";
|
|
187
|
+
export { default as FormItemTabs } from "./components/dataSourceComponents/fields/Tabs";
|
|
185
188
|
|
|
186
189
|
// ==================== 导航组件 (Navigation) ====================
|
|
187
190
|
// 导航、菜单、标签页等组件
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* <Content />
|
|
14
14
|
* </PisellLayouts.ScrollView>
|
|
15
15
|
*/
|
|
16
|
-
/// <reference types="react" />
|
|
17
16
|
declare const PisellLayouts: {
|
|
18
17
|
BasicGrid: <T>(props: import("../PisellBasicGrid").PisellBasicGridProps<T>) => import("react").JSX.Element;
|
|
19
18
|
ScrollView: import("react").ForwardRefExoticComponent<Omit<import("../PisellScrollView").PisellScrollViewProps, "ref"> & import("react").RefAttributes<import("../PisellScrollView").PisellScrollViewRef>>;
|
|
@@ -44,7 +44,7 @@ export declare const withDataSource: <P extends unknown>(WrappedComponent: React
|
|
|
44
44
|
}) => React.JSX.Element;
|
|
45
45
|
export declare const withOptions: <P extends unknown>(WrappedComponent: React.ComponentType<P>) => (props: P & {
|
|
46
46
|
options?: any;
|
|
47
|
-
optionSourceType?: "default" | "
|
|
47
|
+
optionSourceType?: "default" | "custom" | "api" | undefined;
|
|
48
48
|
labelField: string;
|
|
49
49
|
valueField: string;
|
|
50
50
|
extraParams?: Record<string, any> | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataSourceSubFormProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* @title DataSourceSubForm 子表单组件
|
|
5
|
+
* @description
|
|
6
|
+
* 独立的子表单组件,专注于渲染一组表单字段。支持两种使用方式:
|
|
7
|
+
* 1. 传入 children:使用低代码引擎渲染的子组件(优先)
|
|
8
|
+
* 2. 传入 xRecordSchema:通过配置自动生成表单字段(fallback)
|
|
9
|
+
*
|
|
10
|
+
* 值结构: { field1: v1, field2: v2 }
|
|
11
|
+
*/
|
|
12
|
+
declare const DataSourceSubForm: React.FC<DataSourceSubFormProps>;
|
|
13
|
+
export default DataSourceSubForm;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/dataSourceComponents/dataSourceSubForm/index.tsx
|
|
30
|
+
var dataSourceSubForm_exports = {};
|
|
31
|
+
__export(dataSourceSubForm_exports, {
|
|
32
|
+
default: () => dataSourceSubForm_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(dataSourceSubForm_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_ahooks = require("ahooks");
|
|
38
|
+
var import_classnames = __toESM(require("classnames"));
|
|
39
|
+
var import_JsonWrapperContext = __toESM(require("../dataSourceForm/provider/jsonWrapper/JsonWrapperContext"));
|
|
40
|
+
var import_DataSourceProvider = __toESM(require("../provider/dataSource/DataSourceProvider"));
|
|
41
|
+
var import_FormSettingProvider = __toESM(require("../dataSourceForm/provider/formSetting/FormSettingProvider"));
|
|
42
|
+
var getI18nText = (value) => {
|
|
43
|
+
if (value === null || value === void 0) {
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
47
|
+
return `${value}`;
|
|
48
|
+
}
|
|
49
|
+
if (typeof value === "object") {
|
|
50
|
+
return value.original || value["zh-CN"] || value.en || value["zh-HK"] || value.ja || value.pt || "";
|
|
51
|
+
}
|
|
52
|
+
return "";
|
|
53
|
+
};
|
|
54
|
+
var normalizeRecordSchema = (xRecordSchema) => {
|
|
55
|
+
if (!xRecordSchema) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
let rawSchema = xRecordSchema;
|
|
59
|
+
if (typeof xRecordSchema === "string") {
|
|
60
|
+
try {
|
|
61
|
+
rawSchema = JSON.parse(xRecordSchema);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error("Failed to parse xRecordSchema:", error);
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (rawSchema && typeof rawSchema === "object" && !Array.isArray(rawSchema) && rawSchema.name) {
|
|
68
|
+
rawSchema = [rawSchema];
|
|
69
|
+
}
|
|
70
|
+
const normalizeSingleField = (field, fallbackName) => {
|
|
71
|
+
var _a;
|
|
72
|
+
const uiSchema = (field == null ? void 0 : field.uiSchema) || {};
|
|
73
|
+
const name = (field == null ? void 0 : field.name) || fallbackName;
|
|
74
|
+
if (!name) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const component = (uiSchema == null ? void 0 : uiSchema["x-component"]) || (field == null ? void 0 : field.interface) || (field == null ? void 0 : field.componentName) || (field == null ? void 0 : field.component) || "Input";
|
|
78
|
+
const props = {
|
|
79
|
+
...(uiSchema == null ? void 0 : uiSchema["x-component-props"]) || {},
|
|
80
|
+
...(field == null ? void 0 : field.props) || {}
|
|
81
|
+
};
|
|
82
|
+
const uiSchemaDataSourceOptions = ((_a = uiSchema == null ? void 0 : uiSchema["x-data-source"]) == null ? void 0 : _a.options) || [];
|
|
83
|
+
const rawOptions = uiSchemaDataSourceOptions.length ? uiSchemaDataSourceOptions : (uiSchema == null ? void 0 : uiSchema.enum) || (field == null ? void 0 : field.options) || (props == null ? void 0 : props.options) || [];
|
|
84
|
+
const options = rawOptions.map((option) => {
|
|
85
|
+
if (typeof option === "string" || typeof option === "number") {
|
|
86
|
+
return { label: option, value: option };
|
|
87
|
+
}
|
|
88
|
+
return { ...option, label: getI18nText(option == null ? void 0 : option.label) || (option == null ? void 0 : option.value) };
|
|
89
|
+
});
|
|
90
|
+
if (component === "Select" && (field == null ? void 0 : field.type) === "array" && !(props == null ? void 0 : props.mode)) {
|
|
91
|
+
props.mode = "multiple";
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
...field,
|
|
95
|
+
name,
|
|
96
|
+
label: getI18nText(field == null ? void 0 : field.label) || getI18nText(uiSchema == null ? void 0 : uiSchema.title) || name,
|
|
97
|
+
component,
|
|
98
|
+
componentName: component,
|
|
99
|
+
options,
|
|
100
|
+
props,
|
|
101
|
+
uiSchema
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
if (Array.isArray(rawSchema)) {
|
|
105
|
+
return rawSchema.map((item) => normalizeSingleField(item)).filter(Boolean);
|
|
106
|
+
}
|
|
107
|
+
if (Array.isArray(rawSchema == null ? void 0 : rawSchema.fields)) {
|
|
108
|
+
return rawSchema.fields.map((item) => normalizeSingleField(item)).filter(Boolean);
|
|
109
|
+
}
|
|
110
|
+
if (Array.isArray(rawSchema == null ? void 0 : rawSchema.children)) {
|
|
111
|
+
return rawSchema.children.map((item) => normalizeSingleField(item)).filter(Boolean);
|
|
112
|
+
}
|
|
113
|
+
if ((rawSchema == null ? void 0 : rawSchema.properties) && typeof rawSchema.properties === "object") {
|
|
114
|
+
return Object.keys(rawSchema.properties).map((name) => normalizeSingleField(rawSchema.properties[name], name)).filter(Boolean);
|
|
115
|
+
}
|
|
116
|
+
return [];
|
|
117
|
+
};
|
|
118
|
+
var DataSourceSubForm = (0, import_react.forwardRef)((props, ref) => {
|
|
119
|
+
const {
|
|
120
|
+
activeKey,
|
|
121
|
+
value = {},
|
|
122
|
+
onChange,
|
|
123
|
+
children,
|
|
124
|
+
xRecordSchema,
|
|
125
|
+
renderMode = "edit",
|
|
126
|
+
__designMode,
|
|
127
|
+
className,
|
|
128
|
+
style
|
|
129
|
+
} = props;
|
|
130
|
+
const [innerForm] = import_antd.Form.useForm();
|
|
131
|
+
const activeKeyRef = (0, import_react.useRef)(activeKey);
|
|
132
|
+
const safeValue = (0, import_react.useMemo)(() => {
|
|
133
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
return {};
|
|
137
|
+
}, [value]);
|
|
138
|
+
(0, import_react.useImperativeHandle)(ref, () => {
|
|
139
|
+
return {
|
|
140
|
+
getFieldsValue: () => {
|
|
141
|
+
return innerForm.getFieldsValue();
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
(0, import_react.useEffect)(() => {
|
|
146
|
+
if (activeKeyRef.current !== activeKey) {
|
|
147
|
+
activeKeyRef.current = activeKey;
|
|
148
|
+
innerForm.resetFields();
|
|
149
|
+
}
|
|
150
|
+
innerForm.setFieldsValue(safeValue);
|
|
151
|
+
}, [safeValue, innerForm, activeKey]);
|
|
152
|
+
const handleValuesChange = (0, import_ahooks.useMemoizedFn)(
|
|
153
|
+
(_, allValues) => {
|
|
154
|
+
onChange == null ? void 0 : onChange({ ...safeValue, ...allValues });
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
const fields = (0, import_react.useMemo)(
|
|
158
|
+
() => normalizeRecordSchema(xRecordSchema),
|
|
159
|
+
[xRecordSchema]
|
|
160
|
+
);
|
|
161
|
+
const hasRealChildren = (0, import_react.useMemo)(() => {
|
|
162
|
+
const childArray = import_react.default.Children.toArray(children);
|
|
163
|
+
if (childArray.length === 0) return false;
|
|
164
|
+
return childArray.some((child) => import_react.default.isValidElement(child));
|
|
165
|
+
}, [children]);
|
|
166
|
+
const mockDataSource = (0, import_react.useMemo)(() => {
|
|
167
|
+
if (!fields || fields.length === 0) return null;
|
|
168
|
+
return {
|
|
169
|
+
fields: fields.map((field) => ({
|
|
170
|
+
name: field.name,
|
|
171
|
+
uiSchema: field.uiSchema,
|
|
172
|
+
interface: field.interface
|
|
173
|
+
})),
|
|
174
|
+
name: "dataSourceSubForm",
|
|
175
|
+
tableName: "dataSourceSubForm"
|
|
176
|
+
};
|
|
177
|
+
}, [fields]);
|
|
178
|
+
const renderFormContent = () => {
|
|
179
|
+
if (!hasRealChildren && fields.length === 0) {
|
|
180
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-data-source-sub-form__empty" }, "No fields configured. Please configure xRecordSchema or add children components.");
|
|
181
|
+
}
|
|
182
|
+
const formContent = /* @__PURE__ */ import_react.default.createElement(import_JsonWrapperContext.default.Provider, { value: { path: [], level: 0 } }, /* @__PURE__ */ import_react.default.createElement(
|
|
183
|
+
import_antd.Form,
|
|
184
|
+
{
|
|
185
|
+
form: innerForm,
|
|
186
|
+
onValuesChange: handleValuesChange,
|
|
187
|
+
component: false,
|
|
188
|
+
layout: "vertical"
|
|
189
|
+
},
|
|
190
|
+
children
|
|
191
|
+
));
|
|
192
|
+
if (mockDataSource) {
|
|
193
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
194
|
+
import_FormSettingProvider.default,
|
|
195
|
+
{
|
|
196
|
+
renderMode,
|
|
197
|
+
groupInfoPosition: "top",
|
|
198
|
+
size: "large"
|
|
199
|
+
},
|
|
200
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
201
|
+
import_DataSourceProvider.default,
|
|
202
|
+
{
|
|
203
|
+
dataSource: mockDataSource,
|
|
204
|
+
__designMode
|
|
205
|
+
},
|
|
206
|
+
formContent
|
|
207
|
+
)
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
211
|
+
import_FormSettingProvider.default,
|
|
212
|
+
{
|
|
213
|
+
renderMode,
|
|
214
|
+
groupInfoPosition: "top",
|
|
215
|
+
size: "large"
|
|
216
|
+
},
|
|
217
|
+
formContent
|
|
218
|
+
);
|
|
219
|
+
};
|
|
220
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
221
|
+
"div",
|
|
222
|
+
{
|
|
223
|
+
className: (0, import_classnames.default)("pisell-data-source-sub-form", className),
|
|
224
|
+
style
|
|
225
|
+
},
|
|
226
|
+
renderFormContent()
|
|
227
|
+
);
|
|
228
|
+
});
|
|
229
|
+
var dataSourceSubForm_default = DataSourceSubForm;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title DataSourceSubForm 组件样式
|
|
3
|
+
* @description 独立的子表单组件样式定义
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// .pisell-data-source-sub-form {
|
|
7
|
+
// width: 100%;
|
|
8
|
+
|
|
9
|
+
// &__empty {
|
|
10
|
+
// color: #999;
|
|
11
|
+
// font-size: 12px;
|
|
12
|
+
// padding: 12px 0;
|
|
13
|
+
// text-align: center;
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
// &__form-wrapper {
|
|
17
|
+
// width: 100%;
|
|
18
|
+
// }
|
|
19
|
+
// }
|