fix(core): update

This commit is contained in:
Philipp Kunz 2023-10-26 17:39:02 +02:00
parent 5d655035d6
commit 855ce7c074
10 changed files with 603 additions and 456 deletions

View File

@ -18,17 +18,17 @@
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@design.estate/dees-domtools": "^2.0.34", "@design.estate/dees-domtools": "^2.0.55",
"@design.estate/dees-element": "^2.0.23", "@design.estate/dees-element": "^2.0.32",
"@design.estate/dees-wcctools": "^1.0.76", "@design.estate/dees-wcctools": "^1.0.76",
"@git.zone/tsrun": "^1.2.44", "@git.zone/tsrun": "^1.2.44",
"@push.rocks/smartfile": "^10.0.26", "@push.rocks/smartfile": "^10.0.26",
"@push.rocks/smartjson": "^5.0.10", "@push.rocks/smartjson": "^5.0.10",
"@push.rocks/smartpath": "^5.0.5", "@push.rocks/smartpath": "^5.0.5",
"@push.rocks/smartpdf": "^3.0.16", "@push.rocks/smartpdf": "^3.0.16",
"@push.rocks/smarttime": "^4.0.1", "@push.rocks/smarttime": "^4.0.6",
"@tsclass/tsclass": "^4.0.46", "@tsclass/tsclass": "^4.0.46",
"@types/qrcode": "^1.5.2", "@types/qrcode": "^1.5.4",
"qrcode": "^1.5.3" "qrcode": "^1.5.3"
}, },
"devDependencies": { "devDependencies": {

933
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@design.estate/dees-document', name: '@design.estate/dees-document',
version: '1.0.95', version: '1.0.96',
description: 'a catalog for creating documents like invoices' description: 'a catalog for creating documents like invoices'
} }

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@design.estate/dees-document', name: '@design.estate/dees-document',
version: '1.0.95', version: '1.0.96',
description: 'a catalog for creating documents like invoices' description: 'a catalog for creating documents like invoices'
} }

View File

@ -0,0 +1,6 @@
import * as shared from './shared/index.js';
import { html } from '@design.estate/dees-element';
export const demoFunc = () => html`
<dedocument-dedocument .format="${'a4'}" .letterData=${shared.demoLetter}></dedocument-dedocument>
`;

View File

@ -18,6 +18,7 @@ import { DePage } from './page.js';
import { DeContentInvoice } from './contentinvoice.js'; import { DeContentInvoice } from './contentinvoice.js';
import * as shared from './shared/index.js'; import * as shared from './shared/index.js';
import { demoFunc } from './document.demo.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@ -27,9 +28,7 @@ declare global {
@customElement('dedocument-dedocument') @customElement('dedocument-dedocument')
export class DeDocument extends DeesElement { export class DeDocument extends DeesElement {
public static demo = () => html` public static demo = demoFunc;
<dedocument-dedocument .format="${'a4'}" .letterData=${shared.demoLetter}></dedocument-dedocument>
`;
@property({ @property({
type: String, type: String,
@ -86,7 +85,7 @@ export class DeDocument extends DeesElement {
} }
.betweenPagesSpacer { .betweenPagesSpacer {
height: 20px; height: 16px;
} }
`, `,
]; ];
@ -107,6 +106,10 @@ export class DeDocument extends DeesElement {
} }
}); });
resizeObserver.observe(this); resizeObserver.observe(this);
this.registerGarbageFunction(() => {
resizeObserver.disconnect();
})
if (this.letterDataUrl) { if (this.letterDataUrl) {
const response = await fetch(this.letterDataUrl); const response = await fetch(this.letterDataUrl);
this.letterData = await response.json(); this.letterData = await response.json();

View File

@ -6,5 +6,6 @@ export * from './pagecontainer.js';
export * from './pagecontent.js'; export * from './pagecontent.js';
export * from './pagefooter.js'; export * from './pagefooter.js';
export * from './pageheader.js'; export * from './pageheader.js';
export * from './viewer.js';
export * from './shared/index.js'; export * from './shared/index.js';

View File

@ -64,6 +64,9 @@ export class DePage extends DeesElement {
domtools.elementBasic.staticStyles, domtools.elementBasic.staticStyles,
css` css`
:host { :host {
display: block;
max-height: ${shared.a4Height}px;
max-width: ${shared.a4Width}px;
} }
#scaleWrapper { #scaleWrapper {
@ -177,7 +180,7 @@ export class DePage extends DeesElement {
// Adjust the outer dimensions so they match the scaled content // Adjust the outer dimensions so they match the scaled content
scaleWrapper.style.width = `${shared.a4Width * scale}px`; // this.style.width = `${shared.a4Width * scale}px`;
scaleWrapper.style.height = `${shared.a4Height * scale}px`; this.style.height = `${shared.a4Height * scale}px`;
} }
} }

View File

@ -0,0 +1,6 @@
import { html } from '@design.estate/dees-element';
import * as shared from './shared/index.js';
export const demoFunc = () => html`
<dedocument-viewer .letterData=${shared.demoLetter}></dedocument-viewer>
`;

83
ts_web/elements/viewer.ts Normal file
View File

@ -0,0 +1,83 @@
import * as plugins from '../plugins.js';
import { DeesElement, css, cssManager, customElement, html } from '@design.estate/dees-element';
import { demoFunc } from './viewer.demo.js';
declare global {
interface HTMLElementTagNameMap {
'dedocument-viewer': DeDocumentViewer;
}
}
@customElement('dedocument-viewer')
export class DeDocumentViewer extends DeesElement {
// DEMO
public static demo = demoFunc;
// INSTANCE
public letterData: plugins.tsclass.business.ILetter = null;
public static styles = [
cssManager.defaultStyles,
css`
.maincontainer {
position: relative;
height: 100%;
width: 100%;
background: ${cssManager.bdTheme('#eeeeeb', '#111')};
}
.controls {
top: 0px;
right: 0px;
left: 0px;
position: absolute;
height: 32px;
width: 100%;
background: ${cssManager.bdTheme('#eeeeeb', '#111111ee')};
box-shadow: 0px 2px 8px 0px #000000;
}
.controlsShadow {
position: absolute;
top: 32px;
right: 0px;
left: 0px;
height: 16px;
width: 100%;
position: absolute;
background: linear-gradient(to bottom, #111111cc 0%, #11111100 100%);
}
.viewport {
position: absolute;
padding: 16px;
padding-top: 48px;
padding-bottom: 0px;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
overflow-y: scroll;
overscroll-behavior: contain;
}
`,
];
public render = () => {
return html`
<div class="maincontainer">
<div class="viewport">
${this.letterData
? html` <dedocument-dedocument .letterData=${this.letterData}></dedocument-dedocument> `
: html``}
</div>
<div class="controls"></div>
</div>
`;
};
public updated = (changedProperties: Map<string | number | symbol, unknown>) => {
super.updated(changedProperties);
if (changedProperties.has('letterData')) {
}
};
}