@things-factory/worklist 10.1.203 → 10.1.205
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/index.d.ts +1 -0
- package/dist-client/index.js +1 -0
- package/dist-client/index.js.map +1 -1
- package/dist-client/pages/todo/done-list-calendar-page.d.ts +2 -0
- package/dist-client/pages/todo/done-list-calendar-page.js +63 -64
- package/dist-client/pages/todo/done-list-calendar-page.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-client/work-calendar-sources.d.ts +53 -0
- package/dist-client/work-calendar-sources.js +47 -0
- package/dist-client/work-calendar-sources.js.map +1 -0
- package/dist-server/controllers/activity-instance/pick.js +34 -1
- package/dist-server/controllers/activity-instance/pick.js.map +1 -1
- package/dist-server/controllers/activity-thread/check-authority.js +19 -4
- package/dist-server/controllers/activity-thread/check-authority.js.map +1 -1
- package/dist-server/controllers/common.d.ts +13 -0
- package/dist-server/controllers/common.js +26 -3
- package/dist-server/controllers/common.js.map +1 -1
- package/dist-server/service/activity-thread/my-open-threads.js +16 -2
- package/dist-server/service/activity-thread/my-open-threads.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/tests/pick-race.pg.test.ts +79 -1
- package/tests/pool-pick-waiting-thread.test.ts +254 -0
- package/translations/en.json +1 -0
- package/translations/es.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
package/dist-client/index.d.ts
CHANGED
package/dist-client/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export * from './activity-summary-generator.js';
|
|
|
3
3
|
export * from './components/activity-thread-timeline.js';
|
|
4
4
|
export * from './pages/activity-catalog/activity-panels.js';
|
|
5
5
|
export * from './my-work-menus.js';
|
|
6
|
+
export * from './work-calendar-sources.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist-client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0CAA0C,CAAA;AACxD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,oBAAoB,CAAA","sourcesContent":["export * from './pages/activity/activity-page.js'\nexport * from './activity-summary-generator.js'\nexport * from './components/activity-thread-timeline.js'\nexport * from './pages/activity-catalog/activity-panels.js'\nexport * from './my-work-menus.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../client/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0CAA0C,CAAA;AACxD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA","sourcesContent":["export * from './pages/activity/activity-page.js'\nexport * from './activity-summary-generator.js'\nexport * from './components/activity-thread-timeline.js'\nexport * from './pages/activity-catalog/activity-panels.js'\nexport * from './my-work-menus.js'\nexport * from './work-calendar-sources.js'\n"]}
|
|
@@ -15,6 +15,8 @@ export declare class DoneListCalendarPage extends DoneListCalendarPage_base {
|
|
|
15
15
|
};
|
|
16
16
|
render(): import("lit-html").TemplateResult<1>;
|
|
17
17
|
fetchEventsForCalendar(calendar: CALENDAR): Promise<Map<Date, BizEvent[]>>;
|
|
18
|
+
/** worklist's own - my to-dos and approvals, open and finished - as calendar entries. */
|
|
19
|
+
private activityEntries;
|
|
18
20
|
pageUpdated(changes: any, lifecycle: any, before: any): void;
|
|
19
21
|
}
|
|
20
22
|
export {};
|
|
@@ -9,6 +9,7 @@ import { client } from '@operato/graphql';
|
|
|
9
9
|
import { i18next, localize } from '@operato/i18n';
|
|
10
10
|
import { OxEventView } from '@operato/event-view';
|
|
11
11
|
import { ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
12
|
+
import { entriesOfDay, loadWorkCalendar, workCalendarSources } from '../../work-calendar-sources.js';
|
|
12
13
|
/** Priority 0..3. Anything outside the range clamps to the most urgent colour. */
|
|
13
14
|
const PRIORITY_COLORS = ['black', 'darkgray', 'orange', 'red'];
|
|
14
15
|
/**
|
|
@@ -164,73 +165,34 @@ let DoneListCalendarPage = class DoneListCalendarPage extends localize(i18next)(
|
|
|
164
165
|
`;
|
|
165
166
|
}
|
|
166
167
|
async fetchEventsForCalendar(calendar) {
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
priority
|
|
179
|
-
date
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
`,
|
|
183
|
-
variables: {
|
|
184
|
-
from,
|
|
185
|
-
to
|
|
186
|
-
}
|
|
187
|
-
});
|
|
168
|
+
const fromDate = calendar[0].date;
|
|
169
|
+
const toDate = new Date(calendar[calendar.length - 1].date.getTime() + 24 * 60 * 60 * 1000);
|
|
170
|
+
/*
|
|
171
|
+
* worklist's own and every registered source, asked apart: one that fails leaves the others on the grid, and the
|
|
172
|
+
* band above it says something was not read - never a day with nothing on it.
|
|
173
|
+
*/
|
|
174
|
+
const { entries, failed } = await loadWorkCalendar([
|
|
175
|
+
this.activityEntries(fromDate.toISOString(), toDate.toISOString()),
|
|
176
|
+
...workCalendarSources().map(source => source.load(fromDate, toDate))
|
|
177
|
+
]);
|
|
178
|
+
this.failed = failed;
|
|
188
179
|
const eventMap = new Map();
|
|
189
|
-
let activityEvents;
|
|
190
|
-
try {
|
|
191
|
-
activityEvents = askedFor(response, 'responses');
|
|
192
|
-
this.failed = false;
|
|
193
|
-
}
|
|
194
|
-
catch (e) {
|
|
195
|
-
/*
|
|
196
|
-
* 빈 달력을 돌려주되 **빈 달력이라고 말하지는 않는다.** 위의 띠가 못 불러왔다고 적는다.
|
|
197
|
-
*/
|
|
198
|
-
this.failed = true;
|
|
199
|
-
console.error(e);
|
|
200
|
-
return eventMap;
|
|
201
|
-
}
|
|
202
180
|
calendar.forEach(({ date }) => {
|
|
203
181
|
const localDateString = date.toLocaleDateString();
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
* 급한 것이 앞이다: 기한으로 놓인 안 끝난 것 → 받은 날에 놓인 안 끝난 것 → 끝난 것.
|
|
212
|
-
* 같은 자리 안에서는 우선순위가 높은 것, 그 다음 이른 시각.
|
|
213
|
-
*/
|
|
214
|
-
.sort((a, b) => rank(a) - rank(b) || (b.priority || 0) - (a.priority || 0) || (a.date > b.date ? 1 : -1));
|
|
215
|
-
const shown = ofTheDay.slice(0, MOST_PER_DAY);
|
|
216
|
-
const hidden = ofTheDay.length - shown.length;
|
|
217
|
-
const events = shown.map(({ id, name, priority, date, type, state, basis }) => {
|
|
182
|
+
/*
|
|
183
|
+
* **자르기 전에 차례를 세운다.** 상한만 두고 자르면 먼저 온 순서로 잘린다 — 기한이 걸린
|
|
184
|
+
* 결재 한 건이 끝난 스무 건 뒤에 묻히면 「+20건 더」만 보이고, 그 날 할 일이 있다는 것을
|
|
185
|
+
* 아무도 못 본다. 급한 것이 앞이다: 그날 할 것(기한·회의) → 받은 날에 놓인 것 → 끝난 것.
|
|
186
|
+
*/
|
|
187
|
+
const { shown, hidden } = entriesOfDay(entries, localDateString, MOST_PER_DAY);
|
|
188
|
+
const events = shown.map(({ name, priority, date, icon, href, note }) => {
|
|
218
189
|
const color = PRIORITY_COLORS[Math.min(Math.max(priority || 0, 0), PRIORITY_COLORS.length - 1)];
|
|
219
|
-
/*
|
|
220
|
-
* 안 끝난 것은 **하는 화면**으로 간다.
|
|
221
|
-
*
|
|
222
|
-
* activity-thread-view 는 끝난 업무를 읽는 화면이다. 아직 할 일을 거기로 보내면 손댈
|
|
223
|
-
* 데가 없는 화면에 도착한다 — 달력에서 눌렀는데 아무것도 못 한다.
|
|
224
|
-
*/
|
|
225
|
-
const pending = String(state || '').toLowerCase() == 'pending';
|
|
226
|
-
const path = type == 'activity-thread' ? (pending ? 'activity-thread' : 'activity-thread-view') : 'activity-approval';
|
|
227
|
-
const href = `${path}/${id}?title=${encodeURIComponent(name)}`;
|
|
228
190
|
const at = new Date(date).toLocaleTimeString([], {
|
|
229
191
|
hourCycle: 'h23',
|
|
230
192
|
hour: '2-digit',
|
|
231
193
|
minute: '2-digit'
|
|
232
194
|
});
|
|
233
|
-
const icon =
|
|
195
|
+
const body = html `${icon ? html `<md-icon style="font-size:1em;">${icon}</md-icon> ` : ''}${at} ${name}`;
|
|
234
196
|
return {
|
|
235
197
|
/*
|
|
236
198
|
* BizEvent 는 title · color 를 요구한다. 그리는 것은 template 이지만, 부품이 template
|
|
@@ -238,12 +200,10 @@ let DoneListCalendarPage = class DoneListCalendarPage extends localize(i18next)(
|
|
|
238
200
|
*/
|
|
239
201
|
title: name,
|
|
240
202
|
color,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
>${icon ? html `<md-icon style="font-size:1em;">${icon}</md-icon> ` : ''}${at} ${name}</a
|
|
246
|
-
>`
|
|
203
|
+
/* 열 수 없는 것은 링크가 아니다 — 눌러도 아무것도 못 하는 곳으로 보내지 않는다. */
|
|
204
|
+
template: href
|
|
205
|
+
? html `<a href=${href} title=${note ?? ''} style="color:${color};display:block;text-decoration:none;">${body}</a>`
|
|
206
|
+
: html `<span title=${note ?? ''} style="color:${color};display:block;">${body}</span>`
|
|
247
207
|
};
|
|
248
208
|
});
|
|
249
209
|
if (hidden > 0) {
|
|
@@ -263,6 +223,45 @@ let DoneListCalendarPage = class DoneListCalendarPage extends localize(i18next)(
|
|
|
263
223
|
});
|
|
264
224
|
return eventMap;
|
|
265
225
|
}
|
|
226
|
+
/** worklist's own - my to-dos and approvals, open and finished - as calendar entries. */
|
|
227
|
+
async activityEntries(from, to) {
|
|
228
|
+
const response = await client.query({
|
|
229
|
+
query: gql `
|
|
230
|
+
query ($from: String!, $to: String!) {
|
|
231
|
+
responses: activityEvents(from: $from, to: $to) {
|
|
232
|
+
id
|
|
233
|
+
name
|
|
234
|
+
type
|
|
235
|
+
state
|
|
236
|
+
basis
|
|
237
|
+
priority
|
|
238
|
+
date
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`,
|
|
242
|
+
variables: { from, to }
|
|
243
|
+
});
|
|
244
|
+
return askedFor(response, 'responses').map(({ id, name, type, state, basis, priority, date }) => {
|
|
245
|
+
/*
|
|
246
|
+
* 안 끝난 것은 **하는 화면**으로 간다.
|
|
247
|
+
*
|
|
248
|
+
* activity-thread-view 는 끝난 업무를 읽는 화면이다. 아직 할 일을 거기로 보내면 손댈
|
|
249
|
+
* 데가 없는 화면에 도착한다 — 달력에서 눌렀는데 아무것도 못 한다.
|
|
250
|
+
*/
|
|
251
|
+
const pending = String(state || '').toLowerCase() == 'pending';
|
|
252
|
+
const path = type == 'activity-thread' ? (pending ? 'activity-thread' : 'activity-thread-view') : 'activity-approval';
|
|
253
|
+
return {
|
|
254
|
+
id: `${type}:${id}`,
|
|
255
|
+
name,
|
|
256
|
+
date,
|
|
257
|
+
rank: rank({ state, basis }),
|
|
258
|
+
priority,
|
|
259
|
+
icon: eventIcon(state, basis),
|
|
260
|
+
href: `${path}/${id}?title=${encodeURIComponent(name)}`,
|
|
261
|
+
note: basisText(state, basis)
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
}
|
|
266
265
|
pageUpdated(changes, lifecycle, before) {
|
|
267
266
|
if (this.active) {
|
|
268
267
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"done-list-calendar-page.js","sourceRoot":"","sources":["../../../client/pages/todo/done-list-calendar-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,sCAAsC,CAAA;AAE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AAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,CAAA;gBACxD,MAAM,CAAC,IAAI,CAAC;oBACV,KAAK,EAAE,IAAI;oBACX,KAAK,EAAE,SAAS;oBAChB,QAAQ,EAAE,IAAI,CAAA,6BAA6B,IAAI,SAAS;iBACzD,CAAC,CAAA;YACJ,CAAC;YAED;;;eAGG;YACH,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,WAAW,CAAC,OAAY,EAAE,SAAc,EAAE,MAAW;QACnD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB;;eAEG;QACL,CAAC;aAAM,CAAC;YACN,8BAA8B;QAChC,CAAC;IACH,CAAC;;AAnJuB;IAAvB,KAAK,CAAC,eAAe,CAAC;8BAAa,WAAW;IAE/C,qDAAqD;;uDAFN;AAGtC;IAAR,KAAK,EAAE;;oDAAe;AAxCZ,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAyLhC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/event-view/ox-event-view.js'\n\nimport { PropertyValues, html, css } from 'lit'\nimport gql from 'graphql-tag'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxEventView } from '@operato/event-view'\nimport { ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { BizEvent, CALENDAR } from '@operato/event-view/types.js'\n\n/** Priority 0..3. Anything outside the range clamps to the most urgent colour. */\nconst PRIORITY_COLORS = ['black', 'darkgray', 'orange', 'red']\n\n/**\n * Which mark a finished item wears.\n *\n * Pending is the one that is not finished, and it reads as an empty circle: every filled mark on\n * this calendar means \"over\", so a pending item must not borrow one.\n *\n * A state this function does not know draws nothing. The old expression ended in\n * `: 'assignment_return'`, so anything unrecognised became sent-back — and Aborted, added to\n * ActivityEventStatus alongside this change, would have landed there. An icon the screen cannot\n * vouch for is worse than a blank, because the reader cannot tell an invented mark from a reported\n * one.\n *\n * The case fold is a guard, not a fix for anything observed here. ActivityEvent.state is declared\n * `@Field({ nullable: true })` with no explicit type, so type-graphql reflects it as String and the\n * wire carries the enum's value — lowercase, as this function reads it. Declaring it\n * `@Field(type => ActivityEventStatus)` instead is a one-word edit that would silently switch the\n * wire to the enum's **keys**: registerEnumType publishes by key. That switch is not hypothetical.\n * It is what organization/client/types/approval-line.ts hit, where `participation` is declared as\n * the enum, arrives as `Reference`, and was compared against `reference` — false every time, for\n * as long as the check had existed.\n */\nfunction eventIcon(state?: string, basis?: string): string {\n switch (String(state || '').toLowerCase()) {\n /*\n * 안 끝난 것은 **좌표가 표를 정한다.**\n *\n * 기한으로 놓인 것은 시계다 — 「이 날까지」. 기한이 없어 받은 날에 놓인 것은 받은 함이다 —\n * 「이 날 왔다」. 둘을 같은 표로 그리면 한 칸 안에서 구별이 안 되고, 결재자가 기한을 도착으로\n * 읽고 지나치거나 도착을 기한으로 읽고 한 주를 헛되이 다시 짠다.\n *\n * 손댈 곳이 화면뿐이라 화면이 갈라야 한다 — 여기 오면 둘 다 그냥 date 다.\n */\n case 'pending':\n return String(basis || '').toLowerCase() == 'handed-over' ? 'move_to_inbox' : 'schedule'\n case 'done':\n return 'done'\n /* Given up on, not finished. A different mark, not a missing one. */\n case 'aborted':\n return 'block'\n case 'approved':\n return 'done_all'\n case 'rejected':\n return 'assignment_return'\n default:\n return ''\n }\n}\n\n/**\n * 한 칸에 몇 줄까지.\n *\n * 이 화면은 monthly 만 쓴다. 넘치는 것을 줄로 늘리면 칸이 커지고 뒷주가 화면 밖으로 밀린다 —\n * plant 달력이 하루 스물다섯 건에서 실제로 그렇게 됐다. 넘치면 수로 말한다.\n */\nconst MOST_PER_DAY = 4\n\n/** 급한 것이 앞이다 — 기한 걸린 것 · 받아 둔 것 · 끝난 것. */\nfunction rank(event: { state?: string; basis?: string }): number {\n if (String(event.state || '').toLowerCase() != 'pending') {\n return 2\n }\n\n return String(event.basis || '').toLowerCase() == 'handed-over' ? 1 : 0\n}\n\n/** 이 날짜가 무슨 뜻인지 — 표만으로 못 읽는 사람을 위해 한 줄로. */\nfunction basisText(state?: string, basis?: string): string {\n if (String(state || '').toLowerCase() != 'pending') {\n return i18next.t('text.finished-on-this-day')\n }\n\n return String(basis || '').toLowerCase() == 'handed-over'\n ? i18next.t('text.handed-over-on-this-day')\n : i18next.t('text.due-on-this-day')\n}\n\n/**\n * 물은 것을 실제로 받았나 — **아니면 던진다.**\n *\n * 이 앱의 Apollo client 는 `errorPolicy: 'all'` 로 서 있다\n * ([읽었음] operato/webcomponents/graphql/src/graphql-client.ts:15). 질의가 실패해도 **거절되지\n * 않는다.** `errors` 를 실은 응답이 오고 `data` 는 비거나 반만 찬다.\n *\n * 그래서 `if (response.data)` 로 읽으면 실패가 **빈 목록과 구별되지 않는다.** 달력에서 그것은\n * 「이번 달에 아무것도 없다」로 그려진다 — 결재자에게 할 일이 없다고 말하는 것이라 값이 비싸다.\n * 못 불러온 것과 없는 것은 다른 사실이고, 화면은 그 둘을 절대 섞으면 안 된다.\n *\n * plant 레인이 자기 달력에서 같은 구멍을 재서 알려 줬다 — 요청만 실패시키고 화면을 보니 칩은\n * 그대로인 채 그 층만 빈 채로 그려졌다.\n */\nfunction askedFor<T>(response: { data?: any; errors?: readonly unknown[] }, field: string): T[] {\n if (response.errors?.length) {\n throw new Error(`[activityEvents] ${JSON.stringify(response.errors)}`)\n }\n\n const value = response.data?.[field]\n\n if (!Array.isArray(value)) {\n throw new Error(`[activityEvents] \"${field}\" is missing from the response`)\n }\n\n return value as T[]\n}\n\n@customElement('done-list-calendar-page')\nexport class DoneListCalendarPage extends localize(i18next)(PageView) {\n static styles = [\n /* The frame owns the page shell; the calendar is the content it sizes (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n css`\n :host {\n color: var(--md-sys-color-on-background);\n }\n\n /* 못 불러왔다는 말은 달력 위에 선다 — 빈 달력만 보고 「없구나」 하고 닫지 않도록. */\n .failed {\n display: flex;\n align-items: center;\n gap: 6px;\n\n margin: 10px 10px 0 10px;\n padding: 8px 10px;\n border-radius: 6px;\n\n background-color: var(--md-sys-color-error-container, #ffdad6);\n color: var(--md-sys-color-on-error-container, #410002);\n font-size: var(--ui-t-body, 13px);\n }\n\n .failed md-icon {\n font-size: 1.2em;\n }\n\n ox-event-view {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @query('ox-event-view') eventView!: OxEventView\n\n /** 못 불러왔다 — 「없다」와 절대 섞지 않는다. 이 값이 서면 화면이 그렇게 말한다. */\n @state() failed = false\n\n get context() {\n return {\n title: i18next.t('title.my work calendar'),\n help: 'worklist/done-list-calendar-page'\n }\n }\n\n render() {\n return html`\n ${\n this.failed\n ? html`<div class=\"failed\" role=\"alert\">\n <md-icon>cloud_off</md-icon>\n <span>${i18next.t('text.calendar-not-loaded')}</span>\n </div>`\n : ''\n }\n <ox-event-view class=\"page-fill\" mode=\"monthly\" .eventProvider=${this}></ox-event-view>\n `\n }\n\n async fetchEventsForCalendar(calendar: CALENDAR): Promise<Map<Date, BizEvent[]>> {\n const from = calendar[0].date.toISOString()\n const to = new Date(calendar[calendar.length - 1].date.getTime() + 24 * 60 * 60 * 1000).toISOString()\n\n const response = await client.query({\n query: gql`\n query ($from: String!, $to: String!) {\n responses: activityEvents(from: $from, to: $to) {\n id\n name\n type\n state\n basis\n priority\n date\n }\n }\n `,\n variables: {\n from,\n to\n }\n })\n\n const eventMap = new Map<Date, BizEvent[]>()\n\n let activityEvents: any[]\n\n try {\n activityEvents = askedFor(response, 'responses')\n this.failed = false\n } catch (e) {\n /*\n * 빈 달력을 돌려주되 **빈 달력이라고 말하지는 않는다.** 위의 띠가 못 불러왔다고 적는다.\n */\n this.failed = true\n console.error(e)\n return eventMap\n }\n\n calendar.forEach(({ date }) => {\n const localDateString = date.toLocaleDateString()\n\n const ofTheDay = activityEvents\n .filter(({ date: activityDate }) => new Date(activityDate).toLocaleDateString() == localDateString)\n /*\n * **자르기 전에 차례를 세운다.** 상한만 두고 자르면 먼저 온 순서로 잘린다 — 기한이 걸린\n * 결재 한 건이 끝난 스무 건 뒤에 묻히면 「+20건 더」만 보이고, 그 날 할 일이 있다는 것을\n * 아무도 못 본다.\n *\n * 급한 것이 앞이다: 기한으로 놓인 안 끝난 것 → 받은 날에 놓인 안 끝난 것 → 끝난 것.\n * 같은 자리 안에서는 우선순위가 높은 것, 그 다음 이른 시각.\n */\n .sort((a, b) => rank(a) - rank(b) || (b.priority || 0) - (a.priority || 0) || (a.date > b.date ? 1 : -1))\n\n const shown = ofTheDay.slice(0, MOST_PER_DAY)\n const hidden = ofTheDay.length - shown.length\n\n const events: BizEvent[] = shown.map(({ id, name, priority, date, type, state, basis }) => {\n const color = PRIORITY_COLORS[Math.min(Math.max(priority || 0, 0), PRIORITY_COLORS.length - 1)]\n /*\n * 안 끝난 것은 **하는 화면**으로 간다.\n *\n * activity-thread-view 는 끝난 업무를 읽는 화면이다. 아직 할 일을 거기로 보내면 손댈\n * 데가 없는 화면에 도착한다 — 달력에서 눌렀는데 아무것도 못 한다.\n */\n const pending = String(state || '').toLowerCase() == 'pending'\n const path =\n type == 'activity-thread' ? (pending ? 'activity-thread' : 'activity-thread-view') : 'activity-approval'\n const href = `${path}/${id}?title=${encodeURIComponent(name)}`\n const at = new Date(date).toLocaleTimeString([], {\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit'\n })\n const icon = eventIcon(state, basis)\n\n return {\n /*\n * BizEvent 는 title · color 를 요구한다. 그리는 것은 template 이지만, 부품이 template\n * 없이 그리는 길로 갈 때 쓰는 값이라 비워 두지 않는다 — 그때 이름 없는 칸이 뜬다.\n */\n title: name,\n color,\n template: html`<a\n href=${href}\n title=${basisText(state, basis)}\n style=\"color:${color};display:block;text-decoration:none;\"\n >${icon ? html`<md-icon style=\"font-size:1em;\">${icon}</md-icon> ` : ''}${at} ${name}</a\n >`\n }\n })\n\n if (hidden > 0) {\n /* 넘치면 **수로 말한다** — 줄을 늘리면 뒷주가 화면 밖으로 밀린다. */\n const more = i18next.t('text.and-n-more', { n: hidden })\n events.push({\n title: more,\n color: 'inherit',\n template: html`<span style=\"opacity:0.7\">${more}</span>`\n })\n }\n\n /*\n * **키는 받은 그 Date 객체 그대로다.** 같은 날을 새로 만들어 넣으면 조회가 빗나가고 그 칸이\n * 빈 채로 그려진다 — 오류는 안 난다.\n */\n eventMap.set(date, events)\n })\n\n return eventMap\n }\n\n pageUpdated(changes: any, lifecycle: any, before: any) {\n if (this.active) {\n /*\n * this page is activated\n */\n } else {\n /* this page is deactivated */\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"done-list-calendar-page.js","sourceRoot":"","sources":["../../../client/pages/todo/done-list-calendar-page.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,sCAAsC,CAAA;AAE7C,OAAO,EAAkB,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAY,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAGxE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAA0B,MAAM,gCAAgC,CAAA;AAE5H,kFAAkF;AAClF,MAAM,eAAe,GAAG,CAAC,OAAO,EA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AChB;;eAEG;QACL,CAAC;aAAM,CAAC;YACN,8BAA8B;QAChC,CAAC;IACH,CAAC;;AAhJuB;IAAvB,KAAK,CAAC,eAAe,CAAC;8BAAa,WAAW;IAE/C,qDAAqD;;uDAFN;AAGtC;IAAR,KAAK,EAAE;;oDAAe;AAxCZ,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAsLhC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/event-view/ox-event-view.js'\n\nimport { PropertyValues, html, css } from 'lit'\nimport gql from 'graphql-tag'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { PageView } from '@operato/shell'\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { OxEventView } from '@operato/event-view'\nimport { ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { BizEvent, CALENDAR } from '@operato/event-view/types.js'\n\nimport { entriesOfDay, loadWorkCalendar, workCalendarSources, type WorkCalendarEntry } from '../../work-calendar-sources.js'\n\n/** Priority 0..3. Anything outside the range clamps to the most urgent colour. */\nconst PRIORITY_COLORS = ['black', 'darkgray', 'orange', 'red']\n\n/**\n * Which mark a finished item wears.\n *\n * Pending is the one that is not finished, and it reads as an empty circle: every filled mark on\n * this calendar means \"over\", so a pending item must not borrow one.\n *\n * A state this function does not know draws nothing. The old expression ended in\n * `: 'assignment_return'`, so anything unrecognised became sent-back — and Aborted, added to\n * ActivityEventStatus alongside this change, would have landed there. An icon the screen cannot\n * vouch for is worse than a blank, because the reader cannot tell an invented mark from a reported\n * one.\n *\n * The case fold is a guard, not a fix for anything observed here. ActivityEvent.state is declared\n * `@Field({ nullable: true })` with no explicit type, so type-graphql reflects it as String and the\n * wire carries the enum's value — lowercase, as this function reads it. Declaring it\n * `@Field(type => ActivityEventStatus)` instead is a one-word edit that would silently switch the\n * wire to the enum's **keys**: registerEnumType publishes by key. That switch is not hypothetical.\n * It is what organization/client/types/approval-line.ts hit, where `participation` is declared as\n * the enum, arrives as `Reference`, and was compared against `reference` — false every time, for\n * as long as the check had existed.\n */\nfunction eventIcon(state?: string, basis?: string): string {\n switch (String(state || '').toLowerCase()) {\n /*\n * 안 끝난 것은 **좌표가 표를 정한다.**\n *\n * 기한으로 놓인 것은 시계다 — 「이 날까지」. 기한이 없어 받은 날에 놓인 것은 받은 함이다 —\n * 「이 날 왔다」. 둘을 같은 표로 그리면 한 칸 안에서 구별이 안 되고, 결재자가 기한을 도착으로\n * 읽고 지나치거나 도착을 기한으로 읽고 한 주를 헛되이 다시 짠다.\n *\n * 손댈 곳이 화면뿐이라 화면이 갈라야 한다 — 여기 오면 둘 다 그냥 date 다.\n */\n case 'pending':\n return String(basis || '').toLowerCase() == 'handed-over' ? 'move_to_inbox' : 'schedule'\n case 'done':\n return 'done'\n /* Given up on, not finished. A different mark, not a missing one. */\n case 'aborted':\n return 'block'\n case 'approved':\n return 'done_all'\n case 'rejected':\n return 'assignment_return'\n default:\n return ''\n }\n}\n\n/**\n * 한 칸에 몇 줄까지.\n *\n * 이 화면은 monthly 만 쓴다. 넘치는 것을 줄로 늘리면 칸이 커지고 뒷주가 화면 밖으로 밀린다 —\n * plant 달력이 하루 스물다섯 건에서 실제로 그렇게 됐다. 넘치면 수로 말한다.\n */\nconst MOST_PER_DAY = 4\n\n/** 급한 것이 앞이다 — 기한 걸린 것 · 받아 둔 것 · 끝난 것. */\nfunction rank(event: { state?: string; basis?: string }): number {\n if (String(event.state || '').toLowerCase() != 'pending') {\n return 2\n }\n\n return String(event.basis || '').toLowerCase() == 'handed-over' ? 1 : 0\n}\n\n/** 이 날짜가 무슨 뜻인지 — 표만으로 못 읽는 사람을 위해 한 줄로. */\nfunction basisText(state?: string, basis?: string): string {\n if (String(state || '').toLowerCase() != 'pending') {\n return i18next.t('text.finished-on-this-day')\n }\n\n return String(basis || '').toLowerCase() == 'handed-over'\n ? i18next.t('text.handed-over-on-this-day')\n : i18next.t('text.due-on-this-day')\n}\n\n/**\n * 물은 것을 실제로 받았나 — **아니면 던진다.**\n *\n * 이 앱의 Apollo client 는 `errorPolicy: 'all'` 로 서 있다\n * ([읽었음] operato/webcomponents/graphql/src/graphql-client.ts:15). 질의가 실패해도 **거절되지\n * 않는다.** `errors` 를 실은 응답이 오고 `data` 는 비거나 반만 찬다.\n *\n * 그래서 `if (response.data)` 로 읽으면 실패가 **빈 목록과 구별되지 않는다.** 달력에서 그것은\n * 「이번 달에 아무것도 없다」로 그려진다 — 결재자에게 할 일이 없다고 말하는 것이라 값이 비싸다.\n * 못 불러온 것과 없는 것은 다른 사실이고, 화면은 그 둘을 절대 섞으면 안 된다.\n *\n * plant 레인이 자기 달력에서 같은 구멍을 재서 알려 줬다 — 요청만 실패시키고 화면을 보니 칩은\n * 그대로인 채 그 층만 빈 채로 그려졌다.\n */\nfunction askedFor<T>(response: { data?: any; errors?: readonly unknown[] }, field: string): T[] {\n if (response.errors?.length) {\n throw new Error(`[activityEvents] ${JSON.stringify(response.errors)}`)\n }\n\n const value = response.data?.[field]\n\n if (!Array.isArray(value)) {\n throw new Error(`[activityEvents] \"${field}\" is missing from the response`)\n }\n\n return value as T[]\n}\n\n@customElement('done-list-calendar-page')\nexport class DoneListCalendarPage extends localize(i18next)(PageView) {\n static styles = [\n /* The frame owns the page shell; the calendar is the content it sizes (ADR-0060 decision 8). */\n WorkSurfacePageStyles,\n ScrollbarStyles,\n css`\n :host {\n color: var(--md-sys-color-on-background);\n }\n\n /* 못 불러왔다는 말은 달력 위에 선다 — 빈 달력만 보고 「없구나」 하고 닫지 않도록. */\n .failed {\n display: flex;\n align-items: center;\n gap: 6px;\n\n margin: 10px 10px 0 10px;\n padding: 8px 10px;\n border-radius: 6px;\n\n background-color: var(--md-sys-color-error-container, #ffdad6);\n color: var(--md-sys-color-on-error-container, #410002);\n font-size: var(--ui-t-body, 13px);\n }\n\n .failed md-icon {\n font-size: 1.2em;\n }\n\n ox-event-view {\n flex: 1;\n padding: 10px;\n overflow: auto;\n }\n `\n ]\n\n @query('ox-event-view') eventView!: OxEventView\n\n /** 못 불러왔다 — 「없다」와 절대 섞지 않는다. 이 값이 서면 화면이 그렇게 말한다. */\n @state() failed = false\n\n get context() {\n return {\n title: i18next.t('title.my work calendar'),\n help: 'worklist/done-list-calendar-page'\n }\n }\n\n render() {\n return html`\n ${\n this.failed\n ? html`<div class=\"failed\" role=\"alert\">\n <md-icon>cloud_off</md-icon>\n <span>${i18next.t('text.calendar-not-loaded')}</span>\n </div>`\n : ''\n }\n <ox-event-view class=\"page-fill\" mode=\"monthly\" .eventProvider=${this}></ox-event-view>\n `\n }\n\n async fetchEventsForCalendar(calendar: CALENDAR): Promise<Map<Date, BizEvent[]>> {\n const fromDate = calendar[0].date\n const toDate = new Date(calendar[calendar.length - 1].date.getTime() + 24 * 60 * 60 * 1000)\n\n /*\n * worklist's own and every registered source, asked apart: one that fails leaves the others on the grid, and the\n * band above it says something was not read - never a day with nothing on it.\n */\n const { entries, failed } = await loadWorkCalendar([\n this.activityEntries(fromDate.toISOString(), toDate.toISOString()),\n ...workCalendarSources().map(source => source.load(fromDate, toDate))\n ])\n this.failed = failed\n\n const eventMap = new Map<Date, BizEvent[]>()\n\n calendar.forEach(({ date }) => {\n const localDateString = date.toLocaleDateString()\n\n /*\n * **자르기 전에 차례를 세운다.** 상한만 두고 자르면 먼저 온 순서로 잘린다 — 기한이 걸린\n * 결재 한 건이 끝난 스무 건 뒤에 묻히면 「+20건 더」만 보이고, 그 날 할 일이 있다는 것을\n * 아무도 못 본다. 급한 것이 앞이다: 그날 할 것(기한·회의) → 받은 날에 놓인 것 → 끝난 것.\n */\n const { shown, hidden } = entriesOfDay(entries, localDateString, MOST_PER_DAY)\n\n const events: BizEvent[] = shown.map(({ name, priority, date, icon, href, note }) => {\n const color = PRIORITY_COLORS[Math.min(Math.max(priority || 0, 0), PRIORITY_COLORS.length - 1)]\n const at = new Date(date).toLocaleTimeString([], {\n hourCycle: 'h23',\n hour: '2-digit',\n minute: '2-digit'\n })\n const body = html`${icon ? html`<md-icon style=\"font-size:1em;\">${icon}</md-icon> ` : ''}${at} ${name}`\n\n return {\n /*\n * BizEvent 는 title · color 를 요구한다. 그리는 것은 template 이지만, 부품이 template\n * 없이 그리는 길로 갈 때 쓰는 값이라 비워 두지 않는다 — 그때 이름 없는 칸이 뜬다.\n */\n title: name,\n color,\n /* 열 수 없는 것은 링크가 아니다 — 눌러도 아무것도 못 하는 곳으로 보내지 않는다. */\n template: href\n ? html`<a href=${href} title=${note ?? ''} style=\"color:${color};display:block;text-decoration:none;\">${body}</a>`\n : html`<span title=${note ?? ''} style=\"color:${color};display:block;\">${body}</span>`\n }\n })\n\n if (hidden > 0) {\n /* 넘치면 **수로 말한다** — 줄을 늘리면 뒷주가 화면 밖으로 밀린다. */\n const more = i18next.t('text.and-n-more', { n: hidden })\n events.push({\n title: more,\n color: 'inherit',\n template: html`<span style=\"opacity:0.7\">${more}</span>`\n })\n }\n\n /*\n * **키는 받은 그 Date 객체 그대로다.** 같은 날을 새로 만들어 넣으면 조회가 빗나가고 그 칸이\n * 빈 채로 그려진다 — 오류는 안 난다.\n */\n eventMap.set(date, events)\n })\n\n return eventMap\n }\n\n /** worklist's own - my to-dos and approvals, open and finished - as calendar entries. */\n private async activityEntries(from: string, to: string): Promise<WorkCalendarEntry[]> {\n const response = await client.query({\n query: gql`\n query ($from: String!, $to: String!) {\n responses: activityEvents(from: $from, to: $to) {\n id\n name\n type\n state\n basis\n priority\n date\n }\n }\n `,\n variables: { from, to }\n })\n\n return askedFor<any>(response, 'responses').map(({ id, name, type, state, basis, priority, date }) => {\n /*\n * 안 끝난 것은 **하는 화면**으로 간다.\n *\n * activity-thread-view 는 끝난 업무를 읽는 화면이다. 아직 할 일을 거기로 보내면 손댈\n * 데가 없는 화면에 도착한다 — 달력에서 눌렀는데 아무것도 못 한다.\n */\n const pending = String(state || '').toLowerCase() == 'pending'\n const path = type == 'activity-thread' ? (pending ? 'activity-thread' : 'activity-thread-view') : 'activity-approval'\n return {\n id: `${type}:${id}`,\n name,\n date,\n rank: rank({ state, basis }) as 0 | 1 | 2,\n priority,\n icon: eventIcon(state, basis),\n href: `${path}/${id}?title=${encodeURIComponent(name)}`,\n note: basisText(state, basis)\n }\n })\n }\n\n pageUpdated(changes: any, lifecycle: any, before: any) {\n if (this.active) {\n /*\n * this page is activated\n */\n } else {\n /* this page is deactivated */\n }\n }\n}\n"]}
|