@sprucelabs/spruce-organization-utils 0.8.1 → 0.8.5

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.
@@ -17,6 +17,7 @@ export default class OrgListCardViewController extends AbstractViewController<Ca
17
17
  footerButtons?: Button[];
18
18
  selectedOrgId?: string;
19
19
  } & ViewControllerOptions);
20
+ private ActiveRecordCardVc;
20
21
  private handleClickDeleteOrg;
21
22
  buildRow(org: Organization): Row;
22
23
  handleDeletOrg(org: SpruceSchemas.Spruce.v2020_07_22.Organization): Promise<void>;
@@ -12,9 +12,12 @@ export default class OrgListCardViewController extends AbstractViewController {
12
12
  constructor(options) {
13
13
  super(options);
14
14
  this.onDelete = options.onDelete;
15
- this.selectedOrgId = options.selectedOrgId;
16
15
  this.onEdit = options.onEdit;
17
- this.activeRecordCardVc = this.Controller('activeRecordCard', buildActiveRecordCard({
16
+ this.selectedOrgId = options.selectedOrgId;
17
+ this.activeRecordCardVc = this.ActiveRecordCardVc(options);
18
+ }
19
+ ActiveRecordCardVc(options) {
20
+ return this.Controller('activeRecordCard', buildActiveRecordCard({
18
21
  eventName: 'list-organizations::v2020_12_25',
19
22
  responseKey: 'organizations',
20
23
  columnWidths: ['fill'],
@@ -47,6 +50,11 @@ export default class OrgListCardViewController extends AbstractViewController {
47
50
  buildRow(org) {
48
51
  return {
49
52
  id: org.id,
53
+ isSelected: this.selectedOrgId === org.id,
54
+ onClick: () => __awaiter(this, void 0, void 0, function* () {
55
+ var _a;
56
+ yield ((_a = this.onEdit) === null || _a === void 0 ? void 0 : _a.call(this, org));
57
+ }),
50
58
  //@ts-ignore
51
59
  cells: [
52
60
  {
@@ -59,16 +67,6 @@ export default class OrgListCardViewController extends AbstractViewController {
59
67
  : ``}`,
60
68
  },
61
69
  },
62
- this.selectedOrgId !== org.id && {
63
- button: {
64
- lineIcon: 'edit-box',
65
- id: 'edit',
66
- onClick: () => __awaiter(this, void 0, void 0, function* () {
67
- var _a;
68
- yield ((_a = this.onEdit) === null || _a === void 0 ? void 0 : _a.call(this, org));
69
- }),
70
- },
71
- },
72
70
  {
73
71
  button: {
74
72
  type: 'destructive',
@@ -17,6 +17,7 @@ export default class OrgListCardViewController extends AbstractViewController<Ca
17
17
  footerButtons?: Button[];
18
18
  selectedOrgId?: string;
19
19
  } & ViewControllerOptions);
20
+ private ActiveRecordCardVc;
20
21
  private handleClickDeleteOrg;
21
22
  buildRow(org: Organization): Row;
22
23
  handleDeletOrg(org: SpruceSchemas.Spruce.v2020_07_22.Organization): Promise<void>;
@@ -5,9 +5,12 @@ class OrgListCardViewController extends heartwood_view_controllers_1.AbstractVie
5
5
  constructor(options) {
6
6
  super(options);
7
7
  this.onDelete = options.onDelete;
8
- this.selectedOrgId = options.selectedOrgId;
9
8
  this.onEdit = options.onEdit;
10
- this.activeRecordCardVc = this.Controller('activeRecordCard', (0, heartwood_view_controllers_1.buildActiveRecordCard)({
9
+ this.selectedOrgId = options.selectedOrgId;
10
+ this.activeRecordCardVc = this.ActiveRecordCardVc(options);
11
+ }
12
+ ActiveRecordCardVc(options) {
13
+ return this.Controller('activeRecordCard', (0, heartwood_view_controllers_1.buildActiveRecordCard)({
11
14
  eventName: 'list-organizations::v2020_12_25',
12
15
  responseKey: 'organizations',
13
16
  columnWidths: ['fill'],
@@ -38,6 +41,11 @@ class OrgListCardViewController extends heartwood_view_controllers_1.AbstractVie
38
41
  buildRow(org) {
39
42
  return {
40
43
  id: org.id,
44
+ isSelected: this.selectedOrgId === org.id,
45
+ onClick: async () => {
46
+ var _a;
47
+ await ((_a = this.onEdit) === null || _a === void 0 ? void 0 : _a.call(this, org));
48
+ },
41
49
  //@ts-ignore
42
50
  cells: [
43
51
  {
@@ -50,16 +58,6 @@ class OrgListCardViewController extends heartwood_view_controllers_1.AbstractVie
50
58
  : ``}`,
51
59
  },
52
60
  },
53
- this.selectedOrgId !== org.id && {
54
- button: {
55
- lineIcon: 'edit-box',
56
- id: 'edit',
57
- onClick: async () => {
58
- var _a;
59
- await ((_a = this.onEdit) === null || _a === void 0 ? void 0 : _a.call(this, org));
60
- },
61
- },
62
- },
63
61
  {
64
62
  button: {
65
63
  type: 'destructive',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-organization-utils",
3
3
  "description": "Support for working with organizations and Sprucebot. 📈",
4
- "version": "0.8.1",
4
+ "version": "0.8.5",
5
5
  "skill": {
6
6
  "namespace": "organization"
7
7
  },