@pisell/private-materials 3.4.82 → 3.4.83

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 (162) 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 +2 -2
  6. package/build/lowcode/preview.js +152 -152
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +18 -10
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +18 -10
  11. package/es/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  12. package/es/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  13. package/es/components/booking/notes/NoteBlock/index.js +3 -2
  14. package/es/components/booking/utils.d.ts +2 -2
  15. package/es/components/eftpos/hooks.d.ts +0 -1
  16. package/es/components/eftposPay/amount.d.ts +1 -1
  17. package/es/components/eftposPay/app.d.ts +1 -1
  18. package/es/components/eftposPay/device.d.ts +1 -1
  19. package/es/components/eftposPay/hooks.d.ts +2 -2
  20. package/es/components/eftposPay/store/index.d.ts +6 -6
  21. package/es/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  22. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  23. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  24. package/es/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  25. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  26. package/es/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  27. package/es/hooks/usePaymentLogger.d.ts +0 -1
  28. package/es/index.d.ts +4 -2
  29. package/es/index.js +3 -1
  30. package/es/plus/contactInfo/components/SwipeAction/index.js +1 -1
  31. package/es/plus/orderList/components/HandleActions.d.ts +1 -0
  32. package/es/plus/orderList/components/HandleActions.js +5 -2
  33. package/es/plus/orderList/components/Toolbar.d.ts +1 -0
  34. package/es/plus/orderList/components/Toolbar.js +4 -2
  35. package/es/plus/orderList/index.d.ts +1 -0
  36. package/es/plus/orderList/index.js +7 -2
  37. package/es/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  38. package/es/plus/pisellSalesGrid/PisellSalesGrid.js +363 -0
  39. package/es/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  40. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  41. package/es/plus/pisellSalesGrid/PisellSalesGrid.stories.js +559 -0
  42. package/es/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  43. package/es/plus/pisellSalesGrid/hooks/useActions.js +723 -0
  44. package/es/plus/pisellSalesGrid/index.d.ts +4 -0
  45. package/es/plus/pisellSalesGrid/index.js +3 -0
  46. package/es/plus/pisellSalesGrid/locales.d.ts +9 -0
  47. package/es/plus/pisellSalesGrid/locales.js +8 -0
  48. package/es/plus/pisellSalesGrid/serve.d.ts +19 -0
  49. package/es/plus/pisellSalesGrid/serve.js +151 -0
  50. package/es/plus/pisellSalesGrid/types.d.ts +170 -0
  51. package/es/plus/pisellSalesGrid/types.js +1 -0
  52. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  53. package/es/plus/pisellSalesManagement/components/BookingFormsPreview.js +211 -0
  54. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  55. package/es/plus/pisellSalesManagement/components/BookingNotesPreview.js +167 -0
  56. package/es/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  57. package/es/plus/pisellSalesManagement/components/ResourceSelector.js +102 -0
  58. package/es/plus/pisellSalesManagement/config/booking.d.ts +185 -0
  59. package/es/plus/pisellSalesManagement/config/booking.js +380 -0
  60. package/es/plus/pisellSalesManagement/config/index.d.ts +2 -0
  61. package/es/plus/pisellSalesManagement/config/index.js +11 -0
  62. package/es/plus/pisellSalesManagement/config/order.d.ts +172 -0
  63. package/es/plus/pisellSalesManagement/config/order.js +460 -0
  64. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  65. package/es/plus/pisellSalesManagement/hooks/perspectiveUtils.js +66 -0
  66. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  67. package/es/plus/pisellSalesManagement/hooks/useBookingPerspective.js +651 -0
  68. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  69. package/es/plus/pisellSalesManagement/hooks/useOrderPerspective.js +656 -0
  70. package/es/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  71. package/es/plus/pisellSalesManagement/hooks/usePerspectives.js +12 -0
  72. package/es/plus/pisellSalesManagement/index.d.ts +10 -0
  73. package/es/plus/pisellSalesManagement/index.js +84 -0
  74. package/es/plus/pisellSalesManagement/locales.d.ts +303 -0
  75. package/es/plus/pisellSalesManagement/locales.js +302 -0
  76. package/es/plus/pisellSalesManagement/serve.d.ts +26 -0
  77. package/es/plus/pisellSalesManagement/serve.js +222 -0
  78. package/es/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  79. package/es/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  80. package/es/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
  81. package/es/plus/walletPassGallery/components/passDetail/index.js +2 -26
  82. package/es/plus/walletPassGallery/components/passList/index.js +8 -1
  83. package/es/plus/walletPassGallery/index.js +0 -31
  84. package/es/pro/Selector/Selector.d.ts +1 -1
  85. package/lib/components/booking/forms/sendModal/useSendModal.d.ts +0 -1
  86. package/lib/components/booking/info/hooks/useInfoHolder.d.ts +0 -1
  87. package/lib/components/booking/notes/NoteBlock/index.js +2 -1
  88. package/lib/components/booking/utils.d.ts +2 -2
  89. package/lib/components/eftpos/hooks.d.ts +0 -1
  90. package/lib/components/eftposPay/amount.d.ts +1 -1
  91. package/lib/components/eftposPay/app.d.ts +1 -1
  92. package/lib/components/eftposPay/device.d.ts +1 -1
  93. package/lib/components/eftposPay/hooks.d.ts +2 -2
  94. package/lib/components/eftposPay/store/index.d.ts +6 -6
  95. package/lib/components/eventBooking/components/ErrorTip/index.d.ts +0 -1
  96. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/CallToBook/index.d.ts +0 -1
  97. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/WeekItem/index.d.ts +0 -1
  98. package/lib/components/eventBooking/components/bookingAvailabilityCalendar/components/CalendarDate/CalenDateWeek/index.d.ts +0 -1
  99. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/Finish/index.d.ts +0 -1
  100. package/lib/components/pay/toC/PaymentMethods/StripePay/Stripe/components/PageLoading/index.d.ts +0 -1
  101. package/lib/hooks/usePaymentLogger.d.ts +0 -1
  102. package/lib/index.d.ts +4 -2
  103. package/lib/index.js +8 -2
  104. package/lib/plus/contactInfo/components/SwipeAction/index.js +23 -23
  105. package/lib/plus/orderList/components/HandleActions.d.ts +1 -0
  106. package/lib/plus/orderList/components/HandleActions.js +2 -2
  107. package/lib/plus/orderList/components/Toolbar.d.ts +1 -0
  108. package/lib/plus/orderList/components/Toolbar.js +2 -2
  109. package/lib/plus/orderList/index.d.ts +1 -0
  110. package/lib/plus/orderList/index.js +3 -3
  111. package/lib/plus/pisellSalesGrid/PisellSalesGrid.d.ts +5 -0
  112. package/lib/plus/pisellSalesGrid/PisellSalesGrid.js +339 -0
  113. package/lib/plus/pisellSalesGrid/PisellSalesGrid.less +16 -0
  114. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.d.ts +14 -0
  115. package/lib/plus/pisellSalesGrid/PisellSalesGrid.stories.js +455 -0
  116. package/lib/plus/pisellSalesGrid/hooks/useActions.d.ts +19 -0
  117. package/lib/plus/pisellSalesGrid/hooks/useActions.js +545 -0
  118. package/lib/plus/pisellSalesGrid/index.d.ts +4 -0
  119. package/lib/plus/pisellSalesGrid/index.js +42 -0
  120. package/lib/plus/pisellSalesGrid/locales.d.ts +9 -0
  121. package/lib/plus/pisellSalesGrid/locales.js +29 -0
  122. package/lib/plus/pisellSalesGrid/serve.d.ts +19 -0
  123. package/lib/plus/pisellSalesGrid/serve.js +142 -0
  124. package/lib/plus/pisellSalesGrid/types.d.ts +170 -0
  125. package/lib/plus/pisellSalesGrid/types.js +17 -0
  126. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.d.ts +15 -0
  127. package/lib/plus/pisellSalesManagement/components/BookingFormsPreview.js +250 -0
  128. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.d.ts +19 -0
  129. package/lib/plus/pisellSalesManagement/components/BookingNotesPreview.js +193 -0
  130. package/lib/plus/pisellSalesManagement/components/ResourceSelector.d.ts +9 -0
  131. package/lib/plus/pisellSalesManagement/components/ResourceSelector.js +106 -0
  132. package/lib/plus/pisellSalesManagement/config/booking.d.ts +185 -0
  133. package/lib/plus/pisellSalesManagement/config/booking.js +500 -0
  134. package/lib/plus/pisellSalesManagement/config/index.d.ts +2 -0
  135. package/lib/plus/pisellSalesManagement/config/index.js +43 -0
  136. package/lib/plus/pisellSalesManagement/config/order.d.ts +172 -0
  137. package/lib/plus/pisellSalesManagement/config/order.js +492 -0
  138. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.d.ts +15 -0
  139. package/lib/plus/pisellSalesManagement/hooks/perspectiveUtils.js +113 -0
  140. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.d.ts +2 -0
  141. package/lib/plus/pisellSalesManagement/hooks/useBookingPerspective.js +699 -0
  142. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.d.ts +2 -0
  143. package/lib/plus/pisellSalesManagement/hooks/useOrderPerspective.js +700 -0
  144. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.d.ts +5 -0
  145. package/lib/plus/pisellSalesManagement/hooks/usePerspectives.js +42 -0
  146. package/lib/plus/pisellSalesManagement/index.d.ts +10 -0
  147. package/lib/plus/pisellSalesManagement/index.js +113 -0
  148. package/lib/plus/pisellSalesManagement/locales.d.ts +303 -0
  149. package/lib/plus/pisellSalesManagement/locales.js +326 -0
  150. package/lib/plus/pisellSalesManagement/serve.d.ts +26 -0
  151. package/lib/plus/pisellSalesManagement/serve.js +120 -0
  152. package/lib/plus/selectHolder/components/ErrorTip/index.d.ts +0 -1
  153. package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +1 -1
  154. package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +0 -1
  155. package/lib/plus/walletPassGallery/components/passDetail/index.js +1 -16
  156. package/lib/plus/walletPassGallery/components/passList/index.js +9 -3
  157. package/lib/plus/walletPassGallery/index.js +0 -29
  158. package/lib/pro/Selector/Selector.d.ts +1 -1
  159. package/lowcode/eco-cup-list/meta.ts +1 -1
  160. package/lowcode/eco-customer-list/meta.ts +1 -1
  161. package/lowcode/pisell-sales-management/meta.ts +88 -0
  162. package/package.json +4 -4
@@ -0,0 +1,193 @@
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/plus/pisellSalesManagement/components/BookingNotesPreview.tsx
30
+ var BookingNotesPreview_exports = {};
31
+ __export(BookingNotesPreview_exports, {
32
+ default: () => BookingNotesPreview_default
33
+ });
34
+ module.exports = __toCommonJS(BookingNotesPreview_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_materials = require("@pisell/materials");
37
+ var import_utils = require("@pisell/utils");
38
+ var import_NoteBlock = __toESM(require("../../../components/booking/notes/NoteBlock"));
39
+ var import_perspectiveUtils = require("../hooks/perspectiveUtils");
40
+ var normalizeInternalNotes = (value) => {
41
+ if (!value) return [];
42
+ if (Array.isArray(value)) {
43
+ return value.map((item, index) => {
44
+ if (typeof item === "string" || typeof item === "number") {
45
+ return { id: index, content: String(item) };
46
+ }
47
+ if (item && typeof item === "object") {
48
+ return item;
49
+ }
50
+ return { id: index, content: String(item) };
51
+ }).filter((item) => (item == null ? void 0 : item.content) != null && (item == null ? void 0 : item.content) !== "");
52
+ }
53
+ if (typeof value === "string" || typeof value === "number") {
54
+ return [{ id: 0, content: String(value) }];
55
+ }
56
+ return [];
57
+ };
58
+ var BookingNotesPreview = (props) => {
59
+ const { dataSource, labels, style } = props;
60
+ const orderNote = typeof (dataSource == null ? void 0 : dataSource.note) === "string" ? dataSource.note.trim() : "";
61
+ const internalNotes = (0, import_react.useMemo)(
62
+ () => normalizeInternalNotes(dataSource == null ? void 0 : dataSource.internalNotes),
63
+ [dataSource == null ? void 0 : dataSource.internalNotes]
64
+ );
65
+ const displayLines = (0, import_react.useMemo)(() => {
66
+ const lines = [];
67
+ if (orderNote) {
68
+ lines.push({
69
+ label: (labels == null ? void 0 : labels.orderNote) || import_utils.locales.getText("pisell2.salesManagement.booking.notes.orderNotes"),
70
+ content: orderNote
71
+ });
72
+ }
73
+ internalNotes.forEach((item) => {
74
+ const content = typeof (item == null ? void 0 : item.content) === "string" ? item.content.trim() : "";
75
+ if (!content) return;
76
+ lines.push({
77
+ label: (labels == null ? void 0 : labels.internalNote) || import_utils.locales.getText(
78
+ "pisell2.salesManagement.booking.notes.internalNotes"
79
+ ),
80
+ content
81
+ });
82
+ });
83
+ return lines;
84
+ }, [orderNote, internalNotes, labels == null ? void 0 : labels.orderNote, labels == null ? void 0 : labels.internalNote]);
85
+ const visibleLines = displayLines.slice(0, 2);
86
+ const showMore = displayLines.length > 0;
87
+ const [modalOpen, setModalOpen] = (0, import_react.useState)(false);
88
+ if (!displayLines.length) {
89
+ return null;
90
+ }
91
+ const openNotesModal = (event) => {
92
+ event.stopPropagation();
93
+ setModalOpen(true);
94
+ };
95
+ const orderNotes = orderNote ? [
96
+ {
97
+ id: 0,
98
+ content: orderNote
99
+ }
100
+ ] : [];
101
+ const isEditable = Boolean(dataSource == null ? void 0 : dataSource.apis);
102
+ return /* @__PURE__ */ import_react.default.createElement("div", { style, onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react.default.createElement(
103
+ "div",
104
+ {
105
+ style: {
106
+ display: "flex",
107
+ flexDirection: "column",
108
+ cursor: "pointer"
109
+ },
110
+ onClick: openNotesModal
111
+ },
112
+ visibleLines.map((line, index) => /* @__PURE__ */ import_react.default.createElement(
113
+ "div",
114
+ {
115
+ key: `${line.label}-${index}`,
116
+ style: {
117
+ ...import_perspectiveUtils.textStyles.text,
118
+ fontSize: 14,
119
+ whiteSpace: "nowrap",
120
+ overflow: "hidden",
121
+ textOverflow: "ellipsis"
122
+ }
123
+ },
124
+ /* @__PURE__ */ import_react.default.createElement("span", null, line.label, ":"),
125
+ " ",
126
+ /* @__PURE__ */ import_react.default.createElement("span", { style: { color: "#eaa96f" } }, line.content)
127
+ )),
128
+ showMore ? /* @__PURE__ */ import_react.default.createElement(
129
+ "div",
130
+ {
131
+ style: {
132
+ color: "#7f56d9",
133
+ display: "flex",
134
+ alignItems: "center"
135
+ }
136
+ },
137
+ (labels == null ? void 0 : labels.more) || import_utils.locales.getText("pisell2.salesManagement.booking.view-more"),
138
+ /* @__PURE__ */ import_react.default.createElement(import_materials.Icon, { size: 20, type: "pisell2-chevron-right-double" })
139
+ ) : null
140
+ ), /* @__PURE__ */ import_react.default.createElement(
141
+ import_materials.PisellModal,
142
+ {
143
+ open: modalOpen,
144
+ title: import_utils.locales.getText("pisell2.salesManagement.booking.notes.title"),
145
+ width: 600,
146
+ footer: null,
147
+ onCancel: () => setModalOpen(false),
148
+ destroyOnClose: true,
149
+ bodyStyle: {
150
+ overflowX: "hidden"
151
+ }
152
+ },
153
+ /* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 16 } }, /* @__PURE__ */ import_react.default.createElement(
154
+ import_NoteBlock.default,
155
+ {
156
+ noteType: "order",
157
+ maxLength: 1,
158
+ title: `${import_utils.locales.getText(
159
+ "pisell2.salesManagement.booking.notes.orderNotes"
160
+ )}:`,
161
+ describe: "",
162
+ notes: orderNotes,
163
+ apis: dataSource == null ? void 0 : dataSource.apis,
164
+ placeholder: import_utils.locales.getText(
165
+ "pisell2.salesManagement.booking.notes.addOrderNotes"
166
+ ),
167
+ isEdit: isEditable,
168
+ onChange: dataSource == null ? void 0 : dataSource.onChange
169
+ }
170
+ ), (internalNotes.length > 0 || isEditable) && /* @__PURE__ */ import_react.default.createElement(
171
+ import_NoteBlock.default,
172
+ {
173
+ maxLength: 99,
174
+ noteType: "internal",
175
+ title: `${import_utils.locales.getText(
176
+ "pisell2.salesManagement.booking.notes.internalNotes"
177
+ )}:`,
178
+ describe: import_utils.locales.getText(
179
+ "pisell2.salesManagement.booking.notes.internalVisibleOnlyTip"
180
+ ),
181
+ placeholder: import_utils.locales.getText(
182
+ "pisell2.salesManagement.booking.notes.addInternalNotes"
183
+ ),
184
+ notes: internalNotes,
185
+ isEdit: isEditable,
186
+ apis: dataSource == null ? void 0 : dataSource.apis,
187
+ bookingId: dataSource == null ? void 0 : dataSource.bookingId,
188
+ onChange: dataSource == null ? void 0 : dataSource.onChange
189
+ }
190
+ ))
191
+ ));
192
+ };
193
+ var BookingNotesPreview_default = BookingNotesPreview;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare type ResourceSelectorProps = {
3
+ value?: Array<string | number> | string | number;
4
+ onChange?: (value: Array<string | number>) => void;
5
+ className?: string;
6
+ style?: React.CSSProperties;
7
+ };
8
+ declare const ResourceSelector: (props: ResourceSelectorProps) => React.JSX.Element;
9
+ export default ResourceSelector;
@@ -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/plus/pisellSalesManagement/components/ResourceSelector.tsx
30
+ var ResourceSelector_exports = {};
31
+ __export(ResourceSelector_exports, {
32
+ default: () => ResourceSelector_default
33
+ });
34
+ module.exports = __toCommonJS(ResourceSelector_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_antd = require("antd");
37
+ var import_ahooks = require("ahooks");
38
+ var import_utils = require("@pisell/utils");
39
+ var import_serve = require("../serve");
40
+ var formatResourceNode = (item) => {
41
+ const key = item.id ?? item.value ?? item.code ?? item.name ?? item.title ?? item.label ?? "";
42
+ return {
43
+ key,
44
+ value: key,
45
+ title: item.name ?? item.title ?? item.label,
46
+ children: formatResourceNodes(item.resources ?? item.children)
47
+ };
48
+ };
49
+ var formatResourceNodes = (items) => {
50
+ if (!items) return [];
51
+ return items.map(formatResourceNode);
52
+ };
53
+ var buildTreeData = (list) => {
54
+ console.log("xxxxxx", list);
55
+ const formatted = (list || []).map((item) => ({
56
+ ...item,
57
+ resources: item.resources ?? item.children
58
+ }));
59
+ formatted.unshift({
60
+ id: 0,
61
+ name: import_utils.locales.getText(
62
+ "pisell2.salesManagement.booking.filter.resource.none"
63
+ ),
64
+ resources: []
65
+ });
66
+ return formatResourceNodes(formatted);
67
+ };
68
+ var normalizeValue = (value) => {
69
+ if (Array.isArray(value)) return value;
70
+ if (value === void 0 || value === null) return [];
71
+ return [value];
72
+ };
73
+ var extractLeafKeys = (nodes) => {
74
+ if (!(nodes == null ? void 0 : nodes.length)) return [];
75
+ return nodes.filter((node) => !(node == null ? void 0 : node.children) || node.children.length === 0).map((node) => node.key ?? node.value).filter((key) => key !== void 0 && key !== null);
76
+ };
77
+ var ResourceSelector = (props) => {
78
+ const { value, onChange, className, style } = props;
79
+ const { data, loading } = (0, import_ahooks.useRequest)(import_serve.getResourceTypes);
80
+ const treeData = (0, import_react.useMemo)(() => buildTreeData(data || []), [data]);
81
+ const checkedKeys = (0, import_react.useMemo)(() => normalizeValue(value), [value]);
82
+ return /* @__PURE__ */ import_react.default.createElement("div", { className, style }, loading ? /* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { size: "small" }) : treeData.length ? /* @__PURE__ */ import_react.default.createElement(
83
+ import_antd.TreeSelect,
84
+ {
85
+ maxTagCount: "responsive",
86
+ value: checkedKeys,
87
+ treeData,
88
+ treeCheckable: true,
89
+ showCheckedStrategy: import_antd.TreeSelect.SHOW_CHILD,
90
+ treeNodeFilterProp: "title",
91
+ allowClear: true,
92
+ multiple: true,
93
+ style: { width: "100%" },
94
+ dropdownStyle: { maxHeight: 320, overflow: "auto" },
95
+ onChange: (nextValue, _label, extra) => {
96
+ const leafKeys = extractLeafKeys(extra == null ? void 0 : extra.allCheckedNodes);
97
+ const normalizedKeys = Array.isArray(nextValue) ? nextValue : nextValue != null ? [nextValue] : [];
98
+ onChange == null ? void 0 : onChange(leafKeys.length ? leafKeys : normalizedKeys);
99
+ },
100
+ placeholder: import_utils.locales.getText(
101
+ "pisell2.salesManagement.booking.filter.resource.placeholder"
102
+ )
103
+ }
104
+ ) : /* @__PURE__ */ import_react.default.createElement(import_antd.Empty, { image: import_antd.Empty.PRESENTED_IMAGE_SIMPLE }));
105
+ };
106
+ var ResourceSelector_default = ResourceSelector;
@@ -0,0 +1,185 @@
1
+ export declare const getBookingStatusMap: () => Record<string, string>;
2
+ export declare const BOOKING_STATUS_COLOR_MAP: Record<string, string>;
3
+ export declare const getBookingPlatformMap: () => Record<string, string>;
4
+ export declare const getBookingHeaderLabels: () => Record<string, string>;
5
+ export declare const defaultPaymentStatusKeys: string[];
6
+ export declare const getFilterButtonList: () => ({
7
+ name: string;
8
+ type: string;
9
+ key: string;
10
+ label: any;
11
+ other: {
12
+ allowClear: boolean;
13
+ mode: string;
14
+ maxTagCount: string;
15
+ placeholder: any;
16
+ options: {
17
+ label: string;
18
+ value: string;
19
+ }[];
20
+ minInputNumberProps?: undefined;
21
+ maxInputNumberProps?: undefined;
22
+ component?: undefined;
23
+ isSearchServer?: undefined;
24
+ showSearch?: undefined;
25
+ showTime?: undefined;
26
+ };
27
+ sort?: undefined;
28
+ localFilter?: undefined;
29
+ } | {
30
+ name: string;
31
+ type: string;
32
+ key: string;
33
+ label: any;
34
+ other: {
35
+ placeholder: any;
36
+ minInputNumberProps: {
37
+ min: number;
38
+ precision: number;
39
+ };
40
+ maxInputNumberProps: {
41
+ min: number;
42
+ precision: number;
43
+ };
44
+ allowClear?: undefined;
45
+ mode?: undefined;
46
+ maxTagCount?: undefined;
47
+ options?: undefined;
48
+ component?: undefined;
49
+ isSearchServer?: undefined;
50
+ showSearch?: undefined;
51
+ showTime?: undefined;
52
+ };
53
+ sort?: undefined;
54
+ localFilter?: undefined;
55
+ } | {
56
+ name: string;
57
+ type: string;
58
+ key: string;
59
+ label: any;
60
+ sort: boolean;
61
+ localFilter: boolean;
62
+ other: {
63
+ allowClear: boolean;
64
+ mode: string;
65
+ maxTagCount: string;
66
+ component: (props: {
67
+ value?: string | number | (string | number)[] | undefined;
68
+ onChange?: ((value: (string | number)[]) => void) | undefined;
69
+ className?: string | undefined;
70
+ style?: import("react").CSSProperties | undefined;
71
+ }) => import("react").JSX.Element;
72
+ placeholder?: undefined;
73
+ options?: undefined;
74
+ minInputNumberProps?: undefined;
75
+ maxInputNumberProps?: undefined;
76
+ isSearchServer?: undefined;
77
+ showSearch?: undefined;
78
+ showTime?: undefined;
79
+ };
80
+ } | {
81
+ name: string;
82
+ type: string;
83
+ key: string;
84
+ label: any;
85
+ other: {
86
+ allowClear: boolean;
87
+ mode: string;
88
+ maxTagCount: string;
89
+ placeholder: any;
90
+ options: () => Promise<any>;
91
+ minInputNumberProps?: undefined;
92
+ maxInputNumberProps?: undefined;
93
+ component?: undefined;
94
+ isSearchServer?: undefined;
95
+ showSearch?: undefined;
96
+ showTime?: undefined;
97
+ };
98
+ sort?: undefined;
99
+ localFilter?: undefined;
100
+ } | {
101
+ name: string;
102
+ type: string;
103
+ key: string;
104
+ label: any;
105
+ other: {
106
+ placeholder: any;
107
+ allowClear?: undefined;
108
+ mode?: undefined;
109
+ maxTagCount?: undefined;
110
+ options?: undefined;
111
+ minInputNumberProps?: undefined;
112
+ maxInputNumberProps?: undefined;
113
+ component?: undefined;
114
+ isSearchServer?: undefined;
115
+ showSearch?: undefined;
116
+ showTime?: undefined;
117
+ };
118
+ sort?: undefined;
119
+ localFilter?: undefined;
120
+ } | {
121
+ name: string;
122
+ type: string;
123
+ key: string;
124
+ label: any;
125
+ other: {
126
+ allowClear: boolean;
127
+ isSearchServer: boolean;
128
+ showSearch: boolean;
129
+ placeholder: any;
130
+ options: (params?: string) => Promise<any>;
131
+ mode?: undefined;
132
+ maxTagCount?: undefined;
133
+ minInputNumberProps?: undefined;
134
+ maxInputNumberProps?: undefined;
135
+ component?: undefined;
136
+ showTime?: undefined;
137
+ };
138
+ sort?: undefined;
139
+ localFilter?: undefined;
140
+ } | {
141
+ name: string;
142
+ type: string;
143
+ key: string;
144
+ label: any;
145
+ other: {
146
+ placeholder: any;
147
+ showTime: boolean;
148
+ allowClear?: undefined;
149
+ mode?: undefined;
150
+ maxTagCount?: undefined;
151
+ options?: undefined;
152
+ minInputNumberProps?: undefined;
153
+ maxInputNumberProps?: undefined;
154
+ component?: undefined;
155
+ isSearchServer?: undefined;
156
+ showSearch?: undefined;
157
+ };
158
+ sort?: undefined;
159
+ localFilter?: undefined;
160
+ })[];
161
+ export declare const getSortList: () => ({
162
+ type: string;
163
+ isCustom: boolean;
164
+ name: string;
165
+ label: any;
166
+ getSortItems: () => {
167
+ key: string;
168
+ label: any;
169
+ }[];
170
+ other?: undefined;
171
+ } | {
172
+ type: string;
173
+ isCustom: boolean;
174
+ name: string;
175
+ label: any;
176
+ getSortItems: () => {
177
+ key: string;
178
+ label: any;
179
+ }[];
180
+ other: {
181
+ style: {
182
+ width: string;
183
+ };
184
+ };
185
+ })[];