@pdfme/ui 6.1.5-dev.10 → 6.1.5-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/components/CtlBar.d.ts +4 -0
- package/dist/components/Designer/Canvas/index.d.ts +1 -0
- package/dist/helper.d.ts +31 -0
- package/dist/hooks.d.ts +26 -2
- package/dist/index.js +628 -130
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46080,6 +46080,10 @@ object$1({
|
|
|
46080
46080
|
addPageAfter: string$1(),
|
|
46081
46081
|
removePage: string$1(),
|
|
46082
46082
|
removePageConfirm: string$1(),
|
|
46083
|
+
zoomIn: string$1(),
|
|
46084
|
+
zoomOut: string$1(),
|
|
46085
|
+
fitWidth: string$1(),
|
|
46086
|
+
fitHeight: string$1(),
|
|
46083
46087
|
"validation.uniqueName": string$1(),
|
|
46084
46088
|
"validation.hexColor": string$1(),
|
|
46085
46089
|
"validation.dateTimeFormat": string$1(),
|
|
@@ -81891,6 +81895,10 @@ var dictionaries = {
|
|
|
81891
81895
|
addPageAfter: "Add Page After",
|
|
81892
81896
|
removePage: "Remove Current Page",
|
|
81893
81897
|
removePageConfirm: "Are you sure you want to delete this page? This action cannot be undone.",
|
|
81898
|
+
zoomIn: "Zoom in",
|
|
81899
|
+
zoomOut: "Zoom out",
|
|
81900
|
+
fitWidth: "Fit width",
|
|
81901
|
+
fitHeight: "Fit height",
|
|
81894
81902
|
"validation.hexColor": "Please enter a valid hex color code.",
|
|
81895
81903
|
"validation.uniqueName": "Please enter a unique name.",
|
|
81896
81904
|
"validation.dateTimeFormat": "Invalid date time format.",
|
|
@@ -81994,6 +82002,10 @@ var dictionaries = {
|
|
|
81994
82002
|
addPageAfter: "在之后添加页面",
|
|
81995
82003
|
removePage: "删除当前页面",
|
|
81996
82004
|
removePageConfirm: "您确定要删除此页面吗?此操作无法撤销。",
|
|
82005
|
+
zoomIn: "放大",
|
|
82006
|
+
zoomOut: "缩小",
|
|
82007
|
+
fitWidth: "适合宽度",
|
|
82008
|
+
fitHeight: "适合高度",
|
|
81997
82009
|
"validation.hexColor": "请输入有效的十六进制颜色代码。",
|
|
81998
82010
|
"validation.uniqueName": "请输入一个唯一的名称。",
|
|
81999
82011
|
"validation.dateTimeFormat": "日期时间格式无效。",
|
|
@@ -82097,6 +82109,10 @@ var dictionaries = {
|
|
|
82097
82109
|
addPageAfter: "次にページを追加",
|
|
82098
82110
|
removePage: "現在のページを削除",
|
|
82099
82111
|
removePageConfirm: "ページを削除してもよろしいですか?この操作は元に戻せません。",
|
|
82112
|
+
zoomIn: "拡大",
|
|
82113
|
+
zoomOut: "縮小",
|
|
82114
|
+
fitWidth: "横幅に合わせる",
|
|
82115
|
+
fitHeight: "高さに合わせる",
|
|
82100
82116
|
"validation.hexColor": "有効な16進数のカラーコードを入力してください。",
|
|
82101
82117
|
"validation.uniqueName": "一意の名前を入力してください。",
|
|
82102
82118
|
"validation.dateTimeFormat": "日付と時刻のフォーマットが無効です。",
|
|
@@ -82200,6 +82216,10 @@ var dictionaries = {
|
|
|
82200
82216
|
addPageAfter: "다음에 페이지 추가",
|
|
82201
82217
|
removePage: "현재 페이지 제거",
|
|
82202
82218
|
removePageConfirm: "이 페이지를 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.",
|
|
82219
|
+
zoomIn: "확대",
|
|
82220
|
+
zoomOut: "축소",
|
|
82221
|
+
fitWidth: "너비에 맞춤",
|
|
82222
|
+
fitHeight: "높이에 맞춤",
|
|
82203
82223
|
"validation.hexColor": "유효한 16진수 색상 코드를 입력하세요.",
|
|
82204
82224
|
"validation.uniqueName": "고유한 이름을 입력하세요.",
|
|
82205
82225
|
"validation.dateTimeFormat": "날짜/시간 형식이 잘못되었습니다.",
|
|
@@ -82303,6 +82323,10 @@ var dictionaries = {
|
|
|
82303
82323
|
addPageAfter: "إضافة صفحة بعد",
|
|
82304
82324
|
removePage: "احذف الصفحة الحالية",
|
|
82305
82325
|
removePageConfirm: "هل أنت متأكد من رغبتك في حذف هذه الصفحة؟ لا يمكن التراجع عن هذا الإجراء.",
|
|
82326
|
+
zoomIn: "تكبير",
|
|
82327
|
+
zoomOut: "تصغير",
|
|
82328
|
+
fitWidth: "ملاءمة العرض",
|
|
82329
|
+
fitHeight: "ملاءمة الارتفاع",
|
|
82306
82330
|
"validation.hexColor": "الرجاء إدخال رمز لون سداسي عشري صالح.",
|
|
82307
82331
|
"validation.uniqueName": "الرجاء إدخال اسم فريد.",
|
|
82308
82332
|
"validation.dateTimeFormat": "تنسيق التاريخ والوقت غير صالح.",
|
|
@@ -82406,6 +82430,10 @@ var dictionaries = {
|
|
|
82406
82430
|
addPageAfter: "เพิ่มหน้าถัดไป",
|
|
82407
82431
|
removePage: "ลบหน้าปัจจุบัน",
|
|
82408
82432
|
removePageConfirm: "คุณแน่ใจหรือไม่ว่าต้องการลบหน้านี้? การกระทำนี้ไม่สามารถย้อนกลับได้",
|
|
82433
|
+
zoomIn: "ซูมเข้า",
|
|
82434
|
+
zoomOut: "ซูมออก",
|
|
82435
|
+
fitWidth: "พอดีกับความกว้าง",
|
|
82436
|
+
fitHeight: "พอดีกับความสูง",
|
|
82409
82437
|
"validation.hexColor": "กรุณาใส่รหัสสีแบบฐานสิบหกที่ถูกต้อง",
|
|
82410
82438
|
"validation.uniqueName": "กรุณาระบุชื่อที่ไม่ซ้ำ",
|
|
82411
82439
|
"validation.dateTimeFormat": "รูปแบบวันที่และเวลาไม่ถูกต้อง",
|
|
@@ -82509,6 +82537,10 @@ var dictionaries = {
|
|
|
82509
82537
|
addPageAfter: "Aggiungi pagina dopo",
|
|
82510
82538
|
removePage: "Rimuovi la Pagina Corrente",
|
|
82511
82539
|
removePageConfirm: "Sei sicuro di voler eliminare questa pagina? Questa azione non può essere annullata.",
|
|
82540
|
+
zoomIn: "Ingrandisci",
|
|
82541
|
+
zoomOut: "Riduci",
|
|
82542
|
+
fitWidth: "Adatta larghezza",
|
|
82543
|
+
fitHeight: "Adatta altezza",
|
|
82512
82544
|
"validation.hexColor": "Inserisci un codice colore esadecimale valido.",
|
|
82513
82545
|
"validation.uniqueName": "Inserisci un nome univoco.",
|
|
82514
82546
|
"validation.dateTimeFormat": "Formato data-ora non valido.",
|
|
@@ -82612,6 +82644,10 @@ var dictionaries = {
|
|
|
82612
82644
|
addPageAfter: "Dodaj stronę po",
|
|
82613
82645
|
removePage: "Usuń Bieżącą Stronę",
|
|
82614
82646
|
removePageConfirm: "Czy na pewno chcesz usunąć tę stronę? Tej operacji nie można cofnąć.",
|
|
82647
|
+
zoomIn: "Powiększ",
|
|
82648
|
+
zoomOut: "Pomniejsz",
|
|
82649
|
+
fitWidth: "Dopasuj szerokość",
|
|
82650
|
+
fitHeight: "Dopasuj wysokość",
|
|
82615
82651
|
"validation.hexColor": "Wprowadź poprawny kod koloru szesnastkowego.",
|
|
82616
82652
|
"validation.uniqueName": "Proszę wpisać unikalną nazwę.",
|
|
82617
82653
|
"validation.dateTimeFormat": "Nieprawidłowy format daty i godziny.",
|
|
@@ -82715,6 +82751,10 @@ var dictionaries = {
|
|
|
82715
82751
|
addPageAfter: "Seite danach hinzufügen",
|
|
82716
82752
|
removePage: "Aktuelle Seite entfernen",
|
|
82717
82753
|
removePageConfirm: "Sind Sie sicher, dass Sie diese Seite löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.",
|
|
82754
|
+
zoomIn: "Vergrößern",
|
|
82755
|
+
zoomOut: "Verkleinern",
|
|
82756
|
+
fitWidth: "Breite anpassen",
|
|
82757
|
+
fitHeight: "Höhe anpassen",
|
|
82718
82758
|
"validation.hexColor": "Bitte geben Sie einen gültigen Hex-Farbcode ein.",
|
|
82719
82759
|
"validation.uniqueName": "Bitte geben Sie einen eindeutigen Namen ein.",
|
|
82720
82760
|
"validation.dateTimeFormat": "Ungültiges Datums- und Zeitformat.",
|
|
@@ -82818,6 +82858,10 @@ var dictionaries = {
|
|
|
82818
82858
|
addPageAfter: "Insertar página",
|
|
82819
82859
|
removePage: "Eliminar página actual",
|
|
82820
82860
|
removePageConfirm: "¿Estás seguro de que quieres eliminar esta página? Esta acción no se puede deshacer.",
|
|
82861
|
+
zoomIn: "Acercar",
|
|
82862
|
+
zoomOut: "Alejar",
|
|
82863
|
+
fitWidth: "Ajustar ancho",
|
|
82864
|
+
fitHeight: "Ajustar alto",
|
|
82821
82865
|
"validation.hexColor": "Introduce un código de color hexadecimal válido.",
|
|
82822
82866
|
"validation.uniqueName": "Por favor, introduzca un nombre único.",
|
|
82823
82867
|
"validation.dateTimeFormat": "Formato de fecha y hora no válido.",
|
|
@@ -82921,6 +82965,10 @@ var dictionaries = {
|
|
|
82921
82965
|
addPageAfter: "Ajouter une page après",
|
|
82922
82966
|
removePage: "Supprimer la page actuelle",
|
|
82923
82967
|
removePageConfirm: "Êtes-vous sûr de vouloir supprimer cette page ? Cette action est irréversible.",
|
|
82968
|
+
zoomIn: "Zoom avant",
|
|
82969
|
+
zoomOut: "Zoom arrière",
|
|
82970
|
+
fitWidth: "Ajuster la largeur",
|
|
82971
|
+
fitHeight: "Ajuster la hauteur",
|
|
82924
82972
|
"validation.hexColor": "Veuillez entrer un code couleur hexadécimal valide.",
|
|
82925
82973
|
"validation.uniqueName": "Veuillez saisir un nom unique.",
|
|
82926
82974
|
"validation.dateTimeFormat": "Format de date et d'heure non valide.",
|
|
@@ -102430,6 +102478,35 @@ var moveCommandToChangeSchemasArg = (props) => {
|
|
|
102430
102478
|
var getPagesScrollTopByIndex = (pageSizes, index, scale) => {
|
|
102431
102479
|
return pageSizes.slice(0, index).reduce((acc, cur) => acc + (cur.height * ZOOM + 30 * scale) * scale, 0);
|
|
102432
102480
|
};
|
|
102481
|
+
var MIN_ZOOM = .25;
|
|
102482
|
+
var FIT_GUTTER = 40;
|
|
102483
|
+
var clampZoomLevel = (zoomLevel, maxZoom, minZoom = MIN_ZOOM) => Math.min(Math.max(zoomLevel, minZoom), maxZoom);
|
|
102484
|
+
var getFitZoomLevel = ({ mode, pageSize, container, baseScale, maxZoom, hasRulers = false }) => {
|
|
102485
|
+
if (baseScale <= 0) return 1;
|
|
102486
|
+
if (mode === "fit-height") return clampZoomLevel(1, maxZoom);
|
|
102487
|
+
if (!pageSize || !container) return 1;
|
|
102488
|
+
const rulerSize = hasRulers ? 30 : 0;
|
|
102489
|
+
return clampZoomLevel(Math.max(1, container.clientWidth - rulerSize - FIT_GUTTER) / (pageSize.width * ZOOM) / baseScale, maxZoom);
|
|
102490
|
+
};
|
|
102491
|
+
var getZoomAnchor = ({ pageIndex, paper, clientX, clientY, scale }) => {
|
|
102492
|
+
if (!paper || scale <= 0) return null;
|
|
102493
|
+
const rect = paper.getBoundingClientRect();
|
|
102494
|
+
return {
|
|
102495
|
+
pageIndex,
|
|
102496
|
+
localX: (clientX - rect.left) / scale,
|
|
102497
|
+
localY: (clientY - rect.top) / scale,
|
|
102498
|
+
clientX,
|
|
102499
|
+
clientY
|
|
102500
|
+
};
|
|
102501
|
+
};
|
|
102502
|
+
var restoreZoomAnchor = ({ container, paper, anchor, scale }) => {
|
|
102503
|
+
if (!container || !paper || !anchor || scale <= 0) return;
|
|
102504
|
+
const rect = paper.getBoundingClientRect();
|
|
102505
|
+
const nextClientX = rect.left + anchor.localX * scale;
|
|
102506
|
+
const nextClientY = rect.top + anchor.localY * scale;
|
|
102507
|
+
if (Number.isFinite(nextClientX)) container.scrollLeft += nextClientX - anchor.clientX;
|
|
102508
|
+
if (Number.isFinite(nextClientY)) container.scrollTop += nextClientY - anchor.clientY;
|
|
102509
|
+
};
|
|
102433
102510
|
var handlePositionSizeChange = (schema, key, value, basePdf, pageSize) => {
|
|
102434
102511
|
const [pt, pr, pb, pl] = isBlankPdf(basePdf) ? basePdf.padding : [
|
|
102435
102512
|
0,
|
|
@@ -105441,7 +105518,7 @@ function canUseDom$1() {
|
|
|
105441
105518
|
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
|
105442
105519
|
*/
|
|
105443
105520
|
var useInternalLayoutEffect$1 = canUseDom$1() ? import_react$9.useLayoutEffect : import_react$9.useEffect;
|
|
105444
|
-
var useLayoutEffect$
|
|
105521
|
+
var useLayoutEffect$7 = (callback, deps) => {
|
|
105445
105522
|
const firstMountRef = import_react$9.useRef(true);
|
|
105446
105523
|
useInternalLayoutEffect$1(() => {
|
|
105447
105524
|
return callback(firstMountRef.current);
|
|
@@ -105485,7 +105562,7 @@ var useSafeState$1 = (defaultValue) => {
|
|
|
105485
105562
|
function useControlledState(defaultStateValue, value) {
|
|
105486
105563
|
const [innerValue, setInnerValue] = (0, import_react$9.useState)(defaultStateValue);
|
|
105487
105564
|
const mergedValue = value !== void 0 ? value : innerValue;
|
|
105488
|
-
useLayoutEffect$
|
|
105565
|
+
useLayoutEffect$7((mount) => {
|
|
105489
105566
|
if (!mount) setInnerValue(value);
|
|
105490
105567
|
}, [value]);
|
|
105491
105568
|
return [mergedValue, setInnerValue];
|
|
@@ -105513,7 +105590,7 @@ var useId_default$2 = useOriginId$1 ? function useId(id) {
|
|
|
105513
105590
|
};
|
|
105514
105591
|
//#endregion
|
|
105515
105592
|
//#region node_modules/antd/node_modules/@rc-component/util/es/hooks/useMemo.js
|
|
105516
|
-
function useMemo$
|
|
105593
|
+
function useMemo$50(getValue, condition, shouldUpdate) {
|
|
105517
105594
|
const cacheRef = import_react$9.useRef({});
|
|
105518
105595
|
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
105519
105596
|
cacheRef.current.value = getValue();
|
|
@@ -105617,7 +105694,7 @@ var composeRef$1 = (...refs) => {
|
|
|
105617
105694
|
};
|
|
105618
105695
|
};
|
|
105619
105696
|
var useComposeRef$1 = (...refs) => {
|
|
105620
|
-
return useMemo$
|
|
105697
|
+
return useMemo$50(() => composeRef$1(...refs), refs, (prev, next) => prev.length !== next.length || prev.every((ref, i) => ref !== next[i]));
|
|
105621
105698
|
};
|
|
105622
105699
|
var supportRef$1 = (nodeOrComponent) => {
|
|
105623
105700
|
if (!nodeOrComponent) return false;
|
|
@@ -112579,13 +112656,13 @@ function useDom$1(render, debug) {
|
|
|
112579
112656
|
ele.parentElement?.removeChild(ele);
|
|
112580
112657
|
appendedRef.current = false;
|
|
112581
112658
|
}
|
|
112582
|
-
useLayoutEffect$
|
|
112659
|
+
useLayoutEffect$7(() => {
|
|
112583
112660
|
if (render) if (queueCreate) queueCreate(append);
|
|
112584
112661
|
else append();
|
|
112585
112662
|
else cleanup();
|
|
112586
112663
|
return cleanup;
|
|
112587
112664
|
}, [render]);
|
|
112588
|
-
useLayoutEffect$
|
|
112665
|
+
useLayoutEffect$7(() => {
|
|
112589
112666
|
if (queue.length) {
|
|
112590
112667
|
queue.forEach((appendFn) => appendFn());
|
|
112591
112668
|
setQueue(EMPTY_LIST$8);
|
|
@@ -112611,7 +112688,7 @@ function useScrollLocker$1(lock) {
|
|
|
112611
112688
|
uuid$6 += 1;
|
|
112612
112689
|
return `${UNIQUE_ID$1}_${uuid$6}`;
|
|
112613
112690
|
});
|
|
112614
|
-
useLayoutEffect$
|
|
112691
|
+
useLayoutEffect$7(() => {
|
|
112615
112692
|
if (mergedLock) {
|
|
112616
112693
|
const scrollbarSize = getTargetScrollBarSize$1(document.body).width;
|
|
112617
112694
|
updateCSS$1(`
|
|
@@ -112843,7 +112920,7 @@ var Popup$5 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
112843
112920
|
]);
|
|
112844
112921
|
const getPopupContainerNeedParams = getPopupContainer?.length > 0;
|
|
112845
112922
|
const [show, setShow] = import_react$9.useState(!getPopupContainer || !getPopupContainerNeedParams);
|
|
112846
|
-
useLayoutEffect$
|
|
112923
|
+
useLayoutEffect$7(() => {
|
|
112847
112924
|
if (!show && getPopupContainerNeedParams && target) setShow(true);
|
|
112848
112925
|
}, [
|
|
112849
112926
|
show,
|
|
@@ -113020,7 +113097,7 @@ function getPxValue$1(val) {
|
|
|
113020
113097
|
/**
|
|
113021
113098
|
* Get visible area of element
|
|
113022
113099
|
*/
|
|
113023
|
-
function getVisibleArea$
|
|
113100
|
+
function getVisibleArea$2(initArea, scrollerList) {
|
|
113024
113101
|
const visibleArea = { ...initArea };
|
|
113025
113102
|
(scrollerList || []).forEach((ele) => {
|
|
113026
113103
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -113196,8 +113273,8 @@ function useAlign$1(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
113196
113273
|
const VISIBLE_FIRST = "visibleFirst";
|
|
113197
113274
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
113198
113275
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
113199
|
-
const scrollRegionArea = getVisibleArea$
|
|
113200
|
-
const visibleRegionArea = getVisibleArea$
|
|
113276
|
+
const scrollRegionArea = getVisibleArea$2(scrollRegion, scrollerList);
|
|
113277
|
+
const visibleRegionArea = getVisibleArea$2(visibleRegion, scrollerList);
|
|
113201
113278
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
113202
113279
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
113203
113280
|
popupElement.style.left = "auto";
|
|
@@ -113390,8 +113467,8 @@ function useAlign$1(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
113390
113467
|
ready: false
|
|
113391
113468
|
}));
|
|
113392
113469
|
};
|
|
113393
|
-
useLayoutEffect$
|
|
113394
|
-
useLayoutEffect$
|
|
113470
|
+
useLayoutEffect$7(resetReady, [placement]);
|
|
113471
|
+
useLayoutEffect$7(() => {
|
|
113395
113472
|
if (!open) resetReady();
|
|
113396
113473
|
}, [open]);
|
|
113397
113474
|
return [
|
|
@@ -113435,7 +113512,7 @@ function useDelay() {
|
|
|
113435
113512
|
//#endregion
|
|
113436
113513
|
//#region node_modules/antd/node_modules/@rc-component/trigger/es/hooks/useWatch.js
|
|
113437
113514
|
function useWatch$3(open, target, popup, onAlign, onScroll) {
|
|
113438
|
-
useLayoutEffect$
|
|
113515
|
+
useLayoutEffect$7(() => {
|
|
113439
113516
|
if (open && target && popup) {
|
|
113440
113517
|
const targetElement = target;
|
|
113441
113518
|
const popupElement = popup;
|
|
@@ -113800,7 +113877,7 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113800
113877
|
id,
|
|
113801
113878
|
onEsc
|
|
113802
113879
|
}));
|
|
113803
|
-
useLayoutEffect$
|
|
113880
|
+
useLayoutEffect$7(() => {
|
|
113804
113881
|
if (uniqueContext && unique && targetEle && !openUncontrolled && !parentContext) if (mergedOpen) uniqueContext.show(getUniqueOptions(mouseEnterDelay), isOpen);
|
|
113805
113882
|
else uniqueContext.hide(mouseLeaveDelay);
|
|
113806
113883
|
}, [mergedOpen, targetEle]);
|
|
@@ -113836,7 +113913,7 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113836
113913
|
if (top) triggerOpen(false);
|
|
113837
113914
|
}
|
|
113838
113915
|
const [inMotion, setInMotion] = import_react$9.useState(false);
|
|
113839
|
-
useLayoutEffect$
|
|
113916
|
+
useLayoutEffect$7((firstMount) => {
|
|
113840
113917
|
if (!firstMount || mergedOpen) setInMotion(true);
|
|
113841
113918
|
}, [mergedOpen]);
|
|
113842
113919
|
const [motionPrepareResolve, setMotionPrepareResolve] = import_react$9.useState(null);
|
|
@@ -113855,10 +113932,10 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113855
113932
|
if (openRef.current && alignPoint && clickToHide) triggerOpen(false);
|
|
113856
113933
|
};
|
|
113857
113934
|
useWatch$3(mergedOpen, targetEle, popupEle, triggerAlign, onScroll);
|
|
113858
|
-
useLayoutEffect$
|
|
113935
|
+
useLayoutEffect$7(() => {
|
|
113859
113936
|
triggerAlign();
|
|
113860
113937
|
}, [mousePos, popupPlacement]);
|
|
113861
|
-
useLayoutEffect$
|
|
113938
|
+
useLayoutEffect$7(() => {
|
|
113862
113939
|
if (mergedOpen && !builtinPlacements?.[popupPlacement]) triggerAlign();
|
|
113863
113940
|
}, [JSON.stringify(popupAlign)]);
|
|
113864
113941
|
const alignedClassName = import_react$9.useMemo(() => {
|
|
@@ -113898,7 +113975,7 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113898
113975
|
syncTargetSize();
|
|
113899
113976
|
setMotionPrepareResolve(() => resolve);
|
|
113900
113977
|
});
|
|
113901
|
-
useLayoutEffect$
|
|
113978
|
+
useLayoutEffect$7(() => {
|
|
113902
113979
|
if (motionPrepareResolve) {
|
|
113903
113980
|
onAlign();
|
|
113904
113981
|
motionPrepareResolve();
|
|
@@ -114157,7 +114234,7 @@ function useTheme$1(theme, parentTheme, config) {
|
|
|
114157
114234
|
cssVar: parentTheme?.cssVar
|
|
114158
114235
|
} : parentTheme;
|
|
114159
114236
|
const themeKey = (0, import_react$9.useId)();
|
|
114160
|
-
return useMemo$
|
|
114237
|
+
return useMemo$50(() => {
|
|
114161
114238
|
if (!theme) return parentTheme;
|
|
114162
114239
|
const mergedComponents = { ...parentThemeConfig.components };
|
|
114163
114240
|
Object.keys(theme.components || {}).forEach((componentName) => {
|
|
@@ -114345,7 +114422,7 @@ var ProviderChildren$1 = (props) => {
|
|
|
114345
114422
|
autoInsertSpace: autoInsertSpaceInButton,
|
|
114346
114423
|
...config.button
|
|
114347
114424
|
};
|
|
114348
|
-
const memoedConfig = useMemo$
|
|
114425
|
+
const memoedConfig = useMemo$50(() => config, config, (prevConfig, currentConfig) => {
|
|
114349
114426
|
const prevKeys = Object.keys(prevConfig);
|
|
114350
114427
|
const currentKeys = Object.keys(currentConfig);
|
|
114351
114428
|
return prevKeys.length !== currentKeys.length || prevKeys.some((key) => prevConfig[key] !== currentConfig[key]);
|
|
@@ -116445,7 +116522,7 @@ var Button$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
116445
116522
|
isMountRef.current = true;
|
|
116446
116523
|
};
|
|
116447
116524
|
}, []);
|
|
116448
|
-
useLayoutEffect$
|
|
116525
|
+
useLayoutEffect$7(() => {
|
|
116449
116526
|
let delayTimer = null;
|
|
116450
116527
|
if (loadingOrDelay.delay > 0) delayTimer = setTimeout(() => {
|
|
116451
116528
|
delayTimer = null;
|
|
@@ -119645,7 +119722,7 @@ function useBreakpoint$1(refreshOnChange = true, defaultScreens = {}) {
|
|
|
119645
119722
|
const screensRef = (0, import_react$9.useRef)(defaultScreens);
|
|
119646
119723
|
const [, forceUpdate] = useForceUpdate$1();
|
|
119647
119724
|
const responsiveObserver = useResponsiveObserver$1();
|
|
119648
|
-
useLayoutEffect$
|
|
119725
|
+
useLayoutEffect$7(() => {
|
|
119649
119726
|
const token = responsiveObserver.subscribe((supportScreens) => {
|
|
119650
119727
|
screensRef.current = supportScreens;
|
|
119651
119728
|
if (refreshOnChange) forceUpdate();
|
|
@@ -120889,7 +120966,7 @@ function Overflow$1(props, ref) {
|
|
|
120889
120966
|
function getItemWidth(index) {
|
|
120890
120967
|
return itemWidths.get(getKey(mergedData[index], index));
|
|
120891
120968
|
}
|
|
120892
|
-
useLayoutEffect$
|
|
120969
|
+
useLayoutEffect$7(() => {
|
|
120893
120970
|
if (mergedContainerWidth && typeof mergedRestWidth === "number" && mergedData) {
|
|
120894
120971
|
let totalWidth = prefixWidth + suffixWidth;
|
|
120895
120972
|
const len = mergedData.length;
|
|
@@ -121031,7 +121108,7 @@ function mergeProps$2(origin, target) {
|
|
|
121031
121108
|
}
|
|
121032
121109
|
function InheritableContextProvider$1({ children, locked, ...restProps }) {
|
|
121033
121110
|
const context = import_react$9.useContext(MenuContext$3);
|
|
121034
|
-
const inheritableContext = useMemo$
|
|
121111
|
+
const inheritableContext = useMemo$50(() => mergeProps$2(context, restProps), [context, restProps], (prev, next) => !locked && (prev[0] !== next[0] || !isEqual$1(prev[1], next[1], true)));
|
|
121035
121112
|
return /* @__PURE__ */ import_react$9.createElement(MenuContext$3.Provider, { value: inheritableContext }, children);
|
|
121036
121113
|
}
|
|
121037
121114
|
//#endregion
|
|
@@ -126488,7 +126565,7 @@ var ResizableTextArea$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref)
|
|
|
126488
126565
|
const startResize = () => {
|
|
126489
126566
|
setResizeState(RESIZE_START$1);
|
|
126490
126567
|
};
|
|
126491
|
-
useLayoutEffect$
|
|
126568
|
+
useLayoutEffect$7(() => {
|
|
126492
126569
|
if (needAutoSize) startResize();
|
|
126493
126570
|
}, [
|
|
126494
126571
|
value,
|
|
@@ -126496,7 +126573,7 @@ var ResizableTextArea$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref)
|
|
|
126496
126573
|
maxRows,
|
|
126497
126574
|
needAutoSize
|
|
126498
126575
|
]);
|
|
126499
|
-
useLayoutEffect$
|
|
126576
|
+
useLayoutEffect$7(() => {
|
|
126500
126577
|
if (resizeState === RESIZE_START$1) setResizeState(RESIZE_MEASURING$1);
|
|
126501
126578
|
else if (resizeState === RESIZE_MEASURING$1) {
|
|
126502
126579
|
const textareaStyles = calculateAutoSizeStyle$1(textareaRef.current, false, minRows, maxRows);
|
|
@@ -127639,7 +127716,7 @@ var FormItemInput$1 = (props) => {
|
|
|
127639
127716
|
}, [formContext]);
|
|
127640
127717
|
const extraRef = import_react$9.useRef(null);
|
|
127641
127718
|
const [extraHeight, setExtraHeight] = import_react$9.useState(0);
|
|
127642
|
-
useLayoutEffect$
|
|
127719
|
+
useLayoutEffect$7(() => {
|
|
127643
127720
|
if (extra && extraRef.current) setExtraHeight(extraRef.current.clientHeight);
|
|
127644
127721
|
else setExtraHeight(0);
|
|
127645
127722
|
}, [extra]);
|
|
@@ -127837,7 +127914,7 @@ function ItemHolder$1(props) {
|
|
|
127837
127914
|
const hasError = !!(hasHelp || errors.length || warnings.length);
|
|
127838
127915
|
const isOnScreen = !!itemRef.current && isVisible_default$1(itemRef.current);
|
|
127839
127916
|
const [marginBottom, setMarginBottom] = import_react$9.useState(null);
|
|
127840
|
-
useLayoutEffect$
|
|
127917
|
+
useLayoutEffect$7(() => {
|
|
127841
127918
|
if (hasError && itemRef.current) {
|
|
127842
127919
|
const itemStyle = getComputedStyle(itemRef.current);
|
|
127843
127920
|
setMarginBottom(Number.parseInt(itemStyle.marginBottom, 10));
|
|
@@ -128257,7 +128334,7 @@ var OTPInput$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
128257
128334
|
function strToArr$1(str) {
|
|
128258
128335
|
return (str || "").split("");
|
|
128259
128336
|
}
|
|
128260
|
-
var Separator$
|
|
128337
|
+
var Separator$2 = (props) => {
|
|
128261
128338
|
const { index, prefixCls, separator, className: semanticClassName, style: semanticStyle } = props;
|
|
128262
128339
|
const separatorNode = isFunction$4(separator) ? separator(index) : separator;
|
|
128263
128340
|
if (!separatorNode) return null;
|
|
@@ -128384,7 +128461,7 @@ var OTP$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
128384
128461
|
autoFocus: index === 0 && autoFocus,
|
|
128385
128462
|
onFocus: (event) => onInputFocus(event, index),
|
|
128386
128463
|
...inputSharedProps
|
|
128387
|
-
}), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator$
|
|
128464
|
+
}), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator$2, {
|
|
128388
128465
|
separator,
|
|
128389
128466
|
index,
|
|
128390
128467
|
prefixCls,
|
|
@@ -130678,7 +130755,7 @@ function EllipsisMeasure(props) {
|
|
|
130678
130755
|
const [needEllipsis, setNeedEllipsis] = import_react$9.useState(STATUS_MEASURE_NONE);
|
|
130679
130756
|
const [ellipsisHeight, setEllipsisHeight] = import_react$9.useState(0);
|
|
130680
130757
|
const [parentWhiteSpace, setParentWhiteSpace] = import_react$9.useState(null);
|
|
130681
|
-
useLayoutEffect$
|
|
130758
|
+
useLayoutEffect$7(() => {
|
|
130682
130759
|
if (enableMeasure && width && nodeLen) setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
130683
130760
|
else setNeedEllipsis(STATUS_MEASURE_NONE);
|
|
130684
130761
|
}, [
|
|
@@ -130688,7 +130765,7 @@ function EllipsisMeasure(props) {
|
|
|
130688
130765
|
enableMeasure,
|
|
130689
130766
|
nodeList
|
|
130690
130767
|
].concat(_toConsumableArray$14(measureDeps)));
|
|
130691
|
-
useLayoutEffect$
|
|
130768
|
+
useLayoutEffect$7(() => {
|
|
130692
130769
|
if (needEllipsis === STATUS_MEASURE_PREPARE) {
|
|
130693
130770
|
setNeedEllipsis(STATUS_MEASURE_START);
|
|
130694
130771
|
setParentWhiteSpace(measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace);
|
|
@@ -130705,7 +130782,7 @@ function EllipsisMeasure(props) {
|
|
|
130705
130782
|
}
|
|
130706
130783
|
}, [needEllipsis]);
|
|
130707
130784
|
const cutMidIndex = ellipsisCutIndex ? Math.ceil((ellipsisCutIndex[0] + ellipsisCutIndex[1]) / 2) : 0;
|
|
130708
|
-
useLayoutEffect$
|
|
130785
|
+
useLayoutEffect$7(() => {
|
|
130709
130786
|
const [minIndex, maxIndex] = ellipsisCutIndex || [0, 0];
|
|
130710
130787
|
if (minIndex !== maxIndex) {
|
|
130711
130788
|
const isOverflow = (cutMidRef.current?.getHeight() || 0) > ellipsisHeight;
|
|
@@ -130821,7 +130898,7 @@ var Base = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
130821
130898
|
setEditing(edit);
|
|
130822
130899
|
};
|
|
130823
130900
|
const prevEditing = usePrevious$1(editing);
|
|
130824
|
-
useLayoutEffect$
|
|
130901
|
+
useLayoutEffect$7(() => {
|
|
130825
130902
|
if (!editing && prevEditing) editIconRef.current?.focus();
|
|
130826
130903
|
}, [editing]);
|
|
130827
130904
|
const onEditClick = (e) => {
|
|
@@ -130860,7 +130937,7 @@ var Base = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
130860
130937
|
enableEdit,
|
|
130861
130938
|
enableCopy
|
|
130862
130939
|
]);
|
|
130863
|
-
useLayoutEffect$
|
|
130940
|
+
useLayoutEffect$7(() => {
|
|
130864
130941
|
if (enableEllipsis && !needMeasureEllipsis) {
|
|
130865
130942
|
setIsLineClampSupport(isStyleSupport$1("webkitLineClamp"));
|
|
130866
130943
|
setIsTextOverflowSupport(isStyleSupport$1("textOverflow"));
|
|
@@ -130876,7 +130953,7 @@ var Base = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
130876
130953
|
isTextOverflowSupport,
|
|
130877
130954
|
isLineClampSupport
|
|
130878
130955
|
]);
|
|
130879
|
-
useLayoutEffect$
|
|
130956
|
+
useLayoutEffect$7(() => {
|
|
130880
130957
|
setCssEllipsis(canUseCssEllipsis && mergedEnableEllipsis);
|
|
130881
130958
|
}, [canUseCssEllipsis, mergedEnableEllipsis]);
|
|
130882
130959
|
const tooltipProps = useTooltipProps(ellipsisConfig.tooltip, editConfig.text, children);
|
|
@@ -131714,6 +131791,46 @@ var Minus = createLucideIcon("minus", [["path", {
|
|
|
131714
131791
|
* This source code is licensed under the ISC license.
|
|
131715
131792
|
* See the LICENSE file in the root directory of this source tree.
|
|
131716
131793
|
*/
|
|
131794
|
+
var MoveHorizontal = createLucideIcon("move-horizontal", [
|
|
131795
|
+
["path", {
|
|
131796
|
+
d: "m18 8 4 4-4 4",
|
|
131797
|
+
key: "1ak13k"
|
|
131798
|
+
}],
|
|
131799
|
+
["path", {
|
|
131800
|
+
d: "M2 12h20",
|
|
131801
|
+
key: "9i4pu4"
|
|
131802
|
+
}],
|
|
131803
|
+
["path", {
|
|
131804
|
+
d: "m6 8-4 4 4 4",
|
|
131805
|
+
key: "15zrgr"
|
|
131806
|
+
}]
|
|
131807
|
+
]);
|
|
131808
|
+
/**
|
|
131809
|
+
* @license lucide-react v1.17.0 - ISC
|
|
131810
|
+
*
|
|
131811
|
+
* This source code is licensed under the ISC license.
|
|
131812
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131813
|
+
*/
|
|
131814
|
+
var MoveVertical = createLucideIcon("move-vertical", [
|
|
131815
|
+
["path", {
|
|
131816
|
+
d: "M12 2v20",
|
|
131817
|
+
key: "t6zp3m"
|
|
131818
|
+
}],
|
|
131819
|
+
["path", {
|
|
131820
|
+
d: "m8 18 4 4 4-4",
|
|
131821
|
+
key: "bh5tu3"
|
|
131822
|
+
}],
|
|
131823
|
+
["path", {
|
|
131824
|
+
d: "m8 6 4-4 4 4",
|
|
131825
|
+
key: "ybng9g"
|
|
131826
|
+
}]
|
|
131827
|
+
]);
|
|
131828
|
+
/**
|
|
131829
|
+
* @license lucide-react v1.17.0 - ISC
|
|
131830
|
+
*
|
|
131831
|
+
* This source code is licensed under the ISC license.
|
|
131832
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131833
|
+
*/
|
|
131717
131834
|
var Plus = createLucideIcon("plus", [["path", {
|
|
131718
131835
|
d: "M5 12h14",
|
|
131719
131836
|
key: "1ays0h"
|
|
@@ -132389,41 +132506,340 @@ var useUIPreProcessor = ({ template, size, zoomLevel, maxZoom }) => {
|
|
|
132389
132506
|
return {
|
|
132390
132507
|
backgrounds,
|
|
132391
132508
|
pageSizes,
|
|
132509
|
+
baseScale: scale,
|
|
132392
132510
|
scale: scale * zoomLevel,
|
|
132393
132511
|
error,
|
|
132394
132512
|
refresh
|
|
132395
132513
|
};
|
|
132396
132514
|
};
|
|
132397
|
-
var
|
|
132515
|
+
var ZOOM_RENDER_COMMIT_DELAY = 220;
|
|
132516
|
+
var WHEEL_ZOOM_SENSITIVITY = .004;
|
|
132517
|
+
var MAX_WHEEL_DELTA_PER_FRAME = 120;
|
|
132518
|
+
var TOUCH_ZOOM_SENSITIVITY = 1.8;
|
|
132519
|
+
var getTouchDistance = (touches) => {
|
|
132520
|
+
const first = touches.item(0);
|
|
132521
|
+
const second = touches.item(1);
|
|
132522
|
+
if (!first || !second) return 0;
|
|
132523
|
+
return Math.hypot(first.clientX - second.clientX, first.clientY - second.clientY);
|
|
132524
|
+
};
|
|
132525
|
+
var getTouchCenter = (touches) => {
|
|
132526
|
+
const first = touches.item(0);
|
|
132527
|
+
const second = touches.item(1);
|
|
132528
|
+
if (!first || !second) return null;
|
|
132529
|
+
return {
|
|
132530
|
+
clientX: (first.clientX + second.clientX) / 2,
|
|
132531
|
+
clientY: (first.clientY + second.clientY) / 2
|
|
132532
|
+
};
|
|
132533
|
+
};
|
|
132534
|
+
var getWheelZoomFactor = (event) => {
|
|
132535
|
+
const deltaModeMultiplier = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? 80 : 1;
|
|
132536
|
+
const normalizedDelta = Math.max(-120, Math.min(MAX_WHEEL_DELTA_PER_FRAME, event.deltaY * deltaModeMultiplier));
|
|
132537
|
+
return Math.exp(-normalizedDelta * WHEEL_ZOOM_SENSITIVITY);
|
|
132538
|
+
};
|
|
132539
|
+
var useZoom = ({ baseScale, maxZoom, pageCursor, pageSizes, containerRef, paperRefs, size, hasRulers = false, initialZoomLevel = 1, onZoomCommit }) => {
|
|
132540
|
+
const [zoomLevel, setZoomLevelState] = (0, import_react$9.useState)(initialZoomLevel);
|
|
132541
|
+
const [zoomMode, setZoomModeState] = (0, import_react$9.useState)("manual");
|
|
132542
|
+
const [displayScale, setDisplayScale] = (0, import_react$9.useState)(0);
|
|
132543
|
+
const [renderScale, setRenderScale] = (0, import_react$9.useState)(0);
|
|
132544
|
+
const zoomLevelRef = (0, import_react$9.useRef)(zoomLevel);
|
|
132545
|
+
const zoomModeRef = (0, import_react$9.useRef)(zoomMode);
|
|
132546
|
+
const displayScaleRef = (0, import_react$9.useRef)(displayScale);
|
|
132547
|
+
const baseScaleRef = (0, import_react$9.useRef)(baseScale);
|
|
132548
|
+
const pendingAnchorRef = (0, import_react$9.useRef)(null);
|
|
132549
|
+
const pendingCommitCallbackRef = (0, import_react$9.useRef)(false);
|
|
132550
|
+
const renderCommitTimerRef = (0, import_react$9.useRef)(null);
|
|
132551
|
+
const animationFrameRef = (0, import_react$9.useRef)(null);
|
|
132552
|
+
const queuedGestureRef = (0, import_react$9.useRef)(null);
|
|
132553
|
+
const touchGestureRef = (0, import_react$9.useRef)(null);
|
|
132554
|
+
const zoomContainerReady = displayScale > 0;
|
|
132555
|
+
(0, import_react$9.useEffect)(() => {
|
|
132556
|
+
baseScaleRef.current = baseScale;
|
|
132557
|
+
}, [baseScale]);
|
|
132558
|
+
(0, import_react$9.useEffect)(() => {
|
|
132559
|
+
zoomLevelRef.current = zoomLevel;
|
|
132560
|
+
}, [zoomLevel]);
|
|
132561
|
+
(0, import_react$9.useEffect)(() => {
|
|
132562
|
+
zoomModeRef.current = zoomMode;
|
|
132563
|
+
}, [zoomMode]);
|
|
132564
|
+
(0, import_react$9.useEffect)(() => {
|
|
132565
|
+
displayScaleRef.current = displayScale;
|
|
132566
|
+
}, [displayScale]);
|
|
132567
|
+
const getAnchor = (0, import_react$9.useCallback)((point) => {
|
|
132568
|
+
const container = containerRef.current;
|
|
132569
|
+
const paper = paperRefs.current[pageCursor];
|
|
132570
|
+
if (!container || !paper) return null;
|
|
132571
|
+
const containerRect = container.getBoundingClientRect();
|
|
132572
|
+
return getZoomAnchor({
|
|
132573
|
+
pageIndex: pageCursor,
|
|
132574
|
+
paper,
|
|
132575
|
+
clientX: point?.clientX ?? containerRect.left + containerRect.width / 2,
|
|
132576
|
+
clientY: point?.clientY ?? containerRect.top + containerRect.height / 2,
|
|
132577
|
+
scale: displayScaleRef.current
|
|
132578
|
+
});
|
|
132579
|
+
}, [
|
|
132580
|
+
containerRef,
|
|
132581
|
+
pageCursor,
|
|
132582
|
+
paperRefs
|
|
132583
|
+
]);
|
|
132584
|
+
const markCommitted = (0, import_react$9.useCallback)(() => {
|
|
132585
|
+
pendingCommitCallbackRef.current = true;
|
|
132586
|
+
}, []);
|
|
132587
|
+
const clearRenderCommitTimer = (0, import_react$9.useCallback)(() => {
|
|
132588
|
+
if (renderCommitTimerRef.current) {
|
|
132589
|
+
clearTimeout(renderCommitTimerRef.current);
|
|
132590
|
+
renderCommitTimerRef.current = null;
|
|
132591
|
+
}
|
|
132592
|
+
}, []);
|
|
132593
|
+
const commitRenderScale = (0, import_react$9.useCallback)(() => {
|
|
132594
|
+
clearRenderCommitTimer();
|
|
132595
|
+
const nextScale = displayScaleRef.current;
|
|
132596
|
+
setRenderScale(nextScale);
|
|
132597
|
+
markCommitted();
|
|
132598
|
+
}, [clearRenderCommitTimer, markCommitted]);
|
|
132599
|
+
const updateZoom = (0, import_react$9.useCallback)(({ nextZoomLevel, mode, anchor, commitRender }) => {
|
|
132600
|
+
const nextZoom = clampZoomLevel(nextZoomLevel, maxZoom);
|
|
132601
|
+
const nextDisplayScale = baseScaleRef.current > 0 ? baseScaleRef.current * nextZoom : 0;
|
|
132602
|
+
pendingAnchorRef.current = anchor ?? null;
|
|
132603
|
+
zoomLevelRef.current = nextZoom;
|
|
132604
|
+
zoomModeRef.current = mode;
|
|
132605
|
+
displayScaleRef.current = nextDisplayScale;
|
|
132606
|
+
setZoomModeState(mode);
|
|
132607
|
+
setZoomLevelState(nextZoom);
|
|
132608
|
+
setDisplayScale(nextDisplayScale);
|
|
132609
|
+
if (commitRender) {
|
|
132610
|
+
clearRenderCommitTimer();
|
|
132611
|
+
setRenderScale(nextDisplayScale);
|
|
132612
|
+
markCommitted();
|
|
132613
|
+
return;
|
|
132614
|
+
}
|
|
132615
|
+
clearRenderCommitTimer();
|
|
132616
|
+
renderCommitTimerRef.current = setTimeout(() => {
|
|
132617
|
+
setRenderScale(displayScaleRef.current);
|
|
132618
|
+
markCommitted();
|
|
132619
|
+
}, ZOOM_RENDER_COMMIT_DELAY);
|
|
132620
|
+
}, [
|
|
132621
|
+
clearRenderCommitTimer,
|
|
132622
|
+
markCommitted,
|
|
132623
|
+
maxZoom
|
|
132624
|
+
]);
|
|
132625
|
+
const queueGestureZoom = (0, import_react$9.useCallback)((nextZoomLevel, anchor) => {
|
|
132626
|
+
queuedGestureRef.current = {
|
|
132627
|
+
zoomLevel: nextZoomLevel,
|
|
132628
|
+
anchor
|
|
132629
|
+
};
|
|
132630
|
+
if (animationFrameRef.current !== null) return;
|
|
132631
|
+
animationFrameRef.current = window.requestAnimationFrame(() => {
|
|
132632
|
+
animationFrameRef.current = null;
|
|
132633
|
+
const queued = queuedGestureRef.current;
|
|
132634
|
+
queuedGestureRef.current = null;
|
|
132635
|
+
if (!queued) return;
|
|
132636
|
+
updateZoom({
|
|
132637
|
+
nextZoomLevel: queued.zoomLevel,
|
|
132638
|
+
mode: "manual",
|
|
132639
|
+
anchor: queued.anchor,
|
|
132640
|
+
commitRender: false
|
|
132641
|
+
});
|
|
132642
|
+
});
|
|
132643
|
+
}, [updateZoom]);
|
|
132644
|
+
const setZoomLevel = (0, import_react$9.useCallback)((nextZoomLevel) => {
|
|
132645
|
+
updateZoom({
|
|
132646
|
+
nextZoomLevel,
|
|
132647
|
+
mode: "manual",
|
|
132648
|
+
anchor: getAnchor(),
|
|
132649
|
+
commitRender: true
|
|
132650
|
+
});
|
|
132651
|
+
}, [getAnchor, updateZoom]);
|
|
132652
|
+
const fitZoom = (0, import_react$9.useCallback)((mode) => {
|
|
132653
|
+
updateZoom({
|
|
132654
|
+
nextZoomLevel: getFitZoomLevel({
|
|
132655
|
+
mode,
|
|
132656
|
+
pageSize: pageSizes[pageCursor],
|
|
132657
|
+
container: containerRef.current,
|
|
132658
|
+
baseScale: baseScaleRef.current,
|
|
132659
|
+
maxZoom,
|
|
132660
|
+
hasRulers
|
|
132661
|
+
}),
|
|
132662
|
+
mode,
|
|
132663
|
+
anchor: getAnchor(),
|
|
132664
|
+
commitRender: true
|
|
132665
|
+
});
|
|
132666
|
+
}, [
|
|
132667
|
+
containerRef,
|
|
132668
|
+
getAnchor,
|
|
132669
|
+
hasRulers,
|
|
132670
|
+
maxZoom,
|
|
132671
|
+
pageCursor,
|
|
132672
|
+
pageSizes,
|
|
132673
|
+
updateZoom
|
|
132674
|
+
]);
|
|
132675
|
+
(0, import_react$9.useEffect)(() => {
|
|
132676
|
+
if (baseScale <= 0) {
|
|
132677
|
+
setDisplayScale(0);
|
|
132678
|
+
setRenderScale(0);
|
|
132679
|
+
return;
|
|
132680
|
+
}
|
|
132681
|
+
const nextZoomLevel = zoomModeRef.current === "manual" ? clampZoomLevel(zoomLevelRef.current, maxZoom) : getFitZoomLevel({
|
|
132682
|
+
mode: zoomModeRef.current,
|
|
132683
|
+
pageSize: pageSizes[pageCursor],
|
|
132684
|
+
container: containerRef.current,
|
|
132685
|
+
baseScale,
|
|
132686
|
+
maxZoom,
|
|
132687
|
+
hasRulers
|
|
132688
|
+
});
|
|
132689
|
+
const nextDisplayScale = baseScale * nextZoomLevel;
|
|
132690
|
+
zoomLevelRef.current = nextZoomLevel;
|
|
132691
|
+
displayScaleRef.current = nextDisplayScale;
|
|
132692
|
+
setZoomLevelState(nextZoomLevel);
|
|
132693
|
+
setDisplayScale(nextDisplayScale);
|
|
132694
|
+
setRenderScale(nextDisplayScale);
|
|
132695
|
+
markCommitted();
|
|
132696
|
+
}, [
|
|
132697
|
+
baseScale,
|
|
132698
|
+
containerRef,
|
|
132699
|
+
hasRulers,
|
|
132700
|
+
markCommitted,
|
|
132701
|
+
maxZoom,
|
|
132702
|
+
pageCursor,
|
|
132703
|
+
pageSizes,
|
|
132704
|
+
size.height,
|
|
132705
|
+
size.width
|
|
132706
|
+
]);
|
|
132707
|
+
(0, import_react$9.useLayoutEffect)(() => {
|
|
132708
|
+
const anchor = pendingAnchorRef.current;
|
|
132709
|
+
if (anchor) {
|
|
132710
|
+
restoreZoomAnchor({
|
|
132711
|
+
container: containerRef.current,
|
|
132712
|
+
paper: paperRefs.current[anchor.pageIndex],
|
|
132713
|
+
anchor,
|
|
132714
|
+
scale: displayScale
|
|
132715
|
+
});
|
|
132716
|
+
pendingAnchorRef.current = null;
|
|
132717
|
+
}
|
|
132718
|
+
if (pendingCommitCallbackRef.current && Math.abs(displayScale - renderScale) < Number.EPSILON) {
|
|
132719
|
+
pendingCommitCallbackRef.current = false;
|
|
132720
|
+
onZoomCommit?.();
|
|
132721
|
+
}
|
|
132722
|
+
}, [
|
|
132723
|
+
containerRef,
|
|
132724
|
+
displayScale,
|
|
132725
|
+
onZoomCommit,
|
|
132726
|
+
paperRefs,
|
|
132727
|
+
renderScale
|
|
132728
|
+
]);
|
|
132729
|
+
(0, import_react$9.useEffect)(() => {
|
|
132730
|
+
if (!zoomContainerReady) return void 0;
|
|
132731
|
+
const node = containerRef.current;
|
|
132732
|
+
if (!node) return void 0;
|
|
132733
|
+
const onWheel = (event) => {
|
|
132734
|
+
if (!event.ctrlKey) return;
|
|
132735
|
+
event.preventDefault();
|
|
132736
|
+
const anchor = getAnchor({
|
|
132737
|
+
clientX: event.clientX,
|
|
132738
|
+
clientY: event.clientY
|
|
132739
|
+
});
|
|
132740
|
+
queueGestureZoom(zoomLevelRef.current * getWheelZoomFactor(event), anchor);
|
|
132741
|
+
};
|
|
132742
|
+
const onTouchStart = (event) => {
|
|
132743
|
+
if (event.touches.length !== 2) return;
|
|
132744
|
+
event.preventDefault();
|
|
132745
|
+
event.stopPropagation();
|
|
132746
|
+
touchGestureRef.current = {
|
|
132747
|
+
distance: getTouchDistance(event.touches),
|
|
132748
|
+
zoomLevel: zoomLevelRef.current
|
|
132749
|
+
};
|
|
132750
|
+
};
|
|
132751
|
+
const onTouchMove = (event) => {
|
|
132752
|
+
if (event.touches.length !== 2 || !touchGestureRef.current) return;
|
|
132753
|
+
event.preventDefault();
|
|
132754
|
+
event.stopPropagation();
|
|
132755
|
+
const center = getTouchCenter(event.touches);
|
|
132756
|
+
const distance = getTouchDistance(event.touches);
|
|
132757
|
+
if (!center || distance <= 0 || touchGestureRef.current.distance <= 0) return;
|
|
132758
|
+
const anchor = getAnchor(center);
|
|
132759
|
+
const ratio = distance / touchGestureRef.current.distance;
|
|
132760
|
+
const dampedRatio = Math.pow(ratio, TOUCH_ZOOM_SENSITIVITY);
|
|
132761
|
+
queueGestureZoom(touchGestureRef.current.zoomLevel * dampedRatio, anchor);
|
|
132762
|
+
};
|
|
132763
|
+
const onTouchEnd = (event) => {
|
|
132764
|
+
if (event.touches.length >= 2) return;
|
|
132765
|
+
touchGestureRef.current = null;
|
|
132766
|
+
commitRenderScale();
|
|
132767
|
+
};
|
|
132768
|
+
node.addEventListener("wheel", onWheel, { passive: false });
|
|
132769
|
+
node.addEventListener("touchstart", onTouchStart, { passive: false });
|
|
132770
|
+
node.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
132771
|
+
node.addEventListener("touchend", onTouchEnd);
|
|
132772
|
+
node.addEventListener("touchcancel", onTouchEnd);
|
|
132773
|
+
return () => {
|
|
132774
|
+
node.removeEventListener("wheel", onWheel);
|
|
132775
|
+
node.removeEventListener("touchstart", onTouchStart);
|
|
132776
|
+
node.removeEventListener("touchmove", onTouchMove);
|
|
132777
|
+
node.removeEventListener("touchend", onTouchEnd);
|
|
132778
|
+
node.removeEventListener("touchcancel", onTouchEnd);
|
|
132779
|
+
};
|
|
132780
|
+
}, [
|
|
132781
|
+
commitRenderScale,
|
|
132782
|
+
containerRef,
|
|
132783
|
+
getAnchor,
|
|
132784
|
+
queueGestureZoom,
|
|
132785
|
+
zoomContainerReady
|
|
132786
|
+
]);
|
|
132787
|
+
(0, import_react$9.useEffect)(() => () => {
|
|
132788
|
+
clearRenderCommitTimer();
|
|
132789
|
+
if (animationFrameRef.current !== null) window.cancelAnimationFrame(animationFrameRef.current);
|
|
132790
|
+
}, [clearRenderCommitTimer]);
|
|
132791
|
+
return {
|
|
132792
|
+
displayScale,
|
|
132793
|
+
renderScale,
|
|
132794
|
+
zoomLevel,
|
|
132795
|
+
zoomMode,
|
|
132796
|
+
setZoomLevel,
|
|
132797
|
+
fitWidth: () => fitZoom("fit-width"),
|
|
132798
|
+
fitHeight: () => fitZoom("fit-height")
|
|
132799
|
+
};
|
|
132800
|
+
};
|
|
132801
|
+
var getVisibleArea$1 = (containerRect, elementRect) => {
|
|
132802
|
+
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));
|
|
132803
|
+
};
|
|
132804
|
+
var getMostVisiblePageIndex = (container, paperRefs, pageCursor) => {
|
|
132805
|
+
const containerRect = container.getBoundingClientRect();
|
|
132806
|
+
let bestPageIndex = pageCursor;
|
|
132807
|
+
let bestVisibleArea = 0;
|
|
132808
|
+
paperRefs.current.forEach((paper, pageIndex) => {
|
|
132809
|
+
if (!paper) return;
|
|
132810
|
+
const visibleArea = getVisibleArea$1(containerRect, paper.getBoundingClientRect());
|
|
132811
|
+
if (visibleArea > bestVisibleArea) {
|
|
132812
|
+
bestVisibleArea = visibleArea;
|
|
132813
|
+
bestPageIndex = pageIndex;
|
|
132814
|
+
}
|
|
132815
|
+
});
|
|
132816
|
+
return bestVisibleArea > 0 ? bestPageIndex : pageCursor;
|
|
132817
|
+
};
|
|
132818
|
+
var useScrollPageCursor = ({ ref, paperRefs, pageSizes, scale, pageCursor, onChangePageCursor }) => {
|
|
132398
132819
|
const onScroll = (0, import_react$9.useCallback)(() => {
|
|
132399
132820
|
if (!pageSizes[0] || !ref.current) return;
|
|
132400
|
-
const
|
|
132401
|
-
const { top } = ref.current.getBoundingClientRect();
|
|
132402
|
-
const pageHeights = pageSizes.reduce((acc, cur, i) => {
|
|
132403
|
-
let value = (cur.height * ZOOM + 30) * scale;
|
|
132404
|
-
if (i === 0) value += top - value / 2;
|
|
132405
|
-
else value += acc[i - 1];
|
|
132406
|
-
return acc.concat(value);
|
|
132407
|
-
}, []);
|
|
132408
|
-
let _pageCursor = 0;
|
|
132409
|
-
pageHeights.forEach((ph, i) => {
|
|
132410
|
-
if (scroll > ph) _pageCursor = i + 1 >= pageHeights.length ? pageHeights.length - 1 : i + 1;
|
|
132411
|
-
});
|
|
132821
|
+
const _pageCursor = getMostVisiblePageIndex(ref.current, paperRefs, pageCursor);
|
|
132412
132822
|
if (_pageCursor !== pageCursor) onChangePageCursor(_pageCursor);
|
|
132413
132823
|
}, [
|
|
132414
132824
|
onChangePageCursor,
|
|
132415
132825
|
pageCursor,
|
|
132416
132826
|
pageSizes,
|
|
132417
|
-
|
|
132418
|
-
|
|
132827
|
+
paperRefs,
|
|
132828
|
+
ref
|
|
132419
132829
|
]);
|
|
132420
132830
|
(0, import_react$9.useEffect)(() => {
|
|
132421
132831
|
const node = ref.current;
|
|
132422
132832
|
node?.addEventListener("scroll", onScroll);
|
|
132833
|
+
const animationFrame = window.requestAnimationFrame(onScroll);
|
|
132423
132834
|
return () => {
|
|
132835
|
+
window.cancelAnimationFrame(animationFrame);
|
|
132424
132836
|
node?.removeEventListener("scroll", onScroll);
|
|
132425
132837
|
};
|
|
132426
|
-
}, [
|
|
132838
|
+
}, [
|
|
132839
|
+
ref,
|
|
132840
|
+
onScroll,
|
|
132841
|
+
scale
|
|
132842
|
+
]);
|
|
132427
132843
|
};
|
|
132428
132844
|
var useMountStatus = () => {
|
|
132429
132845
|
const [isMounted, setIsMounted] = (0, import_react$9.useState)(false);
|
|
@@ -134913,7 +135329,7 @@ function updateCSS(css, key) {
|
|
|
134913
135329
|
}
|
|
134914
135330
|
//#endregion
|
|
134915
135331
|
//#region ../../node_modules/rc-util/es/hooks/useMemo.js
|
|
134916
|
-
function useMemo$
|
|
135332
|
+
function useMemo$31(getValue, condition, shouldUpdate) {
|
|
134917
135333
|
var cacheRef = import_react$9.useRef({});
|
|
134918
135334
|
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
134919
135335
|
cacheRef.current.value = getValue();
|
|
@@ -136168,7 +136584,7 @@ var composeRef = function composeRef() {
|
|
|
136168
136584
|
};
|
|
136169
136585
|
var useComposeRef = function useComposeRef() {
|
|
136170
136586
|
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) refs[_key2] = arguments[_key2];
|
|
136171
|
-
return useMemo$
|
|
136587
|
+
return useMemo$31(function() {
|
|
136172
136588
|
return composeRef.apply(void 0, refs);
|
|
136173
136589
|
}, refs, function(prev, next) {
|
|
136174
136590
|
return prev.length !== next.length || prev.every(function(ref, i) {
|
|
@@ -138880,7 +139296,7 @@ function useTheme(theme, parentTheme, config) {
|
|
|
138880
139296
|
cssVar: parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.cssVar
|
|
138881
139297
|
}) : parentTheme;
|
|
138882
139298
|
const themeKey = useThemeKey();
|
|
138883
|
-
return useMemo$
|
|
139299
|
+
return useMemo$31(() => {
|
|
138884
139300
|
var _a, _b;
|
|
138885
139301
|
if (!theme) return parentTheme;
|
|
138886
139302
|
const mergedComponents = Object.assign({}, parentThemeConfig.components);
|
|
@@ -139695,7 +140111,7 @@ var ProviderChildren = (props) => {
|
|
|
139695
140111
|
if (propValue) config[propName] = propValue;
|
|
139696
140112
|
});
|
|
139697
140113
|
if (typeof autoInsertSpaceInButton !== "undefined") config.button = Object.assign({ autoInsertSpace: autoInsertSpaceInButton }, config.button);
|
|
139698
|
-
const memoedConfig = useMemo$
|
|
140114
|
+
const memoedConfig = useMemo$31(() => config, config, (prevConfig, currentConfig) => {
|
|
139699
140115
|
const prevKeys = Object.keys(prevConfig);
|
|
139700
140116
|
const currentKeys = Object.keys(currentConfig);
|
|
139701
140117
|
return prevKeys.length !== currentKeys.length || prevKeys.some((key) => prevConfig[key] !== currentConfig[key]);
|
|
@@ -163200,7 +163616,7 @@ var __rest$44 = function(s, e) {
|
|
|
163200
163616
|
function strToArr(str) {
|
|
163201
163617
|
return (str || "").split("");
|
|
163202
163618
|
}
|
|
163203
|
-
var Separator = (props) => {
|
|
163619
|
+
var Separator$1 = (props) => {
|
|
163204
163620
|
const { index, prefixCls, separator } = props;
|
|
163205
163621
|
const separatorNode = typeof separator === "function" ? separator(index) : separator;
|
|
163206
163622
|
if (!separatorNode) return null;
|
|
@@ -163322,7 +163738,7 @@ var OTP = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
163322
163738
|
value: singleValue,
|
|
163323
163739
|
onActiveChange: onInputActiveChange,
|
|
163324
163740
|
autoFocus: index === 0 && autoFocus
|
|
163325
|
-
}, inputSharedProps)), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator, {
|
|
163741
|
+
}, inputSharedProps)), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator$1, {
|
|
163326
163742
|
separator,
|
|
163327
163743
|
index,
|
|
163328
163744
|
prefixCls
|
|
@@ -168616,7 +169032,7 @@ var RefOptionList$1 = /* @__PURE__ */ import_react$9.forwardRef(function OptionL
|
|
|
168616
169032
|
var _useBaseProps = useBaseProps(), prefixCls = _useBaseProps.prefixCls, id = _useBaseProps.id, open = _useBaseProps.open, multiple = _useBaseProps.multiple, mode = _useBaseProps.mode, searchValue = _useBaseProps.searchValue, toggleOpen = _useBaseProps.toggleOpen, notFoundContent = _useBaseProps.notFoundContent, onPopupScroll = _useBaseProps.onPopupScroll;
|
|
168617
169033
|
var _React$useContext = import_react$9.useContext(SelectContext), maxCount = _React$useContext.maxCount, flattenOptions = _React$useContext.flattenOptions, onActiveValue = _React$useContext.onActiveValue, defaultActiveFirstOption = _React$useContext.defaultActiveFirstOption, onSelect = _React$useContext.onSelect, menuItemSelectedIcon = _React$useContext.menuItemSelectedIcon, rawValues = _React$useContext.rawValues, fieldNames = _React$useContext.fieldNames, virtual = _React$useContext.virtual, direction = _React$useContext.direction, listHeight = _React$useContext.listHeight, listItemHeight = _React$useContext.listItemHeight, optionRender = _React$useContext.optionRender;
|
|
168618
169034
|
var itemPrefixCls = "".concat(prefixCls, "-item");
|
|
168619
|
-
var memoFlattenOptions = useMemo$
|
|
169035
|
+
var memoFlattenOptions = useMemo$31(function() {
|
|
168620
169036
|
return flattenOptions;
|
|
168621
169037
|
}, [open, flattenOptions], function(prev, next) {
|
|
168622
169038
|
return next[0] && prev[1] !== next[1];
|
|
@@ -174016,7 +174432,7 @@ var RefOptionList = /* @__PURE__ */ import_react$9.forwardRef(function OptionLis
|
|
|
174016
174432
|
var _React$useContext = import_react$9.useContext(TreeSelectContext), virtual = _React$useContext.virtual, listHeight = _React$useContext.listHeight, listItemHeight = _React$useContext.listItemHeight, listItemScrollOffset = _React$useContext.listItemScrollOffset, treeData = _React$useContext.treeData, fieldNames = _React$useContext.fieldNames, onSelect = _React$useContext.onSelect, dropdownMatchSelectWidth = _React$useContext.dropdownMatchSelectWidth, treeExpandAction = _React$useContext.treeExpandAction, treeTitleRender = _React$useContext.treeTitleRender, onPopupScroll = _React$useContext.onPopupScroll, leftMaxCount = _React$useContext.leftMaxCount, leafCountOnly = _React$useContext.leafCountOnly, valueEntities = _React$useContext.valueEntities;
|
|
174017
174433
|
var _React$useContext2 = import_react$9.useContext(LegacySelectContext), checkable = _React$useContext2.checkable, checkedKeys = _React$useContext2.checkedKeys, halfCheckedKeys = _React$useContext2.halfCheckedKeys, treeExpandedKeys = _React$useContext2.treeExpandedKeys, treeDefaultExpandAll = _React$useContext2.treeDefaultExpandAll, treeDefaultExpandedKeys = _React$useContext2.treeDefaultExpandedKeys, onTreeExpand = _React$useContext2.onTreeExpand, treeIcon = _React$useContext2.treeIcon, showTreeIcon = _React$useContext2.showTreeIcon, switcherIcon = _React$useContext2.switcherIcon, treeLine = _React$useContext2.treeLine, treeNodeFilterProp = _React$useContext2.treeNodeFilterProp, loadData = _React$useContext2.loadData, treeLoadedKeys = _React$useContext2.treeLoadedKeys, treeMotion = _React$useContext2.treeMotion, onTreeLoad = _React$useContext2.onTreeLoad, keyEntities = _React$useContext2.keyEntities;
|
|
174018
174434
|
var treeRef = import_react$9.useRef();
|
|
174019
|
-
var memoTreeData = useMemo$
|
|
174435
|
+
var memoTreeData = useMemo$31(function() {
|
|
174020
174436
|
return treeData;
|
|
174021
174437
|
}, [open, treeData], function(prev, next) {
|
|
174022
174438
|
return next[0] && prev[1] !== next[1];
|
|
@@ -174161,7 +174577,7 @@ var RefOptionList = /* @__PURE__ */ import_react$9.forwardRef(function OptionLis
|
|
|
174161
174577
|
onKeyUp: function onKeyUp() {}
|
|
174162
174578
|
};
|
|
174163
174579
|
});
|
|
174164
|
-
var syncLoadData = useMemo$
|
|
174580
|
+
var syncLoadData = useMemo$31(function() {
|
|
174165
174581
|
return searchValue ? false : true;
|
|
174166
174582
|
}, [searchValue, treeExpandedKeys || expandedKeys], function(_ref2, _ref3) {
|
|
174167
174583
|
var preSearchValue = _slicedToArray$16(_ref2, 1)[0];
|
|
@@ -199035,7 +199451,7 @@ function mergeProps(origin, target) {
|
|
|
199035
199451
|
function InheritableContextProvider(_ref) {
|
|
199036
199452
|
var children = _ref.children, locked = _ref.locked, restProps = _objectWithoutProperties$2(_ref, _excluded$18);
|
|
199037
199453
|
var context = import_react$9.useContext(MenuContext$1);
|
|
199038
|
-
var inheritableContext = useMemo$
|
|
199454
|
+
var inheritableContext = useMemo$31(function() {
|
|
199039
199455
|
return mergeProps(context, restProps);
|
|
199040
199456
|
}, [context, restProps], function(prev, next) {
|
|
199041
199457
|
return !locked && (prev[0] !== next[0] || !isEqual(prev[1], next[1], true));
|
|
@@ -204239,7 +204655,7 @@ function isRenderCell(data) {
|
|
|
204239
204655
|
}
|
|
204240
204656
|
function useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate) {
|
|
204241
204657
|
var perfRecord = import_react$9.useContext(PerfContext);
|
|
204242
|
-
return useMemo$
|
|
204658
|
+
return useMemo$31(function() {
|
|
204243
204659
|
if (validateValue(children)) return [children];
|
|
204244
204660
|
var value = get$1(record, dataIndex === null || dataIndex === void 0 || dataIndex === "" ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex]);
|
|
204245
204661
|
var returnChildNode = value;
|
|
@@ -205409,7 +205825,7 @@ function useFixedInfo(flattenColumns, stickyOffsets, direction) {
|
|
|
205409
205825
|
var fixedInfoList = flattenColumns.map(function(_, colIndex) {
|
|
205410
205826
|
return getCellFixedInfo(colIndex, colIndex, flattenColumns, stickyOffsets, direction);
|
|
205411
205827
|
});
|
|
205412
|
-
return useMemo$
|
|
205828
|
+
return useMemo$31(function() {
|
|
205413
205829
|
return fixedInfoList;
|
|
205414
205830
|
}, [fixedInfoList], function(prev, next) {
|
|
205415
205831
|
return !isEqual(prev, next);
|
|
@@ -235478,7 +235894,7 @@ var DeleteButton = ({ activeElements: aes }) => {
|
|
|
235478
235894
|
});
|
|
235479
235895
|
};
|
|
235480
235896
|
var Canvas = (props, ref) => {
|
|
235481
|
-
const { basePdf, pageCursor, scale, backgrounds, pageSizes, size, activeElements, schemasList, hoveringSchemaId, onEdit, changeSchemas, removeSchemas, onChangeHoveringSchemaId, paperRefs, sidebarOpen } = props;
|
|
235897
|
+
const { basePdf, pageCursor, scale, renderScale, backgrounds, pageSizes, size, activeElements, schemasList, hoveringSchemaId, onEdit, changeSchemas, removeSchemas, onChangeHoveringSchemaId, paperRefs, sidebarOpen } = props;
|
|
235482
235898
|
const { token } = theme_default.useToken();
|
|
235483
235899
|
const pluginsRegistry = (0, import_react$9.useContext)(PluginsRegistry);
|
|
235484
235900
|
const verticalGuides = (0, import_react$9.useRef)([]);
|
|
@@ -235515,6 +235931,9 @@ var Canvas = (props, ref) => {
|
|
|
235515
235931
|
schemasList,
|
|
235516
235932
|
prevSchemas
|
|
235517
235933
|
]);
|
|
235934
|
+
(0, import_react$9.useEffect)(() => {
|
|
235935
|
+
moveable.current?.updateRect();
|
|
235936
|
+
}, [renderScale]);
|
|
235518
235937
|
const onDrag = ({ target, top, left }) => {
|
|
235519
235938
|
const { width: _width, height: _height } = target.style;
|
|
235520
235939
|
const targetWidth = fmt(_width);
|
|
@@ -235744,7 +236163,7 @@ var Canvas = (props, ref) => {
|
|
|
235744
236163
|
basePdf
|
|
235745
236164
|
},
|
|
235746
236165
|
input: Object.fromEntries(schemasList.flat().map(({ name, content = "" }) => [name, content])),
|
|
235747
|
-
scale,
|
|
236166
|
+
scale: renderScale,
|
|
235748
236167
|
totalPages: schemasList.length,
|
|
235749
236168
|
currentPage: index + 1
|
|
235750
236169
|
}),
|
|
@@ -235816,7 +236235,7 @@ var Canvas = (props, ref) => {
|
|
|
235816
236235
|
} : void 0,
|
|
235817
236236
|
stopEditing: () => setEditing(false),
|
|
235818
236237
|
outline: `1px ${hoveringSchemaId === schema.id ? "solid" : "dashed"} ${schema.readOnly && hoveringSchemaId !== schema.id ? "transparent" : token.colorPrimary}`,
|
|
235819
|
-
scale
|
|
236238
|
+
scale: renderScale
|
|
235820
236239
|
}, schema.id);
|
|
235821
236240
|
}
|
|
235822
236241
|
})]
|
|
@@ -235993,42 +236412,74 @@ var ErrorScreen = ({ size, error }) => {
|
|
|
235993
236412
|
//#endregion
|
|
235994
236413
|
//#region src/components/CtlBar.tsx
|
|
235995
236414
|
var { Text: Text$1 } = Typography;
|
|
235996
|
-
var
|
|
236415
|
+
var ToolbarButton = ({ className, label, disabled, active, onClick, children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$2, {
|
|
236416
|
+
title: label,
|
|
236417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(button_default$1, {
|
|
236418
|
+
className,
|
|
236419
|
+
type: "text",
|
|
236420
|
+
"aria-label": label,
|
|
236421
|
+
title: label,
|
|
236422
|
+
disabled,
|
|
236423
|
+
onClick,
|
|
236424
|
+
style: active ? { backgroundColor: "rgba(255, 255, 255, 0.18)" } : void 0,
|
|
236425
|
+
children
|
|
236426
|
+
})
|
|
236427
|
+
});
|
|
236428
|
+
var Separator = ({ color }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: {
|
|
236429
|
+
width: 1,
|
|
236430
|
+
height: 24,
|
|
236431
|
+
margin: "0 6px",
|
|
236432
|
+
backgroundColor: color,
|
|
236433
|
+
opacity: .45
|
|
236434
|
+
} });
|
|
236435
|
+
var Zoom = ({ zoomLevel, setZoomLevel, zoomMode, fitWidth, fitHeight, style, labels }) => {
|
|
235997
236436
|
const zoomStep = .25;
|
|
235998
236437
|
const maxZoom = useMaxZoom();
|
|
235999
|
-
const minZoom = .25;
|
|
236000
236438
|
const nextZoomOut = zoomLevel - zoomStep;
|
|
236001
236439
|
const nextZoomIn = zoomLevel + zoomStep;
|
|
236440
|
+
const iconProps = {
|
|
236441
|
+
size: 16,
|
|
236442
|
+
color: style.textStyle.color
|
|
236443
|
+
};
|
|
236002
236444
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
236003
236445
|
style: {
|
|
236004
236446
|
display: "flex",
|
|
236005
236447
|
alignItems: "center"
|
|
236006
236448
|
},
|
|
236007
236449
|
children: [
|
|
236008
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarButton, {
|
|
236009
236451
|
className: UI_CLASSNAME + "zoom-out",
|
|
236010
|
-
|
|
236011
|
-
disabled:
|
|
236452
|
+
label: labels.zoomOut,
|
|
236453
|
+
disabled: zoomLevel <= MIN_ZOOM,
|
|
236012
236454
|
onClick: () => setZoomLevel(nextZoomOut),
|
|
236013
|
-
|
|
236014
|
-
size: 16,
|
|
236015
|
-
color: style.textStyle.color
|
|
236016
|
-
})
|
|
236455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Minus, { ...iconProps })
|
|
236017
236456
|
}),
|
|
236018
236457
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text$1, {
|
|
236019
236458
|
strong: true,
|
|
236020
236459
|
style: style.textStyle,
|
|
236021
236460
|
children: [Math.round(zoomLevel * 100), "%"]
|
|
236022
236461
|
}),
|
|
236023
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236462
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarButton, {
|
|
236024
236463
|
className: UI_CLASSNAME + "zoom-in",
|
|
236025
|
-
|
|
236026
|
-
disabled: maxZoom
|
|
236464
|
+
label: labels.zoomIn,
|
|
236465
|
+
disabled: maxZoom <= zoomLevel,
|
|
236027
236466
|
onClick: () => setZoomLevel(nextZoomIn),
|
|
236028
|
-
|
|
236029
|
-
|
|
236030
|
-
|
|
236031
|
-
|
|
236467
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { ...iconProps })
|
|
236468
|
+
}),
|
|
236469
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Separator, { color: style.textStyle.color }),
|
|
236470
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarButton, {
|
|
236471
|
+
className: UI_CLASSNAME + "fit-width",
|
|
236472
|
+
label: labels.fitWidth,
|
|
236473
|
+
active: zoomMode === "fit-width",
|
|
236474
|
+
onClick: fitWidth,
|
|
236475
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoveHorizontal, { ...iconProps })
|
|
236476
|
+
}),
|
|
236477
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarButton, {
|
|
236478
|
+
className: UI_CLASSNAME + "fit-height",
|
|
236479
|
+
label: labels.fitHeight,
|
|
236480
|
+
active: zoomMode === "fit-height",
|
|
236481
|
+
onClick: fitHeight,
|
|
236482
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoveVertical, { ...iconProps })
|
|
236032
236483
|
})
|
|
236033
236484
|
]
|
|
236034
236485
|
});
|
|
@@ -236089,7 +236540,7 @@ var ContextMenu = ({ items, style }) => /* @__PURE__ */ (0, import_jsx_runtime.j
|
|
|
236089
236540
|
var CtlBar = (props) => {
|
|
236090
236541
|
const { token } = theme_default.useToken();
|
|
236091
236542
|
const i18n = (0, import_react$9.useContext)(I18nContext);
|
|
236092
|
-
const { size, pageCursor, pageNum, setPageCursor, zoomLevel, setZoomLevel, addPageAfter, removePage } = props;
|
|
236543
|
+
const { size, pageCursor, pageNum, setPageCursor, zoomLevel, setZoomLevel, zoomMode, fitWidth, fitHeight, addPageAfter, removePage } = props;
|
|
236093
236544
|
const contextMenuItems = [];
|
|
236094
236545
|
if (addPageAfter) contextMenuItems.push({
|
|
236095
236546
|
key: "1",
|
|
@@ -236105,9 +236556,6 @@ var CtlBar = (props) => {
|
|
|
236105
236556
|
children: i18n("removePage")
|
|
236106
236557
|
})
|
|
236107
236558
|
});
|
|
236108
|
-
const barWidth = 300;
|
|
236109
|
-
const contextMenuWidth = contextMenuItems.length > 0 ? 50 : 0;
|
|
236110
|
-
const width = (pageNum > 1 ? barWidth : barWidth / 2) + contextMenuWidth;
|
|
236111
236559
|
const textStyle = {
|
|
236112
236560
|
color: token.colorWhite,
|
|
236113
236561
|
fontSize: token.fontSize,
|
|
@@ -236118,23 +236566,26 @@ var CtlBar = (props) => {
|
|
|
236118
236566
|
position: "absolute",
|
|
236119
236567
|
top: "auto",
|
|
236120
236568
|
bottom: "6%",
|
|
236121
|
-
width: size.width
|
|
236569
|
+
width: size.width,
|
|
236570
|
+
display: "flex",
|
|
236571
|
+
justifyContent: "center",
|
|
236572
|
+
pointerEvents: "none"
|
|
236122
236573
|
},
|
|
236123
236574
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
236124
236575
|
className: UI_CLASSNAME + "control-bar",
|
|
236125
236576
|
style: {
|
|
236126
|
-
display: "flex",
|
|
236577
|
+
display: "inline-flex",
|
|
236127
236578
|
alignItems: "center",
|
|
236128
|
-
justifyContent: "
|
|
236579
|
+
justifyContent: "center",
|
|
236129
236580
|
position: "relative",
|
|
236130
236581
|
zIndex: 1,
|
|
236131
|
-
left: `calc(50% - ${width / 2}px)`,
|
|
236132
|
-
width,
|
|
236133
236582
|
height: 40,
|
|
236134
236583
|
boxSizing: "border-box",
|
|
236135
236584
|
padding: token.paddingSM,
|
|
236585
|
+
gap: token.marginXS,
|
|
236136
236586
|
borderRadius: token.borderRadius,
|
|
236137
|
-
backgroundColor: token.colorBgMask
|
|
236587
|
+
backgroundColor: token.colorBgMask,
|
|
236588
|
+
pointerEvents: "auto"
|
|
236138
236589
|
},
|
|
236139
236590
|
children: [
|
|
236140
236591
|
pageNum > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
@@ -236151,7 +236602,16 @@ var CtlBar = (props) => {
|
|
|
236151
236602
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zoom, {
|
|
236152
236603
|
style: { textStyle },
|
|
236153
236604
|
zoomLevel,
|
|
236154
|
-
setZoomLevel
|
|
236605
|
+
setZoomLevel,
|
|
236606
|
+
zoomMode,
|
|
236607
|
+
fitWidth,
|
|
236608
|
+
fitHeight,
|
|
236609
|
+
labels: {
|
|
236610
|
+
zoomIn: i18n("zoomIn"),
|
|
236611
|
+
zoomOut: i18n("zoomOut"),
|
|
236612
|
+
fitWidth: i18n("fitWidth"),
|
|
236613
|
+
fitHeight: i18n("fitHeight")
|
|
236614
|
+
}
|
|
236155
236615
|
})
|
|
236156
236616
|
}),
|
|
236157
236617
|
contextMenuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContextMenu, {
|
|
@@ -236187,16 +236647,36 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236187
236647
|
const [activeElements, setActiveElements] = (0, import_react$9.useState)([]);
|
|
236188
236648
|
const [schemasList, setSchemasList] = (0, import_react$9.useState)([[]]);
|
|
236189
236649
|
const [pageCursor, setPageCursor] = (0, import_react$9.useState)(0);
|
|
236190
|
-
const [zoomLevel, setZoomLevel] = (0, import_react$9.useState)(options.zoomLevel ?? 1);
|
|
236191
236650
|
const [sidebarOpen, setSidebarOpen] = (0, import_react$9.useState)(options.sidebarOpen ?? true);
|
|
236192
236651
|
const [canvasHeight, setCanvasHeight] = (0, import_react$9.useState)(0);
|
|
236193
236652
|
const [prevTemplate, setPrevTemplate] = (0, import_react$9.useState)(null);
|
|
236194
|
-
const
|
|
236653
|
+
const canvasWidth = size.width - 45;
|
|
236654
|
+
const sizeExcSidebars = (0, import_react$9.useMemo)(() => ({
|
|
236655
|
+
width: sidebarOpen ? canvasWidth - 400 : canvasWidth,
|
|
236656
|
+
height: size.height
|
|
236657
|
+
}), [
|
|
236658
|
+
canvasWidth,
|
|
236659
|
+
sidebarOpen,
|
|
236660
|
+
size.height
|
|
236661
|
+
]);
|
|
236662
|
+
const { backgrounds, pageSizes, baseScale, error, refresh } = useUIPreProcessor({
|
|
236195
236663
|
template,
|
|
236196
|
-
size,
|
|
236197
|
-
zoomLevel,
|
|
236664
|
+
size: sizeExcSidebars,
|
|
236665
|
+
zoomLevel: 1,
|
|
236198
236666
|
maxZoom
|
|
236199
236667
|
});
|
|
236668
|
+
const { displayScale, renderScale, zoomLevel, zoomMode, setZoomLevel, fitWidth, fitHeight } = useZoom({
|
|
236669
|
+
baseScale,
|
|
236670
|
+
maxZoom,
|
|
236671
|
+
pageCursor,
|
|
236672
|
+
pageSizes,
|
|
236673
|
+
containerRef: canvasRef,
|
|
236674
|
+
paperRefs,
|
|
236675
|
+
size: sizeExcSidebars,
|
|
236676
|
+
hasRulers: true,
|
|
236677
|
+
initialZoomLevel: options.zoomLevel ?? 1
|
|
236678
|
+
});
|
|
236679
|
+
const previousOptionsZoomLevelRef = (0, import_react$9.useRef)(options.zoomLevel);
|
|
236200
236680
|
const getElementsByIds = (ids) => ids.map((id) => document.getElementById(id)).filter((element) => element instanceof HTMLElement);
|
|
236201
236681
|
const onEdit = (targets) => {
|
|
236202
236682
|
setActiveElements(targets.filter((target) => target instanceof HTMLElement));
|
|
@@ -236222,7 +236702,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236222
236702
|
if (targetPageIndex !== pageCursor) {
|
|
236223
236703
|
setPageCursor(targetPageIndex);
|
|
236224
236704
|
onPageCursorChange(targetPageIndex, schemasList.length);
|
|
236225
|
-
if (options.scroll !== false && canvasRef.current) canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, targetPageIndex,
|
|
236705
|
+
if (options.scroll !== false && canvasRef.current) canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, targetPageIndex, displayScale);
|
|
236226
236706
|
setTimeout(editSelectedSchemas);
|
|
236227
236707
|
return;
|
|
236228
236708
|
}
|
|
@@ -236230,7 +236710,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236230
236710
|
}, [
|
|
236231
236711
|
pageCursor,
|
|
236232
236712
|
pageSizes,
|
|
236233
|
-
|
|
236713
|
+
displayScale,
|
|
236234
236714
|
schemasList,
|
|
236235
236715
|
onPageCursorChange
|
|
236236
236716
|
]);
|
|
@@ -236255,15 +236735,18 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236255
236735
|
setHoveringSchemaId(null);
|
|
236256
236736
|
};
|
|
236257
236737
|
(0, import_react$9.useEffect)(() => {
|
|
236738
|
+
if (previousOptionsZoomLevelRef.current === options.zoomLevel) return;
|
|
236739
|
+
previousOptionsZoomLevelRef.current = options.zoomLevel;
|
|
236258
236740
|
if (typeof options.zoomLevel === "number") setZoomLevel(options.zoomLevel);
|
|
236259
|
-
}, [options.zoomLevel]);
|
|
236741
|
+
}, [options.zoomLevel, setZoomLevel]);
|
|
236260
236742
|
(0, import_react$9.useEffect)(() => {
|
|
236261
236743
|
if (typeof options.sidebarOpen === "boolean") setSidebarOpen(options.sidebarOpen);
|
|
236262
236744
|
}, [options.sidebarOpen]);
|
|
236263
236745
|
useScrollPageCursor({
|
|
236264
236746
|
ref: canvasRef,
|
|
236747
|
+
paperRefs,
|
|
236265
236748
|
pageSizes,
|
|
236266
|
-
scale,
|
|
236749
|
+
scale: displayScale,
|
|
236267
236750
|
pageCursor,
|
|
236268
236751
|
onChangePageCursor: (p) => {
|
|
236269
236752
|
setPageCursor(p);
|
|
@@ -236281,7 +236764,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236281
236764
|
observer.observe(canvasRef.current);
|
|
236282
236765
|
return () => observer.disconnect();
|
|
236283
236766
|
}
|
|
236284
|
-
}, [
|
|
236767
|
+
}, [displayScale]);
|
|
236285
236768
|
const commitSchemas = (0, import_react$9.useCallback)((newSchemas) => {
|
|
236286
236769
|
future.current = [];
|
|
236287
236770
|
past.current.push(cloneDeep$1(schemasList[pageCursor]));
|
|
@@ -236349,12 +236832,12 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236349
236832
|
} else setPageCursor((prev) => {
|
|
236350
236833
|
const clamped = Math.min(prev, sl.length - 1);
|
|
236351
236834
|
if (clamped !== prev && canvasRef.current) canvasRef.current.scroll({
|
|
236352
|
-
top: getPagesScrollTopByIndex(pageSizes, clamped,
|
|
236835
|
+
top: getPagesScrollTopByIndex(pageSizes, clamped, displayScale),
|
|
236353
236836
|
behavior: "smooth"
|
|
236354
236837
|
});
|
|
236355
236838
|
return clamped;
|
|
236356
236839
|
});
|
|
236357
|
-
}, [pageSizes,
|
|
236840
|
+
}, [pageSizes, displayScale]);
|
|
236358
236841
|
const addSchema = (defaultSchema) => {
|
|
236359
236842
|
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = isBlankPdf(template.basePdf) ? template.basePdf.padding : [
|
|
236360
236843
|
0,
|
|
@@ -236405,7 +236888,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236405
236888
|
refresh(newTemplate);
|
|
236406
236889
|
onPageCursorChange(newPageCursor, sl.length);
|
|
236407
236890
|
setTimeout(() => {
|
|
236408
|
-
if (canvasRef.current) canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, newPageCursor,
|
|
236891
|
+
if (canvasRef.current) canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, newPageCursor, displayScale);
|
|
236409
236892
|
}, 0);
|
|
236410
236893
|
};
|
|
236411
236894
|
const handleRemovePage = () => {
|
|
@@ -236424,11 +236907,6 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236424
236907
|
setPrevTemplate(template);
|
|
236425
236908
|
updateTemplate(template, true);
|
|
236426
236909
|
}
|
|
236427
|
-
const canvasWidth = size.width - 45;
|
|
236428
|
-
const sizeExcSidebars = {
|
|
236429
|
-
width: sidebarOpen ? canvasWidth - 400 : canvasWidth,
|
|
236430
|
-
height: size.height
|
|
236431
|
-
};
|
|
236432
236910
|
if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorScreen, {
|
|
236433
236911
|
size,
|
|
236434
236912
|
error
|
|
@@ -236439,7 +236917,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236439
236917
|
} : {};
|
|
236440
236918
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root_default, {
|
|
236441
236919
|
size,
|
|
236442
|
-
scale,
|
|
236920
|
+
scale: displayScale,
|
|
236443
236921
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DndContext, {
|
|
236444
236922
|
onDragEnd: (event) => {
|
|
236445
236923
|
if (!event.active) return;
|
|
@@ -236447,10 +236925,10 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236447
236925
|
const pageRect = paperRefs.current[pageCursor].getBoundingClientRect();
|
|
236448
236926
|
const dragStartLeft = active.rect.current.initial?.left || 0;
|
|
236449
236927
|
const dragStartTop = active.rect.current.initial?.top || 0;
|
|
236450
|
-
const canvasLeftOffsetFromPageCorner = pageRect.left - dragStartLeft + scaleDragPosAdjustment(20,
|
|
236928
|
+
const canvasLeftOffsetFromPageCorner = pageRect.left - dragStartLeft + scaleDragPosAdjustment(20, displayScale);
|
|
236451
236929
|
const canvasTopOffsetFromPageCorner = pageRect.top - dragStartTop;
|
|
236452
|
-
const moveY = (event.delta.y - canvasTopOffsetFromPageCorner) /
|
|
236453
|
-
const moveX = (event.delta.x - canvasLeftOffsetFromPageCorner) /
|
|
236930
|
+
const moveY = (event.delta.y - canvasTopOffsetFromPageCorner) / displayScale;
|
|
236931
|
+
const moveX = (event.delta.x - canvasLeftOffsetFromPageCorner) / displayScale;
|
|
236454
236932
|
const position = {
|
|
236455
236933
|
x: round$2(px2mm(Math.max(0, moveX)), 2),
|
|
236456
236934
|
y: round$2(px2mm(Math.max(0, moveY)), 2)
|
|
@@ -236463,7 +236941,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236463
236941
|
onDragStart: onEditEnd,
|
|
236464
236942
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeftSidebar, {
|
|
236465
236943
|
height: canvasHeight,
|
|
236466
|
-
scale,
|
|
236944
|
+
scale: displayScale,
|
|
236467
236945
|
basePdf: template.basePdf
|
|
236468
236946
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
236469
236947
|
style: {
|
|
@@ -236478,13 +236956,16 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236478
236956
|
pageNum: schemasList.length,
|
|
236479
236957
|
setPageCursor: (p) => {
|
|
236480
236958
|
if (!canvasRef.current) return;
|
|
236481
|
-
canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p,
|
|
236959
|
+
canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p, displayScale);
|
|
236482
236960
|
setPageCursor(p);
|
|
236483
236961
|
onPageCursorChange(p, schemasList.length);
|
|
236484
236962
|
onEditEnd();
|
|
236485
236963
|
},
|
|
236486
236964
|
zoomLevel,
|
|
236487
236965
|
setZoomLevel,
|
|
236966
|
+
zoomMode,
|
|
236967
|
+
fitWidth,
|
|
236968
|
+
fitHeight,
|
|
236488
236969
|
...pageManipulation
|
|
236489
236970
|
}),
|
|
236490
236971
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sidebar, {
|
|
@@ -236516,7 +236997,8 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236516
236997
|
onChangeHoveringSchemaId,
|
|
236517
236998
|
height: size.height - 30 * ZOOM,
|
|
236518
236999
|
pageCursor,
|
|
236519
|
-
scale,
|
|
237000
|
+
scale: displayScale,
|
|
237001
|
+
renderScale,
|
|
236520
237002
|
size: sizeExcSidebars,
|
|
236521
237003
|
pageSizes,
|
|
236522
237004
|
backgrounds,
|
|
@@ -236927,14 +237409,24 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
236927
237409
|
const paperRefs = (0, import_react$9.useRef)([]);
|
|
236928
237410
|
const [unitCursor, setUnitCursor] = (0, import_react$9.useState)(0);
|
|
236929
237411
|
const [pageCursor, setPageCursor] = (0, import_react$9.useState)(0);
|
|
236930
|
-
const [zoomLevel, setZoomLevel] = (0, import_react$9.useState)(options.zoomLevel ?? 1);
|
|
236931
237412
|
const [schemasList, setSchemasList] = (0, import_react$9.useState)([[]]);
|
|
236932
|
-
const { backgrounds, pageSizes,
|
|
237413
|
+
const { backgrounds, pageSizes, baseScale, error, refresh } = useUIPreProcessor({
|
|
236933
237414
|
template,
|
|
236934
237415
|
size,
|
|
236935
|
-
zoomLevel,
|
|
237416
|
+
zoomLevel: 1,
|
|
236936
237417
|
maxZoom
|
|
236937
237418
|
});
|
|
237419
|
+
const { displayScale, renderScale, zoomLevel, zoomMode, setZoomLevel, fitWidth, fitHeight } = useZoom({
|
|
237420
|
+
baseScale,
|
|
237421
|
+
maxZoom,
|
|
237422
|
+
pageCursor,
|
|
237423
|
+
pageSizes,
|
|
237424
|
+
containerRef,
|
|
237425
|
+
paperRefs,
|
|
237426
|
+
size,
|
|
237427
|
+
initialZoomLevel: options.zoomLevel ?? 1
|
|
237428
|
+
});
|
|
237429
|
+
const previousOptionsZoomLevelRef = (0, import_react$9.useRef)(options.zoomLevel);
|
|
236938
237430
|
const isForm = Boolean(onChangeInput);
|
|
236939
237431
|
const input = inputs[unitCursor];
|
|
236940
237432
|
const latestFontRef = (0, import_react$9.useRef)(font);
|
|
@@ -236973,8 +237465,10 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
236973
237465
|
}).catch((err) => console.error(`[@pdfme/ui] `, err));
|
|
236974
237466
|
}, []);
|
|
236975
237467
|
(0, import_react$9.useEffect)(() => {
|
|
237468
|
+
if (previousOptionsZoomLevelRef.current === options.zoomLevel) return;
|
|
237469
|
+
previousOptionsZoomLevelRef.current = options.zoomLevel;
|
|
236976
237470
|
if (typeof options.zoomLevel === "number") setZoomLevel(options.zoomLevel);
|
|
236977
|
-
}, [options.zoomLevel]);
|
|
237471
|
+
}, [options.zoomLevel, setZoomLevel]);
|
|
236978
237472
|
(0, import_react$9.useEffect)(() => {
|
|
236979
237473
|
if (unitCursor > inputs.length - 1) {
|
|
236980
237474
|
setUnitCursor(inputs.length - 1);
|
|
@@ -236990,8 +237484,9 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
236990
237484
|
]);
|
|
236991
237485
|
useScrollPageCursor({
|
|
236992
237486
|
ref: containerRef,
|
|
237487
|
+
paperRefs,
|
|
236993
237488
|
pageSizes,
|
|
236994
|
-
scale,
|
|
237489
|
+
scale: displayScale,
|
|
236995
237490
|
pageCursor,
|
|
236996
237491
|
onChangePageCursor: (p) => {
|
|
236997
237492
|
setPageCursor(p);
|
|
@@ -237054,7 +237549,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237054
237549
|
});
|
|
237055
237550
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Root_default, {
|
|
237056
237551
|
size,
|
|
237057
|
-
scale,
|
|
237552
|
+
scale: displayScale,
|
|
237058
237553
|
children: [
|
|
237059
237554
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CtlBar, {
|
|
237060
237555
|
size,
|
|
@@ -237062,7 +237557,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237062
237557
|
pageNum: schemasList.length,
|
|
237063
237558
|
setPageCursor: (p) => {
|
|
237064
237559
|
if (!containerRef.current) return;
|
|
237065
|
-
containerRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p,
|
|
237560
|
+
containerRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p, displayScale);
|
|
237066
237561
|
setPageCursor(p);
|
|
237067
237562
|
if (onPageChange) onPageChange({
|
|
237068
237563
|
currentPage: p,
|
|
@@ -237070,7 +237565,10 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237070
237565
|
});
|
|
237071
237566
|
},
|
|
237072
237567
|
zoomLevel,
|
|
237073
|
-
setZoomLevel
|
|
237568
|
+
setZoomLevel,
|
|
237569
|
+
zoomMode,
|
|
237570
|
+
fitWidth,
|
|
237571
|
+
fitHeight
|
|
237074
237572
|
}),
|
|
237075
237573
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnitPager, {
|
|
237076
237574
|
size,
|
|
@@ -237087,7 +237585,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237087
237585
|
},
|
|
237088
237586
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Paper, {
|
|
237089
237587
|
paperRefs,
|
|
237090
|
-
scale,
|
|
237588
|
+
scale: displayScale,
|
|
237091
237589
|
size,
|
|
237092
237590
|
schemasList,
|
|
237093
237591
|
pageSizes,
|
|
@@ -237114,12 +237612,12 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237114
237612
|
handleOnChangeRenderer(Array.isArray(arg) ? arg : [arg], schema);
|
|
237115
237613
|
},
|
|
237116
237614
|
outline: isForm && !schema.readOnly ? `1px dashed ${token.colorPrimary}` : "transparent",
|
|
237117
|
-
scale
|
|
237615
|
+
scale: renderScale
|
|
237118
237616
|
}, schema.id);
|
|
237119
237617
|
},
|
|
237120
237618
|
renderPaper: ({ index }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StaticSchema, {
|
|
237121
237619
|
template,
|
|
237122
|
-
scale,
|
|
237620
|
+
scale: renderScale,
|
|
237123
237621
|
input,
|
|
237124
237622
|
totalPages: schemasList.length,
|
|
237125
237623
|
currentPage: index + 1
|