@pisell/materials 3.3.67 → 3.3.69
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 +5 -5
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.js +16 -16
- package/build/lowcode/view.js +16 -16
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +68 -10
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +5 -3
- package/es/components/dataSourceComponents/dataSourceForm/serve.d.ts +30 -0
- package/es/components/dataSourceComponents/dataSourceForm/serve.js +93 -0
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +66 -28
- package/es/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -0
- package/es/components/dataSourceComponents/dataSourceForm/urlUtils.d.ts +24 -0
- package/es/components/dataSourceComponents/dataSourceForm/urlUtils.js +76 -0
- package/es/components/dataSourceComponents/dataSourceForm/utils.js +3 -4
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- package/es/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.d.ts +5 -0
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.js +16 -0
- package/es/components/dataSourceComponents/fields/Switch/ReadPretty.less +2 -0
- package/es/components/dataSourceComponents/fields/Switch/WithMode.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Switch/WithMode.js +5 -0
- package/es/components/dataSourceComponents/fields/Switch/index.d.ts +3 -0
- package/es/components/dataSourceComponents/fields/Switch/index.js +8 -0
- package/es/components/dataSourceComponents/fields/Switch/type.d.ts +16 -0
- package/es/components/dataSourceComponents/fields/Switch/type.js +1 -0
- package/es/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +11 -11
- package/es/components/dataSourceComponents/hooks/useActions.js +20 -14
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/table/Table/fields/index.d.ts +2 -2
- package/es/components/table/Table/index.js +7 -3
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/table/hooks/useTransColumns.d.ts +1 -1
- package/es/components/table/hooks/useTransColumns.js +1 -1
- package/es/components/table/index.js +3 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +37 -3
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingContext.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/provider/formSetting/FormSettingProvider.js +5 -3
- package/lib/components/dataSourceComponents/dataSourceForm/serve.d.ts +30 -0
- package/lib/components/dataSourceComponents/dataSourceForm/serve.js +45 -2
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +23 -2
- package/lib/components/dataSourceComponents/dataSourceForm/type.d.ts +1 -0
- package/lib/components/dataSourceComponents/dataSourceForm/urlUtils.d.ts +24 -0
- package/lib/components/dataSourceComponents/dataSourceForm/urlUtils.js +68 -0
- package/lib/components/dataSourceComponents/dataSourceForm/utils.js +3 -3
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +3 -3
- package/lib/components/dataSourceComponents/fields/Input.Subdomain/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.d.ts +5 -0
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.js +52 -0
- package/lib/components/dataSourceComponents/fields/Switch/ReadPretty.less +2 -0
- package/lib/components/dataSourceComponents/fields/Switch/WithMode.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Switch/WithMode.js +39 -0
- package/lib/components/dataSourceComponents/fields/Switch/index.d.ts +3 -0
- package/lib/components/dataSourceComponents/fields/Switch/index.js +42 -0
- package/lib/components/dataSourceComponents/fields/Switch/type.d.ts +16 -0
- package/lib/components/dataSourceComponents/fields/Switch/type.js +17 -0
- package/lib/components/dataSourceComponents/fields/Upload/utils.d.ts +1 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +11 -11
- package/lib/components/dataSourceComponents/hooks/useActions.js +3 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/table/Table/fields/index.d.ts +2 -2
- package/lib/components/table/Table/index.js +8 -4
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/table/hooks/useTransColumns.d.ts +1 -1
- package/lib/components/table/hooks/useTransColumns.js +1 -1
- package/lib/components/table/index.js +3 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/utils/platform.d.ts +1 -1
- package/lowcode/data-source-form/constants.ts +3 -0
- package/lowcode/data-source-form/meta.ts +90 -31
- package/lowcode/data-source-form/utils.ts +132 -19
- package/lowcode/form-item-switch/meta.ts +145 -0
- package/lowcode/form-item-switch/snippets.ts +15 -0
- package/package.json +1 -1
|
@@ -41,7 +41,9 @@ var import_useFormSetting = __toESM(require("../provider/hooks/useFormSetting"))
|
|
|
41
41
|
var import_useCtxActions = __toESM(require("../../hooks/useCtxActions"));
|
|
42
42
|
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
43
43
|
var import_utils = require("../utils");
|
|
44
|
+
var import_urlUtils = require("../urlUtils");
|
|
44
45
|
var import_index = require("./index.less");
|
|
46
|
+
var import_serve = require("../serve");
|
|
45
47
|
var SubmitButton = (props) => {
|
|
46
48
|
const {
|
|
47
49
|
children,
|
|
@@ -58,13 +60,25 @@ var SubmitButton = (props) => {
|
|
|
58
60
|
const [loading, setLoading] = (0, import_react.useState)(false);
|
|
59
61
|
const [api, contextHolder] = import_antd.notification.useNotification();
|
|
60
62
|
const form = import_antd.Form.useFormInstance();
|
|
61
|
-
const { renderMode, onDataSourceFinish, formatSubmitValues, customSubmit } = (0, import_useFormSetting.default)();
|
|
63
|
+
const { renderMode, onDataSourceFinish, formatSubmitValues, customSubmit, beforeSubmit } = (0, import_useFormSetting.default)();
|
|
62
64
|
const { setVisible, refreshTableData } = (0, import_useCtxActions.default)();
|
|
63
|
-
const { create, update } = (0, import_useDataSource.default)();
|
|
65
|
+
const { create, update, dataSource } = (0, import_useDataSource.default)();
|
|
64
66
|
const isDisabled = status === "disabled";
|
|
65
67
|
const onSubmit = async (values) => {
|
|
66
68
|
setLoading(true);
|
|
67
69
|
try {
|
|
70
|
+
if (dataSource == null ? void 0 : dataSource.fromSettingMeta) {
|
|
71
|
+
const urlParams = (0, import_urlUtils.getFormSettingParams)();
|
|
72
|
+
const business_code = urlParams.businessCode;
|
|
73
|
+
const channel_code = urlParams.channelCode;
|
|
74
|
+
const board_code = urlParams.isBoard && business_code && channel_code ? `${business_code}+${channel_code}` : void 0;
|
|
75
|
+
return await (0, import_serve.updateTenantSetting)({
|
|
76
|
+
business_code,
|
|
77
|
+
channel_code,
|
|
78
|
+
board_code,
|
|
79
|
+
data: values
|
|
80
|
+
});
|
|
81
|
+
}
|
|
68
82
|
if (customSubmit) {
|
|
69
83
|
return await customSubmit(values);
|
|
70
84
|
}
|
|
@@ -118,6 +132,12 @@ var SubmitButton = (props) => {
|
|
|
118
132
|
}
|
|
119
133
|
const filteredValues = (0, import_utils.filterSystemFields)(allValues);
|
|
120
134
|
const formattedValues = formatSubmitValues ? formatSubmitValues(filteredValues) : filteredValues;
|
|
135
|
+
if (beforeSubmit) {
|
|
136
|
+
const canSubmit = await beforeSubmit(formattedValues);
|
|
137
|
+
if (!canSubmit) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
121
141
|
const result = await onSubmit(formattedValues);
|
|
122
142
|
if (onDataSourceFinish) {
|
|
123
143
|
onDataSourceFinish(formattedValues, result, form);
|
|
@@ -138,6 +158,7 @@ var SubmitButton = (props) => {
|
|
|
138
158
|
}
|
|
139
159
|
(0, import_utils.setFormFieldsUntouched)(form);
|
|
140
160
|
} catch (error) {
|
|
161
|
+
debugger;
|
|
141
162
|
(0, import_pisellToast.default)({
|
|
142
163
|
content: `${error.message}`
|
|
143
164
|
});
|
|
@@ -20,6 +20,7 @@ export interface DataSourceFormProps {
|
|
|
20
20
|
formatSubmitValues?: (values: Record<string, any>) => Record<string, any>;
|
|
21
21
|
formatInitialValues?: (values: Record<string, any>) => Record<string, any>;
|
|
22
22
|
customSubmit?: (values: Record<string, any>) => Promise<any>;
|
|
23
|
+
beforeSubmit?: (values: Record<string, any>) => Promise<boolean> | boolean;
|
|
23
24
|
leaveConfirmConfig?: {
|
|
24
25
|
enable: boolean;
|
|
25
26
|
title: string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL参数处理工具方法
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 从浏览器URL获取查询参数
|
|
6
|
+
* @returns Record<string, string> URL查询参数对象
|
|
7
|
+
*/
|
|
8
|
+
export declare const getUrlParams: () => Record<string, string>;
|
|
9
|
+
/**
|
|
10
|
+
* 从URL参数中提取formSettingMeta相关的参数
|
|
11
|
+
* @param urlParams URL查询参数对象,如果不传则自动从浏览器获取
|
|
12
|
+
* @returns 包含business_code、channel_code和isBoard参数的对象
|
|
13
|
+
*/
|
|
14
|
+
export declare const getFormSettingParams: (urlParams?: Record<string, string>) => {
|
|
15
|
+
businessCode: string;
|
|
16
|
+
channelCode: string;
|
|
17
|
+
isBoard: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* 根据URL参数更新租户设置数据
|
|
21
|
+
* @param data 要更新的数据对象,如 {"order.prefix":"","order.suffix":"","payment.number":""}
|
|
22
|
+
* @returns Promise<any> 返回更新结果
|
|
23
|
+
*/
|
|
24
|
+
export declare const updateTenantSettingFromUrl: (data: Record<string, any>) => Promise<any>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/dataSourceComponents/dataSourceForm/urlUtils.ts
|
|
20
|
+
var urlUtils_exports = {};
|
|
21
|
+
__export(urlUtils_exports, {
|
|
22
|
+
getFormSettingParams: () => getFormSettingParams,
|
|
23
|
+
getUrlParams: () => getUrlParams,
|
|
24
|
+
updateTenantSettingFromUrl: () => updateTenantSettingFromUrl
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(urlUtils_exports);
|
|
27
|
+
var import_utils = require("../../table/utils");
|
|
28
|
+
var getUrlParams = () => {
|
|
29
|
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
30
|
+
const urlParams = {};
|
|
31
|
+
urlSearchParams.forEach((value, key) => {
|
|
32
|
+
urlParams[key] = value;
|
|
33
|
+
});
|
|
34
|
+
return urlParams;
|
|
35
|
+
};
|
|
36
|
+
var getFormSettingParams = (urlParams) => {
|
|
37
|
+
const params = urlParams || getUrlParams();
|
|
38
|
+
return {
|
|
39
|
+
businessCode: params.businessCode || params.business_code,
|
|
40
|
+
channelCode: params.channelCode || params.channel_code,
|
|
41
|
+
isBoard: params.is_board === "1"
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
var updateTenantSettingFromUrl = async (data) => {
|
|
45
|
+
debugger;
|
|
46
|
+
const urlParams = getFormSettingParams();
|
|
47
|
+
const businessCode = urlParams.businessCode;
|
|
48
|
+
const channelCode = urlParams.channelCode;
|
|
49
|
+
const boardCode = urlParams.isBoard && businessCode && channelCode ? `${businessCode}+${channelCode}` : void 0;
|
|
50
|
+
const requestBody = {
|
|
51
|
+
business_code: businessCode || "",
|
|
52
|
+
channel_code: channelCode || "",
|
|
53
|
+
board_code: boardCode || "",
|
|
54
|
+
data
|
|
55
|
+
};
|
|
56
|
+
const url = "/tenant/setting";
|
|
57
|
+
return import_utils.request.getRequest().post(url, requestBody, {
|
|
58
|
+
headers: {
|
|
59
|
+
"Content-Type": "application/json"
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
getFormSettingParams,
|
|
66
|
+
getUrlParams,
|
|
67
|
+
updateTenantSettingFromUrl
|
|
68
|
+
});
|
|
@@ -136,13 +136,13 @@ var withFormItem = (WrappedComponent, overlayProps) => {
|
|
|
136
136
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
137
137
|
WrappedComponent,
|
|
138
138
|
{
|
|
139
|
+
...overlayProps == null ? void 0 : overlayProps.innerProps,
|
|
139
140
|
...otherProps,
|
|
140
141
|
mode: propsMode,
|
|
141
142
|
renderMode: effectiveMode,
|
|
142
|
-
...overlayProps == null ? void 0 : overlayProps.innerProps,
|
|
143
143
|
style: {
|
|
144
|
-
...
|
|
145
|
-
...
|
|
144
|
+
...((_a2 = overlayProps == null ? void 0 : overlayProps.innerProps) == null ? void 0 : _a2.style) || {},
|
|
145
|
+
...innerStyle || {}
|
|
146
146
|
},
|
|
147
147
|
fieldKey: name,
|
|
148
148
|
isVerification: typeobj == null ? void 0 : typeobj.enabled,
|
|
@@ -105,6 +105,7 @@ var BaseTable = (props, ref) => {
|
|
|
105
105
|
}, [dataSourceKey]);
|
|
106
106
|
(0, import_react.useEffect)(() => {
|
|
107
107
|
if (dataSourceKeyRef.current) {
|
|
108
|
+
if (dataSource == null ? void 0 : dataSource.fromSettingMeta) return;
|
|
108
109
|
list == null ? void 0 : list.run(queryPageConfig);
|
|
109
110
|
} else {
|
|
110
111
|
list == null ? void 0 : list.mutate([]);
|
|
@@ -19,7 +19,7 @@ interface UseTablePropsProps {
|
|
|
19
19
|
*/
|
|
20
20
|
declare const useTableProps: (props: UseTablePropsProps) => {
|
|
21
21
|
currentComponentId: any;
|
|
22
|
-
title: number | boolean |
|
|
22
|
+
title: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
23
23
|
pagination: {
|
|
24
24
|
total: number;
|
|
25
25
|
current: number;
|
|
@@ -28,7 +28,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
28
28
|
showSizeChanger: boolean;
|
|
29
29
|
};
|
|
30
30
|
columns: import("./useColumns").Column[];
|
|
31
|
-
subTitle: number | boolean |
|
|
31
|
+
subTitle: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
32
32
|
buttons: any[] | null;
|
|
33
33
|
filter: {
|
|
34
34
|
dom: any;
|
|
@@ -54,7 +54,7 @@ declare const useTableProps: (props: UseTablePropsProps) => {
|
|
|
54
54
|
width: number;
|
|
55
55
|
align: "center" | "left" | "right";
|
|
56
56
|
fixed: false | "left" | "right";
|
|
57
|
-
type: "
|
|
57
|
+
type: "button" | "link";
|
|
58
58
|
items: OperationItem[];
|
|
59
59
|
} | undefined;
|
|
60
60
|
operationContent?: {
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
declare const Subdomain: React.FC<import("antd").InputProps & {
|
|
3
3
|
onChange: (value: string) => void;
|
|
4
4
|
onBlur?: ((e: React.FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
5
|
-
rootDomain: "custom" | "
|
|
5
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
6
6
|
customDomain?: string | undefined;
|
|
7
7
|
value?: string | undefined;
|
|
8
8
|
tenantId: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
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/fields/Switch/ReadPretty.tsx
|
|
30
|
+
var ReadPretty_exports = {};
|
|
31
|
+
__export(ReadPretty_exports, {
|
|
32
|
+
default: () => ReadPretty_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ReadPretty_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_iconfont = __toESM(require("../../../iconfont"));
|
|
37
|
+
var import_ReadPretty = require("./ReadPretty.less");
|
|
38
|
+
var SwitchReadPretty = (props) => {
|
|
39
|
+
const { value, checked } = props;
|
|
40
|
+
const isChecked = value !== void 0 ? value : checked;
|
|
41
|
+
return isChecked ? /* @__PURE__ */ import_react.default.createElement(
|
|
42
|
+
import_iconfont.default,
|
|
43
|
+
{
|
|
44
|
+
type: "pisell2-check",
|
|
45
|
+
style: {
|
|
46
|
+
color: "var(--theme-color)",
|
|
47
|
+
fontSize: 20
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
) : null;
|
|
51
|
+
};
|
|
52
|
+
var ReadPretty_default = SwitchReadPretty;
|
|
@@ -0,0 +1,39 @@
|
|
|
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/fields/Switch/WithMode.ts
|
|
30
|
+
var WithMode_exports = {};
|
|
31
|
+
__export(WithMode_exports, {
|
|
32
|
+
default: () => WithMode_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(WithMode_exports);
|
|
35
|
+
var import_utils = require("../../dataSourceForm/utils");
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_ReadPretty = __toESM(require("./ReadPretty"));
|
|
38
|
+
var SwitchWithMode = (0, import_utils.withMode)(import_antd.Switch, import_ReadPretty.default);
|
|
39
|
+
var WithMode_default = SwitchWithMode;
|
|
@@ -0,0 +1,42 @@
|
|
|
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/fields/Switch/index.tsx
|
|
30
|
+
var Switch_exports = {};
|
|
31
|
+
__export(Switch_exports, {
|
|
32
|
+
default: () => Switch_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Switch_exports);
|
|
35
|
+
var import_WithMode = __toESM(require("./WithMode"));
|
|
36
|
+
var import_utils = require("../../dataSourceForm/utils");
|
|
37
|
+
var Switch = (0, import_utils.withFormItem)(import_WithMode.default, {
|
|
38
|
+
otherFormItemProps: {
|
|
39
|
+
valuePropName: "checked"
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var Switch_default = Switch;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface SwitchProps {
|
|
3
|
+
value?: boolean;
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
defaultChecked?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
size?: 'default' | 'small';
|
|
9
|
+
checkedChildren?: React.ReactNode;
|
|
10
|
+
unCheckedChildren?: React.ReactNode;
|
|
11
|
+
autoFocus?: boolean;
|
|
12
|
+
onChange?: (checked: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
13
|
+
onClick?: (checked: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
14
|
+
renderMode?: 'view' | 'edit' | 'disabled' | 'hidden';
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/components/dataSourceComponents/fields/Switch/type.ts
|
|
16
|
+
var type_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(type_exports);
|
|
@@ -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;
|
|
@@ -19,7 +19,7 @@ declare const formFieldMap: {
|
|
|
19
19
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
20
20
|
onChange: (value: string) => void;
|
|
21
21
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
22
|
-
rootDomain: "custom" | "
|
|
22
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
23
23
|
customDomain?: string | undefined;
|
|
24
24
|
value?: string | undefined;
|
|
25
25
|
tenantId: string;
|
|
@@ -59,7 +59,13 @@ declare const formFieldMap: {
|
|
|
59
59
|
FormItemTranslation: import("react").FC<import("./Translation/type").TranslationProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
60
60
|
FormItemIconSelect: import("react").FC<import("./IconSelect/type").IconSelectProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
61
61
|
};
|
|
62
|
-
declare const getFieldComponent: (fieldComponent: string) => (import("react").FC<import("./
|
|
62
|
+
declare const getFieldComponent: (fieldComponent: string) => import("react").FC<any> | import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
63
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
64
|
+
} & {
|
|
65
|
+
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
66
|
+
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & 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("antd").InputProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("antd").InputProps & {
|
|
67
|
+
onChange: (value: string) => void;
|
|
68
|
+
} & 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("./Input/type").InputProps> & {
|
|
63
69
|
JSON: import("react").FC<any>;
|
|
64
70
|
Password: import("react").FC<import("antd/es/input").PasswordProps & import("react").RefAttributes<import("antd").InputRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
65
71
|
TextArea: import("react").FC<import("antd/es/input").TextAreaProps & import("react").RefAttributes<import("antd/es/input/TextArea").TextAreaRef> & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
@@ -72,18 +78,14 @@ declare const getFieldComponent: (fieldComponent: string) => (import("react").FC
|
|
|
72
78
|
Subdomain: import("react").FC<import("antd").InputProps & {
|
|
73
79
|
onChange: (value: string) => void;
|
|
74
80
|
onBlur?: ((e: import("react").FocusEvent<HTMLInputElement, Element>) => void) | undefined;
|
|
75
|
-
rootDomain: "custom" | "
|
|
81
|
+
rootDomain: "custom" | "saas" | "xzero";
|
|
76
82
|
customDomain?: string | undefined;
|
|
77
83
|
value?: string | undefined;
|
|
78
84
|
tenantId: string;
|
|
79
85
|
name?: string | undefined;
|
|
80
86
|
fieldKey?: string | undefined;
|
|
81
87
|
} & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps>;
|
|
82
|
-
}) | import("react").FC<
|
|
83
|
-
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
84
|
-
} & {
|
|
85
|
-
Group: import("react").FC<import("./Checkbox/type").CheckboxGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
86
|
-
}) | import("react").FC<import("./ColorPicker/type").ColorPickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<(import("antd").DatePickerProps & import("../dataSourceForm/utils").WithModeProps) & import("../dataSourceForm/utils").WithFormItemProps> | (import("react").FC<{}> & {
|
|
88
|
+
}) | import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps> | (import("react").FC<{}> & {
|
|
87
89
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
88
90
|
} & {
|
|
89
91
|
Group: import("react").FC<import("./Radio/type").RadioGroupProps & import("../dataSourceForm/utils").WithModeProps>;
|
|
@@ -95,7 +97,5 @@ declare const getFieldComponent: (fieldComponent: string) => (import("react").FC
|
|
|
95
97
|
extraParams?: Record<string, any> | undefined;
|
|
96
98
|
} & {
|
|
97
99
|
dataSource?: any;
|
|
98
|
-
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | import("react").FC<import("./
|
|
99
|
-
onChange: (value: string) => void;
|
|
100
|
-
} & 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>;
|
|
100
|
+
}) => JSX.Element) | import("react").FC<import("./TimePicker/type").TimePickerProps & import("../dataSourceForm/utils").WithModeProps & import("../dataSourceForm/utils").WithFormItemProps> | 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>;
|
|
101
101
|
export { getFieldComponent, formFieldMap };
|
|
@@ -168,6 +168,9 @@ var useActions = ({
|
|
|
168
168
|
designModeToast();
|
|
169
169
|
return Promise.reject();
|
|
170
170
|
}
|
|
171
|
+
if (currentDataSource == null ? void 0 : currentDataSource.fromSettingMeta) {
|
|
172
|
+
return Promise.reject();
|
|
173
|
+
}
|
|
171
174
|
if (isCustomApi) {
|
|
172
175
|
const actions = getParsedActions();
|
|
173
176
|
if (!actions.update) {
|
|
@@ -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) => string | number;
|
|
@@ -197,12 +197,12 @@ export declare const fieldList: ({
|
|
|
197
197
|
field_icon: string;
|
|
198
198
|
field_name: string;
|
|
199
199
|
field_type: string;
|
|
200
|
-
default_value:
|
|
200
|
+
default_value: string;
|
|
201
201
|
} | {
|
|
202
202
|
field_icon: string;
|
|
203
203
|
field_name: string;
|
|
204
204
|
field_type: string;
|
|
205
|
-
default_value:
|
|
205
|
+
default_value: boolean;
|
|
206
206
|
} | {
|
|
207
207
|
field_icon: string;
|
|
208
208
|
field_name: string;
|
|
@@ -71,10 +71,13 @@ var GridViewTable = ({
|
|
|
71
71
|
payload: newData
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
|
-
const handleResize = (index) => (e, { size }) => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
const handleResize = (index, record) => (e, { size }) => {
|
|
75
|
+
const findIndex = column_setting.findIndex(
|
|
76
|
+
(item) => item.dataIndex === record.dataIndex
|
|
77
|
+
);
|
|
78
|
+
const nextColumns = [...column_setting];
|
|
79
|
+
nextColumns[findIndex] = {
|
|
80
|
+
...nextColumns[findIndex],
|
|
78
81
|
width: size.width
|
|
79
82
|
};
|
|
80
83
|
form.setFieldValue("column_setting", nextColumns);
|
|
@@ -108,6 +111,7 @@ var GridViewTable = ({
|
|
|
108
111
|
const components = (0, import_useGenTableComponents.default)({
|
|
109
112
|
form
|
|
110
113
|
});
|
|
114
|
+
console.log(columns, "columns12");
|
|
111
115
|
const showTotal = (0, import_react.useCallback)(
|
|
112
116
|
(total, range, pageSize) => {
|
|
113
117
|
let start = range[0] - 1;
|
|
@@ -155,7 +155,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
155
155
|
sort?: SortType | undefined;
|
|
156
156
|
mode: "" | "localStorage" | "remote";
|
|
157
157
|
currentViewMode: ModeType;
|
|
158
|
-
}) => ("filters" | "
|
|
158
|
+
}) => ("filters" | "filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
|
|
159
159
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
160
160
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
161
161
|
export {};
|
|
@@ -4,7 +4,7 @@ declare type UseTransColumnsProps = {
|
|
|
4
4
|
form: FormInstance;
|
|
5
5
|
localPagination: boolean;
|
|
6
6
|
handleSave?: (row: Record<string, any>) => void;
|
|
7
|
-
handleResize?: (index: number) => (e: any, p2: any) => void;
|
|
7
|
+
handleResize?: (index: number, record: Record<string, any>) => (e: any, p2: any) => void;
|
|
8
8
|
dragSort: boolean;
|
|
9
9
|
bordered: boolean;
|
|
10
10
|
};
|
|
@@ -196,7 +196,7 @@ var useTransColumns = (params) => {
|
|
|
196
196
|
onHeaderCell: (record) => ({
|
|
197
197
|
record,
|
|
198
198
|
...item,
|
|
199
|
-
onResize: handleResize == null ? void 0 : handleResize(index),
|
|
199
|
+
onResize: handleResize == null ? void 0 : handleResize(index, record),
|
|
200
200
|
position
|
|
201
201
|
})
|
|
202
202
|
};
|
|
@@ -266,7 +266,9 @@ var GridView = (0, import_model.Provider)(
|
|
|
266
266
|
try {
|
|
267
267
|
if (!tableId) return {};
|
|
268
268
|
const setting = (0, import_utils.getTableSettingByCurrentViewMode)(tableId, currentViewMode);
|
|
269
|
-
|
|
269
|
+
const filters = (setting == null ? void 0 : setting.filters) || {};
|
|
270
|
+
filters.order_by = (setting == null ? void 0 : setting.order_by) || "";
|
|
271
|
+
return filters;
|
|
270
272
|
} catch (e) {
|
|
271
273
|
return {};
|
|
272
274
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export { default as DataSourceTypography } from './components/dataSourceComponen
|
|
|
26
26
|
export { default as DataSourceTable } from './components/dataSourceComponents/dataSourceTable';
|
|
27
27
|
export { default as DataSourceWrapper } from './components/dataSourceComponents/dataSourceWrapper';
|
|
28
28
|
export { default as FormItemCheckbox } from './components/dataSourceComponents/fields/Checkbox';
|
|
29
|
+
export { default as FormItemSwitch } from './components/dataSourceComponents/fields/Switch';
|
|
29
30
|
export { default as FormItemColorPicker } from './components/dataSourceComponents/fields/ColorPicker';
|
|
30
31
|
export { default as FormItemDatePicker } from './components/dataSourceComponents/fields/DatePicker';
|
|
31
32
|
export { default as FormItemInput } from './components/dataSourceComponents/fields/Input';
|