@pdfme/ui 6.1.13-dev.1 → 6.1.13-dev.13
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 +213 -51
- 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",
|
|
@@ -56104,9 +56105,29 @@ var import_client = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
56104
56105
|
var DESTROYED_ERR_MSG = "[@pdfme/ui] this instance is already destroyed";
|
|
56105
56106
|
var SELECTABLE_CLASSNAME = "selectable";
|
|
56106
56107
|
var BACKGROUND_COLOR = "rgb(74, 74, 74)";
|
|
56108
|
+
var PAGE_SWITCH_REMAINING_RATIO = .25;
|
|
56107
56109
|
var DESIGNER_CLASSNAME = "pdfme-designer-";
|
|
56108
56110
|
var UI_CLASSNAME = "pdfme-ui-";
|
|
56109
56111
|
//#endregion
|
|
56112
|
+
//#region src/containerSize.ts
|
|
56113
|
+
var visibleIntersection = (start, end, viewportSize) => Math.max(0, Math.min(end, viewportSize) - Math.max(start, 0));
|
|
56114
|
+
var capOverflowToViewport = (layout, visible, viewportSize) => layout > viewportSize ? Math.min(layout, visible) : layout;
|
|
56115
|
+
var measureUiContainerSize = (container, viewport) => {
|
|
56116
|
+
const layoutWidth = container.clientWidth || viewport.width;
|
|
56117
|
+
const layoutHeight = container.clientHeight || viewport.height;
|
|
56118
|
+
const rect = container.getBoundingClientRect();
|
|
56119
|
+
const visibleWidth = visibleIntersection(rect.left, rect.right, viewport.width);
|
|
56120
|
+
const visibleHeight = visibleIntersection(rect.top, rect.bottom, viewport.height);
|
|
56121
|
+
if (visibleWidth === 0 || visibleHeight === 0) return {
|
|
56122
|
+
height: layoutHeight,
|
|
56123
|
+
width: layoutWidth
|
|
56124
|
+
};
|
|
56125
|
+
return {
|
|
56126
|
+
height: capOverflowToViewport(layoutHeight, visibleHeight, viewport.height),
|
|
56127
|
+
width: capOverflowToViewport(layoutWidth, visibleWidth, viewport.width)
|
|
56128
|
+
};
|
|
56129
|
+
};
|
|
56130
|
+
//#endregion
|
|
56110
56131
|
//#region ../../node_modules/hotkeys-js/dist/hotkeys-js.js
|
|
56111
56132
|
/*!
|
|
56112
56133
|
* hotkeys-js v4.0.7
|
|
@@ -57348,6 +57369,113 @@ var dictionaries = {
|
|
|
57348
57369
|
"schemas.list.indentItem": "เพิ่มย่อหน้า",
|
|
57349
57370
|
"schemas.list.outdentItem": "ลดย่อหน้า"
|
|
57350
57371
|
},
|
|
57372
|
+
tr: {
|
|
57373
|
+
cancel: "İptal",
|
|
57374
|
+
close: "Kapat",
|
|
57375
|
+
clear: "Temizle",
|
|
57376
|
+
set: "Ayarla",
|
|
57377
|
+
field: "alan",
|
|
57378
|
+
fieldName: "Ad",
|
|
57379
|
+
align: "Hizala",
|
|
57380
|
+
width: "Genişlik",
|
|
57381
|
+
height: "Yükseklik",
|
|
57382
|
+
opacity: "Opaklık",
|
|
57383
|
+
rotate: "Döndür",
|
|
57384
|
+
required: "Zorunlu",
|
|
57385
|
+
editable: "Düzenlenebilir",
|
|
57386
|
+
edit: "Düzenle",
|
|
57387
|
+
plsInputName: "Lütfen bir ad girin",
|
|
57388
|
+
fieldMustUniq: "Alan adı benzersiz olmalı",
|
|
57389
|
+
notUniq: "(Benzersiz olmayan ad)",
|
|
57390
|
+
noKeyName: "Adsız",
|
|
57391
|
+
fieldsList: "Alan Listesi",
|
|
57392
|
+
editField: "Alanı Düzenle",
|
|
57393
|
+
type: "Tür",
|
|
57394
|
+
errorOccurred: "Bir hata oluştu",
|
|
57395
|
+
errorBulkUpdateFieldName: "Öğe sayısı değiştiği için değişiklik kaydedilemedi.",
|
|
57396
|
+
commitBulkUpdateFieldName: "Değişiklikleri Kaydet",
|
|
57397
|
+
bulkUpdateFieldName: "Alan adlarını toplu güncelle",
|
|
57398
|
+
addPageAfter: "Sonrasına Sayfa Ekle",
|
|
57399
|
+
removePage: "Mevcut Sayfayı Kaldır",
|
|
57400
|
+
removePageConfirm: "Bu sayfayı silmek istediğinizden emin misiniz? Bu işlem geri alınamaz.",
|
|
57401
|
+
zoomIn: "Yakınlaştır",
|
|
57402
|
+
zoomOut: "Uzaklaştır",
|
|
57403
|
+
fitWidth: "Genişliğe sığdır",
|
|
57404
|
+
fitHeight: "Yüksekliğe sığdır",
|
|
57405
|
+
"validation.hexColor": "Lütfen geçerli bir hex renk kodu girin.",
|
|
57406
|
+
"validation.uniqueName": "Lütfen benzersiz bir ad girin.",
|
|
57407
|
+
"validation.dateTimeFormat": "Geçersiz tarih saat biçimi.",
|
|
57408
|
+
"validation.outOfBounds": "Sayfa sınırlarını aşıyor.",
|
|
57409
|
+
"schemas.color": "Renk",
|
|
57410
|
+
"schemas.borderWidth": "Kenarlık Genişliği",
|
|
57411
|
+
"schemas.borderColor": "Kenarlık Rengi",
|
|
57412
|
+
"schemas.backgroundColor": "Arka Plan Rengi",
|
|
57413
|
+
"schemas.textColor": "Metin Rengi",
|
|
57414
|
+
"schemas.bgColor": "Arka Plan Rengi",
|
|
57415
|
+
"schemas.horizontal": "Yatay",
|
|
57416
|
+
"schemas.vertical": "Dikey",
|
|
57417
|
+
"schemas.left": "Sol",
|
|
57418
|
+
"schemas.center": "Orta",
|
|
57419
|
+
"schemas.right": "Sağ",
|
|
57420
|
+
"schemas.top": "Üst",
|
|
57421
|
+
"schemas.middle": "Orta",
|
|
57422
|
+
"schemas.bottom": "Alt",
|
|
57423
|
+
"schemas.padding": "İç Boşluk",
|
|
57424
|
+
"schemas.text.fontName": "Yazı Tipi Adı",
|
|
57425
|
+
"schemas.text.size": "Boyut",
|
|
57426
|
+
"schemas.text.spacing": "Aralık",
|
|
57427
|
+
"schemas.text.textAlign": "Metin Hizası",
|
|
57428
|
+
"schemas.text.verticalAlign": "Dikey Hizalama",
|
|
57429
|
+
"schemas.text.lineHeight": "Satır Yüksekliği",
|
|
57430
|
+
"schemas.text.min": "En Az",
|
|
57431
|
+
"schemas.text.max": "En Çok",
|
|
57432
|
+
"schemas.text.fit": "Sığdır",
|
|
57433
|
+
"schemas.text.dynamicFontSize": "Dinamik Yazı Tipi Boyutu",
|
|
57434
|
+
"schemas.text.overflow": "Taşma",
|
|
57435
|
+
"schemas.text.overflowVisible": "Görünür",
|
|
57436
|
+
"schemas.text.overflowExpand": "Genişlet",
|
|
57437
|
+
"schemas.text.format": "Biçim",
|
|
57438
|
+
"schemas.text.plain": "Düz",
|
|
57439
|
+
"schemas.text.inlineMarkdown": "Satır İçi Markdown Kullan",
|
|
57440
|
+
"schemas.text.markdownFonts": "Markdown Yazı Tipleri",
|
|
57441
|
+
"schemas.text.boldFont": "Kalın Yazı Tipi",
|
|
57442
|
+
"schemas.text.italicFont": "İtalik Yazı Tipi",
|
|
57443
|
+
"schemas.text.boldItalicFont": "Kalın İtalik Yazı Tipi",
|
|
57444
|
+
"schemas.text.codeFont": "Kod Yazı Tipi",
|
|
57445
|
+
"schemas.text.variantFallback": "Varyant Geri Dönüşü",
|
|
57446
|
+
"schemas.text.synthetic": "Yapay Stil",
|
|
57447
|
+
"schemas.text.error": "Hata",
|
|
57448
|
+
"schemas.radius": "Yarıçap",
|
|
57449
|
+
"schemas.mvt.typingInstructions": "Değişken eklemek için süslü parantez içine kelime yazın, örneğin",
|
|
57450
|
+
"schemas.mvt.sampleField": "ad",
|
|
57451
|
+
"schemas.mvt.variablesSampleData": "Değişken Örnek Verisi",
|
|
57452
|
+
"schemas.mvt.placeholderDynamicVariable": "Yer Tutucu Dinamik Değişken",
|
|
57453
|
+
"schemas.barcodes.barColor": "Çubuk Rengi",
|
|
57454
|
+
"schemas.barcodes.includetext": "Metni Dahil Et",
|
|
57455
|
+
"schemas.table.alternateBackgroundColor": "Alternatif Arka Plan Rengi",
|
|
57456
|
+
"schemas.table.tableStyle": "Tablo Stili",
|
|
57457
|
+
"schemas.table.showHead": "Başlığı Göster",
|
|
57458
|
+
"schemas.table.repeatHead": "Başlığı Tekrarla",
|
|
57459
|
+
"schemas.table.headStyle": "Başlık Stili",
|
|
57460
|
+
"schemas.table.bodyStyle": "Gövde Stili",
|
|
57461
|
+
"schemas.table.columnStyle": "Sütun Stili",
|
|
57462
|
+
"schemas.date.format": "Tarih Biçimi",
|
|
57463
|
+
"schemas.date.locale": "Yerel Ayar",
|
|
57464
|
+
"schemas.select.options": "Seçenekler",
|
|
57465
|
+
"schemas.select.optionPlaceholder": "Bir seçenek girin",
|
|
57466
|
+
"schemas.radioGroup.groupName": "Grup Adı",
|
|
57467
|
+
"schemas.list.listStyle": "Liste Stili",
|
|
57468
|
+
"schemas.list.bullet": "Madde İşaretli",
|
|
57469
|
+
"schemas.list.ordered": "Numaralı",
|
|
57470
|
+
"schemas.list.markerWidth": "İşaret Genişliği",
|
|
57471
|
+
"schemas.list.markerGap": "İşaret Aralığı",
|
|
57472
|
+
"schemas.list.indentSize": "Girinti Boyutu",
|
|
57473
|
+
"schemas.list.itemSpacing": "Öğe Aralığı",
|
|
57474
|
+
"schemas.list.addItem": "Öğe Ekle",
|
|
57475
|
+
"schemas.list.removeItem": "Öğe Kaldır",
|
|
57476
|
+
"schemas.list.indentItem": "Girintiyi Artır",
|
|
57477
|
+
"schemas.list.outdentItem": "Girintiyi Azalt"
|
|
57478
|
+
},
|
|
57351
57479
|
it: {
|
|
57352
57480
|
cancel: "Annulla",
|
|
57353
57481
|
close: "Chiudi",
|
|
@@ -77054,6 +77182,25 @@ var uuid$13 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c)
|
|
|
77054
77182
|
const r = Math.random() * 16 | 0;
|
|
77055
77183
|
return (c == "x" ? r : r & 3 | 8).toString(16);
|
|
77056
77184
|
});
|
|
77185
|
+
/**
|
|
77186
|
+
* Assigns runtime UI ids that stay stable for a Designer/Viewer/Form session.
|
|
77187
|
+
* Caller/template ids are ignored: Schema.passthrough() can carry values that
|
|
77188
|
+
* break `#text-{id}` querySelector (e.g. `foo[`). Save paths still strip ids.
|
|
77189
|
+
*/
|
|
77190
|
+
var stabilizeSchemaIds = (schemas, idMap) => schemas.map((schema, index) => {
|
|
77191
|
+
const key = schema.name || `index:${index}`;
|
|
77192
|
+
const existingId = idMap.get(key);
|
|
77193
|
+
if (existingId) return {
|
|
77194
|
+
...schema,
|
|
77195
|
+
id: existingId
|
|
77196
|
+
};
|
|
77197
|
+
const id = uuid$13();
|
|
77198
|
+
idMap.set(key, id);
|
|
77199
|
+
return {
|
|
77200
|
+
...schema,
|
|
77201
|
+
id
|
|
77202
|
+
};
|
|
77203
|
+
});
|
|
77057
77204
|
var set$3 = (obj, path, value) => {
|
|
77058
77205
|
path = Array.isArray(path) ? path : path.replace(/\[/g, ".").replace(/\]/g, "").split(".");
|
|
77059
77206
|
let src = obj;
|
|
@@ -77316,6 +77463,44 @@ var moveCommandToChangeSchemasArg = (props) => {
|
|
|
77316
77463
|
var getPagesScrollTopByIndex = (pageSizes, index, scale) => {
|
|
77317
77464
|
return pageSizes.slice(0, index).reduce((acc, cur) => acc + (cur.height * ZOOM + 30 * scale) * scale, 0);
|
|
77318
77465
|
};
|
|
77466
|
+
var getVisibleOverlap = (containerRect, elementRect) => {
|
|
77467
|
+
const width = Math.max(0, Math.min(containerRect.right, elementRect.right) - Math.max(containerRect.left, elementRect.left));
|
|
77468
|
+
const height = Math.max(0, Math.min(containerRect.bottom, elementRect.bottom) - Math.max(containerRect.top, elementRect.top));
|
|
77469
|
+
return {
|
|
77470
|
+
width,
|
|
77471
|
+
height,
|
|
77472
|
+
area: width * height
|
|
77473
|
+
};
|
|
77474
|
+
};
|
|
77475
|
+
var VERTICAL_SCROLL_EDGE_EPSILON = 1;
|
|
77476
|
+
var isAtVerticalScrollEdge = (container) => {
|
|
77477
|
+
const maxScrollTop = container.scrollHeight - container.clientHeight;
|
|
77478
|
+
if (maxScrollTop <= 0) return false;
|
|
77479
|
+
const { scrollTop } = container;
|
|
77480
|
+
return scrollTop <= VERTICAL_SCROLL_EDGE_EPSILON || scrollTop >= maxScrollTop - VERTICAL_SCROLL_EDGE_EPSILON;
|
|
77481
|
+
};
|
|
77482
|
+
var getStickyScrollPageIndex = (container, papers, pageCursor) => {
|
|
77483
|
+
const containerRect = container.getBoundingClientRect();
|
|
77484
|
+
const stickyHeight = containerRect.height * PAGE_SWITCH_REMAINING_RATIO;
|
|
77485
|
+
let bestPageIndex = pageCursor;
|
|
77486
|
+
let bestVisibleArea = 0;
|
|
77487
|
+
let currentVisibleHeight = 0;
|
|
77488
|
+
let currentVisibleArea = 0;
|
|
77489
|
+
papers.forEach((paper, pageIndex) => {
|
|
77490
|
+
if (!paper) return;
|
|
77491
|
+
const { height, area } = getVisibleOverlap(containerRect, paper.getBoundingClientRect());
|
|
77492
|
+
if (pageIndex === pageCursor) {
|
|
77493
|
+
currentVisibleHeight = height;
|
|
77494
|
+
currentVisibleArea = area;
|
|
77495
|
+
}
|
|
77496
|
+
if (area > bestVisibleArea) {
|
|
77497
|
+
bestVisibleArea = area;
|
|
77498
|
+
bestPageIndex = pageIndex;
|
|
77499
|
+
}
|
|
77500
|
+
});
|
|
77501
|
+
if (bestVisibleArea <= 0) return pageCursor;
|
|
77502
|
+
return !isAtVerticalScrollEdge(container) && currentVisibleArea > 0 && currentVisibleHeight >= stickyHeight ? pageCursor : bestPageIndex;
|
|
77503
|
+
};
|
|
77319
77504
|
var MIN_ZOOM = .25;
|
|
77320
77505
|
var FIT_GUTTER = 40;
|
|
77321
77506
|
var clampZoomLevel = (zoomLevel, maxZoom, minZoom = MIN_ZOOM) => Math.min(Math.max(zoomLevel, minZoom), maxZoom);
|
|
@@ -77436,15 +77621,10 @@ var BaseUIClass = class {
|
|
|
77436
77621
|
_defineProperty$14(this, "options", {});
|
|
77437
77622
|
_defineProperty$14(this, "setSize", debounce$2(() => {
|
|
77438
77623
|
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
|
-
};
|
|
77624
|
+
this.size = measureUiContainerSize(this.domContainer, {
|
|
77625
|
+
height: window.innerHeight,
|
|
77626
|
+
width: window.innerWidth
|
|
77627
|
+
});
|
|
77448
77628
|
this.render();
|
|
77449
77629
|
}, 100));
|
|
77450
77630
|
_defineProperty$14(this, "resizeObserver", new ResizeObserver(this.setSize));
|
|
@@ -77454,10 +77634,10 @@ var BaseUIClass = class {
|
|
|
77454
77634
|
this.template = cloneDeep$1(template);
|
|
77455
77635
|
this.options = options;
|
|
77456
77636
|
const container = this.domContainer;
|
|
77457
|
-
this.size = {
|
|
77458
|
-
height:
|
|
77459
|
-
width:
|
|
77460
|
-
};
|
|
77637
|
+
this.size = measureUiContainerSize(container, {
|
|
77638
|
+
height: window.innerHeight,
|
|
77639
|
+
width: window.innerWidth
|
|
77640
|
+
});
|
|
77461
77641
|
this.resizeObserver.observe(container);
|
|
77462
77642
|
const { lang, font } = options;
|
|
77463
77643
|
if (lang) this.lang = lang;
|
|
@@ -88030,7 +88210,7 @@ function getPxValue$5(val) {
|
|
|
88030
88210
|
/**
|
|
88031
88211
|
* Get visible area of element
|
|
88032
88212
|
*/
|
|
88033
|
-
function getVisibleArea$
|
|
88213
|
+
function getVisibleArea$5(initArea, scrollerList) {
|
|
88034
88214
|
const visibleArea = { ...initArea };
|
|
88035
88215
|
(scrollerList || []).forEach((ele) => {
|
|
88036
88216
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -88208,8 +88388,8 @@ function useAlign$5(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
88208
88388
|
const VISIBLE_FIRST = "visibleFirst";
|
|
88209
88389
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
88210
88390
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
88211
|
-
const scrollRegionArea = getVisibleArea$
|
|
88212
|
-
const visibleRegionArea = getVisibleArea$
|
|
88391
|
+
const scrollRegionArea = getVisibleArea$5(scrollRegion, scrollerList);
|
|
88392
|
+
const visibleRegionArea = getVisibleArea$5(visibleRegion, scrollerList);
|
|
88213
88393
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
88214
88394
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
88215
88395
|
popupElement.style.left = "auto";
|
|
@@ -95506,7 +95686,7 @@ function getPxValue$4(val) {
|
|
|
95506
95686
|
/**
|
|
95507
95687
|
* Get visible area of element
|
|
95508
95688
|
*/
|
|
95509
|
-
function getVisibleArea$
|
|
95689
|
+
function getVisibleArea$4(initArea, scrollerList) {
|
|
95510
95690
|
const visibleArea = { ...initArea };
|
|
95511
95691
|
(scrollerList || []).forEach((ele) => {
|
|
95512
95692
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -95684,8 +95864,8 @@ function useAlign$4(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
95684
95864
|
const VISIBLE_FIRST = "visibleFirst";
|
|
95685
95865
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
95686
95866
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
95687
|
-
const scrollRegionArea = getVisibleArea$
|
|
95688
|
-
const visibleRegionArea = getVisibleArea$
|
|
95867
|
+
const scrollRegionArea = getVisibleArea$4(scrollRegion, scrollerList);
|
|
95868
|
+
const visibleRegionArea = getVisibleArea$4(visibleRegion, scrollerList);
|
|
95689
95869
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
95690
95870
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
95691
95871
|
popupElement.style.left = "auto";
|
|
@@ -101632,7 +101812,7 @@ function getPxValue$3(val) {
|
|
|
101632
101812
|
/**
|
|
101633
101813
|
* Get visible area of element
|
|
101634
101814
|
*/
|
|
101635
|
-
function getVisibleArea$
|
|
101815
|
+
function getVisibleArea$3(initArea, scrollerList) {
|
|
101636
101816
|
const visibleArea = { ...initArea };
|
|
101637
101817
|
(scrollerList || []).forEach((ele) => {
|
|
101638
101818
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -101810,8 +101990,8 @@ function useAlign$3(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
101810
101990
|
const VISIBLE_FIRST = "visibleFirst";
|
|
101811
101991
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
101812
101992
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
101813
|
-
const scrollRegionArea = getVisibleArea$
|
|
101814
|
-
const visibleRegionArea = getVisibleArea$
|
|
101993
|
+
const scrollRegionArea = getVisibleArea$3(scrollRegion, scrollerList);
|
|
101994
|
+
const visibleRegionArea = getVisibleArea$3(visibleRegion, scrollerList);
|
|
101815
101995
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
101816
101996
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
101817
101997
|
popupElement.style.left = "auto";
|
|
@@ -103998,7 +104178,7 @@ function getPxValue$2(val) {
|
|
|
103998
104178
|
/**
|
|
103999
104179
|
* Get visible area of element
|
|
104000
104180
|
*/
|
|
104001
|
-
function getVisibleArea$
|
|
104181
|
+
function getVisibleArea$2(initArea, scrollerList) {
|
|
104002
104182
|
const visibleArea = { ...initArea };
|
|
104003
104183
|
(scrollerList || []).forEach((ele) => {
|
|
104004
104184
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -104176,8 +104356,8 @@ function useAlign$2(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
104176
104356
|
const VISIBLE_FIRST = "visibleFirst";
|
|
104177
104357
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
104178
104358
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
104179
|
-
const scrollRegionArea = getVisibleArea$
|
|
104180
|
-
const visibleRegionArea = getVisibleArea$
|
|
104359
|
+
const scrollRegionArea = getVisibleArea$2(scrollRegion, scrollerList);
|
|
104360
|
+
const visibleRegionArea = getVisibleArea$2(visibleRegion, scrollerList);
|
|
104181
104361
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
104182
104362
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
104183
104363
|
popupElement.style.left = "auto";
|
|
@@ -106054,7 +106234,7 @@ function getPxValue$1(val) {
|
|
|
106054
106234
|
/**
|
|
106055
106235
|
* Get visible area of element
|
|
106056
106236
|
*/
|
|
106057
|
-
function getVisibleArea$
|
|
106237
|
+
function getVisibleArea$1(initArea, scrollerList) {
|
|
106058
106238
|
const visibleArea = { ...initArea };
|
|
106059
106239
|
(scrollerList || []).forEach((ele) => {
|
|
106060
106240
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -106232,8 +106412,8 @@ function useAlign$1(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
106232
106412
|
const VISIBLE_FIRST = "visibleFirst";
|
|
106233
106413
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
106234
106414
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
106235
|
-
const scrollRegionArea = getVisibleArea$
|
|
106236
|
-
const visibleRegionArea = getVisibleArea$
|
|
106415
|
+
const scrollRegionArea = getVisibleArea$1(scrollRegion, scrollerList);
|
|
106416
|
+
const visibleRegionArea = getVisibleArea$1(visibleRegion, scrollerList);
|
|
106237
106417
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
106238
106418
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
106239
106419
|
popupElement.style.left = "auto";
|
|
@@ -122369,27 +122549,10 @@ var useZoom = ({ baseScale, maxZoom, pageCursor, pageSizes, containerRef, paperR
|
|
|
122369
122549
|
fitHeight: () => fitZoom("fit-height")
|
|
122370
122550
|
};
|
|
122371
122551
|
};
|
|
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
122552
|
var useScrollPageCursor = ({ ref, paperRefs, pageSizes, scale, pageCursor, onChangePageCursor }) => {
|
|
122390
122553
|
const onScroll = (0, import_react$9.useCallback)(() => {
|
|
122391
122554
|
if (!pageSizes[0] || !ref.current) return;
|
|
122392
|
-
const _pageCursor =
|
|
122555
|
+
const _pageCursor = getStickyScrollPageIndex(ref.current, paperRefs.current, pageCursor);
|
|
122393
122556
|
if (_pageCursor !== pageCursor) onChangePageCursor(_pageCursor);
|
|
122394
122557
|
}, [
|
|
122395
122558
|
onChangePageCursor,
|
|
@@ -225690,12 +225853,11 @@ var Padding = ({ basePdf }) => {
|
|
|
225690
225853
|
//#region src/components/StaticSchema.tsx
|
|
225691
225854
|
var StaticSchema = (props) => {
|
|
225692
225855
|
const { template: { schemas, basePdf }, input, scale, totalPages, currentPage } = props;
|
|
225856
|
+
const [staticSchemaIds] = (0, import_react$9.useState)(() => /* @__PURE__ */ new Map());
|
|
225693
225857
|
if (!isBlankPdf(basePdf) || !basePdf.staticSchema) return null;
|
|
225694
|
-
|
|
225695
|
-
|
|
225696
|
-
|
|
225697
|
-
id: uuid$13()
|
|
225698
|
-
},
|
|
225858
|
+
const schemasForUI = stabilizeSchemaIds(basePdf.staticSchema, staticSchemaIds);
|
|
225859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: schemasForUI.map((schema) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Renderer, {
|
|
225860
|
+
schema,
|
|
225699
225861
|
basePdf,
|
|
225700
225862
|
value: schema.readOnly ? replacePlaceholders({
|
|
225701
225863
|
content: schema.content || "",
|