@pisell/materials 6.11.31 → 6.11.33

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.
@@ -1590,7 +1590,6 @@ function buildGroupedCourtRows(courts) {
1590
1590
  var predefined = ["VIP", "Standard"];
1591
1591
  var rows = [];
1592
1592
  var consumedIds = new Set();
1593
- console.log(courts, collapsedGroups, 'courts, collapsedGroups = {}');
1594
1593
  predefined.forEach(function (group) {
1595
1594
  var items = courts.filter(function (court) {
1596
1595
  return court.type === group;
@@ -1647,7 +1646,21 @@ function buildGroupedCourtRows(courts) {
1647
1646
  });
1648
1647
  }
1649
1648
  });
1650
- console.log(rows, 'rows123');
1649
+ var courtRowsOnly = rows.filter(function (r) {
1650
+ return r.kind === "court";
1651
+ });
1652
+ /** 全部分组折叠时只有 group 头、无 court 行 → 日视图 0/0 free 与空白主体;退化为平铺 */
1653
+ if (courtRowsOnly.length === 0 && courts.length > 0) {
1654
+ return courts.map(function (c) {
1655
+ return {
1656
+ kind: "court",
1657
+ id: c.id,
1658
+ name: c.name,
1659
+ type: c.type,
1660
+ group: c.type
1661
+ };
1662
+ });
1663
+ }
1651
1664
  return rows;
1652
1665
  }
1653
1666
 
@@ -2066,13 +2079,16 @@ export default function BookingCalendarDemo() {
2066
2079
  var courts = useMemo(function () {
2067
2080
  var r = props.resources;
2068
2081
  if (Array.isArray(r) && r.length > 0) {
2069
- return r.map(function (x) {
2082
+ var mapped = r.filter(function (x) {
2083
+ return x && x.id !== undefined && x.id !== null && String(x.id).trim() !== "";
2084
+ }).map(function (x) {
2070
2085
  return {
2071
- id: x.id,
2072
- name: x.name,
2086
+ id: String(x.id),
2087
+ name: x.name != null && String(x.name).trim() !== "" ? String(x.name) : String(x.id),
2073
2088
  type: x.groupType && String(x.groupType).trim() !== "" ? String(x.groupType) : "Resource"
2074
2089
  };
2075
2090
  });
2091
+ if (mapped.length > 0) return mapped;
2076
2092
  }
2077
2093
  return DEFAULT_COURTS;
2078
2094
  }, [props.resources]);
@@ -3213,7 +3229,6 @@ export default function BookingCalendarDemo() {
3213
3229
  return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, key, _objectSpread(_objectSpread({}, prev[key] || {}), {}, _defineProperty({}, filesSubtab, true))));
3214
3230
  });
3215
3231
  }, [detailItem, detailMode, detailTab, filesSubtab]);
3216
- console.log(visibleCourtRows, 'visibleCourtRows1234', visibleCourts, collapsedGroups);
3217
3232
  return /*#__PURE__*/React.createElement(Spin, {
3218
3233
  spinning: Boolean(props.loading),
3219
3234
  wrapperClassName: "pisell-rb-cal-spin-wrap flex min-h-0 flex-1 flex-col"
@@ -34,7 +34,8 @@
34
34
  /** 与中间日程条同一行:整行深色底,左标题 / 中选日 / 右操作 */
35
35
  .pisell-reservation-schedule-band-schedule-row {
36
36
  display: grid;
37
- grid-template-columns: 1fr auto 1fr;
37
+ /** 左右按内容占位,剩余宽度给中间,避免「等分 1fr」把左侧挤窄后标题与 Segmented 被迫换行 */
38
+ grid-template-columns: auto minmax(0, 1fr) auto;
38
39
  align-items: center;
39
40
  width: 100%;
40
41
  min-width: 0;
@@ -61,7 +62,7 @@
61
62
  }
62
63
 
63
64
  .pisell-reservation-schedule-band-schedule {
64
- justify-self: center;
65
+ justify-self: stretch;
65
66
  min-width: 0;
66
67
  display: flex;
67
68
  flex-direction: row;
@@ -1524,7 +1524,6 @@ function buildGroupedCourtRows(courts, collapsedGroups = {}) {
1524
1524
  const predefined = ["VIP", "Standard"];
1525
1525
  const rows = [];
1526
1526
  const consumedIds = /* @__PURE__ */ new Set();
1527
- console.log(courts, collapsedGroups, "courts, collapsedGroups = {}");
1528
1527
  predefined.forEach((group) => {
1529
1528
  const items = courts.filter((court) => court.type === group);
1530
1529
  if (items.length === 0) return;
@@ -1562,7 +1561,16 @@ function buildGroupedCourtRows(courts, collapsedGroups = {}) {
1562
1561
  items.forEach((court) => rows.push({ kind: "court", ...court, group: label }));
1563
1562
  }
1564
1563
  });
1565
- console.log(rows, "rows123");
1564
+ const courtRowsOnly = rows.filter((r) => r.kind === "court");
1565
+ if (courtRowsOnly.length === 0 && courts.length > 0) {
1566
+ return courts.map((c) => ({
1567
+ kind: "court",
1568
+ id: c.id,
1569
+ name: c.name,
1570
+ type: c.type,
1571
+ group: c.type
1572
+ }));
1573
+ }
1566
1574
  return rows;
1567
1575
  }
1568
1576
  function assignDayOverlapLanesInPlace(overlays) {
@@ -1836,11 +1844,14 @@ function BookingCalendarDemo(props = {}) {
1836
1844
  const courts = (0, import_react.useMemo)(() => {
1837
1845
  const r = props.resources;
1838
1846
  if (Array.isArray(r) && r.length > 0) {
1839
- return r.map((x) => ({
1840
- id: x.id,
1841
- name: x.name,
1847
+ const mapped = r.filter(
1848
+ (x) => x && x.id !== void 0 && x.id !== null && String(x.id).trim() !== ""
1849
+ ).map((x) => ({
1850
+ id: String(x.id),
1851
+ name: x.name != null && String(x.name).trim() !== "" ? String(x.name) : String(x.id),
1842
1852
  type: x.groupType && String(x.groupType).trim() !== "" ? String(x.groupType) : "Resource"
1843
1853
  }));
1854
+ if (mapped.length > 0) return mapped;
1844
1855
  }
1845
1856
  return DEFAULT_COURTS;
1846
1857
  }, [props.resources]);
@@ -2805,7 +2816,6 @@ function BookingCalendarDemo(props = {}) {
2805
2816
  [key]: { ...prev[key] || {}, [filesSubtab]: true }
2806
2817
  }));
2807
2818
  }, [detailItem, detailMode, detailTab, filesSubtab]);
2808
- console.log(visibleCourtRows, "visibleCourtRows1234", visibleCourts, collapsedGroups);
2809
2819
  return /* @__PURE__ */ import_react.default.createElement(
2810
2820
  import_antd.Spin,
2811
2821
  {
@@ -34,7 +34,8 @@
34
34
  /** 与中间日程条同一行:整行深色底,左标题 / 中选日 / 右操作 */
35
35
  .pisell-reservation-schedule-band-schedule-row {
36
36
  display: grid;
37
- grid-template-columns: 1fr auto 1fr;
37
+ /** 左右按内容占位,剩余宽度给中间,避免「等分 1fr」把左侧挤窄后标题与 Segmented 被迫换行 */
38
+ grid-template-columns: auto minmax(0, 1fr) auto;
38
39
  align-items: center;
39
40
  width: 100%;
40
41
  min-width: 0;
@@ -61,7 +62,7 @@
61
62
  }
62
63
 
63
64
  .pisell-reservation-schedule-band-schedule {
64
- justify-self: center;
65
+ justify-self: stretch;
65
66
  min-width: 0;
66
67
  display: flex;
67
68
  flex-direction: row;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "6.11.31",
3
+ "version": "6.11.33",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",