@design.estate/dees-document 1.0.103 → 1.3.0
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_bundle/bundle.js +213 -198
- package/dist_bundle/bundle.js.map +4 -4
- package/dist_ts/00_commitinfo_data.js +3 -3
- package/dist_ts/classes.pdfservice.d.ts +5 -1
- package/dist_ts/classes.pdfservice.js +4 -3
- package/dist_ts/interfaces/document.d.ts +7 -0
- package/dist_ts/interfaces/document.js +2 -0
- package/dist_ts/interfaces/index.d.ts +2 -0
- package/dist_ts/interfaces/index.js +3 -0
- package/dist_ts/interfaces/translation.d.ts +19 -0
- package/dist_ts/interfaces/translation.js +2 -0
- package/dist_ts/shared/demoletter.d.ts +4 -0
- package/dist_ts/shared/demoletter.js +214 -0
- package/dist_ts/shared/index.d.ts +7 -0
- package/dist_ts/shared/index.js +8 -0
- package/dist_ts/shared/translation.d.ts +15 -0
- package/dist_ts/shared/translation.js +73 -0
- package/dist_watch/bundle.js +200 -55
- package/dist_watch/bundle.js.map +4 -4
- package/npmextra.json +10 -12
- package/package.json +13 -14
- package/readme.md +131 -87
- package/ts/00_commitinfo_data.ts +2 -2
- package/ts/classes.pdfservice.ts +6 -2
- package/ts/interfaces/document.ts +8 -0
- package/ts/interfaces/index.ts +2 -0
- package/ts/interfaces/translation.ts +19 -0
- package/{ts_web/elements → ts}/shared/demoletter.ts +10 -1
- package/{ts_web/elements → ts}/shared/index.ts +4 -1
- package/ts/shared/translation.ts +82 -0
- package/ts_web/00_commitinfo_data.ts +2 -2
- package/ts_web/elements/contentinvoice.ts +16 -11
- package/ts_web/elements/document.demo.ts +1 -1
- package/ts_web/elements/document.ts +20 -8
- package/ts_web/elements/index.ts +1 -1
- package/ts_web/elements/letterheader.ts +1 -1
- package/ts_web/elements/page.ts +51 -22
- package/ts_web/elements/pagecontainer.ts +1 -1
- package/ts_web/elements/pagecontent.ts +1 -1
- package/ts_web/elements/pagefooter.ts +14 -6
- package/ts_web/elements/pageheader.ts +19 -5
- package/ts_web/elements/viewer.demo.ts +2 -2
- package/ts_web/elements/viewer.ts +4 -1
- package/ts_web/pages/page1.ts +1 -1
|
@@ -11,13 +11,20 @@ import {
|
|
|
11
11
|
domtools,
|
|
12
12
|
} from '@design.estate/dees-element';
|
|
13
13
|
|
|
14
|
+
import * as interfaces from '../../ts/interfaces/index.js';
|
|
14
15
|
import * as plugins from '../plugins.js';
|
|
15
16
|
|
|
17
|
+
export const defaultDocumentSettings: interfaces.IDocumentSettings = {
|
|
18
|
+
enableTopDraftText: true,
|
|
19
|
+
enableDefaultHeader: true,
|
|
20
|
+
enableDefaultFooter: true,
|
|
21
|
+
};
|
|
22
|
+
|
|
16
23
|
|
|
17
24
|
import { DePage } from './page.js';
|
|
18
25
|
import { DeContentInvoice } from './contentinvoice.js';
|
|
19
26
|
|
|
20
|
-
import * as shared from '
|
|
27
|
+
import * as shared from '../../ts/shared/index.js';
|
|
21
28
|
import { demoFunc } from './document.demo.js';
|
|
22
29
|
|
|
23
30
|
declare global {
|
|
@@ -68,9 +75,17 @@ export class DeDocument extends DeesElement {
|
|
|
68
75
|
public letterData: plugins.tsclass.business.ILetter;
|
|
69
76
|
|
|
70
77
|
@property({
|
|
71
|
-
type:
|
|
78
|
+
type: Object,
|
|
79
|
+
reflect: true,
|
|
80
|
+
converter: (valueArg) => {
|
|
81
|
+
if (typeof valueArg === 'string') {
|
|
82
|
+
return plugins.smartjson.parseBase64(valueArg)
|
|
83
|
+
} else {
|
|
84
|
+
return valueArg;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
72
87
|
})
|
|
73
|
-
public
|
|
88
|
+
public documentSettings: interfaces.IDocumentSettings = defaultDocumentSettings;
|
|
74
89
|
|
|
75
90
|
constructor() {
|
|
76
91
|
super();
|
|
@@ -112,11 +127,6 @@ export class DeDocument extends DeesElement {
|
|
|
112
127
|
this.registerGarbageFunction(() => {
|
|
113
128
|
resizeObserver.disconnect();
|
|
114
129
|
})
|
|
115
|
-
|
|
116
|
-
if (this.letterDataUrl) {
|
|
117
|
-
const response = await fetch(this.letterDataUrl);
|
|
118
|
-
this.letterData = await response.json();
|
|
119
|
-
}
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
public latestRenderedLetterData: plugins.tsclass.business.ILetter = null;
|
|
@@ -136,6 +146,7 @@ export class DeDocument extends DeesElement {
|
|
|
136
146
|
// lets append the content
|
|
137
147
|
const content: DeContentInvoice = new DeContentInvoice();
|
|
138
148
|
content.letterData = this.letterData;
|
|
149
|
+
content.documentSettings = this.documentSettings;
|
|
139
150
|
document.body.appendChild(content);
|
|
140
151
|
|
|
141
152
|
await domtools.convenience.smartdelay.delayFor(0);
|
|
@@ -148,6 +159,7 @@ export class DeDocument extends DeesElement {
|
|
|
148
159
|
const newPage = new DePage();
|
|
149
160
|
newPage.printMode = this.printMode;
|
|
150
161
|
newPage.letterData = this.letterData;
|
|
162
|
+
newPage.documentSettings = this.documentSettings;
|
|
151
163
|
pages.push(newPage);
|
|
152
164
|
newPage.pageNumber = pageCounter;
|
|
153
165
|
newPage.append(currentContent);
|
package/ts_web/elements/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@design.estate/dees-element';
|
|
11
11
|
import * as domtools from '@design.estate/dees-domtools';
|
|
12
12
|
|
|
13
|
-
import * as shared from '
|
|
13
|
+
import * as shared from '../../ts/shared/index.js';
|
|
14
14
|
import * as tsclass from '@tsclass/tsclass';
|
|
15
15
|
|
|
16
16
|
declare global {
|
package/ts_web/elements/page.ts
CHANGED
|
@@ -8,10 +8,14 @@ import {
|
|
|
8
8
|
css,
|
|
9
9
|
cssManager,
|
|
10
10
|
unsafeCSS,
|
|
11
|
+
domtools,
|
|
11
12
|
} from '@design.estate/dees-element';
|
|
12
|
-
import * as domtools from '@design.estate/dees-domtools';
|
|
13
13
|
|
|
14
|
-
import * as
|
|
14
|
+
import * as interfaces from '../../ts/interfaces/index.js';
|
|
15
|
+
|
|
16
|
+
import { defaultDocumentSettings } from './document.js';
|
|
17
|
+
|
|
18
|
+
import * as shared from '../../ts/shared/index.js';
|
|
15
19
|
|
|
16
20
|
declare global {
|
|
17
21
|
interface HTMLElementTagNameMap {
|
|
@@ -23,10 +27,14 @@ declare global {
|
|
|
23
27
|
export class DePage extends DeesElement {
|
|
24
28
|
public static demo = () => html` <dedocument-page .format="${'a4'}"></dedocument-page> `;
|
|
25
29
|
|
|
26
|
-
@property(
|
|
30
|
+
@property({
|
|
31
|
+
type: Number,
|
|
32
|
+
})
|
|
27
33
|
viewWidth: number = null;
|
|
28
34
|
|
|
29
|
-
@property(
|
|
35
|
+
@property({
|
|
36
|
+
type: Number,
|
|
37
|
+
})
|
|
30
38
|
viewHeight: number = null;
|
|
31
39
|
|
|
32
40
|
@property({
|
|
@@ -55,6 +63,12 @@ export class DePage extends DeesElement {
|
|
|
55
63
|
})
|
|
56
64
|
printMode = false;
|
|
57
65
|
|
|
66
|
+
@property({
|
|
67
|
+
type: Object,
|
|
68
|
+
reflect: true,
|
|
69
|
+
})
|
|
70
|
+
public documentSettings: interfaces.IDocumentSettings = defaultDocumentSettings;
|
|
71
|
+
|
|
58
72
|
constructor() {
|
|
59
73
|
super();
|
|
60
74
|
domtools.DomTools.setupDomTools();
|
|
@@ -109,46 +123,61 @@ export class DePage extends DeesElement {
|
|
|
109
123
|
<dedocument-pagecontainer .printMode=${this.printMode}>
|
|
110
124
|
${this.letterData
|
|
111
125
|
? html`
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
126
|
+
${this.documentSettings.enableDefaultHeader
|
|
127
|
+
? html`
|
|
128
|
+
<dedocument-pageheader
|
|
129
|
+
.letterData=${this.letterData}
|
|
130
|
+
.documentSettings=${this.documentSettings}
|
|
131
|
+
.pageNumber="${this.pageNumber}"
|
|
132
|
+
.pageTotalNumber="${this.pageTotalNumber}"
|
|
133
|
+
></dedocument-pageheader>
|
|
134
|
+
`
|
|
135
|
+
: ``}
|
|
117
136
|
${this.pageNumber === 1
|
|
118
137
|
? html`
|
|
119
138
|
<dedocument-letterheader
|
|
120
139
|
.pageNumber="${this.pageNumber}"
|
|
121
140
|
.letterData=${this.letterData}
|
|
141
|
+
.documentSettings=${this.documentSettings}
|
|
122
142
|
.pageTotalNumber="${this.pageTotalNumber}"
|
|
123
143
|
></dedocument-letterheader>
|
|
124
144
|
`
|
|
125
145
|
: html``}
|
|
126
146
|
<dedocument-pagecontent
|
|
147
|
+
.letterData=${this.letterData}
|
|
148
|
+
.documentSettings=${this.documentSettings}
|
|
127
149
|
.pageNumber="${this.pageNumber}"
|
|
128
150
|
.pageTotalNumber="${this.pageTotalNumber}"
|
|
129
|
-
.letterData=${this.letterData}
|
|
130
151
|
><slot></slot
|
|
131
152
|
></dedocument-pagecontent>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
153
|
+
${this.documentSettings.enableDefaultFooter
|
|
154
|
+
? html`
|
|
155
|
+
<dedocument-pagefooter
|
|
156
|
+
.letterData=${this.letterData}
|
|
157
|
+
.documentSettings=${this.documentSettings}
|
|
158
|
+
.pageNumber="${this.pageNumber}"
|
|
159
|
+
.pageTotalNumber="${this.pageTotalNumber}"
|
|
160
|
+
></dedocument-pagefooter>
|
|
161
|
+
`
|
|
162
|
+
: ``}
|
|
137
163
|
<div class="versionOverlay">
|
|
138
164
|
${this.letterData.versionInfo.type === 'draft'
|
|
139
165
|
? html`
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
166
|
+
${this.documentSettings.enableTopDraftText
|
|
167
|
+
? html`
|
|
168
|
+
<div class="topInfo">
|
|
169
|
+
Please note: THIS IS A DRAFT ONLY. NO RIGHTS CAN BE DERIVED FROM
|
|
170
|
+
THIS.<br />
|
|
171
|
+
-> Revision/Document version: ${this.letterData.versionInfo.version}
|
|
172
|
+
</div>
|
|
173
|
+
`
|
|
174
|
+
: ``}
|
|
144
175
|
<div class="bigDraftText">DRAFT</div>
|
|
145
176
|
`
|
|
146
177
|
: html``}
|
|
147
178
|
</div>
|
|
148
179
|
`
|
|
149
|
-
: html`
|
|
150
|
-
<slot></slot>
|
|
151
|
-
`}
|
|
180
|
+
: html` <slot></slot> `}
|
|
152
181
|
</dedocument-pagecontainer>
|
|
153
182
|
</div>
|
|
154
183
|
`;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@design.estate/dees-element';
|
|
11
11
|
import * as domtools from '@design.estate/dees-domtools';
|
|
12
12
|
|
|
13
|
-
import * as shared from '
|
|
13
|
+
import * as shared from '../../ts/shared/index.js';
|
|
14
14
|
|
|
15
15
|
declare global {
|
|
16
16
|
interface HTMLElementTagNameMap {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '@design.estate/dees-element';
|
|
11
11
|
import * as domtools from '@design.estate/dees-domtools';
|
|
12
12
|
|
|
13
|
-
import * as shared from '
|
|
13
|
+
import * as shared from '../../ts/shared/index.js';
|
|
14
14
|
import * as tsclass from '@tsclass/tsclass';
|
|
15
15
|
|
|
16
16
|
declare global {
|
|
@@ -7,10 +7,12 @@ import {
|
|
|
7
7
|
css,
|
|
8
8
|
cssManager,
|
|
9
9
|
unsafeCSS,
|
|
10
|
+
domtools,
|
|
10
11
|
} from '@design.estate/dees-element';
|
|
11
|
-
import * as domtools from '@design.estate/dees-domtools';
|
|
12
12
|
|
|
13
|
-
import * as
|
|
13
|
+
import * as interfaces from '../../ts/interfaces/index.js';
|
|
14
|
+
|
|
15
|
+
import * as shared from '../../ts/shared/index.js';
|
|
14
16
|
import * as tsclass from '@tsclass/tsclass';
|
|
15
17
|
|
|
16
18
|
declare global {
|
|
@@ -30,6 +32,12 @@ export class DePageFooter extends DeesElement {
|
|
|
30
32
|
})
|
|
31
33
|
letterData: tsclass.business.ILetter;
|
|
32
34
|
|
|
35
|
+
@property({
|
|
36
|
+
type: Object,
|
|
37
|
+
reflect: true,
|
|
38
|
+
})
|
|
39
|
+
documentSettings: interfaces.IDocumentSettings;
|
|
40
|
+
|
|
33
41
|
@property({
|
|
34
42
|
type: Number
|
|
35
43
|
})
|
|
@@ -96,26 +104,26 @@ export class DePageFooter extends DeesElement {
|
|
|
96
104
|
return html`
|
|
97
105
|
<div class="bottomstripe">
|
|
98
106
|
<div>
|
|
99
|
-
<strong
|
|
107
|
+
<strong>${shared.translation.translate(this.documentSettings.languageCode, 'address', 'Address')}:</strong><br />
|
|
100
108
|
${this.letterData.from.name}<br />
|
|
101
109
|
${this.letterData.from.address.streetName} ${this.letterData.from.address.houseNumber}<br />
|
|
102
110
|
${this.letterData.from.address.postalCode} ${this.letterData.from.address.city}<br />
|
|
103
111
|
${this.letterData.from.address.country}
|
|
104
112
|
</div>
|
|
105
113
|
<div>
|
|
106
|
-
<strong
|
|
114
|
+
<strong>${shared.translation.translate(this.documentSettings.languageCode, 'registrationInfo', 'Registration Info')}:</strong><br />
|
|
107
115
|
Amtsgericht Bremen<br />
|
|
108
116
|
<i>reg-#:</i> HRB 35230 HB<br />
|
|
109
117
|
<i>vat-id:</i> ${this.letterData.from.vatId}
|
|
110
118
|
</div>
|
|
111
119
|
<div>
|
|
112
|
-
<strong
|
|
120
|
+
<strong>${shared.translation.translate(this.documentSettings.languageCode, 'contactInfo', 'Contact Info')}:</strong><br />
|
|
113
121
|
<i>email:</i> ${this.letterData.from.email}<br />
|
|
114
122
|
<i>phone:</i> ${this.letterData.from.phone}<br />
|
|
115
123
|
<i>fax:</i> ${this.letterData.from.fax}
|
|
116
124
|
</div>
|
|
117
125
|
<div>
|
|
118
|
-
<strong
|
|
126
|
+
<strong>${shared.translation.translate(this.documentSettings.languageCode, 'bankConnection', 'Bank Connection')}:</strong><br />
|
|
119
127
|
<i>beneficiary:</i> ${this.letterData?.from?.name}<br />
|
|
120
128
|
<i>institution:</i> ${this.letterData?.from?.sepaConnection?.institution}<br />
|
|
121
129
|
<i>iban:</i> ${this.letterData?.from?.sepaConnection?.iban}<br />
|
|
@@ -7,10 +7,12 @@ import {
|
|
|
7
7
|
css,
|
|
8
8
|
cssManager,
|
|
9
9
|
unsafeCSS,
|
|
10
|
+
domtools
|
|
10
11
|
} from '@design.estate/dees-element';
|
|
11
|
-
import * as domtools from '@design.estate/dees-domtools';
|
|
12
12
|
|
|
13
|
-
import * as
|
|
13
|
+
import * as interfaces from '../../ts/interfaces/index.js';
|
|
14
|
+
|
|
15
|
+
import * as shared from '../../ts/shared/index.js';
|
|
14
16
|
import * as tsclass from '@tsclass/tsclass';
|
|
15
17
|
|
|
16
18
|
declare global {
|
|
@@ -30,6 +32,12 @@ export class DePageHeader extends DeesElement {
|
|
|
30
32
|
})
|
|
31
33
|
public letterData: tsclass.business.ILetter = null;
|
|
32
34
|
|
|
35
|
+
@property({
|
|
36
|
+
type: Object,
|
|
37
|
+
reflect: true,
|
|
38
|
+
})
|
|
39
|
+
documentSettings: interfaces.IDocumentSettings;
|
|
40
|
+
|
|
33
41
|
@property({
|
|
34
42
|
type: Number,
|
|
35
43
|
})
|
|
@@ -74,13 +82,17 @@ export class DePageHeader extends DeesElement {
|
|
|
74
82
|
color: #333;
|
|
75
83
|
font-size: 10px;
|
|
76
84
|
}
|
|
77
|
-
.topstripe
|
|
78
|
-
filter: invert(1);
|
|
85
|
+
.topstripe .logo {
|
|
79
86
|
position: absolute;
|
|
80
87
|
bottom: 10px;
|
|
81
88
|
height: 25px;
|
|
82
89
|
left: auto;
|
|
83
90
|
right: ${unsafeCSS(shared.rightMargin + 'px')};
|
|
91
|
+
font-family: 'Courier New', Courier, monospace;
|
|
92
|
+
}
|
|
93
|
+
.topstripe .logo img {
|
|
94
|
+
position: relative;
|
|
95
|
+
height: 25px;
|
|
84
96
|
}
|
|
85
97
|
`,
|
|
86
98
|
];
|
|
@@ -88,7 +100,9 @@ export class DePageHeader extends DeesElement {
|
|
|
88
100
|
public render(): TemplateResult {
|
|
89
101
|
return html`
|
|
90
102
|
<div class="topstripe">
|
|
91
|
-
<
|
|
103
|
+
<div class="logo">
|
|
104
|
+
No logo set!
|
|
105
|
+
</div>
|
|
92
106
|
</div>
|
|
93
107
|
<div class="topstripe2">${this.letterData?.from?.description || '[no letterData.from.description set]'}</div>
|
|
94
108
|
`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { html } from '@design.estate/dees-element';
|
|
2
|
-
import * as shared from '
|
|
2
|
+
import * as shared from '../../ts/shared/index.js';
|
|
3
3
|
|
|
4
4
|
export const demoFunc = () => html`
|
|
5
|
-
<dedocument-viewer .letterData=${shared.demoLetter}></dedocument-viewer>
|
|
5
|
+
<dedocument-viewer .letterData=${shared.demoLetter} .documentSettings=${shared.demoDocumentSettings}></dedocument-viewer>
|
|
6
6
|
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as plugins from '../plugins.js';
|
|
2
|
+
import * as interfaces from '../../ts/interfaces/index.js';
|
|
2
3
|
|
|
3
4
|
import { DeesElement, css, cssManager, customElement, html } from '@design.estate/dees-element';
|
|
4
5
|
import { demoFunc } from './viewer.demo.js';
|
|
@@ -17,6 +18,8 @@ export class DeDocumentViewer extends DeesElement {
|
|
|
17
18
|
// INSTANCE
|
|
18
19
|
public letterData: plugins.tsclass.business.ILetter = null;
|
|
19
20
|
|
|
21
|
+
public documentSettings: interfaces.IDocumentSettings;
|
|
22
|
+
|
|
20
23
|
public static styles = [
|
|
21
24
|
cssManager.defaultStyles,
|
|
22
25
|
css`
|
|
@@ -67,7 +70,7 @@ export class DeDocumentViewer extends DeesElement {
|
|
|
67
70
|
<div class="maincontainer">
|
|
68
71
|
<div class="viewport">
|
|
69
72
|
${this.letterData
|
|
70
|
-
? html` <dedocument-dedocument .letterData=${this.letterData}></dedocument-dedocument> `
|
|
73
|
+
? html` <dedocument-dedocument .letterData=${this.letterData} .documentSettings=${this.documentSettings}></dedocument-dedocument> `
|
|
71
74
|
: html``}
|
|
72
75
|
</div>
|
|
73
76
|
<div class="controls"></div>
|
package/ts_web/pages/page1.ts
CHANGED