@pisell/private-materials 3.0.166 → 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 (33) 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/forms/model.d.ts +1 -2
  10. package/es/components/booking/info/utils.js +1 -1
  11. package/es/components/booking/info2/service/addService/utils.js +26 -13
  12. package/es/components/booking/info2/service/editService/index.js +29 -25
  13. package/es/components/booking/info2/utilsByBooking.js +46 -34
  14. package/es/components/booking/materiels/duration/index.d.ts +2 -2
  15. package/es/components/booking/materiels/duration/index.js +11 -11
  16. package/es/components/booking/notes/index.d.ts +1 -1
  17. package/es/components/booking/notes/model.d.ts +1 -2
  18. package/es/components/booking/payments/model.d.ts +1 -2
  19. package/es/components/schedules/index.d.ts +1 -1
  20. package/es/components/schedules/model.d.ts +1 -2
  21. package/lib/components/booking/addons/model.d.ts +1 -2
  22. package/lib/components/booking/forms/model.d.ts +1 -2
  23. package/lib/components/booking/info/utils.js +1 -1
  24. package/lib/components/booking/info2/service/addService/utils.js +13 -11
  25. package/lib/components/booking/info2/service/editService/index.js +20 -15
  26. package/lib/components/booking/info2/utilsByBooking.js +22 -14
  27. package/lib/components/booking/materiels/duration/index.d.ts +2 -2
  28. package/lib/components/booking/notes/index.d.ts +1 -1
  29. package/lib/components/booking/notes/model.d.ts +1 -2
  30. package/lib/components/booking/payments/model.d.ts +1 -2
  31. package/lib/components/schedules/index.d.ts +1 -1
  32. package/lib/components/schedules/model.d.ts +1 -2
  33. package/package.json +3 -3
@@ -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,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.166",
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/materials": "3.0.50",
63
64
  "@pisell/icon": "0.0.11",
64
- "@pisell/date-picker": "1.0.100",
65
- "@pisell/materials": "3.0.50"
65
+ "@pisell/date-picker": "1.0.100"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",