@pisell/materials 1.0.458 → 1.0.459
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 +7 -7
- package/build/lowcode/render/default/view.js +16 -16
- package/build/lowcode/view.js +20 -20
- package/es/components/dataSourceComponents/dataSourceForm/BaseForm.js +0 -2
- package/es/components/dataSourceComponents/dataSourceForm/submitButton/index.js +6 -6
- package/es/components/dataSourceComponents/dataSourceTable/BaseTable.js +38 -30
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +6 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.js +17 -0
- package/es/components/dataSourceComponents/hooks/useActions.js +1 -1
- package/es/components/dataSourceComponents/provider/fields/DataSourceProvider.js +3 -1
- package/es/components/productCard/components/Packages/index.js +2 -1
- package/es/components/productCard/hooks/useOpenNote.js +10 -4
- package/es/components/productCard/locales.d.ts +9 -3
- package/es/components/productCard/locales.js +9 -3
- package/lib/components/dataSourceComponents/dataSourceForm/BaseForm.js +0 -2
- package/lib/components/dataSourceComponents/dataSourceForm/submitButton/index.js +4 -4
- package/lib/components/dataSourceComponents/dataSourceTable/BaseTable.js +30 -17
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.d.ts +6 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useDataSourceKey.js +50 -0
- package/lib/components/dataSourceComponents/hooks/useActions.js +1 -1
- package/lib/components/dataSourceComponents/provider/fields/DataSourceProvider.js +2 -1
- package/lib/components/productCard/components/Packages/index.js +4 -3
- package/lib/components/productCard/hooks/useOpenNote.js +6 -3
- package/lib/components/productCard/locales.d.ts +9 -3
- package/lib/components/productCard/locales.js +9 -3
- package/package.json +3 -3
|
@@ -7,7 +7,6 @@ import classNames from 'classnames';
|
|
|
7
7
|
import useDataSource from "../hooks/useDataSource";
|
|
8
8
|
import Form from "../../form";
|
|
9
9
|
import FormSettingProvider from "./provider/formSetting/FormSettingProvider";
|
|
10
|
-
import useSetRequest from "../../../hooks/useSetRequest";
|
|
11
10
|
import "./index.less";
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -27,7 +26,6 @@ var BaseForm = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
27
26
|
currentValue = props.currentValue,
|
|
28
27
|
className = props.className,
|
|
29
28
|
others = _objectWithoutProperties(props, _excluded);
|
|
30
|
-
useSetRequest();
|
|
31
29
|
var formRef = useRef(null);
|
|
32
30
|
var _useDataSource = useDataSource(),
|
|
33
31
|
get = _useDataSource.get;
|
|
@@ -14,8 +14,8 @@ import PisellToast from "../../../pisellToast";
|
|
|
14
14
|
import PisellModal from "../../../pisellModal";
|
|
15
15
|
import FormItem from "../formItem";
|
|
16
16
|
import useFormSetting from "../provider/hooks/useFormSetting";
|
|
17
|
-
import useActions from "../../hooks/useActions";
|
|
18
17
|
import useCtxActions from "../../hooks/useCtxActions";
|
|
18
|
+
import useDataSource from "../../hooks/useDataSource";
|
|
19
19
|
import "./index.less";
|
|
20
20
|
// 表单提交按钮
|
|
21
21
|
var SubmitButton = function SubmitButton(props) {
|
|
@@ -42,9 +42,9 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
42
42
|
var _useCtxActions = useCtxActions(),
|
|
43
43
|
setVisible = _useCtxActions.setVisible,
|
|
44
44
|
refreshTableData = _useCtxActions.refreshTableData;
|
|
45
|
-
var
|
|
46
|
-
create =
|
|
47
|
-
update =
|
|
45
|
+
var _useDataSource = useDataSource(),
|
|
46
|
+
create = _useDataSource.create,
|
|
47
|
+
update = _useDataSource.update;
|
|
48
48
|
var isDisabled = status === 'disabled';
|
|
49
49
|
var onSubmit = /*#__PURE__*/function () {
|
|
50
50
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(values) {
|
|
@@ -59,7 +59,7 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
_context.next = 5;
|
|
62
|
-
return update(values);
|
|
62
|
+
return update.runAsync(values);
|
|
63
63
|
case 5:
|
|
64
64
|
_context.next = 12;
|
|
65
65
|
break;
|
|
@@ -69,7 +69,7 @@ var SubmitButton = function SubmitButton(props) {
|
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
_context.next = 10;
|
|
72
|
-
return create(values);
|
|
72
|
+
return create.runAsync(values);
|
|
73
73
|
case 10:
|
|
74
74
|
res = _context.sent;
|
|
75
75
|
form === null || form === void 0 ? void 0 : form.resetFields();
|
|
@@ -7,7 +7,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
7
7
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
8
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
9
|
import React, { useEffect, useMemo } from 'react';
|
|
10
|
-
import { Drawer, Button, Space } from 'antd';
|
|
10
|
+
import { Drawer, Button, Space, message } from 'antd';
|
|
11
11
|
import Table from "../../table";
|
|
12
12
|
import useVariables from "../hooks/useVariables";
|
|
13
13
|
import useColumns from "./hooks/useColumns";
|
|
@@ -16,10 +16,10 @@ import ActionsProvider from "../provider/actions/ActionsProvider";
|
|
|
16
16
|
import useDrawerState from "./hooks/useDrawerState";
|
|
17
17
|
import useDesignMode from "./hooks/useDesignMode";
|
|
18
18
|
import useTableQuery from "./hooks/useTableQuery";
|
|
19
|
-
import useSetRequest from "../../../hooks/useSetRequest";
|
|
20
19
|
import { getText } from "../../../locales";
|
|
21
20
|
import useDataSource from "../hooks/useDataSource";
|
|
22
21
|
import TableSettingProvider from "./provider/tableSetting/TableSettingProvider";
|
|
22
|
+
import useDataSourceKey from "./hooks/useDataSourceKey";
|
|
23
23
|
var DRAWER_TITLES = {
|
|
24
24
|
detail: getText('pisell-data-source-table-detail'),
|
|
25
25
|
edit: getText('pisell-data-source-table-edit'),
|
|
@@ -37,13 +37,15 @@ var BaseTable = function BaseTable(props) {
|
|
|
37
37
|
addContent = props.addContent,
|
|
38
38
|
__designMode = props.__designMode,
|
|
39
39
|
others = _objectWithoutProperties(props, _excluded);
|
|
40
|
-
useSetRequest();
|
|
41
40
|
var _useVariables = useVariables(),
|
|
42
41
|
registerVariable = _useVariables.registerVariable;
|
|
43
42
|
var _useDataSource = useDataSource(),
|
|
44
43
|
list = _useDataSource.list,
|
|
45
44
|
destroy = _useDataSource.destroy;
|
|
46
45
|
var data = list.data;
|
|
46
|
+
var _useDataSourceKey = useDataSourceKey(),
|
|
47
|
+
dataSourceKey = _useDataSourceKey.dataSourceKey,
|
|
48
|
+
dataSourceKeyRef = _useDataSourceKey.dataSourceKeyRef;
|
|
47
49
|
var _useDrawerState = useDrawerState(),
|
|
48
50
|
drawerVisible = _useDrawerState.drawerVisible,
|
|
49
51
|
setDrawerVisible = _useDrawerState.setDrawerVisible,
|
|
@@ -63,12 +65,15 @@ var BaseTable = function BaseTable(props) {
|
|
|
63
65
|
data: data === null || data === void 0 ? void 0 : data.data
|
|
64
66
|
});
|
|
65
67
|
useEffect(function () {
|
|
66
|
-
|
|
68
|
+
refreshData();
|
|
69
|
+
}, [dataSourceKey]);
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
if (dataSourceKeyRef.current) {
|
|
67
72
|
list === null || list === void 0 ? void 0 : list.run(queryPageConfig);
|
|
68
73
|
} else {
|
|
69
74
|
list === null || list === void 0 ? void 0 : list.mutate([]);
|
|
70
75
|
}
|
|
71
|
-
}, [
|
|
76
|
+
}, [queryPageConfig]);
|
|
72
77
|
|
|
73
78
|
// 打开抽屉
|
|
74
79
|
var handleOpenDrawer = function handleOpenDrawer(record, type) {
|
|
@@ -92,24 +97,29 @@ var BaseTable = function BaseTable(props) {
|
|
|
92
97
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
93
98
|
while (1) switch (_context2.prev = _context2.next) {
|
|
94
99
|
case 0:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
100
|
+
try {
|
|
101
|
+
registerVariable === null || registerVariable === void 0 ? void 0 : registerVariable({
|
|
102
|
+
currentRecord: record
|
|
103
|
+
});
|
|
104
|
+
setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
105
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
106
|
+
while (1) switch (_context.prev = _context.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
_context.next = 2;
|
|
109
|
+
return destroy === null || destroy === void 0 ? void 0 : destroy.run(record.id);
|
|
110
|
+
case 2:
|
|
111
|
+
refreshData();
|
|
112
|
+
case 3:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
115
|
+
}
|
|
116
|
+
}, _callee);
|
|
117
|
+
})));
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error(error);
|
|
120
|
+
message.error('删除失败,请重试');
|
|
121
|
+
}
|
|
122
|
+
case 1:
|
|
113
123
|
case "end":
|
|
114
124
|
return _context2.stop();
|
|
115
125
|
}
|
|
@@ -156,18 +166,16 @@ var BaseTable = function BaseTable(props) {
|
|
|
156
166
|
actionsColumns: actionsColumns
|
|
157
167
|
});
|
|
158
168
|
var pagination = usePagination({
|
|
159
|
-
data: data
|
|
169
|
+
data: data
|
|
160
170
|
});
|
|
161
|
-
|
|
162
|
-
// 获取抽屉内容
|
|
163
|
-
var getDrawerContent = function getDrawerContent(type) {
|
|
171
|
+
var drawerContent = useMemo(function () {
|
|
164
172
|
var contentMap = {
|
|
165
173
|
detail: detailContent,
|
|
166
174
|
edit: editContent,
|
|
167
175
|
add: addContent
|
|
168
176
|
};
|
|
169
|
-
return contentMap[
|
|
170
|
-
};
|
|
177
|
+
return contentMap[drawerType];
|
|
178
|
+
}, [drawerType, detailContent, editContent, addContent]);
|
|
171
179
|
return /*#__PURE__*/React.createElement(TableSettingProvider, null, showAddButton && /*#__PURE__*/React.createElement("div", {
|
|
172
180
|
style: {
|
|
173
181
|
marginBottom: 16
|
|
@@ -192,6 +200,6 @@ var BaseTable = function BaseTable(props) {
|
|
|
192
200
|
open: drawerVisible,
|
|
193
201
|
onClose: handleCloseDrawer,
|
|
194
202
|
destroyOnClose: true
|
|
195
|
-
},
|
|
203
|
+
}, drawerContent)));
|
|
196
204
|
};
|
|
197
205
|
export default BaseTable;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
|
+
import { isString } from '@pisell/utils';
|
|
3
|
+
import useDataSource from "../../hooks/useDataSource";
|
|
4
|
+
var useDataSourceKey = function useDataSourceKey() {
|
|
5
|
+
var _useDataSource = useDataSource(),
|
|
6
|
+
dataSource = _useDataSource.dataSource;
|
|
7
|
+
var dataSourceKey = useMemo(function () {
|
|
8
|
+
return isString(dataSource) ? dataSource : dataSource === null || dataSource === void 0 ? void 0 : dataSource.key;
|
|
9
|
+
}, [dataSource]);
|
|
10
|
+
var dataSourceKeyRef = useRef(dataSourceKey);
|
|
11
|
+
dataSourceKeyRef.current = dataSourceKey;
|
|
12
|
+
return {
|
|
13
|
+
dataSourceKey: dataSourceKey,
|
|
14
|
+
dataSourceKeyRef: dataSourceKeyRef
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default useDataSourceKey;
|
|
@@ -189,7 +189,7 @@ var useActions = function useActions() {
|
|
|
189
189
|
break;
|
|
190
190
|
}
|
|
191
191
|
message.error('请先获取数据');
|
|
192
|
-
return _context4.abrupt("return",
|
|
192
|
+
return _context4.abrupt("return", Promise.reject());
|
|
193
193
|
case 12:
|
|
194
194
|
return _context4.abrupt("return", updateNocobaseData({
|
|
195
195
|
key: name,
|
|
@@ -5,6 +5,8 @@ import DataSourceContext from "./DataSourceContext";
|
|
|
5
5
|
import useActions from "../../hooks/useActions";
|
|
6
6
|
import useVariables from "../../hooks/useVariables";
|
|
7
7
|
import useDataSource from "../../hooks/useDataSource";
|
|
8
|
+
import useSetRequest from "../../../../hooks/useSetRequest";
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @title: DataSource Provider
|
|
10
12
|
* @description: 提供页面配置的数据源
|
|
@@ -13,6 +15,7 @@ var DataSourceProvider = function DataSourceProvider(props) {
|
|
|
13
15
|
var children = props.children,
|
|
14
16
|
propsDataSource = props.dataSource,
|
|
15
17
|
currentValue = props.currentValue;
|
|
18
|
+
useSetRequest();
|
|
16
19
|
var _useVariables = useVariables(),
|
|
17
20
|
parseVariable = _useVariables.parseVariable;
|
|
18
21
|
var _useDataSource = useDataSource(),
|
|
@@ -22,7 +25,6 @@ var DataSourceProvider = function DataSourceProvider(props) {
|
|
|
22
25
|
currentDataSource: ctxDataSource
|
|
23
26
|
}
|
|
24
27
|
}) : propsDataSource;
|
|
25
|
-
console.log(dataSource, 'dataSource');
|
|
26
28
|
var _useActions = useActions({
|
|
27
29
|
dataSource: dataSource,
|
|
28
30
|
currentValue: currentValue
|
|
@@ -6,6 +6,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Divider from "../Divider";
|
|
9
|
+
import { locales } from '@pisell/utils';
|
|
9
10
|
import CollapsibleList from "./components/collapsibleList";
|
|
10
11
|
import { renderBundles } from "./components/collapsibleList/utils";
|
|
11
12
|
import "./index.less";
|
|
@@ -18,7 +19,7 @@ var Packages = function Packages(_ref) {
|
|
|
18
19
|
className: "".concat(prefix, "product-packages-wrap")
|
|
19
20
|
}, /*#__PURE__*/React.createElement("div", {
|
|
20
21
|
className: "".concat(prefix, "product-packages-title")
|
|
21
|
-
},
|
|
22
|
+
}, locales.getText('pisell2.product.card.items.package')), /*#__PURE__*/React.createElement(CollapsibleList, {
|
|
22
23
|
list: bundle || [],
|
|
23
24
|
renderItem: function renderItem(items) {
|
|
24
25
|
return renderBundles(_objectSpread(_objectSpread({}, items), {}, {
|
|
@@ -13,14 +13,19 @@ var useOpenNote = function useOpenNote(_ref, ref) {
|
|
|
13
13
|
_useState2 = _slicedToArray(_useState, 2),
|
|
14
14
|
open = _useState2[0],
|
|
15
15
|
setOpen = _useState2[1];
|
|
16
|
-
var _useState3 = useState(),
|
|
16
|
+
var _useState3 = useState({}),
|
|
17
17
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
item = _useState4[0],
|
|
19
|
+
setItem = _useState4[1];
|
|
20
|
+
var _useState5 = useState(),
|
|
21
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
22
|
+
value = _useState6[0],
|
|
23
|
+
setValue = _useState6[1];
|
|
20
24
|
useImperativeHandle(ref, function () {
|
|
21
25
|
return {
|
|
22
26
|
open: function open(_ref2) {
|
|
23
27
|
var item = _ref2.item;
|
|
28
|
+
setItem(item);
|
|
24
29
|
setValue(item === null || item === void 0 ? void 0 : item.note);
|
|
25
30
|
setOpen(true);
|
|
26
31
|
}
|
|
@@ -35,7 +40,7 @@ var useOpenNote = function useOpenNote(_ref, ref) {
|
|
|
35
40
|
bodyStyle: {
|
|
36
41
|
padding: 0
|
|
37
42
|
},
|
|
38
|
-
title:
|
|
43
|
+
title: item !== null && item !== void 0 && item.note ? locales.getText('pisell2.product.card.discount.edit.note') : locales.getText('pisell2.product.card.discount.add.note'),
|
|
39
44
|
onCancel: function onCancel() {
|
|
40
45
|
return setOpen(false);
|
|
41
46
|
},
|
|
@@ -46,6 +51,7 @@ var useOpenNote = function useOpenNote(_ref, ref) {
|
|
|
46
51
|
cancelText: locales.getText('pisell2.product.card.cancel')
|
|
47
52
|
}, /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
48
53
|
size: "large",
|
|
54
|
+
placeholder: locales.getText('pisell2.product.card.note.pla'),
|
|
49
55
|
autoSize: {
|
|
50
56
|
minRows: 4
|
|
51
57
|
},
|
|
@@ -6,7 +6,9 @@ declare const _default: {
|
|
|
6
6
|
'pisell2.product.card.discount.add.note': string;
|
|
7
7
|
'pisell2.product.card.discount.edit.note': string;
|
|
8
8
|
'pisell2.product.card.confirm': string;
|
|
9
|
-
'pisell2.product.card.
|
|
9
|
+
'pisell2.product.card.cancel': string;
|
|
10
|
+
'pisell2.product.card.note.pla': string;
|
|
11
|
+
'pisell2.product.card.items.package': string;
|
|
10
12
|
};
|
|
11
13
|
'zh-CN': {
|
|
12
14
|
'pisell2.product.card.day': (val: number) => string;
|
|
@@ -15,7 +17,9 @@ declare const _default: {
|
|
|
15
17
|
'pisell2.product.card.discount.add.note': string;
|
|
16
18
|
'pisell2.product.card.discount.edit.note': string;
|
|
17
19
|
'pisell2.product.card.confirm': string;
|
|
18
|
-
'pisell2.product.card.
|
|
20
|
+
'pisell2.product.card.cancel': string;
|
|
21
|
+
'pisell2.product.card.note.pla': string;
|
|
22
|
+
'pisell2.product.card.items.package': string;
|
|
19
23
|
};
|
|
20
24
|
'zh-HK': {
|
|
21
25
|
'pisell2.product.card.day': (val: number) => string;
|
|
@@ -24,7 +28,9 @@ declare const _default: {
|
|
|
24
28
|
'pisell2.product.card.discount.add.note': string;
|
|
25
29
|
'pisell2.product.card.discount.edit.note': string;
|
|
26
30
|
'pisell2.product.card.confirm': string;
|
|
27
|
-
'pisell2.product.card.
|
|
31
|
+
'pisell2.product.card.cancel': string;
|
|
32
|
+
'pisell2.product.card.note.pla': string;
|
|
33
|
+
'pisell2.product.card.items.package': string;
|
|
28
34
|
};
|
|
29
35
|
};
|
|
30
36
|
export default _default;
|
|
@@ -8,7 +8,9 @@ export default {
|
|
|
8
8
|
'pisell2.product.card.discount.add.note': 'Add note',
|
|
9
9
|
'pisell2.product.card.discount.edit.note': 'Edit note',
|
|
10
10
|
'pisell2.product.card.confirm': 'Confirm',
|
|
11
|
-
'pisell2.product.card.
|
|
11
|
+
'pisell2.product.card.cancel': 'Cancel',
|
|
12
|
+
'pisell2.product.card.note.pla': 'Please enter the note',
|
|
13
|
+
'pisell2.product.card.items.package': 'Items in package'
|
|
12
14
|
},
|
|
13
15
|
'zh-CN': {
|
|
14
16
|
'pisell2.product.card.day': function pisell2ProductCardDay(val) {
|
|
@@ -19,7 +21,9 @@ export default {
|
|
|
19
21
|
'pisell2.product.card.discount.add.note': '添加备注',
|
|
20
22
|
'pisell2.product.card.discount.edit.note': '编辑备注',
|
|
21
23
|
'pisell2.product.card.confirm': '确定',
|
|
22
|
-
'pisell2.product.card.
|
|
24
|
+
'pisell2.product.card.cancel': '取消',
|
|
25
|
+
'pisell2.product.card.note.pla': '请输入备注',
|
|
26
|
+
'pisell2.product.card.items.package': '包含的商品'
|
|
23
27
|
},
|
|
24
28
|
'zh-HK': {
|
|
25
29
|
'pisell2.product.card.day': function pisell2ProductCardDay(val) {
|
|
@@ -30,6 +34,8 @@ export default {
|
|
|
30
34
|
'pisell2.product.card.discount.add.note': '添加備註',
|
|
31
35
|
'pisell2.product.card.discount.edit.note': '編輯備註',
|
|
32
36
|
'pisell2.product.card.confirm': '確定',
|
|
33
|
-
'pisell2.product.card.
|
|
37
|
+
'pisell2.product.card.cancel': '取消',
|
|
38
|
+
'pisell2.product.card.note.pla': '請輸入備註',
|
|
39
|
+
'pisell2.product.card.items.package': '包含的商品'
|
|
34
40
|
}
|
|
35
41
|
};
|
|
@@ -37,7 +37,6 @@ var import_classnames = __toESM(require("classnames"));
|
|
|
37
37
|
var import_useDataSource = __toESM(require("../hooks/useDataSource"));
|
|
38
38
|
var import_form = __toESM(require("../../form"));
|
|
39
39
|
var import_FormSettingProvider = __toESM(require("./provider/formSetting/FormSettingProvider"));
|
|
40
|
-
var import_useSetRequest = __toESM(require("../../../hooks/useSetRequest"));
|
|
41
40
|
var import_index = require("./index.less");
|
|
42
41
|
var BaseForm = (0, import_react.forwardRef)(
|
|
43
42
|
(props, ref) => {
|
|
@@ -55,7 +54,6 @@ var BaseForm = (0, import_react.forwardRef)(
|
|
|
55
54
|
className,
|
|
56
55
|
...others
|
|
57
56
|
} = props;
|
|
58
|
-
(0, import_useSetRequest.default)();
|
|
59
57
|
const formRef = (0, import_react.useRef)(null);
|
|
60
58
|
const { get } = (0, import_useDataSource.default)();
|
|
61
59
|
(0, import_react.useEffect)(() => {
|
|
@@ -38,8 +38,8 @@ var import_pisellToast = __toESM(require("../../../pisellToast"));
|
|
|
38
38
|
var import_pisellModal = __toESM(require("../../../pisellModal"));
|
|
39
39
|
var import_formItem = __toESM(require("../formItem"));
|
|
40
40
|
var import_useFormSetting = __toESM(require("../provider/hooks/useFormSetting"));
|
|
41
|
-
var import_useActions = __toESM(require("../../hooks/useActions"));
|
|
42
41
|
var import_useCtxActions = __toESM(require("../../hooks/useCtxActions"));
|
|
42
|
+
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
43
43
|
var import_index = require("./index.less");
|
|
44
44
|
var SubmitButton = (props) => {
|
|
45
45
|
const {
|
|
@@ -58,15 +58,15 @@ var SubmitButton = (props) => {
|
|
|
58
58
|
const form = import_antd.Form.useFormInstance();
|
|
59
59
|
const { mode } = (0, import_useFormSetting.default)();
|
|
60
60
|
const { setVisible, refreshTableData } = (0, import_useCtxActions.default)();
|
|
61
|
-
const { create, update } = (0,
|
|
61
|
+
const { create, update } = (0, import_useDataSource.default)();
|
|
62
62
|
const isDisabled = status === "disabled";
|
|
63
63
|
const onSubmit = async (values) => {
|
|
64
64
|
try {
|
|
65
65
|
setLoading(true);
|
|
66
66
|
if (mode === "edit") {
|
|
67
|
-
await update(values);
|
|
67
|
+
await update.runAsync(values);
|
|
68
68
|
} else if (mode === "add") {
|
|
69
|
-
const res = await create(values);
|
|
69
|
+
const res = await create.runAsync(values);
|
|
70
70
|
form == null ? void 0 : form.resetFields();
|
|
71
71
|
}
|
|
72
72
|
} catch (error) {
|
|
@@ -42,10 +42,10 @@ var import_ActionsProvider = __toESM(require("../provider/actions/ActionsProvide
|
|
|
42
42
|
var import_useDrawerState = __toESM(require("./hooks/useDrawerState"));
|
|
43
43
|
var import_useDesignMode = __toESM(require("./hooks/useDesignMode"));
|
|
44
44
|
var import_useTableQuery = __toESM(require("./hooks/useTableQuery"));
|
|
45
|
-
var import_useSetRequest = __toESM(require("../../../hooks/useSetRequest"));
|
|
46
45
|
var import_locales = require("../../../locales");
|
|
47
46
|
var import_useDataSource = __toESM(require("../hooks/useDataSource"));
|
|
48
47
|
var import_TableSettingProvider = __toESM(require("./provider/tableSetting/TableSettingProvider"));
|
|
48
|
+
var import_useDataSourceKey = __toESM(require("./hooks/useDataSourceKey"));
|
|
49
49
|
var DRAWER_TITLES = {
|
|
50
50
|
detail: (0, import_locales.getText)("pisell-data-source-table-detail"),
|
|
51
51
|
edit: (0, import_locales.getText)("pisell-data-source-table-edit"),
|
|
@@ -65,10 +65,10 @@ var BaseTable = (props) => {
|
|
|
65
65
|
__designMode,
|
|
66
66
|
...others
|
|
67
67
|
} = props;
|
|
68
|
-
(0, import_useSetRequest.default)();
|
|
69
68
|
const { registerVariable } = (0, import_useVariables.default)();
|
|
70
69
|
const { list, destroy } = (0, import_useDataSource.default)();
|
|
71
70
|
const { data } = list;
|
|
71
|
+
const { dataSourceKey, dataSourceKeyRef } = (0, import_useDataSourceKey.default)();
|
|
72
72
|
const {
|
|
73
73
|
drawerVisible,
|
|
74
74
|
setDrawerVisible,
|
|
@@ -77,14 +77,22 @@ var BaseTable = (props) => {
|
|
|
77
77
|
closeDrawer
|
|
78
78
|
} = (0, import_useDrawerState.default)();
|
|
79
79
|
const { queryPageConfig, handleValuesChange, refreshData } = (0, import_useTableQuery.default)();
|
|
80
|
-
(0, import_useDesignMode.default)(props, {
|
|
80
|
+
(0, import_useDesignMode.default)(props, {
|
|
81
|
+
registerVariable,
|
|
82
|
+
openDrawer,
|
|
83
|
+
closeDrawer,
|
|
84
|
+
data: data == null ? void 0 : data.data
|
|
85
|
+
});
|
|
86
|
+
(0, import_react.useEffect)(() => {
|
|
87
|
+
refreshData();
|
|
88
|
+
}, [dataSourceKey]);
|
|
81
89
|
(0, import_react.useEffect)(() => {
|
|
82
|
-
if (
|
|
90
|
+
if (dataSourceKeyRef.current) {
|
|
83
91
|
list == null ? void 0 : list.run(queryPageConfig);
|
|
84
92
|
} else {
|
|
85
93
|
list == null ? void 0 : list.mutate([]);
|
|
86
94
|
}
|
|
87
|
-
}, [
|
|
95
|
+
}, [queryPageConfig]);
|
|
88
96
|
const handleOpenDrawer = (record, type) => {
|
|
89
97
|
openDrawer(type);
|
|
90
98
|
registerVariable == null ? void 0 : registerVariable({
|
|
@@ -98,13 +106,18 @@ var BaseTable = (props) => {
|
|
|
98
106
|
});
|
|
99
107
|
};
|
|
100
108
|
const handleDelete = async (record) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
try {
|
|
110
|
+
registerVariable == null ? void 0 : registerVariable({
|
|
111
|
+
currentRecord: record
|
|
112
|
+
});
|
|
113
|
+
setTimeout(async () => {
|
|
114
|
+
await (destroy == null ? void 0 : destroy.run(record.id));
|
|
115
|
+
refreshData();
|
|
116
|
+
});
|
|
117
|
+
} catch (error) {
|
|
118
|
+
console.error(error);
|
|
119
|
+
import_antd.message.error("删除失败,请重试");
|
|
120
|
+
}
|
|
108
121
|
};
|
|
109
122
|
const actionsColumns = (0, import_react.useMemo)(() => {
|
|
110
123
|
return [
|
|
@@ -140,15 +153,15 @@ var BaseTable = (props) => {
|
|
|
140
153
|
// 操作列
|
|
141
154
|
actionsColumns
|
|
142
155
|
});
|
|
143
|
-
const pagination = (0, import_usePagination.default)({ data
|
|
144
|
-
const
|
|
156
|
+
const pagination = (0, import_usePagination.default)({ data });
|
|
157
|
+
const drawerContent = (0, import_react.useMemo)(() => {
|
|
145
158
|
const contentMap = {
|
|
146
159
|
detail: detailContent,
|
|
147
160
|
edit: editContent,
|
|
148
161
|
add: addContent
|
|
149
162
|
};
|
|
150
|
-
return contentMap[
|
|
151
|
-
};
|
|
163
|
+
return contentMap[drawerType];
|
|
164
|
+
}, [drawerType, detailContent, editContent, addContent]);
|
|
152
165
|
return /* @__PURE__ */ import_react.default.createElement(import_TableSettingProvider.default, null, showAddButton && /* @__PURE__ */ import_react.default.createElement("div", { style: { marginBottom: 16 } }, /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { type: "primary", onClick: () => handleOpenDrawer(null, "add") }, (0, import_locales.getText)("pisell-data-source-table-add"))), /* @__PURE__ */ import_react.default.createElement(
|
|
153
166
|
import_table.default,
|
|
154
167
|
{
|
|
@@ -174,7 +187,7 @@ var BaseTable = (props) => {
|
|
|
174
187
|
onClose: handleCloseDrawer,
|
|
175
188
|
destroyOnClose: true
|
|
176
189
|
},
|
|
177
|
-
|
|
190
|
+
drawerContent
|
|
178
191
|
)
|
|
179
192
|
));
|
|
180
193
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
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/dataSourceTable/hooks/useDataSourceKey.ts
|
|
30
|
+
var useDataSourceKey_exports = {};
|
|
31
|
+
__export(useDataSourceKey_exports, {
|
|
32
|
+
default: () => useDataSourceKey_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(useDataSourceKey_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_utils = require("@pisell/utils");
|
|
37
|
+
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
38
|
+
var useDataSourceKey = () => {
|
|
39
|
+
const { dataSource } = (0, import_useDataSource.default)();
|
|
40
|
+
const dataSourceKey = (0, import_react.useMemo)(() => {
|
|
41
|
+
return (0, import_utils.isString)(dataSource) ? dataSource : dataSource == null ? void 0 : dataSource.key;
|
|
42
|
+
}, [dataSource]);
|
|
43
|
+
const dataSourceKeyRef = (0, import_react.useRef)(dataSourceKey);
|
|
44
|
+
dataSourceKeyRef.current = dataSourceKey;
|
|
45
|
+
return {
|
|
46
|
+
dataSourceKey,
|
|
47
|
+
dataSourceKeyRef
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var useDataSourceKey_default = useDataSourceKey;
|
|
@@ -39,8 +39,10 @@ var import_DataSourceContext = __toESM(require("./DataSourceContext"));
|
|
|
39
39
|
var import_useActions = __toESM(require("../../hooks/useActions"));
|
|
40
40
|
var import_useVariables = __toESM(require("../../hooks/useVariables"));
|
|
41
41
|
var import_useDataSource = __toESM(require("../../hooks/useDataSource"));
|
|
42
|
+
var import_useSetRequest = __toESM(require("../../../../hooks/useSetRequest"));
|
|
42
43
|
var DataSourceProvider = (props) => {
|
|
43
44
|
const { children, dataSource: propsDataSource, currentValue } = props;
|
|
45
|
+
(0, import_useSetRequest.default)();
|
|
44
46
|
const { parseVariable } = (0, import_useVariables.default)();
|
|
45
47
|
const { dataSource: ctxDataSource } = (0, import_useDataSource.default)();
|
|
46
48
|
const dataSource = (0, import_utils.isString)(propsDataSource) ? parseVariable == null ? void 0 : parseVariable(propsDataSource, {
|
|
@@ -48,7 +50,6 @@ var DataSourceProvider = (props) => {
|
|
|
48
50
|
currentDataSource: ctxDataSource
|
|
49
51
|
}
|
|
50
52
|
}) : propsDataSource;
|
|
51
|
-
console.log(dataSource, "dataSource");
|
|
52
53
|
const { list, get, update, create, destroy } = (0, import_useActions.default)({
|
|
53
54
|
dataSource,
|
|
54
55
|
currentValue
|
|
@@ -34,17 +34,18 @@ __export(Packages_exports, {
|
|
|
34
34
|
module.exports = __toCommonJS(Packages_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_Divider = __toESM(require("../Divider"));
|
|
37
|
+
var import_utils = require("@pisell/utils");
|
|
37
38
|
var import_collapsibleList = __toESM(require("./components/collapsibleList"));
|
|
38
|
-
var
|
|
39
|
+
var import_utils2 = require("./components/collapsibleList/utils");
|
|
39
40
|
var import_index = require("./index.less");
|
|
40
41
|
var prefix = "pisell-lowcode-";
|
|
41
42
|
var Packages = ({ item, isShowPackageNote }) => {
|
|
42
43
|
const bundle = (item == null ? void 0 : item.bundle) || [];
|
|
43
|
-
return (bundle == null ? void 0 : bundle.length) > 0 ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Divider.default, null), /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}product-packages-wrap` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}product-packages-title` }, "
|
|
44
|
+
return (bundle == null ? void 0 : bundle.length) > 0 ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_Divider.default, null), /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}product-packages-wrap` }, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}product-packages-title` }, import_utils.locales.getText("pisell2.product.card.items.package")), /* @__PURE__ */ import_react.default.createElement(
|
|
44
45
|
import_collapsibleList.default,
|
|
45
46
|
{
|
|
46
47
|
list: bundle || [],
|
|
47
|
-
renderItem: (items) => (0,
|
|
48
|
+
renderItem: (items) => (0, import_utils2.renderBundles)(
|
|
48
49
|
{ ...items, symbol: item == null ? void 0 : item.symbol, total: items == null ? void 0 : items.price },
|
|
49
50
|
false,
|
|
50
51
|
isShowPackageNote
|