@seatlayer/core 0.16.0 → 0.16.1
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.
- package/dist/index.cjs +32 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +32 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1590,6 +1590,24 @@ var _SeatmapRenderer = class _SeatmapRenderer {
|
|
|
1590
1590
|
for (const id of ids) this.setSelected(id, false, true);
|
|
1591
1591
|
this.overlayLayer.batchDraw();
|
|
1592
1592
|
}
|
|
1593
|
+
setMaxSelection(maxSelection) {
|
|
1594
|
+
this.opts.maxSelection = Math.max(0, Math.floor(maxSelection));
|
|
1595
|
+
}
|
|
1596
|
+
select(seatIds) {
|
|
1597
|
+
const added = [];
|
|
1598
|
+
for (const id of seatIds) {
|
|
1599
|
+
if (this.selection.has(id) || !this.isSelectable(id)) continue;
|
|
1600
|
+
if (this.selection.size >= this.opts.maxSelection) {
|
|
1601
|
+
this.opts.onSelectionLimit?.(this.opts.maxSelection);
|
|
1602
|
+
break;
|
|
1603
|
+
}
|
|
1604
|
+
this.setSelected(id, true, true);
|
|
1605
|
+
const seat = this.seatById.get(id);
|
|
1606
|
+
if (seat) added.push(seat);
|
|
1607
|
+
}
|
|
1608
|
+
if (added.length) this.overlayLayer.batchDraw();
|
|
1609
|
+
return added;
|
|
1610
|
+
}
|
|
1593
1611
|
/** Switch organizer interaction in place so the host preserves camera, LOD,
|
|
1594
1612
|
* focus and live status state while moving between Monitor and Block. */
|
|
1595
1613
|
setManageInteraction(options) {
|
|
@@ -3140,7 +3158,10 @@ var _SeatmapRenderer = class _SeatmapRenderer {
|
|
|
3140
3158
|
if (seat) this.opts.onDeselect?.(seat);
|
|
3141
3159
|
} else {
|
|
3142
3160
|
if (!this.isSelectable(id)) return;
|
|
3143
|
-
if (this.selection.size >= this.opts.maxSelection)
|
|
3161
|
+
if (this.selection.size >= this.opts.maxSelection) {
|
|
3162
|
+
this.opts.onSelectionLimit?.(this.opts.maxSelection);
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3144
3165
|
this.setSelected(id, true);
|
|
3145
3166
|
const seat = this.seatById.get(id);
|
|
3146
3167
|
if (seat) this.opts.onSelect?.(seat);
|
|
@@ -3907,6 +3928,7 @@ var PickerController = class {
|
|
|
3907
3928
|
this.opts.onDeselect?.(seat);
|
|
3908
3929
|
this.emitSelectionChange();
|
|
3909
3930
|
},
|
|
3931
|
+
onSelectionLimit: this.opts.onSelectionLimit,
|
|
3910
3932
|
onHover: (seat) => {
|
|
3911
3933
|
this.opts.onHover?.(seat);
|
|
3912
3934
|
if (this.opts.onSeatHover) this.opts.onSeatHover(seat ? this.describeSeat(seat) : null);
|
|
@@ -3974,6 +3996,15 @@ var PickerController = class {
|
|
|
3974
3996
|
this.renderer?.deselect(ids);
|
|
3975
3997
|
this.emitSelectionChange();
|
|
3976
3998
|
}
|
|
3999
|
+
setMaxSelection(maxSelection) {
|
|
4000
|
+
this.maxSelection = Math.max(0, Math.floor(maxSelection));
|
|
4001
|
+
this.renderer?.setMaxSelection?.(this.maxSelection);
|
|
4002
|
+
}
|
|
4003
|
+
select(ids) {
|
|
4004
|
+
const added = this.renderer?.select?.(ids) ?? [];
|
|
4005
|
+
if (added.length) this.emitSelectionChange();
|
|
4006
|
+
return added.map((seat) => this.toSeat(seat));
|
|
4007
|
+
}
|
|
3977
4008
|
// ---- booking machine ------------------------------------------------------
|
|
3978
4009
|
/**
|
|
3979
4010
|
* Hold the current selection (or a given label set). The controller does the
|