@sprucelabs/spruce-location-utils 10.0.164 → 10.0.166
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.
|
@@ -6,7 +6,7 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
6
6
|
constructor(options) {
|
|
7
7
|
super(options);
|
|
8
8
|
const { id, onDelete, selectedLocationId, footerButtons, currentOrganizationId, onClick, shouldRenderDeleteButtons, header, } = options;
|
|
9
|
-
this.shouldRenderDeleteButtons = shouldRenderDeleteButtons
|
|
9
|
+
this.shouldRenderDeleteButtons = shouldRenderDeleteButtons ?? false;
|
|
10
10
|
this.onDeleteHandler = onDelete;
|
|
11
11
|
this.selectedLocationId = selectedLocationId;
|
|
12
12
|
this.onClickHandler = onClick;
|
|
@@ -24,7 +24,7 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
24
24
|
columnWidths: this.onClickHandler
|
|
25
25
|
? ['fill']
|
|
26
26
|
: ['content', 'fill'],
|
|
27
|
-
header: header
|
|
27
|
+
header: header ?? {
|
|
28
28
|
title: 'Your locations',
|
|
29
29
|
},
|
|
30
30
|
eventName: 'list-locations::v2020_12_25',
|
|
@@ -93,15 +93,13 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
93
93
|
await rowVc.setValue('isSelected', true);
|
|
94
94
|
}
|
|
95
95
|
async handleClickLocation(location) {
|
|
96
|
-
var _a;
|
|
97
96
|
if (this.onClickHandler) {
|
|
98
|
-
|
|
97
|
+
this.onClickHandler?.(location);
|
|
99
98
|
return;
|
|
100
99
|
}
|
|
101
100
|
await this.selectLocation(location.id);
|
|
102
101
|
}
|
|
103
102
|
async handleDeleteLocation(location) {
|
|
104
|
-
var _a;
|
|
105
103
|
const shouldDelete = await this.confirm({
|
|
106
104
|
title: `Delete ${location.name}?`,
|
|
107
105
|
isDestructive: true,
|
|
@@ -117,7 +115,7 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
117
115
|
locationId: location.id,
|
|
118
116
|
},
|
|
119
117
|
});
|
|
120
|
-
|
|
118
|
+
this.onDeleteHandler?.(location);
|
|
121
119
|
this.activeRecordCardVc.deleteRow(location.id);
|
|
122
120
|
}
|
|
123
121
|
catch (err) {
|
|
@@ -141,7 +139,7 @@ class LocationListCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
141
139
|
return this.activeRecordCardVc.getListVc();
|
|
142
140
|
}
|
|
143
141
|
async load(targetAndPayload) {
|
|
144
|
-
const { target, payload } = targetAndPayload
|
|
142
|
+
const { target, payload } = targetAndPayload ?? {};
|
|
145
143
|
if (target) {
|
|
146
144
|
this.activeRecordCardVc.setTarget(target);
|
|
147
145
|
}
|