@things-factory/pdf 10.1.232 → 10.1.233

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 '@material/web/button/filled-button.js';
2
+ import '@material/web/button/outlined-button.js';
2
3
  import { LitElement } from 'lit';
3
4
  /** A kind as its owning module words it - `issued-document.<kind>` in that module's translations. */
4
5
  export declare const issuedDocumentKindWord: (kind?: string | null) => string;
@@ -18,6 +19,8 @@ export declare function downloadIssuedFile(file: {
18
19
  fullpath: string;
19
20
  name?: string | null;
20
21
  }): Promise<void>;
22
+ /** A PDF in a large popup - an issued file at its address, or a preview just printed. */
23
+ export declare function openPdfView(src: string, title: string): import("@operato/layout").PopupHandle<unknown>;
21
24
  /**
22
25
  * Ask for what an issue needs - its purpose and where it goes, and the day it speaks of when the kind has one - then issue
23
26
  * it (`issueDocument`, ADR-0176) and open the file. Resolves with the issued row, or null when the person closed it.
@@ -39,6 +42,9 @@ export declare class IssueDocumentForm extends IssueDocumentForm_base {
39
42
  private submittedTo;
40
43
  private busy;
41
44
  render(): import("lit-html").TemplateResult<1>;
45
+ private get variables();
46
+ /** The document as it would be issued with what is written now - unnumbered and marked as a preview, kept nowhere. */
47
+ private preview;
42
48
  private issue;
43
49
  }
44
50
  export {};
@@ -1,5 +1,6 @@
1
1
  import { __decorate, __metadata } from "tslib";
2
2
  import '@material/web/button/filled-button.js';
3
+ import '@material/web/button/outlined-button.js';
3
4
  import gql from 'graphql-tag';
4
5
  import { css, html, LitElement } from 'lit';
5
6
  import { customElement, property, state } from 'lit/decorators.js';
@@ -23,6 +24,10 @@ export async function downloadIssuedFile(file) {
23
24
  link.remove();
24
25
  setTimeout(() => URL.revokeObjectURL(url), 1000);
25
26
  }
27
+ /** A PDF in a large popup - an issued file at its address, or a preview just printed. */
28
+ export function openPdfView(src, title) {
29
+ return openPopup(html `<iframe title=${title} src=${src} style="display: block; width: 100%; height: 80vh; border: 0"></iframe>`, { backdrop: true, size: 'large', title });
30
+ }
26
31
  /**
27
32
  * Ask for what an issue needs - its purpose and where it goes, and the day it speaks of when the kind has one - then issue
28
33
  * it (`issueDocument`, ADR-0176) and open the file. Resolves with the issued row, or null when the person closed it.
@@ -79,6 +84,7 @@ let IssueDocumentForm = class IssueDocumentForm extends localize(i18next)(LitEle
79
84
  div[actions] {
80
85
  display: flex;
81
86
  justify-content: flex-end;
87
+ gap: var(--spacing-medium, 8px);
82
88
  }
83
89
  `; }
84
90
  render() {
@@ -89,10 +95,41 @@ let IssueDocumentForm = class IssueDocumentForm extends localize(i18next)(LitEle
89
95
  <label>${i18next.t('field.issued-document-purpose')}<input .value=${this.purpose} @input=${(e) => (this.purpose = e.target.value)} /></label>
90
96
  <label>${i18next.t('field.issued-document-submitted-to')}<input .value=${this.submittedTo} @input=${(e) => (this.submittedTo = e.target.value)} /></label>
91
97
  <div actions>
98
+ <md-outlined-button ?disabled=${this.busy} @click=${() => this.preview()}>${i18next.t('button.pdf-preview')}</md-outlined-button>
92
99
  <md-filled-button ?disabled=${this.busy} @click=${() => this.issue()}>${i18next.t('button.issue-document')}</md-filled-button>
93
100
  </div>
94
101
  `;
95
102
  }
103
+ get variables() {
104
+ return { kind: this.kind, refId: this.refId || null, input: { purpose: this.purpose, submittedTo: this.submittedTo, asOf: this.withAsOf ? this.asOf || null : null } };
105
+ }
106
+ /** The document as it would be issued with what is written now - unnumbered and marked as a preview, kept nowhere. */
107
+ async preview() {
108
+ this.busy = true;
109
+ try {
110
+ const response = await client.query({
111
+ query: gql `
112
+ query ($kind: String!, $refId: String, $input: IssueDocumentInput) {
113
+ previewIssuedDocument(kind: $kind, refId: $refId, input: $input)
114
+ }
115
+ `,
116
+ variables: this.variables,
117
+ fetchPolicy: 'no-cache'
118
+ });
119
+ if (response.errors?.length)
120
+ throw response.errors[0];
121
+ const bytes = Uint8Array.from(atob(response.data.previewIssuedDocument), c => c.charCodeAt(0));
122
+ const url = URL.createObjectURL(new Blob([bytes], { type: 'application/pdf' }));
123
+ const popup = openPdfView(url, `${i18next.t('button.pdf-preview')} · ${issuedDocumentKindWord(this.kind)}`);
124
+ popup.onclosed = () => URL.revokeObjectURL(url);
125
+ }
126
+ catch (error) {
127
+ notify({ level: 'error', message: error?.message ?? String(error) });
128
+ }
129
+ finally {
130
+ this.busy = false;
131
+ }
132
+ }
96
133
  async issue() {
97
134
  this.busy = true;
98
135
  try {
@@ -109,7 +146,7 @@ let IssueDocumentForm = class IssueDocumentForm extends localize(i18next)(LitEle
109
146
  }
110
147
  }
111
148
  `,
112
- variables: { kind: this.kind, refId: this.refId || null, input: { purpose: this.purpose, submittedTo: this.submittedTo, asOf: this.withAsOf ? this.asOf || null : null } }
149
+ variables: this.variables
113
150
  });
114
151
  if (response.errors?.length)
115
152
  throw response.errors[0];
@@ -1 +1 @@
1
- {"version":3,"file":"issue-document.js","sourceRoot":"","sources":["../client/issue-document.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAE9C,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEnD,qGAAqG;AACrG,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,IAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AAI1I;;;GAGG;AACH,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,CAAC,IAAI,EAAE,QAAQ;gBAAE,MAAM,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAChE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;QACnE,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACtE,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,KAAK,CAAA;QACnB,CAAC;IACH,CAAC;;AAjDW;IAAX,QAAQ,EAAE;;+CAAU;AACT;IAAX,QAAQ,EAAE;;gDAAW;AACV;IAAX,QAAQ,EAAE;;+CAAU;AACQ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;mDAAiB;AAC5B;IAAhB,KAAK,EAAE;;kDAAqB;AACZ;IAAhB,KAAK,EAAE;;sDAAyB;AAChB;IAAhB,KAAK,EAAE;;+CAAqB;AAtClB,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAkF7B","sourcesContent":["import '@material/web/button/filled-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\n\n/** A kind as its owning module words it - `issued-document.<kind>` in that module's translations. */\nexport const issuedDocumentKindWord = (kind?: string | null) => (kind ? i18next.t(`issued-document.${kind}`, { defaultValue: kind }) : '')\n\nexport type IssuedDocument = { id: string; number: string; file?: { fullpath: string; name?: string | null } | null }\n\n/**\n * Save an issued file under its own name - `재직증명서_남종호_재직-2026-0001.pdf` - not the storage path the address\n * carries. The file is fetched with the session and handed to the browser as a download.\n */\nexport async function downloadIssuedFile(file: { fullpath: string; name?: string | null }): Promise<void> {\n const response = await fetch(file.fullpath, { credentials: 'same-origin' })\n if (!response.ok) throw new Error(`${response.status} ${response.statusText}`)\n const url = URL.createObjectURL(await response.blob())\n const link = Object.assign(document.createElement('a'), { href: url, download: file.name || file.fullpath.split('/').pop() || 'document.pdf' })\n document.body.appendChild(link)\n link.click()\n link.remove()\n setTimeout(() => URL.revokeObjectURL(url), 1000)\n}\n\n/**\n * Ask for what an issue needs - its purpose and where it goes, and the day it speaks of when the kind has one - then issue\n * it (`issueDocument`, ADR-0176) and open the file. Resolves with the issued row, or null when the person closed it.\n */\nexport function issueDocument(options: { kind: string; refId?: string; asOf?: string; withAsOf?: boolean }): Promise<IssuedDocument | null> {\n return new Promise(resolve => {\n let done: IssuedDocument | null = null\n const popup = openPopup(\n html`<issue-document-form\n .kind=${options.kind}\n .refId=${options.refId ?? ''}\n .asOf=${options.asOf ?? ''}\n .withAsOf=${!!options.withAsOf}\n @issued=${(e: CustomEvent) => ((done = e.detail), popup.close())}\n ></issue-document-form>`,\n { backdrop: true, size: 'small', title: i18next.t('title.issue-document', { kind: issuedDocumentKindWord(options.kind) }) }\n )\n popup.onclosed = () => resolve(done)\n })\n}\n\n@customElement('issue-document-form')\nexport class IssueDocumentForm extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium, 8px);\n padding: var(--spacing-large, 12px);\n background-color: var(--md-sys-color-surface);\n }\n label {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-small, 4px);\n font: var(--label-font);\n color: var(--md-sys-color-on-surface);\n }\n input {\n box-sizing: border-box;\n width: 100%;\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n padding: var(--input-padding);\n font: var(--input-font);\n }\n div[actions] {\n display: flex;\n justify-content: flex-end;\n }\n `\n\n @property() kind = ''\n @property() refId = ''\n @property() asOf = ''\n @property({ type: Boolean }) withAsOf = false\n @state() private purpose = ''\n @state() private submittedTo = ''\n @state() private busy = false\n\n render() {\n return html`\n ${this.withAsOf\n ? html`<label>${i18next.t('field.issue-as-of')}<input type=\"date\" .value=${this.asOf} @input=${(e: any) => (this.asOf = e.target.value)} /></label>`\n : ''}\n <label>${i18next.t('field.issued-document-purpose')}<input .value=${this.purpose} @input=${(e: any) => (this.purpose = e.target.value)} /></label>\n <label>${i18next.t('field.issued-document-submitted-to')}<input .value=${this.submittedTo} @input=${(e: any) => (this.submittedTo = e.target.value)} /></label>\n <div actions>\n <md-filled-button ?disabled=${this.busy} @click=${() => this.issue()}>${i18next.t('button.issue-document')}</md-filled-button>\n </div>\n `\n }\n\n private async issue() {\n this.busy = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($kind: String!, $refId: String, $input: IssueDocumentInput) {\n issueDocument(kind: $kind, refId: $refId, input: $input) {\n id\n number\n file {\n fullpath\n name\n }\n }\n }\n `,\n variables: { kind: this.kind, refId: this.refId || null, input: { purpose: this.purpose, submittedTo: this.submittedTo, asOf: this.withAsOf ? this.asOf || null : null } }\n })\n if (response.errors?.length) throw response.errors[0]\n const issued: IssuedDocument = response.data.issueDocument\n notify({ message: i18next.t('text.issued-document-issued', { number: issued.number }) })\n if (issued.file?.fullpath) await downloadIssuedFile(issued.file)\n this.dispatchEvent(new CustomEvent('issued', { detail: issued }))\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n } finally {\n this.busy = false\n }\n }\n}\n"]}
1
+ {"version":3,"file":"issue-document.js","sourceRoot":"","sources":["../client/issue-document.ts"],"names":[],"mappings":";AAAA,OAAO,uCAAuC,CAAA;AAC9C,OAAO,yCAAyC,CAAA;AAEhD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,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KAAK,CAAC,EAAE,CAAC,CAAA;QACtE,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,IAAI,GAAG,KAAK,CAAA;QACnB,CAAC;IACH,CAAC;;AA/EW;IAAX,QAAQ,EAAE;;+CAAU;AACT;IAAX,QAAQ,EAAE;;gDAAW;AACV;IAAX,QAAQ,EAAE;;+CAAU;AACQ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;mDAAiB;AAC5B;IAAhB,KAAK,EAAE;;kDAAqB;AACZ;IAAhB,KAAK,EAAE;;sDAAyB;AAChB;IAAhB,KAAK,EAAE;;+CAAqB;AAvClB,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAiH7B","sourcesContent":["import '@material/web/button/filled-button.js'\nimport '@material/web/button/outlined-button.js'\n\nimport gql from 'graphql-tag'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\n\nimport { client } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { notify, openPopup } from '@operato/layout'\n\n/** A kind as its owning module words it - `issued-document.<kind>` in that module's translations. */\nexport const issuedDocumentKindWord = (kind?: string | null) => (kind ? i18next.t(`issued-document.${kind}`, { defaultValue: kind }) : '')\n\nexport type IssuedDocument = { id: string; number: string; file?: { fullpath: string; name?: string | null } | null }\n\n/**\n * Save an issued file under its own name - `재직증명서_남종호_재직-2026-0001.pdf` - not the storage path the address\n * carries. The file is fetched with the session and handed to the browser as a download.\n */\nexport async function downloadIssuedFile(file: { fullpath: string; name?: string | null }): Promise<void> {\n const response = await fetch(file.fullpath, { credentials: 'same-origin' })\n if (!response.ok) throw new Error(`${response.status} ${response.statusText}`)\n const url = URL.createObjectURL(await response.blob())\n const link = Object.assign(document.createElement('a'), { href: url, download: file.name || file.fullpath.split('/').pop() || 'document.pdf' })\n document.body.appendChild(link)\n link.click()\n link.remove()\n setTimeout(() => URL.revokeObjectURL(url), 1000)\n}\n\n/** A PDF in a large popup - an issued file at its address, or a preview just printed. */\nexport function openPdfView(src: string, title: string) {\n return openPopup(html`<iframe title=${title} src=${src} style=\"display: block; width: 100%; height: 80vh; border: 0\"></iframe>`, { backdrop: true, size: 'large', title })\n}\n\n/**\n * Ask for what an issue needs - its purpose and where it goes, and the day it speaks of when the kind has one - then issue\n * it (`issueDocument`, ADR-0176) and open the file. Resolves with the issued row, or null when the person closed it.\n */\nexport function issueDocument(options: { kind: string; refId?: string; asOf?: string; withAsOf?: boolean }): Promise<IssuedDocument | null> {\n return new Promise(resolve => {\n let done: IssuedDocument | null = null\n const popup = openPopup(\n html`<issue-document-form\n .kind=${options.kind}\n .refId=${options.refId ?? ''}\n .asOf=${options.asOf ?? ''}\n .withAsOf=${!!options.withAsOf}\n @issued=${(e: CustomEvent) => ((done = e.detail), popup.close())}\n ></issue-document-form>`,\n { backdrop: true, size: 'small', title: i18next.t('title.issue-document', { kind: issuedDocumentKindWord(options.kind) }) }\n )\n popup.onclosed = () => resolve(done)\n })\n}\n\n@customElement('issue-document-form')\nexport class IssueDocumentForm extends localize(i18next)(LitElement) {\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-medium, 8px);\n padding: var(--spacing-large, 12px);\n background-color: var(--md-sys-color-surface);\n }\n label {\n display: flex;\n flex-direction: column;\n gap: var(--spacing-small, 4px);\n font: var(--label-font);\n color: var(--md-sys-color-on-surface);\n }\n input {\n box-sizing: border-box;\n width: 100%;\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n padding: var(--input-padding);\n font: var(--input-font);\n }\n div[actions] {\n display: flex;\n justify-content: flex-end;\n gap: var(--spacing-medium, 8px);\n }\n `\n\n @property() kind = ''\n @property() refId = ''\n @property() asOf = ''\n @property({ type: Boolean }) withAsOf = false\n @state() private purpose = ''\n @state() private submittedTo = ''\n @state() private busy = false\n\n render() {\n return html`\n ${this.withAsOf\n ? html`<label>${i18next.t('field.issue-as-of')}<input type=\"date\" .value=${this.asOf} @input=${(e: any) => (this.asOf = e.target.value)} /></label>`\n : ''}\n <label>${i18next.t('field.issued-document-purpose')}<input .value=${this.purpose} @input=${(e: any) => (this.purpose = e.target.value)} /></label>\n <label>${i18next.t('field.issued-document-submitted-to')}<input .value=${this.submittedTo} @input=${(e: any) => (this.submittedTo = e.target.value)} /></label>\n <div actions>\n <md-outlined-button ?disabled=${this.busy} @click=${() => this.preview()}>${i18next.t('button.pdf-preview')}</md-outlined-button>\n <md-filled-button ?disabled=${this.busy} @click=${() => this.issue()}>${i18next.t('button.issue-document')}</md-filled-button>\n </div>\n `\n }\n\n private get variables() {\n return { kind: this.kind, refId: this.refId || null, input: { purpose: this.purpose, submittedTo: this.submittedTo, asOf: this.withAsOf ? this.asOf || null : null } }\n }\n\n /** The document as it would be issued with what is written now - unnumbered and marked as a preview, kept nowhere. */\n private async preview() {\n this.busy = true\n try {\n const response = await client.query({\n query: gql`\n query ($kind: String!, $refId: String, $input: IssueDocumentInput) {\n previewIssuedDocument(kind: $kind, refId: $refId, input: $input)\n }\n `,\n variables: this.variables,\n fetchPolicy: 'no-cache'\n })\n if (response.errors?.length) throw response.errors[0]\n const bytes = Uint8Array.from(atob(response.data.previewIssuedDocument), c => c.charCodeAt(0))\n const url = URL.createObjectURL(new Blob([bytes], { type: 'application/pdf' }))\n const popup = openPdfView(url, `${i18next.t('button.pdf-preview')} · ${issuedDocumentKindWord(this.kind)}`)\n popup.onclosed = () => URL.revokeObjectURL(url)\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n } finally {\n this.busy = false\n }\n }\n\n private async issue() {\n this.busy = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($kind: String!, $refId: String, $input: IssueDocumentInput) {\n issueDocument(kind: $kind, refId: $refId, input: $input) {\n id\n number\n file {\n fullpath\n name\n }\n }\n }\n `,\n variables: this.variables\n })\n if (response.errors?.length) throw response.errors[0]\n const issued: IssuedDocument = response.data.issueDocument\n notify({ message: i18next.t('text.issued-document-issued', { number: issued.number }) })\n if (issued.file?.fullpath) await downloadIssuedFile(issued.file)\n this.dispatchEvent(new CustomEvent('issued', { detail: issued }))\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n } finally {\n this.busy = false\n }\n }\n}\n"]}
@@ -12,7 +12,7 @@ import { i18next, localize } from '@operato/i18n';
12
12
  import { notify } from '@operato/layout';
13
13
  import { PageView } from '@operato/shell';
14
14
  import { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
15
- import { downloadIssuedFile, issueDocument, issuedDocumentKindWord as kindWord } from '../../issue-document';
15
+ import { downloadIssuedFile, issueDocument, issuedDocumentKindWord as kindWord, openPdfView } from '../../issue-document';
16
16
  const FIELDS = 'id kind number subjectName purpose submittedTo state revokedAt revokeReason createdAt creator { id name } file { id fullpath name }';
17
17
  /**
18
18
  * 발급 대장 (ADR-0176 decision 2) - the documents issued, newest first: kind, number, whom or what each is about, what
@@ -140,6 +140,16 @@ let IssuedDocumentList = class IssuedDocumentList extends localize(i18next)(Page
140
140
  click: (_c, _d, _col, record) => record?.file?.fullpath && downloadIssuedFile(record.file).catch((error) => notify({ level: 'error', message: error?.message ?? String(error) }))
141
141
  }
142
142
  },
143
+ {
144
+ type: 'gutter',
145
+ gutterName: 'button',
146
+ icon: 'visibility',
147
+ title: i18next.t('button.pdf-preview'),
148
+ handlers: {
149
+ /* The issued file itself, as it went out - its number and seal - opened in place under its own name. */
150
+ click: (_c, _d, _col, record) => record?.file?.fullpath && openPdfView(record.file.fullpath, `${kindWord(record.kind)} · ${record.number}`)
151
+ }
152
+ },
143
153
  { type: 'string', name: 'number', header: i18next.t('field.issued-document-number'), width: 140 },
144
154
  { type: 'string', name: 'kind', header: i18next.t('field.issued-document-kind'), record: { renderer: (value) => kindWord(value) }, width: 140 },
145
155
  { type: 'string', name: 'subjectName', header: i18next.t('field.issued-document-subject'), width: 160 },
@@ -1 +1 @@
1
- {"version":3,"file":"issued-document-list.js","sourceRoot":"","sources":["../../../client/pages/issued-document/issued-document-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,6BAA6B,CAAA;AACpC,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAE3F,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,sBAAsB,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAE5G,MAAM,MAAM,GAAG,qIAAqI,CAAA;AAEpJ;;;;;GAKG;AAEI,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAA5D;;QACL,wHAAwH;QAC9G,SAAI,GAAG,KAAK,CAAA;QAoDL,UAAK,GAAa,EAAE,CAAA;QACpB,aAAQ,GAA6D,EAAE,CAAA;QACvE,SAAI,GAAG,EAAE,CAAA;QACT,aAAQ,GAAQ,IAAI,CAAA;QACpB,WAAM,GAAG,EAAE,CAAA;QACX,SAAI,GAAG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-grist/ox-grist.js'\nimport '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-list.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 { notify } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\n\nimport { downloadIssuedFile, issueDocument, issuedDocumentKindWord as kindWord } from '../../issue-document'\n\nconst FIELDS = 'id kind number subjectName purpose submittedTo state revokedAt revokeReason createdAt creator { id name } file { id fullpath name }'\n\n/**\n * 발급 대장 (ADR-0176 decision 2) - the documents issued, newest first: kind, number, whom or what each is about, what\n * for and to whom, who issued it and when, and whether it was revoked. Each person sees the kinds their own rules let\n * them read (the server asks each kind's module) - an employee their own certificates - and issues here what is about\n * the company or about themselves. A file is saved as it was issued; a mistaken one is revoked with a reason.\n */\n@customElement('issued-document-list')\nexport class IssuedDocumentList extends localize(i18next)(PageView) {\n /** 내 증명서: one's own - about oneself or issued by oneself - and the documents one issues here. Else the whole ledger. */\n protected mine = false\n\n static styles = [\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n ox-grist {\n flex: 1;\n }\n .filters {\n display: flex;\n gap: var(--spacing-medium, 8px);\n align-items: center;\n padding: var(--spacing-medium, 8px) var(--spacing-large, 12px);\n }\n .revoke {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-medium, 8px);\n align-items: center;\n padding: var(--spacing-medium, 8px) var(--spacing-large, 12px);\n border-top: var(--border-dim-color);\n font: var(--label-font);\n }\n .revoke input {\n flex: 1;\n min-width: 200px;\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n padding: var(--input-padding);\n font: var(--input-font);\n }\n .filters label {\n display: flex;\n align-items: center;\n gap: var(--spacing-medium, 8px);\n font: var(--label-font);\n }\n ox-select {\n min-width: 200px;\n }\n `\n ]\n\n @state() private gristConfig: any\n @state() private kinds: string[] = []\n @state() private issuable: { kind: string; asOf: boolean; refId?: string | null }[] = []\n @state() private kind = ''\n @state() private selected: any = null\n @state() private reason = ''\n @state() private busy = false\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t(this.mine ? 'title.my-issued-documents' : 'title.issued-document-list'),\n /* Issued in 내 증명서: a document about oneself (one's 재직증명서), and one about the company itself (a 주주명부). */\n actions: (this.mine ? this.issuable : []).map(one => ({\n title: i18next.t('button.issue-kind', { kind: kindWord(one.kind) }),\n icon: 'workspace_premium',\n action: async () => (await issueDocument({ kind: one.kind, refId: one.refId ?? undefined, withAsOf: one.asOf })) && this.grist.fetch()\n })),\n search: { handler: (search: string) => ((this.grist.searchText = search), this.grist.fetch()), value: this.grist?.searchText }\n }\n }\n\n render() {\n const row = this.selected\n return html`\n ${this.kinds.length > 1\n ? html`<div class=\"filters\">\n <label\n >${i18next.t('field.issued-document-kind')}\n <ox-select\n .value=${this.kind}\n @change=${(e: CustomEvent) => {\n const next = String(e.detail ?? '')\n if (next !== this.kind) (this.kind = next), this.grist.fetch()\n }}\n >\n <span slot=\"label\">${this.kind ? kindWord(this.kind) : i18next.t('text.all')}</span>\n <ox-popup-list align-left nowrap with-search>\n <div option value=\"\">${i18next.t('text.all')}</div>\n ${this.kinds.map(kind => html`<div option value=${kind}>${kindWord(kind)}</div>`)}\n </ox-popup-list>\n </ox-select>\n </label>\n </div>`\n : nothing}\n <ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} @select-record-change=${(e: any) => this.select(e.detail?.records)}></ox-grist>\n ${row && row.state === 'published'\n ? html`<div class=\"revoke\">\n ${i18next.t('text.issued-document-revoke', { number: row.number })}\n <input .value=${this.reason} placeholder=${i18next.t('field.issued-document-revoke-reason')} ?disabled=${this.busy} @input=${(e: any) => (this.reason = e.target.value)} />\n <button danger ?disabled=${this.busy || !this.reason.trim()} @click=${() => this.revoke()}>${i18next.t('button.issued-document-revoke')}</button>\n </div>`\n : nothing}\n `\n }\n\n async pageInitialized() {\n this.gristConfig = {\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: false },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'download',\n title: i18next.t('button.issued-document-open'),\n handlers: {\n click: (_c: any, _d: any, _col: any, record: any) =>\n record?.file?.fullpath && downloadIssuedFile(record.file).catch((error: any) => notify({ level: 'error', message: error?.message ?? String(error) }))\n }\n },\n { type: 'string', name: 'number', header: i18next.t('field.issued-document-number'), width: 140 },\n { type: 'string', name: 'kind', header: i18next.t('field.issued-document-kind'), record: { renderer: (value: string) => kindWord(value) }, width: 140 },\n { type: 'string', name: 'subjectName', header: i18next.t('field.issued-document-subject'), width: 160 },\n { type: 'string', name: 'purpose', header: i18next.t('field.issued-document-purpose'), width: 160 },\n { type: 'string', name: 'submittedTo', header: i18next.t('field.issued-document-submitted-to'), width: 160 },\n { type: 'datetime', name: 'createdAt', header: i18next.t('field.issued-document-issued-at'), width: 160 },\n { type: 'resource-object', name: 'creator', header: i18next.t('field.issued-document-issuer'), width: 110 },\n {\n type: 'string',\n name: 'state',\n header: i18next.t('field.state'),\n record: { renderer: (value: string, _c: any, record: any) => (value === 'revoked' ? `${i18next.t('text.issued-document-revoked')} · ${record.revokeReason ?? ''}` : i18next.t('text.issued-document-published')) },\n width: 200\n }\n ],\n rows: { appendable: false, selectable: { multiple: false } }\n }\n const response = await client.query({ query: gql`query { issuedDocumentKinds { kind asOf issuable refId } }`, fetchPolicy: 'no-cache' })\n const kinds = response.data?.issuedDocumentKinds ?? []\n this.kinds = kinds.map((one: any) => one.kind)\n this.issuable = kinds.filter((one: any) => one.issuable)\n this.updateContext()\n }\n\n async pageUpdated(changes: any) {\n if ((this as any).active && changes.active && this.grist) this.grist.fetch()\n }\n\n async fetchHandler({ page = 1, limit = 100 }: FetchOption) {\n const filters: any[] = []\n if (this.kind) filters.push({ name: 'kind', operator: 'eq', value: this.kind })\n if (this.grist?.searchText) filters.push({ name: 'q', operator: 'search', value: this.grist.searchText })\n const response = await client.query({\n query: gql(\n this.mine\n ? `query ($filters: [Filter!], $pagination: Pagination) { list: readableIssuedDocuments(filters: $filters, pagination: $pagination, mine: true) { items { ${FIELDS} } total } }`\n : `query ($filters: [Filter!], $pagination: Pagination) { list: issuedDocuments(filters: $filters, pagination: $pagination) { items { ${FIELDS} } total } }`\n ),\n variables: { filters, pagination: { page, limit } },\n fetchPolicy: 'no-cache'\n })\n this.select([])\n return { total: response.data?.list?.total ?? 0, records: response.data?.list?.items ?? [] }\n }\n\n private select(records: any[] | undefined) {\n const row = records?.[0] ?? null\n if (row?.id !== this.selected?.id) this.reason = ''\n this.selected = row\n }\n\n private async revoke() {\n this.busy = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $reason: String!) {\n revokeIssuedDocument(id: $id, reason: $reason) {\n id\n }\n }\n `,\n variables: { id: this.selected.id, reason: this.reason }\n })\n if (response.errors?.length) throw response.errors[0]\n notify({ message: i18next.t('text.issued-document-revoked-done', { number: this.selected.number }) })\n this.grist.fetch()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n } finally {\n this.busy = false\n }\n }\n}\n\n/** 내 정보 › 내 증명서 - the ledger's rows that are one's own, and the documents one issues for oneself. */\n@customElement('my-issued-document-list')\nexport class MyIssuedDocumentList extends IssuedDocumentList {\n protected mine = true\n}\n"]}
1
+ {"version":3,"file":"issued-document-list.js","sourceRoot":"","sources":["../../../client/pages/issued-document/issued-document-list.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,iCAAiC,CAAA;AACxC,OAAO,6BAA6B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kB,CAgN9B;;AAED,qGAAqG;AAE9F,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,kBAAkB;IAArD;;QACK,SAAI,GAAG,IAAI,CAAA;IACvB,CAAC;CAAA,CAAA;AAFY,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAEhC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist/ox-grist.js'\nimport '@operato/input/ox-select.js'\nimport '@operato/popup/ox-popup-list.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 { notify } from '@operato/layout'\nimport { PageView } from '@operato/shell'\nimport { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\n\nimport { downloadIssuedFile, issueDocument, issuedDocumentKindWord as kindWord, openPdfView } from '../../issue-document'\n\nconst FIELDS = 'id kind number subjectName purpose submittedTo state revokedAt revokeReason createdAt creator { id name } file { id fullpath name }'\n\n/**\n * 발급 대장 (ADR-0176 decision 2) - the documents issued, newest first: kind, number, whom or what each is about, what\n * for and to whom, who issued it and when, and whether it was revoked. Each person sees the kinds their own rules let\n * them read (the server asks each kind's module) - an employee their own certificates - and issues here what is about\n * the company or about themselves. A file is saved as it was issued; a mistaken one is revoked with a reason.\n */\n@customElement('issued-document-list')\nexport class IssuedDocumentList extends localize(i18next)(PageView) {\n /** 내 증명서: one's own - about oneself or issued by oneself - and the documents one issues here. Else the whole ledger. */\n protected mine = false\n\n static styles = [\n WorkSurfacePageStyles,\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n }\n ox-grist {\n flex: 1;\n }\n .filters {\n display: flex;\n gap: var(--spacing-medium, 8px);\n align-items: center;\n padding: var(--spacing-medium, 8px) var(--spacing-large, 12px);\n }\n .revoke {\n display: flex;\n flex-wrap: wrap;\n gap: var(--spacing-medium, 8px);\n align-items: center;\n padding: var(--spacing-medium, 8px) var(--spacing-large, 12px);\n border-top: var(--border-dim-color);\n font: var(--label-font);\n }\n .revoke input {\n flex: 1;\n min-width: 200px;\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n border: var(--border-dim-color);\n border-radius: var(--border-radius);\n padding: var(--input-padding);\n font: var(--input-font);\n }\n .filters label {\n display: flex;\n align-items: center;\n gap: var(--spacing-medium, 8px);\n font: var(--label-font);\n }\n ox-select {\n min-width: 200px;\n }\n `\n ]\n\n @state() private gristConfig: any\n @state() private kinds: string[] = []\n @state() private issuable: { kind: string; asOf: boolean; refId?: string | null }[] = []\n @state() private kind = ''\n @state() private selected: any = null\n @state() private reason = ''\n @state() private busy = false\n\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t(this.mine ? 'title.my-issued-documents' : 'title.issued-document-list'),\n /* Issued in 내 증명서: a document about oneself (one's 재직증명서), and one about the company itself (a 주주명부). */\n actions: (this.mine ? this.issuable : []).map(one => ({\n title: i18next.t('button.issue-kind', { kind: kindWord(one.kind) }),\n icon: 'workspace_premium',\n action: async () => (await issueDocument({ kind: one.kind, refId: one.refId ?? undefined, withAsOf: one.asOf })) && this.grist.fetch()\n })),\n search: { handler: (search: string) => ((this.grist.searchText = search), this.grist.fetch()), value: this.grist?.searchText }\n }\n }\n\n render() {\n const row = this.selected\n return html`\n ${this.kinds.length > 1\n ? html`<div class=\"filters\">\n <label\n >${i18next.t('field.issued-document-kind')}\n <ox-select\n .value=${this.kind}\n @change=${(e: CustomEvent) => {\n const next = String(e.detail ?? '')\n if (next !== this.kind) (this.kind = next), this.grist.fetch()\n }}\n >\n <span slot=\"label\">${this.kind ? kindWord(this.kind) : i18next.t('text.all')}</span>\n <ox-popup-list align-left nowrap with-search>\n <div option value=\"\">${i18next.t('text.all')}</div>\n ${this.kinds.map(kind => html`<div option value=${kind}>${kindWord(kind)}</div>`)}\n </ox-popup-list>\n </ox-select>\n </label>\n </div>`\n : nothing}\n <ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)} @select-record-change=${(e: any) => this.select(e.detail?.records)}></ox-grist>\n ${row && row.state === 'published'\n ? html`<div class=\"revoke\">\n ${i18next.t('text.issued-document-revoke', { number: row.number })}\n <input .value=${this.reason} placeholder=${i18next.t('field.issued-document-revoke-reason')} ?disabled=${this.busy} @input=${(e: any) => (this.reason = e.target.value)} />\n <button danger ?disabled=${this.busy || !this.reason.trim()} @click=${() => this.revoke()}>${i18next.t('button.issued-document-revoke')}</button>\n </div>`\n : nothing}\n `\n }\n\n async pageInitialized() {\n this.gristConfig = {\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n { type: 'gutter', gutterName: 'row-selector', multiple: false },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'download',\n title: i18next.t('button.issued-document-open'),\n handlers: {\n click: (_c: any, _d: any, _col: any, record: any) =>\n record?.file?.fullpath && downloadIssuedFile(record.file).catch((error: any) => notify({ level: 'error', message: error?.message ?? String(error) }))\n }\n },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'visibility',\n title: i18next.t('button.pdf-preview'),\n handlers: {\n /* The issued file itself, as it went out - its number and seal - opened in place under its own name. */\n click: (_c: any, _d: any, _col: any, record: any) => record?.file?.fullpath && openPdfView(record.file.fullpath, `${kindWord(record.kind)} · ${record.number}`)\n }\n },\n { type: 'string', name: 'number', header: i18next.t('field.issued-document-number'), width: 140 },\n { type: 'string', name: 'kind', header: i18next.t('field.issued-document-kind'), record: { renderer: (value: string) => kindWord(value) }, width: 140 },\n { type: 'string', name: 'subjectName', header: i18next.t('field.issued-document-subject'), width: 160 },\n { type: 'string', name: 'purpose', header: i18next.t('field.issued-document-purpose'), width: 160 },\n { type: 'string', name: 'submittedTo', header: i18next.t('field.issued-document-submitted-to'), width: 160 },\n { type: 'datetime', name: 'createdAt', header: i18next.t('field.issued-document-issued-at'), width: 160 },\n { type: 'resource-object', name: 'creator', header: i18next.t('field.issued-document-issuer'), width: 110 },\n {\n type: 'string',\n name: 'state',\n header: i18next.t('field.state'),\n record: { renderer: (value: string, _c: any, record: any) => (value === 'revoked' ? `${i18next.t('text.issued-document-revoked')} · ${record.revokeReason ?? ''}` : i18next.t('text.issued-document-published')) },\n width: 200\n }\n ],\n rows: { appendable: false, selectable: { multiple: false } }\n }\n const response = await client.query({ query: gql`query { issuedDocumentKinds { kind asOf issuable refId } }`, fetchPolicy: 'no-cache' })\n const kinds = response.data?.issuedDocumentKinds ?? []\n this.kinds = kinds.map((one: any) => one.kind)\n this.issuable = kinds.filter((one: any) => one.issuable)\n this.updateContext()\n }\n\n async pageUpdated(changes: any) {\n if ((this as any).active && changes.active && this.grist) this.grist.fetch()\n }\n\n async fetchHandler({ page = 1, limit = 100 }: FetchOption) {\n const filters: any[] = []\n if (this.kind) filters.push({ name: 'kind', operator: 'eq', value: this.kind })\n if (this.grist?.searchText) filters.push({ name: 'q', operator: 'search', value: this.grist.searchText })\n const response = await client.query({\n query: gql(\n this.mine\n ? `query ($filters: [Filter!], $pagination: Pagination) { list: readableIssuedDocuments(filters: $filters, pagination: $pagination, mine: true) { items { ${FIELDS} } total } }`\n : `query ($filters: [Filter!], $pagination: Pagination) { list: issuedDocuments(filters: $filters, pagination: $pagination) { items { ${FIELDS} } total } }`\n ),\n variables: { filters, pagination: { page, limit } },\n fetchPolicy: 'no-cache'\n })\n this.select([])\n return { total: response.data?.list?.total ?? 0, records: response.data?.list?.items ?? [] }\n }\n\n private select(records: any[] | undefined) {\n const row = records?.[0] ?? null\n if (row?.id !== this.selected?.id) this.reason = ''\n this.selected = row\n }\n\n private async revoke() {\n this.busy = true\n try {\n const response = await client.mutate({\n mutation: gql`\n mutation ($id: String!, $reason: String!) {\n revokeIssuedDocument(id: $id, reason: $reason) {\n id\n }\n }\n `,\n variables: { id: this.selected.id, reason: this.reason }\n })\n if (response.errors?.length) throw response.errors[0]\n notify({ message: i18next.t('text.issued-document-revoked-done', { number: this.selected.number }) })\n this.grist.fetch()\n } catch (error: any) {\n notify({ level: 'error', message: error?.message ?? String(error) })\n } finally {\n this.busy = false\n }\n }\n}\n\n/** 내 정보 › 내 증명서 - the ledger's rows that are one's own, and the documents one issues for oneself. */\n@customElement('my-issued-document-list')\nexport class MyIssuedDocumentList extends IssuedDocumentList {\n protected mine = true\n}\n"]}