@pisell/private-materials 3.0.119 → 3.0.121

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 (76) 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/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +10 -10
  11. package/es/components/booking/addons/index.d.ts +1 -1
  12. package/es/components/booking/components/TabProduct/productItem/index.d.ts +2 -2
  13. package/es/components/booking/components/TabProduct/productItem/index.js +8 -7
  14. package/es/components/booking/forms/index.d.ts +1 -1
  15. package/es/components/booking/index.d.ts +1 -1
  16. package/es/components/booking/info/header/index.d.ts +2 -2
  17. package/es/components/booking/info/header/index.js +436 -44
  18. package/es/components/booking/info/header/index.less +110 -1
  19. package/es/components/booking/info/service/addService/index.js +3 -1
  20. package/es/components/booking/info/service/editService/index.js +3 -1
  21. package/es/components/booking/locales.d.ts +63 -0
  22. package/es/components/booking/locales.js +78 -6
  23. package/es/components/booking/payments/index.d.ts +1 -1
  24. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
  25. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +40 -0
  26. package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
  27. package/es/components/schedules/components/ScheduleList/index.d.ts +5 -4
  28. package/es/components/schedules/components/ScheduleList/index.js +53 -43
  29. package/es/components/schedules/hooks/useSchedulesDataSource.js +5 -3
  30. package/es/components/schedules/products/list/index.d.ts +2 -2
  31. package/es/components/schedules/products/list/index.js +8 -8
  32. package/es/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
  33. package/es/components/schedules/schedules/AllSchedules/index.js +9 -6
  34. package/es/components/schedules/schedules/AllSchedules/index.less +11 -3
  35. package/es/components/schedules/schedules/serve.d.ts +7 -0
  36. package/es/components/schedules/schedules/serve.js +24 -3
  37. package/es/components/schedules/schedules/utils.d.ts +22 -0
  38. package/es/components/schedules/schedules/utils.js +143 -1
  39. package/es/components/schedules/type.d.ts +7 -0
  40. package/es/components/tabProduct/index.d.ts +3 -2
  41. package/es/components/tabProduct/index.js +27 -18
  42. package/es/components/tabProduct/tabs/index.d.ts +3 -3
  43. package/es/components/tabProduct/tabs/index.js +34 -21
  44. package/lib/components/booking/addons/index.d.ts +1 -1
  45. package/lib/components/booking/components/TabProduct/productItem/index.d.ts +2 -2
  46. package/lib/components/booking/components/TabProduct/productItem/index.js +2 -1
  47. package/lib/components/booking/forms/index.d.ts +1 -1
  48. package/lib/components/booking/index.d.ts +1 -1
  49. package/lib/components/booking/info/header/index.d.ts +2 -2
  50. package/lib/components/booking/info/header/index.js +212 -11
  51. package/lib/components/booking/info/header/index.less +110 -1
  52. package/lib/components/booking/info/service/addService/index.js +3 -1
  53. package/lib/components/booking/info/service/editService/index.js +3 -1
  54. package/lib/components/booking/locales.d.ts +63 -0
  55. package/lib/components/booking/locales.js +72 -6
  56. package/lib/components/booking/payments/index.d.ts +1 -1
  57. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
  58. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +77 -0
  59. package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
  60. package/lib/components/schedules/components/ScheduleList/index.d.ts +5 -4
  61. package/lib/components/schedules/components/ScheduleList/index.js +38 -31
  62. package/lib/components/schedules/hooks/useSchedulesDataSource.js +8 -2
  63. package/lib/components/schedules/products/list/index.d.ts +2 -2
  64. package/lib/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
  65. package/lib/components/schedules/schedules/AllSchedules/index.js +3 -2
  66. package/lib/components/schedules/schedules/AllSchedules/index.less +11 -3
  67. package/lib/components/schedules/schedules/serve.d.ts +7 -0
  68. package/lib/components/schedules/schedules/serve.js +5 -2
  69. package/lib/components/schedules/schedules/utils.d.ts +22 -0
  70. package/lib/components/schedules/schedules/utils.js +98 -0
  71. package/lib/components/schedules/type.d.ts +7 -0
  72. package/lib/components/tabProduct/index.d.ts +3 -2
  73. package/lib/components/tabProduct/index.js +15 -6
  74. package/lib/components/tabProduct/tabs/index.d.ts +3 -3
  75. package/lib/components/tabProduct/tabs/index.js +10 -6
  76. package/package.json +4 -4
@@ -37,6 +37,8 @@ __export(utils_exports, {
37
37
  calcCalendarDataByTimeSlots: () => calcCalendarDataByTimeSlots,
38
38
  calcMinTimeMaxTimeBySchedules: () => calcMinTimeMaxTimeBySchedules,
39
39
  calcScheduleDateRange: () => calcScheduleDateRange,
40
+ formatScheduleData: () => formatScheduleData,
41
+ formatScheduleListByTabs: () => formatScheduleListByTabs,
40
42
  formatScheduleResult: () => formatScheduleResult,
41
43
  getDaysByStartEnd: () => getDaysByStartEnd,
42
44
  isAllDay: () => isAllDay
@@ -540,6 +542,100 @@ var calcMinTimeMaxTimeBySchedules = (schedules, scheduleAllMap, selectDate) => {
540
542
  };
541
543
  }, {});
542
544
  };
545
+ var formatScheduleData = (relation, table_type, item_type, isExcluded) => {
546
+ const _relation = relation || [];
547
+ if (table_type && item_type && isExcluded) {
548
+ return _relation.find((item) => (item == null ? void 0 : item.relation_table_type) === table_type && (item == null ? void 0 : item.item_type) !== item_type);
549
+ }
550
+ if (table_type && item_type) {
551
+ return _relation.find((item) => (item == null ? void 0 : item.relation_table_type) === table_type && (item == null ? void 0 : item.item_type) === item_type);
552
+ }
553
+ if (table_type) {
554
+ return _relation.some((item) => (item == null ? void 0 : item.relation_table_type) === table_type);
555
+ }
556
+ if (item_type) {
557
+ return _relation.find((item) => (item == null ? void 0 : item.item_type) === item_type);
558
+ }
559
+ };
560
+ var formatScheduleListByTabs = (list, filterItem) => {
561
+ let _list = list || [];
562
+ if (filterItem) {
563
+ _list = _list.filter(filterItem);
564
+ }
565
+ let categoryObject = {
566
+ // 全部
567
+ all: {
568
+ id: 0,
569
+ name: import_utils.locales.getText("pisell2.schedule.tab.all"),
570
+ products: _list
571
+ },
572
+ // 附加费
573
+ surcharge: {
574
+ id: 1,
575
+ name: import_utils.locales.getText("pisell2.schedule.tab.surcharge"),
576
+ products: []
577
+ },
578
+ // 资源
579
+ resources: {
580
+ id: 2,
581
+ name: import_utils.locales.getText("pisell2.schedule.tab.resources"),
582
+ products: []
583
+ },
584
+ // 商品
585
+ products: {
586
+ id: 3,
587
+ name: import_utils.locales.getText("pisell2.schedule.tab.products"),
588
+ products: []
589
+ },
590
+ // 活动
591
+ events: {
592
+ id: 4,
593
+ name: import_utils.locales.getText("pisell2.schedule.tab.events"),
594
+ products: []
595
+ },
596
+ // 报价单
597
+ quotation: {
598
+ id: 5,
599
+ name: import_utils.locales.getText("pisell2.schedule.tab.quotation"),
600
+ products: []
601
+ },
602
+ // 营业时间
603
+ "open-hours": {
604
+ id: 6,
605
+ name: import_utils.locales.getText("pisell2.schedule.tab.open-hours"),
606
+ products: []
607
+ }
608
+ };
609
+ for (let i = 0; i < _list.length; i++) {
610
+ const productItem = _list[i];
611
+ const _relation = productItem.relation || [];
612
+ if (formatScheduleData(_relation, "custom_surcharge")) {
613
+ categoryObject.surcharge.products.push(productItem);
614
+ }
615
+ if (formatScheduleData(_relation, "form", "opening_hours", true)) {
616
+ categoryObject.resources.products.push(productItem);
617
+ }
618
+ if (formatScheduleData(_relation, "product")) {
619
+ categoryObject.products.products.push(productItem);
620
+ }
621
+ if (formatScheduleData(_relation, "product", "event_item")) {
622
+ categoryObject.events.products.push(productItem);
623
+ }
624
+ if (formatScheduleData(_relation, "shelf", "quotation")) {
625
+ categoryObject.quotation.products.push(productItem);
626
+ }
627
+ if (formatScheduleData(_relation, "", "opening_hours")) {
628
+ categoryObject["open-hours"].products.push(productItem);
629
+ }
630
+ }
631
+ Object.keys(categoryObject).forEach((cur) => {
632
+ var _a, _b;
633
+ if (((_b = (_a = categoryObject == null ? void 0 : categoryObject[cur]) == null ? void 0 : _a.products) == null ? void 0 : _b.length) === 0) {
634
+ delete categoryObject[cur];
635
+ }
636
+ });
637
+ return Object.values(categoryObject);
638
+ };
543
639
  // Annotate the CommonJS export names for ESM import in node:
544
640
  0 && (module.exports = {
545
641
  calcCalendarDataByDesignation,
@@ -550,6 +646,8 @@ var calcMinTimeMaxTimeBySchedules = (schedules, scheduleAllMap, selectDate) => {
550
646
  calcCalendarDataByTimeSlots,
551
647
  calcMinTimeMaxTimeBySchedules,
552
648
  calcScheduleDateRange,
649
+ formatScheduleData,
650
+ formatScheduleListByTabs,
553
651
  formatScheduleResult,
554
652
  getDaysByStartEnd,
555
653
  isAllDay
@@ -57,6 +57,13 @@ export declare type ScheduleItem = {
57
57
  /** 是否全天 */
58
58
  is_all: 1 | 0;
59
59
  [key: string]: any;
60
+ relation?: {
61
+ id: number;
62
+ item_id: number;
63
+ item_type: string;
64
+ relation_table_type: string;
65
+ schedule_id: number;
66
+ }[];
60
67
  };
61
68
  export declare type ScheduleFormOtherValue = {
62
69
  /** 截止模式
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  export interface TabProductProps {
4
4
  list?: any[];
5
5
  scrollDom?: string;
@@ -10,6 +10,7 @@ export interface TabProductProps {
10
10
  listWrapClassName?: string;
11
11
  warpClassName?: string;
12
12
  stickyTop?: number;
13
+ name?: string | number;
13
14
  }
14
15
  declare const TabProduct: (props: TabProductProps) => React.JSX.Element;
15
16
  export default TabProduct;
@@ -38,6 +38,7 @@ var import_card = __toESM(require("./card"));
38
38
  var import_classnames = __toESM(require("classnames"));
39
39
  var import_index = require("./index.less");
40
40
  var io = null;
41
+ var tabsHeight = 92;
41
42
  var TabProduct = (props) => {
42
43
  const {
43
44
  list = [],
@@ -48,7 +49,8 @@ var TabProduct = (props) => {
48
49
  listWrapClassName,
49
50
  renderItem,
50
51
  warpClassName,
51
- stickyTop = 0
52
+ stickyTop = 0,
53
+ name
52
54
  } = props;
53
55
  const tabsRef = (0, import_react.useRef)();
54
56
  const [current, setCurrent] = (0, import_react.useState)(1);
@@ -59,18 +61,24 @@ var TabProduct = (props) => {
59
61
  }
60
62
  }, [list]);
61
63
  const handleObserver = () => {
64
+ var _a;
65
+ const domHeight = scrollDom ? ((_a = document.querySelector(scrollDom)) == null ? void 0 : _a.clientHeight) || window.innerHeight : window.innerHeight;
66
+ const marginTop = `-${tabsHeight}px`;
67
+ const marginBottom = `-${domHeight - tabsHeight - 10}px`;
62
68
  io = new IntersectionObserver(
63
69
  (entries) => {
64
- var _a, _b, _c, _d;
70
+ var _a2, _b, _c, _d;
65
71
  console.log(entries);
66
72
  if (entries[0].isIntersecting) {
67
- const [name, id] = (_c = (_b = (_a = entries[0]) == null ? void 0 : _a.target) == null ? void 0 : _b.id) == null ? void 0 : _c.split("-");
73
+ const [name2, id] = (_c = (_b = (_a2 = entries[0]) == null ? void 0 : _a2.target) == null ? void 0 : _b.id) == null ? void 0 : _c.split("-");
68
74
  setCurrent(Number(id));
69
75
  (_d = tabsRef == null ? void 0 : tabsRef.current) == null ? void 0 : _d.scroll(id);
70
76
  }
71
77
  },
72
78
  {
73
- root: scrollDom ? document.querySelector(scrollDom) : null
79
+ root: scrollDom ? document.querySelector(scrollDom) : null,
80
+ rootMargin: `${marginTop} 0px ${marginBottom}`
81
+ // threshold: 0.5,
74
82
  // rootMargin: ,
75
83
  }
76
84
  );
@@ -105,7 +113,7 @@ var TabProduct = (props) => {
105
113
  import_card.default,
106
114
  {
107
115
  className: (0, import_classnames.default)("tabs", tabsWrapClassName),
108
- id: "product-category"
116
+ id: `${name || "product"}-category`
109
117
  },
110
118
  /* @__PURE__ */ import_react.default.createElement(
111
119
  import_tabs.default,
@@ -114,11 +122,12 @@ var TabProduct = (props) => {
114
122
  options: list,
115
123
  rowKey,
116
124
  tab: current,
125
+ name,
117
126
  onChange: (e) => {
118
127
  const dom = document == null ? void 0 : document.querySelector("#list-" + e);
119
128
  const main = document == null ? void 0 : document.querySelector(scrollDom || "");
120
129
  if (dom && main) {
121
- main.scrollTop = dom.offsetTop - 40;
130
+ main.scrollTop = dom.offsetTop - 42;
122
131
  }
123
132
  handleUnObserver();
124
133
  setCurrent(e);
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  export interface Com<T> extends React.FC<T> {
4
4
  }
5
5
  export declare type RowKey = string | number;
@@ -7,7 +7,7 @@ export interface Option {
7
7
  id: number | string;
8
8
  name: React.ReactNode;
9
9
  }
10
- export interface TabsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "onChange"> {
10
+ export interface TabsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'> {
11
11
  renderTab: (item: any) => React.ReactNode;
12
12
  rowKey: RowKey;
13
13
  name: RowKey;
@@ -63,9 +63,13 @@ var Tabs = ({ renderTab, rowKey, name = "tabs-", onChange, tab, className, optio
63
63
  calculateWidth();
64
64
  }
65
65
  }, [options]);
66
+ const _id = (0, import_react.useMemo)(() => {
67
+ const _id2 = name ? `pisell-${name}-tabs` : "pisell-tabs";
68
+ return _id2;
69
+ }, [name]);
66
70
  const calculateWidth = () => {
67
- const content2 = document.querySelector("#pisell-tabs");
68
- const itemList = document.querySelector("#pisell-tabs-content");
71
+ const content2 = document.querySelector(`#${_id}`);
72
+ const itemList = document.querySelector(`#${_id}-content`);
69
73
  if ((itemList == null ? void 0 : itemList.offsetWidth) + 60 < (content2 == null ? void 0 : content2.offsetWidth)) {
70
74
  setIsShowButton(false);
71
75
  }
@@ -98,7 +102,7 @@ var Tabs = ({ renderTab, rowKey, name = "tabs-", onChange, tab, className, optio
98
102
  debounceChange.run({ current, total });
99
103
  };
100
104
  const setTabScroll = (val) => {
101
- let dom = document.querySelector("#pisell-tabs-content");
105
+ let dom = document.querySelector(`#${_id}-content`);
102
106
  console.log("domdom", dom);
103
107
  if (!dom) {
104
108
  return;
@@ -106,7 +110,7 @@ var Tabs = ({ renderTab, rowKey, name = "tabs-", onChange, tab, className, optio
106
110
  dom.scrollLeft = val;
107
111
  };
108
112
  const onPageChange = (type) => {
109
- let dom = document.querySelector("#pisell-tabs-content");
113
+ let dom = document.querySelector(`#${_id}-content`);
110
114
  if (!dom) {
111
115
  return;
112
116
  }
@@ -150,7 +154,7 @@ var Tabs = ({ renderTab, rowKey, name = "tabs-", onChange, tab, className, optio
150
154
  "div",
151
155
  {
152
156
  className: "pisell-tabs-content",
153
- id: "pisell-tabs-content",
157
+ id: `${_id}-content`,
154
158
  onScroll
155
159
  },
156
160
  _options.map((d, i) => {
@@ -172,6 +176,6 @@ var Tabs = ({ renderTab, rowKey, name = "tabs-", onChange, tab, className, optio
172
176
  })
173
177
  );
174
178
  }, [_options, rowKey, name, tab]);
175
- return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-tabs", className), id: "pisell-tabs" }, isShowButton && leftBtn, content, isShowButton && rightBtn);
179
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("pisell-tabs", className), id: _id }, isShowButton && leftBtn, content, isShowButton && rightBtn);
176
180
  };
177
181
  var tabs_default = (0, import_react.forwardRef)(Tabs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "3.0.119",
3
+ "version": "3.0.121",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -59,10 +59,10 @@
59
59
  "react-infinite-scroll-component": "^6.1.0",
60
60
  "rc-virtual-list": "^3.11.3",
61
61
  "decimal.js": "^10.4.3",
62
- "@pisell/icon": "0.0.11",
63
- "@pisell/date-picker": "1.0.97",
64
62
  "@pisell/utils": "1.0.28",
65
- "@pisell/materials": "3.0.38"
63
+ "@pisell/icon": "0.0.11",
64
+ "@pisell/materials": "3.0.38",
65
+ "@pisell/date-picker": "1.0.97"
66
66
  },
67
67
  "peerDependencies": {
68
68
  "react": "^18.0.0",