@pisell/private-materials 3.0.77 → 3.0.78
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.js +6 -6
- package/build/lowcode/view.js +8 -8
- package/es/components/booking/components/customSelect/index.js +8 -2
- package/es/components/booking/forms/serve.d.ts +9 -0
- package/es/components/booking/forms/serve.js +25 -0
- package/es/components/booking/forms/single/RenderValueById.d.ts +6 -0
- package/es/components/booking/forms/single/RenderValueById.js +79 -0
- package/es/components/booking/forms/single/index.js +27 -0
- package/es/components/productExtension/fields/SelectResourcesTable/index.js +22 -10
- package/lib/components/booking/components/customSelect/index.js +7 -2
- package/lib/components/booking/forms/serve.d.ts +9 -0
- package/lib/components/booking/forms/serve.js +30 -0
- package/lib/components/booking/forms/single/RenderValueById.d.ts +6 -0
- package/lib/components/booking/forms/single/RenderValueById.js +106 -0
- package/lib/components/booking/forms/single/index.js +12 -0
- package/lib/components/productExtension/fields/SelectResourcesTable/index.js +16 -6
- package/package.json +3 -3
|
@@ -127,11 +127,15 @@ var CustomSelect = function CustomSelect(props, ref) {
|
|
|
127
127
|
* @Author: zhiwei.Wang
|
|
128
128
|
* @Date: 2024-01-30 16:45
|
|
129
129
|
*/
|
|
130
|
-
var closeDrawer = function closeDrawer() {
|
|
130
|
+
var closeDrawer = function closeDrawer(reset) {
|
|
131
131
|
// 关闭
|
|
132
132
|
setOpen(false);
|
|
133
133
|
// 清空搜索
|
|
134
134
|
setSearch("");
|
|
135
|
+
// 如果直接关闭弹窗, 则将value恢复到上一次的数据
|
|
136
|
+
if (reset) {
|
|
137
|
+
initValue();
|
|
138
|
+
}
|
|
135
139
|
// 回调
|
|
136
140
|
closeCallback === null || closeCallback === void 0 ? void 0 : closeCallback();
|
|
137
141
|
};
|
|
@@ -395,7 +399,9 @@ var CustomSelect = function CustomSelect(props, ref) {
|
|
|
395
399
|
}
|
|
396
400
|
}) : null) : null, /*#__PURE__*/React.createElement(Drawer, _extends({
|
|
397
401
|
open: open,
|
|
398
|
-
onClose:
|
|
402
|
+
onClose: function onClose() {
|
|
403
|
+
closeDrawer(true);
|
|
404
|
+
},
|
|
399
405
|
header: /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
|
|
400
406
|
ref: searchRef,
|
|
401
407
|
prefix: /*#__PURE__*/React.createElement(SearchLg, null),
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
import { request } from "../utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 获取表单数据
|
|
9
|
+
*/
|
|
10
|
+
export var getFormData = /*#__PURE__*/function () {
|
|
11
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
12
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13
|
+
while (1) switch (_context.prev = _context.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
return _context.abrupt("return", request.getRequest().get("/shop/form/data/v1", params));
|
|
16
|
+
case 1:
|
|
17
|
+
case "end":
|
|
18
|
+
return _context.stop();
|
|
19
|
+
}
|
|
20
|
+
}, _callee);
|
|
21
|
+
}));
|
|
22
|
+
return function getFormData(_x) {
|
|
23
|
+
return _ref.apply(this, arguments);
|
|
24
|
+
};
|
|
25
|
+
}();
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { useEffect, useMemo } from "react";
|
|
2
|
+
import { isArr, isUndefined } from "@pisell/utils";
|
|
3
|
+
import { Tag } from "antd";
|
|
4
|
+
import { useRequest } from "ahooks";
|
|
5
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
6
|
+
import { getFormData } from "../serve";
|
|
7
|
+
var RenderValueById = function RenderValueById(props) {
|
|
8
|
+
var _field$setting, _field$setting6;
|
|
9
|
+
var field = props.field,
|
|
10
|
+
propsValue = props.value;
|
|
11
|
+
var _useEngineContext = useEngineContext(),
|
|
12
|
+
appHelper = _useEngineContext.appHelper;
|
|
13
|
+
var _getFormData = useRequest(getFormData, {
|
|
14
|
+
manual: true,
|
|
15
|
+
cacheKey: "formOption-".concat((_field$setting = field.setting) === null || _field$setting === void 0 ? void 0 : _field$setting.linkedTable),
|
|
16
|
+
staleTime: 500,
|
|
17
|
+
cacheTime: 5000
|
|
18
|
+
});
|
|
19
|
+
var value = useMemo(function () {
|
|
20
|
+
var v = propsValue;
|
|
21
|
+
if (field.filed_type === "form_to_form") {
|
|
22
|
+
if (isArr(propsValue)) {
|
|
23
|
+
v = propsValue;
|
|
24
|
+
} else if (propsValue !== null && propsValue !== void 0 && propsValue.form_ids) {
|
|
25
|
+
v = propsValue.form_ids;
|
|
26
|
+
} else {
|
|
27
|
+
v = propsValue;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return v;
|
|
31
|
+
}, [propsValue]);
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
var _field$setting2;
|
|
34
|
+
if (field.filed_type === "form_to_form" && (_field$setting2 = field.setting) !== null && _field$setting2 !== void 0 && _field$setting2.linkedTable) {
|
|
35
|
+
var _field$setting3;
|
|
36
|
+
_getFormData.run({
|
|
37
|
+
form_record_ids: value,
|
|
38
|
+
form_id: (_field$setting3 = field.setting) === null || _field$setting3 === void 0 ? void 0 : _field$setting3.linkedTable,
|
|
39
|
+
skip: 1,
|
|
40
|
+
num: 999
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, [field.filed_type, value]);
|
|
44
|
+
var options = useMemo(function () {
|
|
45
|
+
var _field$setting4, _field$setting5;
|
|
46
|
+
if (field.filed_type === "form_to_form" && field !== null && field !== void 0 && (_field$setting4 = field.setting) !== null && _field$setting4 !== void 0 && _field$setting4.linkedTable) {
|
|
47
|
+
var _getFormData$data, _getFormData$data$dat, _getFormData$data$dat2;
|
|
48
|
+
return ((_getFormData$data = _getFormData.data) === null || _getFormData$data === void 0 ? void 0 : (_getFormData$data$dat = _getFormData$data.data) === null || _getFormData$data$dat === void 0 ? void 0 : (_getFormData$data$dat2 = _getFormData$data$dat.list) === null || _getFormData$data$dat2 === void 0 ? void 0 : _getFormData$data$dat2.map(function (item) {
|
|
49
|
+
return {
|
|
50
|
+
title: item.main_field,
|
|
51
|
+
id: item.form_record_id
|
|
52
|
+
};
|
|
53
|
+
})) || [];
|
|
54
|
+
}
|
|
55
|
+
return field === null || field === void 0 ? void 0 : (_field$setting5 = field.setting) === null || _field$setting5 === void 0 ? void 0 : _field$setting5.customTypeList;
|
|
56
|
+
}, [field.filed_type, field === null || field === void 0 ? void 0 : (_field$setting6 = field.setting) === null || _field$setting6 === void 0 ? void 0 : _field$setting6.customTypeList, _getFormData.data]);
|
|
57
|
+
if (isArr(value)) {
|
|
58
|
+
var _list = options === null || options === void 0 ? void 0 : options.filter(function (i) {
|
|
59
|
+
return value === null || value === void 0 ? void 0 : value.includes((i === null || i === void 0 ? void 0 : i.id) || i.value);
|
|
60
|
+
});
|
|
61
|
+
var _str = (_list === null || _list === void 0 ? void 0 : _list.map(function (i) {
|
|
62
|
+
var _appHelper$utils;
|
|
63
|
+
return /*#__PURE__*/React.createElement(Tag, null, appHelper === null || appHelper === void 0 ? void 0 : (_appHelper$utils = appHelper.utils) === null || _appHelper$utils === void 0 ? void 0 : _appHelper$utils.translationShop((i === null || i === void 0 ? void 0 : i.title) || (i === null || i === void 0 ? void 0 : i.label)));
|
|
64
|
+
})) || "-";
|
|
65
|
+
return /*#__PURE__*/React.createElement("span", null, _str || "-");
|
|
66
|
+
}
|
|
67
|
+
if (!isUndefined(value)) {
|
|
68
|
+
var _field$setting7, _appHelper$utils2, _item$, _item$2;
|
|
69
|
+
if ((field === null || field === void 0 ? void 0 : field.filed_type) === "select" && !(field !== null && field !== void 0 && (_field$setting7 = field.setting) !== null && _field$setting7 !== void 0 && _field$setting7.version)) {
|
|
70
|
+
return /*#__PURE__*/React.createElement("span", null, value || "-");
|
|
71
|
+
}
|
|
72
|
+
var _item = options === null || options === void 0 ? void 0 : options.filter(function (i) {
|
|
73
|
+
return (i === null || i === void 0 ? void 0 : i.id) == value;
|
|
74
|
+
});
|
|
75
|
+
return (appHelper === null || appHelper === void 0 ? void 0 : (_appHelper$utils2 = appHelper.utils) === null || _appHelper$utils2 === void 0 ? void 0 : _appHelper$utils2.translationShop((_item === null || _item === void 0 ? void 0 : (_item$ = _item[0]) === null || _item$ === void 0 ? void 0 : _item$.title) || (_item === null || _item === void 0 ? void 0 : (_item$2 = _item[0]) === null || _item$2 === void 0 ? void 0 : _item$2.label))) || "-";
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
export default RenderValueById;
|
|
@@ -5,6 +5,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
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; }
|
|
6
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
7
|
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); }
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
14
|
import React, { useCallback, useMemo } from "react";
|
|
9
15
|
import FileDownload02 from "@pisell/icon/es/FileDownload02";
|
|
10
16
|
import { image, locales } from "@pisell/utils";
|
|
@@ -12,6 +18,9 @@ import { Avatar } from "antd";
|
|
|
12
18
|
import CustomSelect from "../../components/customSelect";
|
|
13
19
|
import CollapsibleList from "../../components/collapsibleList";
|
|
14
20
|
import "./index.less";
|
|
21
|
+
import RenderValueById from "./RenderValueById";
|
|
22
|
+
import useComponents from "../../../../hooks/useComponents";
|
|
23
|
+
var queryValueById = ['checkbox', 'radioButton', 'select', 'form_to_form'];
|
|
15
24
|
|
|
16
25
|
/**
|
|
17
26
|
* @title: 表单选择器
|
|
@@ -37,6 +46,12 @@ var Single = function Single(_ref) {
|
|
|
37
46
|
// return field.field[0]?.key || "";
|
|
38
47
|
// }, [field]);
|
|
39
48
|
|
|
49
|
+
var _useComponents = useComponents({
|
|
50
|
+
components: ["HumanBodySelector"]
|
|
51
|
+
}),
|
|
52
|
+
_useComponents2 = _slicedToArray(_useComponents, 1),
|
|
53
|
+
HumanBodySelector = _useComponents2[0];
|
|
54
|
+
|
|
40
55
|
/**
|
|
41
56
|
* @title: 渲染表单内容
|
|
42
57
|
* @description:
|
|
@@ -103,6 +118,18 @@ var Single = function Single(_ref) {
|
|
|
103
118
|
return "(+".concat(val.country_calling_code, ") ").concat(val.phone);
|
|
104
119
|
}
|
|
105
120
|
}
|
|
121
|
+
if (field.filed_type === "body_hotspot_image") {
|
|
122
|
+
return HumanBodySelector ? /*#__PURE__*/React.createElement(HumanBodySelector, {
|
|
123
|
+
value: val,
|
|
124
|
+
disable: true
|
|
125
|
+
}) : val;
|
|
126
|
+
}
|
|
127
|
+
if (queryValueById.includes(field === null || field === void 0 ? void 0 : field.filed_type)) {
|
|
128
|
+
return /*#__PURE__*/React.createElement(RenderValueById, {
|
|
129
|
+
field: field,
|
|
130
|
+
value: val
|
|
131
|
+
});
|
|
132
|
+
}
|
|
106
133
|
return val || "-";
|
|
107
134
|
};
|
|
108
135
|
|
|
@@ -94,18 +94,30 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
|
|
|
94
94
|
}();
|
|
95
95
|
var _dataSource = useMemo(function () {
|
|
96
96
|
if (value) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
// 创建一个排序键对象
|
|
98
|
+
var sortOrder = {};
|
|
99
|
+
// 创建 arr1 的副本
|
|
100
|
+
var arr1Copy = data.slice();
|
|
101
|
+
value.forEach(function (item, index) {
|
|
102
|
+
sortOrder[item.form_id] = index;
|
|
103
|
+
});
|
|
104
|
+
arr1Copy.sort(function (a, b) {
|
|
105
|
+
// 如果 a 和 b 都在 sortOrder 中,则按 sortOrder 中的顺序排序
|
|
106
|
+
if (sortOrder[a.form_id] !== undefined && sortOrder[b.form_id] !== undefined) {
|
|
107
|
+
return sortOrder[a.form_id] - sortOrder[b.form_id];
|
|
108
|
+
}
|
|
109
|
+
// 如果只有 a 在 sortOrder 中,则 a 排在前面
|
|
110
|
+
if (sortOrder[a.form_id] !== undefined) {
|
|
111
|
+
return -1;
|
|
112
|
+
}
|
|
113
|
+
// 如果只有 b 在 sortOrder 中,则 b 排在前面
|
|
114
|
+
if (sortOrder[b.form_id] !== undefined) {
|
|
115
|
+
return 1;
|
|
106
116
|
}
|
|
107
|
-
|
|
117
|
+
// 如果 a 和 b 都不在 sortOrder 中,则保持原顺序
|
|
118
|
+
return 0;
|
|
108
119
|
});
|
|
120
|
+
return arr1Copy;
|
|
109
121
|
}
|
|
110
122
|
return data;
|
|
111
123
|
}, [data, value]);
|
|
@@ -98,9 +98,12 @@ var CustomSelect = (props, ref) => {
|
|
|
98
98
|
}
|
|
99
99
|
set_value(_val);
|
|
100
100
|
};
|
|
101
|
-
const closeDrawer = () => {
|
|
101
|
+
const closeDrawer = (reset) => {
|
|
102
102
|
setOpen(false);
|
|
103
103
|
setSearch("");
|
|
104
|
+
if (reset) {
|
|
105
|
+
initValue();
|
|
106
|
+
}
|
|
104
107
|
closeCallback == null ? void 0 : closeCallback();
|
|
105
108
|
};
|
|
106
109
|
const handleOpenModal = () => {
|
|
@@ -247,7 +250,9 @@ var CustomSelect = (props, ref) => {
|
|
|
247
250
|
import_drawer.default,
|
|
248
251
|
{
|
|
249
252
|
open,
|
|
250
|
-
onClose:
|
|
253
|
+
onClose: () => {
|
|
254
|
+
closeDrawer(true);
|
|
255
|
+
},
|
|
251
256
|
header: /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
|
|
252
257
|
import_antd.Input,
|
|
253
258
|
{
|
|
@@ -0,0 +1,30 @@
|
|
|
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/booking/forms/serve.ts
|
|
20
|
+
var serve_exports = {};
|
|
21
|
+
__export(serve_exports, {
|
|
22
|
+
getFormData: () => getFormData
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(serve_exports);
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
var getFormData = async (params) => import_utils.request.getRequest().get(`/shop/form/data/v1`, params);
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
getFormData
|
|
30
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
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/booking/forms/single/RenderValueById.tsx
|
|
30
|
+
var RenderValueById_exports = {};
|
|
31
|
+
__export(RenderValueById_exports, {
|
|
32
|
+
default: () => RenderValueById_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(RenderValueById_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_utils = require("@pisell/utils");
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_ahooks = require("ahooks");
|
|
39
|
+
var import_useEngineContext = __toESM(require("../../../../hooks/useEngineContext"));
|
|
40
|
+
var import_serve = require("../serve");
|
|
41
|
+
var RenderValueById = (props) => {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f;
|
|
43
|
+
const { field, value: propsValue } = props;
|
|
44
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
45
|
+
const _getFormData = (0, import_ahooks.useRequest)(import_serve.getFormData, {
|
|
46
|
+
manual: true,
|
|
47
|
+
cacheKey: `formOption-${(_a = field.setting) == null ? void 0 : _a.linkedTable}`,
|
|
48
|
+
staleTime: 500,
|
|
49
|
+
cacheTime: 5e3
|
|
50
|
+
});
|
|
51
|
+
const value = (0, import_react.useMemo)(() => {
|
|
52
|
+
let v = propsValue;
|
|
53
|
+
if (field.filed_type === "form_to_form") {
|
|
54
|
+
if ((0, import_utils.isArr)(propsValue)) {
|
|
55
|
+
v = propsValue;
|
|
56
|
+
} else if (propsValue == null ? void 0 : propsValue.form_ids) {
|
|
57
|
+
v = propsValue.form_ids;
|
|
58
|
+
} else {
|
|
59
|
+
v = propsValue;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return v;
|
|
63
|
+
}, [propsValue]);
|
|
64
|
+
(0, import_react.useEffect)(() => {
|
|
65
|
+
var _a2, _b2;
|
|
66
|
+
if (field.filed_type === "form_to_form" && ((_a2 = field.setting) == null ? void 0 : _a2.linkedTable)) {
|
|
67
|
+
_getFormData.run({
|
|
68
|
+
form_record_ids: value,
|
|
69
|
+
form_id: (_b2 = field.setting) == null ? void 0 : _b2.linkedTable,
|
|
70
|
+
skip: 1,
|
|
71
|
+
num: 999
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}, [field.filed_type, value]);
|
|
75
|
+
const options = (0, import_react.useMemo)(() => {
|
|
76
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
77
|
+
if (field.filed_type === "form_to_form" && ((_a2 = field == null ? void 0 : field.setting) == null ? void 0 : _a2.linkedTable)) {
|
|
78
|
+
return ((_d2 = (_c2 = (_b2 = _getFormData.data) == null ? void 0 : _b2.data) == null ? void 0 : _c2.list) == null ? void 0 : _d2.map((item) => ({
|
|
79
|
+
title: item.main_field,
|
|
80
|
+
id: item.form_record_id
|
|
81
|
+
}))) || [];
|
|
82
|
+
}
|
|
83
|
+
return (_e2 = field == null ? void 0 : field.setting) == null ? void 0 : _e2.customTypeList;
|
|
84
|
+
}, [field.filed_type, (_b = field == null ? void 0 : field.setting) == null ? void 0 : _b.customTypeList, _getFormData.data]);
|
|
85
|
+
if ((0, import_utils.isArr)(value)) {
|
|
86
|
+
let _list = options == null ? void 0 : options.filter((i) => {
|
|
87
|
+
return value == null ? void 0 : value.includes((i == null ? void 0 : i.id) || i.value);
|
|
88
|
+
});
|
|
89
|
+
let _str = (_list == null ? void 0 : _list.map((i) => {
|
|
90
|
+
var _a2;
|
|
91
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Tag, null, (_a2 = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a2.translationShop((i == null ? void 0 : i.title) || (i == null ? void 0 : i.label)));
|
|
92
|
+
})) || "-";
|
|
93
|
+
return /* @__PURE__ */ import_react.default.createElement("span", null, _str || "-");
|
|
94
|
+
}
|
|
95
|
+
if (!(0, import_utils.isUndefined)(value)) {
|
|
96
|
+
if ((field == null ? void 0 : field.filed_type) === "select" && !((_c = field == null ? void 0 : field.setting) == null ? void 0 : _c.version)) {
|
|
97
|
+
return /* @__PURE__ */ import_react.default.createElement("span", null, value || "-");
|
|
98
|
+
}
|
|
99
|
+
let _item = options == null ? void 0 : options.filter((i) => (i == null ? void 0 : i.id) == value);
|
|
100
|
+
return ((_f = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _f.translationShop(
|
|
101
|
+
((_d = _item == null ? void 0 : _item[0]) == null ? void 0 : _d.title) || ((_e = _item == null ? void 0 : _item[0]) == null ? void 0 : _e.label)
|
|
102
|
+
)) || "-";
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
};
|
|
106
|
+
var RenderValueById_default = RenderValueById;
|
|
@@ -39,6 +39,9 @@ var import_antd = require("antd");
|
|
|
39
39
|
var import_customSelect = __toESM(require("../../components/customSelect"));
|
|
40
40
|
var import_collapsibleList = __toESM(require("../../components/collapsibleList"));
|
|
41
41
|
var import_index = require("./index.less");
|
|
42
|
+
var import_RenderValueById = __toESM(require("./RenderValueById"));
|
|
43
|
+
var import_useComponents = __toESM(require("../../../../hooks/useComponents"));
|
|
44
|
+
var queryValueById = ["checkbox", "radioButton", "select", "form_to_form"];
|
|
42
45
|
var Single = ({
|
|
43
46
|
value,
|
|
44
47
|
onChange,
|
|
@@ -53,6 +56,9 @@ var Single = ({
|
|
|
53
56
|
watch
|
|
54
57
|
}) => {
|
|
55
58
|
var _a, _b;
|
|
59
|
+
const [HumanBodySelector] = (0, import_useComponents.default)({
|
|
60
|
+
components: ["HumanBodySelector"]
|
|
61
|
+
});
|
|
56
62
|
const renderFieldValue = (fieldData, field) => {
|
|
57
63
|
const val = fieldData[field.key];
|
|
58
64
|
if (field.filed_type === "attachment") {
|
|
@@ -101,6 +107,12 @@ var Single = ({
|
|
|
101
107
|
return `(+${val.country_calling_code}) ${val.phone}`;
|
|
102
108
|
}
|
|
103
109
|
}
|
|
110
|
+
if (field.filed_type === "body_hotspot_image") {
|
|
111
|
+
return HumanBodySelector ? /* @__PURE__ */ import_react.default.createElement(HumanBodySelector, { value: val, disable: true }) : val;
|
|
112
|
+
}
|
|
113
|
+
if (queryValueById.includes(field == null ? void 0 : field.filed_type)) {
|
|
114
|
+
return /* @__PURE__ */ import_react.default.createElement(import_RenderValueById.default, { field, value: val });
|
|
115
|
+
}
|
|
104
116
|
return val || "-";
|
|
105
117
|
};
|
|
106
118
|
const renderItem = (0, import_react.useCallback)(
|
|
@@ -81,14 +81,24 @@ var SelectResourcesTable = ({ value, onChange }) => {
|
|
|
81
81
|
};
|
|
82
82
|
const _dataSource = (0, import_react.useMemo)(() => {
|
|
83
83
|
if (value) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
let sortOrder = {};
|
|
85
|
+
let arr1Copy = data.slice();
|
|
86
|
+
value.forEach((item, index) => {
|
|
87
|
+
sortOrder[item.form_id] = index;
|
|
88
|
+
});
|
|
89
|
+
arr1Copy.sort((a, b) => {
|
|
90
|
+
if (sortOrder[a.form_id] !== void 0 && sortOrder[b.form_id] !== void 0) {
|
|
91
|
+
return sortOrder[a.form_id] - sortOrder[b.form_id];
|
|
92
|
+
}
|
|
93
|
+
if (sortOrder[a.form_id] !== void 0) {
|
|
94
|
+
return -1;
|
|
95
|
+
}
|
|
96
|
+
if (sortOrder[b.form_id] !== void 0) {
|
|
97
|
+
return 1;
|
|
89
98
|
}
|
|
90
|
-
return
|
|
99
|
+
return 0;
|
|
91
100
|
});
|
|
101
|
+
return arr1Copy;
|
|
92
102
|
}
|
|
93
103
|
return data;
|
|
94
104
|
}, [data, value]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/private-materials",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.78",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"ahooks": "^3.7.6",
|
|
59
59
|
"react-infinite-scroll-component": "^6.1.0",
|
|
60
60
|
"rc-virtual-list": "^3.11.3",
|
|
61
|
+
"@pisell/icon": "0.0.8",
|
|
61
62
|
"@pisell/utils": "1.0.25",
|
|
62
|
-
"@pisell/date-picker": "1.0.74"
|
|
63
|
-
"@pisell/icon": "0.0.8"
|
|
63
|
+
"@pisell/date-picker": "1.0.74"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": "^18.0.0",
|