fix(core): update
This commit is contained in:
6
ts_web/elements/document.demo.ts
Normal file
6
ts_web/elements/document.demo.ts
Normal 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>
|
||||
`;
|
@ -18,6 +18,7 @@ import { DePage } from './page.js';
|
||||
import { DeContentInvoice } from './contentinvoice.js';
|
||||
|
||||
import * as shared from './shared/index.js';
|
||||
import { demoFunc } from './document.demo.js';
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
@ -27,9 +28,7 @@ declare global {
|
||||
|
||||
@customElement('dedocument-dedocument')
|
||||
export class DeDocument extends DeesElement {
|
||||
public static demo = () => html`
|
||||
<dedocument-dedocument .format="${'a4'}" .letterData=${shared.demoLetter}></dedocument-dedocument>
|
||||
`;
|
||||
public static demo = demoFunc;
|
||||
|
||||
@property({
|
||||
type: String,
|
||||
@ -86,7 +85,7 @@ export class DeDocument extends DeesElement {
|
||||
}
|
||||
|
||||
.betweenPagesSpacer {
|
||||
height: 20px;
|
||||
height: 16px;
|
||||
}
|
||||
`,
|
||||
];
|
||||
@ -107,6 +106,10 @@ export class DeDocument extends DeesElement {
|
||||
}
|
||||
});
|
||||
resizeObserver.observe(this);
|
||||
this.registerGarbageFunction(() => {
|
||||
resizeObserver.disconnect();
|
||||
})
|
||||
|
||||
if (this.letterDataUrl) {
|
||||
const response = await fetch(this.letterDataUrl);
|
||||
this.letterData = await response.json();
|
||||
|
@ -6,5 +6,6 @@ export * from './pagecontainer.js';
|
||||
export * from './pagecontent.js';
|
||||
export * from './pagefooter.js';
|
||||
export * from './pageheader.js';
|
||||
export * from './viewer.js';
|
||||
|
||||
export * from './shared/index.js';
|
@ -64,6 +64,9 @@ export class DePage extends DeesElement {
|
||||
domtools.elementBasic.staticStyles,
|
||||
css`
|
||||
:host {
|
||||
display: block;
|
||||
max-height: ${shared.a4Height}px;
|
||||
max-width: ${shared.a4Width}px;
|
||||
}
|
||||
|
||||
#scaleWrapper {
|
||||
@ -177,7 +180,7 @@ export class DePage extends DeesElement {
|
||||
|
||||
// Adjust the outer dimensions so they match the scaled content
|
||||
|
||||
scaleWrapper.style.width = `${shared.a4Width * scale}px`;
|
||||
scaleWrapper.style.height = `${shared.a4Height * scale}px`;
|
||||
// this.style.width = `${shared.a4Width * scale}px`;
|
||||
this.style.height = `${shared.a4Height * scale}px`;
|
||||
}
|
||||
}
|
||||
|
6
ts_web/elements/viewer.demo.ts
Normal file
6
ts_web/elements/viewer.demo.ts
Normal 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
83
ts_web/elements/viewer.ts
Normal 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')) {
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user