@things-factory/inquiry 10.1.259 → 10.1.260
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-client/pages/inquiry-list.d.ts +0 -3
- package/dist-client/pages/inquiry-list.js +30 -47
- package/dist-client/pages/inquiry-list.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/utils/inquiry-list-query.d.ts +15 -0
- package/dist-client/utils/inquiry-list-query.js +19 -0
- package/dist-client/utils/inquiry-list-query.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import '@material/web/icon/icon.js';
|
|
2
2
|
import '@operato/data-grist/ox-grist.js';
|
|
3
3
|
import '@operato/data-grist/ox-filters-form.js';
|
|
4
|
-
import '@operato/input/ox-select.js';
|
|
5
|
-
import '@operato/popup/ox-popup-list.js';
|
|
6
4
|
import '../components/inquiry-thread.js';
|
|
7
5
|
import { FetchOption } from '@operato/data-grist';
|
|
8
6
|
import { PageView } from '@operato/shell';
|
|
@@ -14,7 +12,6 @@ declare const InquiryList_base: (new (...args: any[]) => import("lit").LitElemen
|
|
|
14
12
|
export declare class InquiryList extends InquiryList_base {
|
|
15
13
|
static styles: import("lit").CSSResult[];
|
|
16
14
|
gristConfig: any;
|
|
17
|
-
scope: string;
|
|
18
15
|
handler: boolean;
|
|
19
16
|
openId: string;
|
|
20
17
|
private grist;
|
|
@@ -2,8 +2,6 @@ import { __decorate, __metadata } from "tslib";
|
|
|
2
2
|
import '@material/web/icon/icon.js';
|
|
3
3
|
import '@operato/data-grist/ox-grist.js';
|
|
4
4
|
import '@operato/data-grist/ox-filters-form.js';
|
|
5
|
-
import '@operato/input/ox-select.js';
|
|
6
|
-
import '@operato/popup/ox-popup-list.js';
|
|
7
5
|
import '../components/inquiry-thread.js';
|
|
8
6
|
import gql from 'graphql-tag';
|
|
9
7
|
import { css, html, nothing } from 'lit';
|
|
@@ -16,6 +14,7 @@ import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePage
|
|
|
16
14
|
import { isMobileDevice } from '@operato/utils';
|
|
17
15
|
import { openInquiryWriter } from '../components/inquiry-writer.js';
|
|
18
16
|
import { inquiryApi, LIST_FIELDS } from '../utils/inquiry-api.js';
|
|
17
|
+
import { inquiryAddress, inquiryQueryOf } from '../utils/inquiry-list-query.js';
|
|
19
18
|
import { KIND_ICONS, KINDS, kindWord, STATUSES, statusWord, t, visibilityWord, when } from '../utils/inquiry-words.js';
|
|
20
19
|
/**
|
|
21
20
|
* 문의 · 제안 — the questions, bug reports and proposals of the domain that the person may read, and with `?id=` one of
|
|
@@ -24,7 +23,6 @@ import { KIND_ICONS, KINDS, kindWord, STATUSES, statusWord, t, visibilityWord, w
|
|
|
24
23
|
let InquiryList = class InquiryList extends localize(i18next)(PageView) {
|
|
25
24
|
constructor() {
|
|
26
25
|
super(...arguments);
|
|
27
|
-
this.scope = 'all';
|
|
28
26
|
this.handler = false;
|
|
29
27
|
/* The inquiry shown as its thread - none shows the list. */
|
|
30
28
|
this.openId = '';
|
|
@@ -40,15 +38,6 @@ let InquiryList = class InquiryList extends localize(i18next)(PageView) {
|
|
|
40
38
|
CommonHeaderStyles,
|
|
41
39
|
ScrollbarStyles,
|
|
42
40
|
css `
|
|
43
|
-
.filters {
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-wrap: wrap;
|
|
46
|
-
align-items: center;
|
|
47
|
-
gap: var(--spacing-medium, 8px);
|
|
48
|
-
}
|
|
49
|
-
ox-select {
|
|
50
|
-
min-width: 140px;
|
|
51
|
-
}
|
|
52
41
|
.thread {
|
|
53
42
|
overflow: auto;
|
|
54
43
|
padding: var(--spacing-large, 12px) var(--spacing-huge, 16px);
|
|
@@ -77,7 +66,7 @@ let InquiryList = class InquiryList extends localize(i18next)(PageView) {
|
|
|
77
66
|
}
|
|
78
67
|
}),
|
|
79
68
|
actions: [
|
|
80
|
-
...(this.openId ? [{ title: t('inquiry.button.back'), icon: 'arrow_back', action: () => navigate('
|
|
69
|
+
...(this.openId ? [{ title: t('inquiry.button.back'), icon: 'arrow_back', action: () => navigate(inquiryAddress(location.search, '')) }] : []),
|
|
81
70
|
{ title: t('inquiry.button.send'), icon: 'add', emphasis: { raised: true }, action: () => openInquiryWriter() }
|
|
82
71
|
]
|
|
83
72
|
};
|
|
@@ -85,30 +74,13 @@ let InquiryList = class InquiryList extends localize(i18next)(PageView) {
|
|
|
85
74
|
render() {
|
|
86
75
|
if (this.openId)
|
|
87
76
|
return html `<div class="thread"><inquiry-thread .inquiryId=${this.openId}></inquiry-thread></div>`;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>
|
|
77
|
+
/*
|
|
78
|
+
* Whose inquiries, the kind, the status, search and page are the grid's own, kept in the address
|
|
79
|
+
* (FOOTER-BUTTON-REVIEW G09): a shared link, coming back from a thread and reloading read the same list.
|
|
80
|
+
*/
|
|
81
|
+
return html `<ox-grist class="page-fill" search-mode="term" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>
|
|
94
82
|
<div slot="headroom" class="header">
|
|
95
|
-
<div class="filters">
|
|
96
|
-
<ox-select
|
|
97
|
-
.value=${this.scope}
|
|
98
|
-
aria-label=${t('inquiry.text.scope')}
|
|
99
|
-
@change=${(e) => {
|
|
100
|
-
const next = String(e.detail ?? 'all');
|
|
101
|
-
if (next === this.scope)
|
|
102
|
-
return;
|
|
103
|
-
this.scope = next;
|
|
104
|
-
this.grist.fetch();
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<span slot="label">${scopes.find(one => one.value === this.scope)?.display}</span>
|
|
108
|
-
<ox-popup-list align-left nowrap>${scopes.map(one => html `<div option value=${one.value}>${one.display}</div>`)}</ox-popup-list>
|
|
109
|
-
</ox-select>
|
|
110
|
-
<ox-filters-form without-search autofocus></ox-filters-form>
|
|
111
|
-
</div>
|
|
83
|
+
<div class="filters"><ox-filters-form without-search autofocus></ox-filters-form></div>
|
|
112
84
|
</div>
|
|
113
85
|
</ox-grist>`;
|
|
114
86
|
}
|
|
@@ -124,30 +96,45 @@ let InquiryList = class InquiryList extends localize(i18next)(PageView) {
|
|
|
124
96
|
if (!this.active || !(changes.active || changes.params))
|
|
125
97
|
return;
|
|
126
98
|
const id = String(lifecycle?.params?.id ?? '');
|
|
99
|
+
/* The list re-reads by its own address when it comes back; nothing to ask here. */
|
|
127
100
|
if (id !== this.openId) {
|
|
128
101
|
this.openId = id;
|
|
129
102
|
this.updateContext();
|
|
130
103
|
}
|
|
131
|
-
else if (!id && this.gristConfig)
|
|
132
|
-
this.grist?.fetch();
|
|
133
104
|
}
|
|
134
105
|
async pageInitialized() {
|
|
135
106
|
try {
|
|
136
107
|
this.handler = (await inquiryApi.summary()).handler;
|
|
137
|
-
/* A handler opens on what waits on them. */
|
|
138
|
-
if (this.handler)
|
|
139
|
-
this.scope = 'handlers-turn';
|
|
140
108
|
}
|
|
141
109
|
catch {
|
|
142
110
|
this.handler = false;
|
|
143
111
|
}
|
|
144
|
-
|
|
112
|
+
/* A thread keeps the list's address beside its `id`, so 「목록」 comes back to the same list. */
|
|
113
|
+
const open = (record) => record?.id && navigate(inquiryAddress(location.search, record.id));
|
|
145
114
|
this.gristConfig = {
|
|
146
115
|
rows: { appendable: false, selectable: false, handlers: { click: (_c, _d, _col, record) => open(record) } },
|
|
147
116
|
pagination: { limit: 50, pages: [50, 100] },
|
|
148
117
|
emptyNote: { title: t('inquiry.text.empty'), description: t('inquiry.text.empty-description') },
|
|
149
118
|
list: { fields: ['title', 'status'], details: ['kind', 'createdAt'] },
|
|
150
119
|
columns: [
|
|
120
|
+
/* Whose inquiries - the server's `scope`, a filter of its own on no column shown. A handler opens on what waits on them. */
|
|
121
|
+
{
|
|
122
|
+
type: 'string',
|
|
123
|
+
name: 'scope',
|
|
124
|
+
header: t('inquiry.text.scope'),
|
|
125
|
+
hidden: true,
|
|
126
|
+
record: { editable: false },
|
|
127
|
+
filter: {
|
|
128
|
+
type: 'select',
|
|
129
|
+
operator: 'eq',
|
|
130
|
+
value: this.handler ? 'handlers-turn' : 'all',
|
|
131
|
+
options: [
|
|
132
|
+
{ value: 'all', display: t('inquiry.scope.all') },
|
|
133
|
+
{ value: 'mine', display: t('inquiry.scope.mine') },
|
|
134
|
+
...(this.handler ? [{ value: 'handlers-turn', display: t('inquiry.scope.handlers-turn') }] : [])
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
151
138
|
{
|
|
152
139
|
type: 'string',
|
|
153
140
|
name: 'kind',
|
|
@@ -200,7 +187,7 @@ let InquiryList = class InquiryList extends localize(i18next)(PageView) {
|
|
|
200
187
|
}
|
|
201
188
|
}
|
|
202
189
|
`,
|
|
203
|
-
variables: { filters, pagination: { page, limit }, search: search?.trim() || undefined
|
|
190
|
+
variables: { ...inquiryQueryOf(filters), pagination: { page, limit }, search: search?.trim() || undefined },
|
|
204
191
|
fetchPolicy: 'network-only'
|
|
205
192
|
});
|
|
206
193
|
if (response.errors?.length)
|
|
@@ -212,10 +199,6 @@ __decorate([
|
|
|
212
199
|
state(),
|
|
213
200
|
__metadata("design:type", Object)
|
|
214
201
|
], InquiryList.prototype, "gristConfig", void 0);
|
|
215
|
-
__decorate([
|
|
216
|
-
state(),
|
|
217
|
-
__metadata("design:type", Object)
|
|
218
|
-
], InquiryList.prototype, "scope", void 0);
|
|
219
202
|
__decorate([
|
|
220
203
|
state(),
|
|
221
204
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inquiry-list.js","sourceRoot":"","sources":["../../client/pages/inquiry-list.ts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,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE;YAC3G,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;YAAE,MAAM,QAAQ,CAAA;QAC3C,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACzF,CAAC;;AAhKQ;IAAR,KAAK,EAAE;;gDAAiB;AAChB;IAAR,KAAK,EAAE;;0CAAc;AACb;IAAR,KAAK,EAAE;;4CAAgB;AAEf;IAAR,KAAK,EAAE;;2CAAY;AACO;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;0CAAA;AA/BjC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CA2LvB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-list.js'\nimport '../components/inquiry-thread.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { openInquiryWriter } from '../components/inquiry-writer.js'\nimport { inquiryApi, LIST_FIELDS } from '../utils/inquiry-api.js'\nimport { KIND_ICONS, KINDS, kindWord, STATUSES, statusWord, t, visibilityWord, when } from '../utils/inquiry-words.js'\n\n/**\n * 문의 · 제안 — the questions, bug reports and proposals of the domain that the person may read, and with `?id=` one of\n * them as its thread (ADR-0184 decision 8). Handlers work from here too: they open on those waiting on them.\n */\n@customElement('inquiry-list')\nexport class InquiryList extends localize(i18next)(PageView) {\n static styles = [\n WorkSurfacePageStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n .filters {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--spacing-medium, 8px);\n }\n ox-select {\n min-width: 140px;\n }\n .thread {\n overflow: auto;\n padding: var(--spacing-large, 12px) var(--spacing-huge, 16px);\n max-width: 880px;\n width: 100%;\n box-sizing: border-box;\n }\n `\n ]\n\n @state() gristConfig: any\n @state() scope = 'all'\n @state() handler = false\n /* The inquiry shown as its thread - none shows the list. */\n @state() openId = ''\n @query('ox-grist') private grist!: DataGrist\n\n private onChanged = () => {\n if (this.openId) return\n this.grist?.fetch()\n }\n\n get context() {\n return {\n title: t('inquiry.title.list'),\n ...(this.openId\n ? {}\n : {\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n }\n }),\n actions: [\n ...(this.openId ? [{ title: t('inquiry.button.back'), icon: 'arrow_back', action: () => navigate('inquiry-list') }] : []),\n { title: t('inquiry.button.send'), icon: 'add', emphasis: { raised: true }, action: () => openInquiryWriter() }\n ]\n }\n }\n\n render() {\n if (this.openId) return html`<div class=\"thread\"><inquiry-thread .inquiryId=${this.openId}></inquiry-thread></div>`\n const scopes = [\n { value: 'all', display: t('inquiry.scope.all') },\n { value: 'mine', display: t('inquiry.scope.mine') },\n ...(this.handler ? [{ value: 'handlers-turn', display: t('inquiry.scope.handlers-turn') }] : [])\n ]\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\">\n <ox-select\n .value=${this.scope}\n aria-label=${t('inquiry.text.scope')}\n @change=${(e: CustomEvent) => {\n const next = String(e.detail ?? 'all')\n if (next === this.scope) return\n this.scope = next\n this.grist.fetch()\n }}\n >\n <span slot=\"label\">${scopes.find(one => one.value === this.scope)?.display}</span>\n <ox-popup-list align-left nowrap>${scopes.map(one => html`<div option value=${one.value}>${one.display}</div>`)}</ox-popup-list>\n </ox-select>\n <ox-filters-form without-search autofocus></ox-filters-form>\n </div>\n </div>\n </ox-grist>`\n }\n\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener('inquiries-changed', this.onChanged)\n }\n\n disconnectedCallback() {\n window.removeEventListener('inquiries-changed', this.onChanged)\n super.disconnectedCallback()\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (!this.active || !(changes.active || changes.params)) return\n const id = String(lifecycle?.params?.id ?? '')\n if (id !== this.openId) {\n this.openId = id\n this.updateContext()\n } else if (!id && this.gristConfig) this.grist?.fetch()\n }\n\n async pageInitialized() {\n try {\n this.handler = (await inquiryApi.summary()).handler\n /* A handler opens on what waits on them. */\n if (this.handler) this.scope = 'handlers-turn'\n } catch {\n this.handler = false\n }\n const open = (record: any) => record?.id && navigate(`inquiry-list?id=${record.id}`)\n this.gristConfig = {\n rows: { appendable: false, selectable: false, handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n pagination: { limit: 50, pages: [50, 100] },\n emptyNote: { title: t('inquiry.text.empty'), description: t('inquiry.text.empty-description') },\n list: { fields: ['title', 'status'], details: ['kind', 'createdAt'] },\n columns: [\n {\n type: 'string',\n name: 'kind',\n header: t('inquiry.field.kind'),\n width: 110,\n record: {\n editable: false,\n renderer: (value: string) => html`<span style=\"display:inline-flex;align-items:center;gap:2px\"><md-icon style=\"--md-icon-size:16px\">${KIND_ICONS[value] ?? 'help'}</md-icon>${kindWord(value)}</span>`\n },\n filter: { type: 'select', operator: 'eq', options: [{ display: '', value: '' }, ...KINDS.map(code => ({ display: kindWord(code), value: code }))] }\n },\n {\n type: 'string',\n name: 'title',\n header: t('inquiry.field.title'),\n width: 320,\n record: {\n editable: false,\n renderer: (value: string, _c: any, record: any) =>\n html`<span style=${record?.isNew ? 'font-weight:600' : ''}\n >${record?.visibility === 'PRIVATE' ? html`<md-icon style=\"--md-icon-size:14px\" title=${visibilityWord('PRIVATE')}>lock</md-icon> ` : nothing}${value}${record?.replyCount\n ? ` (${record.replyCount})`\n : ''}</span\n >`\n }\n },\n {\n type: 'string',\n name: 'status',\n header: t('inquiry.field.status'),\n width: 100,\n record: {\n editable: false,\n renderer: (value: string, _c: any, record: any) =>\n html`<span style=${record?.isNew ? 'color:var(--md-sys-color-primary);font-weight:600' : ''}>${statusWord(value)}${record?.isNew ? ` · ${t('inquiry.text.new')}` : ''}</span>`\n },\n filter: { type: 'select', operator: 'eq', options: [{ display: '', value: '' }, ...STATUSES.map(code => ({ display: statusWord(code), value: code }))] }\n },\n { type: 'string', name: 'creator', header: t('inquiry.field.writer'), width: 110, record: { editable: false, renderer: (value: any) => value?.name ?? '' } },\n { type: 'string', name: 'assignee', header: t('inquiry.field.assignee'), width: 110, record: { editable: false, renderer: (value: any) => value?.name ?? '' } },\n { type: 'string', name: 'createdAt', header: t('inquiry.field.created-at'), width: 170, record: { editable: false, renderer: (value: string) => when(value) } }\n ]\n }\n }\n\n async fetchHandler({ page = 1, limit = 50, filters = [], search }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $search: String, $scope: String) {\n responses: inquiries(filters: $filters, pagination: $pagination, search: $search, scope: $scope) {\n items { ${LIST_FIELDS} }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, search: search?.trim() || undefined, scope: this.scope },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"inquiry-list.js","sourceRoot":"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,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACzF,CAAC;;AAjKQ;IAAR,KAAK,EAAE;;gDAAiB;AAChB;IAAR,KAAK,EAAE;;4CAAgB;AAEf;IAAR,KAAK,EAAE;;2CAAY;AACO;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;0CAAA;AArBjC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAmLvB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/data-grist/ox-filters-form.js'\nimport '../components/inquiry-thread.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, nothing } from 'lit'\nimport { customElement, query, state } from 'lit/decorators.js'\n\nimport { DataGrist, FetchOption } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { openInquiryWriter } from '../components/inquiry-writer.js'\nimport { inquiryApi, LIST_FIELDS } from '../utils/inquiry-api.js'\nimport { inquiryAddress, inquiryQueryOf } from '../utils/inquiry-list-query.js'\nimport { KIND_ICONS, KINDS, kindWord, STATUSES, statusWord, t, visibilityWord, when } from '../utils/inquiry-words.js'\n\n/**\n * 문의 · 제안 — the questions, bug reports and proposals of the domain that the person may read, and with `?id=` one of\n * them as its thread (ADR-0184 decision 8). Handlers work from here too: they open on those waiting on them.\n */\n@customElement('inquiry-list')\nexport class InquiryList extends localize(i18next)(PageView) {\n static styles = [\n WorkSurfacePageStyles,\n CommonGristStyles,\n CommonHeaderStyles,\n ScrollbarStyles,\n css`\n .thread {\n overflow: auto;\n padding: var(--spacing-large, 12px) var(--spacing-huge, 16px);\n max-width: 880px;\n width: 100%;\n box-sizing: border-box;\n }\n `\n ]\n\n @state() gristConfig: any\n @state() handler = false\n /* The inquiry shown as its thread - none shows the list. */\n @state() openId = ''\n @query('ox-grist') private grist!: DataGrist\n\n private onChanged = () => {\n if (this.openId) return\n this.grist?.fetch()\n }\n\n get context() {\n return {\n title: t('inquiry.title.list'),\n ...(this.openId\n ? {}\n : {\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n filter: {\n handler: () => {\n this.grist.toggleHeadroom()\n }\n }\n }),\n actions: [\n ...(this.openId ? [{ title: t('inquiry.button.back'), icon: 'arrow_back', action: () => navigate(inquiryAddress(location.search, '')) }] : []),\n { title: t('inquiry.button.send'), icon: 'add', emphasis: { raised: true }, action: () => openInquiryWriter() }\n ]\n }\n }\n\n render() {\n if (this.openId) return html`<div class=\"thread\"><inquiry-thread .inquiryId=${this.openId}></inquiry-thread></div>`\n /*\n * Whose inquiries, the kind, the status, search and page are the grid's own, kept in the address\n * (FOOTER-BUTTON-REVIEW G09): a shared link, coming back from a thread and reloading read the same list.\n */\n return html`<ox-grist class=\"page-fill\" search-mode=\"term\" .mode=${isMobileDevice() ? 'CARD' : 'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} ?url-params-sensitive=${this.active}>\n <div slot=\"headroom\" class=\"header\">\n <div class=\"filters\"><ox-filters-form without-search autofocus></ox-filters-form></div>\n </div>\n </ox-grist>`\n }\n\n connectedCallback() {\n super.connectedCallback()\n window.addEventListener('inquiries-changed', this.onChanged)\n }\n\n disconnectedCallback() {\n window.removeEventListener('inquiries-changed', this.onChanged)\n super.disconnectedCallback()\n }\n\n async pageUpdated(changes: any, lifecycle: any) {\n if (!this.active || !(changes.active || changes.params)) return\n const id = String(lifecycle?.params?.id ?? '')\n /* The list re-reads by its own address when it comes back; nothing to ask here. */\n if (id !== this.openId) {\n this.openId = id\n this.updateContext()\n }\n }\n\n async pageInitialized() {\n try {\n this.handler = (await inquiryApi.summary()).handler\n } catch {\n this.handler = false\n }\n /* A thread keeps the list's address beside its `id`, so 「목록」 comes back to the same list. */\n const open = (record: any) => record?.id && navigate(inquiryAddress(location.search, record.id))\n this.gristConfig = {\n rows: { appendable: false, selectable: false, handlers: { click: (_c: any, _d: any, _col: any, record: any) => open(record) } },\n pagination: { limit: 50, pages: [50, 100] },\n emptyNote: { title: t('inquiry.text.empty'), description: t('inquiry.text.empty-description') },\n list: { fields: ['title', 'status'], details: ['kind', 'createdAt'] },\n columns: [\n /* Whose inquiries - the server's `scope`, a filter of its own on no column shown. A handler opens on what waits on them. */\n {\n type: 'string',\n name: 'scope',\n header: t('inquiry.text.scope'),\n hidden: true,\n record: { editable: false },\n filter: {\n type: 'select',\n operator: 'eq',\n value: this.handler ? 'handlers-turn' : 'all',\n options: [\n { value: 'all', display: t('inquiry.scope.all') },\n { value: 'mine', display: t('inquiry.scope.mine') },\n ...(this.handler ? [{ value: 'handlers-turn', display: t('inquiry.scope.handlers-turn') }] : [])\n ]\n }\n },\n {\n type: 'string',\n name: 'kind',\n header: t('inquiry.field.kind'),\n width: 110,\n record: {\n editable: false,\n renderer: (value: string) => html`<span style=\"display:inline-flex;align-items:center;gap:2px\"><md-icon style=\"--md-icon-size:16px\">${KIND_ICONS[value] ?? 'help'}</md-icon>${kindWord(value)}</span>`\n },\n filter: { type: 'select', operator: 'eq', options: [{ display: '', value: '' }, ...KINDS.map(code => ({ display: kindWord(code), value: code }))] }\n },\n {\n type: 'string',\n name: 'title',\n header: t('inquiry.field.title'),\n width: 320,\n record: {\n editable: false,\n renderer: (value: string, _c: any, record: any) =>\n html`<span style=${record?.isNew ? 'font-weight:600' : ''}\n >${record?.visibility === 'PRIVATE' ? html`<md-icon style=\"--md-icon-size:14px\" title=${visibilityWord('PRIVATE')}>lock</md-icon> ` : nothing}${value}${record?.replyCount\n ? ` (${record.replyCount})`\n : ''}</span\n >`\n }\n },\n {\n type: 'string',\n name: 'status',\n header: t('inquiry.field.status'),\n width: 100,\n record: {\n editable: false,\n renderer: (value: string, _c: any, record: any) =>\n html`<span style=${record?.isNew ? 'color:var(--md-sys-color-primary);font-weight:600' : ''}>${statusWord(value)}${record?.isNew ? ` · ${t('inquiry.text.new')}` : ''}</span>`\n },\n filter: { type: 'select', operator: 'eq', options: [{ display: '', value: '' }, ...STATUSES.map(code => ({ display: statusWord(code), value: code }))] }\n },\n { type: 'string', name: 'creator', header: t('inquiry.field.writer'), width: 110, record: { editable: false, renderer: (value: any) => value?.name ?? '' } },\n { type: 'string', name: 'assignee', header: t('inquiry.field.assignee'), width: 110, record: { editable: false, renderer: (value: any) => value?.name ?? '' } },\n { type: 'string', name: 'createdAt', header: t('inquiry.field.created-at'), width: 170, record: { editable: false, renderer: (value: string) => when(value) } }\n ]\n }\n }\n\n async fetchHandler({ page = 1, limit = 50, filters = [], search }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $search: String, $scope: String) {\n responses: inquiries(filters: $filters, pagination: $pagination, search: $search, scope: $scope) {\n items { ${LIST_FIELDS} }\n total\n }\n }\n `,\n variables: { ...inquiryQueryOf(filters), pagination: { page, limit }, search: search?.trim() || undefined },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n}\n"]}
|