@pisell/private-materials 3.0.13 → 3.0.14
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 +9 -9
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +8 -8
- package/es/components/booking/components/addButton/index.d.ts +8 -8
- package/es/components/booking/components/addButton/index.js +1 -1
- package/es/components/booking/components/drawer/index.d.ts +1 -1
- package/es/components/booking/components/footer/FooterMenus/index.js +1 -1
- package/es/components/booking/components/footer/index.js +23 -21
- package/es/components/booking/components/footer/utils.js +4 -3
- package/es/components/booking/forms/forms.js +2 -1
- package/es/components/booking/info/client/index.js +0 -1
- package/es/components/booking/info/date/index.less +1 -1
- package/es/components/booking/info/index.js +10 -4
- package/es/components/booking/info/pet/index.js +5 -7
- package/es/components/booking/info/service/addService/index.js +27 -11
- package/es/components/booking/info/service/editService/index.js +8 -7
- package/es/components/booking/info/service/index.js +1 -1
- package/es/components/booking/info/service/index.less +3 -0
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +3 -0
- package/es/components/booking/model.d.ts +11 -0
- package/es/components/booking/utils.js +2 -1
- package/es/components/index.d.ts +2 -1
- package/es/components/index.js +2 -1
- package/es/components/productExtension/card/index.d.ts +10 -0
- package/es/components/productExtension/card/index.js +20 -0
- package/es/components/productExtension/card/index.less +34 -0
- package/es/components/productExtension/fields/Actor/Container/index.d.ts +12 -0
- package/es/components/productExtension/fields/Actor/Container/index.js +34 -0
- package/es/components/productExtension/fields/Actor/Container/index.less +19 -0
- package/es/components/productExtension/fields/Actor/CutOffTime/index.d.ts +10 -0
- package/es/components/productExtension/fields/Actor/CutOffTime/index.js +94 -0
- package/es/components/productExtension/fields/Actor/CutOffTime/index.less +32 -0
- package/es/components/productExtension/fields/Actor/CutOffTime/status.d.ts +0 -0
- package/es/components/productExtension/fields/Actor/CutOffTime/status.js +0 -0
- package/es/components/productExtension/fields/Actor/index.d.ts +5 -0
- package/es/components/productExtension/fields/Actor/index.js +23 -0
- package/es/components/productExtension/fields/Forms/index.d.ts +10 -0
- package/es/components/productExtension/fields/Forms/index.js +184 -0
- package/es/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +4 -0
- package/es/components/productExtension/fields/SelectProducts/ProductItem/index.js +30 -0
- package/es/components/productExtension/fields/SelectProducts/ProductItem/index.less +69 -0
- package/es/components/productExtension/fields/SelectProducts/index.d.ts +10 -0
- package/es/components/productExtension/fields/SelectProducts/index.js +91 -0
- package/es/components/productExtension/fields/SelectProducts/index.less +30 -0
- package/es/components/productExtension/fields/SelectProducts/mock.d.ts +0 -0
- package/es/components/productExtension/fields/SelectProducts/mock.js +0 -0
- package/es/components/productExtension/fields/SelectProducts/server.d.ts +1 -0
- package/es/components/productExtension/fields/SelectProducts/server.js +29 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +4 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.js +198 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.less +0 -0
- package/es/components/productExtension/fields/SelectResourcesTable/mock.d.ts +2681 -0
- package/es/components/productExtension/fields/SelectResourcesTable/mock.js +5072 -0
- package/es/components/productExtension/fields/SelectResourcesTable/server.d.ts +2 -0
- package/es/components/productExtension/fields/SelectResourcesTable/server.js +49 -0
- package/es/components/productExtension/fields/index.d.ts +1 -0
- package/es/components/productExtension/fields/index.js +33 -0
- package/es/components/productExtension/index.d.ts +7 -0
- package/es/components/productExtension/index.js +77 -0
- package/es/components/productExtension/index.less +0 -0
- package/es/components/productExtension/locales.d.ts +48 -0
- package/es/components/productExtension/locales.js +47 -0
- package/es/components/productExtension/server.d.ts +1 -0
- package/es/components/productExtension/server.js +29 -0
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.d.ts +1 -1
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.js +21 -5
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.d.ts +5 -2
- package/es/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +20 -5
- package/es/components/selectModal/index.d.ts +24 -0
- package/es/components/selectModal/index.js +108 -0
- package/es/components/selectModal/index.less +0 -0
- package/es/components/tabProduct/card/index.d.ts +2 -2
- package/es/components/tabProduct/card/index.js +3 -4
- package/es/components/tabProduct/index.d.ts +4 -2
- package/es/components/tabProduct/index.js +10 -9
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils/index.d.ts +22 -0
- package/es/utils/index.js +56 -0
- package/lib/components/booking/components/addButton/index.d.ts +8 -8
- package/lib/components/booking/components/addButton/index.js +1 -1
- package/lib/components/booking/components/drawer/index.d.ts +1 -1
- package/lib/components/booking/components/footer/FooterMenus/index.js +1 -1
- package/lib/components/booking/components/footer/index.js +3 -1
- package/lib/components/booking/components/footer/utils.js +4 -2
- package/lib/components/booking/forms/forms.js +1 -1
- package/lib/components/booking/info/client/index.js +0 -1
- package/lib/components/booking/info/date/index.less +1 -1
- package/lib/components/booking/info/index.js +7 -1
- package/lib/components/booking/info/pet/index.js +5 -7
- package/lib/components/booking/info/service/addService/index.js +25 -10
- package/lib/components/booking/info/service/editService/index.js +7 -5
- package/lib/components/booking/info/service/index.js +1 -1
- package/lib/components/booking/info/service/index.less +3 -0
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +3 -0
- package/lib/components/booking/model.d.ts +11 -0
- package/lib/components/booking/utils.js +2 -1
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +3 -0
- package/lib/components/productExtension/card/index.d.ts +10 -0
- package/lib/components/productExtension/card/index.js +57 -0
- package/lib/components/productExtension/card/index.less +34 -0
- package/lib/components/productExtension/fields/Actor/Container/index.d.ts +12 -0
- package/lib/components/productExtension/fields/Actor/Container/index.js +64 -0
- package/lib/components/productExtension/fields/Actor/Container/index.less +19 -0
- package/lib/components/productExtension/fields/Actor/CutOffTime/index.d.ts +10 -0
- package/lib/components/productExtension/fields/Actor/CutOffTime/index.js +128 -0
- package/lib/components/productExtension/fields/Actor/CutOffTime/index.less +32 -0
- package/lib/components/productExtension/fields/Actor/CutOffTime/status.d.ts +0 -0
- package/lib/components/productExtension/fields/Actor/CutOffTime/status.js +0 -0
- package/lib/components/productExtension/fields/Actor/index.d.ts +5 -0
- package/lib/components/productExtension/fields/Actor/index.js +56 -0
- package/lib/components/productExtension/fields/Forms/index.d.ts +10 -0
- package/lib/components/productExtension/fields/Forms/index.js +108 -0
- package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.d.ts +4 -0
- package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.js +65 -0
- package/lib/components/productExtension/fields/SelectProducts/ProductItem/index.less +69 -0
- package/lib/components/productExtension/fields/SelectProducts/index.d.ts +10 -0
- package/lib/components/productExtension/fields/SelectProducts/index.js +111 -0
- package/lib/components/productExtension/fields/SelectProducts/index.less +30 -0
- package/lib/components/productExtension/fields/SelectProducts/mock.d.ts +0 -0
- package/lib/components/productExtension/fields/SelectProducts/mock.js +0 -0
- package/lib/components/productExtension/fields/SelectProducts/server.d.ts +1 -0
- package/lib/components/productExtension/fields/SelectProducts/server.js +33 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +4 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.js +179 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.less +0 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/mock.d.ts +2681 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/mock.js +12723 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/server.d.ts +2 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/server.js +39 -0
- package/lib/components/productExtension/fields/index.d.ts +1 -0
- package/lib/components/productExtension/fields/index.js +69 -0
- package/lib/components/productExtension/index.d.ts +7 -0
- package/lib/components/productExtension/index.js +108 -0
- package/lib/components/productExtension/index.less +0 -0
- package/lib/components/productExtension/locales.d.ts +48 -0
- package/lib/components/productExtension/locales.js +71 -0
- package/lib/components/productExtension/server.d.ts +1 -0
- package/lib/components/productExtension/server.js +33 -0
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.d.ts +1 -1
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/AddSchedules/index.js +11 -6
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.d.ts +5 -2
- package/lib/components/schedules/products/ProductDetailDrawer/ProductDetail/SchedulesModule/index.js +18 -4
- package/lib/components/selectModal/index.d.ts +24 -0
- package/lib/components/selectModal/index.js +133 -0
- package/lib/components/selectModal/index.less +0 -0
- package/lib/components/tabProduct/card/index.d.ts +2 -2
- package/lib/components/tabProduct/card/index.js +1 -2
- package/lib/components/tabProduct/index.d.ts +4 -2
- package/lib/components/tabProduct/index.js +7 -8
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/utils/index.d.ts +22 -0
- package/lib/utils/index.js +59 -0
- package/lowcode/product-extension/meta.ts +120 -0
- package/package.json +1 -1
|
@@ -0,0 +1,108 @@
|
|
|
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/productExtension/fields/Forms/index.tsx
|
|
30
|
+
var Forms_exports = {};
|
|
31
|
+
__export(Forms_exports, {
|
|
32
|
+
default: () => Forms_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Forms_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_forms = __toESM(require("../../../booking/forms/forms"));
|
|
37
|
+
var relation_type = "appointment_booking";
|
|
38
|
+
var Forms = (props) => {
|
|
39
|
+
const { relation_id, action, value, onChange, apis } = props;
|
|
40
|
+
const [formList, setFormList] = (0, import_react.useState)([]);
|
|
41
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
42
|
+
(0, import_react.useEffect)(() => {
|
|
43
|
+
geForms();
|
|
44
|
+
}, []);
|
|
45
|
+
const getFormDataById = async (item) => {
|
|
46
|
+
let _params = {
|
|
47
|
+
form_id: item.form_id,
|
|
48
|
+
skip: 1,
|
|
49
|
+
num: 999
|
|
50
|
+
};
|
|
51
|
+
let options = [];
|
|
52
|
+
const data = await apis.getPetsData(_params);
|
|
53
|
+
options = (data == null ? void 0 : data.list) || [];
|
|
54
|
+
return {
|
|
55
|
+
...item,
|
|
56
|
+
options
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const getFormData = async (formList2) => {
|
|
60
|
+
let all = [];
|
|
61
|
+
all = formList2.map((d) => getFormDataById(d));
|
|
62
|
+
return Promise.all(all);
|
|
63
|
+
};
|
|
64
|
+
const getFormValues = (data) => {
|
|
65
|
+
let _values = {};
|
|
66
|
+
for (let item of data) {
|
|
67
|
+
_values[item.form_id] = item.form_record;
|
|
68
|
+
}
|
|
69
|
+
return _values;
|
|
70
|
+
};
|
|
71
|
+
const geForms = async () => {
|
|
72
|
+
setLoading(true);
|
|
73
|
+
try {
|
|
74
|
+
let data = await apis.getForms({
|
|
75
|
+
relation_type,
|
|
76
|
+
relation_id
|
|
77
|
+
});
|
|
78
|
+
const formData = await getFormData(data);
|
|
79
|
+
setFormList(formData);
|
|
80
|
+
setLoading(false);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
console.log("form_error", err);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const onValueChange = (data) => {
|
|
86
|
+
const { values } = data;
|
|
87
|
+
onChange == null ? void 0 : onChange(values);
|
|
88
|
+
};
|
|
89
|
+
const addCallback = async (form) => {
|
|
90
|
+
let _data = [...formList];
|
|
91
|
+
const data = await getFormDataById(form);
|
|
92
|
+
_data = _data.map((d) => d.form_id === form.form_id ? data : d);
|
|
93
|
+
setFormList(_data);
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
96
|
+
import_forms.default,
|
|
97
|
+
{
|
|
98
|
+
forms: formList,
|
|
99
|
+
action,
|
|
100
|
+
modalOpen: false,
|
|
101
|
+
value,
|
|
102
|
+
onChange: onValueChange,
|
|
103
|
+
addCallback,
|
|
104
|
+
client: 0
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
var Forms_default = Forms;
|
|
@@ -0,0 +1,65 @@
|
|
|
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/productExtension/fields/SelectProducts/ProductItem/index.tsx
|
|
30
|
+
var ProductItem_exports = {};
|
|
31
|
+
__export(ProductItem_exports, {
|
|
32
|
+
default: () => ProductItem_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(ProductItem_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("@pisell/utils");
|
|
37
|
+
var import_classnames = __toESM(require("classnames"));
|
|
38
|
+
var import_index = require("./index.less");
|
|
39
|
+
var ProductItem = ({
|
|
40
|
+
item = {},
|
|
41
|
+
onClick,
|
|
42
|
+
amountSymbol = "$",
|
|
43
|
+
style,
|
|
44
|
+
className
|
|
45
|
+
}) => {
|
|
46
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
style,
|
|
50
|
+
className: (0, import_classnames.default)("product-item-card", className),
|
|
51
|
+
onClick: () => {
|
|
52
|
+
onClick(item);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
item.cover ? /* @__PURE__ */ import_react.default.createElement(
|
|
56
|
+
"img",
|
|
57
|
+
{
|
|
58
|
+
src: import_utils.image.ali(item.cover, 100),
|
|
59
|
+
className: "product-item-card-cover"
|
|
60
|
+
}
|
|
61
|
+
) : null,
|
|
62
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "product-item-card-content" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "product-item-card-title" }, item.title), /* @__PURE__ */ import_react.default.createElement("div", { className: "product-item-card-price" }, (0, import_utils.formatAmount)(item.price, 2, amountSymbol)))
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
var ProductItem_default = ProductItem;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
.product-item-card {
|
|
2
|
+
cursor: pointer;
|
|
3
|
+
padding: 16px;
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 12px;
|
|
8
|
+
|
|
9
|
+
&::before {
|
|
10
|
+
content: "";
|
|
11
|
+
position: absolute;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
left: 50%;
|
|
14
|
+
transform: translate(-50%, -50%);
|
|
15
|
+
width: calc(100% - 40px);
|
|
16
|
+
height: 1px;
|
|
17
|
+
background: #F1F1F1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:last-child {
|
|
21
|
+
&::before {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.product-item-card-cover {
|
|
27
|
+
width: 80px;
|
|
28
|
+
height: 80px;
|
|
29
|
+
border-radius: 8px;
|
|
30
|
+
object-fit: cover;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.product-item-card-content {
|
|
34
|
+
flex: 1;
|
|
35
|
+
|
|
36
|
+
.product-item-card-title {
|
|
37
|
+
color: var(--text-text-1, #1B1B1B);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
font-size: 14px;
|
|
41
|
+
font-style: normal;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
line-height: 20px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.product-item-card-time {
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
color: var(--text-text-2, #777);
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
font-style: normal;
|
|
54
|
+
font-weight: 400;
|
|
55
|
+
line-height: 18px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.product-item-card-price {
|
|
59
|
+
color: var(--text-text-1, #1B1B1B);
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
font-size: 14px;
|
|
63
|
+
font-style: normal;
|
|
64
|
+
font-weight: 400;
|
|
65
|
+
line-height: 20px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
interface valueType {
|
|
4
|
+
}
|
|
5
|
+
interface SelectProductsProps {
|
|
6
|
+
value?: valueType[];
|
|
7
|
+
onChange?: (value: valueType[]) => void;
|
|
8
|
+
}
|
|
9
|
+
declare const SelectProducts: ({ value, onChange }: SelectProductsProps) => React.JSX.Element;
|
|
10
|
+
export default SelectProducts;
|
|
@@ -0,0 +1,111 @@
|
|
|
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/productExtension/fields/SelectProducts/index.tsx
|
|
30
|
+
var SelectProducts_exports = {};
|
|
31
|
+
__export(SelectProducts_exports, {
|
|
32
|
+
default: () => SelectProducts_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(SelectProducts_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_ahooks = require("ahooks");
|
|
37
|
+
var import_selectModal = __toESM(require("../../../selectModal"));
|
|
38
|
+
var import_server = require("./server");
|
|
39
|
+
var import_ProductItem = __toESM(require("./ProductItem"));
|
|
40
|
+
var import_index = require("./index.less");
|
|
41
|
+
var import_utils = require("@pisell/utils");
|
|
42
|
+
var SelectProducts = ({ value, onChange }) => {
|
|
43
|
+
const [listMap, setListMap] = (0, import_react.useState)({});
|
|
44
|
+
const _getProductList = (0, import_ahooks.useRequest)(import_server.getProductList, {
|
|
45
|
+
manual: true,
|
|
46
|
+
onSuccess: (res) => {
|
|
47
|
+
let obj = {};
|
|
48
|
+
res.forEach((d) => {
|
|
49
|
+
obj[d.id] = d;
|
|
50
|
+
});
|
|
51
|
+
setListMap(obj);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const _value = (0, import_react.useMemo)(() => {
|
|
55
|
+
if (value && value.length) {
|
|
56
|
+
return value.map((d) => listMap[d.product_id] || d);
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}, [value, listMap]);
|
|
60
|
+
(0, import_react.useEffect)(() => {
|
|
61
|
+
_getProductList.run({
|
|
62
|
+
skip: 1,
|
|
63
|
+
num: 500,
|
|
64
|
+
with: ["category"],
|
|
65
|
+
open_quotation: 1
|
|
66
|
+
});
|
|
67
|
+
}, []);
|
|
68
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
69
|
+
import_selectModal.default,
|
|
70
|
+
{
|
|
71
|
+
value: _value,
|
|
72
|
+
loading: _getProductList.loading,
|
|
73
|
+
onChange: (arr) => {
|
|
74
|
+
onChange == null ? void 0 : onChange(
|
|
75
|
+
arr.map((d) => {
|
|
76
|
+
return {
|
|
77
|
+
product_collection_id: 0,
|
|
78
|
+
product_id: d.id || d.product_id,
|
|
79
|
+
product_variant_id: 0
|
|
80
|
+
};
|
|
81
|
+
})
|
|
82
|
+
);
|
|
83
|
+
},
|
|
84
|
+
dataSource: _getProductList.data,
|
|
85
|
+
renderValueItem: (item, onSelect) => {
|
|
86
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ProductItem.default, { key: item == null ? void 0 : item.id, item, onClick: onSelect });
|
|
87
|
+
},
|
|
88
|
+
renderOptionItem: (item, onSelect) => {
|
|
89
|
+
return /* @__PURE__ */ import_react.default.createElement(import_ProductItem.default, { key: item == null ? void 0 : item.id, item, onClick: onSelect });
|
|
90
|
+
},
|
|
91
|
+
buttonProps: {
|
|
92
|
+
showSub: !!(value == null ? void 0 : value.length),
|
|
93
|
+
title: import_utils.locales.getText("pisell2.text.product-extension.add-product"),
|
|
94
|
+
subTitle: import_utils.locales.getText(
|
|
95
|
+
"pisell2.text.product-extension.add-other-product"
|
|
96
|
+
)
|
|
97
|
+
},
|
|
98
|
+
drawerProps: {
|
|
99
|
+
width: 500,
|
|
100
|
+
title: import_utils.locales.getText("pisell2.text.product-extension.add-product"),
|
|
101
|
+
rootClassName: "select-product-drawer"
|
|
102
|
+
},
|
|
103
|
+
tabProductProps: {
|
|
104
|
+
warpClassName: "select-product-warp",
|
|
105
|
+
stickyTop: 188,
|
|
106
|
+
scrollDom: ".select-product-drawer .pisell-lowcode-drawer-body"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
var SelectProducts_default = SelectProducts;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
.select-product-warp {
|
|
2
|
+
.category-list {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
padding: 0 32px;
|
|
6
|
+
|
|
7
|
+
.category-title {
|
|
8
|
+
margin: 16px 0;
|
|
9
|
+
font-style: normal;
|
|
10
|
+
font-weight: 600;
|
|
11
|
+
font-size: 18px;
|
|
12
|
+
line-height: 24px;
|
|
13
|
+
color: #1b1b1b;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.product-list {
|
|
17
|
+
width: 100%;
|
|
18
|
+
background: #ffffff;
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
padding: 20px;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
margin-bottom: 20px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
background: #ffffff;
|
|
25
|
+
/* shadow-sm */
|
|
26
|
+
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1), 0px 1px 2px rgba(0, 0, 0, 0.06);
|
|
27
|
+
border-radius: 12px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getProductList: (params: any) => Promise<any>;
|
|
@@ -0,0 +1,33 @@
|
|
|
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/productExtension/fields/SelectProducts/server.ts
|
|
20
|
+
var server_exports = {};
|
|
21
|
+
__export(server_exports, {
|
|
22
|
+
getProductList: () => getProductList
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(server_exports);
|
|
25
|
+
var import_utils = require("../../../../utils/index");
|
|
26
|
+
var getProductList = async (params) => {
|
|
27
|
+
let { data } = await import_utils.request.getRequest().post("/shop/product/query", params, { abort: true });
|
|
28
|
+
return (data == null ? void 0 : data.list) || [];
|
|
29
|
+
};
|
|
30
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
+
0 && (module.exports = {
|
|
32
|
+
getProductList
|
|
33
|
+
});
|
|
@@ -0,0 +1,179 @@
|
|
|
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/productExtension/fields/SelectResourcesTable/index.tsx
|
|
30
|
+
var SelectResourcesTable_exports = {};
|
|
31
|
+
__export(SelectResourcesTable_exports, {
|
|
32
|
+
default: () => SelectResourcesTable_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(SelectResourcesTable_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_antd = require("antd");
|
|
37
|
+
var import_utils = require("@pisell/utils");
|
|
38
|
+
var import_server = require("./server");
|
|
39
|
+
var import_index = require("./index.less");
|
|
40
|
+
var sortArrayByOrder = (arr1, arr2, reverse) => {
|
|
41
|
+
return (arr1 || []).sort((a, b) => {
|
|
42
|
+
let _a = arr2.findIndex((item) => item.form_id === a.form_id);
|
|
43
|
+
let _b = arr2.findIndex((item) => item.form_id === b.form_id);
|
|
44
|
+
return reverse ? _a - _b : _b - _a;
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var SelectResourcesTable = ({ value, onChange }) => {
|
|
48
|
+
const Dom = window.BaseMaterials.Table;
|
|
49
|
+
const [data, setData] = (0, import_react.useState)([]);
|
|
50
|
+
const _getData = async () => {
|
|
51
|
+
let _getFormTypes = (0, import_server.getFormTypes)(
|
|
52
|
+
{ type: "manual", num: 500, skip: 1 },
|
|
53
|
+
{ useCache: true }
|
|
54
|
+
);
|
|
55
|
+
let _getAllResource = (0, import_server.getAllResource)(
|
|
56
|
+
{ num: 500, skip: 1 },
|
|
57
|
+
{ useCache: true }
|
|
58
|
+
);
|
|
59
|
+
const [forms, resources] = await Promise.all([
|
|
60
|
+
_getFormTypes,
|
|
61
|
+
_getAllResource
|
|
62
|
+
]);
|
|
63
|
+
let _data = (forms || []).reduce((arr, item) => {
|
|
64
|
+
const currentResource = (resources || []).filter(
|
|
65
|
+
(relation) => relation.form_id === item.id
|
|
66
|
+
);
|
|
67
|
+
if (currentResource.length > 0) {
|
|
68
|
+
arr.push({
|
|
69
|
+
label: item.title,
|
|
70
|
+
key: item.id,
|
|
71
|
+
value: item.id,
|
|
72
|
+
options: currentResource,
|
|
73
|
+
// 统一字段,方便后面处理
|
|
74
|
+
...item,
|
|
75
|
+
form_id: item.id
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return arr;
|
|
79
|
+
}, []);
|
|
80
|
+
setData(_data);
|
|
81
|
+
};
|
|
82
|
+
const _dataSource = (0, import_react.useMemo)(() => {
|
|
83
|
+
if (value) {
|
|
84
|
+
return (data || []).sort((a, b) => {
|
|
85
|
+
let _a = value.findIndex((item) => item.form_id === a.form_id);
|
|
86
|
+
let _b = value.findIndex((item) => item.form_id === b.form_id);
|
|
87
|
+
if (_a === -1 || _b === -1) {
|
|
88
|
+
return 999;
|
|
89
|
+
}
|
|
90
|
+
return _a - _b;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return data;
|
|
94
|
+
}, [data, value]);
|
|
95
|
+
const _onChange = (val, form_id) => {
|
|
96
|
+
let _value = JSON.parse(JSON.stringify(value || []));
|
|
97
|
+
let cur = _value.find((d) => d.form_id === form_id);
|
|
98
|
+
if (cur) {
|
|
99
|
+
cur.form_record_ids = val;
|
|
100
|
+
} else {
|
|
101
|
+
_value.push({ form_id, form_record_ids: val });
|
|
102
|
+
}
|
|
103
|
+
onChange == null ? void 0 : onChange(_value);
|
|
104
|
+
};
|
|
105
|
+
const columns = (0, import_react.useMemo)(() => {
|
|
106
|
+
return [
|
|
107
|
+
{
|
|
108
|
+
title: import_utils.locales.getText("pisell2.text.product-extension.resource-type"),
|
|
109
|
+
dataIndex: "title",
|
|
110
|
+
value,
|
|
111
|
+
data,
|
|
112
|
+
width: 100
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: import_utils.locales.getText("pisell2.text.product-extension.open"),
|
|
116
|
+
dataIndex: "open",
|
|
117
|
+
width: 80,
|
|
118
|
+
render: (text, record, index) => {
|
|
119
|
+
let cur = value == null ? void 0 : value.find((d) => d.form_id === record.form_id);
|
|
120
|
+
let bol = !!((cur == null ? void 0 : cur.form_record_ids) || []).length;
|
|
121
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
122
|
+
import_antd.Switch,
|
|
123
|
+
{
|
|
124
|
+
disabled: !bol,
|
|
125
|
+
checked: bol,
|
|
126
|
+
onChange: (e) => {
|
|
127
|
+
_onChange([], record.id);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
title: import_utils.locales.getText("pisell2.text.product-extension.options"),
|
|
135
|
+
dataIndex: "form_id",
|
|
136
|
+
render: (form_id, record, index) => {
|
|
137
|
+
let cur = value == null ? void 0 : value.find((d) => d.form_id === form_id);
|
|
138
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
139
|
+
import_antd.Select,
|
|
140
|
+
{
|
|
141
|
+
style: { width: "100%" },
|
|
142
|
+
mode: "multiple",
|
|
143
|
+
value: (cur == null ? void 0 : cur.form_record_ids) || [],
|
|
144
|
+
options: record.options,
|
|
145
|
+
popupMatchSelectWidth: false,
|
|
146
|
+
fieldNames: { label: "title", value: "id" },
|
|
147
|
+
onChange: (val) => {
|
|
148
|
+
_onChange(val, form_id);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
];
|
|
155
|
+
}, [value, _dataSource]);
|
|
156
|
+
const sortChange = (detail) => {
|
|
157
|
+
if (value && value.length) {
|
|
158
|
+
onChange == null ? void 0 : onChange(sortArrayByOrder(value, detail.dataSource));
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
(0, import_react.useEffect)(() => {
|
|
162
|
+
_getData();
|
|
163
|
+
}, []);
|
|
164
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
165
|
+
Dom,
|
|
166
|
+
{
|
|
167
|
+
className: "",
|
|
168
|
+
dragSort: true,
|
|
169
|
+
onSortChange: sortChange,
|
|
170
|
+
rowKey: "form_id",
|
|
171
|
+
columns,
|
|
172
|
+
dataSource: _dataSource,
|
|
173
|
+
pagination: false,
|
|
174
|
+
virtual: false,
|
|
175
|
+
scroll: { x: "auto" }
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
var SelectResourcesTable_default = SelectResourcesTable;
|
|
File without changes
|