@pisell/materials 1.0.964 → 1.0.966
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 +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +15 -15
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +15 -15
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +42 -8
- 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 +43 -20
- package/es/components/dataSourceComponents/dataSourceForm/urlUtils.d.ts +36 -0
- package/es/components/dataSourceComponents/dataSourceForm/urlUtils.js +129 -0
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/es/components/dataSourceComponents/hooks/useActions.js +20 -14
- package/es/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/es/components/iconfont/index.js +1 -1
- package/es/components/pisellWalletPassCard/index.less +0 -1
- package/es/components/productCard/cartSkuCard/components/holders/index.js +6 -1
- package/es/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
- package/es/components/productCard/components/Packages/utils.d.ts +1 -1
- package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +2 -0
- package/es/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/es/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/es/components/table/Table/index.js +7 -3
- 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/utils/index.d.ts +1 -1
- package/es/utils/platform.d.ts +1 -1
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +20 -2
- 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 +16 -1
- package/lib/components/dataSourceComponents/dataSourceForm/urlUtils.d.ts +36 -0
- package/lib/components/dataSourceComponents/dataSourceForm/urlUtils.js +92 -0
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +1 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +2 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +2 -2
- package/lib/components/dataSourceComponents/hooks/useActions.js +3 -0
- package/lib/components/dataSourceComponents/provider/dataSource/DataSourceContext.d.ts +1 -0
- package/lib/components/iconfont/index.js +1 -1
- package/lib/components/pisellWalletPassCard/index.less +0 -1
- package/lib/components/productCard/cartSkuCard/components/holders/index.js +6 -1
- package/lib/components/productCard/cartSkuCard/components/packages/utils.d.ts +1 -1
- package/lib/components/productCard/components/Packages/utils.d.ts +1 -1
- package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +2 -0
- package/lib/components/table/Gallery/components/VirtualGrid/useGapSize.d.ts +2 -2
- package/lib/components/table/Table/fields/select/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/fields/treeSelect/filterUtil/index.d.ts +1 -1
- package/lib/components/table/Table/index.js +8 -4
- 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/utils/index.d.ts +1 -1
- package/lib/utils/platform.d.ts +1 -1
- package/package.json +1 -1
|
@@ -258,32 +258,38 @@ var useActions = function useActions() {
|
|
|
258
258
|
designModeToast();
|
|
259
259
|
return _context4.abrupt("return", Promise.reject());
|
|
260
260
|
case 3:
|
|
261
|
+
if (!(currentDataSource !== null && currentDataSource !== void 0 && currentDataSource.fromSettingMeta)) {
|
|
262
|
+
_context4.next = 5;
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
return _context4.abrupt("return", Promise.reject());
|
|
266
|
+
case 5:
|
|
261
267
|
if (!isCustomApi) {
|
|
262
|
-
_context4.next =
|
|
268
|
+
_context4.next = 13;
|
|
263
269
|
break;
|
|
264
270
|
}
|
|
265
271
|
actions = getParsedActions();
|
|
266
272
|
if (actions.update) {
|
|
267
|
-
_context4.next =
|
|
273
|
+
_context4.next = 9;
|
|
268
274
|
break;
|
|
269
275
|
}
|
|
270
276
|
return _context4.abrupt("return", {});
|
|
271
|
-
case
|
|
277
|
+
case 9:
|
|
272
278
|
updateApi = genCustomApi(actions === null || actions === void 0 ? void 0 : actions.update);
|
|
273
279
|
return _context4.abrupt("return", updateApi(formatCreateUpdateParams(values)));
|
|
274
|
-
case
|
|
280
|
+
case 13:
|
|
275
281
|
id = (extraParams === null || extraParams === void 0 ? void 0 : extraParams.filterByTk) || (values === null || values === void 0 ? void 0 : values.id);
|
|
276
282
|
if (!(!id || !name)) {
|
|
277
|
-
_context4.next =
|
|
283
|
+
_context4.next = 17;
|
|
278
284
|
break;
|
|
279
285
|
}
|
|
280
286
|
PisellToast({
|
|
281
287
|
content: getText('pisell-action-get-data')
|
|
282
288
|
});
|
|
283
289
|
return _context4.abrupt("return", Promise.reject());
|
|
284
|
-
case
|
|
285
|
-
_context4.prev =
|
|
286
|
-
_context4.next =
|
|
290
|
+
case 17:
|
|
291
|
+
_context4.prev = 17;
|
|
292
|
+
_context4.next = 20;
|
|
287
293
|
return updateNocobaseData({
|
|
288
294
|
key: name,
|
|
289
295
|
data: formatCreateUpdateParams(values),
|
|
@@ -292,18 +298,18 @@ var useActions = function useActions() {
|
|
|
292
298
|
filterByTk: id
|
|
293
299
|
}, extraParams === null || extraParams === void 0 ? void 0 : extraParams.update)
|
|
294
300
|
});
|
|
295
|
-
case
|
|
301
|
+
case 20:
|
|
296
302
|
res = _context4.sent;
|
|
297
303
|
return _context4.abrupt("return", res);
|
|
298
|
-
case
|
|
299
|
-
_context4.prev =
|
|
300
|
-
_context4.t0 = _context4["catch"](
|
|
304
|
+
case 24:
|
|
305
|
+
_context4.prev = 24;
|
|
306
|
+
_context4.t0 = _context4["catch"](17);
|
|
301
307
|
return _context4.abrupt("return", Promise.reject());
|
|
302
|
-
case
|
|
308
|
+
case 27:
|
|
303
309
|
case "end":
|
|
304
310
|
return _context4.stop();
|
|
305
311
|
}
|
|
306
|
-
}, _callee4, null, [[
|
|
312
|
+
}, _callee4, null, [[17, 24]]);
|
|
307
313
|
}));
|
|
308
314
|
return function (_x3) {
|
|
309
315
|
return _ref12.apply(this, arguments);
|
|
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
var MyIcon = createFromIconfontCN({
|
|
5
|
-
scriptUrl: 'https://static.pisellcdn.com/pisell2iconfont1.
|
|
5
|
+
scriptUrl: 'https://static.pisellcdn.com/pisell2iconfont1.19.js' // 在 iconfont.cn 上生成
|
|
6
6
|
});
|
|
7
7
|
var IconFont = function IconFont(props) {
|
|
8
8
|
return /*#__PURE__*/React.createElement(MyIcon, _extends({}, props, {
|
|
@@ -3,6 +3,11 @@ import Iconfont from "../../../../iconfont";
|
|
|
3
3
|
import { PREFIX } from "../../index";
|
|
4
4
|
import "./index.less";
|
|
5
5
|
import { locales } from '@pisell/utils';
|
|
6
|
+
var holderIconMap = {
|
|
7
|
+
'form': 'pisell2-file-05',
|
|
8
|
+
'minors': 'pisell2-user-check-01',
|
|
9
|
+
'waiver': 'pisell2-file-lock-03'
|
|
10
|
+
};
|
|
6
11
|
var Holders = function Holders(props) {
|
|
7
12
|
var _props$dataSource = props.dataSource,
|
|
8
13
|
dataSource = _props$dataSource === void 0 ? {} : _props$dataSource;
|
|
@@ -30,7 +35,7 @@ var Holders = function Holders(props) {
|
|
|
30
35
|
key: id
|
|
31
36
|
}, /*#__PURE__*/React.createElement(Iconfont, {
|
|
32
37
|
className: "holder-icon",
|
|
33
|
-
type:
|
|
38
|
+
type: holderIconMap[(dataSource === null || dataSource === void 0 ? void 0 : dataSource.holderType) || 'minors']
|
|
34
39
|
}), /*#__PURE__*/React.createElement("span", {
|
|
35
40
|
className: "holder-label"
|
|
36
41
|
}, (holder === null || holder === void 0 ? void 0 : holder.label) || id));
|
|
@@ -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;
|
|
@@ -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;
|
package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js
CHANGED
|
@@ -99,6 +99,8 @@ export var batchExport = function batchExport(exportParams, exportImport) {
|
|
|
99
99
|
params === null || params === void 0 || delete params.shipping_status;
|
|
100
100
|
params === null || params === void 0 || delete params.payment_status;
|
|
101
101
|
params === null || params === void 0 || delete params.status;
|
|
102
|
+
} else {
|
|
103
|
+
params === null || params === void 0 || delete params.ids;
|
|
102
104
|
}
|
|
103
105
|
params.export_select = exportImportTypeMap[type];
|
|
104
106
|
return _batchExport(params);
|
|
@@ -57,11 +57,14 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
57
57
|
payload: newData
|
|
58
58
|
});
|
|
59
59
|
});
|
|
60
|
-
var handleResize = function handleResize(index) {
|
|
60
|
+
var handleResize = function handleResize(index, record) {
|
|
61
61
|
return function (e, _ref2) {
|
|
62
62
|
var size = _ref2.size;
|
|
63
|
-
var
|
|
64
|
-
|
|
63
|
+
var findIndex = column_setting.findIndex(function (item) {
|
|
64
|
+
return item.dataIndex === record.dataIndex;
|
|
65
|
+
});
|
|
66
|
+
var nextColumns = _toConsumableArray(column_setting);
|
|
67
|
+
nextColumns[findIndex] = _objectSpread(_objectSpread({}, nextColumns[findIndex]), {}, {
|
|
65
68
|
width: size.width
|
|
66
69
|
});
|
|
67
70
|
form.setFieldValue('column_setting', nextColumns);
|
|
@@ -98,6 +101,7 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
98
101
|
var components = useGenTableComponents({
|
|
99
102
|
form: form
|
|
100
103
|
});
|
|
104
|
+
console.log(columns, 'columns12');
|
|
101
105
|
var showTotal = useCallback(function (total, range, pageSize) {
|
|
102
106
|
var start = range[0] - 1;
|
|
103
107
|
var _current = start / pageSize + 1;
|
|
@@ -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
|
};
|
|
@@ -186,7 +186,7 @@ var useTransColumns = function useTransColumns(params) {
|
|
|
186
186
|
return _objectSpread(_objectSpread({
|
|
187
187
|
record: record
|
|
188
188
|
}, item), {}, {
|
|
189
|
-
onResize: handleResize === null || handleResize === void 0 ? void 0 : handleResize(index),
|
|
189
|
+
onResize: handleResize === null || handleResize === void 0 ? void 0 : handleResize(index, record),
|
|
190
190
|
position: position
|
|
191
191
|
});
|
|
192
192
|
}
|
|
@@ -252,7 +252,9 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
252
252
|
try {
|
|
253
253
|
if (!tableId) return {};
|
|
254
254
|
var setting = getTableSettingByCurrentViewMode(tableId, currentViewMode);
|
|
255
|
-
|
|
255
|
+
var filters = (setting === null || setting === void 0 ? void 0 : setting.filters) || {};
|
|
256
|
+
filters.order_by = (setting === null || setting === void 0 ? void 0 : setting.order_by) || '';
|
|
257
|
+
return filters;
|
|
256
258
|
} catch (e) {
|
|
257
259
|
return {};
|
|
258
260
|
}
|
package/es/utils/index.d.ts
CHANGED
package/es/utils/platform.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const isMobile: () =>
|
|
1
|
+
export declare const isMobile: () => boolean;
|
|
@@ -43,6 +43,8 @@ var import_form = __toESM(require("../../form"));
|
|
|
43
43
|
var import_FormSettingProvider = __toESM(require("./provider/formSetting/FormSettingProvider"));
|
|
44
44
|
var import_page_header = __toESM(require("../../page-header"));
|
|
45
45
|
var import_utils = require("./utils");
|
|
46
|
+
var import_serve = require("./serve");
|
|
47
|
+
var import_urlUtils = require("./urlUtils");
|
|
46
48
|
var import_index = require("./index.less");
|
|
47
49
|
var BaseForm = (0, import_react.forwardRef)(
|
|
48
50
|
(props, ref) => {
|
|
@@ -83,11 +85,27 @@ var BaseForm = (0, import_react.forwardRef)(
|
|
|
83
85
|
}, []);
|
|
84
86
|
(0, import_react.useImperativeHandle)(ref, () => formRef.current);
|
|
85
87
|
(0, import_react.useEffect)(() => {
|
|
88
|
+
var _a2;
|
|
86
89
|
if (["edit", "view"].includes(renderMode || "") && dataSource) {
|
|
90
|
+
if (dataSource == null ? void 0 : dataSource.fromSettingMeta) {
|
|
91
|
+
if (props.__designMode === "design") return;
|
|
92
|
+
const { businessCode, channelCode, includeBoard } = (0, import_urlUtils.getFormSettingParams)();
|
|
93
|
+
const sectionCodes = Array.from(new Set((_a2 = dataSource == null ? void 0 : dataSource.fields) == null ? void 0 : _a2.map((field) => field.name.split(".").shift())));
|
|
94
|
+
(0, import_serve.getFormSettingMetaData)({ sectionCodes, businessCode, channelCode, includeBoard }).then((res) => {
|
|
95
|
+
var _a3;
|
|
96
|
+
const formattedValues = formatInitialValues ? formatInitialValues(res.data) : res.data || {};
|
|
97
|
+
(_a3 = formRef.current) == null ? void 0 : _a3.setFields((0, import_utils.transformFormObjToArrayWithUntouched)({
|
|
98
|
+
...formattedValues
|
|
99
|
+
}));
|
|
100
|
+
}).catch((error) => {
|
|
101
|
+
console.error("获取formSettingMeta数据失败:", error);
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
87
105
|
get == null ? void 0 : get.runAsync().then((res) => {
|
|
88
|
-
var
|
|
106
|
+
var _a3;
|
|
89
107
|
const formattedValues = formatInitialValues ? formatInitialValues(res) : res;
|
|
90
|
-
(
|
|
108
|
+
(_a3 = formRef.current) == null ? void 0 : _a3.setFields((0, import_utils.transformFormObjToArrayWithUntouched)(formattedValues));
|
|
91
109
|
});
|
|
92
110
|
}
|
|
93
111
|
}, [renderMode, dataSource]);
|
|
@@ -146,4 +146,34 @@ export declare const getNocobaseDataList: (allParams: {
|
|
|
146
146
|
* 删除nocobase数据
|
|
147
147
|
*/
|
|
148
148
|
export declare const deleteNocobaseData: (key: string, id: string, headers?: any) => Promise<any>;
|
|
149
|
+
/**
|
|
150
|
+
* 获取formSettingMeta数据
|
|
151
|
+
* @param params 请求参数
|
|
152
|
+
* @param params.sectionCodes 配置段代码数组,如 ['payment']
|
|
153
|
+
* @param params.businessCode 业务代码
|
|
154
|
+
* @param params.channelCode 渠道代码
|
|
155
|
+
* @param params.includeBoard 是否包含board_code参数(当board=1时)
|
|
156
|
+
* @returns Promise<any> 返回设置元数据
|
|
157
|
+
*/
|
|
158
|
+
export declare const getFormSettingMetaData: (params: {
|
|
159
|
+
sectionCodes: string[];
|
|
160
|
+
businessCode?: string | undefined;
|
|
161
|
+
channelCode?: string | undefined;
|
|
162
|
+
includeBoard?: boolean | undefined;
|
|
163
|
+
}) => Promise<any>;
|
|
164
|
+
/**
|
|
165
|
+
* 更新租户设置数据
|
|
166
|
+
* @param params 请求参数
|
|
167
|
+
* @param params.businessCode 业务代码
|
|
168
|
+
* @param params.channelCode 渠道代码
|
|
169
|
+
* @param params.boardCode 板块代码
|
|
170
|
+
* @param params.data 要更新的数据对象,如 {"order.prefix":"","order.suffix":"","payment.number":""}
|
|
171
|
+
* @returns Promise<any> 返回更新结果
|
|
172
|
+
*/
|
|
173
|
+
export declare const updateTenantSetting: (params: {
|
|
174
|
+
business_code?: string | undefined;
|
|
175
|
+
channel_code?: string | undefined;
|
|
176
|
+
board_code?: string | undefined;
|
|
177
|
+
data: Record<string, any>;
|
|
178
|
+
}) => Promise<any>;
|
|
149
179
|
export {};
|
|
@@ -22,12 +22,14 @@ __export(serve_exports, {
|
|
|
22
22
|
createNocobaseData: () => createNocobaseData,
|
|
23
23
|
customApi: () => customApi,
|
|
24
24
|
deleteNocobaseData: () => deleteNocobaseData,
|
|
25
|
+
getFormSettingMetaData: () => getFormSettingMetaData,
|
|
25
26
|
getNocobaseData: () => getNocobaseData,
|
|
26
27
|
getNocobaseDataList: () => getNocobaseDataList,
|
|
27
28
|
getNocobaseDataSource: () => getNocobaseDataSource,
|
|
28
29
|
getNocobaseDataSourceOptions: () => getNocobaseDataSourceOptions,
|
|
29
30
|
getNocobaseMainDataSource: () => getNocobaseMainDataSource,
|
|
30
|
-
updateNocobaseData: () => updateNocobaseData
|
|
31
|
+
updateNocobaseData: () => updateNocobaseData,
|
|
32
|
+
updateTenantSetting: () => updateTenantSetting
|
|
31
33
|
});
|
|
32
34
|
module.exports = __toCommonJS(serve_exports);
|
|
33
35
|
var import_utils = require("../../table/utils");
|
|
@@ -137,15 +139,56 @@ var deleteNocobaseData = async (key, id, headers) => {
|
|
|
137
139
|
}
|
|
138
140
|
);
|
|
139
141
|
};
|
|
142
|
+
var getFormSettingMetaData = async (params) => {
|
|
143
|
+
console.log("getFormSettingMetaData", params);
|
|
144
|
+
const { sectionCodes, businessCode, channelCode, includeBoard } = params;
|
|
145
|
+
const queryParams = new URLSearchParams();
|
|
146
|
+
sectionCodes.forEach((code) => {
|
|
147
|
+
queryParams.append("section_code[]", code);
|
|
148
|
+
});
|
|
149
|
+
if (businessCode) {
|
|
150
|
+
queryParams.append("business_code", businessCode);
|
|
151
|
+
}
|
|
152
|
+
if (channelCode) {
|
|
153
|
+
queryParams.append("channel_code", channelCode);
|
|
154
|
+
}
|
|
155
|
+
if (includeBoard && businessCode && channelCode) {
|
|
156
|
+
queryParams.append("board_code", `${businessCode}×${channelCode}`);
|
|
157
|
+
}
|
|
158
|
+
const url = `/tenant/setting?${queryParams.toString()}`;
|
|
159
|
+
return import_utils.request.getRequest().get(url, {}, {
|
|
160
|
+
headers: {
|
|
161
|
+
"Content-Type": "application/json"
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
var updateTenantSetting = async (params) => {
|
|
166
|
+
console.log("updateTenantSetting", params);
|
|
167
|
+
const { business_code, channel_code, board_code, data } = params;
|
|
168
|
+
const requestBody = {
|
|
169
|
+
business_code,
|
|
170
|
+
channel_code,
|
|
171
|
+
board_code,
|
|
172
|
+
data
|
|
173
|
+
};
|
|
174
|
+
const url = "/tenant/setting";
|
|
175
|
+
return import_utils.request.getRequest().post(url, requestBody, {
|
|
176
|
+
headers: {
|
|
177
|
+
"Content-Type": "application/json"
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
};
|
|
140
181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
141
182
|
0 && (module.exports = {
|
|
142
183
|
createNocobaseData,
|
|
143
184
|
customApi,
|
|
144
185
|
deleteNocobaseData,
|
|
186
|
+
getFormSettingMetaData,
|
|
145
187
|
getNocobaseData,
|
|
146
188
|
getNocobaseDataList,
|
|
147
189
|
getNocobaseDataSource,
|
|
148
190
|
getNocobaseDataSourceOptions,
|
|
149
191
|
getNocobaseMainDataSource,
|
|
150
|
-
updateNocobaseData
|
|
192
|
+
updateNocobaseData,
|
|
193
|
+
updateTenantSetting
|
|
151
194
|
});
|
|
@@ -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,
|
|
@@ -60,11 +62,23 @@ var SubmitButton = (props) => {
|
|
|
60
62
|
const form = import_antd.Form.useFormInstance();
|
|
61
63
|
const { renderMode, onDataSourceFinish, formatSubmitValues, customSubmit } = (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.getUrlParams)();
|
|
72
|
+
const business_code = urlParams.business_code;
|
|
73
|
+
const channel_code = urlParams.channel_code;
|
|
74
|
+
const board_code = urlParams.isBoard === "1" && channel_code && channel_code ? `${business_code}x${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
|
}
|
|
@@ -138,6 +152,7 @@ var SubmitButton = (props) => {
|
|
|
138
152
|
}
|
|
139
153
|
(0, import_utils.setFormFieldsUntouched)(form);
|
|
140
154
|
} catch (error) {
|
|
155
|
+
debugger;
|
|
141
156
|
(0, import_pisellToast.default)({
|
|
142
157
|
content: `${error.message}`
|
|
143
158
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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和board相关参数的对象
|
|
13
|
+
*/
|
|
14
|
+
export declare const getFormSettingParams: (urlParams?: Record<string, string>) => {
|
|
15
|
+
businessCode: string;
|
|
16
|
+
channelCode: string;
|
|
17
|
+
board: string;
|
|
18
|
+
includeBoard: boolean;
|
|
19
|
+
isBoard: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* 保存formSettingMeta数据
|
|
23
|
+
* @param sectionCodes 配置段代码数组,如 ['payment']
|
|
24
|
+
* @param data 要保存的数据
|
|
25
|
+
* @param businessCode 业务代码
|
|
26
|
+
* @param channelCode 渠道代码
|
|
27
|
+
* @param includeBoard 是否包含board_code参数
|
|
28
|
+
* @returns Promise<any> 返回保存结果
|
|
29
|
+
*/
|
|
30
|
+
export declare const saveFormSettingMeta: (sectionCodes: string[], data: Record<string, any>, businessCode: string, channelCode: string, includeBoard: boolean) => Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* 根据URL参数更新租户设置数据
|
|
33
|
+
* @param data 要更新的数据对象,如 {"order.prefix":"","order.suffix":"","payment.number":""}
|
|
34
|
+
* @returns Promise<any> 返回更新结果
|
|
35
|
+
*/
|
|
36
|
+
export declare const updateTenantSettingFromUrl: (data: Record<string, any>) => Promise<any>;
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
saveFormSettingMeta: () => saveFormSettingMeta,
|
|
25
|
+
updateTenantSettingFromUrl: () => updateTenantSettingFromUrl
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(urlUtils_exports);
|
|
28
|
+
var import_utils = require("../../table/utils");
|
|
29
|
+
var getUrlParams = () => {
|
|
30
|
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
31
|
+
const urlParams = {};
|
|
32
|
+
urlSearchParams.forEach((value, key) => {
|
|
33
|
+
urlParams[key] = value;
|
|
34
|
+
});
|
|
35
|
+
return urlParams;
|
|
36
|
+
};
|
|
37
|
+
var getFormSettingParams = (urlParams) => {
|
|
38
|
+
const params = urlParams || getUrlParams();
|
|
39
|
+
return {
|
|
40
|
+
businessCode: params.businessCode || params.business_code,
|
|
41
|
+
channelCode: params.channelCode || params.channel_code,
|
|
42
|
+
board: params.board,
|
|
43
|
+
includeBoard: params.board === "1",
|
|
44
|
+
isBoard: params.isBoard
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var saveFormSettingMeta = async (sectionCodes, data, businessCode, channelCode, includeBoard) => {
|
|
48
|
+
const queryParams = new URLSearchParams();
|
|
49
|
+
sectionCodes.forEach((code) => {
|
|
50
|
+
queryParams.append("section_code[]", code);
|
|
51
|
+
});
|
|
52
|
+
if (businessCode) {
|
|
53
|
+
queryParams.append("business_code", businessCode);
|
|
54
|
+
}
|
|
55
|
+
if (channelCode) {
|
|
56
|
+
queryParams.append("channel_code", channelCode);
|
|
57
|
+
}
|
|
58
|
+
if (includeBoard && businessCode && channelCode) {
|
|
59
|
+
queryParams.append("board_code", `${businessCode}×${channelCode}`);
|
|
60
|
+
}
|
|
61
|
+
const url = `/setting?${queryParams.toString()}`;
|
|
62
|
+
return import_utils.request.getRequest().post(url, data, {
|
|
63
|
+
headers: {
|
|
64
|
+
"Content-Type": "application/json"
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
var updateTenantSettingFromUrl = async (data) => {
|
|
69
|
+
const urlParams = getUrlParams();
|
|
70
|
+
const businessCode = urlParams.businessCode;
|
|
71
|
+
const channelCode = urlParams.channelCode;
|
|
72
|
+
const boardCode = urlParams.isBoard === "1" && businessCode && channelCode ? `${businessCode}x${channelCode}` : void 0;
|
|
73
|
+
const requestBody = {
|
|
74
|
+
business_code: businessCode || "",
|
|
75
|
+
channel_code: channelCode || "",
|
|
76
|
+
board_code: boardCode || "",
|
|
77
|
+
data
|
|
78
|
+
};
|
|
79
|
+
const url = "/tenant/setting";
|
|
80
|
+
return import_utils.request.getRequest().post(url, requestBody, {
|
|
81
|
+
headers: {
|
|
82
|
+
"Content-Type": "application/json"
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
getFormSettingParams,
|
|
89
|
+
getUrlParams,
|
|
90
|
+
saveFormSettingMeta,
|
|
91
|
+
updateTenantSettingFromUrl
|
|
92
|
+
});
|
|
@@ -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([]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const useDataSourceKey: () => {
|
|
2
|
-
dataSourceKey: string |
|
|
3
|
-
dataSourceKeyRef: import("react").MutableRefObject<string |
|
|
2
|
+
dataSourceKey: string | undefined;
|
|
3
|
+
dataSourceKeyRef: import("react").MutableRefObject<string | undefined>;
|
|
4
4
|
};
|
|
5
5
|
export default useDataSourceKey;
|
|
@@ -19,7 +19,7 @@ interface UseTablePropsProps {
|
|
|
19
19
|
*/
|
|
20
20
|
declare const useTableProps: (props: UseTablePropsProps) => {
|
|
21
21
|
currentComponentId: any;
|
|
22
|
-
title:
|
|
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:
|
|
31
|
+
subTitle: number | boolean | React.ReactFragment | JSX.Element | (() => React.ReactNode) | null | undefined;
|
|
32
32
|
buttons: any[] | null;
|
|
33
33
|
filter: {
|
|
34
34
|
dom: any;
|
|
@@ -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) {
|
|
@@ -35,7 +35,7 @@ module.exports = __toCommonJS(iconfont_exports);
|
|
|
35
35
|
var import_icons = require("@ant-design/icons");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var MyIcon = (0, import_icons.createFromIconfontCN)({
|
|
38
|
-
scriptUrl: "https://static.pisellcdn.com/pisell2iconfont1.
|
|
38
|
+
scriptUrl: "https://static.pisellcdn.com/pisell2iconfont1.19.js"
|
|
39
39
|
// 在 iconfont.cn 上生成
|
|
40
40
|
});
|
|
41
41
|
var IconFont = (props) => {
|