@pdfme/ui 6.1.13-dev.1 → 6.1.13-dev.17
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/class.d.ts +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/containerSize.d.ts +11 -0
- package/dist/helper.d.ts +17 -0
- package/dist/index.js +229 -54
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/class.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare abstract class BaseUIClass {
|
|
|
12
12
|
private readonly setSize;
|
|
13
13
|
resizeObserver: ResizeObserver;
|
|
14
14
|
constructor(props: UIProps);
|
|
15
|
-
protected getLang(): "ar" | "de" | "en" | "es" | "fr" | "it" | "ja" | "ko" | "pl" | "th" | "zh" | "zh-TW";
|
|
15
|
+
protected getLang(): "ar" | "de" | "en" | "es" | "fr" | "it" | "ja" | "ko" | "pl" | "th" | "tr" | "zh" | "zh-TW";
|
|
16
16
|
protected getFont(): Record<string, {
|
|
17
17
|
data: string | ArrayBuffer | Uint8Array<ArrayBuffer>;
|
|
18
18
|
fallback?: boolean | undefined;
|
package/dist/constants.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export declare const LEFT_SIDEBAR_WIDTH = 45;
|
|
|
7
7
|
export declare const RIGHT_SIDEBAR_WIDTH = 400;
|
|
8
8
|
export declare const BACKGROUND_COLOR = "rgb(74, 74, 74)";
|
|
9
9
|
export declare const DEFAULT_MAX_ZOOM = 2;
|
|
10
|
+
export declare const PAGE_SWITCH_REMAINING_RATIO = 0.25;
|
|
10
11
|
export declare const DESIGNER_CLASSNAME = "pdfme-designer-";
|
|
11
12
|
export declare const UI_CLASSNAME = "pdfme-ui-";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Size } from '@pdfme/common';
|
|
2
|
+
export type ViewportSize = {
|
|
3
|
+
height: number;
|
|
4
|
+
width: number;
|
|
5
|
+
};
|
|
6
|
+
export type ContainerBox = {
|
|
7
|
+
clientHeight: number;
|
|
8
|
+
clientWidth: number;
|
|
9
|
+
getBoundingClientRect: () => Pick<DOMRect, 'bottom' | 'left' | 'right' | 'top'>;
|
|
10
|
+
};
|
|
11
|
+
export declare const measureUiContainerSize: (container: ContainerBox, viewport: ViewportSize) => Size;
|
package/dist/helper.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { Template, BasePdf, SchemaForUI, Size, PluginRegistry } from '@pdfme/common';
|
|
2
2
|
export declare const uuid: () => string;
|
|
3
|
+
/**
|
|
4
|
+
* Assigns runtime UI ids that stay stable for a Designer/Viewer/Form session.
|
|
5
|
+
* Caller/template ids are ignored: Schema.passthrough() can carry values that
|
|
6
|
+
* break `#text-{id}` querySelector (e.g. `foo[`). Save paths still strip ids.
|
|
7
|
+
*/
|
|
8
|
+
export declare const stabilizeSchemaIds: <T extends {
|
|
9
|
+
name: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
}>(schemas: T[], idMap: Map<string, string>) => (T & {
|
|
12
|
+
id: string;
|
|
13
|
+
})[];
|
|
3
14
|
export declare const debounce: <T extends (...args: unknown[]) => unknown>(cb: T, wait?: number) => T;
|
|
4
15
|
export declare const round: (number: number, precision: number) => number;
|
|
5
16
|
export declare const flatten: <T>(arr: T[][]) => T[];
|
|
@@ -55,6 +66,12 @@ export declare const moveCommandToChangeSchemasArg: (props: {
|
|
|
55
66
|
schemaId: string;
|
|
56
67
|
}[];
|
|
57
68
|
export declare const getPagesScrollTopByIndex: (pageSizes: Size[], index: number, scale: number) => number;
|
|
69
|
+
export declare const getVisibleOverlap: (containerRect: DOMRect, elementRect: DOMRect) => {
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
area: number;
|
|
73
|
+
};
|
|
74
|
+
export declare const getStickyScrollPageIndex: (container: HTMLElement, papers: Array<HTMLElement | null | undefined>, pageCursor: number) => number;
|
|
58
75
|
export type ZoomMode = 'manual' | 'fit-width' | 'fit-height';
|
|
59
76
|
export type ZoomAnchor = {
|
|
60
77
|
pageIndex: number;
|
package/dist/index.js
CHANGED
|
@@ -45375,6 +45375,7 @@ var Lang = _enum([
|
|
|
45375
45375
|
"ko",
|
|
45376
45376
|
"ar",
|
|
45377
45377
|
"th",
|
|
45378
|
+
"tr",
|
|
45378
45379
|
"pl",
|
|
45379
45380
|
"it",
|
|
45380
45381
|
"de",
|
|
@@ -46151,9 +46152,22 @@ var replacePlaceholders = (arg) => {
|
|
|
46151
46152
|
var EPSILON = .01;
|
|
46152
46153
|
/** Calculate the content height of a page (drawable area excluding padding) */
|
|
46153
46154
|
var getContentHeight = (basePdf) => basePdf.height - basePdf.padding[0] - basePdf.padding[2];
|
|
46155
|
+
/**
|
|
46156
|
+
* Resolve a readOnly table body.
|
|
46157
|
+
* Uses input[schema.name] when present (array or JSON string) and never runs
|
|
46158
|
+
* replacePlaceholders. Falls back to schema.content (Designer sample).
|
|
46159
|
+
*/
|
|
46160
|
+
var getReadOnlyTableValue = (schema, input) => {
|
|
46161
|
+
if (input && Object.prototype.hasOwnProperty.call(input, schema.name)) {
|
|
46162
|
+
const value = input[schema.name];
|
|
46163
|
+
if (value !== void 0 && value !== null) return typeof value === "string" ? value : JSON.stringify(value);
|
|
46164
|
+
}
|
|
46165
|
+
return schema.content || "";
|
|
46166
|
+
};
|
|
46154
46167
|
/** Get the input value for a schema */
|
|
46155
46168
|
var getSchemaValue = (schema, input, schemas) => {
|
|
46156
46169
|
if (!schema.readOnly) return input?.[schema.name] || "";
|
|
46170
|
+
if (schema.type === "table") return getReadOnlyTableValue(schema, input);
|
|
46157
46171
|
if (schema.type !== "text" && schema.type !== "multiVariableText") return schema.content || "";
|
|
46158
46172
|
return replacePlaceholders({
|
|
46159
46173
|
content: schema.content || "",
|
|
@@ -56104,9 +56118,29 @@ var import_client = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
56104
56118
|
var DESTROYED_ERR_MSG = "[@pdfme/ui] this instance is already destroyed";
|
|
56105
56119
|
var SELECTABLE_CLASSNAME = "selectable";
|
|
56106
56120
|
var BACKGROUND_COLOR = "rgb(74, 74, 74)";
|
|
56121
|
+
var PAGE_SWITCH_REMAINING_RATIO = .25;
|
|
56107
56122
|
var DESIGNER_CLASSNAME = "pdfme-designer-";
|
|
56108
56123
|
var UI_CLASSNAME = "pdfme-ui-";
|
|
56109
56124
|
//#endregion
|
|
56125
|
+
//#region src/containerSize.ts
|
|
56126
|
+
var visibleIntersection = (start, end, viewportSize) => Math.max(0, Math.min(end, viewportSize) - Math.max(start, 0));
|
|
56127
|
+
var capOverflowToViewport = (layout, visible, viewportSize) => layout > viewportSize ? Math.min(layout, visible) : layout;
|
|
56128
|
+
var measureUiContainerSize = (container, viewport) => {
|
|
56129
|
+
const layoutWidth = container.clientWidth || viewport.width;
|
|
56130
|
+
const layoutHeight = container.clientHeight || viewport.height;
|
|
56131
|
+
const rect = container.getBoundingClientRect();
|
|
56132
|
+
const visibleWidth = visibleIntersection(rect.left, rect.right, viewport.width);
|
|
56133
|
+
const visibleHeight = visibleIntersection(rect.top, rect.bottom, viewport.height);
|
|
56134
|
+
if (visibleWidth === 0 || visibleHeight === 0) return {
|
|
56135
|
+
height: layoutHeight,
|
|
56136
|
+
width: layoutWidth
|
|
56137
|
+
};
|
|
56138
|
+
return {
|
|
56139
|
+
height: capOverflowToViewport(layoutHeight, visibleHeight, viewport.height),
|
|
56140
|
+
width: capOverflowToViewport(layoutWidth, visibleWidth, viewport.width)
|
|
56141
|
+
};
|
|
56142
|
+
};
|
|
56143
|
+
//#endregion
|
|
56110
56144
|
//#region ../../node_modules/hotkeys-js/dist/hotkeys-js.js
|
|
56111
56145
|
/*!
|
|
56112
56146
|
* hotkeys-js v4.0.7
|
|
@@ -57348,6 +57382,113 @@ var dictionaries = {
|
|
|
57348
57382
|
"schemas.list.indentItem": "เพิ่มย่อหน้า",
|
|
57349
57383
|
"schemas.list.outdentItem": "ลดย่อหน้า"
|
|
57350
57384
|
},
|
|
57385
|
+
tr: {
|
|
57386
|
+
cancel: "İptal",
|
|
57387
|
+
close: "Kapat",
|
|
57388
|
+
clear: "Temizle",
|
|
57389
|
+
set: "Ayarla",
|
|
57390
|
+
field: "alan",
|
|
57391
|
+
fieldName: "Ad",
|
|
57392
|
+
align: "Hizala",
|
|
57393
|
+
width: "Genişlik",
|
|
57394
|
+
height: "Yükseklik",
|
|
57395
|
+
opacity: "Opaklık",
|
|
57396
|
+
rotate: "Döndür",
|
|
57397
|
+
required: "Zorunlu",
|
|
57398
|
+
editable: "Düzenlenebilir",
|
|
57399
|
+
edit: "Düzenle",
|
|
57400
|
+
plsInputName: "Lütfen bir ad girin",
|
|
57401
|
+
fieldMustUniq: "Alan adı benzersiz olmalı",
|
|
57402
|
+
notUniq: "(Benzersiz olmayan ad)",
|
|
57403
|
+
noKeyName: "Adsız",
|
|
57404
|
+
fieldsList: "Alan Listesi",
|
|
57405
|
+
editField: "Alanı Düzenle",
|
|
57406
|
+
type: "Tür",
|
|
57407
|
+
errorOccurred: "Bir hata oluştu",
|
|
57408
|
+
errorBulkUpdateFieldName: "Öğe sayısı değiştiği için değişiklik kaydedilemedi.",
|
|
57409
|
+
commitBulkUpdateFieldName: "Değişiklikleri Kaydet",
|
|
57410
|
+
bulkUpdateFieldName: "Alan adlarını toplu güncelle",
|
|
57411
|
+
addPageAfter: "Sonrasına Sayfa Ekle",
|
|
57412
|
+
removePage: "Mevcut Sayfayı Kaldır",
|
|
57413
|
+
removePageConfirm: "Bu sayfayı silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.",
|
|
57414
|
+
zoomIn: "Yakınlaştır",
|
|
57415
|
+
zoomOut: "Uzaklaştır",
|
|
57416
|
+
fitWidth: "Genişliğe sığdır",
|
|
57417
|
+
fitHeight: "Yüksekliğe sığdır",
|
|
57418
|
+
"validation.hexColor": "Lütfen geçerli bir hex renk kodu girin.",
|
|
57419
|
+
"validation.uniqueName": "Lütfen benzersiz bir ad girin.",
|
|
57420
|
+
"validation.dateTimeFormat": "Geçersiz tarih saat biçimi.",
|
|
57421
|
+
"validation.outOfBounds": "Sayfa sınırlarını aşıyor.",
|
|
57422
|
+
"schemas.color": "Renk",
|
|
57423
|
+
"schemas.borderWidth": "Kenarlık Genişliği",
|
|
57424
|
+
"schemas.borderColor": "Kenarlık Rengi",
|
|
57425
|
+
"schemas.backgroundColor": "Arka Plan Rengi",
|
|
57426
|
+
"schemas.textColor": "Metin Rengi",
|
|
57427
|
+
"schemas.bgColor": "Arka Plan Rengi",
|
|
57428
|
+
"schemas.horizontal": "Yatay",
|
|
57429
|
+
"schemas.vertical": "Dikey",
|
|
57430
|
+
"schemas.left": "Sol",
|
|
57431
|
+
"schemas.center": "Orta",
|
|
57432
|
+
"schemas.right": "Sağ",
|
|
57433
|
+
"schemas.top": "Üst",
|
|
57434
|
+
"schemas.middle": "Orta",
|
|
57435
|
+
"schemas.bottom": "Alt",
|
|
57436
|
+
"schemas.padding": "İç Boşluk",
|
|
57437
|
+
"schemas.text.fontName": "Yazı Tipi Adı",
|
|
57438
|
+
"schemas.text.size": "Boyut",
|
|
57439
|
+
"schemas.text.spacing": "Aralık",
|
|
57440
|
+
"schemas.text.textAlign": "Metin Hizası",
|
|
57441
|
+
"schemas.text.verticalAlign": "Dikey Hizalama",
|
|
57442
|
+
"schemas.text.lineHeight": "Satır Yüksekliği",
|
|
57443
|
+
"schemas.text.min": "En Az",
|
|
57444
|
+
"schemas.text.max": "En Çok",
|
|
57445
|
+
"schemas.text.fit": "Sığdır",
|
|
57446
|
+
"schemas.text.dynamicFontSize": "Dinamik Yazı Tipi Boyutu",
|
|
57447
|
+
"schemas.text.overflow": "Taşma",
|
|
57448
|
+
"schemas.text.overflowVisible": "Görünür",
|
|
57449
|
+
"schemas.text.overflowExpand": "Genişlet",
|
|
57450
|
+
"schemas.text.format": "Biçim",
|
|
57451
|
+
"schemas.text.plain": "Düz",
|
|
57452
|
+
"schemas.text.inlineMarkdown": "Satır İçi Markdown Kullan",
|
|
57453
|
+
"schemas.text.markdownFonts": "Markdown Yazı Tipleri",
|
|
57454
|
+
"schemas.text.boldFont": "Kalın Yazı Tipi",
|
|
57455
|
+
"schemas.text.italicFont": "İtalik Yazı Tipi",
|
|
57456
|
+
"schemas.text.boldItalicFont": "Kalın İtalik Yazı Tipi",
|
|
57457
|
+
"schemas.text.codeFont": "Kod Yazı Tipi",
|
|
57458
|
+
"schemas.text.variantFallback": "Varyant Geri Dönüşü",
|
|
57459
|
+
"schemas.text.synthetic": "Yapay Stil",
|
|
57460
|
+
"schemas.text.error": "Hata",
|
|
57461
|
+
"schemas.radius": "Yarıçap",
|
|
57462
|
+
"schemas.mvt.typingInstructions": "Değişken eklemek için süslü parantez içine kelime yazın, örneğin",
|
|
57463
|
+
"schemas.mvt.sampleField": "ad",
|
|
57464
|
+
"schemas.mvt.variablesSampleData": "Değişken Örnek Verisi",
|
|
57465
|
+
"schemas.mvt.placeholderDynamicVariable": "Yer Tutucu Dinamik Değişken",
|
|
57466
|
+
"schemas.barcodes.barColor": "Çubuk Rengi",
|
|
57467
|
+
"schemas.barcodes.includetext": "Metni Dahil Et",
|
|
57468
|
+
"schemas.table.alternateBackgroundColor": "Alternatif Arka Plan Rengi",
|
|
57469
|
+
"schemas.table.tableStyle": "Tablo Stili",
|
|
57470
|
+
"schemas.table.showHead": "Başlığı Göster",
|
|
57471
|
+
"schemas.table.repeatHead": "Başlığı Tekrarla",
|
|
57472
|
+
"schemas.table.headStyle": "Başlık Stili",
|
|
57473
|
+
"schemas.table.bodyStyle": "Gövde Stili",
|
|
57474
|
+
"schemas.table.columnStyle": "Sütun Stili",
|
|
57475
|
+
"schemas.date.format": "Tarih Biçimi",
|
|
57476
|
+
"schemas.date.locale": "Yerel Ayar",
|
|
57477
|
+
"schemas.select.options": "Seçenekler",
|
|
57478
|
+
"schemas.select.optionPlaceholder": "Bir seçenek girin",
|
|
57479
|
+
"schemas.radioGroup.groupName": "Grup Adı",
|
|
57480
|
+
"schemas.list.listStyle": "Liste Stili",
|
|
57481
|
+
"schemas.list.bullet": "Madde İşaretli",
|
|
57482
|
+
"schemas.list.ordered": "Numaralı",
|
|
57483
|
+
"schemas.list.markerWidth": "İşaret Genişliği",
|
|
57484
|
+
"schemas.list.markerGap": "İşaret Aralığı",
|
|
57485
|
+
"schemas.list.indentSize": "Girinti Boyutu",
|
|
57486
|
+
"schemas.list.itemSpacing": "Öğe Aralığı",
|
|
57487
|
+
"schemas.list.addItem": "Öğe Ekle",
|
|
57488
|
+
"schemas.list.removeItem": "Öğe Kaldır",
|
|
57489
|
+
"schemas.list.indentItem": "Girintiyi Artır",
|
|
57490
|
+
"schemas.list.outdentItem": "Girintiyi Azalt"
|
|
57491
|
+
},
|
|
57351
57492
|
it: {
|
|
57352
57493
|
cancel: "Annulla",
|
|
57353
57494
|
close: "Chiudi",
|
|
@@ -77054,6 +77195,25 @@ var uuid$13 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c)
|
|
|
77054
77195
|
const r = Math.random() * 16 | 0;
|
|
77055
77196
|
return (c == "x" ? r : r & 3 | 8).toString(16);
|
|
77056
77197
|
});
|
|
77198
|
+
/**
|
|
77199
|
+
* Assigns runtime UI ids that stay stable for a Designer/Viewer/Form session.
|
|
77200
|
+
* Caller/template ids are ignored: Schema.passthrough() can carry values that
|
|
77201
|
+
* break `#text-{id}` querySelector (e.g. `foo[`). Save paths still strip ids.
|
|
77202
|
+
*/
|
|
77203
|
+
var stabilizeSchemaIds = (schemas, idMap) => schemas.map((schema, index) => {
|
|
77204
|
+
const key = schema.name || `index:${index}`;
|
|
77205
|
+
const existingId = idMap.get(key);
|
|
77206
|
+
if (existingId) return {
|
|
77207
|
+
...schema,
|
|
77208
|
+
id: existingId
|
|
77209
|
+
};
|
|
77210
|
+
const id = uuid$13();
|
|
77211
|
+
idMap.set(key, id);
|
|
77212
|
+
return {
|
|
77213
|
+
...schema,
|
|
77214
|
+
id
|
|
77215
|
+
};
|
|
77216
|
+
});
|
|
77057
77217
|
var set$3 = (obj, path, value) => {
|
|
77058
77218
|
path = Array.isArray(path) ? path : path.replace(/\[/g, ".").replace(/\]/g, "").split(".");
|
|
77059
77219
|
let src = obj;
|
|
@@ -77316,6 +77476,44 @@ var moveCommandToChangeSchemasArg = (props) => {
|
|
|
77316
77476
|
var getPagesScrollTopByIndex = (pageSizes, index, scale) => {
|
|
77317
77477
|
return pageSizes.slice(0, index).reduce((acc, cur) => acc + (cur.height * ZOOM + 30 * scale) * scale, 0);
|
|
77318
77478
|
};
|
|
77479
|
+
var getVisibleOverlap = (containerRect, elementRect) => {
|
|
77480
|
+
const width = Math.max(0, Math.min(containerRect.right, elementRect.right) - Math.max(containerRect.left, elementRect.left));
|
|
77481
|
+
const height = Math.max(0, Math.min(containerRect.bottom, elementRect.bottom) - Math.max(containerRect.top, elementRect.top));
|
|
77482
|
+
return {
|
|
77483
|
+
width,
|
|
77484
|
+
height,
|
|
77485
|
+
area: width * height
|
|
77486
|
+
};
|
|
77487
|
+
};
|
|
77488
|
+
var VERTICAL_SCROLL_EDGE_EPSILON = 1;
|
|
77489
|
+
var isAtVerticalScrollEdge = (container) => {
|
|
77490
|
+
const maxScrollTop = container.scrollHeight - container.clientHeight;
|
|
77491
|
+
if (maxScrollTop <= 0) return false;
|
|
77492
|
+
const { scrollTop } = container;
|
|
77493
|
+
return scrollTop <= VERTICAL_SCROLL_EDGE_EPSILON || scrollTop >= maxScrollTop - VERTICAL_SCROLL_EDGE_EPSILON;
|
|
77494
|
+
};
|
|
77495
|
+
var getStickyScrollPageIndex = (container, papers, pageCursor) => {
|
|
77496
|
+
const containerRect = container.getBoundingClientRect();
|
|
77497
|
+
const stickyHeight = containerRect.height * PAGE_SWITCH_REMAINING_RATIO;
|
|
77498
|
+
let bestPageIndex = pageCursor;
|
|
77499
|
+
let bestVisibleArea = 0;
|
|
77500
|
+
let currentVisibleHeight = 0;
|
|
77501
|
+
let currentVisibleArea = 0;
|
|
77502
|
+
papers.forEach((paper, pageIndex) => {
|
|
77503
|
+
if (!paper) return;
|
|
77504
|
+
const { height, area } = getVisibleOverlap(containerRect, paper.getBoundingClientRect());
|
|
77505
|
+
if (pageIndex === pageCursor) {
|
|
77506
|
+
currentVisibleHeight = height;
|
|
77507
|
+
currentVisibleArea = area;
|
|
77508
|
+
}
|
|
77509
|
+
if (area > bestVisibleArea) {
|
|
77510
|
+
bestVisibleArea = area;
|
|
77511
|
+
bestPageIndex = pageIndex;
|
|
77512
|
+
}
|
|
77513
|
+
});
|
|
77514
|
+
if (bestVisibleArea <= 0) return pageCursor;
|
|
77515
|
+
return !isAtVerticalScrollEdge(container) && currentVisibleArea > 0 && currentVisibleHeight >= stickyHeight ? pageCursor : bestPageIndex;
|
|
77516
|
+
};
|
|
77319
77517
|
var MIN_ZOOM = .25;
|
|
77320
77518
|
var FIT_GUTTER = 40;
|
|
77321
77519
|
var clampZoomLevel = (zoomLevel, maxZoom, minZoom = MIN_ZOOM) => Math.min(Math.max(zoomLevel, minZoom), maxZoom);
|
|
@@ -77436,15 +77634,10 @@ var BaseUIClass = class {
|
|
|
77436
77634
|
_defineProperty$14(this, "options", {});
|
|
77437
77635
|
_defineProperty$14(this, "setSize", debounce$2(() => {
|
|
77438
77636
|
if (!this.domContainer) return;
|
|
77439
|
-
|
|
77440
|
-
|
|
77441
|
-
|
|
77442
|
-
|
|
77443
|
-
const visibleHeight = Math.max(0, Math.min(rect.bottom, vh) - Math.max(rect.top, 0));
|
|
77444
|
-
this.size = {
|
|
77445
|
-
height: visibleHeight,
|
|
77446
|
-
width: visibleWidth
|
|
77447
|
-
};
|
|
77637
|
+
this.size = measureUiContainerSize(this.domContainer, {
|
|
77638
|
+
height: window.innerHeight,
|
|
77639
|
+
width: window.innerWidth
|
|
77640
|
+
});
|
|
77448
77641
|
this.render();
|
|
77449
77642
|
}, 100));
|
|
77450
77643
|
_defineProperty$14(this, "resizeObserver", new ResizeObserver(this.setSize));
|
|
@@ -77454,10 +77647,10 @@ var BaseUIClass = class {
|
|
|
77454
77647
|
this.template = cloneDeep$1(template);
|
|
77455
77648
|
this.options = options;
|
|
77456
77649
|
const container = this.domContainer;
|
|
77457
|
-
this.size = {
|
|
77458
|
-
height:
|
|
77459
|
-
width:
|
|
77460
|
-
};
|
|
77650
|
+
this.size = measureUiContainerSize(container, {
|
|
77651
|
+
height: window.innerHeight,
|
|
77652
|
+
width: window.innerWidth
|
|
77653
|
+
});
|
|
77461
77654
|
this.resizeObserver.observe(container);
|
|
77462
77655
|
const { lang, font } = options;
|
|
77463
77656
|
if (lang) this.lang = lang;
|
|
@@ -88030,7 +88223,7 @@ function getPxValue$5(val) {
|
|
|
88030
88223
|
/**
|
|
88031
88224
|
* Get visible area of element
|
|
88032
88225
|
*/
|
|
88033
|
-
function getVisibleArea$
|
|
88226
|
+
function getVisibleArea$5(initArea, scrollerList) {
|
|
88034
88227
|
const visibleArea = { ...initArea };
|
|
88035
88228
|
(scrollerList || []).forEach((ele) => {
|
|
88036
88229
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -88208,8 +88401,8 @@ function useAlign$5(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
88208
88401
|
const VISIBLE_FIRST = "visibleFirst";
|
|
88209
88402
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
88210
88403
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
88211
|
-
const scrollRegionArea = getVisibleArea$
|
|
88212
|
-
const visibleRegionArea = getVisibleArea$
|
|
88404
|
+
const scrollRegionArea = getVisibleArea$5(scrollRegion, scrollerList);
|
|
88405
|
+
const visibleRegionArea = getVisibleArea$5(visibleRegion, scrollerList);
|
|
88213
88406
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
88214
88407
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
88215
88408
|
popupElement.style.left = "auto";
|
|
@@ -95506,7 +95699,7 @@ function getPxValue$4(val) {
|
|
|
95506
95699
|
/**
|
|
95507
95700
|
* Get visible area of element
|
|
95508
95701
|
*/
|
|
95509
|
-
function getVisibleArea$
|
|
95702
|
+
function getVisibleArea$4(initArea, scrollerList) {
|
|
95510
95703
|
const visibleArea = { ...initArea };
|
|
95511
95704
|
(scrollerList || []).forEach((ele) => {
|
|
95512
95705
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -95684,8 +95877,8 @@ function useAlign$4(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
95684
95877
|
const VISIBLE_FIRST = "visibleFirst";
|
|
95685
95878
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
95686
95879
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
95687
|
-
const scrollRegionArea = getVisibleArea$
|
|
95688
|
-
const visibleRegionArea = getVisibleArea$
|
|
95880
|
+
const scrollRegionArea = getVisibleArea$4(scrollRegion, scrollerList);
|
|
95881
|
+
const visibleRegionArea = getVisibleArea$4(visibleRegion, scrollerList);
|
|
95689
95882
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
95690
95883
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
95691
95884
|
popupElement.style.left = "auto";
|
|
@@ -101632,7 +101825,7 @@ function getPxValue$3(val) {
|
|
|
101632
101825
|
/**
|
|
101633
101826
|
* Get visible area of element
|
|
101634
101827
|
*/
|
|
101635
|
-
function getVisibleArea$
|
|
101828
|
+
function getVisibleArea$3(initArea, scrollerList) {
|
|
101636
101829
|
const visibleArea = { ...initArea };
|
|
101637
101830
|
(scrollerList || []).forEach((ele) => {
|
|
101638
101831
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -101810,8 +102003,8 @@ function useAlign$3(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
101810
102003
|
const VISIBLE_FIRST = "visibleFirst";
|
|
101811
102004
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
101812
102005
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
101813
|
-
const scrollRegionArea = getVisibleArea$
|
|
101814
|
-
const visibleRegionArea = getVisibleArea$
|
|
102006
|
+
const scrollRegionArea = getVisibleArea$3(scrollRegion, scrollerList);
|
|
102007
|
+
const visibleRegionArea = getVisibleArea$3(visibleRegion, scrollerList);
|
|
101815
102008
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
101816
102009
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
101817
102010
|
popupElement.style.left = "auto";
|
|
@@ -103998,7 +104191,7 @@ function getPxValue$2(val) {
|
|
|
103998
104191
|
/**
|
|
103999
104192
|
* Get visible area of element
|
|
104000
104193
|
*/
|
|
104001
|
-
function getVisibleArea$
|
|
104194
|
+
function getVisibleArea$2(initArea, scrollerList) {
|
|
104002
104195
|
const visibleArea = { ...initArea };
|
|
104003
104196
|
(scrollerList || []).forEach((ele) => {
|
|
104004
104197
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -104176,8 +104369,8 @@ function useAlign$2(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
104176
104369
|
const VISIBLE_FIRST = "visibleFirst";
|
|
104177
104370
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
104178
104371
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
104179
|
-
const scrollRegionArea = getVisibleArea$
|
|
104180
|
-
const visibleRegionArea = getVisibleArea$
|
|
104372
|
+
const scrollRegionArea = getVisibleArea$2(scrollRegion, scrollerList);
|
|
104373
|
+
const visibleRegionArea = getVisibleArea$2(visibleRegion, scrollerList);
|
|
104181
104374
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
104182
104375
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
104183
104376
|
popupElement.style.left = "auto";
|
|
@@ -106054,7 +106247,7 @@ function getPxValue$1(val) {
|
|
|
106054
106247
|
/**
|
|
106055
106248
|
* Get visible area of element
|
|
106056
106249
|
*/
|
|
106057
|
-
function getVisibleArea$
|
|
106250
|
+
function getVisibleArea$1(initArea, scrollerList) {
|
|
106058
106251
|
const visibleArea = { ...initArea };
|
|
106059
106252
|
(scrollerList || []).forEach((ele) => {
|
|
106060
106253
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -106232,8 +106425,8 @@ function useAlign$1(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
106232
106425
|
const VISIBLE_FIRST = "visibleFirst";
|
|
106233
106426
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
106234
106427
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
106235
|
-
const scrollRegionArea = getVisibleArea$
|
|
106236
|
-
const visibleRegionArea = getVisibleArea$
|
|
106428
|
+
const scrollRegionArea = getVisibleArea$1(scrollRegion, scrollerList);
|
|
106429
|
+
const visibleRegionArea = getVisibleArea$1(visibleRegion, scrollerList);
|
|
106237
106430
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
106238
106431
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
106239
106432
|
popupElement.style.left = "auto";
|
|
@@ -122369,27 +122562,10 @@ var useZoom = ({ baseScale, maxZoom, pageCursor, pageSizes, containerRef, paperR
|
|
|
122369
122562
|
fitHeight: () => fitZoom("fit-height")
|
|
122370
122563
|
};
|
|
122371
122564
|
};
|
|
122372
|
-
var getVisibleArea$1 = (containerRect, elementRect) => {
|
|
122373
|
-
return Math.max(0, Math.min(containerRect.right, elementRect.right) - Math.max(containerRect.left, elementRect.left)) * Math.max(0, Math.min(containerRect.bottom, elementRect.bottom) - Math.max(containerRect.top, elementRect.top));
|
|
122374
|
-
};
|
|
122375
|
-
var getMostVisiblePageIndex = (container, paperRefs, pageCursor) => {
|
|
122376
|
-
const containerRect = container.getBoundingClientRect();
|
|
122377
|
-
let bestPageIndex = pageCursor;
|
|
122378
|
-
let bestVisibleArea = 0;
|
|
122379
|
-
paperRefs.current.forEach((paper, pageIndex) => {
|
|
122380
|
-
if (!paper) return;
|
|
122381
|
-
const visibleArea = getVisibleArea$1(containerRect, paper.getBoundingClientRect());
|
|
122382
|
-
if (visibleArea > bestVisibleArea) {
|
|
122383
|
-
bestVisibleArea = visibleArea;
|
|
122384
|
-
bestPageIndex = pageIndex;
|
|
122385
|
-
}
|
|
122386
|
-
});
|
|
122387
|
-
return bestVisibleArea > 0 ? bestPageIndex : pageCursor;
|
|
122388
|
-
};
|
|
122389
122565
|
var useScrollPageCursor = ({ ref, paperRefs, pageSizes, scale, pageCursor, onChangePageCursor }) => {
|
|
122390
122566
|
const onScroll = (0, import_react$9.useCallback)(() => {
|
|
122391
122567
|
if (!pageSizes[0] || !ref.current) return;
|
|
122392
|
-
const _pageCursor =
|
|
122568
|
+
const _pageCursor = getStickyScrollPageIndex(ref.current, paperRefs.current, pageCursor);
|
|
122393
122569
|
if (_pageCursor !== pageCursor) onChangePageCursor(_pageCursor);
|
|
122394
122570
|
}, [
|
|
122395
122571
|
onChangePageCursor,
|
|
@@ -225690,14 +225866,13 @@ var Padding = ({ basePdf }) => {
|
|
|
225690
225866
|
//#region src/components/StaticSchema.tsx
|
|
225691
225867
|
var StaticSchema = (props) => {
|
|
225692
225868
|
const { template: { schemas, basePdf }, input, scale, totalPages, currentPage } = props;
|
|
225869
|
+
const [staticSchemaIds] = (0, import_react$9.useState)(() => /* @__PURE__ */ new Map());
|
|
225693
225870
|
if (!isBlankPdf(basePdf) || !basePdf.staticSchema) return null;
|
|
225694
|
-
|
|
225695
|
-
|
|
225696
|
-
|
|
225697
|
-
id: uuid$13()
|
|
225698
|
-
},
|
|
225871
|
+
const schemasForUI = stabilizeSchemaIds(basePdf.staticSchema, staticSchemaIds);
|
|
225872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: schemasForUI.map((schema) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Renderer, {
|
|
225873
|
+
schema,
|
|
225699
225874
|
basePdf,
|
|
225700
|
-
value: schema.readOnly ? replacePlaceholders({
|
|
225875
|
+
value: schema.readOnly && schema.type === "table" ? getReadOnlyTableValue(schema, input) : schema.readOnly ? replacePlaceholders({
|
|
225701
225876
|
content: schema.content || "",
|
|
225702
225877
|
variables: {
|
|
225703
225878
|
...input,
|
|
@@ -226073,7 +226248,7 @@ var Canvas = (props, ref) => {
|
|
|
226073
226248
|
const mode = editing && activeElements.map((ae) => ae.id).includes(schema.id) ? "designer" : "viewer";
|
|
226074
226249
|
const content = schema.content || "";
|
|
226075
226250
|
let value = content;
|
|
226076
|
-
if (mode !== "designer" && schema.readOnly) value = replacePlaceholders({
|
|
226251
|
+
if (mode !== "designer" && schema.readOnly && schema.type !== "table") value = replacePlaceholders({
|
|
226077
226252
|
content,
|
|
226078
226253
|
variables: {
|
|
226079
226254
|
...schemasList.flat().reduce((acc, currSchema) => {
|
|
@@ -227502,7 +227677,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
227502
227677
|
backgrounds,
|
|
227503
227678
|
renderSchema: ({ schema, index }) => {
|
|
227504
227679
|
const hasInputValue = Boolean(input && Object.prototype.hasOwnProperty.call(input, schema.name));
|
|
227505
|
-
const value = schema.readOnly ? replacePlaceholders({
|
|
227680
|
+
const value = schema.readOnly && schema.type === "table" ? getReadOnlyTableValue(schema, input) : schema.readOnly ? replacePlaceholders({
|
|
227506
227681
|
content: schema.content || "",
|
|
227507
227682
|
variables: {
|
|
227508
227683
|
...input,
|