@things-factory/invoice 0.0.0-stage → 10.1.130
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/README.md +21 -2
- package/dist-client/bootstrap.d.ts +1 -0
- package/dist-client/bootstrap.js +5 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/document/document-amount.d.ts +6 -0
- package/dist-client/document/document-amount.js +19 -0
- package/dist-client/document/document-amount.js.map +1 -0
- package/dist-client/document/document-form.d.ts +14 -0
- package/dist-client/document/document-form.js +145 -0
- package/dist-client/document/document-form.js.map +1 -0
- package/dist-client/document/document-lines.d.ts +104 -0
- package/dist-client/document/document-lines.js +61 -0
- package/dist-client/document/document-lines.js.map +1 -0
- package/dist-client/document/document-print.d.ts +15 -0
- package/dist-client/document/document-print.js +60 -0
- package/dist-client/document/document-print.js.map +1 -0
- package/dist-client/entity360/invoice-360.d.ts +19 -0
- package/dist-client/entity360/invoice-360.js +116 -0
- package/dist-client/entity360/invoice-360.js.map +1 -0
- package/dist-client/index.d.ts +6 -0
- package/dist-client/index.js +7 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/invoice-attach.d.ts +19 -0
- package/dist-client/invoice-attach.js +19 -0
- package/dist-client/invoice-attach.js.map +1 -0
- package/dist-client/pages/invoice-editor.d.ts +48 -0
- package/dist-client/pages/invoice-editor.js +341 -0
- package/dist-client/pages/invoice-editor.js.map +1 -0
- package/dist-client/pages/invoice-list.d.ts +39 -0
- package/dist-client/pages/invoice-list.js +125 -0
- package/dist-client/pages/invoice-list.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +11 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +6 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/routes.js +3 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/index.d.ts +12 -0
- package/dist-server/service/index.js +19 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/invoice/commercial-document.d.ts +44 -0
- package/dist-server/service/invoice/commercial-document.js +200 -0
- package/dist-server/service/invoice/commercial-document.js.map +1 -0
- package/dist-server/service/invoice/index.d.ts +6 -0
- package/dist-server/service/invoice/index.js +10 -0
- package/dist-server/service/invoice/index.js.map +1 -0
- package/dist-server/service/invoice/invoice-mutation.d.ts +8 -0
- package/dist-server/service/invoice/invoice-mutation.js +75 -0
- package/dist-server/service/invoice/invoice-mutation.js.map +1 -0
- package/dist-server/service/invoice/invoice-query.d.ts +16 -0
- package/dist-server/service/invoice/invoice-query.js +117 -0
- package/dist-server/service/invoice/invoice-query.js.map +1 -0
- package/dist-server/service/invoice/invoice-rules.d.ts +83 -0
- package/dist-server/service/invoice/invoice-rules.js +202 -0
- package/dist-server/service/invoice/invoice-rules.js.map +1 -0
- package/dist-server/service/invoice/invoice-service.d.ts +26 -0
- package/dist-server/service/invoice/invoice-service.js +133 -0
- package/dist-server/service/invoice/invoice-service.js.map +1 -0
- package/dist-server/service/invoice/invoice-type.d.ts +40 -0
- package/dist-server/service/invoice/invoice-type.js +146 -0
- package/dist-server/service/invoice/invoice-type.js.map +1 -0
- package/dist-server/service/invoice/invoice.d.ts +30 -0
- package/dist-server/service/invoice/invoice.js +108 -0
- package/dist-server/service/invoice/invoice.js.map +1 -0
- package/dist-server/service/invoice-event/index.d.ts +5 -0
- package/dist-server/service/invoice-event/index.js +9 -0
- package/dist-server/service/invoice-event/index.js.map +1 -0
- package/dist-server/service/invoice-event/invoice-event-query.d.ts +9 -0
- package/dist-server/service/invoice-event/invoice-event-query.js +57 -0
- package/dist-server/service/invoice-event/invoice-event-query.js.map +1 -0
- package/dist-server/service/invoice-event/invoice-event.d.ts +22 -0
- package/dist-server/service/invoice-event/invoice-event.js +98 -0
- package/dist-server/service/invoice-event/invoice-event.js.map +1 -0
- package/dist-server/service/invoice-item/index.d.ts +5 -0
- package/dist-server/service/invoice-item/index.js +9 -0
- package/dist-server/service/invoice-item/index.js.map +1 -0
- package/dist-server/service/invoice-item/invoice-item-query.d.ts +8 -0
- package/dist-server/service/invoice-item/invoice-item-query.js +47 -0
- package/dist-server/service/invoice-item/invoice-item-query.js.map +1 -0
- package/dist-server/service/invoice-item/invoice-item.d.ts +19 -0
- package/dist-server/service/invoice-item/invoice-item.js +80 -0
- package/dist-server/service/invoice-item/invoice-item.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +44 -4
- package/things-factory.config.js +11 -0
- package/translations/en.json +81 -0
- package/translations/ko.json +81 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import '@operato/data-grist/ox-grist.js';
|
|
2
|
+
import { FetchOption } from '@operato/data-grist';
|
|
3
|
+
import { PageView } from '@operato/shell';
|
|
4
|
+
declare const InvoiceList_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
5
|
+
/**
|
|
6
|
+
* 청구서 — every invoice the domain sent or received. The other party's name opens the invoice's 360; the edit gutter
|
|
7
|
+
* opens the editor. Search is the server's: number, parties, purchase order and notes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class InvoiceList extends InvoiceList_base {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
gristConfig: any;
|
|
12
|
+
private grist;
|
|
13
|
+
get context(): {
|
|
14
|
+
title: string;
|
|
15
|
+
search: {
|
|
16
|
+
handler: (search: string) => void;
|
|
17
|
+
value: string;
|
|
18
|
+
};
|
|
19
|
+
actions: {
|
|
20
|
+
title: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
emphasis: {
|
|
23
|
+
raised: boolean;
|
|
24
|
+
};
|
|
25
|
+
action: () => void;
|
|
26
|
+
}[];
|
|
27
|
+
exportable: {
|
|
28
|
+
name: string;
|
|
29
|
+
data: () => any[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
pageInitialized(): Promise<void>;
|
|
34
|
+
fetchHandler({ page, limit, sortings, filters, search }: FetchOption): Promise<{
|
|
35
|
+
total: any;
|
|
36
|
+
records: any;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@operato/data-grist/ox-grist.js';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
import { html } from 'lit';
|
|
5
|
+
import { customElement, query, state } from 'lit/decorators.js';
|
|
6
|
+
import { DataGrist } from '@operato/data-grist';
|
|
7
|
+
import { client } from '@operato/graphql';
|
|
8
|
+
import { i18next, localize } from '@operato/i18n';
|
|
9
|
+
import { entity360Name } from '@operato/layout';
|
|
10
|
+
import { navigate, PageView } from '@operato/shell';
|
|
11
|
+
import { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles';
|
|
12
|
+
import { isMobileDevice } from '@operato/utils';
|
|
13
|
+
import { documentAmount } from '../document/document-amount';
|
|
14
|
+
import { counterpartOf, invoiceStatusWord } from '../entity360/invoice-360';
|
|
15
|
+
/**
|
|
16
|
+
* 청구서 — every invoice the domain sent or received. The other party's name opens the invoice's 360; the edit gutter
|
|
17
|
+
* opens the editor. Search is the server's: number, parties, purchase order and notes.
|
|
18
|
+
*/
|
|
19
|
+
let InvoiceList = class InvoiceList extends localize(i18next)(PageView) {
|
|
20
|
+
static { this.styles = [WorkSurfacePageStyles, CommonGristStyles, ScrollbarStyles]; }
|
|
21
|
+
get context() {
|
|
22
|
+
return {
|
|
23
|
+
title: i18next.t('title.invoice-list'),
|
|
24
|
+
search: {
|
|
25
|
+
handler: (search) => {
|
|
26
|
+
this.grist.searchText = search;
|
|
27
|
+
},
|
|
28
|
+
value: this.grist?.searchText || ''
|
|
29
|
+
},
|
|
30
|
+
actions: [{ title: i18next.t('button.invoice-new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('invoice-editor') }],
|
|
31
|
+
exportable: { name: i18next.t('title.invoice-list'), data: () => this.grist.exportRecords() }
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return html `<ox-grist
|
|
36
|
+
class="page-fill"
|
|
37
|
+
search-mode="term"
|
|
38
|
+
.mode=${isMobileDevice() ? 'CARD' : 'GRID'}
|
|
39
|
+
.config=${this.gristConfig}
|
|
40
|
+
.fetchHandler=${this.fetchHandler.bind(this)}
|
|
41
|
+
></ox-grist>`;
|
|
42
|
+
}
|
|
43
|
+
async pageInitialized() {
|
|
44
|
+
const readonly = (type, name, header, width, extra = {}) => ({
|
|
45
|
+
type,
|
|
46
|
+
name,
|
|
47
|
+
header,
|
|
48
|
+
width,
|
|
49
|
+
sortable: true,
|
|
50
|
+
...extra,
|
|
51
|
+
record: { editable: false, ...extra.record }
|
|
52
|
+
});
|
|
53
|
+
this.gristConfig = {
|
|
54
|
+
rows: { appendable: false, selectable: false },
|
|
55
|
+
pagination: { limit: 50, pages: [50, 100, 500] },
|
|
56
|
+
emptyNote: { title: i18next.t('text.invoice-empty'), description: i18next.t('text.invoice-empty-description') },
|
|
57
|
+
list: { fields: ['counterpart', 'number'], details: ['status', 'dueDate', 'totalAmount'] },
|
|
58
|
+
columns: [
|
|
59
|
+
{ type: 'gutter', gutterName: 'sequence' },
|
|
60
|
+
{
|
|
61
|
+
type: 'gutter',
|
|
62
|
+
gutterName: 'button',
|
|
63
|
+
icon: 'edit_note',
|
|
64
|
+
handlers: { click: (_columns, _data, _column, record) => record?.id && navigate(`invoice-editor?id=${record.id}`) }
|
|
65
|
+
},
|
|
66
|
+
readonly('string', 'counterpart', i18next.t('field.invoice-counterpart'), 200, {
|
|
67
|
+
sortable: false,
|
|
68
|
+
record: { renderer: (_value, _column, record) => (record?.id ? entity360Name({ __typename: 'Invoice', ...record }, counterpartOf(record)) : '') }
|
|
69
|
+
}),
|
|
70
|
+
readonly('string', 'number', i18next.t('field.invoice-number'), 140),
|
|
71
|
+
readonly('string', 'status', i18next.t('field.invoice-status'), 80, { record: { renderer: (value) => invoiceStatusWord(value) } }),
|
|
72
|
+
readonly('string', 'direction', i18next.t('field.invoice-direction'), 80, {
|
|
73
|
+
record: { renderer: (value) => (value === 'PURCHASE' ? i18next.t('text.invoice-direction-purchase') : i18next.t('text.invoice-direction-sales')) }
|
|
74
|
+
}),
|
|
75
|
+
readonly('string', 'issueDate', i18next.t('field.invoice-issue-date'), 110),
|
|
76
|
+
readonly('string', 'dueDate', i18next.t('field.invoice-due-date'), 110),
|
|
77
|
+
readonly('float', 'totalAmount', i18next.t('field.invoice-total-amount'), 160, {
|
|
78
|
+
record: { align: 'right', renderer: (value, _column, record) => documentAmount(value, record?.currency || 'KRW') }
|
|
79
|
+
})
|
|
80
|
+
],
|
|
81
|
+
sorters: [{ name: 'issueDate', desc: true }]
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }) {
|
|
85
|
+
const response = await client.query({
|
|
86
|
+
query: gql `
|
|
87
|
+
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {
|
|
88
|
+
responses: invoices(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {
|
|
89
|
+
items {
|
|
90
|
+
id
|
|
91
|
+
number
|
|
92
|
+
status
|
|
93
|
+
direction
|
|
94
|
+
currency
|
|
95
|
+
supplierName
|
|
96
|
+
buyerName
|
|
97
|
+
issueDate
|
|
98
|
+
dueDate
|
|
99
|
+
totalAmount
|
|
100
|
+
}
|
|
101
|
+
total
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`,
|
|
105
|
+
variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },
|
|
106
|
+
fetchPolicy: 'network-only'
|
|
107
|
+
});
|
|
108
|
+
if (response.errors?.length)
|
|
109
|
+
throw response;
|
|
110
|
+
return { total: response.data.responses.total, records: response.data.responses.items };
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
__decorate([
|
|
114
|
+
state(),
|
|
115
|
+
__metadata("design:type", Object)
|
|
116
|
+
], InvoiceList.prototype, "gristConfig", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
query('ox-grist'),
|
|
119
|
+
__metadata("design:type", DataGrist)
|
|
120
|
+
], InvoiceList.prototype, "grist", void 0);
|
|
121
|
+
InvoiceList = __decorate([
|
|
122
|
+
customElement('invoice-list')
|
|
123
|
+
], InvoiceList);
|
|
124
|
+
export { InvoiceList };
|
|
125
|
+
//# sourceMappingURL=invoice-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-list.js","sourceRoot":"","sources":["../../client/pages/invoice-list.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,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,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE3E;;;GAGG;AAEI,IAA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,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,IAAI,KAAK,CAAC,EAAE;iBACrI,CAAC;aACH;YACD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;SAC7C,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,QAAQ,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,EAAE,MAAM,EAAe;QAC3F,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;YAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;OAkBT;YACD,SAAS,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,EAAE;YAClG,WAAW,EAAE,cAAc;SAC5B,CAAC,CAAA;QACF,IAAI,QAAQ,CAAC,MAAM,EAAE,MAAM;YAAE,MAAM,QAAQ,CAAA;QAC3C,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAA;IACzF,CAAC;;AA/FQ;IAAR,KAAK,EAAE;;gDAAiB;AACE;IAA1B,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;0CAAA;AAJjC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAmGvB","sourcesContent":["import '@operato/data-grist/ox-grist.js'\n\nimport gql from 'graphql-tag'\nimport { html } 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 { entity360Name } from '@operato/layout'\nimport { navigate, PageView } from '@operato/shell'\nimport { CommonGristStyles, ScrollbarStyles, WorkSurfacePageStyles } from '@operato/styles'\nimport { isMobileDevice } from '@operato/utils'\n\nimport { documentAmount } from '../document/document-amount'\nimport { counterpartOf, invoiceStatusWord } from '../entity360/invoice-360'\n\n/**\n * 청구서 — every invoice the domain sent or received. The other party's name opens the invoice's 360; the edit gutter\n * opens the editor. Search is the server's: number, parties, purchase order and notes.\n */\n@customElement('invoice-list')\nexport class InvoiceList extends localize(i18next)(PageView) {\n static styles = [WorkSurfacePageStyles, CommonGristStyles, ScrollbarStyles]\n\n @state() gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: i18next.t('title.invoice-list'),\n search: {\n handler: (search: string) => {\n this.grist.searchText = search\n },\n value: this.grist?.searchText || ''\n },\n actions: [{ title: i18next.t('button.invoice-new'), icon: 'add', emphasis: { raised: true }, action: () => navigate('invoice-editor') }],\n exportable: { name: i18next.t('title.invoice-list'), data: () => this.grist.exportRecords() }\n }\n }\n\n render() {\n return html`<ox-grist\n class=\"page-fill\"\n search-mode=\"term\"\n .mode=${isMobileDevice() ? 'CARD' : 'GRID'}\n .config=${this.gristConfig}\n .fetchHandler=${this.fetchHandler.bind(this)}\n ></ox-grist>`\n }\n\n async pageInitialized() {\n const readonly = (type: string, name: string, header: string, width: number, extra: any = {}) => ({\n type,\n name,\n header,\n width,\n sortable: true,\n ...extra,\n record: { editable: false, ...extra.record }\n })\n this.gristConfig = {\n rows: { appendable: false, selectable: false },\n pagination: { limit: 50, pages: [50, 100, 500] },\n emptyNote: { title: i18next.t('text.invoice-empty'), description: i18next.t('text.invoice-empty-description') },\n list: { fields: ['counterpart', 'number'], details: ['status', 'dueDate', 'totalAmount'] },\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'gutter',\n gutterName: 'button',\n icon: 'edit_note',\n handlers: { click: (_columns: any, _data: any, _column: any, record: any) => record?.id && navigate(`invoice-editor?id=${record.id}`) }\n },\n readonly('string', 'counterpart', i18next.t('field.invoice-counterpart'), 200, {\n sortable: false,\n record: { renderer: (_value: any, _column: any, record: any) => (record?.id ? entity360Name({ __typename: 'Invoice', ...record }, counterpartOf(record)) : '') }\n }),\n readonly('string', 'number', i18next.t('field.invoice-number'), 140),\n readonly('string', 'status', i18next.t('field.invoice-status'), 80, { record: { renderer: (value: string) => invoiceStatusWord(value) } }),\n readonly('string', 'direction', i18next.t('field.invoice-direction'), 80, {\n record: { renderer: (value: string) => (value === 'PURCHASE' ? i18next.t('text.invoice-direction-purchase') : i18next.t('text.invoice-direction-sales')) }\n }),\n readonly('string', 'issueDate', i18next.t('field.invoice-issue-date'), 110),\n readonly('string', 'dueDate', i18next.t('field.invoice-due-date'), 110),\n readonly('float', 'totalAmount', i18next.t('field.invoice-total-amount'), 160, {\n record: { align: 'right', renderer: (value: number, _column: any, record: any) => documentAmount(value, record?.currency || 'KRW') }\n })\n ],\n sorters: [{ name: 'issueDate', desc: true }]\n }\n }\n\n async fetchHandler({ page = 1, limit = 50, sortings = [], filters = [], search }: FetchOption) {\n const response = await client.query({\n query: gql`\n query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!], $search: String) {\n responses: invoices(filters: $filters, pagination: $pagination, sortings: $sortings, search: $search) {\n items {\n id\n number\n status\n direction\n currency\n supplierName\n buyerName\n issueDate\n dueDate\n totalAmount\n }\n total\n }\n }\n `,\n variables: { filters, pagination: { page, limit }, sortings, search: search?.trim() || undefined },\n fetchPolicy: 'network-only'\n })\n if (response.errors?.length) throw response\n return { total: response.data.responses.total, records: response.data.responses.items }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function route(page: string): "invoice-editor" | "invoice-list";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,cAAc;YACjB,MAAM,CAAC,sBAAsB,CAAC,CAAA;YAC9B,OAAO,IAAI,CAAA;QAEb,KAAK,gBAAgB;YACnB,MAAM,CAAC,wBAAwB,CAAC,CAAA;YAChC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case 'invoice-list':\n import('./pages/invoice-list')\n return page\n\n case 'invoice-editor':\n import('./pages/invoice-editor')\n return page\n }\n}\n"]}
|