@things-factory/figure-ui 10.1.4 → 10.1.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.
- package/client/graphql/index.ts +87 -12
- package/client/modeller/figure-history-panel.ts +324 -0
- package/client/modeller/figure-side.ts +19 -1
- package/client/pages/figure-list-page.ts +363 -226
- package/client/pages/figure-modeller-page.ts +22 -0
- package/client/types.ts +17 -0
- package/dist-client/graphql/index.d.ts +24 -4
- package/dist-client/graphql/index.js +70 -9
- package/dist-client/graphql/index.js.map +1 -1
- package/dist-client/modeller/figure-history-panel.d.ts +42 -0
- package/dist-client/modeller/figure-history-panel.js +343 -0
- package/dist-client/modeller/figure-history-panel.js.map +1 -0
- package/dist-client/modeller/figure-side.d.ts +6 -0
- package/dist-client/modeller/figure-side.js +31 -0
- package/dist-client/modeller/figure-side.js.map +1 -1
- package/dist-client/pages/figure-list-page.d.ts +44 -21
- package/dist-client/pages/figure-list-page.js +351 -246
- package/dist-client/pages/figure-list-page.js.map +1 -1
- package/dist-client/pages/figure-modeller-page.d.ts +9 -0
- package/dist-client/pages/figure-modeller-page.js +20 -0
- package/dist-client/pages/figure-modeller-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/types.d.ts +19 -0
- package/dist-client/types.js.map +1 -1
- package/package.json +4 -2
- package/translations/en.json +15 -0
- package/translations/ja.json +17 -2
- package/translations/ko.json +17 -2
- package/translations/ms.json +17 -2
- package/translations/zh.json +17 -2
- package/client/viewparts/figure-card.ts +0 -226
- package/dist-client/viewparts/figure-card.d.ts +0 -24
- package/dist-client/viewparts/figure-card.js +0 -221
- package/dist-client/viewparts/figure-card.js.map +0 -1
|
@@ -1,148 +1,141 @@
|
|
|
1
|
+
import '@operato/data-grist'
|
|
1
2
|
import '@material/web/icon/icon.js'
|
|
2
|
-
import '../viewparts/figure-card.js'
|
|
3
3
|
|
|
4
4
|
import { css, html } from 'lit'
|
|
5
|
-
import { customElement, property,
|
|
5
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
6
6
|
|
|
7
|
+
import type { DataGrist, FetchOption } from '@operato/data-grist'
|
|
7
8
|
import { i18next, localize } from '@operato/i18n'
|
|
9
|
+
import { p13n } from '@operato/p13n'
|
|
8
10
|
import { auth } from '@things-factory/auth-base/dist-client'
|
|
9
11
|
import { navigate, PageView } from '@operato/shell'
|
|
10
|
-
import { ScrollbarStyles } from '@operato/styles'
|
|
12
|
+
import { CommonGristStyles, CommonHeaderStyles, ScrollbarStyles } from '@operato/styles'
|
|
11
13
|
|
|
14
|
+
import { capacityFrom } from '../modeller/scene-budget.js'
|
|
12
15
|
import { deleteFigure, fetchFigureList } from '../graphql/index.js'
|
|
13
16
|
import type { Figure } from '../types.js'
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
/**
|
|
19
|
+
* 이 값 아래면 점수를 색으로 눈에 띄게 한다.
|
|
20
|
+
*
|
|
21
|
+
* **등급 경계가 아니다.** 등급(A~D)은 `figure-model` 의 `scoreOf` 가 정하고 화면은 그것을
|
|
22
|
+
* 베끼지 않는다. 이것은 「눈에 걸리게 할 선」이고, 화면의 판단이다.
|
|
23
|
+
*/
|
|
24
|
+
const ATTENTION_BELOW = 50
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* ── renderer 가 그리는 것은 이 파일의 CSS 가 닿지 않는다 ──────────────────────
|
|
28
|
+
*
|
|
29
|
+
* 컬럼 renderer 의 결과는 `ox-card-field` 의 shadow root 안에 그려진다. 이 페이지의 `static
|
|
30
|
+
* styles` 는 그 경계를 넘지 못하므로 `code[figure-type]` 같은 선택자는 **아무 일도 하지 않는다.**
|
|
31
|
+
* 넘어가는 것은 custom property 뿐이라, 색과 글꼴은 여기서 인라인으로 준다 — 값 자체는 테마
|
|
32
|
+
* 토큰을 가리키므로 밝음·어둠은 따라온다. data-grist 의 image renderer 도 같은 방식이다.
|
|
33
|
+
*/
|
|
34
|
+
const CAPACITY = 'font-weight: 700; color: var(--md-sys-color-primary);'
|
|
35
|
+
const UNMEASURED = 'font-style: italic; color: var(--md-sys-color-outline);'
|
|
36
|
+
const RELEASED = 'font-weight: 700; color: var(--md-sys-color-primary);'
|
|
37
|
+
const DRAFT = 'color: var(--md-sys-color-tertiary);'
|
|
38
|
+
const badge = (low: boolean) =>
|
|
39
|
+
`padding: 0 6px; border-radius: var(--md-sys-shape-corner-small, 4px); font-weight: 700; ${
|
|
40
|
+
low
|
|
41
|
+
? 'color: var(--md-sys-color-on-error, #fff); background-color: var(--md-sys-color-error);'
|
|
42
|
+
: 'color: var(--md-sys-color-on-primary-container); background-color: var(--md-sys-color-primary-container);'
|
|
43
|
+
}`
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* `as typeof PageView` 로 조이지 않는다 — 그렇게 하면 p13n 이 얹어 주는
|
|
47
|
+
* `getPagePreferenceProvider` 가 타입에서 사라져 개인 설정을 붙일 수 없다.
|
|
48
|
+
*/
|
|
49
|
+
const FigureListPageBase = p13n(localize(i18next)(PageView))
|
|
16
50
|
|
|
17
51
|
/**
|
|
18
|
-
* Figure
|
|
52
|
+
* Figure 카탈로그.
|
|
53
|
+
*
|
|
54
|
+
* 이 화면은 저작면으로 가는 문이다. 여기서 오래 머물 화면이 아니므로 꾸미지 않는다. 카드에는
|
|
55
|
+
* **고를 때 쓰는 것만** 싣는다 — 그림과 이름, 그리고 아직 초안이라는 것. 배치 한도·성숙도·삼각형
|
|
56
|
+
* 수는 고른 뒤에 따지는 값이라 표 모드의 칸으로 남기고 저작면에서 본다.
|
|
57
|
+
*
|
|
58
|
+
* ## 왜 손으로 만든 카드가 아니라 격자인가
|
|
19
59
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
60
|
+
* 전에는 카드 격자와 걸러 보기 줄과 빈 화면을 이 파일이 직접 그렸다(200줄). 그 자리에서 빠져
|
|
61
|
+
* 있던 것들은 하나같이 `ox-grist` 가 이미 가진 것이다 — 쪽 나누기, 정렬, 컬럼 걸러 보기,
|
|
62
|
+
* 개인 설정(모드·정렬·쪽 크기를 사람마다 기억한다), 표 모드로 바꿔 보기, 내보내기.
|
|
63
|
+
* 손으로 만든 카드는 그 중 아무것도 없었고, 목록이 늘어나면 전부 한 번에 그렸다.
|
|
64
|
+
*
|
|
65
|
+
* 카드에 실을 것은 `list` 가 정하고, 무엇을 어떻게 그릴지는 컬럼의 renderer 가 정한다. 같은
|
|
66
|
+
* 설정이 표 모드에서도 그대로 쓰이므로 **두 모드가 다른 말을 하지 않는다.**
|
|
23
67
|
*/
|
|
24
68
|
@customElement('figure-list-page')
|
|
25
69
|
export class FigureListPage extends FigureListPageBase {
|
|
26
70
|
static styles = [
|
|
27
71
|
ScrollbarStyles,
|
|
72
|
+
CommonGristStyles,
|
|
73
|
+
CommonHeaderStyles,
|
|
28
74
|
css`
|
|
29
75
|
:host {
|
|
30
76
|
display: flex;
|
|
31
77
|
flex-direction: column;
|
|
32
|
-
|
|
78
|
+
width: 100%;
|
|
33
79
|
background-color: var(--md-sys-color-surface);
|
|
34
80
|
color: var(--md-sys-color-on-surface);
|
|
35
81
|
}
|
|
36
82
|
|
|
37
|
-
/*
|
|
38
|
-
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
gap: var(--spacing-medium, 8px);
|
|
42
|
-
padding: var(--spacing-medium, 8px) var(--spacing-large, 12px);
|
|
43
|
-
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
input[search] {
|
|
83
|
+
/* 격자가 바깥에 요구하는 것은 확정된 높이 하나뿐이다 — 스크롤은 격자가 안에서 한다 */
|
|
84
|
+
ox-grist {
|
|
47
85
|
flex: 1;
|
|
48
|
-
min-
|
|
49
|
-
max-width: 320px;
|
|
50
|
-
padding: 6px 10px;
|
|
51
|
-
font: var(--input-field-font, inherit);
|
|
52
|
-
color: var(--md-sys-color-on-surface);
|
|
53
|
-
background-color: var(--md-sys-color-surface-container-lowest);
|
|
54
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
55
|
-
/* 명령 요소의 모서리는 테마가 정한다 — 알약으로 만들지 않는다 */
|
|
56
|
-
border-radius: 6px;
|
|
86
|
+
min-height: 0;
|
|
57
87
|
}
|
|
58
88
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
background-color: var(--md-sys-color-secondary-container);
|
|
71
|
-
border-color: transparent;
|
|
72
|
-
}
|
|
89
|
+
/*
|
|
90
|
+
── 그림이 주인공인 카탈로그 ────────────────────────────────────────
|
|
91
|
+
카드 기본값은 글이 많은 목록(직원·결재함)에 맞춰져 있다. 여기서는 사람이 먼저 보는 것이
|
|
92
|
+
형상 그림이므로, 그림 칸을 비율로 잡아 카드 폭이 달라져도 그림이 나란히 읽히게 한다.
|
|
93
|
+
*/
|
|
94
|
+
ox-grist {
|
|
95
|
+
--data-card-min-width: 240px;
|
|
96
|
+
--data-card-thumbnail-height: auto;
|
|
97
|
+
--data-card-thumbnail-aspect: 4 / 3;
|
|
98
|
+
--data-card-thumbnail-padding: var(--spacing-small);
|
|
99
|
+
--data-card-thumbnail-background: var(--md-sys-color-surface-container);
|
|
73
100
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
101
|
+
/*
|
|
102
|
+
카드 기본 글꼴은 굵다(제목 bold 1.1em). 글이 정보를 나르는 목록에서는 맞지만, 여기서
|
|
103
|
+
정보를 나르는 것은 그림이다. 굵은 제목이 카드마다 서면 그림보다 글이 먼저 읽힌다 —
|
|
104
|
+
이름은 알아볼 정도로만, 타입은 곁글로 둔다.
|
|
105
|
+
*/
|
|
106
|
+
--data-card-item-name-font: 500 0.9rem/1.35 var(--theme-font, 'Roboto');
|
|
107
|
+
--data-card-item-name-color: var(--md-sys-color-on-surface);
|
|
108
|
+
--data-card-item-disc-font: normal 0.72rem/1.2 var(--theme-font, 'Roboto');
|
|
109
|
+
--data-card-item-disc-color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
110
|
+
--data-card-item-etc-font: normal 0.72rem/1.2 var(--theme-font, 'Roboto');
|
|
79
111
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
flex: 1;
|
|
83
|
-
overflow-y: auto;
|
|
84
|
-
display: grid;
|
|
85
|
-
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
86
|
-
gap: var(--spacing-medium, 8px);
|
|
87
|
-
padding: var(--spacing-large, 12px);
|
|
88
|
-
align-content: start;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/* ── 아무것도 없을 때 ──────────────────────────────────────────────
|
|
92
|
-
이 자리가 이 화면에서 가장 중요하다. 처음 온 사람은 여기서 이 도구가
|
|
93
|
-
무엇을 만드는 것인지 알게 된다. 「데이터 없음」으로 끝내지 않는다. */
|
|
94
|
-
div[empty] {
|
|
95
|
-
flex: 1;
|
|
96
|
-
display: flex;
|
|
97
|
-
flex-direction: column;
|
|
98
|
-
align-items: center;
|
|
99
|
-
justify-content: center;
|
|
100
|
-
gap: var(--spacing-medium, 8px);
|
|
101
|
-
padding: var(--spacing-large, 12px);
|
|
102
|
-
text-align: center;
|
|
103
|
-
color: var(--md-sys-color-on-surface-variant, var(--md-sys-color-on-surface));
|
|
104
|
-
}
|
|
105
|
-
div[empty] md-icon {
|
|
106
|
-
--md-icon-size: 48px;
|
|
107
|
-
color: var(--md-sys-color-outline-variant);
|
|
108
|
-
}
|
|
109
|
-
div[empty] h2 {
|
|
110
|
-
margin: 0;
|
|
111
|
-
font: var(--theme-font, inherit);
|
|
112
|
-
font-size: var(--ui-t-title, 15px);
|
|
113
|
-
color: var(--md-sys-color-on-surface);
|
|
114
|
-
}
|
|
115
|
-
div[empty] p {
|
|
116
|
-
margin: 0;
|
|
117
|
-
max-width: 34em;
|
|
118
|
-
line-height: 1.6;
|
|
119
|
-
}
|
|
120
|
-
div[empty] button {
|
|
121
|
-
margin-top: var(--spacing-medium, 8px);
|
|
122
|
-
padding: 8px 18px;
|
|
123
|
-
font: var(--label-font, inherit);
|
|
124
|
-
color: var(--md-sys-color-on-primary, #fff);
|
|
125
|
-
background-color: var(--md-sys-color-primary);
|
|
126
|
-
border: none;
|
|
127
|
-
border-radius: 6px;
|
|
128
|
-
cursor: pointer;
|
|
112
|
+
/* 상태와 성숙도는 짧은 표식이다 — 두 줄로 세우지 않고 한 줄에 뉜다 */
|
|
113
|
+
--data-card-detail-direction: row;
|
|
129
114
|
}
|
|
130
115
|
`
|
|
131
116
|
]
|
|
132
117
|
|
|
133
|
-
@
|
|
134
|
-
|
|
135
|
-
@
|
|
136
|
-
@state() private stateFilter = ''
|
|
137
|
-
@state() private loaded = false
|
|
138
|
-
/** 못 불러온 사유. 빈 목록과 구분해서 보여 준다. */
|
|
139
|
-
@state() private failure = ''
|
|
118
|
+
@property({ type: Object }) gristConfig: any
|
|
119
|
+
|
|
120
|
+
@query('ox-grist') private grist!: DataGrist
|
|
140
121
|
|
|
141
122
|
private listen?: () => void
|
|
142
123
|
|
|
143
124
|
get context() {
|
|
144
125
|
return {
|
|
145
126
|
title: i18next.t('title.figures'),
|
|
127
|
+
search: {
|
|
128
|
+
handler: (search: string) => {
|
|
129
|
+
this.grist.searchText = search
|
|
130
|
+
},
|
|
131
|
+
value: this.grist?.searchText || '',
|
|
132
|
+
placeholder: i18next.t('text.search-figure-by-name-or-type')
|
|
133
|
+
},
|
|
134
|
+
filter: {
|
|
135
|
+
handler: () => {
|
|
136
|
+
this.grist.toggleHeadroom()
|
|
137
|
+
}
|
|
138
|
+
},
|
|
146
139
|
actions: [
|
|
147
140
|
{
|
|
148
141
|
title: i18next.t('button.new-figure'),
|
|
@@ -154,103 +147,264 @@ export class FigureListPage extends FigureListPageBase {
|
|
|
154
147
|
|
|
155
148
|
render() {
|
|
156
149
|
return html`
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
{ value: 'released', label: i18next.t('label.released') }
|
|
172
|
-
].map(
|
|
173
|
-
option => html`
|
|
174
|
-
<button
|
|
175
|
-
state
|
|
176
|
-
?selected=${this.stateFilter === option.value}
|
|
177
|
-
@click=${() => {
|
|
178
|
-
this.stateFilter = option.value
|
|
179
|
-
this.reload()
|
|
180
|
-
}}
|
|
181
|
-
>
|
|
182
|
-
${option.label}
|
|
183
|
-
</button>
|
|
184
|
-
`
|
|
185
|
-
)}
|
|
186
|
-
${this.loaded ? html`<span count>${i18next.t('text.figure-count', { count: this.total })}</span>` : ''}
|
|
187
|
-
</div>
|
|
188
|
-
|
|
189
|
-
${!this.loaded
|
|
190
|
-
? html``
|
|
191
|
-
: this.failure
|
|
192
|
-
? html`
|
|
193
|
-
<div empty>
|
|
194
|
-
<md-icon>error</md-icon>
|
|
195
|
-
<p>${i18next.t('text.could-not-load-figures')}</p>
|
|
196
|
-
<p quiet>${this.failure}</p>
|
|
197
|
-
<button @click=${() => this.reload()}>${i18next.t('button.try-again')}</button>
|
|
198
|
-
</div>
|
|
199
|
-
`
|
|
200
|
-
: this.figures.length === 0
|
|
201
|
-
? this.renderEmpty()
|
|
202
|
-
: html`
|
|
203
|
-
<div cards>
|
|
204
|
-
${this.figures.map(
|
|
205
|
-
figure => html`
|
|
206
|
-
<figure-card
|
|
207
|
-
.figure=${figure}
|
|
208
|
-
@open=${() => this.openModeller(figure.id)}
|
|
209
|
-
@remove=${() => this.removeFigure(figure)}
|
|
210
|
-
></figure-card>
|
|
211
|
-
`
|
|
212
|
-
)}
|
|
213
|
-
</div>
|
|
214
|
-
`}
|
|
150
|
+
<ox-grist
|
|
151
|
+
mode="CARD"
|
|
152
|
+
.config=${this.gristConfig}
|
|
153
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
154
|
+
.personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}
|
|
155
|
+
>
|
|
156
|
+
<div slot="headroom" class="header">
|
|
157
|
+
<div class="filters">
|
|
158
|
+
<ox-filters-form autofocus without-search></ox-filters-form>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<ox-grist-personalizer slot="setting"></ox-grist-personalizer>
|
|
163
|
+
</ox-grist>
|
|
215
164
|
`
|
|
216
165
|
}
|
|
217
166
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const filtered = !!this.search || !!this.stateFilter
|
|
226
|
-
|
|
227
|
-
if (filtered) {
|
|
228
|
-
return html`
|
|
229
|
-
<div empty>
|
|
230
|
-
<md-icon>search_off</md-icon>
|
|
231
|
-
<h2>${i18next.t('text.no-figure-matches-the-filter')}</h2>
|
|
232
|
-
<p>${i18next.t('text.try-clearing-the-search-or-state-filter')}</p>
|
|
233
|
-
<button
|
|
234
|
-
@click=${() => {
|
|
235
|
-
this.search = ''
|
|
236
|
-
this.stateFilter = ''
|
|
237
|
-
this.reload()
|
|
238
|
-
}}
|
|
239
|
-
>
|
|
240
|
-
${i18next.t('button.clear-filters')}
|
|
241
|
-
</button>
|
|
242
|
-
</div>
|
|
243
|
-
`
|
|
244
|
-
}
|
|
167
|
+
async pageInitialized() {
|
|
168
|
+
this.gristConfig = {
|
|
169
|
+
/*
|
|
170
|
+
**쪽 나누기는 선택이 아니다.** 격자에 가상 스크롤이 없어 받은 것을 전부 DOM 에 그린다.
|
|
171
|
+
카드 모드는 끝까지 내려가면 다음 쪽을 이어 붙이므로, 한 쪽이 작아도 목록은 계속 읽힌다.
|
|
172
|
+
*/
|
|
173
|
+
pagination: { pages: [24, 48, 96] },
|
|
245
174
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
175
|
+
/*
|
|
176
|
+
아직 아무것도 없을 때 하는 말. **이 자리가 이 화면에서 가장 중요하다** — 처음 온 사람은
|
|
177
|
+
여기서 이 도구가 무엇을 만드는 것인지 알게 된다. 조건이 걸려 비었을 때는 격자가 스스로
|
|
178
|
+
다른 말을 한다(「찾는 것이 없다」). 그 둘을 섞지 않는 것이 격자 쪽에 이미 들어 있다.
|
|
179
|
+
*/
|
|
180
|
+
emptyNote: {
|
|
181
|
+
icon: 'deployed_code',
|
|
182
|
+
title: i18next.t('text.no-figure-yet'),
|
|
183
|
+
description: i18next.t('text.what-a-figure-is')
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
list: {
|
|
187
|
+
thumbnail: 'thumbnail',
|
|
188
|
+
/* 그림이 없는 카드도 자리는 지킨다 — 빈 사각형으로 두지 않고 왜 없는지 말한다 */
|
|
189
|
+
emptyThumbnail: {
|
|
190
|
+
icon: 'deployed_code',
|
|
191
|
+
label: i18next.t('text.thumbnail-not-made-yet')
|
|
192
|
+
},
|
|
193
|
+
fields: ['name', 'type'],
|
|
194
|
+
/*
|
|
195
|
+
**카드에는 고를 때 쓰는 것만 싣는다.**
|
|
196
|
+
|
|
197
|
+
배치 한도·성숙도·삼각형 수·수정일시까지 실어 봤더니 카드가 명세표가 되었다. 카탈로그에서
|
|
198
|
+
사람이 하는 일은 「이거다」를 고르는 것이고, 그때 보는 것은 그림과 이름이다.
|
|
199
|
+
|
|
200
|
+
숫자는 **하나만** 남긴다 — 성숙도다. 셋 중 이것 하나가 나머지를 요약한다(배치 한도와
|
|
201
|
+
삼각형 수는 무게 한 가지만 말하는데, 성숙도는 무게·식별성·상태 표현까지 여러 축을 합친
|
|
202
|
+
값이다). 그 축별 내역과 나머지 숫자는 표 모드의 칸과 저작면에 있다.
|
|
203
|
+
|
|
204
|
+
이름표는 달지 않는다. 성숙도는 색과 숫자로 읽히고, 상태는 발행된 것에 아무 말도 하지
|
|
205
|
+
않는다(그것이 예사다) — 초안일 때만 「초안」이 뜬다.
|
|
206
|
+
*/
|
|
207
|
+
details: ['state', 'score'],
|
|
208
|
+
/* 삭제는 손이 갈 때만 나온다 — 고르려고 보는 자리에 되돌릴 수 없는 조작을 띄우지 않는다 */
|
|
209
|
+
gutters: 'hover'
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
columns: [
|
|
213
|
+
{ type: 'gutter', gutterName: 'sequence', fixed: true },
|
|
214
|
+
{
|
|
215
|
+
type: 'gutter',
|
|
216
|
+
gutterName: 'button',
|
|
217
|
+
icon: 'delete',
|
|
218
|
+
title: i18next.t('button.delete'),
|
|
219
|
+
danger: true,
|
|
220
|
+
width: 40,
|
|
221
|
+
handlers: {
|
|
222
|
+
click: (_columns: any, _data: any, _column: any, record: Figure) => this.removeFigure(record)
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
type: 'string',
|
|
227
|
+
name: 'name',
|
|
228
|
+
header: i18next.t('label.name'),
|
|
229
|
+
record: { editable: false },
|
|
230
|
+
filter: 'search',
|
|
231
|
+
sortable: true,
|
|
232
|
+
width: 200
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
/*
|
|
236
|
+
타입 이름은 **저장되는 식별자**다. 표시 이름과 다르게 보이게 두어야 보드가 무엇으로
|
|
237
|
+
이 형상을 찾는지 헷갈리지 않는다.
|
|
238
|
+
*/
|
|
239
|
+
type: 'string',
|
|
240
|
+
name: 'type',
|
|
241
|
+
header: i18next.t('label.type'),
|
|
242
|
+
record: {
|
|
243
|
+
editable: false,
|
|
244
|
+
renderer: (value: string) => html`<code>${value}</code>`
|
|
245
|
+
},
|
|
246
|
+
filter: 'search',
|
|
247
|
+
sortable: true,
|
|
248
|
+
width: 160
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
type: 'string',
|
|
252
|
+
name: 'state',
|
|
253
|
+
header: i18next.t('label.state'),
|
|
254
|
+
record: {
|
|
255
|
+
editable: false,
|
|
256
|
+
/*
|
|
257
|
+
**발행된 것에는 아무 말도 하지 않는다.** 카탈로그에 있는 것은 대개 발행된 것이라,
|
|
258
|
+
카드마다 「발행됨」이 붙으면 그 말이 아무것도 가르지 않고 자리만 먹는다. 판 번호도
|
|
259
|
+
고를 때 쓰는 값이 아니다 — 이력 탭에 있다.
|
|
260
|
+
|
|
261
|
+
표 모드에서는 칸에 값이 있어야 하므로 그때는 발행됨도 적는다(`wide` 가 아니라 label
|
|
262
|
+
이 붙는 자리인지로 가른다 — 카드는 label 을 달지 않았다).
|
|
263
|
+
*/
|
|
264
|
+
renderer: (value: string, _column: any, record: Figure, _rowIndex: number, field: Element) => {
|
|
265
|
+
if (value !== 'released') {
|
|
266
|
+
return html`<span style=${DRAFT}>${i18next.t('label.draft')}</span>`
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* 표에서는 칸이 비면 안 된다. 카드에서만 입을 다문다 — 그리는 자리가 알려 준다. */
|
|
270
|
+
return field?.tagName === 'OX-CARD-FIELD'
|
|
271
|
+
? ''
|
|
272
|
+
: html`<span style=${RELEASED}
|
|
273
|
+
>${i18next.t('label.released')}
|
|
274
|
+
${record.version ? i18next.t('text.version-number', { version: record.version }) : ''}</span
|
|
275
|
+
>`
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
/* 전체·초안·발행됨을 단추로 고른다 — 값이 둘뿐인 조건을 펼침 목록에 넣지 않는다 */
|
|
279
|
+
filter: {
|
|
280
|
+
type: 'select-buttons',
|
|
281
|
+
operator: 'in',
|
|
282
|
+
options: [
|
|
283
|
+
{ display: i18next.t('label.draft'), value: 'draft' },
|
|
284
|
+
{ display: i18next.t('label.released'), value: 'released' }
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
width: 120
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
/*
|
|
291
|
+
**몇 개까지 놓을 수 있나.** 카드에는 싣지 않고 표 모드의 칸으로 둔다 — 고른 뒤에
|
|
292
|
+
따지는 값이다. 서버에 없는 값이라 `groups` 와 `triangles` 에서 계산하는데, 저작면
|
|
293
|
+
머리와 **같은 함수**를 쓴다. 두 화면이 같은 형상을 다른 잣대로 말하면 무엇을 고칠지
|
|
294
|
+
모른다.
|
|
295
|
+
*/
|
|
296
|
+
type: 'string',
|
|
297
|
+
name: 'capacity',
|
|
298
|
+
header: i18next.t('label.capacity'),
|
|
299
|
+
label: true,
|
|
300
|
+
sortable: false,
|
|
301
|
+
record: {
|
|
302
|
+
editable: false,
|
|
303
|
+
renderer: (_value: unknown, _column: any, record: Figure) => {
|
|
304
|
+
const capacity = capacityFrom(record.groups ?? 0, record.triangles ?? 0)
|
|
305
|
+
|
|
306
|
+
return capacity
|
|
307
|
+
? html`<span style=${CAPACITY} title=${i18next.t('text.reuse-score-explained')}>
|
|
308
|
+
${i18next.t('text.fits-n-instances', { n: capacity.instances.toLocaleString() })}
|
|
309
|
+
</span>`
|
|
310
|
+
: html`<span style=${UNMEASURED}>${i18next.t('text.not-measured-yet')}</span>`
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
width: 120
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
type: 'float',
|
|
317
|
+
name: 'score',
|
|
318
|
+
header: i18next.t('label.maturity'),
|
|
319
|
+
record: {
|
|
320
|
+
editable: false,
|
|
321
|
+
/*
|
|
322
|
+
카드에 남긴 하나뿐인 숫자. **이름표를 달지 않으므로** 무엇인지는 색과 손이 갔을 때
|
|
323
|
+
뜨는 말이 알려 준다.
|
|
324
|
+
|
|
325
|
+
아직 재지 않은 것을 **0 으로 보여 주지 않는다.** 0 은 「가볍다」는 뜻이 되어 버린다.
|
|
326
|
+
등급 문자(A~D)도 여기서 만들지 않는다 — 경계는 `figure-model` 이 정하고 그것을
|
|
327
|
+
화면이 베끼면 두 벌이 되어 목록과 저작면이 다른 등급을 말한다.
|
|
328
|
+
*/
|
|
329
|
+
renderer: (value: number | null) =>
|
|
330
|
+
value == null
|
|
331
|
+
? html`<span style=${UNMEASURED}>${i18next.t('text.not-measured-yet')}</span>`
|
|
332
|
+
: html`<span style=${badge(value < ATTENTION_BELOW)} title=${i18next.t('label.maturity')}
|
|
333
|
+
>${Math.round(value)}</span
|
|
334
|
+
>`
|
|
335
|
+
},
|
|
336
|
+
sortable: true,
|
|
337
|
+
width: 90
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
type: 'integer',
|
|
341
|
+
name: 'triangles',
|
|
342
|
+
header: i18next.t('label.triangles'),
|
|
343
|
+
label: true,
|
|
344
|
+
record: {
|
|
345
|
+
editable: false,
|
|
346
|
+
renderer: (value: number | null) => (value == null ? '' : value.toLocaleString())
|
|
347
|
+
},
|
|
348
|
+
sortable: true,
|
|
349
|
+
width: 110
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
type: 'integer',
|
|
353
|
+
name: 'groups',
|
|
354
|
+
header: i18next.t('label.budget-groups'),
|
|
355
|
+
record: { editable: false },
|
|
356
|
+
hidden: true,
|
|
357
|
+
width: 0
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
type: 'image',
|
|
361
|
+
name: 'thumbnail',
|
|
362
|
+
header: i18next.t('field.thumbnail'),
|
|
363
|
+
record: { editable: false, align: 'center', wide: true },
|
|
364
|
+
hidden: true,
|
|
365
|
+
width: 160
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
type: 'datetime',
|
|
369
|
+
name: 'updatedAt',
|
|
370
|
+
header: i18next.t('field.updated_at'),
|
|
371
|
+
label: true,
|
|
372
|
+
record: { editable: false },
|
|
373
|
+
sortable: true,
|
|
374
|
+
width: 180
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
/*
|
|
378
|
+
`resource-object` 를 쓰지 않는다 — 그 renderer 는 다른 패키지(resource-ui)가 등록하고,
|
|
379
|
+
등록되지 않은 앱에서는 조용히 글자 renderer 로 떨어져 `[object Object]` 가 된다.
|
|
380
|
+
이름 하나 꺼내는 일에 그 위험을 질 이유가 없다.
|
|
381
|
+
*/
|
|
382
|
+
type: 'string',
|
|
383
|
+
name: 'updater',
|
|
384
|
+
header: i18next.t('field.updater'),
|
|
385
|
+
record: {
|
|
386
|
+
editable: false,
|
|
387
|
+
renderer: (value: { name?: string } | null) => value?.name || ''
|
|
388
|
+
},
|
|
389
|
+
hidden: true,
|
|
390
|
+
width: 120
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
|
|
394
|
+
rows: {
|
|
395
|
+
selectable: false,
|
|
396
|
+
appendable: false,
|
|
397
|
+
handlers: {
|
|
398
|
+
click: (_columns: any, _data: any, _column: any, record: Figure) => {
|
|
399
|
+
if (record?.id) {
|
|
400
|
+
this.openModeller(record.id)
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
|
|
406
|
+
sorters: [{ name: 'updatedAt', desc: true }]
|
|
407
|
+
}
|
|
254
408
|
}
|
|
255
409
|
|
|
256
410
|
connectedCallback() {
|
|
@@ -263,15 +417,10 @@ export class FigureListPage extends FigureListPageBase {
|
|
|
263
417
|
나간다. 첫 질의가 프로필보다 앞서면 그 한 번이 실패하고, 그 뒤로 다시 묻는 사람이 없으면
|
|
264
418
|
화면은 비어 있는 채로 남는다. lite-menu 도 같은 신호로 같은 순서 문제를 푼다
|
|
265
419
|
(`auth.on('profile')` — 그쪽 주석에 그 사연이 적혀 있다).
|
|
266
|
-
|
|
267
|
-
**이 화면에서 그 실패를 실제로 본 적은 없다.** 빈 화면을 봤던 것은 숨은 탭에서 조사할 때였고,
|
|
268
|
-
그때는 셸이 첫 `pageUpdated` 를 requestAnimationFrame 안에서 부르는데 숨은 탭은 rAF 를 돌리지
|
|
269
|
-
않아 질의가 아예 나가지 않았다 — 원인이 달랐다. 그래도 이 구독은 남긴다: 값이 싸고, 못 불러온
|
|
270
|
-
경우를 화면이 말하게 한 아래 처리와 짝이다.
|
|
271
420
|
*/
|
|
272
421
|
this.listen = () => {
|
|
273
422
|
if (this.active) {
|
|
274
|
-
|
|
423
|
+
this.grist?.fetch()
|
|
275
424
|
}
|
|
276
425
|
}
|
|
277
426
|
auth.on('profile', this.listen)
|
|
@@ -285,34 +434,22 @@ export class FigureListPage extends FigureListPageBase {
|
|
|
285
434
|
super.disconnectedCallback()
|
|
286
435
|
}
|
|
287
436
|
|
|
288
|
-
async pageUpdated(
|
|
437
|
+
async pageUpdated() {
|
|
289
438
|
if (this.active) {
|
|
290
|
-
|
|
439
|
+
this.grist.fetch()
|
|
291
440
|
}
|
|
292
441
|
}
|
|
293
442
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
443
|
+
/**
|
|
444
|
+
* 걸러 보기·정렬·쪽을 **격자가 만든 그대로** 서버에 넘긴다.
|
|
445
|
+
*
|
|
446
|
+
* 여기서 이름을 바꿔 담으면 격자가 아는 조건과 서버에 가는 조건이 어긋난다. 실패는 격자가
|
|
447
|
+
* 받아 화면에 낸다 — 목록이 비어 있는 것과 못 불러온 것은 다른 사실이다.
|
|
448
|
+
*/
|
|
449
|
+
async fetchHandler({ page = 1, limit = 24, sortings = [], filters = [] }: FetchOption) {
|
|
450
|
+
const { items, total } = await fetchFigureList({ page, limit, filters, sortings })
|
|
297
451
|
|
|
298
|
-
|
|
299
|
-
비어 있었다. 목록이 비어 있는 것과 못 불러온 것은 다른 사실이고, 사용자가 할 일도 다르다 —
|
|
300
|
-
하나는 만들면 되고, 하나는 다시 시도하거나 사람을 불러야 한다.
|
|
301
|
-
*/
|
|
302
|
-
try {
|
|
303
|
-
const { items, total } = await fetchFigureList({
|
|
304
|
-
search: this.search || undefined,
|
|
305
|
-
state: this.stateFilter || undefined
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
this.figures = items
|
|
309
|
-
this.total = total
|
|
310
|
-
this.failure = ''
|
|
311
|
-
} catch (e) {
|
|
312
|
-
this.failure = (e as Error).message
|
|
313
|
-
} finally {
|
|
314
|
-
this.loaded = true
|
|
315
|
-
}
|
|
452
|
+
return { total: total || 0, records: items || [] }
|
|
316
453
|
}
|
|
317
454
|
|
|
318
455
|
private openModeller(id?: string) {
|
|
@@ -328,6 +465,6 @@ export class FigureListPage extends FigureListPageBase {
|
|
|
328
465
|
}
|
|
329
466
|
|
|
330
467
|
await deleteFigure(figure.id)
|
|
331
|
-
|
|
468
|
+
this.grist.fetch()
|
|
332
469
|
}
|
|
333
470
|
}
|