@pisell/private-materials 3.0.165 → 3.0.167

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.
Files changed (39) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/render/default/view.js +9 -9
  7. package/build/lowcode/view.js +10 -10
  8. package/es/components/booking/addons/model.d.ts +1 -2
  9. package/es/components/booking/dashboard/index.js +4 -3
  10. package/es/components/booking/forms/model.d.ts +1 -2
  11. package/es/components/booking/info/utils.js +1 -1
  12. package/es/components/booking/info2/service/addService/utils.js +26 -13
  13. package/es/components/booking/info2/service/editService/index.js +29 -25
  14. package/es/components/booking/info2/utilsByBooking.js +46 -34
  15. package/es/components/booking/materiels/duration/index.d.ts +2 -2
  16. package/es/components/booking/materiels/duration/index.js +11 -11
  17. package/es/components/booking/notes/index.d.ts +1 -1
  18. package/es/components/booking/notes/model.d.ts +1 -2
  19. package/es/components/booking/payments/model.d.ts +1 -2
  20. package/es/components/productExtension/fields/SelectResourcesTable/index.d.ts +2 -2
  21. package/es/components/productExtension/fields/SelectResourcesTable/index.js +64 -18
  22. package/es/components/schedules/index.d.ts +1 -1
  23. package/es/components/schedules/model.d.ts +1 -2
  24. package/lib/components/booking/addons/model.d.ts +1 -2
  25. package/lib/components/booking/dashboard/index.js +4 -3
  26. package/lib/components/booking/forms/model.d.ts +1 -2
  27. package/lib/components/booking/info/utils.js +1 -1
  28. package/lib/components/booking/info2/service/addService/utils.js +13 -11
  29. package/lib/components/booking/info2/service/editService/index.js +20 -15
  30. package/lib/components/booking/info2/utilsByBooking.js +22 -14
  31. package/lib/components/booking/materiels/duration/index.d.ts +2 -2
  32. package/lib/components/booking/notes/index.d.ts +1 -1
  33. package/lib/components/booking/notes/model.d.ts +1 -2
  34. package/lib/components/booking/payments/model.d.ts +1 -2
  35. package/lib/components/productExtension/fields/SelectResourcesTable/index.d.ts +2 -2
  36. package/lib/components/productExtension/fields/SelectResourcesTable/index.js +23 -0
  37. package/lib/components/schedules/index.d.ts +1 -1
  38. package/lib/components/schedules/model.d.ts +1 -2
  39. package/package.json +3 -3
@@ -13,10 +13,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
13
13
  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; }
14
14
  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; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import React, { useState, useMemo, useEffect } from "react";
17
- import { Select } from "antd";
16
+ import React, { useState, useMemo, useEffect } from 'react';
17
+ import { Select } from 'antd';
18
18
  // import {} from '@pisell/materials'
19
- import { locales } from "@pisell/utils";
19
+ import { locales } from '@pisell/utils';
20
20
  import { getFormTypes, getAllResource } from "./server";
21
21
  import "./index.less";
22
22
  var sortArrayByOrder = function sortArrayByOrder(arr1, arr2, reverse) {
@@ -38,26 +38,35 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
38
38
  _useState2 = _slicedToArray(_useState, 2),
39
39
  data = _useState2[0],
40
40
  setData = _useState2[1];
41
+
42
+ /**
43
+ * @title: 获取数据
44
+ * @description:
45
+ * @return {*}
46
+ * @Author: zhiwei.Wang
47
+ * @Date: 2024-11-04 17:07
48
+ */
41
49
  var _getData = /*#__PURE__*/function () {
42
50
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
43
- var _getFormTypes, _getAllResource, _yield$Promise$all, _yield$Promise$all2, forms, resources, _data;
51
+ var _getFormTypes, _getAllResource, _yield$Promise$all, _yield$Promise$all2, forms, resources, defaultResourceId, _data;
44
52
  return _regeneratorRuntime().wrap(function _callee$(_context) {
45
53
  while (1) switch (_context.prev = _context.next) {
46
54
  case 0:
55
+ // 获取资源分类
47
56
  _getFormTypes = getFormTypes({
48
- type: "manual",
57
+ type: 'manual',
49
58
  num: 500,
50
59
  skip: 1,
51
- status: "published"
60
+ status: 'published'
52
61
  }, {
53
62
  useCache: true
54
- });
63
+ }); // 获取资源列表
55
64
  _getAllResource = getAllResource({
56
65
  num: 500,
57
66
  skip: 1
58
67
  }, {
59
68
  useCache: true
60
- });
69
+ }); // 合并请求
61
70
  _context.next = 4;
62
71
  return Promise.all([_getFormTypes, _getAllResource]);
63
72
  case 4:
@@ -65,11 +74,24 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
65
74
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
66
75
  forms = _yield$Promise$all2[0];
67
76
  resources = _yield$Promise$all2[1];
77
+ // 需要默认选择的资源
78
+ defaultResourceId = getDefaultResourceId();
68
79
  _data = (forms || []).reduce(function (arr, item) {
80
+ // 根据资源分类,找到该分类下的所有资源
69
81
  var currentResource = (resources || []).filter(function (relation) {
70
82
  return relation.form_id === item.id;
71
83
  });
72
84
  if (currentResource.length > 0) {
85
+ // 设置默认资源
86
+ if (defaultResourceId && currentResource.some(function (d) {
87
+ return d.id == defaultResourceId;
88
+ })) {
89
+ // 返回上层
90
+ _onChange([defaultResourceId], item.id);
91
+ // 清空默认值
92
+ removeDefaultResourceId();
93
+ defaultResourceId = undefined;
94
+ }
73
95
  arr.push(_objectSpread(_objectSpread({
74
96
  label: item.title,
75
97
  key: item.id,
@@ -82,7 +104,7 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
82
104
  return arr;
83
105
  }, []);
84
106
  setData(_data);
85
- case 10:
107
+ case 11:
86
108
  case "end":
87
109
  return _context.stop();
88
110
  }
@@ -92,6 +114,29 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
92
114
  return _ref2.apply(this, arguments);
93
115
  };
94
116
  }();
117
+
118
+ /**
119
+ * @title: 获取默认选择的资源
120
+ * @description:
121
+ * @return {*}
122
+ * @Author: zhiwei.Wang
123
+ * @Date: 2024-11-04 17:09
124
+ */
125
+ var getDefaultResourceId = function getDefaultResourceId() {
126
+ var _serviceParams;
127
+ var serviceParams = sessionStorage.getItem('pisell2.eventBooking.serviceParams');
128
+ if (serviceParams) {
129
+ serviceParams = JSON.parse(serviceParams);
130
+ }
131
+ var resource_id = (_serviceParams = serviceParams) === null || _serviceParams === void 0 ? void 0 : _serviceParams.resource_id;
132
+ if (resource_id) {
133
+ resource_id = Number(resource_id);
134
+ }
135
+ return resource_id;
136
+ };
137
+ var removeDefaultResourceId = function removeDefaultResourceId() {
138
+ sessionStorage.setItem('pisell2.eventBooking.serviceParams', '');
139
+ };
95
140
  var _dataSource = useMemo(function () {
96
141
  if (value) {
97
142
  // 创建一个排序键对象
@@ -136,10 +181,11 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
136
181
  }
137
182
  onChange === null || onChange === void 0 ? void 0 : onChange(_value);
138
183
  };
184
+ console.log('value', value);
139
185
  var columns = useMemo(function () {
140
186
  return [{
141
- title: locales.getText("pisell2.text.product-extension.resource-type"),
142
- dataIndex: "title",
187
+ title: locales.getText('pisell2.text.product-extension.resource-type'),
188
+ dataIndex: 'title',
143
189
  value: value,
144
190
  data: data,
145
191
  width: 100
@@ -163,23 +209,23 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
163
209
  // },
164
210
  // },
165
211
  {
166
- title: locales.getText("pisell2.text.product-extension.options"),
167
- dataIndex: "form_id",
212
+ title: locales.getText('pisell2.text.product-extension.options'),
213
+ dataIndex: 'form_id',
168
214
  render: function render(form_id, record, index) {
169
215
  var cur = value === null || value === void 0 ? void 0 : value.find(function (d) {
170
216
  return d.form_id === form_id;
171
217
  });
172
218
  return /*#__PURE__*/React.createElement(Select, {
173
219
  style: {
174
- width: "100%"
220
+ width: '100%'
175
221
  },
176
222
  mode: "multiple",
177
223
  value: (cur === null || cur === void 0 ? void 0 : cur.form_record_ids) || [],
178
224
  options: record.options,
179
225
  popupMatchSelectWidth: false,
180
226
  fieldNames: {
181
- label: "title",
182
- value: "id"
227
+ label: 'title',
228
+ value: 'id'
183
229
  },
184
230
  onChange: function onChange(val) {
185
231
  _onChange(val, form_id);
@@ -200,13 +246,13 @@ var SelectResourcesTable = function SelectResourcesTable(_ref) {
200
246
  className: "",
201
247
  dragSort: true,
202
248
  onSortChange: sortChange,
203
- rowKey: "form_id",
249
+ rowKey: 'form_id',
204
250
  columns: columns,
205
251
  dataSource: _dataSource,
206
252
  pagination: false,
207
253
  virtual: false,
208
254
  scroll: {
209
- x: "auto"
255
+ x: 'auto'
210
256
  }
211
257
  });
212
258
  };
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => any;
2
+ declare const Schedules: (props: any) => JSX.Element;
3
3
  export default Schedules;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CalendarDataItem, ScheduleItem } from "./type";
3
2
  import dayjs from "dayjs";
4
3
  export interface FormState {
@@ -69,7 +68,7 @@ export interface FormState {
69
68
  };
70
69
  setGlobalState: Function | null;
71
70
  }
72
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
71
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
73
72
  state: FormState;
74
73
  } & {
75
74
  dispatch: (params: {
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -44,13 +44,14 @@ var translationOriginal = (text) => "";
44
44
  var formatCapacityToChildrenData = (data) => {
45
45
  const map = {};
46
46
  data.forEach((item) => {
47
- if (!map[item.id]) {
48
- map[item.id] = {
47
+ const name = translationOriginal(item.name) || "default";
48
+ if (!map[name]) {
49
+ map[name] = {
49
50
  label: !item.id ? import_utils.locales.getText("pisell2.booking.dashboard.default") : translationOriginal(item.name) || "",
50
51
  value: 0
51
52
  };
52
53
  }
53
- map[item.id].value = (map[item.id].value || 0) + (item.value || 0);
54
+ map[name].value = (map[name].value || 0) + (item.value || 0);
54
55
  });
55
56
  return Object.values(map).sort((a, b) => b.label.localeCompare(a.label));
56
57
  };
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -83,7 +83,7 @@ var isBooking4Shop = (shopId, renderType) => {
83
83
  if (renderType === "eventBooking") {
84
84
  return false;
85
85
  }
86
- const booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007];
86
+ const booking4Shops = [1350, 1401, 3013, 7154, 7572, 7007, 8119, 7320];
87
87
  return booking4Shops.includes(shopId);
88
88
  };
89
89
  // Annotate the CommonJS export names for ESM import in node:
@@ -90,7 +90,7 @@ var getFlexibleOption = ({
90
90
  slice,
91
91
  durationProps
92
92
  }) => {
93
- var _a, _b;
93
+ var _a, _b, _c, _d, _e, _f;
94
94
  const _durationProps = durationProps || getDurationProps({
95
95
  cacheItem,
96
96
  useStartTime,
@@ -102,7 +102,7 @@ var getFlexibleOption = ({
102
102
  let endDate = (0, import_utils.getEndDate)(
103
103
  _durationProps.startDate,
104
104
  _duration,
105
- ((_a = _durationProps.usableTime) == null ? void 0 : _a.end_at) ? (0, import_dayjs.default)((_b = _durationProps.usableTime) == null ? void 0 : _b.end_at) : null
105
+ ((_c = (_b = (_a = _durationProps.usableTime) == null ? void 0 : _a._extend) == null ? void 0 : _b.usableTime) == null ? void 0 : _c.end_at) ? (0, import_dayjs.default)((_f = (_e = (_d = _durationProps.usableTime) == null ? void 0 : _d._extend) == null ? void 0 : _e.usableTime) == null ? void 0 : _f.end_at) : null
106
106
  );
107
107
  let timeValue = endDate.diff(_durationProps.startDate, "minute");
108
108
  return {
@@ -197,6 +197,7 @@ var setDefaultResource = ({ cacheItem, resources }) => {
197
197
  for (let item of resources) {
198
198
  let defaultResource = item.renderList.filter((d) => d.is_default == 1 || d.id === resourceId).map((d) => {
199
199
  return {
200
+ ...d,
200
201
  relation_type: d.relation_type,
201
202
  form_id: item.form_id,
202
203
  relation_id: d.id,
@@ -324,11 +325,13 @@ var getProductExtend = ({ cacheItem, state }) => {
324
325
  resources: _cacheItem._data.resources
325
326
  });
326
327
  if ((0, import_utils.getDuration)(_cacheItem == null ? void 0 : _cacheItem.duration)) {
327
- _cacheItem._data._timeObj = getTimeObj({
328
- cacheItem,
328
+ _cacheItem._data.timeObj = getTimeObj({
329
+ cacheItem: _cacheItem,
330
+ useStartTime: _cacheItem._extend.start_time,
329
331
  currentResource: _cacheItem._extend.resource,
330
332
  state
331
333
  });
334
+ _cacheItem._extend.duration = _cacheItem._data.timeObj.durationSlicesBasedOnTime[0].value;
332
335
  }
333
336
  _cacheItem.autoClose = getIsAutoClose(_cacheItem);
334
337
  if (_cacheItem._extend.bundle_edit !== void 0) {
@@ -336,13 +339,6 @@ var getProductExtend = ({ cacheItem, state }) => {
336
339
  }
337
340
  _cacheItem._time = (/* @__PURE__ */ new Date()).getTime();
338
341
  } else {
339
- if (!_cacheItem._data._timeObj) {
340
- _cacheItem._data._timeObj = getTimeObj({
341
- cacheItem,
342
- currentResource: _cacheItem._extend.resource,
343
- state
344
- });
345
- }
346
342
  if (!_cacheItem._data.capacitys) {
347
343
  _cacheItem._data.capacitys = cacheItem.capacity;
348
344
  }
@@ -360,6 +356,12 @@ var getProductExtend = ({ cacheItem, state }) => {
360
356
  _cacheItem._data.resources = list;
361
357
  _cacheItem._data.resourceMaps = maps;
362
358
  }
359
+ _cacheItem._data.timeObj = getTimeObj({
360
+ cacheItem: _cacheItem,
361
+ useStartTime: _cacheItem._extend.start_time,
362
+ currentResource: _cacheItem._extend.resource,
363
+ state
364
+ });
363
365
  }
364
366
  console.log("_cacheItem_cacheItem", _cacheItem);
365
367
  return _cacheItem;
@@ -50,7 +50,7 @@ var import_utilsByBooking = require("../../utilsByBooking");
50
50
  var import_utils4 = require("../addService/utils");
51
51
  var submitLock = false;
52
52
  var Info = (_, ref) => {
53
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
53
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
54
54
  const [form] = import_antd.Form.useForm();
55
55
  const useTotal = import_antd.Form.useWatch("total", form);
56
56
  const useResource = import_antd.Form.useWatch("resource", form);
@@ -94,9 +94,14 @@ var Info = (_, ref) => {
94
94
  });
95
95
  }, [durationProps, import_utils.locales.locale]);
96
96
  const timeObj = (0, import_react.useMemo)(() => {
97
- var _a2, _b2;
98
- return (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._data.timeObj;
99
- }, [(_e = (_d = state.service) == null ? void 0 : _d.cacheItem) == null ? void 0 : _e._data.timeObj]);
97
+ return (0, import_utils4.getTimeObj)({
98
+ durationProps,
99
+ useStartTime,
100
+ currentResource,
101
+ state,
102
+ useDuration
103
+ });
104
+ }, [durationProps, useStartTime, currentResource, state, useDuration]);
100
105
  (0, import_react.useEffect)(() => {
101
106
  try {
102
107
  if (useDuration.indexOf("flexible_") == 0) {
@@ -206,7 +211,7 @@ var Info = (_, ref) => {
206
211
  let oPrice = Number(((_a2 = state.service.cacheItem) == null ? void 0 : _a2._extend.origin_total) || 0);
207
212
  let cPrice = Number(useTotal || 0);
208
213
  return cPrice !== oPrice;
209
- }, [useTotal, (_g = (_f = state.service.cacheItem) == null ? void 0 : _f._extend) == null ? void 0 : _g.origin_total]);
214
+ }, [useTotal, (_e = (_d = state.service.cacheItem) == null ? void 0 : _d._extend) == null ? void 0 : _e.origin_total]);
210
215
  const getResources = () => {
211
216
  let res = (0, import_utils4.formatResources)({
212
217
  cacheItem: getCurrentCacheItem(),
@@ -269,18 +274,18 @@ var Info = (_, ref) => {
269
274
  }, [state.service.editModal, state.isBookingCreatePage]);
270
275
  (0, import_react.useEffect)(() => {
271
276
  getDiscount();
272
- }, [useTotal, (_i = (_h = state.service.cacheItem) == null ? void 0 : _h._extend) == null ? void 0 : _i.origin_total]);
277
+ }, [useTotal, (_g = (_f = state.service.cacheItem) == null ? void 0 : _f._extend) == null ? void 0 : _g.origin_total]);
273
278
  const isDiscount = (0, import_react.useMemo)(() => {
274
279
  var _a2, _b2, _c2;
275
280
  if (!((_a2 = state.service) == null ? void 0 : _a2.cacheItem)) {
276
281
  return false;
277
282
  }
278
283
  return useTotal != ((_c2 = (_b2 = state.service) == null ? void 0 : _b2.cacheItem) == null ? void 0 : _c2._extend.origin_total);
279
- }, [useTotal, (_k = (_j = state.service) == null ? void 0 : _j.cacheItem) == null ? void 0 : _k._extend.origin_total]);
284
+ }, [useTotal, (_i = (_h = state.service) == null ? void 0 : _h.cacheItem) == null ? void 0 : _i._extend.origin_total]);
280
285
  const bundles = (0, import_react.useMemo)(() => {
281
286
  var _a2, _b2, _c2, _d2;
282
287
  return ((_d2 = (_c2 = (_b2 = (_a2 = state.service) == null ? void 0 : _a2.cacheItem) == null ? void 0 : _b2._extend) == null ? void 0 : _c2.other) == null ? void 0 : _d2.bundle) || [];
283
- }, [(_o = (_n = (_m = (_l = state.service) == null ? void 0 : _l.cacheItem) == null ? void 0 : _m._extend) == null ? void 0 : _n.other) == null ? void 0 : _o.bundle]);
288
+ }, [(_m = (_l = (_k = (_j = state.service) == null ? void 0 : _j.cacheItem) == null ? void 0 : _k._extend) == null ? void 0 : _l.other) == null ? void 0 : _m.bundle]);
284
289
  const handleEdit = (e) => {
285
290
  const item = state.service.cacheItem;
286
291
  let values = form.getFieldsValue();
@@ -348,14 +353,14 @@ var Info = (_, ref) => {
348
353
  };
349
354
  });
350
355
  console.log("state.service.value", state.service.value);
351
- const SelectTime = (_p = window.BaseMaterials) == null ? void 0 : _p.SelectTime;
356
+ const SelectTime = (_n = window.BaseMaterials) == null ? void 0 : _n.SelectTime;
352
357
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
353
358
  import_drawer.default,
354
359
  {
355
360
  titleNoWrap: true,
356
361
  zIndex: state.service.changeService ? 999 : 1e3,
357
362
  forceRender: true,
358
- open: state.service.editModal && !((_q = state.service.cacheItem) == null ? void 0 : _q.autoClose),
363
+ open: state.service.editModal && !((_o = state.service.cacheItem) == null ? void 0 : _o.autoClose),
359
364
  title: import_utils.locales.getText("pisell2.text.edit-service"),
360
365
  onClose: () => {
361
366
  dispatch({
@@ -368,7 +373,7 @@ var Info = (_, ref) => {
368
373
  });
369
374
  }
370
375
  },
371
- /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-body-edit" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { layout: "vertical", form, onFinish }, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { style: { width: "100%" }, gutter: [16, 0] }, /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "product_name" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_t = (_s = (_r = state.service) == null ? void 0 : _r.cacheItem) == null ? void 0 : _s._extend) == null ? void 0 : _t.product_name) || "-"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleEdit }, import_utils.locales.getText("pisell2.text.edit")), !state.isBookingCreatePage && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleChange }, import_utils.locales.getText("pisell2.text.change"))), /* @__PURE__ */ import_react.default.createElement(
376
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__booking-service-body-edit" }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form, { layout: "vertical", form, onFinish }, /* @__PURE__ */ import_react.default.createElement(import_antd.Row, { style: { width: "100%" }, gutter: [16, 0] }, /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 24 }, /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "product_name" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name-wrap" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "current-service-info-name" }, ((_r = (_q = (_p = state.service) == null ? void 0 : _p.cacheItem) == null ? void 0 : _q._extend) == null ? void 0 : _r.product_name) || "-"), /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleEdit }, import_utils.locales.getText("pisell2.text.edit")), !state.isBookingCreatePage && /* @__PURE__ */ import_react.default.createElement(import_antd.Button, { onClick: handleChange }, import_utils.locales.getText("pisell2.text.change"))), /* @__PURE__ */ import_react.default.createElement(
372
377
  import_collapsibleList.default,
373
378
  {
374
379
  style: { marginTop: bundles.length ? "8px" : 0 },
@@ -391,8 +396,8 @@ var Info = (_, ref) => {
391
396
  precision: 2,
392
397
  style: { width: "100%" },
393
398
  min: 0,
394
- max: ((_v = (_u = state.service.cacheItem) == null ? void 0 : _u._extend) == null ? void 0 : _v.origin_total) || 0,
395
- placeholder: ((_x = (_w = state.service.cacheItem) == null ? void 0 : _w._extend) == null ? void 0 : _x.origin_total) || "0"
399
+ max: ((_t = (_s = state.service.cacheItem) == null ? void 0 : _s._extend) == null ? void 0 : _t.origin_total) || 0,
400
+ placeholder: ((_v = (_u = state.service.cacheItem) == null ? void 0 : _u._extend) == null ? void 0 : _v.origin_total) || "0"
396
401
  }
397
402
  )
398
403
  )), /* @__PURE__ */ import_react.default.createElement(import_antd.Col, { span: 12 }, /* @__PURE__ */ import_react.default.createElement(
@@ -432,7 +437,7 @@ var Info = (_, ref) => {
432
437
  SelectTime ? /* @__PURE__ */ import_react.default.createElement(
433
438
  SelectTime,
434
439
  {
435
- slice: (_B = (_A = (_z = (_y = state.bookingConfig) == null ? void 0 : _y.config) == null ? void 0 : _z.basic) == null ? void 0 : _A.service_time) == null ? void 0 : _B.value,
440
+ slice: (_z = (_y = (_x = (_w = state.bookingConfig) == null ? void 0 : _w.config) == null ? void 0 : _x.basic) == null ? void 0 : _y.service_time) == null ? void 0 : _z.value,
436
441
  timePickerProps: {
437
442
  style: { width: "100%" }
438
443
  },
@@ -477,7 +482,7 @@ var Info = (_, ref) => {
477
482
  {
478
483
  type: "primary",
479
484
  className: "pisell-lowcode__booking-service-body-edit-footer-apple",
480
- disabled: !((_C = state.service.resourcesOrigin) == null ? void 0 : _C.length),
485
+ disabled: !((_A = state.service.resourcesOrigin) == null ? void 0 : _A.length),
481
486
  onClick: () => {
482
487
  form.submit();
483
488
  }
@@ -70,6 +70,7 @@ var getResourceTimeIsUsable = (item, cacheItem, resourceItem) => {
70
70
  const currentCount = getSumCapacity({ cacheItem });
71
71
  const eventList = time.event_list || [];
72
72
  let endDate = null;
73
+ let isCalcCount = true;
73
74
  if (isFlexible) {
74
75
  if (eventList.length) {
75
76
  timeStartDate = eventList.reduce((max, event) => {
@@ -78,6 +79,11 @@ var getResourceTimeIsUsable = (item, cacheItem, resourceItem) => {
78
79
  }, (0, import_dayjs.default)(eventList[0].end_at));
79
80
  }
80
81
  isDateRange = startDate.isAfter(timeStartDate) && startDate.isBefore(timeEndDate);
82
+ if (!isDateRange && eventList.length) {
83
+ isCalcCount = false;
84
+ isDateRange = true;
85
+ isCountRange = false;
86
+ }
81
87
  } else {
82
88
  endDate = startDate.add(import_utils2.flexibleObj.getValue(cacheItem._extend.duration), "minute");
83
89
  const isTimeRange = startDate.isAfter(timeStartDate) && endDate.isBefore(timeEndDate);
@@ -85,21 +91,23 @@ var getResourceTimeIsUsable = (item, cacheItem, resourceItem) => {
85
91
  isDateRange = true;
86
92
  }
87
93
  }
88
- let conflict = (time.event_list || []).filter((d) => {
89
- return isConflict({ start_at: d.start_at, end_at: d.end_at }, { start_at: startDate, end_at: endDate });
90
- });
91
- if (resourceItem.resourceType === "single") {
92
- if (conflict.length === 0) {
93
- isCountRange = true;
94
- } else {
95
- isCountRange = false;
96
- }
97
- } else {
98
- let conflictCount = getUseableEventCount(conflict, resourceItem.capacity);
99
- if (currentCount <= conflictCount) {
100
- isCountRange = true;
94
+ if (isCalcCount) {
95
+ let conflict = (time.event_list || []).filter((d) => {
96
+ return isConflict({ start_at: d.start_at, end_at: d.end_at }, { start_at: startDate, end_at: endDate });
97
+ });
98
+ if (resourceItem.resourceType === "single") {
99
+ if (conflict.length === 0) {
100
+ isCountRange = true;
101
+ } else {
102
+ isCountRange = false;
103
+ }
101
104
  } else {
102
- isCountRange = false;
105
+ let conflictCount = getUseableEventCount(conflict, resourceItem.capacity);
106
+ if (currentCount <= conflictCount) {
107
+ isCountRange = true;
108
+ } else {
109
+ isCountRange = false;
110
+ }
103
111
  }
104
112
  }
105
113
  const isUsable = isDateRange && isCountRange;
@@ -1,5 +1,5 @@
1
- import { SelectProps } from "antd";
2
- import React from "react";
1
+ import { SelectProps } from 'antd';
2
+ import React from 'react';
3
3
  interface DurationProps extends SelectProps {
4
4
  locale?: string;
5
5
  slice?: number;
@@ -4,5 +4,5 @@ export interface InfoProps {
4
4
  globalState: any;
5
5
  setGlobalState: any;
6
6
  }
7
- declare const Notes: (props: any) => any;
7
+ declare const Notes: any;
8
8
  export default Notes;
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -1,6 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { FormState } from "../model";
3
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
2
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
4
3
  state: FormState;
5
4
  } & {
6
5
  dispatch: (params: {
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  declare const SelectResourcesTable: ({ value, onChange }: any) => React.JSX.Element;
4
4
  export default SelectResourcesTable;
@@ -60,11 +60,17 @@ var SelectResourcesTable = ({ value, onChange }) => {
60
60
  _getFormTypes,
61
61
  _getAllResource
62
62
  ]);
63
+ let defaultResourceId = getDefaultResourceId();
63
64
  let _data = (forms || []).reduce((arr, item) => {
64
65
  const currentResource = (resources || []).filter(
65
66
  (relation) => relation.form_id === item.id
66
67
  );
67
68
  if (currentResource.length > 0) {
69
+ if (defaultResourceId && currentResource.some((d) => d.id == defaultResourceId)) {
70
+ _onChange([defaultResourceId], item.id);
71
+ removeDefaultResourceId();
72
+ defaultResourceId = void 0;
73
+ }
68
74
  arr.push({
69
75
  label: item.title,
70
76
  key: item.id,
@@ -79,6 +85,22 @@ var SelectResourcesTable = ({ value, onChange }) => {
79
85
  }, []);
80
86
  setData(_data);
81
87
  };
88
+ const getDefaultResourceId = () => {
89
+ let serviceParams = sessionStorage.getItem(
90
+ "pisell2.eventBooking.serviceParams"
91
+ );
92
+ if (serviceParams) {
93
+ serviceParams = JSON.parse(serviceParams);
94
+ }
95
+ let resource_id = serviceParams == null ? void 0 : serviceParams.resource_id;
96
+ if (resource_id) {
97
+ resource_id = Number(resource_id);
98
+ }
99
+ return resource_id;
100
+ };
101
+ const removeDefaultResourceId = () => {
102
+ sessionStorage.setItem("pisell2.eventBooking.serviceParams", "");
103
+ };
82
104
  const _dataSource = (0, import_react.useMemo)(() => {
83
105
  if (value) {
84
106
  let sortOrder = {};
@@ -112,6 +134,7 @@ var SelectResourcesTable = ({ value, onChange }) => {
112
134
  }
113
135
  onChange == null ? void 0 : onChange(_value);
114
136
  };
137
+ console.log("value", value);
115
138
  const columns = (0, import_react.useMemo)(() => {
116
139
  return [
117
140
  {
@@ -1,3 +1,3 @@
1
1
  import "./index.less";
2
- declare const Schedules: (props: any) => any;
2
+ declare const Schedules: (props: any) => JSX.Element;
3
3
  export default Schedules;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { CalendarDataItem, ScheduleItem } from "./type";
3
2
  import dayjs from "dayjs";
4
3
  export interface FormState {
@@ -69,7 +68,7 @@ export interface FormState {
69
68
  };
70
69
  setGlobalState: Function | null;
71
70
  }
72
- export declare const Provider: (ComponentUi: any) => (props: any) => any, Context: import("react").Context<{
71
+ export declare const Provider: (ComponentUi: any) => (props: any) => JSX.Element, Context: import("react").Context<{
73
72
  state: FormState;
74
73
  } & {
75
74
  dispatch: (params: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.165",
3
+ "version": "3.0.167",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -60,9 +60,9 @@
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
62
  "@pisell/utils": "1.0.42",
63
- "@pisell/date-picker": "1.0.100",
63
+ "@pisell/materials": "3.0.50",
64
64
  "@pisell/icon": "0.0.11",
65
- "@pisell/materials": "3.0.50"
65
+ "@pisell/date-picker": "1.0.100"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",