@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.
- 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 +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +13 -13
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/PisellCards/index.d.ts +6 -6
- package/es/components/appVersionControl/index.js +1 -1
- package/es/components/calendar/index.d.ts +2 -2
- package/es/components/checkbox/index.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +3 -3
- package/es/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/index.js +1 -1
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +2 -2
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
- package/es/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceSubForm/index.d.ts +16 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/index.js +329 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +538 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
- package/es/components/dataSourceComponents/dataSourceSubForm/types.d.ts +121 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
- package/es/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -1
- package/es/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +1 -1
- package/es/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +3 -3
- package/es/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +1 -1
- package/es/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +1 -1
- package/es/components/dataSourceComponents/fields/Input.Phone/WithMode.js +1 -1
- package/es/components/dataSourceComponents/fields/Radio/WithMode.d.ts +2 -2
- package/es/components/dataSourceComponents/fields/Radio/WithMode.js +1 -1
- package/es/components/dataSourceComponents/fields/RecordListWrapper/README.md +247 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +39 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +84 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +17 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/index.js +9 -0
- package/es/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +91 -0
- package/es/components/dataSourceComponents/fields/Select/WithMode.js +1 -1
- package/es/components/dataSourceComponents/fields/Select/index.d.ts +3 -3
- package/es/components/dataSourceComponents/fields/Tabs/ReadPretty.js +16 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.js +75 -0
- package/es/components/dataSourceComponents/fields/Tabs/Tabs.less +55 -0
- package/es/components/dataSourceComponents/fields/Tabs/WithMode.js +13 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.d.ts +19 -0
- package/es/components/dataSourceComponents/fields/Tabs/index.js +10 -0
- package/es/components/dataSourceComponents/fields/Tabs/type.d.ts +36 -0
- package/es/components/dataSourceComponents/fields/index.js +5 -1
- package/es/components/dataSourceComponents/fields/utils.js +3 -0
- package/es/components/dataSourceComponents/hooks/useActions.js +1 -1
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +1 -1
- package/es/components/date-picker/index.d.ts +2 -2
- package/es/components/input/index.d.ts +2 -2
- package/es/components/pisell-config-provider/context.d.ts +2 -2
- package/es/components/pisellDataSourceContainer/type.d.ts +1 -1
- package/es/components/pisellDatePicker/index.d.ts +2 -2
- package/es/components/pisellInput/components/Copy/index.js +1 -1
- package/es/components/pisellModal/index.d.ts +6 -6
- package/es/components/pisellMultipleSelect/PisellMultipleSelect.less +15 -7
- package/es/components/pisellQuickFilter/index.d.ts +2 -2
- package/es/components/pisellRecordBoard/PisellRecordBoard.js +10 -3
- package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +3 -1
- package/es/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +4 -2
- package/es/components/pisellRecordBoard/types.d.ts +4 -0
- package/es/components/pisellSingleSelect/PisellSingleSelect.less +15 -0
- package/es/components/pisellWalletPassCard/index.js +1 -1
- package/es/components/radio/index.d.ts +2 -2
- package/es/components/section-footers/index.d.ts +2 -2
- package/es/components/select/index.less +18 -2
- package/es/components/skeleton/index.d.ts +2 -2
- package/es/components/table/Actions/component/ExportImport/index.js +1 -1
- package/es/components/table/Table/fields/select/Edit/index.js +1 -1
- package/es/components/table/Table/tableConfig/SortRow/index.js +1 -1
- package/es/components/table/Table/tableConfig/body/CellProvider/index.js +1 -1
- package/es/components/time-picker/index.d.ts +2 -2
- package/es/components/typography/index.d.ts +2 -2
- package/es/components/upload/index.d.ts +2 -2
- package/es/index.d.ts +5 -1
- package/es/index.js +8 -5
- package/lib/components/PisellCards/index.d.ts +6 -6
- package/lib/components/PisellFields/index.d.ts +12 -12
- package/lib/components/PisellLayouts/index.d.ts +9 -9
- package/lib/components/PisellMetrics/index.d.ts +4 -4
- package/lib/components/appVersionControl/index.js +4 -4
- package/lib/components/calendar/index.d.ts +2 -2
- package/lib/components/checkbox/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +3 -3
- package/lib/components/dataSourceComponents/dataSourceForm/formItem.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/index.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +2 -2
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
- package/lib/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.d.ts +16 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.js +332 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/index.less +19 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/schema-full-example.json +538 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/schema-simple-example.json +174 -0
- package/lib/components/dataSourceComponents/dataSourceSubForm/types.d.ts +121 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.js +1 -1
- package/lib/components/dataSourceComponents/dataSourceTable/type.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceWrapper/BaseWrapper.js +1 -1
- package/lib/components/dataSourceComponents/fields/Checkbox/WithMode.d.ts +3 -3
- package/lib/components/dataSourceComponents/fields/DateRangePicker/WithMode.js +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Mobile/WithMode.js +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Password/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.Phone/WithMode.js +1 -1
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Input.TextArea/index.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Radio/WithMode.d.ts +2 -2
- package/lib/components/dataSourceComponents/fields/Radio/WithMode.js +1 -1
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/README.md +247 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/ReadPretty.js +41 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/WithMode.js +86 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.d.ts +17 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/index.js +9 -0
- package/lib/components/dataSourceComponents/fields/RecordListWrapper/type.d.ts +91 -0
- package/lib/components/dataSourceComponents/fields/Select/WithMode.js +1 -1
- package/lib/components/dataSourceComponents/fields/Select/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Tabs/ReadPretty.js +16 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.js +78 -0
- package/lib/components/dataSourceComponents/fields/Tabs/Tabs.less +55 -0
- package/lib/components/dataSourceComponents/fields/Tabs/WithMode.js +13 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.d.ts +19 -0
- package/lib/components/dataSourceComponents/fields/Tabs/index.js +10 -0
- package/lib/components/dataSourceComponents/fields/Tabs/type.d.ts +35 -0
- package/lib/components/dataSourceComponents/fields/index.js +37 -33
- package/lib/components/dataSourceComponents/fields/utils.js +3 -0
- package/lib/components/dataSourceComponents/hooks/useActions.js +1 -1
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceProvider.js +1 -1
- package/lib/components/date-picker/index.d.ts +2 -2
- package/lib/components/input/index.d.ts +2 -2
- package/lib/components/pisell-config-provider/context.d.ts +2 -2
- package/lib/components/pisellDataSourceContainer/components/Pagination/index.d.ts +2 -2
- package/lib/components/pisellDataSourceContainer/components/Table/index.d.ts +2 -2
- package/lib/components/pisellDataSourceContainer/type.d.ts +1 -1
- package/lib/components/pisellDatePicker/index.d.ts +2 -2
- package/lib/components/pisellInput/components/Copy/index.js +1 -1
- package/lib/components/pisellMultipleSelect/PisellMultipleSelect.less +15 -7
- package/lib/components/pisellRecordBoard/PisellRecordBoard.js +10 -3
- package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +3 -1
- package/lib/components/pisellRecordBoard/shellFrame/ToolBarReset/index.js +4 -2
- package/lib/components/pisellRecordBoard/types.d.ts +4 -0
- package/lib/components/pisellSingleSelect/PisellSingleSelect.less +15 -0
- package/lib/components/pisellWalletPassCard/index.js +1 -1
- package/lib/components/radio/index.d.ts +2 -2
- package/lib/components/section-footers/index.d.ts +2 -2
- package/lib/components/select/index.less +18 -2
- package/lib/components/skeleton/index.d.ts +2 -2
- package/lib/components/table/Actions/component/ExportImport/index.js +1 -1
- package/lib/components/table/Table/fields/select/Edit/index.js +1 -1
- package/lib/components/table/Table/tableConfig/SortRow/index.js +1 -1
- package/lib/components/table/Table/tableConfig/body/CellProvider/index.js +1 -1
- package/lib/components/time-picker/index.d.ts +2 -2
- package/lib/components/upload/index.d.ts +2 -2
- package/lib/index.d.ts +5 -1
- package/lib/index.js +256 -250
- package/lowcode/data-source-form/constants.ts +3 -0
- package/lowcode/data-source-form/utils.ts +19 -5
- package/lowcode/data-source-sub-form/meta.ts +274 -0
- package/lowcode/data-source-sub-form/snippets.ts +135 -0
- package/lowcode/form-item-record-list-wrapper/meta.ts +246 -0
- package/lowcode/form-item-record-list-wrapper/snippets.ts +24 -0
- package/lowcode/form-item-tabs/meta.ts +172 -0
- package/package.json +1 -1
|
@@ -7,15 +7,15 @@ import "./components/PisellImageCard/index.js";
|
|
|
7
7
|
import { BadgeConfig, TabCardProps } from "./components/TabCard/types.js";
|
|
8
8
|
import "./components/TextCard/types.js";
|
|
9
9
|
import { MultilevelCardProps } from "./components/MultilevelCard/types.js";
|
|
10
|
-
import * as
|
|
10
|
+
import * as react38 from "react";
|
|
11
11
|
|
|
12
12
|
//#region src/components/PisellCards/index.d.ts
|
|
13
13
|
declare const PisellCards: {
|
|
14
|
-
TabCard: (props: any) =>
|
|
15
|
-
TextCard: (props: any) =>
|
|
16
|
-
GraphicTextCard: (props: GraphicTextCardProps) =>
|
|
17
|
-
MultilevelCard: (props: any) =>
|
|
18
|
-
PisellImageCard: (props: PisellImageCardProps) =>
|
|
14
|
+
TabCard: (props: any) => react38.JSX.Element;
|
|
15
|
+
TextCard: (props: any) => react38.JSX.Element;
|
|
16
|
+
GraphicTextCard: (props: GraphicTextCardProps) => react38.JSX.Element;
|
|
17
|
+
MultilevelCard: (props: any) => react38.JSX.Element;
|
|
18
|
+
PisellImageCard: (props: PisellImageCardProps) => react38.JSX.Element;
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
21
|
export { PisellCards };
|
|
@@ -4,8 +4,8 @@ import pisellModal_default from "../pisellModal/index.js";
|
|
|
4
4
|
import button_default from "../button/index.js";
|
|
5
5
|
import icon_default from "../icon/index.js";
|
|
6
6
|
import { _asyncToGenerator } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js";
|
|
7
|
-
import pisellAvatar_default from "../pisellAvatar/index.js";
|
|
8
7
|
import pisellToast_default from "../pisellToast/index.js";
|
|
8
|
+
import pisellAvatar_default from "../pisellAvatar/index.js";
|
|
9
9
|
import versionSelect_default from "../versionSelect/index.js";
|
|
10
10
|
import versionModal_default from "../versionModal/index.js";
|
|
11
11
|
import { getMaxVersion } from "./utils.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as react24 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/calendar/index.d.ts
|
|
5
|
-
declare const Calendar: (props: any) =>
|
|
5
|
+
declare const Calendar: (props: any) => react24.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Calendar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as react25 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/checkbox/index.d.ts
|
|
5
|
-
declare const Checkbox: (props: any) =>
|
|
5
|
+
declare const Checkbox: (props: any) => react25.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Checkbox };
|
|
@@ -3,13 +3,13 @@ import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtim
|
|
|
3
3
|
import useEngineContext_default from "../../../hooks/useEngineContext.js";
|
|
4
4
|
import pisellModal_default from "../../pisellModal/index.js";
|
|
5
5
|
import { _asyncToGenerator } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js";
|
|
6
|
-
import form_default from "../../form/index.js";
|
|
7
|
-
import useDataSource_default from "../hooks/useDataSource.js";
|
|
8
6
|
import { getFormSettingMetaData } from "./serve.js";
|
|
7
|
+
import useDataSource_default from "../hooks/useDataSource.js";
|
|
8
|
+
import FormSettingProvider_default from "./provider/formSetting/FormSettingProvider.js";
|
|
9
|
+
import form_default from "../../form/index.js";
|
|
9
10
|
import { transformFormObjToArrayWithUntouched } from "./utils.js";
|
|
10
11
|
import page_header_default from "../../page-header/index.js";
|
|
11
12
|
import useCtxActions_default from "../hooks/useCtxActions.js";
|
|
12
|
-
import FormSettingProvider_default from "./provider/formSetting/FormSettingProvider.js";
|
|
13
13
|
import useFormSettingParams_default from "../hooks/useFormSettingParams.js";
|
|
14
14
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
15
15
|
import { isArr } from "@pisell/utils";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
|
|
2
2
|
import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectWithoutProperties.js";
|
|
3
|
-
import form_default from "../../form/index.js";
|
|
4
3
|
import useDataSource_default from "../hooks/useDataSource.js";
|
|
4
|
+
import form_default from "../../form/index.js";
|
|
5
5
|
import useFormSetting_default from "./provider/hooks/useFormSetting.js";
|
|
6
6
|
import useJsonPrefixPath_default from "./provider/hooks/useJsonPrefixPath.js";
|
|
7
7
|
import { toArr } from "./utils.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
|
|
2
|
-
import form_default from "../../form/index.js";
|
|
3
2
|
import DataSourceProvider_default from "../provider/dataSource/DataSourceProvider.js";
|
|
3
|
+
import form_default from "../../form/index.js";
|
|
4
4
|
import BaseForm_default from "./BaseForm.js";
|
|
5
5
|
import React, { forwardRef } from "react";
|
|
6
6
|
import "./index.less";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import pisellModal_default from "../../../pisellModal/index.js";
|
|
2
2
|
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/asyncToGenerator.js";
|
|
3
|
-
import useDataSource_default from "../../hooks/useDataSource.js";
|
|
4
|
-
import useFormSetting_default from "../provider/hooks/useFormSetting.js";
|
|
5
3
|
import pisellToast_default from "../../../pisellToast/index.js";
|
|
6
4
|
import { updateTenantSetting } from "../serve.js";
|
|
5
|
+
import useDataSource_default from "../../hooks/useDataSource.js";
|
|
6
|
+
import useFormSetting_default from "../provider/hooks/useFormSetting.js";
|
|
7
7
|
import { filterSystemFields, setFormFieldsUntouched } from "../utils.js";
|
|
8
8
|
import useCtxActions_default from "../../hooks/useCtxActions.js";
|
|
9
9
|
import useFormSettingParams_default from "../../hooks/useFormSettingParams.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getText } from "../../../locales/index.js";
|
|
2
2
|
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
|
|
3
3
|
import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectWithoutProperties.js";
|
|
4
|
-
import
|
|
4
|
+
import useVariables_default from "../hooks/useVariables.js";
|
|
5
5
|
import useDataSource_default from "../hooks/useDataSource.js";
|
|
6
|
+
import DataSourceProvider_default from "../provider/dataSource/DataSourceProvider.js";
|
|
7
|
+
import form_default from "../../form/index.js";
|
|
6
8
|
import useFormSetting_default from "./provider/hooks/useFormSetting.js";
|
|
7
9
|
import useJsonPrefixPath_default from "./provider/hooks/useJsonPrefixPath.js";
|
|
8
|
-
import useVariables_default from "../hooks/useVariables.js";
|
|
9
|
-
import DataSourceProvider_default from "../provider/dataSource/DataSourceProvider.js";
|
|
10
10
|
import useTranslationOriginal_default from "../../../hooks/useTranslationOriginal.js";
|
|
11
11
|
import React, { useEffect, useMemo } from "react";
|
|
12
12
|
import { isArr, isFunction, isNumber, isString } from "@pisell/utils";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import * as
|
|
2
|
+
import * as react45 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/dataSourceComponents/dataSourceShow/dataSourceQRCode/index.d.ts
|
|
5
|
-
declare const DataSourceQRCode: (props: any) =>
|
|
5
|
+
declare const DataSourceQRCode: (props: any) => react45.JSX.Element;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { DataSourceQRCode };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DataSourceSubFormProps } from "./types.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/dataSourceComponents/dataSourceSubForm/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* @title DataSourceSubForm 子表单组件
|
|
7
|
+
* @description
|
|
8
|
+
* 独立的子表单组件,专注于渲染一组表单字段。支持两种使用方式:
|
|
9
|
+
* 1. 传入 children:使用低代码引擎渲染的子组件(优先)
|
|
10
|
+
* 2. 传入 xRecordSchema:通过配置自动生成表单字段(fallback)
|
|
11
|
+
*
|
|
12
|
+
* 值结构: { field1: v1, field2: v2 }
|
|
13
|
+
*/
|
|
14
|
+
declare const DataSourceSubForm: React.FC<DataSourceSubFormProps>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { DataSourceSubForm };
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/objectSpread2.js";
|
|
2
|
+
import JsonWrapperContext_default from "../dataSourceForm/provider/jsonWrapper/JsonWrapperContext.js";
|
|
3
|
+
import DataSourceProvider_default from "../provider/dataSource/DataSourceProvider.js";
|
|
4
|
+
import FormSettingProvider_default from "../dataSourceForm/provider/formSetting/FormSettingProvider.js";
|
|
5
|
+
import React, { useEffect, useMemo } from "react";
|
|
6
|
+
import { Button, Checkbox, ColorPicker, DatePicker, Form, Input, InputNumber, Radio, Select, Switch, TimePicker, Upload } from "antd";
|
|
7
|
+
import classNames from "classnames";
|
|
8
|
+
import { useMemoizedFn } from "ahooks";
|
|
9
|
+
|
|
10
|
+
//#region src/components/dataSourceComponents/dataSourceSubForm/index.tsx
|
|
11
|
+
const { TextArea, Password } = Input;
|
|
12
|
+
/**
|
|
13
|
+
* @title 提取多语言文本
|
|
14
|
+
* @description 兼容字符串、数字、多语言对象格式,返回可显示文本
|
|
15
|
+
*/
|
|
16
|
+
const getI18nText = (value) => {
|
|
17
|
+
if (value === null || value === void 0) return "";
|
|
18
|
+
if (typeof value === "string" || typeof value === "number") return `${value}`;
|
|
19
|
+
if (typeof value === "object") return value.original || value["zh-CN"] || value.en || value["zh-HK"] || value.ja || value.pt || "";
|
|
20
|
+
return "";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @title 解析并规范化 xRecordSchema
|
|
24
|
+
* @description 兼容字符串、数组、properties 和 fields 结构,统一成字段数组供渲染使用
|
|
25
|
+
*/
|
|
26
|
+
const normalizeRecordSchema = (xRecordSchema) => {
|
|
27
|
+
if (!xRecordSchema) return [];
|
|
28
|
+
let rawSchema = xRecordSchema;
|
|
29
|
+
if (typeof xRecordSchema === "string") try {
|
|
30
|
+
rawSchema = JSON.parse(xRecordSchema);
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error("Failed to parse xRecordSchema:", error);
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
if (rawSchema && typeof rawSchema === "object" && !Array.isArray(rawSchema) && rawSchema.name) rawSchema = [rawSchema];
|
|
36
|
+
/**
|
|
37
|
+
* @title 规范化单个字段
|
|
38
|
+
* @description 将各种格式的字段配置统一转换为标准格式
|
|
39
|
+
*/
|
|
40
|
+
const normalizeSingleField = (field, fallbackName) => {
|
|
41
|
+
var _uiSchema$xDataSour;
|
|
42
|
+
const uiSchema = (field === null || field === void 0 ? void 0 : field.uiSchema) || {};
|
|
43
|
+
const name = (field === null || field === void 0 ? void 0 : field.name) || fallbackName;
|
|
44
|
+
if (!name) return null;
|
|
45
|
+
const component = (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["x-component"]) || (field === null || field === void 0 ? void 0 : field.interface) || (field === null || field === void 0 ? void 0 : field.componentName) || (field === null || field === void 0 ? void 0 : field.component) || "Input";
|
|
46
|
+
const props = _objectSpread2(_objectSpread2({}, (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema["x-component-props"]) || {}), (field === null || field === void 0 ? void 0 : field.props) || {});
|
|
47
|
+
const uiSchemaDataSourceOptions = (uiSchema === null || uiSchema === void 0 || (_uiSchema$xDataSour = uiSchema["x-data-source"]) === null || _uiSchema$xDataSour === void 0 ? void 0 : _uiSchema$xDataSour.options) || [];
|
|
48
|
+
const options = (uiSchemaDataSourceOptions.length ? uiSchemaDataSourceOptions : (uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema.enum) || (field === null || field === void 0 ? void 0 : field.options) || (props === null || props === void 0 ? void 0 : props.options) || []).map((option) => {
|
|
49
|
+
if (typeof option === "string" || typeof option === "number") return {
|
|
50
|
+
label: option,
|
|
51
|
+
value: option
|
|
52
|
+
};
|
|
53
|
+
return _objectSpread2(_objectSpread2({}, option), {}, { label: getI18nText(option === null || option === void 0 ? void 0 : option.label) || (option === null || option === void 0 ? void 0 : option.value) });
|
|
54
|
+
});
|
|
55
|
+
if (component === "Select" && (field === null || field === void 0 ? void 0 : field.type) === "array" && !(props === null || props === void 0 ? void 0 : props.mode)) props.mode = "multiple";
|
|
56
|
+
return _objectSpread2(_objectSpread2({}, field), {}, {
|
|
57
|
+
name,
|
|
58
|
+
label: getI18nText(field === null || field === void 0 ? void 0 : field.label) || getI18nText(uiSchema === null || uiSchema === void 0 ? void 0 : uiSchema.title) || name,
|
|
59
|
+
component,
|
|
60
|
+
componentName: component,
|
|
61
|
+
options,
|
|
62
|
+
props,
|
|
63
|
+
uiSchema
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
if (Array.isArray(rawSchema)) return rawSchema.map((item) => normalizeSingleField(item)).filter(Boolean);
|
|
67
|
+
if (Array.isArray(rawSchema === null || rawSchema === void 0 ? void 0 : rawSchema.fields)) return rawSchema.fields.map((item) => normalizeSingleField(item)).filter(Boolean);
|
|
68
|
+
if (Array.isArray(rawSchema === null || rawSchema === void 0 ? void 0 : rawSchema.children)) return rawSchema.children.map((item) => normalizeSingleField(item)).filter(Boolean);
|
|
69
|
+
if ((rawSchema === null || rawSchema === void 0 ? void 0 : rawSchema.properties) && typeof rawSchema.properties === "object") return Object.keys(rawSchema.properties).map((name) => normalizeSingleField(rawSchema.properties[name], name)).filter(Boolean);
|
|
70
|
+
return [];
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* @title 渲染单个表单字段(Form.Item + Antd 控件)
|
|
74
|
+
* @description
|
|
75
|
+
* 根据字段的 componentName/component 映射到对应的 Antd 组件,并包裹在 Form.Item 中。
|
|
76
|
+
* Form.Item 的 name 绑定让 antd Form 自动管理该字段的值收集与回填。
|
|
77
|
+
*
|
|
78
|
+
* 支持的组件类型:
|
|
79
|
+
* - 文本类:Input / Input.TextArea / Input.Password / Input.Email / Input.Phone / Input.Mobile / Input.URL / Input.Subdomain
|
|
80
|
+
* - 数字类:InputNumber / Percent
|
|
81
|
+
* - 时间类:DatePicker / TimePicker
|
|
82
|
+
* - 颜色:ColorPicker
|
|
83
|
+
* - 选择类:Select / Radio.Group / Checkbox.Group / Checkbox
|
|
84
|
+
* - 开关:Switch
|
|
85
|
+
* - 上传:Upload
|
|
86
|
+
* - JSON:Input.JSON / Input.InputJSON
|
|
87
|
+
* - 复杂组件(降级):Translation / IconPicker / RecordListWrapper
|
|
88
|
+
*/
|
|
89
|
+
const renderFormItem = (field, isDisabled) => {
|
|
90
|
+
const componentType = `${field.componentName || field.component || "Input"}`;
|
|
91
|
+
const fieldOptions = field.options || [];
|
|
92
|
+
const fieldProps = _objectSpread2({}, field.props || {});
|
|
93
|
+
const label = field.label || field.name;
|
|
94
|
+
const name = field.name;
|
|
95
|
+
if (componentType === "Input.TextArea") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
96
|
+
key: name,
|
|
97
|
+
name,
|
|
98
|
+
label
|
|
99
|
+
}, /* @__PURE__ */ React.createElement(TextArea, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled })));
|
|
100
|
+
if (componentType === "Input.Password" || componentType === "Password") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
101
|
+
key: name,
|
|
102
|
+
name,
|
|
103
|
+
label
|
|
104
|
+
}, /* @__PURE__ */ React.createElement(Password, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled })));
|
|
105
|
+
if ([
|
|
106
|
+
"Input.Email",
|
|
107
|
+
"Input.Phone",
|
|
108
|
+
"Input.Mobile",
|
|
109
|
+
"Input.URL",
|
|
110
|
+
"Input.Subdomain"
|
|
111
|
+
].includes(componentType)) return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
112
|
+
key: name,
|
|
113
|
+
name,
|
|
114
|
+
label
|
|
115
|
+
}, /* @__PURE__ */ React.createElement(Input, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled })));
|
|
116
|
+
if (componentType === "InputNumber" || componentType === "Percent") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
117
|
+
key: name,
|
|
118
|
+
name,
|
|
119
|
+
label
|
|
120
|
+
}, /* @__PURE__ */ React.createElement(InputNumber, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
121
|
+
disabled: isDisabled,
|
|
122
|
+
style: _objectSpread2({ width: "100%" }, fieldProps.style || {})
|
|
123
|
+
})));
|
|
124
|
+
if (componentType === "DatePicker") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
125
|
+
key: name,
|
|
126
|
+
name,
|
|
127
|
+
label
|
|
128
|
+
}, /* @__PURE__ */ React.createElement(DatePicker, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
129
|
+
disabled: isDisabled,
|
|
130
|
+
style: _objectSpread2({ width: "100%" }, fieldProps.style || {})
|
|
131
|
+
})));
|
|
132
|
+
if (componentType === "TimePicker") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
133
|
+
key: name,
|
|
134
|
+
name,
|
|
135
|
+
label
|
|
136
|
+
}, /* @__PURE__ */ React.createElement(TimePicker, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
137
|
+
disabled: isDisabled,
|
|
138
|
+
style: _objectSpread2({ width: "100%" }, fieldProps.style || {})
|
|
139
|
+
})));
|
|
140
|
+
if (componentType === "ColorPicker") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
141
|
+
key: name,
|
|
142
|
+
name,
|
|
143
|
+
label,
|
|
144
|
+
getValueFromEvent: (color) => {
|
|
145
|
+
var _color$toHexString, _color$toHexString2;
|
|
146
|
+
return (_color$toHexString = color === null || color === void 0 || (_color$toHexString2 = color.toHexString) === null || _color$toHexString2 === void 0 ? void 0 : _color$toHexString2.call(color)) !== null && _color$toHexString !== void 0 ? _color$toHexString : color;
|
|
147
|
+
}
|
|
148
|
+
}, /* @__PURE__ */ React.createElement(ColorPicker, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled })));
|
|
149
|
+
if (["Select", "RecordListWrapper"].includes(componentType)) return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
150
|
+
key: name,
|
|
151
|
+
name,
|
|
152
|
+
label
|
|
153
|
+
}, /* @__PURE__ */ React.createElement(Select, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
154
|
+
disabled: isDisabled,
|
|
155
|
+
options: fieldOptions,
|
|
156
|
+
style: _objectSpread2({ width: "100%" }, fieldProps.style || {})
|
|
157
|
+
})));
|
|
158
|
+
if (componentType === "Radio.Group") {
|
|
159
|
+
const radioOptions = fieldOptions.map((o) => {
|
|
160
|
+
var _o$label;
|
|
161
|
+
return _objectSpread2(_objectSpread2({}, o), {}, { label: (_o$label = o.label) !== null && _o$label !== void 0 ? _o$label : String(o.value) });
|
|
162
|
+
});
|
|
163
|
+
return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
164
|
+
key: name,
|
|
165
|
+
name,
|
|
166
|
+
label
|
|
167
|
+
}, /* @__PURE__ */ React.createElement(Radio.Group, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
168
|
+
disabled: isDisabled,
|
|
169
|
+
options: radioOptions
|
|
170
|
+
})));
|
|
171
|
+
}
|
|
172
|
+
if (componentType === "Checkbox.Group") {
|
|
173
|
+
const checkboxOptions = fieldOptions.map((o) => {
|
|
174
|
+
var _o$label2;
|
|
175
|
+
return _objectSpread2(_objectSpread2({}, o), {}, { label: (_o$label2 = o.label) !== null && _o$label2 !== void 0 ? _o$label2 : String(o.value) });
|
|
176
|
+
});
|
|
177
|
+
return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
178
|
+
key: name,
|
|
179
|
+
name,
|
|
180
|
+
label
|
|
181
|
+
}, /* @__PURE__ */ React.createElement(Checkbox.Group, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
182
|
+
disabled: isDisabled,
|
|
183
|
+
options: checkboxOptions
|
|
184
|
+
})));
|
|
185
|
+
}
|
|
186
|
+
if (componentType === "Checkbox") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
187
|
+
key: name,
|
|
188
|
+
name,
|
|
189
|
+
label,
|
|
190
|
+
valuePropName: "checked"
|
|
191
|
+
}, /* @__PURE__ */ React.createElement(Checkbox, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled }), label));
|
|
192
|
+
if (componentType === "Switch") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
193
|
+
key: name,
|
|
194
|
+
name,
|
|
195
|
+
label,
|
|
196
|
+
valuePropName: "checked"
|
|
197
|
+
}, /* @__PURE__ */ React.createElement(Switch, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled })));
|
|
198
|
+
if (componentType === "Upload") return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
199
|
+
key: name,
|
|
200
|
+
name,
|
|
201
|
+
label,
|
|
202
|
+
valuePropName: "fileList",
|
|
203
|
+
getValueFromEvent: (e) => Array.isArray(e) ? e : e === null || e === void 0 ? void 0 : e.fileList
|
|
204
|
+
}, /* @__PURE__ */ React.createElement(Upload, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled }), /* @__PURE__ */ React.createElement(Button, { disabled: isDisabled }, "上传文件")));
|
|
205
|
+
if (["Input.JSON", "Input.InputJSON"].includes(componentType)) return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
206
|
+
key: name,
|
|
207
|
+
name,
|
|
208
|
+
label,
|
|
209
|
+
getValueProps: (v) => ({ value: v !== void 0 && typeof v === "object" ? JSON.stringify(v, null, 2) : v !== null && v !== void 0 ? v : "" }),
|
|
210
|
+
getValueFromEvent: (e) => {
|
|
211
|
+
try {
|
|
212
|
+
return JSON.parse(e.target.value);
|
|
213
|
+
} catch (_unused) {
|
|
214
|
+
return e.target.value;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, /* @__PURE__ */ React.createElement(TextArea, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
218
|
+
disabled: isDisabled,
|
|
219
|
+
rows: fieldProps.rows || 6
|
|
220
|
+
})));
|
|
221
|
+
if (["Translation", "IconPicker"].includes(componentType)) return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
222
|
+
key: name,
|
|
223
|
+
name,
|
|
224
|
+
label
|
|
225
|
+
}, /* @__PURE__ */ React.createElement(Input, _objectSpread2(_objectSpread2({}, fieldProps), {}, {
|
|
226
|
+
disabled: isDisabled,
|
|
227
|
+
placeholder: fieldProps.placeholder || `${componentType}(请在低代码平台配置后使用)`
|
|
228
|
+
})));
|
|
229
|
+
return /* @__PURE__ */ React.createElement(Form.Item, {
|
|
230
|
+
key: name,
|
|
231
|
+
name,
|
|
232
|
+
label
|
|
233
|
+
}, /* @__PURE__ */ React.createElement(Input, _objectSpread2(_objectSpread2({}, fieldProps), {}, { disabled: isDisabled })));
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* @title DataSourceSubForm 子表单组件
|
|
237
|
+
* @description
|
|
238
|
+
* 独立的子表单组件,专注于渲染一组表单字段。支持两种使用方式:
|
|
239
|
+
* 1. 传入 children:使用低代码引擎渲染的子组件(优先)
|
|
240
|
+
* 2. 传入 xRecordSchema:通过配置自动生成表单字段(fallback)
|
|
241
|
+
*
|
|
242
|
+
* 值结构: { field1: v1, field2: v2 }
|
|
243
|
+
*/
|
|
244
|
+
const DataSourceSubForm = (props) => {
|
|
245
|
+
const { value = {}, onChange, children, xRecordSchema, renderMode = "edit", __designMode, className, style } = props;
|
|
246
|
+
const [innerForm] = Form.useForm();
|
|
247
|
+
/** renderMode 为 disabled 时所有控件禁用 */
|
|
248
|
+
const isDisabled = renderMode === "disabled";
|
|
249
|
+
/** 确保 value 是对象 */
|
|
250
|
+
const safeValue = useMemo(() => {
|
|
251
|
+
if (value && typeof value === "object" && !Array.isArray(value)) return value;
|
|
252
|
+
return {};
|
|
253
|
+
}, [value]);
|
|
254
|
+
/** 当外部 value 变化时,同步到内部 Form */
|
|
255
|
+
useEffect(() => {
|
|
256
|
+
innerForm.setFieldsValue(safeValue);
|
|
257
|
+
}, [safeValue, innerForm]);
|
|
258
|
+
/** 内部 Form 值变化 -> 通知外部 */
|
|
259
|
+
const handleValuesChange = useMemoizedFn((_, allValues) => {
|
|
260
|
+
onChange === null || onChange === void 0 || onChange(_objectSpread2(_objectSpread2({}, safeValue), allValues));
|
|
261
|
+
});
|
|
262
|
+
/** 解析 xRecordSchema 为字段数组 */
|
|
263
|
+
const fields = useMemo(() => normalizeRecordSchema(xRecordSchema), [xRecordSchema]);
|
|
264
|
+
/**
|
|
265
|
+
* @title 判断是否有有效的低代码子组件
|
|
266
|
+
* @description 排除引擎注入的空容器占位符
|
|
267
|
+
*/
|
|
268
|
+
const hasRealChildren = useMemo(() => {
|
|
269
|
+
const childArray = React.Children.toArray(children);
|
|
270
|
+
if (childArray.length === 0) return false;
|
|
271
|
+
return childArray.some((child) => React.isValidElement(child));
|
|
272
|
+
}, [children]);
|
|
273
|
+
/**
|
|
274
|
+
* @title 创建模拟数据源
|
|
275
|
+
* @description 供 DataSourceProvider 消费,使子组件(如 Select)可访问字段元信息
|
|
276
|
+
*/
|
|
277
|
+
const mockDataSource = useMemo(() => {
|
|
278
|
+
if (!fields || fields.length === 0) return null;
|
|
279
|
+
return {
|
|
280
|
+
fields: fields.map((field) => ({
|
|
281
|
+
name: field.name,
|
|
282
|
+
uiSchema: field.uiSchema,
|
|
283
|
+
interface: field.interface
|
|
284
|
+
})),
|
|
285
|
+
name: "dataSourceSubForm",
|
|
286
|
+
tableName: "dataSourceSubForm"
|
|
287
|
+
};
|
|
288
|
+
}, [fields]);
|
|
289
|
+
/**
|
|
290
|
+
* @title 渲染表单核心内容
|
|
291
|
+
* @description
|
|
292
|
+
* - 有 children:渲染低代码引擎注入的子组件
|
|
293
|
+
* - 无 children 但有 fields:用 renderFormItem 逐字段渲染 Antd 控件
|
|
294
|
+
* - 两者均无:显示空状态提示
|
|
295
|
+
*/
|
|
296
|
+
const renderFormContent = () => {
|
|
297
|
+
if (!hasRealChildren && fields.length === 0) return /* @__PURE__ */ React.createElement("div", { className: "pisell-data-source-sub-form__empty" }, "No fields configured. Please configure xRecordSchema or add children components.");
|
|
298
|
+
const formContent = /* @__PURE__ */ React.createElement(JsonWrapperContext_default.Provider, { value: {
|
|
299
|
+
path: [],
|
|
300
|
+
level: 0
|
|
301
|
+
} }, /* @__PURE__ */ React.createElement(Form, {
|
|
302
|
+
form: innerForm,
|
|
303
|
+
onValuesChange: handleValuesChange,
|
|
304
|
+
component: false,
|
|
305
|
+
layout: "vertical"
|
|
306
|
+
}, hasRealChildren ? children : fields.map((field) => renderFormItem(field, isDisabled))));
|
|
307
|
+
if (mockDataSource) return /* @__PURE__ */ React.createElement(FormSettingProvider_default, {
|
|
308
|
+
renderMode,
|
|
309
|
+
groupInfoPosition: "top",
|
|
310
|
+
size: "large"
|
|
311
|
+
}, /* @__PURE__ */ React.createElement(DataSourceProvider_default, {
|
|
312
|
+
dataSource: mockDataSource,
|
|
313
|
+
__designMode
|
|
314
|
+
}, formContent));
|
|
315
|
+
return /* @__PURE__ */ React.createElement(FormSettingProvider_default, {
|
|
316
|
+
renderMode,
|
|
317
|
+
groupInfoPosition: "top",
|
|
318
|
+
size: "large"
|
|
319
|
+
}, formContent);
|
|
320
|
+
};
|
|
321
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
322
|
+
className: classNames("pisell-data-source-sub-form", className),
|
|
323
|
+
style
|
|
324
|
+
}, renderFormContent());
|
|
325
|
+
};
|
|
326
|
+
var dataSourceSubForm_default = DataSourceSubForm;
|
|
327
|
+
|
|
328
|
+
//#endregion
|
|
329
|
+
export { dataSourceSubForm_default as default };
|
|
@@ -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
|
+
// }
|