@things-factory/contact 10.1.302 → 10.1.304

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.
@@ -1,4 +1,5 @@
1
1
  import '@operato/data-grist';
2
+ import '@things-factory/ai-assistant/dist-client/index.js';
2
3
  import { PageView } from '@operato/shell';
3
4
  import { FetchOption } from '@operato/data-grist';
4
5
  import '../components/contact-popup';
@@ -22,19 +23,11 @@ export declare class ContactListPage extends ContactListPage_base {
22
23
  handler: () => void;
23
24
  };
24
25
  help: string;
25
- actions: ({
26
+ actions: {
26
27
  icon: string;
27
28
  title: string;
28
29
  action: () => Promise<void>;
29
- emphasis?: undefined;
30
- } | {
31
- icon: string;
32
- title: string;
33
- action: () => Promise<void>;
34
- emphasis: {
35
- danger: boolean;
36
- };
37
- })[];
30
+ }[];
38
31
  exportable: {
39
32
  name: string;
40
33
  data: () => Promise<{}[]>;
@@ -1,5 +1,6 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@operato/data-grist';
3
+ import '@things-factory/ai-assistant/dist-client/index.js';
3
4
  import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
4
5
  import { PageView } from '@operato/shell';
5
6
  import { css, html } from 'lit';
@@ -55,12 +56,6 @@ let ContactListPage = class ContactListPage extends localize(i18next)(ScopedElem
55
56
  { icon: 'add',
56
57
  title: i18next.t('button.add'),
57
58
  action: this.onCreateContact.bind(this)
58
- },
59
- { icon: 'delete',
60
- title: i18next.t('button.delete'),
61
- action: this.onDeleteContact.bind(this),
62
- emphasis: { danger: true
63
- }
64
59
  }
65
60
  ],
66
61
  exportable: { name: i18next.t('title.contact list'),
@@ -73,14 +68,24 @@ let ContactListPage = class ContactListPage extends localize(i18next)(ScopedElem
73
68
  const mode = this.mode || (isMobileDevice() ? 'CARD' : 'GRID');
74
69
  return html `
75
70
  <ox-grist class="page-fill" .mode=${mode} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
71
+ <!-- What is done to the picked rows: over the column heads while rows are picked (ADR-0225). -->
72
+ <ox-assistant-selection-bar
73
+ slot="selection"
74
+ .gridOf=${() => this.grist}
75
+ name=${i18next.t('title.contact list')}
76
+ .assistant=${false}
77
+ .actions=${[{ id: 'delete', title: i18next.t('button.delete'), icon: 'delete_outline', emphasis: { danger: true }, action: () => this.onDeleteContact() }]}
78
+ ></ox-assistant-selection-bar>
76
79
  </ox-grist>
77
80
  `;
78
81
  }
79
82
  async pageInitialized(lifecycle) {
80
83
  this.gristConfig = { pagination: { pages: [100, 200, 500] },
81
84
  list: { thumbnail: 'profile',
85
+ /* On a phone: who and for which company, then the phone, the email and the department - each with its name. */
82
86
  fields: ['name', 'counterparty'],
83
- details: ['email', 'updatedAt']
87
+ details: ['phone', 'email', 'department'],
88
+ labeled: true
84
89
  },
85
90
  columns: [
86
91
  { type: 'gutter', gutterName: 'sequence' },
@@ -90,6 +95,8 @@ let ContactListPage = class ContactListPage extends localize(i18next)(ScopedElem
90
95
  header: i18next.t('field.photo'),
91
96
  width: 80,
92
97
  record: { align: 'center',
98
+ /* renderEmpty: a card draws this column's renderer for a contact with no photo - the avatar with the name's initial, as the table does - not a bare grey box. The card takes the first column named profile, this one. */
99
+ renderEmpty: true,
93
100
  renderer: function (value, column, record, rowIndex, field) {
94
101
  return html `<ox-pfp-view .profile=${record.profile} .name=${record.name || '+'}></ox-pfp-view>`;
95
102
  }
@@ -291,8 +298,9 @@ let ContactListPage = class ContactListPage extends localize(i18next)(ScopedElem
291
298
  }
292
299
  }
293
300
  }
301
+ /* The list's own export is the rows it shows; the picked rows go out by the selection bar's 「선택 내보내기」 (ADR-0225). */
294
302
  async exportHandler() {
295
- const exportTargets = this.grist.selected.length ? this.grist.selected : this.grist.dirtyData.records;
303
+ const exportTargets = this.grist.dirtyData.records;
296
304
  const targetFieldSet = new Set(['id', 'name', 'counterparty', 'email', 'phone', 'address', 'note']);
297
305
  return exportTargets.map(contact => {
298
306
  let tempObj = {};
@@ -82,13 +82,13 @@ let ContactQuery = class ContactQuery {
82
82
  return getContactItems(contact);
83
83
  }
84
84
  async domain(contact) {
85
- return await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: contact.domainId });
85
+ return contact.domainId ? await (0, shell_1.getRepository)(shell_1.Domain).findOneBy({ id: contact.domainId }) : null;
86
86
  }
87
87
  async updater(contact) {
88
- return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: contact.updaterId });
88
+ return contact.updaterId ? await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: contact.updaterId }) : null;
89
89
  }
90
90
  async creator(contact) {
91
- return await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: contact.creatorId });
91
+ return contact.creatorId ? await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: contact.creatorId }) : null;
92
92
  }
93
93
  };
94
94
  exports.ContactQuery = ContactQuery;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/contact",
3
- "version": "10.1.302",
3
+ "version": "10.1.304",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "files": [
@@ -52,10 +52,11 @@
52
52
  "@operato/popup": "^10.0.0",
53
53
  "@operato/shell": "^10.29.69",
54
54
  "@operato/styles": "^10.0.0",
55
- "@things-factory/attachment-base": "^10.1.302",
56
- "@things-factory/auth-base": "^10.1.302",
57
- "@things-factory/biz-base": "^10.1.302",
58
- "@things-factory/shell": "^10.1.302"
55
+ "@things-factory/ai-assistant": "^10.1.304",
56
+ "@things-factory/attachment-base": "^10.1.304",
57
+ "@things-factory/auth-base": "^10.1.304",
58
+ "@things-factory/biz-base": "^10.1.304",
59
+ "@things-factory/shell": "^10.1.304"
59
60
  },
60
- "gitHead": "2e754aaeafcd39f5c6f4b7c8847a6c60ffe0789c"
61
+ "gitHead": "76ce38519069ba90190d69d2a9d6c130bc981cf0"
61
62
  }