@pisell/private-materials 3.0.151 → 3.0.152
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 +142 -142
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +12 -12
- package/es/components/booking/components/footer/index.js +48 -33
- package/es/components/booking/components/footer/utils.js +35 -4
- package/es/components/booking/index.js +1 -1
- package/es/components/booking/info/index.d.ts +4 -12
- package/es/components/booking/info/index.js +12 -122
- package/es/components/booking/info/main.d.ts +12 -0
- package/es/components/booking/info/main.js +124 -0
- package/es/components/booking/info/model.js +0 -1
- package/es/components/booking/info/service/addTimeModal/index.js +4 -4
- package/es/components/booking/info/utils.d.ts +1 -0
- package/es/components/booking/info/utils.js +7 -0
- package/es/components/booking/info2/index.d.ts +12 -0
- package/es/components/booking/info2/index.js +216 -0
- package/es/components/booking/info2/serve.d.ts +6 -0
- package/es/components/booking/info2/serve.js +79 -0
- package/es/components/booking/info2/service/actions/index.d.ts +6 -0
- package/es/components/booking/info2/service/actions/index.js +86 -0
- package/es/components/booking/info2/service/addService/index.d.ts +6 -0
- package/es/components/booking/info2/service/addService/index.js +404 -0
- package/es/components/booking/info2/service/addService/mock.d.ts +214 -0
- package/es/components/booking/info2/service/addService/mock.js +332 -0
- package/es/components/booking/info2/service/addService/utils.d.ts +71 -0
- package/es/components/booking/info2/service/addService/utils.js +510 -0
- package/es/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
- package/es/components/booking/info2/service/addTimeModal/index.js +681 -0
- package/es/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
- package/es/components/booking/info2/service/addTimeModal/serve.js +73 -0
- package/es/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
- package/es/components/booking/info2/service/addTimeModal/utils.js +176 -0
- package/es/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
- package/es/components/booking/info2/service/editService/Capacity/index.js +121 -0
- package/es/components/booking/info2/service/editService/Capacity/index.less +1 -0
- package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
- package/es/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +28 -0
- package/es/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
- package/es/components/booking/info2/service/editService/Resources/index.js +233 -0
- package/es/components/booking/info2/service/editService/Resources/index.less +21 -0
- package/es/components/booking/info2/service/editService/index.d.ts +7 -0
- package/es/components/booking/info2/service/editService/index.js +617 -0
- package/es/components/booking/info2/service/editService/index.less +99 -0
- package/es/components/booking/info2/service/editService/utils.d.ts +11 -0
- package/es/components/booking/info2/service/editService/utils.js +37 -0
- package/es/components/booking/info2/service/index.d.ts +4 -0
- package/es/components/booking/info2/service/index.js +55 -0
- package/es/components/booking/info2/service/serviceItem/index.d.ts +4 -0
- package/es/components/booking/info2/service/serviceItem/index.js +176 -0
- package/es/components/booking/info2/service/serviceItem/index.less +125 -0
- package/es/components/booking/info2/service/serviceList/index.d.ts +6 -0
- package/es/components/booking/info2/service/serviceList/index.js +106 -0
- package/es/components/booking/info2/service/serviceList/index.less +0 -0
- package/es/components/booking/info2/utilsByBooking.d.ts +34 -0
- package/es/components/booking/info2/utilsByBooking.js +349 -0
- package/es/components/booking/locales.d.ts +3 -0
- package/es/components/booking/locales.js +12 -3
- package/es/components/booking/materiels/resources/index.d.ts +2 -2
- package/es/components/booking/materiels/resources/index.js +11 -11
- package/es/components/booking/mock.d.ts +1 -0
- package/es/components/booking/mock.js +66 -0
- package/es/components/booking/notes/index.d.ts +1 -1
- package/es/components/index.d.ts +1 -1
- package/es/components/index.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/lib/components/booking/components/footer/index.js +28 -5
- package/lib/components/booking/components/footer/utils.js +29 -4
- package/lib/components/booking/index.js +2 -2
- package/lib/components/booking/info/index.d.ts +4 -12
- package/lib/components/booking/info/index.js +14 -115
- package/lib/components/booking/info/main.d.ts +12 -0
- package/lib/components/booking/info/main.js +152 -0
- package/lib/components/booking/info/service/addTimeModal/index.js +1 -0
- package/lib/components/booking/info/utils.d.ts +1 -0
- package/lib/components/booking/info/utils.js +9 -0
- package/lib/components/booking/info2/index.d.ts +12 -0
- package/lib/components/booking/info2/index.js +202 -0
- package/lib/components/booking/info2/serve.d.ts +6 -0
- package/lib/components/booking/info2/serve.js +53 -0
- package/lib/components/booking/info2/service/actions/index.d.ts +6 -0
- package/lib/components/booking/info2/service/actions/index.js +102 -0
- package/lib/components/booking/info2/service/addService/index.d.ts +6 -0
- package/lib/components/booking/info2/service/addService/index.js +356 -0
- package/lib/components/booking/info2/service/addService/mock.d.ts +214 -0
- package/lib/components/booking/info2/service/addService/mock.js +398 -0
- package/lib/components/booking/info2/service/addService/utils.d.ts +71 -0
- package/lib/components/booking/info2/service/addService/utils.js +377 -0
- package/lib/components/booking/info2/service/addTimeModal/index.d.ts +4 -0
- package/lib/components/booking/info2/service/addTimeModal/index.js +558 -0
- package/lib/components/booking/info2/service/addTimeModal/serve.d.ts +9 -0
- package/lib/components/booking/info2/service/addTimeModal/serve.js +45 -0
- package/lib/components/booking/info2/service/addTimeModal/utils.d.ts +31 -0
- package/lib/components/booking/info2/service/addTimeModal/utils.js +157 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.d.ts +4 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.js +97 -0
- package/lib/components/booking/info2/service/editService/Capacity/index.less +1 -0
- package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.d.ts +7 -0
- package/lib/components/booking/info2/service/editService/Resources/MaxLengthSelect/index.js +54 -0
- package/lib/components/booking/info2/service/editService/Resources/index.d.ts +4 -0
- package/lib/components/booking/info2/service/editService/Resources/index.js +212 -0
- package/lib/components/booking/info2/service/editService/Resources/index.less +21 -0
- package/lib/components/booking/info2/service/editService/index.d.ts +7 -0
- package/lib/components/booking/info2/service/editService/index.js +483 -0
- package/lib/components/booking/info2/service/editService/index.less +99 -0
- package/lib/components/booking/info2/service/editService/utils.d.ts +11 -0
- package/lib/components/booking/info2/service/editService/utils.js +0 -0
- package/lib/components/booking/info2/service/index.d.ts +4 -0
- package/lib/components/booking/info2/service/index.js +75 -0
- package/lib/components/booking/info2/service/serviceItem/index.d.ts +4 -0
- package/lib/components/booking/info2/service/serviceItem/index.js +184 -0
- package/lib/components/booking/info2/service/serviceItem/index.less +125 -0
- package/lib/components/booking/info2/service/serviceList/index.d.ts +6 -0
- package/lib/components/booking/info2/service/serviceList/index.js +130 -0
- package/lib/components/booking/info2/service/serviceList/index.less +0 -0
- package/lib/components/booking/info2/utilsByBooking.d.ts +34 -0
- package/lib/components/booking/info2/utilsByBooking.js +257 -0
- package/lib/components/booking/locales.d.ts +3 -0
- package/lib/components/booking/locales.js +6 -3
- package/lib/components/booking/materiels/resources/index.d.ts +2 -2
- package/lib/components/booking/mock.d.ts +1 -0
- package/lib/components/booking/mock.js +67 -2
- package/lib/components/booking/notes/index.d.ts +1 -1
- package/lib/components/eftposPay/tyro/index.js +3 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,233 @@
|
|
|
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 _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
3
|
+
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
|
+
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; }
|
|
5
|
+
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; }
|
|
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; }
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
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."); }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
+
import React, { useState, useMemo, forwardRef, useCallback, useImperativeHandle } from 'react';
|
|
16
|
+
import { Col, Form, Select, Button, Alert } from 'antd';
|
|
17
|
+
import MaxLengthSelect from "./MaxLengthSelect";
|
|
18
|
+
import Like from "../../../../info/service/like";
|
|
19
|
+
import "./index.less";
|
|
20
|
+
import { locales } from '@pisell/utils';
|
|
21
|
+
import { getErrorList } from "../../../utilsByBooking";
|
|
22
|
+
import { isArray } from 'lodash';
|
|
23
|
+
var Resources = function Resources(_ref, ref) {
|
|
24
|
+
var _cacheItem$_data2, _cacheItem$_data4;
|
|
25
|
+
var state = _ref.state,
|
|
26
|
+
cacheItem = _ref.cacheItem,
|
|
27
|
+
getCurrentCacheItem = _ref.getCurrentCacheItem,
|
|
28
|
+
onChange = _ref.onChange,
|
|
29
|
+
value = _ref.value;
|
|
30
|
+
var _useState = useState(false),
|
|
31
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
32
|
+
showError = _useState2[0],
|
|
33
|
+
setShowError = _useState2[1];
|
|
34
|
+
|
|
35
|
+
// 需要渲染的列表, 资源二级结构数据
|
|
36
|
+
var data = useMemo(function () {
|
|
37
|
+
var _cacheItem$_data;
|
|
38
|
+
return (cacheItem === null || cacheItem === void 0 ? void 0 : (_cacheItem$_data = cacheItem._data) === null || _cacheItem$_data === void 0 ? void 0 : _cacheItem$_data.resources) || [];
|
|
39
|
+
}, [cacheItem === null || cacheItem === void 0 ? void 0 : (_cacheItem$_data2 = cacheItem._data) === null || _cacheItem$_data2 === void 0 ? void 0 : _cacheItem$_data2.resources]);
|
|
40
|
+
|
|
41
|
+
// 同上, 只是map结构,方便计算
|
|
42
|
+
var resourceMaps = useMemo(function () {
|
|
43
|
+
var _cacheItem$_data3;
|
|
44
|
+
return (cacheItem === null || cacheItem === void 0 ? void 0 : (_cacheItem$_data3 = cacheItem._data) === null || _cacheItem$_data3 === void 0 ? void 0 : _cacheItem$_data3.resourceMaps) || [];
|
|
45
|
+
}, [cacheItem === null || cacheItem === void 0 ? void 0 : (_cacheItem$_data4 = cacheItem._data) === null || _cacheItem$_data4 === void 0 ? void 0 : _cacheItem$_data4.resourceMaps]);
|
|
46
|
+
|
|
47
|
+
// 默认值
|
|
48
|
+
var defaultValue = useMemo(function () {
|
|
49
|
+
return data.reduce(function (pre, cur) {
|
|
50
|
+
pre[cur.form_id] = [];
|
|
51
|
+
return pre;
|
|
52
|
+
}, {});
|
|
53
|
+
}, [data]);
|
|
54
|
+
|
|
55
|
+
// 当前的值
|
|
56
|
+
var _value = useMemo(function () {
|
|
57
|
+
return value || defaultValue;
|
|
58
|
+
}, [value, defaultValue]);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @title: 当选择资源时
|
|
62
|
+
* @description:
|
|
63
|
+
* @param {any} val
|
|
64
|
+
* @param {number} form_id
|
|
65
|
+
* @param {string} key
|
|
66
|
+
* @return {*}
|
|
67
|
+
* @Author: zhiwei.Wang
|
|
68
|
+
* @Date: 2024-09-19 21:04
|
|
69
|
+
*/
|
|
70
|
+
var _onChange = function _onChange(val, form_id, key) {
|
|
71
|
+
var _val = _objectSpread({}, _value);
|
|
72
|
+
// 将当前数据map化, 减少循环次数
|
|
73
|
+
var maps = _val[form_id] ? _val[form_id].reduce(function (pre, cur) {
|
|
74
|
+
pre[cur.relation_id] = cur;
|
|
75
|
+
return pre;
|
|
76
|
+
}, {}) : {};
|
|
77
|
+
// 重新赋值, 因为select返回的是数字列表, 需要补充额外的数据
|
|
78
|
+
_val[form_id] = val.map(function (d) {
|
|
79
|
+
var _currentForm$renderLi, _currentForm$renderLi2, _currentForm$renderLi3, _currentForm$renderLi4;
|
|
80
|
+
var _d = maps[d];
|
|
81
|
+
if (_d) {
|
|
82
|
+
if (key === 'like_status') {
|
|
83
|
+
d[key].like_status = val;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
var currentForm = (resourceMaps === null || resourceMaps === void 0 ? void 0 : resourceMaps[form_id]) || {};
|
|
87
|
+
return (
|
|
88
|
+
// maps[d] 为真时, 说明是之前已选择, 否则为新增的值,补充数据
|
|
89
|
+
maps[d] || {
|
|
90
|
+
relation_type: ((_currentForm$renderLi = currentForm.renderListMaps[d]) === null || _currentForm$renderLi === void 0 ? void 0 : (_currentForm$renderLi2 = _currentForm$renderLi.usable) === null || _currentForm$renderLi2 === void 0 ? void 0 : _currentForm$renderLi2.relation_type) || 'form',
|
|
91
|
+
form_id: form_id,
|
|
92
|
+
relation_id: d,
|
|
93
|
+
like_status: 'common',
|
|
94
|
+
// 新添加的数据补充错误信息
|
|
95
|
+
errors: getErrorList((_currentForm$renderLi3 = currentForm.renderListMaps) === null || _currentForm$renderLi3 === void 0 ? void 0 : _currentForm$renderLi3[d], getCurrentCacheItem()),
|
|
96
|
+
metadata: {
|
|
97
|
+
form_name: currentForm.title,
|
|
98
|
+
resource_name: (_currentForm$renderLi4 = currentForm.renderListMaps[d]) === null || _currentForm$renderLi4 === void 0 ? void 0 : _currentForm$renderLi4.main_field
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
setShowError(false);
|
|
104
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_val);
|
|
105
|
+
};
|
|
106
|
+
var setLikeStatus = function setLikeStatus(val, form_id, key) {
|
|
107
|
+
var _val$form_id;
|
|
108
|
+
var _val = _objectSpread({}, _value);
|
|
109
|
+
if (_val !== null && _val !== void 0 && (_val$form_id = _val[form_id]) !== null && _val$form_id !== void 0 && _val$form_id[0]) {
|
|
110
|
+
_val[form_id][0][key] = val;
|
|
111
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_val);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @title: 渲染下拉框
|
|
117
|
+
* @description:
|
|
118
|
+
* @return {*}
|
|
119
|
+
* @Author: zhiwei.Wang
|
|
120
|
+
* @Date: 2024-01-09 14:02
|
|
121
|
+
*/
|
|
122
|
+
var renderOptions = useCallback(function (array) {
|
|
123
|
+
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
|
|
124
|
+
var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
|
|
125
|
+
var type = arguments.length > 3 ? arguments[3] : undefined;
|
|
126
|
+
return array.map(function (d) {
|
|
127
|
+
var props = {};
|
|
128
|
+
if (type === 'resource') {
|
|
129
|
+
props.labelText = d.labelText;
|
|
130
|
+
}
|
|
131
|
+
return /*#__PURE__*/React.createElement(Select.Option, _extends({
|
|
132
|
+
value: d[value],
|
|
133
|
+
key: d[value]
|
|
134
|
+
}, props, {
|
|
135
|
+
relation_type: d.relation_type
|
|
136
|
+
}), d[label]);
|
|
137
|
+
});
|
|
138
|
+
}, []);
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @title: 检查当前资源最小选择数量
|
|
142
|
+
* @description:
|
|
143
|
+
* @return {*}
|
|
144
|
+
* @Author: zhiwei.Wang
|
|
145
|
+
* @Date: 2024-09-19 21:08
|
|
146
|
+
*/
|
|
147
|
+
var check = function check() {
|
|
148
|
+
var _iterator = _createForOfIteratorHelper(data),
|
|
149
|
+
_step;
|
|
150
|
+
try {
|
|
151
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
152
|
+
var _value$item$form_id;
|
|
153
|
+
var item = _step.value;
|
|
154
|
+
var _length = (_value$item$form_id = _value[item.form_id]) === null || _value$item$form_id === void 0 ? void 0 : _value$item$form_id.length;
|
|
155
|
+
if (item.select_type.min > _length) {
|
|
156
|
+
setShowError(true);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} catch (err) {
|
|
161
|
+
_iterator.e(err);
|
|
162
|
+
} finally {
|
|
163
|
+
_iterator.f();
|
|
164
|
+
}
|
|
165
|
+
return true;
|
|
166
|
+
};
|
|
167
|
+
useImperativeHandle(ref, function () {
|
|
168
|
+
return {
|
|
169
|
+
check: check
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, data.map(function (item) {
|
|
173
|
+
var _cur$2;
|
|
174
|
+
var cur = _value[item.form_id];
|
|
175
|
+
var errors = (cur || []).reduce(function (pre, d) {
|
|
176
|
+
return pre.concat((d === null || d === void 0 ? void 0 : d.errors) || []);
|
|
177
|
+
}, []);
|
|
178
|
+
return /*#__PURE__*/React.createElement(Col, {
|
|
179
|
+
span: 24,
|
|
180
|
+
key: item.form_id
|
|
181
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
182
|
+
label: item.title,
|
|
183
|
+
required: true,
|
|
184
|
+
extra: showError && item.select_type.min > (cur === null || cur === void 0 ? void 0 : cur.length) ? /*#__PURE__*/React.createElement("span", {
|
|
185
|
+
style: {
|
|
186
|
+
color: '#ff4d4f'
|
|
187
|
+
}
|
|
188
|
+
}, locales.getText('page.booking.text.resource.min-length-error')(item.select_type.min, item.title)) : undefined
|
|
189
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
190
|
+
className: "resource-col"
|
|
191
|
+
}, item.select_type.type === 'multiple' ? null : /*#__PURE__*/React.createElement(Button, {
|
|
192
|
+
className: "resource-col-like-wrap",
|
|
193
|
+
onClick: function onClick() {
|
|
194
|
+
var _cur$;
|
|
195
|
+
setLikeStatus((cur === null || cur === void 0 ? void 0 : (_cur$ = cur[0]) === null || _cur$ === void 0 ? void 0 : _cur$.like_status) === 'like' ? 'common' : 'like', item.form_id, 'like_status');
|
|
196
|
+
}
|
|
197
|
+
}, /*#__PURE__*/React.createElement(Like, {
|
|
198
|
+
status: cur === null || cur === void 0 ? void 0 : (_cur$2 = cur[0]) === null || _cur$2 === void 0 ? void 0 : _cur$2.like_status
|
|
199
|
+
})), /*#__PURE__*/React.createElement(MaxLengthSelect, {
|
|
200
|
+
className: "resource-col-select",
|
|
201
|
+
size: "large",
|
|
202
|
+
maxLength: item.select_type.max,
|
|
203
|
+
mode: item.select_type.type === 'multiple' ? 'multiple' : undefined,
|
|
204
|
+
onChange: function onChange(e) {
|
|
205
|
+
var val = e;
|
|
206
|
+
if (!isArray(e)) {
|
|
207
|
+
if (e || e === 0) {
|
|
208
|
+
val = [e];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
_onChange(val, item.form_id, 'value');
|
|
212
|
+
},
|
|
213
|
+
value: cur === null || cur === void 0 ? void 0 : cur.map(function (d) {
|
|
214
|
+
return d.relation_id;
|
|
215
|
+
}),
|
|
216
|
+
showSearch: true,
|
|
217
|
+
filterOption: function filterOption(str, option) {
|
|
218
|
+
return ((option === null || option === void 0 ? void 0 : option.labelText) || '').toLowerCase().includes((str || '').toLowerCase());
|
|
219
|
+
}
|
|
220
|
+
}, renderOptions(item.renderList, 'id', 'label', 'resource')))), state.renderType !== 'eventBooking' && (errors || []).map(function (d) {
|
|
221
|
+
return /*#__PURE__*/React.createElement(Alert, {
|
|
222
|
+
key: d.type,
|
|
223
|
+
message: d.label,
|
|
224
|
+
type: "warning",
|
|
225
|
+
showIcon: true,
|
|
226
|
+
style: {
|
|
227
|
+
marginBottom: 12
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}));
|
|
231
|
+
}));
|
|
232
|
+
};
|
|
233
|
+
export default /*#__PURE__*/forwardRef(Resources);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.resource-col {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
|
|
7
|
+
.resource-col-like-wrap {
|
|
8
|
+
width: 44px;
|
|
9
|
+
height: 40px;
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
padding: 0;
|
|
14
|
+
|
|
15
|
+
.like-resource {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.resource-col-select {
|
|
19
|
+
flex: 1;
|
|
20
|
+
}
|
|
21
|
+
}
|