@pisell/materials 6.11.212 → 6.11.214

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 (63) 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/meta.js +1 -1
  5. package/build/lowcode/render/default/view.css +1 -1
  6. package/build/lowcode/render/default/view.js +6 -6
  7. package/build/lowcode/view.css +1 -1
  8. package/build/lowcode/view.js +5 -5
  9. package/es/components/PisellTabbar/PisellTabbar.js +35 -8
  10. package/es/components/PisellTabbar/template/Template1/PisellTabbar.js +35 -8
  11. package/es/components/PisellTabbar/types.d.ts +2 -0
  12. package/es/components/pisellFind/index.d.ts +9 -4
  13. package/es/components/pisellFind/index.js +46 -13
  14. package/es/components/pisellLookup/PisellLookup.js +7 -2
  15. package/es/components/pisellLookup/components/LookupTrigger.js +36 -9
  16. package/es/components/pisellLookup/types.d.ts +63 -0
  17. package/es/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +9 -2
  18. package/es/components/pisellRecordBoard/shellFrame/ToolBar/index.js +33 -9
  19. package/es/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +86 -11
  20. package/es/components/pisellRecordBoard/shellFrame/index.js +1 -0
  21. package/es/components/pisellRecordBoard/types.d.ts +7 -0
  22. package/es/components/pisellShellFrame/PisellShellFrame.less +5 -0
  23. package/es/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.js +6 -1
  24. package/es/components/pisellTimeRangeDisplay/components/TimeRangeBlock.js +53 -20
  25. package/es/components/productCard/lineItem/BookingLineItem.js +95 -32
  26. package/es/components/productCard/lineItem/index.js +9 -1
  27. package/es/components/productCard/lineItem/index.less +33 -0
  28. package/es/components/productCard/lineItem/locales.js +20 -5
  29. package/es/index.d.ts +1 -1
  30. package/lib/components/PisellTabbar/PisellTabbar.js +16 -4
  31. package/lib/components/PisellTabbar/template/Template1/PisellTabbar.js +16 -4
  32. package/lib/components/PisellTabbar/types.d.ts +2 -0
  33. package/lib/components/pisellFind/index.d.ts +9 -4
  34. package/lib/components/pisellFind/index.js +29 -10
  35. package/lib/components/pisellLookup/PisellLookup.js +9 -1
  36. package/lib/components/pisellLookup/components/LookupTrigger.js +17 -0
  37. package/lib/components/pisellLookup/types.d.ts +63 -0
  38. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/ToolBarFilter.less +9 -2
  39. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/index.js +21 -6
  40. package/lib/components/pisellRecordBoard/shellFrame/ToolBar/recordBoardToolbar.less +86 -11
  41. package/lib/components/pisellRecordBoard/shellFrame/index.js +1 -0
  42. package/lib/components/pisellRecordBoard/types.d.ts +7 -0
  43. package/lib/components/pisellShellFrame/PisellShellFrame.less +5 -0
  44. package/lib/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.js +6 -1
  45. package/lib/components/pisellTimeRangeDisplay/components/TimeRangeBlock.js +37 -20
  46. package/lib/components/productCard/lineItem/BookingLineItem.js +93 -43
  47. package/lib/components/productCard/lineItem/index.js +9 -1
  48. package/lib/components/productCard/lineItem/index.less +33 -0
  49. package/lib/components/productCard/lineItem/locales.js +20 -5
  50. package/lib/index.d.ts +1 -1
  51. package/package.json +2 -2
  52. package/es/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.d.ts +0 -32
  53. package/es/components/pisellTimeRangeDisplay/components/TimeRangeBlock.d.ts +0 -30
  54. package/es/components/pisellTimeRangeDisplay/types.d.ts +0 -137
  55. package/es/components/productCard/lineItem/BookingLineItem.d.ts +0 -19
  56. package/es/components/productCard/lineItem/index.d.ts +0 -69
  57. package/es/components/productCard/lineItem/locales.d.ts +0 -23
  58. package/lib/components/pisellTimeRangeDisplay/PisellTimeRangeDisplay.d.ts +0 -32
  59. package/lib/components/pisellTimeRangeDisplay/components/TimeRangeBlock.d.ts +0 -30
  60. package/lib/components/pisellTimeRangeDisplay/types.d.ts +0 -137
  61. package/lib/components/productCard/lineItem/BookingLineItem.d.ts +0 -19
  62. package/lib/components/productCard/lineItem/index.d.ts +0 -69
  63. package/lib/components/productCard/lineItem/locales.d.ts +0 -23
@@ -156,6 +156,15 @@ var RecordBoardToolBar = function RecordBoardToolBar(props) {
156
156
  rest = _objectWithoutProperties(_ref, _excluded2);
157
157
  return rest;
158
158
  }() : {};
159
+
160
+ /** 业务侧 toolBar.search.enableScanner;compact-narrow 仅在 Find 弹层打开时真正订阅 */
161
+ var searchEnableScannerConfigured = searchConfigRest && _typeof(searchConfigRest) === 'object' && searchConfigRest.enableScanner === true;
162
+ var _useState3 = useState(false),
163
+ _useState4 = _slicedToArray(_useState3, 2),
164
+ isFindSearchOpen = _useState4[0],
165
+ setIsFindSearchOpen = _useState4[1];
166
+ var searchConfigOnOpen = searchConfigRest === null || searchConfigRest === void 0 ? void 0 : searchConfigRest.onOpen;
167
+ var searchConfigOnClose = searchConfigRest === null || searchConfigRest === void 0 ? void 0 : searchConfigRest.onClose;
159
168
  var searchNode = hideSearch ? null : isCompactNarrow ? /*#__PURE__*/React.createElement(PisellFind, _extends({}, compactNarrowSearchRest, searchDebounceEnabled ? {
160
169
  debounceTime: searchDebounceMs
161
170
  } : {}, {
@@ -167,7 +176,16 @@ var RecordBoardToolBar = function RecordBoardToolBar(props) {
167
176
  className: "record-board-toolbar-find-icon",
168
177
  triggerIcon: /*#__PURE__*/React.createElement(SearchOutlined, {
169
178
  "aria-label": searchButtonText
170
- })
179
+ }),
180
+ enableScanner: searchEnableScannerConfigured && isFindSearchOpen,
181
+ onOpen: function onOpen() {
182
+ searchConfigOnOpen === null || searchConfigOnOpen === void 0 || searchConfigOnOpen();
183
+ setIsFindSearchOpen(true);
184
+ },
185
+ onClose: function onClose() {
186
+ searchConfigOnClose === null || searchConfigOnClose === void 0 || searchConfigOnClose();
187
+ setIsFindSearchOpen(false);
188
+ }
171
189
  })) : /*#__PURE__*/React.createElement(PisellFind, _extends({
172
190
  triggerType: "input",
173
191
  displayType: "inline",
@@ -249,10 +267,7 @@ var RecordBoardToolBar = function RecordBoardToolBar(props) {
249
267
  onChange: function onChange(v) {
250
268
  return setBodyView(v);
251
269
  },
252
- options: bodyViewSegmentedOptions,
253
- style: {
254
- marginRight: 8
255
- }
270
+ options: bodyViewSegmentedOptions
256
271
  }) : null;
257
272
 
258
273
  /** 平面图 / 日历模式:第二行工具(搜索/筛选等)收起;切换器在业务方 tabs 内(如预约 ScheduleBand) */
@@ -389,9 +404,15 @@ var RecordBoardToolBar = function RecordBoardToolBar(props) {
389
404
  var showColumnSetting = slots.columnSetting !== false && bodyView !== 'resourceWall' && Array.isArray(gridColumns) && gridColumns.length > 0;
390
405
 
391
406
  /**
392
- * compact-narrow:列显示 / 排序 / 筛选 / 重置 收入齿轮 Popover;顶栏右侧仅保留搜索图标 + 齿轮。
407
+ * 收纳到齿轮:compact-narrow 始终收纳;桌面在 `collapseActions==='gear'` opt-in 收纳。
393
408
  */
394
- var settingsGearPopoverContent = isCompactNarrow ? /*#__PURE__*/React.createElement("div", {
409
+ var collapseActionsToGear = slots.collapseActions === 'gear';
410
+ var shouldCollapseToGear = isCompactNarrow || collapseActionsToGear;
411
+
412
+ /**
413
+ * compact-narrow / opt-in:列显示 / 排序 / 筛选 / 重置 收入齿轮 Popover;顶栏右侧仅保留(搜索图标 +)齿轮。
414
+ */
415
+ var settingsGearPopoverContent = shouldCollapseToGear ? /*#__PURE__*/React.createElement("div", {
395
416
  className: "record-board-toolbar-settings-gear-popover"
396
417
  }, showColumnSetting ? /*#__PURE__*/React.createElement("div", {
397
418
  className: "record-board-toolbar-settings-gear-row"
@@ -409,7 +430,7 @@ var RecordBoardToolBar = function RecordBoardToolBar(props) {
409
430
  trigger: "click",
410
431
  placement: "bottomRight",
411
432
  arrow: false,
412
- overlayClassName: classNames('record-board-toolbar-settings-gear-overlay', isCompactNarrow && 'record-board-toolbar-settings-gear-overlay--compact-narrow')
433
+ overlayClassName: classNames('record-board-toolbar-settings-gear-overlay', isCompactNarrow && 'record-board-toolbar-settings-gear-overlay--compact-narrow', !isCompactNarrow && collapseActionsToGear && 'record-board-toolbar-settings-gear-overlay--collapsed-actions')
413
434
  }, /*#__PURE__*/React.createElement(Button, {
414
435
  className: "record-board-toolbar-settings-gear-btn",
415
436
  icon: /*#__PURE__*/React.createElement(SettingOutlined, null),
@@ -438,7 +459,10 @@ var RecordBoardToolBar = function RecordBoardToolBar(props) {
438
459
  var topRight = compactFloorMapToolbar ? null : isCompactNarrow ? mergeQuickFilterWithCompactTrailing ? (_slots$topRight = slots.topRight) !== null && _slots$topRight !== void 0 ? _slots$topRight : null : /*#__PURE__*/React.createElement(Space, {
439
460
  className: "record-board-toolbar-right-actions",
440
461
  size: 4
441
- }, bodyView !== 'resourceWall' && searchNode ? searchNode : null, settingsGearTrigger, slots.topRight) : /*#__PURE__*/React.createElement(Space, {
462
+ }, bodyView !== 'resourceWall' && searchNode ? searchNode : null, settingsGearTrigger, slots.topRight) : collapseActionsToGear && settingsGearTrigger ? /*#__PURE__*/React.createElement(Space, {
463
+ className: "record-board-toolbar-right-actions",
464
+ size: 8
465
+ }, settingsGearTrigger, slots.topRight) : /*#__PURE__*/React.createElement(Space, {
442
466
  className: "record-board-toolbar-right-actions"
443
467
  }, showColumnSetting ? /*#__PURE__*/React.createElement(RecordBoardColumnSetting, null) : null, sortNode, filterNode, bodyView !== 'resourceWall' ? /*#__PURE__*/React.createElement(ToolBarReset, {
444
468
  size: barSize
@@ -20,17 +20,34 @@
20
20
  padding-bottom: 0 !important;
21
21
  }
22
22
 
23
- /* 表格 / 资源墙:与主内容区左右对齐 16px;平面图、日历不加(日程带全宽) */
23
+ /* 表格 / 资源墙:左右 16px;上下 6px(覆盖 GridPro 默认 padding-bottom: 16px) */
24
24
  .pisell-grid-pro-toolbar.pisell-record-board-toolbar--grid,
25
25
  .pisell-grid-pro-toolbar.pisell-record-board-toolbar--resource-wall {
26
- padding-left: 16px;
27
- padding-right: 16px;
26
+ padding: 6px 16px !important;
27
+ gap: 4px;
28
+
29
+ > .pisell-grid-pro-toolbar-row.toolbar-row,
30
+ > .toolbar-row {
31
+ gap: 4px;
32
+ }
33
+
34
+ .toolbar-row-left {
35
+ gap: 4px;
36
+ align-items: center;
37
+ }
38
+
39
+ .toolbar-row-right {
40
+ gap: 4px;
41
+ }
42
+
43
+ .record-board-toolbar-right-actions.ant-space {
44
+ gap: 4px !important;
45
+ }
28
46
  }
29
47
 
30
48
  #body .pisell-grid-pro-toolbar.pisell-record-board-toolbar--grid,
31
49
  #body .pisell-grid-pro-toolbar.pisell-record-board-toolbar--resource-wall {
32
- padding-left: 16px;
33
- padding-right: 16px;
50
+ padding: 6px 16px !important;
34
51
  }
35
52
 
36
53
  /**
@@ -126,29 +143,29 @@
126
143
  */
127
144
  .pisell-grid-pro-toolbar.pisell-record-board-toolbar--compact {
128
145
  // padding-bottom: 8px !important;
129
- gap: 6px !important;
146
+ gap: 4px !important;
130
147
 
131
148
  > .pisell-grid-pro-toolbar-row.toolbar-row,
132
149
  > .toolbar-row {
133
- gap: 6px !important;
150
+ gap: 4px !important;
134
151
  align-items: center;
135
152
  }
136
153
 
137
154
  .toolbar-row-left {
138
155
  align-items: center !important;
139
- gap: 6px !important;
156
+ gap: 4px !important;
140
157
  }
141
158
 
142
159
  .toolbar-row-right {
143
- gap: 6px !important;
160
+ gap: 4px !important;
144
161
  }
145
162
 
146
163
  .record-board-toolbar-right-actions.ant-space {
147
- gap: 6px !important;
164
+ gap: 4px !important;
148
165
  }
149
166
 
150
167
  .record-board-toolbar-top-left {
151
- gap: 6px;
168
+ gap: 4px;
152
169
  }
153
170
 
154
171
  .pisell-lookup-input-suffix {
@@ -510,6 +527,64 @@
510
527
  }
511
528
  }
512
529
 
530
+ /**
531
+ * 桌面 opt-in 收纳(collapseActions='gear'):按钮等宽撑满、收紧上下间距,
532
+ * 避免默认居中布局在 180px Popover 内两侧/上下留出大量空白。
533
+ */
534
+ .record-board-toolbar-settings-gear-overlay--collapsed-actions {
535
+ .ant-popover-inner-content,
536
+ .pisell-lowcode-popover-inner-content {
537
+ box-sizing: border-box;
538
+ width: auto !important;
539
+ min-width: 120px !important;
540
+ padding: 6px !important;
541
+ }
542
+
543
+ .record-board-toolbar-settings-gear-popover {
544
+ gap: 6px;
545
+ width: 100%;
546
+ align-items: stretch;
547
+ }
548
+
549
+ .record-board-toolbar-settings-gear-row {
550
+ width: 100%;
551
+ gap: 6px;
552
+ }
553
+
554
+ /** Sort / Filter / Reset:等宽铺满,去掉两侧空白 */
555
+ .record-board-toolbar-settings-gear-row:has(.record-board-toolbar-filter-btn),
556
+ .record-board-toolbar-settings-gear-row:has(.record-board-toolbar-reset) {
557
+ justify-content: stretch;
558
+
559
+ > * {
560
+ display: block;
561
+ width: 100%;
562
+ min-width: 0;
563
+ }
564
+ }
565
+
566
+ .record-board-toolbar-filter-btn,
567
+ .record-board-toolbar-filter-btn.ant-btn,
568
+ .record-board-toolbar-filter-btn.pisell-lowcode-btn,
569
+ .record-board-toolbar-reset,
570
+ .record-board-toolbar-reset.ant-btn,
571
+ .record-board-toolbar-reset.pisell-lowcode-btn {
572
+ box-sizing: border-box;
573
+ width: 100% !important;
574
+ min-width: 0 !important;
575
+ min-height: 36px !important;
576
+ height: auto !important;
577
+ padding: 6px 10px !important;
578
+ justify-content: center;
579
+
580
+ &.pisell-lowcode-btn-lg,
581
+ &.ant-btn-lg {
582
+ min-height: 36px !important;
583
+ padding: 6px 10px !important;
584
+ }
585
+ }
586
+ }
587
+
513
588
  .record-board-toolbar-settings-gear-popover {
514
589
  display: flex;
515
590
  flex-direction: column;
@@ -270,6 +270,7 @@ var RecordBoardShellFrame = function RecordBoardShellFrame(_ref2) {
270
270
  className: classNames(className, {
271
271
  /** 非表格主区:工具栏与内容区无缝(与 PisellShellFrame.less body-subview 配对) */
272
272
  'pisell-shell-frame--body-subview': !showGrid,
273
+ 'pisell-shell-frame--grid-view': showGrid,
273
274
  'pisell-shell-frame--floor-map-view': showFloorMap,
274
275
  'pisell-shell-frame--calendar-view': showCalendar,
275
276
  'pisell-shell-frame--resource-wall-view': showResourceWall
@@ -707,6 +707,13 @@ export interface RecordBoardToolBarProps {
707
707
  * 以便快筛按钮换行后图标组与**最后一行**快筛右缘对齐(HUD 抽屉等极窄场景)。
708
708
  */
709
709
  mergeCompactNarrowTrailingWithQuickFilterRow?: boolean;
710
+ /**
711
+ * 桌面(非 compact-narrow)下把右侧操作区(列显示 / 排序 / 筛选 / 重置)收进一个齿轮按钮的 Popover,
712
+ * 复用 compact-narrow 的齿轮机制以节省顶栏宽度。opt-in,默认平铺。
713
+ * `compact-narrow` 始终强制收纳,不受此项影响。
714
+ * @default undefined
715
+ */
716
+ collapseActions?: 'gear';
710
717
  }
711
718
  /** Search 透传配置,与 PisellFind 的 props 对齐 */
712
719
  export declare type RecordBoardSearchProps = Record<string, any>;
@@ -45,6 +45,11 @@
45
45
  margin-bottom: 0;
46
46
  }
47
47
 
48
+ /** 表格主区:垂直间距由 GridPro 工具栏 padding 6px 承担,不再叠加 shell margin */
49
+ &--grid-view &-toolbar {
50
+ margin-bottom: 0;
51
+ }
52
+
48
53
  /**
49
54
  * 工具栏正下方的「附加条」:默认与 toolbar 留 8px 缝隙,让插入的轻量摘要
50
55
  * 与 toolbar 视觉上分开但不破坏顶栏整体节奏。空内容时塌陷不占位。
@@ -52,6 +52,8 @@ export var PisellTimeRangeDisplay = function PisellTimeRangeDisplay(props) {
52
52
  durationFormat = props.durationFormat,
53
53
  containerStyle = props.containerStyle,
54
54
  timeStyle = props.timeStyle,
55
+ startTimeStyle = props.startTimeStyle,
56
+ endTimeStyle = props.endTimeStyle,
55
57
  dateStyle = props.dateStyle,
56
58
  weekdayStyle = props.weekdayStyle,
57
59
  durationStyle = props.durationStyle,
@@ -123,8 +125,11 @@ export var PisellTimeRangeDisplay = function PisellTimeRangeDisplay(props) {
123
125
  timeFormat: timeFormat,
124
126
  dateFormat: effectiveDateFormat,
125
127
  weekdayFormat: weekdayFormat,
128
+ showWeekdayInCrossDay: showWeekday,
126
129
  referenceDate: dayjs(),
127
- style: timeStyle
130
+ style: timeStyle,
131
+ startStyle: startTimeStyle,
132
+ endStyle: endTimeStyle
128
133
  }) : null;
129
134
  case 'date':
130
135
  if (!showDate) return null;
@@ -1,21 +1,32 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  import React from 'react';
2
8
  import dayjs from 'dayjs';
3
- import { formatTime, getDatePartDisplay } from "../utils";
9
+ import { formatDate, formatTime, getDatePartDisplay } from "../utils";
4
10
  /**
5
11
  * 时间区间展示块
6
12
  * - 同一天:HH:mm-HH:mm
7
13
  * - 跨天:起止完整日期时间;若某端为相对日(今天/昨天/明天)则只显示「时间 相对日」,不显示星期+日期
8
14
  */
9
15
  export var TimeRangeBlock = function TimeRangeBlock(_ref) {
16
+ var _startStyle$fontSize, _startStyle$fontWeigh, _startStyle$color, _startStyle$lineHeigh, _endStyle$fontSize, _endStyle$fontWeight, _endStyle$color, _endStyle$lineHeight, _dateFormat$showYear;
10
17
  var start = _ref.start,
11
18
  end = _ref.end,
12
19
  isSameDay = _ref.isSameDay,
13
20
  timeFormat = _ref.timeFormat,
14
21
  dateFormat = _ref.dateFormat,
15
22
  weekdayFormat = _ref.weekdayFormat,
23
+ _ref$showWeekdayInCro = _ref.showWeekdayInCrossDay,
24
+ showWeekdayInCrossDay = _ref$showWeekdayInCro === void 0 ? true : _ref$showWeekdayInCro,
16
25
  _ref$referenceDate = _ref.referenceDate,
17
26
  referenceDate = _ref$referenceDate === void 0 ? dayjs() : _ref$referenceDate,
18
27
  style = _ref.style,
28
+ startStyle = _ref.startStyle,
29
+ endStyle = _ref.endStyle,
19
30
  className = _ref.className;
20
31
  var inlineStyle = {
21
32
  fontSize: style === null || style === void 0 ? void 0 : style.fontSize,
@@ -23,6 +34,18 @@ export var TimeRangeBlock = function TimeRangeBlock(_ref) {
23
34
  color: style === null || style === void 0 ? void 0 : style.color,
24
35
  lineHeight: style === null || style === void 0 ? void 0 : style.lineHeight
25
36
  };
37
+ var startInlineStyle = _objectSpread(_objectSpread({}, inlineStyle), {}, {
38
+ fontSize: (_startStyle$fontSize = startStyle === null || startStyle === void 0 ? void 0 : startStyle.fontSize) !== null && _startStyle$fontSize !== void 0 ? _startStyle$fontSize : inlineStyle.fontSize,
39
+ fontWeight: (_startStyle$fontWeigh = startStyle === null || startStyle === void 0 ? void 0 : startStyle.fontWeight) !== null && _startStyle$fontWeigh !== void 0 ? _startStyle$fontWeigh : inlineStyle.fontWeight,
40
+ color: (_startStyle$color = startStyle === null || startStyle === void 0 ? void 0 : startStyle.color) !== null && _startStyle$color !== void 0 ? _startStyle$color : inlineStyle.color,
41
+ lineHeight: (_startStyle$lineHeigh = startStyle === null || startStyle === void 0 ? void 0 : startStyle.lineHeight) !== null && _startStyle$lineHeigh !== void 0 ? _startStyle$lineHeigh : inlineStyle.lineHeight
42
+ });
43
+ var endInlineStyle = _objectSpread(_objectSpread({}, inlineStyle), {}, {
44
+ fontSize: (_endStyle$fontSize = endStyle === null || endStyle === void 0 ? void 0 : endStyle.fontSize) !== null && _endStyle$fontSize !== void 0 ? _endStyle$fontSize : inlineStyle.fontSize,
45
+ fontWeight: (_endStyle$fontWeight = endStyle === null || endStyle === void 0 ? void 0 : endStyle.fontWeight) !== null && _endStyle$fontWeight !== void 0 ? _endStyle$fontWeight : inlineStyle.fontWeight,
46
+ color: (_endStyle$color = endStyle === null || endStyle === void 0 ? void 0 : endStyle.color) !== null && _endStyle$color !== void 0 ? _endStyle$color : inlineStyle.color,
47
+ lineHeight: (_endStyle$lineHeight = endStyle === null || endStyle === void 0 ? void 0 : endStyle.lineHeight) !== null && _endStyle$lineHeight !== void 0 ? _endStyle$lineHeight : inlineStyle.lineHeight
48
+ });
26
49
  if (isSameDay) {
27
50
  var startStr = formatTime(start, timeFormat);
28
51
  var endStr = formatTime(end, timeFormat);
@@ -31,14 +54,17 @@ export var TimeRangeBlock = function TimeRangeBlock(_ref) {
31
54
  className: "pisell-time-range-display-time ".concat(className || '').trim(),
32
55
  style: inlineStyle
33
56
  }, /*#__PURE__*/React.createElement("span", {
34
- className: "pisell-time-range-display-time-start"
57
+ className: "pisell-time-range-display-time-start",
58
+ style: startInlineStyle
35
59
  }, startStr), /*#__PURE__*/React.createElement("span", {
36
60
  className: "pisell-time-range-display-time-end-wrap"
37
61
  }, /*#__PURE__*/React.createElement("span", {
38
62
  className: "pisell-time-range-display-time-sep",
63
+ style: inlineStyle,
39
64
  "aria-hidden": true
40
65
  }, " - "), /*#__PURE__*/React.createElement("span", {
41
- className: "pisell-time-range-display-time-end"
66
+ className: "pisell-time-range-display-time-end",
67
+ style: endInlineStyle
42
68
  }, endStr)));
43
69
  }
44
70
 
@@ -47,27 +73,27 @@ export var TimeRangeBlock = function TimeRangeBlock(_ref) {
47
73
  var dateFormatOverride = {
48
74
  order: 'DMY',
49
75
  shortMonth: true,
50
- showYear: isCrossYear,
76
+ showYear: (_dateFormat$showYear = dateFormat === null || dateFormat === void 0 ? void 0 : dateFormat.showYear) !== null && _dateFormat$showYear !== void 0 ? _dateFormat$showYear : isCrossYear,
51
77
  showMonth: true,
52
78
  showDay: true,
53
79
  useCommaBeforeYear: false
54
80
  };
55
81
  var startTimeStr = formatTime(start, timeFormat);
56
82
  var endTimeStr = formatTime(end, timeFormat);
57
- var startDatePart = getDatePartDisplay({
58
- date: start,
59
- dateFormat: dateFormat,
60
- weekdayFormat: weekdayFormat,
61
- referenceDate: referenceDate,
62
- dateFormatOverride: dateFormatOverride
63
- });
64
- var endDatePart = getDatePartDisplay({
65
- date: end,
66
- dateFormat: dateFormat,
67
- weekdayFormat: weekdayFormat,
68
- referenceDate: referenceDate,
69
- dateFormatOverride: dateFormatOverride
70
- });
83
+ var getCrossDayDatePart = function getCrossDayDatePart(date) {
84
+ if (!showWeekdayInCrossDay) {
85
+ return formatDate(date, _objectSpread(_objectSpread({}, dateFormat), dateFormatOverride));
86
+ }
87
+ return getDatePartDisplay({
88
+ date: date,
89
+ dateFormat: dateFormat,
90
+ weekdayFormat: weekdayFormat,
91
+ referenceDate: referenceDate,
92
+ dateFormatOverride: dateFormatOverride
93
+ });
94
+ };
95
+ var startDatePart = getCrossDayDatePart(start);
96
+ var endDatePart = getCrossDayDatePart(end);
71
97
  var startPart = "".concat(startTimeStr, " ").concat(startDatePart);
72
98
  var endPart = "".concat(endTimeStr, " ").concat(endDatePart);
73
99
 
@@ -76,11 +102,18 @@ export var TimeRangeBlock = function TimeRangeBlock(_ref) {
76
102
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
77
103
  key: "time-start",
78
104
  className: "".concat(timeClass, " ").concat(className || '').trim(),
79
- style: inlineStyle
105
+ style: startInlineStyle
80
106
  }, startPart), /*#__PURE__*/React.createElement("span", {
81
107
  key: "time-end",
82
108
  className: "".concat(timeClass, " ").concat(className || '').trim(),
83
109
  style: inlineStyle
84
- }, ' - ', endPart));
110
+ }, /*#__PURE__*/React.createElement("span", {
111
+ className: "pisell-time-range-display-time-cross-sep",
112
+ style: inlineStyle,
113
+ "aria-hidden": true
114
+ }, ' - '), /*#__PURE__*/React.createElement("span", {
115
+ className: "pisell-time-range-display-time-cross-end",
116
+ style: endInlineStyle
117
+ }, endPart)));
85
118
  };
86
119
  export default TimeRangeBlock;
@@ -1,18 +1,22 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["dataSource", "type", "cartSkuType", "isShowBookingHeader", "relatedProductDataSource", "rightActions", "escapeDom", "isShowImage", "isFormSubject", "isShowDelete", "isShowNote", "isShowAmountFooter", "disabledClick", "disabledEdit", "statusOptions", "statusLoading", "statusDisabled", "isShowRelatedProduct", "holderOptions", "onBookingStatusChange", "onAction", "onDelete", "onNote", "onCard", "onPromotion", "onGift"];
2
+ var _excluded = ["dataSource", "type", "cartSkuType", "isShowBookingHeader", "relatedProductDataSource", "addTimeProductDataSources", "rightActions", "escapeDom", "isShowImage", "isFormSubject", "isShowDelete", "isShowNote", "isShowAmountFooter", "disabledClick", "disabledEdit", "statusOptions", "statusLoading", "statusDisabled", "isShowRelatedProduct", "holderOptions", "onBookingStatusChange", "onAction", "onDelete", "onNote", "onCard", "onPromotion", "onGift"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
8
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
9
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
10
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12
14
  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; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
17
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
14
18
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
15
- import React, { useMemo } from 'react';
19
+ import React, { useMemo, useState } from 'react';
16
20
  import classNames from 'classnames';
17
21
  import { Button, Divider, Dropdown } from 'antd';
18
22
  import { DownOutlined } from '@ant-design/icons';
@@ -32,6 +36,7 @@ import Holders from "./components/Holders";
32
36
  import Iconfont from "../../iconfont";
33
37
  import useEngineContext from "../../../hooks/useEngineContext";
34
38
  var PREFIX = 'pisell-line-item';
39
+ var ADD_TIME_PRODUCTS_PREVIEW_COUNT = 2;
35
40
  var DEFAULT_STATUS_COLOR = '#91caff';
36
41
  var getStatusOption = function getStatusOption(status) {
37
42
  var statusOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -75,6 +80,8 @@ var BookingLineItem = function BookingLineItem(props) {
75
80
  cartSkuType = props.cartSkuType,
76
81
  isShowBookingHeader = props.isShowBookingHeader,
77
82
  relatedProductDataSource = props.relatedProductDataSource,
83
+ _props$addTimeProduct = props.addTimeProductDataSources,
84
+ addTimeProductDataSources = _props$addTimeProduct === void 0 ? [] : _props$addTimeProduct,
78
85
  _props$rightActions = props.rightActions,
79
86
  rightActions = _props$rightActions === void 0 ? [] : _props$rightActions,
80
87
  escapeDom = props.escapeDom,
@@ -103,6 +110,10 @@ var BookingLineItem = function BookingLineItem(props) {
103
110
  onGift = props.onGift,
104
111
  other = _objectWithoutProperties(props, _excluded);
105
112
  var context = useEngineContext();
113
+ var _useState = useState(false),
114
+ _useState2 = _slicedToArray(_useState, 2),
115
+ isAddTimeProductsExpanded = _useState2[0],
116
+ setIsAddTimeProductsExpanded = _useState2[1];
106
117
  var translationOriginal = context.appHelper.utils.translationOriginal;
107
118
  var locale = ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut.getApp) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.call(_context$appHelper$ut)) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut2 = _context$appHelper$ut2.locales) === null || _context$appHelper$ut2 === void 0 || (_context$appHelper$ut3 = _context$appHelper$ut2.getLocale) === null || _context$appHelper$ut3 === void 0 ? void 0 : _context$appHelper$ut3.call(_context$appHelper$ut2)) || ((_context$appHelper$ut4 = context.appHelper.utils) === null || _context$appHelper$ut4 === void 0 || (_context$appHelper$ut4 = _context$appHelper$ut4.storage) === null || _context$appHelper$ut4 === void 0 ? void 0 : _context$appHelper$ut4.get('umi_locale')) || 'en-US';
108
119
  var isShowAction = dataSource.isShowAction,
@@ -157,16 +168,18 @@ var BookingLineItem = function BookingLineItem(props) {
157
168
  })) : null;
158
169
  };
159
170
  var renderStatusButton = function renderStatusButton() {
160
- return /*#__PURE__*/React.createElement(Button, {
161
- className: "".concat(PREFIX, "__status"),
162
- htmlType: "button",
163
- disabled: !canChangeStatus,
164
- loading: statusLoading,
171
+ var statusButtonProps = {
165
172
  onClick: function onClick(e) {
166
173
  e.preventDefault();
167
174
  e.stopPropagation();
168
175
  }
169
- }, /*#__PURE__*/React.createElement("span", {
176
+ };
177
+ return /*#__PURE__*/React.createElement(Button, _extends({
178
+ className: "".concat(PREFIX, "__status"),
179
+ htmlType: "button",
180
+ disabled: !canChangeStatus,
181
+ loading: statusLoading
182
+ }, statusButtonProps), /*#__PURE__*/React.createElement("span", {
170
183
  className: "".concat(PREFIX, "__status-label")
171
184
  }, currentStatus.label), canChangeStatus ? /*#__PURE__*/React.createElement(DownOutlined, null) : null);
172
185
  };
@@ -176,6 +189,73 @@ var BookingLineItem = function BookingLineItem(props) {
176
189
  return onPromotion === null || onPromotion === void 0 ? void 0 : onPromotion(item);
177
190
  }
178
191
  }) : null;
192
+ var renderProductCard = function renderProductCard(productDataSource, source) {
193
+ var _productDataSource$pr;
194
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
195
+ if (!productDataSource || productDataSource !== null && productDataSource !== void 0 && productDataSource.isGift) return null;
196
+ var _options$showProductP = options.showProductPromotion,
197
+ showProductPromotion = _options$showProductP === void 0 ? true : _options$showProductP;
198
+ var productPromotion = productDataSource !== null && productDataSource !== void 0 && (_productDataSource$pr = productDataSource.promotions) !== null && _productDataSource$pr !== void 0 && _productDataSource$pr.length ? /*#__PURE__*/React.createElement(Promotion, {
199
+ promotions: productDataSource.promotions,
200
+ onClick: function onClick(item) {
201
+ return onPromotion === null || onPromotion === void 0 ? void 0 : onPromotion(item);
202
+ }
203
+ }) : null;
204
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BasicInfo, {
205
+ isShowImage: isShowImage,
206
+ dataSource: productDataSource,
207
+ type: cartSkuType,
208
+ maxSpecsCount: props.maxSpecsCount || 1
209
+ }), /*#__PURE__*/React.createElement(Packages, {
210
+ dataSource: productDataSource,
211
+ isShowImage: isShowImage,
212
+ type: cartSkuType
213
+ }), isShowAmountFooter ? /*#__PURE__*/React.createElement(AmountFooter, {
214
+ item: productDataSource,
215
+ hideDivider: false,
216
+ type: "total"
217
+ }) : null, showProductPromotion ? productPromotion : null, isShowNote ? /*#__PURE__*/React.createElement(Note, _extends({}, other, {
218
+ item: productDataSource,
219
+ disabledEdit: disabledEdit,
220
+ openNote: function openNote() {
221
+ return onNote === null || onNote === void 0 ? void 0 : onNote(source);
222
+ }
223
+ })) : null);
224
+ };
225
+ var renderAddTimeProducts = function renderAddTimeProducts() {
226
+ var displayAddTimeProducts = addTimeProductDataSources.filter(function (item) {
227
+ return item && !item.isGift;
228
+ });
229
+ if (displayAddTimeProducts.length === 0) return null;
230
+ var shouldCollapse = displayAddTimeProducts.length > ADD_TIME_PRODUCTS_PREVIEW_COUNT;
231
+ var visibleAddTimeProducts = isAddTimeProductsExpanded ? displayAddTimeProducts : displayAddTimeProducts.slice(0, ADD_TIME_PRODUCTS_PREVIEW_COUNT);
232
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
233
+ style: {
234
+ margin: 0
235
+ }
236
+ }), /*#__PURE__*/React.createElement("div", {
237
+ className: "".concat(PREFIX, "__add-time-products")
238
+ }, /*#__PURE__*/React.createElement("div", {
239
+ className: "".concat(PREFIX, "__section-title")
240
+ }, locales.getText('pisell2.line-item.add-time-products')), visibleAddTimeProducts.map(function (item, index) {
241
+ var _ref3, _item$_id;
242
+ var key = (_ref3 = (_item$_id = item === null || item === void 0 ? void 0 : item._id) !== null && _item$_id !== void 0 ? _item$_id : item === null || item === void 0 ? void 0 : item.id) !== null && _ref3 !== void 0 ? _ref3 : index;
243
+ return /*#__PURE__*/React.createElement("div", {
244
+ className: "".concat(PREFIX, "__add-time-product-card"),
245
+ key: "".concat(key)
246
+ }, renderProductCard(item, item));
247
+ }), shouldCollapse ? /*#__PURE__*/React.createElement("button", {
248
+ className: "".concat(PREFIX, "__add-time-products-toggle"),
249
+ type: "button",
250
+ onClick: function onClick(e) {
251
+ e.preventDefault();
252
+ e.stopPropagation();
253
+ setIsAddTimeProductsExpanded(function (expanded) {
254
+ return !expanded;
255
+ });
256
+ }
257
+ }, locales.getText(isAddTimeProductsExpanded ? 'pisell2.line-item.collapse' : 'pisell2.line-item.show-all')) : null));
258
+ };
179
259
  if (dataSource !== null && dataSource !== void 0 && dataSource.isGift) return null;
180
260
  return /*#__PURE__*/React.createElement("div", {
181
261
  className: "".concat(PREFIX, "-wrapper-container")
@@ -206,8 +286,8 @@ var BookingLineItem = function BookingLineItem(props) {
206
286
  }, canChangeStatus ? /*#__PURE__*/React.createElement(Dropdown, {
207
287
  menu: {
208
288
  items: statusMenuItems,
209
- onClick: function onClick(_ref3) {
210
- var key = _ref3.key;
289
+ onClick: function onClick(_ref4) {
290
+ var key = _ref4.key;
211
291
  return onBookingStatusChange === null || onBookingStatusChange === void 0 ? void 0 : onBookingStatusChange(String(key), dataSource);
212
292
  }
213
293
  },
@@ -232,31 +312,14 @@ var BookingLineItem = function BookingLineItem(props) {
232
312
  className: "".concat(PREFIX, "__related-product")
233
313
  }, /*#__PURE__*/React.createElement("div", {
234
314
  className: "".concat(PREFIX, "__related-product-card")
235
- }, /*#__PURE__*/React.createElement(BasicInfo, {
236
- isShowImage: isShowImage,
237
- dataSource: relatedProductDataSource,
238
- type: cartSkuType,
239
- maxSpecsCount: props.maxSpecsCount || 1
240
- }), /*#__PURE__*/React.createElement(Packages, {
241
- dataSource: relatedProductDataSource,
242
- isShowImage: isShowImage,
243
- type: cartSkuType
244
- }), isShowAmountFooter ? /*#__PURE__*/React.createElement(AmountFooter, {
245
- item: relatedProductDataSource,
246
- hideDivider: false,
247
- type: "total"
248
- }) : null, renderPromotion, isShowNote ? /*#__PURE__*/React.createElement(Note, _extends({}, other, {
249
- item: relatedProductDataSource,
250
- disabledEdit: disabledEdit,
251
- openNote: function openNote() {
252
- return onNote === null || onNote === void 0 ? void 0 : onNote(dataSource);
253
- }
254
- })) : null, isShowAction && actionText ? /*#__PURE__*/React.createElement(Action, {
315
+ }, renderProductCard(relatedProductDataSource, dataSource, {
316
+ showProductPromotion: false
317
+ }), renderPromotion, isShowAction && actionText ? /*#__PURE__*/React.createElement(Action, {
255
318
  item: dataSource,
256
319
  onAction: function onAction() {
257
320
  return _onAction === null || _onAction === void 0 ? void 0 : _onAction(dataSource);
258
321
  }
259
- }) : null))) : null)), /*#__PURE__*/React.createElement(Gift, _extends({}, (dataSource === null || dataSource === void 0 ? void 0 : dataSource.giftData) || {}, {
322
+ }) : null))) : null, renderAddTimeProducts())), /*#__PURE__*/React.createElement(Gift, _extends({}, (dataSource === null || dataSource === void 0 ? void 0 : dataSource.giftData) || {}, {
260
323
  onClick: function onClick() {
261
324
  return onGift === null || onGift === void 0 ? void 0 : onGift(dataSource);
262
325
  }