@pisell/materials 1.0.458 → 1.0.460
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/AmountFooter/index.js +1 -1
- package/es/components/productCard/components/Header/index.d.ts +1 -1
- package/es/components/productCard/components/Header/index.js +8 -6
- package/es/components/productCard/components/Note/index.d.ts +1 -1
- package/es/components/productCard/components/Note/index.js +8 -7
- package/es/components/productCard/components/Packages/index.js +2 -1
- package/es/components/productCard/hooks/useOpenNote.js +10 -4
- package/es/components/productCard/index.js +10 -5
- package/es/components/productCard/locales.d.ts +9 -3
- package/es/components/productCard/locales.js +9 -3
- package/es/components/productCard/status.d.ts +9 -0
- package/es/components/productCard/status.js +15 -0
- package/es/components/productCard/types.d.ts +1 -0
- 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/AmountFooter/index.js +1 -1
- package/lib/components/productCard/components/Header/index.d.ts +1 -1
- package/lib/components/productCard/components/Header/index.js +3 -2
- package/lib/components/productCard/components/Note/index.d.ts +1 -1
- package/lib/components/productCard/components/Note/index.js +4 -3
- package/lib/components/productCard/components/Packages/index.js +4 -3
- package/lib/components/productCard/hooks/useOpenNote.js +6 -3
- package/lib/components/productCard/index.js +4 -1
- package/lib/components/productCard/locales.d.ts +9 -3
- package/lib/components/productCard/locales.js +9 -3
- package/lib/components/productCard/status.d.ts +9 -0
- package/lib/components/productCard/status.js +36 -0
- package/lib/components/productCard/types.d.ts +1 -0
- 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
|
|
@@ -29,7 +29,7 @@ var Footer = function Footer(_ref) {
|
|
|
29
29
|
className: classNames("".concat(prefix, "packages-product-footer"), hideDivider && "".concat(prefix, "packages-product-hide-divider-footer"))
|
|
30
30
|
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, _formatAmount(item === null || item === void 0 ? void 0 : item.total, item === null || item === void 0 ? void 0 : item.symbol)), /*#__PURE__*/React.createElement("span", null, "\xD7".concat(item === null || item === void 0 ? void 0 : item.num)), /*#__PURE__*/React.createElement("span", {
|
|
31
31
|
className: "".concat(prefix, "packages-product-footer-total")
|
|
32
|
-
},
|
|
32
|
+
}, _formatAmount((item === null || item === void 0 ? void 0 : item.total) * (item === null || item === void 0 ? void 0 : item.num), item === null || item === void 0 ? void 0 : item.symbol))), isDiscount ? /*#__PURE__*/React.createElement("div", {
|
|
33
33
|
className: "".concat(prefix, "packages-product-footer-discount")
|
|
34
34
|
}, /*#__PURE__*/React.createElement("span", null, _formatAmount(item === null || item === void 0 ? void 0 : item.origin_total, item === null || item === void 0 ? void 0 : item.symbol)), /*#__PURE__*/React.createElement("span", null, _formatAmount((item === null || item === void 0 ? void 0 : item.origin_total) * (item === null || item === void 0 ? void 0 : item.num), item === null || item === void 0 ? void 0 : item.symbol, 2))) : null), isDiscount && (_item$_extend = item._extend) !== null && _item$_extend !== void 0 && _item$_extend.discount_reason && type === 'total' ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
|
|
35
35
|
className: "".concat(prefix, "product-item-discount-reason")
|
|
@@ -6,11 +6,13 @@ import { image, formatAmount } from '@pisell/utils';
|
|
|
6
6
|
import Options from "../Packages/components/options";
|
|
7
7
|
import "./index.less";
|
|
8
8
|
var prefix = 'pisell-lowcode-';
|
|
9
|
-
var Header = function Header(
|
|
10
|
-
var isShowDelete =
|
|
11
|
-
item =
|
|
12
|
-
showImage =
|
|
13
|
-
onDelete =
|
|
9
|
+
var Header = function Header(props) {
|
|
10
|
+
var isShowDelete = props.isShowDelete,
|
|
11
|
+
item = props.item,
|
|
12
|
+
showImage = props.showImage,
|
|
13
|
+
onDelete = props.onDelete,
|
|
14
|
+
disabledEdit = props.disabledEdit;
|
|
15
|
+
|
|
14
16
|
/**
|
|
15
17
|
* @title: 是否显示价格
|
|
16
18
|
* @description:
|
|
@@ -38,7 +40,7 @@ var Header = function Header(_ref) {
|
|
|
38
40
|
}, [item === null || item === void 0 ? void 0 : item.options, item === null || item === void 0 ? void 0 : item.product_option_string]);
|
|
39
41
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
42
|
className: classNames("".concat(prefix, "product-header"), headerCenterStyle && "".concat(prefix, "product-options-header"))
|
|
41
|
-
}, isShowDelete ? /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
}, isShowDelete && !disabledEdit ? /*#__PURE__*/React.createElement("div", {
|
|
42
44
|
className: "".concat(prefix, "product-delete"),
|
|
43
45
|
onClick: function onClick(e) {
|
|
44
46
|
e.stopPropagation();
|
|
@@ -4,21 +4,22 @@ import { locales } from '@pisell/utils';
|
|
|
4
4
|
import Divider from "../Divider";
|
|
5
5
|
import "./index.less";
|
|
6
6
|
var prefix = 'pisell-lowcode-';
|
|
7
|
-
var Note = function Note(
|
|
8
|
-
var item =
|
|
9
|
-
type =
|
|
10
|
-
openNote =
|
|
11
|
-
|
|
7
|
+
var Note = function Note(props) {
|
|
8
|
+
var item = props.item,
|
|
9
|
+
type = props.type,
|
|
10
|
+
openNote = props.openNote,
|
|
11
|
+
disabledEdit = props.disabledEdit;
|
|
12
|
+
return item !== null && item !== void 0 && item.note || !disabledEdit ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
12
13
|
type: type
|
|
13
14
|
}), /*#__PURE__*/React.createElement("div", {
|
|
14
15
|
className: classNames("".concat(prefix, "product-note-wrap"))
|
|
15
|
-
}, item !== null && item !== void 0 && item.note ? /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.product.card.discount.note'), ": ", item.note) : null, /*#__PURE__*/React.createElement("span", {
|
|
16
|
+
}, item !== null && item !== void 0 && item.note ? /*#__PURE__*/React.createElement("div", null, locales.getText('pisell2.product.card.discount.note'), ": ", item.note) : null, !disabledEdit ? /*#__PURE__*/React.createElement("span", {
|
|
16
17
|
className: "".concat(prefix, "product-note-btn"),
|
|
17
18
|
onClick: function onClick(e) {
|
|
18
19
|
e.preventDefault();
|
|
19
20
|
e.stopPropagation();
|
|
20
21
|
openNote();
|
|
21
22
|
}
|
|
22
|
-
}, item !== null && item !== void 0 && item.note ? locales.getText('pisell2.product.card.discount.edit.note') : locales.getText('pisell2.product.card.discount.add.note'))));
|
|
23
|
+
}, item !== null && item !== void 0 && item.note ? locales.getText('pisell2.product.card.discount.edit.note') : locales.getText('pisell2.product.card.discount.add.note')) : null)) : null;
|
|
23
24
|
};
|
|
24
25
|
export default Note;
|
|
@@ -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
|
},
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["dataSource", "isShowImage", "isShowHolder", "isShowNote", "isShowDelete", "isShowPackageNote", "onAction", "onDelete", "onNote", "onLike", "onCard"];
|
|
2
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
7
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
8
|
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); }
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
7
11
|
import React, { useMemo, useRef } from 'react';
|
|
8
12
|
import classNames from 'classnames';
|
|
9
13
|
import { Alert } from 'antd';
|
|
@@ -37,7 +41,8 @@ var ProductCard = function ProductCard(props) {
|
|
|
37
41
|
_onDelete = props.onDelete,
|
|
38
42
|
onNote = props.onNote,
|
|
39
43
|
_onLike = props.onLike,
|
|
40
|
-
onCard = props.onCard
|
|
44
|
+
onCard = props.onCard,
|
|
45
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
41
46
|
var useOpenNoteRef = useRef();
|
|
42
47
|
|
|
43
48
|
/**
|
|
@@ -73,7 +78,7 @@ var ProductCard = function ProductCard(props) {
|
|
|
73
78
|
e.stopPropagation();
|
|
74
79
|
onCard === null || onCard === void 0 ? void 0 : onCard(dataSource);
|
|
75
80
|
}
|
|
76
|
-
}, /*#__PURE__*/React.createElement(Header, {
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Header, _extends({}, other, {
|
|
77
82
|
item: dataSource,
|
|
78
83
|
isShowImage: isShowImage,
|
|
79
84
|
isShowDelete: isShowDelete,
|
|
@@ -81,7 +86,7 @@ var ProductCard = function ProductCard(props) {
|
|
|
81
86
|
onDelete: function onDelete() {
|
|
82
87
|
_onDelete === null || _onDelete === void 0 ? void 0 : _onDelete(dataSource);
|
|
83
88
|
}
|
|
84
|
-
}), dataSource !== null && dataSource !== void 0 && dataSource._extend ? /*#__PURE__*/React.createElement(Time, {
|
|
89
|
+
})), dataSource !== null && dataSource !== void 0 && dataSource._extend ? /*#__PURE__*/React.createElement(Time, {
|
|
85
90
|
item: dataSource,
|
|
86
91
|
isShowHolder: isShowHolder,
|
|
87
92
|
onLike: function onLike(item) {
|
|
@@ -97,14 +102,14 @@ var ProductCard = function ProductCard(props) {
|
|
|
97
102
|
item: dataSource,
|
|
98
103
|
hideDivider: hideDivider,
|
|
99
104
|
type: "total"
|
|
100
|
-
}), isShowNote ? /*#__PURE__*/React.createElement(Note, {
|
|
105
|
+
}), isShowNote ? /*#__PURE__*/React.createElement(Note, _extends({}, other, {
|
|
101
106
|
item: dataSource,
|
|
102
107
|
openNote: function openNote() {
|
|
103
108
|
useOpenNoteRef.current.open({
|
|
104
109
|
item: dataSource
|
|
105
110
|
});
|
|
106
111
|
}
|
|
107
|
-
}) : null, dataSource !== null && dataSource !== void 0 && dataSource._showAction && dataSource !== null && dataSource !== void 0 && dataSource._actionText ? /*#__PURE__*/React.createElement(Action, {
|
|
112
|
+
})) : null, dataSource !== null && dataSource !== void 0 && dataSource._showAction && dataSource !== null && dataSource !== void 0 && dataSource._actionText ? /*#__PURE__*/React.createElement(Action, {
|
|
108
113
|
item: dataSource,
|
|
109
114
|
onAction: function onAction() {
|
|
110
115
|
return _onAction === null || _onAction === void 0 ? void 0 : _onAction(dataSource);
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @title: 默认数据
|
|
3
|
+
* @description:
|
|
4
|
+
* @return {*}
|
|
5
|
+
* @Author: WangHan
|
|
6
|
+
* @Date: 2024-12-12 16:49
|
|
7
|
+
*/
|
|
8
|
+
export var defaultValue = {
|
|
9
|
+
dataSource: {},
|
|
10
|
+
isShowImage: true,
|
|
11
|
+
isShowHolder: true,
|
|
12
|
+
isShowNote: true,
|
|
13
|
+
isShowDelete: true,
|
|
14
|
+
isShowPackageNote: true
|
|
15
|
+
};
|
|
@@ -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) {
|