@pdfme/ui 6.1.5-dev.1 → 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 +658 -148
- 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.",
|
|
@@ -98926,7 +98974,7 @@ $d636bc798e7178db$export$36b2f24e97d43be($21ee218f84ac7f32$export$2e2bcd8739ae03
|
|
|
98926
98974
|
$d636bc798e7178db$export$36b2f24e97d43be($cd5853a56c68fec7$export$2e2bcd8739ae039);
|
|
98927
98975
|
$d636bc798e7178db$export$36b2f24e97d43be($05f49f930186144e$export$2e2bcd8739ae039);
|
|
98928
98976
|
//#endregion
|
|
98929
|
-
//#region ../schemas/dist/splitRange-
|
|
98977
|
+
//#region ../schemas/dist/splitRange-BOUo4Tvl.js
|
|
98930
98978
|
var ALIGN_LEFT = "left";
|
|
98931
98979
|
var ALIGN_CENTER = "center";
|
|
98932
98980
|
var ALIGN_RIGHT = "right";
|
|
@@ -99167,16 +99215,28 @@ var fetchRemoteFontData = async (url) => {
|
|
|
99167
99215
|
var getFontKitFont = async (fontName, font, _cache) => {
|
|
99168
99216
|
const fntNm = fontName || getFallbackFontName(font);
|
|
99169
99217
|
const cacheKey = getCacheKey(fntNm);
|
|
99170
|
-
|
|
99171
|
-
|
|
99172
|
-
if (
|
|
99173
|
-
|
|
99174
|
-
|
|
99175
|
-
|
|
99176
|
-
|
|
99177
|
-
|
|
99178
|
-
|
|
99179
|
-
|
|
99218
|
+
const fontCache = _cache;
|
|
99219
|
+
const cachedFont = fontCache.get(cacheKey);
|
|
99220
|
+
if (cachedFont) return await cachedFont;
|
|
99221
|
+
const currentFont = font[fntNm] || getFallbackFont(font) || getDefaultFont()["Roboto"];
|
|
99222
|
+
const fontKitFontPromise = (async () => {
|
|
99223
|
+
let fontData = currentFont.data;
|
|
99224
|
+
if (typeof fontData === "string") if (fontData.startsWith("http")) fontData = await fetchRemoteFontData(fontData);
|
|
99225
|
+
else fontData = b64toUint8Array(fontData);
|
|
99226
|
+
let fontDataBuffer;
|
|
99227
|
+
if (fontData instanceof Buffer$1) fontDataBuffer = fontData;
|
|
99228
|
+
else fontDataBuffer = Buffer$1.from(fontData);
|
|
99229
|
+
return $d636bc798e7178db$export$185802fd694ee1f5(fontDataBuffer);
|
|
99230
|
+
})();
|
|
99231
|
+
fontCache.set(cacheKey, fontKitFontPromise);
|
|
99232
|
+
try {
|
|
99233
|
+
const fontKitFont = await fontKitFontPromise;
|
|
99234
|
+
fontCache.set(cacheKey, fontKitFont);
|
|
99235
|
+
return fontKitFont;
|
|
99236
|
+
} catch (error) {
|
|
99237
|
+
if (fontCache.get(cacheKey) === fontKitFontPromise) fontCache.delete(cacheKey);
|
|
99238
|
+
throw error;
|
|
99239
|
+
}
|
|
99180
99240
|
};
|
|
99181
99241
|
/**
|
|
99182
99242
|
* If using dynamic font size, iteratively increment or decrement the
|
|
@@ -99392,7 +99452,7 @@ var createTextLineSplitRange = (start, end) => createDynamicLayoutSplitRange(TEX
|
|
|
99392
99452
|
var getTableBodyRange = (schema) => getDynamicLayoutSplitRange(schema, TABLE_BODY_SPLIT_UNIT);
|
|
99393
99453
|
var getTextLineRange = (schema) => getDynamicLayoutSplitRange(schema, TEXT_LINE_SPLIT_UNIT);
|
|
99394
99454
|
//#endregion
|
|
99395
|
-
//#region ../schemas/dist/measure-
|
|
99455
|
+
//#region ../schemas/dist/measure-_MO-Voz3.js
|
|
99396
99456
|
var MARKDOWN_ESCAPABLE_CHARS = new Set([
|
|
99397
99457
|
"\\",
|
|
99398
99458
|
"*",
|
|
@@ -99991,7 +100051,7 @@ var getRichTextLineHeight = (line, fontSize) => {
|
|
|
99991
100051
|
return Math.max(...line.runs.map((run) => heightOfFontAtSize(run.fontKitFont, fontSize)));
|
|
99992
100052
|
};
|
|
99993
100053
|
//#endregion
|
|
99994
|
-
//#region ../schemas/dist/dynamicTemplate-
|
|
100054
|
+
//#region ../schemas/dist/dynamicTemplate-C9FSccAm.js
|
|
99995
100055
|
function _typeof$18(o) {
|
|
99996
100056
|
"@babel/helpers - typeof";
|
|
99997
100057
|
return _typeof$18 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -100555,7 +100615,7 @@ var getDynamicLayoutForTable = async (value, args) => {
|
|
|
100555
100615
|
};
|
|
100556
100616
|
};
|
|
100557
100617
|
//#endregion
|
|
100558
|
-
//#region ../schemas/dist/utils-
|
|
100618
|
+
//#region ../schemas/dist/utils-B8i6Nc_7.js
|
|
100559
100619
|
var convertForPdfLayoutProps = ({ schema, pageHeight, applyRotateTranslate = true }) => {
|
|
100560
100620
|
const { width: mmWidth, height: mmHeight, position, rotate, opacity } = schema;
|
|
100561
100621
|
const { x: mmX, y: mmY } = position;
|
|
@@ -100845,7 +100905,7 @@ var Underline = [["path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }], ["line", {
|
|
|
100845
100905
|
y2: "20"
|
|
100846
100906
|
}]];
|
|
100847
100907
|
//#endregion
|
|
100848
|
-
//#region ../schemas/dist/builtins-
|
|
100908
|
+
//#region ../schemas/dist/builtins-Bs4Z7Q4K.js
|
|
100849
100909
|
var addUriLinkAnnotation = (arg) => {
|
|
100850
100910
|
const { pdfDoc, page, uri, rect, borderWidth = 0 } = arg;
|
|
100851
100911
|
const safeUri = normalizeSafeLinkUri(uri);
|
|
@@ -102418,6 +102478,35 @@ var moveCommandToChangeSchemasArg = (props) => {
|
|
|
102418
102478
|
var getPagesScrollTopByIndex = (pageSizes, index, scale) => {
|
|
102419
102479
|
return pageSizes.slice(0, index).reduce((acc, cur) => acc + (cur.height * ZOOM + 30 * scale) * scale, 0);
|
|
102420
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
|
+
};
|
|
102421
102510
|
var handlePositionSizeChange = (schema, key, value, basePdf, pageSize) => {
|
|
102422
102511
|
const [pt, pr, pb, pl] = isBlankPdf(basePdf) ? basePdf.padding : [
|
|
102423
102512
|
0,
|
|
@@ -105429,7 +105518,7 @@ function canUseDom$1() {
|
|
|
105429
105518
|
* Wrap `React.useLayoutEffect` which will not throw warning message in test env
|
|
105430
105519
|
*/
|
|
105431
105520
|
var useInternalLayoutEffect$1 = canUseDom$1() ? import_react$9.useLayoutEffect : import_react$9.useEffect;
|
|
105432
|
-
var useLayoutEffect$
|
|
105521
|
+
var useLayoutEffect$7 = (callback, deps) => {
|
|
105433
105522
|
const firstMountRef = import_react$9.useRef(true);
|
|
105434
105523
|
useInternalLayoutEffect$1(() => {
|
|
105435
105524
|
return callback(firstMountRef.current);
|
|
@@ -105473,7 +105562,7 @@ var useSafeState$1 = (defaultValue) => {
|
|
|
105473
105562
|
function useControlledState(defaultStateValue, value) {
|
|
105474
105563
|
const [innerValue, setInnerValue] = (0, import_react$9.useState)(defaultStateValue);
|
|
105475
105564
|
const mergedValue = value !== void 0 ? value : innerValue;
|
|
105476
|
-
useLayoutEffect$
|
|
105565
|
+
useLayoutEffect$7((mount) => {
|
|
105477
105566
|
if (!mount) setInnerValue(value);
|
|
105478
105567
|
}, [value]);
|
|
105479
105568
|
return [mergedValue, setInnerValue];
|
|
@@ -105501,7 +105590,7 @@ var useId_default$2 = useOriginId$1 ? function useId(id) {
|
|
|
105501
105590
|
};
|
|
105502
105591
|
//#endregion
|
|
105503
105592
|
//#region node_modules/antd/node_modules/@rc-component/util/es/hooks/useMemo.js
|
|
105504
|
-
function useMemo$
|
|
105593
|
+
function useMemo$50(getValue, condition, shouldUpdate) {
|
|
105505
105594
|
const cacheRef = import_react$9.useRef({});
|
|
105506
105595
|
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
105507
105596
|
cacheRef.current.value = getValue();
|
|
@@ -105605,7 +105694,7 @@ var composeRef$1 = (...refs) => {
|
|
|
105605
105694
|
};
|
|
105606
105695
|
};
|
|
105607
105696
|
var useComposeRef$1 = (...refs) => {
|
|
105608
|
-
return useMemo$
|
|
105697
|
+
return useMemo$50(() => composeRef$1(...refs), refs, (prev, next) => prev.length !== next.length || prev.every((ref, i) => ref !== next[i]));
|
|
105609
105698
|
};
|
|
105610
105699
|
var supportRef$1 = (nodeOrComponent) => {
|
|
105611
105700
|
if (!nodeOrComponent) return false;
|
|
@@ -112567,13 +112656,13 @@ function useDom$1(render, debug) {
|
|
|
112567
112656
|
ele.parentElement?.removeChild(ele);
|
|
112568
112657
|
appendedRef.current = false;
|
|
112569
112658
|
}
|
|
112570
|
-
useLayoutEffect$
|
|
112659
|
+
useLayoutEffect$7(() => {
|
|
112571
112660
|
if (render) if (queueCreate) queueCreate(append);
|
|
112572
112661
|
else append();
|
|
112573
112662
|
else cleanup();
|
|
112574
112663
|
return cleanup;
|
|
112575
112664
|
}, [render]);
|
|
112576
|
-
useLayoutEffect$
|
|
112665
|
+
useLayoutEffect$7(() => {
|
|
112577
112666
|
if (queue.length) {
|
|
112578
112667
|
queue.forEach((appendFn) => appendFn());
|
|
112579
112668
|
setQueue(EMPTY_LIST$8);
|
|
@@ -112599,7 +112688,7 @@ function useScrollLocker$1(lock) {
|
|
|
112599
112688
|
uuid$6 += 1;
|
|
112600
112689
|
return `${UNIQUE_ID$1}_${uuid$6}`;
|
|
112601
112690
|
});
|
|
112602
|
-
useLayoutEffect$
|
|
112691
|
+
useLayoutEffect$7(() => {
|
|
112603
112692
|
if (mergedLock) {
|
|
112604
112693
|
const scrollbarSize = getTargetScrollBarSize$1(document.body).width;
|
|
112605
112694
|
updateCSS$1(`
|
|
@@ -112831,7 +112920,7 @@ var Popup$5 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
112831
112920
|
]);
|
|
112832
112921
|
const getPopupContainerNeedParams = getPopupContainer?.length > 0;
|
|
112833
112922
|
const [show, setShow] = import_react$9.useState(!getPopupContainer || !getPopupContainerNeedParams);
|
|
112834
|
-
useLayoutEffect$
|
|
112923
|
+
useLayoutEffect$7(() => {
|
|
112835
112924
|
if (!show && getPopupContainerNeedParams && target) setShow(true);
|
|
112836
112925
|
}, [
|
|
112837
112926
|
show,
|
|
@@ -113008,7 +113097,7 @@ function getPxValue$1(val) {
|
|
|
113008
113097
|
/**
|
|
113009
113098
|
* Get visible area of element
|
|
113010
113099
|
*/
|
|
113011
|
-
function getVisibleArea$
|
|
113100
|
+
function getVisibleArea$2(initArea, scrollerList) {
|
|
113012
113101
|
const visibleArea = { ...initArea };
|
|
113013
113102
|
(scrollerList || []).forEach((ele) => {
|
|
113014
113103
|
if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) return;
|
|
@@ -113184,8 +113273,8 @@ function useAlign$1(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
113184
113273
|
const VISIBLE_FIRST = "visibleFirst";
|
|
113185
113274
|
if (htmlRegion !== "scroll" && htmlRegion !== VISIBLE_FIRST) htmlRegion = VISIBLE;
|
|
113186
113275
|
const isVisibleFirst = htmlRegion === VISIBLE_FIRST;
|
|
113187
|
-
const scrollRegionArea = getVisibleArea$
|
|
113188
|
-
const visibleRegionArea = getVisibleArea$
|
|
113276
|
+
const scrollRegionArea = getVisibleArea$2(scrollRegion, scrollerList);
|
|
113277
|
+
const visibleRegionArea = getVisibleArea$2(visibleRegion, scrollerList);
|
|
113189
113278
|
const visibleArea = htmlRegion === VISIBLE ? visibleRegionArea : scrollRegionArea;
|
|
113190
113279
|
const adjustCheckVisibleArea = isVisibleFirst ? visibleRegionArea : visibleArea;
|
|
113191
113280
|
popupElement.style.left = "auto";
|
|
@@ -113378,8 +113467,8 @@ function useAlign$1(open, popupEle, target, placement, builtinPlacements, popupA
|
|
|
113378
113467
|
ready: false
|
|
113379
113468
|
}));
|
|
113380
113469
|
};
|
|
113381
|
-
useLayoutEffect$
|
|
113382
|
-
useLayoutEffect$
|
|
113470
|
+
useLayoutEffect$7(resetReady, [placement]);
|
|
113471
|
+
useLayoutEffect$7(() => {
|
|
113383
113472
|
if (!open) resetReady();
|
|
113384
113473
|
}, [open]);
|
|
113385
113474
|
return [
|
|
@@ -113423,7 +113512,7 @@ function useDelay() {
|
|
|
113423
113512
|
//#endregion
|
|
113424
113513
|
//#region node_modules/antd/node_modules/@rc-component/trigger/es/hooks/useWatch.js
|
|
113425
113514
|
function useWatch$3(open, target, popup, onAlign, onScroll) {
|
|
113426
|
-
useLayoutEffect$
|
|
113515
|
+
useLayoutEffect$7(() => {
|
|
113427
113516
|
if (open && target && popup) {
|
|
113428
113517
|
const targetElement = target;
|
|
113429
113518
|
const popupElement = popup;
|
|
@@ -113788,7 +113877,7 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113788
113877
|
id,
|
|
113789
113878
|
onEsc
|
|
113790
113879
|
}));
|
|
113791
|
-
useLayoutEffect$
|
|
113880
|
+
useLayoutEffect$7(() => {
|
|
113792
113881
|
if (uniqueContext && unique && targetEle && !openUncontrolled && !parentContext) if (mergedOpen) uniqueContext.show(getUniqueOptions(mouseEnterDelay), isOpen);
|
|
113793
113882
|
else uniqueContext.hide(mouseLeaveDelay);
|
|
113794
113883
|
}, [mergedOpen, targetEle]);
|
|
@@ -113824,7 +113913,7 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113824
113913
|
if (top) triggerOpen(false);
|
|
113825
113914
|
}
|
|
113826
113915
|
const [inMotion, setInMotion] = import_react$9.useState(false);
|
|
113827
|
-
useLayoutEffect$
|
|
113916
|
+
useLayoutEffect$7((firstMount) => {
|
|
113828
113917
|
if (!firstMount || mergedOpen) setInMotion(true);
|
|
113829
113918
|
}, [mergedOpen]);
|
|
113830
113919
|
const [motionPrepareResolve, setMotionPrepareResolve] = import_react$9.useState(null);
|
|
@@ -113843,10 +113932,10 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113843
113932
|
if (openRef.current && alignPoint && clickToHide) triggerOpen(false);
|
|
113844
113933
|
};
|
|
113845
113934
|
useWatch$3(mergedOpen, targetEle, popupEle, triggerAlign, onScroll);
|
|
113846
|
-
useLayoutEffect$
|
|
113935
|
+
useLayoutEffect$7(() => {
|
|
113847
113936
|
triggerAlign();
|
|
113848
113937
|
}, [mousePos, popupPlacement]);
|
|
113849
|
-
useLayoutEffect$
|
|
113938
|
+
useLayoutEffect$7(() => {
|
|
113850
113939
|
if (mergedOpen && !builtinPlacements?.[popupPlacement]) triggerAlign();
|
|
113851
113940
|
}, [JSON.stringify(popupAlign)]);
|
|
113852
113941
|
const alignedClassName = import_react$9.useMemo(() => {
|
|
@@ -113886,7 +113975,7 @@ function generateTrigger$1(PortalComponent = es_default$30) {
|
|
|
113886
113975
|
syncTargetSize();
|
|
113887
113976
|
setMotionPrepareResolve(() => resolve);
|
|
113888
113977
|
});
|
|
113889
|
-
useLayoutEffect$
|
|
113978
|
+
useLayoutEffect$7(() => {
|
|
113890
113979
|
if (motionPrepareResolve) {
|
|
113891
113980
|
onAlign();
|
|
113892
113981
|
motionPrepareResolve();
|
|
@@ -114145,7 +114234,7 @@ function useTheme$1(theme, parentTheme, config) {
|
|
|
114145
114234
|
cssVar: parentTheme?.cssVar
|
|
114146
114235
|
} : parentTheme;
|
|
114147
114236
|
const themeKey = (0, import_react$9.useId)();
|
|
114148
|
-
return useMemo$
|
|
114237
|
+
return useMemo$50(() => {
|
|
114149
114238
|
if (!theme) return parentTheme;
|
|
114150
114239
|
const mergedComponents = { ...parentThemeConfig.components };
|
|
114151
114240
|
Object.keys(theme.components || {}).forEach((componentName) => {
|
|
@@ -114333,7 +114422,7 @@ var ProviderChildren$1 = (props) => {
|
|
|
114333
114422
|
autoInsertSpace: autoInsertSpaceInButton,
|
|
114334
114423
|
...config.button
|
|
114335
114424
|
};
|
|
114336
|
-
const memoedConfig = useMemo$
|
|
114425
|
+
const memoedConfig = useMemo$50(() => config, config, (prevConfig, currentConfig) => {
|
|
114337
114426
|
const prevKeys = Object.keys(prevConfig);
|
|
114338
114427
|
const currentKeys = Object.keys(currentConfig);
|
|
114339
114428
|
return prevKeys.length !== currentKeys.length || prevKeys.some((key) => prevConfig[key] !== currentConfig[key]);
|
|
@@ -116433,7 +116522,7 @@ var Button$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
116433
116522
|
isMountRef.current = true;
|
|
116434
116523
|
};
|
|
116435
116524
|
}, []);
|
|
116436
|
-
useLayoutEffect$
|
|
116525
|
+
useLayoutEffect$7(() => {
|
|
116437
116526
|
let delayTimer = null;
|
|
116438
116527
|
if (loadingOrDelay.delay > 0) delayTimer = setTimeout(() => {
|
|
116439
116528
|
delayTimer = null;
|
|
@@ -119633,7 +119722,7 @@ function useBreakpoint$1(refreshOnChange = true, defaultScreens = {}) {
|
|
|
119633
119722
|
const screensRef = (0, import_react$9.useRef)(defaultScreens);
|
|
119634
119723
|
const [, forceUpdate] = useForceUpdate$1();
|
|
119635
119724
|
const responsiveObserver = useResponsiveObserver$1();
|
|
119636
|
-
useLayoutEffect$
|
|
119725
|
+
useLayoutEffect$7(() => {
|
|
119637
119726
|
const token = responsiveObserver.subscribe((supportScreens) => {
|
|
119638
119727
|
screensRef.current = supportScreens;
|
|
119639
119728
|
if (refreshOnChange) forceUpdate();
|
|
@@ -120877,7 +120966,7 @@ function Overflow$1(props, ref) {
|
|
|
120877
120966
|
function getItemWidth(index) {
|
|
120878
120967
|
return itemWidths.get(getKey(mergedData[index], index));
|
|
120879
120968
|
}
|
|
120880
|
-
useLayoutEffect$
|
|
120969
|
+
useLayoutEffect$7(() => {
|
|
120881
120970
|
if (mergedContainerWidth && typeof mergedRestWidth === "number" && mergedData) {
|
|
120882
120971
|
let totalWidth = prefixWidth + suffixWidth;
|
|
120883
120972
|
const len = mergedData.length;
|
|
@@ -121019,7 +121108,7 @@ function mergeProps$2(origin, target) {
|
|
|
121019
121108
|
}
|
|
121020
121109
|
function InheritableContextProvider$1({ children, locked, ...restProps }) {
|
|
121021
121110
|
const context = import_react$9.useContext(MenuContext$3);
|
|
121022
|
-
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)));
|
|
121023
121112
|
return /* @__PURE__ */ import_react$9.createElement(MenuContext$3.Provider, { value: inheritableContext }, children);
|
|
121024
121113
|
}
|
|
121025
121114
|
//#endregion
|
|
@@ -126476,7 +126565,7 @@ var ResizableTextArea$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref)
|
|
|
126476
126565
|
const startResize = () => {
|
|
126477
126566
|
setResizeState(RESIZE_START$1);
|
|
126478
126567
|
};
|
|
126479
|
-
useLayoutEffect$
|
|
126568
|
+
useLayoutEffect$7(() => {
|
|
126480
126569
|
if (needAutoSize) startResize();
|
|
126481
126570
|
}, [
|
|
126482
126571
|
value,
|
|
@@ -126484,7 +126573,7 @@ var ResizableTextArea$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref)
|
|
|
126484
126573
|
maxRows,
|
|
126485
126574
|
needAutoSize
|
|
126486
126575
|
]);
|
|
126487
|
-
useLayoutEffect$
|
|
126576
|
+
useLayoutEffect$7(() => {
|
|
126488
126577
|
if (resizeState === RESIZE_START$1) setResizeState(RESIZE_MEASURING$1);
|
|
126489
126578
|
else if (resizeState === RESIZE_MEASURING$1) {
|
|
126490
126579
|
const textareaStyles = calculateAutoSizeStyle$1(textareaRef.current, false, minRows, maxRows);
|
|
@@ -127627,7 +127716,7 @@ var FormItemInput$1 = (props) => {
|
|
|
127627
127716
|
}, [formContext]);
|
|
127628
127717
|
const extraRef = import_react$9.useRef(null);
|
|
127629
127718
|
const [extraHeight, setExtraHeight] = import_react$9.useState(0);
|
|
127630
|
-
useLayoutEffect$
|
|
127719
|
+
useLayoutEffect$7(() => {
|
|
127631
127720
|
if (extra && extraRef.current) setExtraHeight(extraRef.current.clientHeight);
|
|
127632
127721
|
else setExtraHeight(0);
|
|
127633
127722
|
}, [extra]);
|
|
@@ -127825,7 +127914,7 @@ function ItemHolder$1(props) {
|
|
|
127825
127914
|
const hasError = !!(hasHelp || errors.length || warnings.length);
|
|
127826
127915
|
const isOnScreen = !!itemRef.current && isVisible_default$1(itemRef.current);
|
|
127827
127916
|
const [marginBottom, setMarginBottom] = import_react$9.useState(null);
|
|
127828
|
-
useLayoutEffect$
|
|
127917
|
+
useLayoutEffect$7(() => {
|
|
127829
127918
|
if (hasError && itemRef.current) {
|
|
127830
127919
|
const itemStyle = getComputedStyle(itemRef.current);
|
|
127831
127920
|
setMarginBottom(Number.parseInt(itemStyle.marginBottom, 10));
|
|
@@ -128245,7 +128334,7 @@ var OTPInput$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
128245
128334
|
function strToArr$1(str) {
|
|
128246
128335
|
return (str || "").split("");
|
|
128247
128336
|
}
|
|
128248
|
-
var Separator$
|
|
128337
|
+
var Separator$2 = (props) => {
|
|
128249
128338
|
const { index, prefixCls, separator, className: semanticClassName, style: semanticStyle } = props;
|
|
128250
128339
|
const separatorNode = isFunction$4(separator) ? separator(index) : separator;
|
|
128251
128340
|
if (!separatorNode) return null;
|
|
@@ -128372,7 +128461,7 @@ var OTP$1 = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
128372
128461
|
autoFocus: index === 0 && autoFocus,
|
|
128373
128462
|
onFocus: (event) => onInputFocus(event, index),
|
|
128374
128463
|
...inputSharedProps
|
|
128375
|
-
}), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator$
|
|
128464
|
+
}), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator$2, {
|
|
128376
128465
|
separator,
|
|
128377
128466
|
index,
|
|
128378
128467
|
prefixCls,
|
|
@@ -130666,7 +130755,7 @@ function EllipsisMeasure(props) {
|
|
|
130666
130755
|
const [needEllipsis, setNeedEllipsis] = import_react$9.useState(STATUS_MEASURE_NONE);
|
|
130667
130756
|
const [ellipsisHeight, setEllipsisHeight] = import_react$9.useState(0);
|
|
130668
130757
|
const [parentWhiteSpace, setParentWhiteSpace] = import_react$9.useState(null);
|
|
130669
|
-
useLayoutEffect$
|
|
130758
|
+
useLayoutEffect$7(() => {
|
|
130670
130759
|
if (enableMeasure && width && nodeLen) setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
130671
130760
|
else setNeedEllipsis(STATUS_MEASURE_NONE);
|
|
130672
130761
|
}, [
|
|
@@ -130676,7 +130765,7 @@ function EllipsisMeasure(props) {
|
|
|
130676
130765
|
enableMeasure,
|
|
130677
130766
|
nodeList
|
|
130678
130767
|
].concat(_toConsumableArray$14(measureDeps)));
|
|
130679
|
-
useLayoutEffect$
|
|
130768
|
+
useLayoutEffect$7(() => {
|
|
130680
130769
|
if (needEllipsis === STATUS_MEASURE_PREPARE) {
|
|
130681
130770
|
setNeedEllipsis(STATUS_MEASURE_START);
|
|
130682
130771
|
setParentWhiteSpace(measureWhiteSpaceRef.current && getComputedStyle(measureWhiteSpaceRef.current).whiteSpace);
|
|
@@ -130693,7 +130782,7 @@ function EllipsisMeasure(props) {
|
|
|
130693
130782
|
}
|
|
130694
130783
|
}, [needEllipsis]);
|
|
130695
130784
|
const cutMidIndex = ellipsisCutIndex ? Math.ceil((ellipsisCutIndex[0] + ellipsisCutIndex[1]) / 2) : 0;
|
|
130696
|
-
useLayoutEffect$
|
|
130785
|
+
useLayoutEffect$7(() => {
|
|
130697
130786
|
const [minIndex, maxIndex] = ellipsisCutIndex || [0, 0];
|
|
130698
130787
|
if (minIndex !== maxIndex) {
|
|
130699
130788
|
const isOverflow = (cutMidRef.current?.getHeight() || 0) > ellipsisHeight;
|
|
@@ -130809,7 +130898,7 @@ var Base = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
130809
130898
|
setEditing(edit);
|
|
130810
130899
|
};
|
|
130811
130900
|
const prevEditing = usePrevious$1(editing);
|
|
130812
|
-
useLayoutEffect$
|
|
130901
|
+
useLayoutEffect$7(() => {
|
|
130813
130902
|
if (!editing && prevEditing) editIconRef.current?.focus();
|
|
130814
130903
|
}, [editing]);
|
|
130815
130904
|
const onEditClick = (e) => {
|
|
@@ -130848,7 +130937,7 @@ var Base = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
130848
130937
|
enableEdit,
|
|
130849
130938
|
enableCopy
|
|
130850
130939
|
]);
|
|
130851
|
-
useLayoutEffect$
|
|
130940
|
+
useLayoutEffect$7(() => {
|
|
130852
130941
|
if (enableEllipsis && !needMeasureEllipsis) {
|
|
130853
130942
|
setIsLineClampSupport(isStyleSupport$1("webkitLineClamp"));
|
|
130854
130943
|
setIsTextOverflowSupport(isStyleSupport$1("textOverflow"));
|
|
@@ -130864,7 +130953,7 @@ var Base = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
130864
130953
|
isTextOverflowSupport,
|
|
130865
130954
|
isLineClampSupport
|
|
130866
130955
|
]);
|
|
130867
|
-
useLayoutEffect$
|
|
130956
|
+
useLayoutEffect$7(() => {
|
|
130868
130957
|
setCssEllipsis(canUseCssEllipsis && mergedEnableEllipsis);
|
|
130869
130958
|
}, [canUseCssEllipsis, mergedEnableEllipsis]);
|
|
130870
130959
|
const tooltipProps = useTooltipProps(ellipsisConfig.tooltip, editConfig.text, children);
|
|
@@ -131702,6 +131791,46 @@ var Minus = createLucideIcon("minus", [["path", {
|
|
|
131702
131791
|
* This source code is licensed under the ISC license.
|
|
131703
131792
|
* See the LICENSE file in the root directory of this source tree.
|
|
131704
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
|
+
*/
|
|
131705
131834
|
var Plus = createLucideIcon("plus", [["path", {
|
|
131706
131835
|
d: "M5 12h14",
|
|
131707
131836
|
key: "1ays0h"
|
|
@@ -132377,41 +132506,340 @@ var useUIPreProcessor = ({ template, size, zoomLevel, maxZoom }) => {
|
|
|
132377
132506
|
return {
|
|
132378
132507
|
backgrounds,
|
|
132379
132508
|
pageSizes,
|
|
132509
|
+
baseScale: scale,
|
|
132380
132510
|
scale: scale * zoomLevel,
|
|
132381
132511
|
error,
|
|
132382
132512
|
refresh
|
|
132383
132513
|
};
|
|
132384
132514
|
};
|
|
132385
|
-
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 }) => {
|
|
132386
132819
|
const onScroll = (0, import_react$9.useCallback)(() => {
|
|
132387
132820
|
if (!pageSizes[0] || !ref.current) return;
|
|
132388
|
-
const
|
|
132389
|
-
const { top } = ref.current.getBoundingClientRect();
|
|
132390
|
-
const pageHeights = pageSizes.reduce((acc, cur, i) => {
|
|
132391
|
-
let value = (cur.height * ZOOM + 30) * scale;
|
|
132392
|
-
if (i === 0) value += top - value / 2;
|
|
132393
|
-
else value += acc[i - 1];
|
|
132394
|
-
return acc.concat(value);
|
|
132395
|
-
}, []);
|
|
132396
|
-
let _pageCursor = 0;
|
|
132397
|
-
pageHeights.forEach((ph, i) => {
|
|
132398
|
-
if (scroll > ph) _pageCursor = i + 1 >= pageHeights.length ? pageHeights.length - 1 : i + 1;
|
|
132399
|
-
});
|
|
132821
|
+
const _pageCursor = getMostVisiblePageIndex(ref.current, paperRefs, pageCursor);
|
|
132400
132822
|
if (_pageCursor !== pageCursor) onChangePageCursor(_pageCursor);
|
|
132401
132823
|
}, [
|
|
132402
132824
|
onChangePageCursor,
|
|
132403
132825
|
pageCursor,
|
|
132404
132826
|
pageSizes,
|
|
132405
|
-
|
|
132406
|
-
|
|
132827
|
+
paperRefs,
|
|
132828
|
+
ref
|
|
132407
132829
|
]);
|
|
132408
132830
|
(0, import_react$9.useEffect)(() => {
|
|
132409
132831
|
const node = ref.current;
|
|
132410
132832
|
node?.addEventListener("scroll", onScroll);
|
|
132833
|
+
const animationFrame = window.requestAnimationFrame(onScroll);
|
|
132411
132834
|
return () => {
|
|
132835
|
+
window.cancelAnimationFrame(animationFrame);
|
|
132412
132836
|
node?.removeEventListener("scroll", onScroll);
|
|
132413
132837
|
};
|
|
132414
|
-
}, [
|
|
132838
|
+
}, [
|
|
132839
|
+
ref,
|
|
132840
|
+
onScroll,
|
|
132841
|
+
scale
|
|
132842
|
+
]);
|
|
132415
132843
|
};
|
|
132416
132844
|
var useMountStatus = () => {
|
|
132417
132845
|
const [isMounted, setIsMounted] = (0, import_react$9.useState)(false);
|
|
@@ -134901,7 +135329,7 @@ function updateCSS(css, key) {
|
|
|
134901
135329
|
}
|
|
134902
135330
|
//#endregion
|
|
134903
135331
|
//#region ../../node_modules/rc-util/es/hooks/useMemo.js
|
|
134904
|
-
function useMemo$
|
|
135332
|
+
function useMemo$31(getValue, condition, shouldUpdate) {
|
|
134905
135333
|
var cacheRef = import_react$9.useRef({});
|
|
134906
135334
|
if (!("value" in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
134907
135335
|
cacheRef.current.value = getValue();
|
|
@@ -136156,7 +136584,7 @@ var composeRef = function composeRef() {
|
|
|
136156
136584
|
};
|
|
136157
136585
|
var useComposeRef = function useComposeRef() {
|
|
136158
136586
|
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) refs[_key2] = arguments[_key2];
|
|
136159
|
-
return useMemo$
|
|
136587
|
+
return useMemo$31(function() {
|
|
136160
136588
|
return composeRef.apply(void 0, refs);
|
|
136161
136589
|
}, refs, function(prev, next) {
|
|
136162
136590
|
return prev.length !== next.length || prev.every(function(ref, i) {
|
|
@@ -138868,7 +139296,7 @@ function useTheme(theme, parentTheme, config) {
|
|
|
138868
139296
|
cssVar: parentTheme === null || parentTheme === void 0 ? void 0 : parentTheme.cssVar
|
|
138869
139297
|
}) : parentTheme;
|
|
138870
139298
|
const themeKey = useThemeKey();
|
|
138871
|
-
return useMemo$
|
|
139299
|
+
return useMemo$31(() => {
|
|
138872
139300
|
var _a, _b;
|
|
138873
139301
|
if (!theme) return parentTheme;
|
|
138874
139302
|
const mergedComponents = Object.assign({}, parentThemeConfig.components);
|
|
@@ -139683,7 +140111,7 @@ var ProviderChildren = (props) => {
|
|
|
139683
140111
|
if (propValue) config[propName] = propValue;
|
|
139684
140112
|
});
|
|
139685
140113
|
if (typeof autoInsertSpaceInButton !== "undefined") config.button = Object.assign({ autoInsertSpace: autoInsertSpaceInButton }, config.button);
|
|
139686
|
-
const memoedConfig = useMemo$
|
|
140114
|
+
const memoedConfig = useMemo$31(() => config, config, (prevConfig, currentConfig) => {
|
|
139687
140115
|
const prevKeys = Object.keys(prevConfig);
|
|
139688
140116
|
const currentKeys = Object.keys(currentConfig);
|
|
139689
140117
|
return prevKeys.length !== currentKeys.length || prevKeys.some((key) => prevConfig[key] !== currentConfig[key]);
|
|
@@ -163188,7 +163616,7 @@ var __rest$44 = function(s, e) {
|
|
|
163188
163616
|
function strToArr(str) {
|
|
163189
163617
|
return (str || "").split("");
|
|
163190
163618
|
}
|
|
163191
|
-
var Separator = (props) => {
|
|
163619
|
+
var Separator$1 = (props) => {
|
|
163192
163620
|
const { index, prefixCls, separator } = props;
|
|
163193
163621
|
const separatorNode = typeof separator === "function" ? separator(index) : separator;
|
|
163194
163622
|
if (!separatorNode) return null;
|
|
@@ -163310,7 +163738,7 @@ var OTP = /* @__PURE__ */ import_react$9.forwardRef((props, ref) => {
|
|
|
163310
163738
|
value: singleValue,
|
|
163311
163739
|
onActiveChange: onInputActiveChange,
|
|
163312
163740
|
autoFocus: index === 0 && autoFocus
|
|
163313
|
-
}, inputSharedProps)), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator, {
|
|
163741
|
+
}, inputSharedProps)), index < length - 1 && /* @__PURE__ */ import_react$9.createElement(Separator$1, {
|
|
163314
163742
|
separator,
|
|
163315
163743
|
index,
|
|
163316
163744
|
prefixCls
|
|
@@ -168604,7 +169032,7 @@ var RefOptionList$1 = /* @__PURE__ */ import_react$9.forwardRef(function OptionL
|
|
|
168604
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;
|
|
168605
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;
|
|
168606
169034
|
var itemPrefixCls = "".concat(prefixCls, "-item");
|
|
168607
|
-
var memoFlattenOptions = useMemo$
|
|
169035
|
+
var memoFlattenOptions = useMemo$31(function() {
|
|
168608
169036
|
return flattenOptions;
|
|
168609
169037
|
}, [open, flattenOptions], function(prev, next) {
|
|
168610
169038
|
return next[0] && prev[1] !== next[1];
|
|
@@ -174004,7 +174432,7 @@ var RefOptionList = /* @__PURE__ */ import_react$9.forwardRef(function OptionLis
|
|
|
174004
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;
|
|
174005
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;
|
|
174006
174434
|
var treeRef = import_react$9.useRef();
|
|
174007
|
-
var memoTreeData = useMemo$
|
|
174435
|
+
var memoTreeData = useMemo$31(function() {
|
|
174008
174436
|
return treeData;
|
|
174009
174437
|
}, [open, treeData], function(prev, next) {
|
|
174010
174438
|
return next[0] && prev[1] !== next[1];
|
|
@@ -174149,7 +174577,7 @@ var RefOptionList = /* @__PURE__ */ import_react$9.forwardRef(function OptionLis
|
|
|
174149
174577
|
onKeyUp: function onKeyUp() {}
|
|
174150
174578
|
};
|
|
174151
174579
|
});
|
|
174152
|
-
var syncLoadData = useMemo$
|
|
174580
|
+
var syncLoadData = useMemo$31(function() {
|
|
174153
174581
|
return searchValue ? false : true;
|
|
174154
174582
|
}, [searchValue, treeExpandedKeys || expandedKeys], function(_ref2, _ref3) {
|
|
174155
174583
|
var preSearchValue = _slicedToArray$16(_ref2, 1)[0];
|
|
@@ -199023,7 +199451,7 @@ function mergeProps(origin, target) {
|
|
|
199023
199451
|
function InheritableContextProvider(_ref) {
|
|
199024
199452
|
var children = _ref.children, locked = _ref.locked, restProps = _objectWithoutProperties$2(_ref, _excluded$18);
|
|
199025
199453
|
var context = import_react$9.useContext(MenuContext$1);
|
|
199026
|
-
var inheritableContext = useMemo$
|
|
199454
|
+
var inheritableContext = useMemo$31(function() {
|
|
199027
199455
|
return mergeProps(context, restProps);
|
|
199028
199456
|
}, [context, restProps], function(prev, next) {
|
|
199029
199457
|
return !locked && (prev[0] !== next[0] || !isEqual(prev[1], next[1], true));
|
|
@@ -204227,7 +204655,7 @@ function isRenderCell(data) {
|
|
|
204227
204655
|
}
|
|
204228
204656
|
function useCellRender(record, dataIndex, renderIndex, children, render, shouldCellUpdate) {
|
|
204229
204657
|
var perfRecord = import_react$9.useContext(PerfContext);
|
|
204230
|
-
return useMemo$
|
|
204658
|
+
return useMemo$31(function() {
|
|
204231
204659
|
if (validateValue(children)) return [children];
|
|
204232
204660
|
var value = get$1(record, dataIndex === null || dataIndex === void 0 || dataIndex === "" ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex]);
|
|
204233
204661
|
var returnChildNode = value;
|
|
@@ -205397,7 +205825,7 @@ function useFixedInfo(flattenColumns, stickyOffsets, direction) {
|
|
|
205397
205825
|
var fixedInfoList = flattenColumns.map(function(_, colIndex) {
|
|
205398
205826
|
return getCellFixedInfo(colIndex, colIndex, flattenColumns, stickyOffsets, direction);
|
|
205399
205827
|
});
|
|
205400
|
-
return useMemo$
|
|
205828
|
+
return useMemo$31(function() {
|
|
205401
205829
|
return fixedInfoList;
|
|
205402
205830
|
}, [fixedInfoList], function(prev, next) {
|
|
205403
205831
|
return !isEqual(prev, next);
|
|
@@ -214385,7 +214813,7 @@ function _regeneratorRuntime() {
|
|
|
214385
214813
|
//#region ../../node_modules/form-render/es/index.js
|
|
214386
214814
|
var es_default = withProvider(FormCore, widgets_exports);
|
|
214387
214815
|
//#endregion
|
|
214388
|
-
//#region ../schemas/dist/helper-
|
|
214816
|
+
//#region ../schemas/dist/helper-CbU88kUO.js
|
|
214389
214817
|
var substituteVariables = (text, variablesIn, valueMapper = (value) => value) => {
|
|
214390
214818
|
if (!text) return "";
|
|
214391
214819
|
let substitutedText = text;
|
|
@@ -214421,7 +214849,7 @@ var validateVariables = (value, schema) => {
|
|
|
214421
214849
|
return true;
|
|
214422
214850
|
};
|
|
214423
214851
|
//#endregion
|
|
214424
|
-
//#region ../schemas/dist/dynamicTemplate-
|
|
214852
|
+
//#region ../schemas/dist/dynamicTemplate-DILLiIp6.js
|
|
214425
214853
|
var getDynamicLayoutForMultiVariableText = async (value, args) => {
|
|
214426
214854
|
if (args.schema.type !== "multiVariableText") return { heights: [args.schema.height] };
|
|
214427
214855
|
const schema = args.schema;
|
|
@@ -235466,7 +235894,7 @@ var DeleteButton = ({ activeElements: aes }) => {
|
|
|
235466
235894
|
});
|
|
235467
235895
|
};
|
|
235468
235896
|
var Canvas = (props, ref) => {
|
|
235469
|
-
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;
|
|
235470
235898
|
const { token } = theme_default.useToken();
|
|
235471
235899
|
const pluginsRegistry = (0, import_react$9.useContext)(PluginsRegistry);
|
|
235472
235900
|
const verticalGuides = (0, import_react$9.useRef)([]);
|
|
@@ -235503,6 +235931,9 @@ var Canvas = (props, ref) => {
|
|
|
235503
235931
|
schemasList,
|
|
235504
235932
|
prevSchemas
|
|
235505
235933
|
]);
|
|
235934
|
+
(0, import_react$9.useEffect)(() => {
|
|
235935
|
+
moveable.current?.updateRect();
|
|
235936
|
+
}, [renderScale]);
|
|
235506
235937
|
const onDrag = ({ target, top, left }) => {
|
|
235507
235938
|
const { width: _width, height: _height } = target.style;
|
|
235508
235939
|
const targetWidth = fmt(_width);
|
|
@@ -235732,7 +236163,7 @@ var Canvas = (props, ref) => {
|
|
|
235732
236163
|
basePdf
|
|
235733
236164
|
},
|
|
235734
236165
|
input: Object.fromEntries(schemasList.flat().map(({ name, content = "" }) => [name, content])),
|
|
235735
|
-
scale,
|
|
236166
|
+
scale: renderScale,
|
|
235736
236167
|
totalPages: schemasList.length,
|
|
235737
236168
|
currentPage: index + 1
|
|
235738
236169
|
}),
|
|
@@ -235804,7 +236235,7 @@ var Canvas = (props, ref) => {
|
|
|
235804
236235
|
} : void 0,
|
|
235805
236236
|
stopEditing: () => setEditing(false),
|
|
235806
236237
|
outline: `1px ${hoveringSchemaId === schema.id ? "solid" : "dashed"} ${schema.readOnly && hoveringSchemaId !== schema.id ? "transparent" : token.colorPrimary}`,
|
|
235807
|
-
scale
|
|
236238
|
+
scale: renderScale
|
|
235808
236239
|
}, schema.id);
|
|
235809
236240
|
}
|
|
235810
236241
|
})]
|
|
@@ -235981,42 +236412,74 @@ var ErrorScreen = ({ size, error }) => {
|
|
|
235981
236412
|
//#endregion
|
|
235982
236413
|
//#region src/components/CtlBar.tsx
|
|
235983
236414
|
var { Text: Text$1 } = Typography;
|
|
235984
|
-
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 }) => {
|
|
235985
236436
|
const zoomStep = .25;
|
|
235986
236437
|
const maxZoom = useMaxZoom();
|
|
235987
|
-
const minZoom = .25;
|
|
235988
236438
|
const nextZoomOut = zoomLevel - zoomStep;
|
|
235989
236439
|
const nextZoomIn = zoomLevel + zoomStep;
|
|
236440
|
+
const iconProps = {
|
|
236441
|
+
size: 16,
|
|
236442
|
+
color: style.textStyle.color
|
|
236443
|
+
};
|
|
235990
236444
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
235991
236445
|
style: {
|
|
235992
236446
|
display: "flex",
|
|
235993
236447
|
alignItems: "center"
|
|
235994
236448
|
},
|
|
235995
236449
|
children: [
|
|
235996
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236450
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarButton, {
|
|
235997
236451
|
className: UI_CLASSNAME + "zoom-out",
|
|
235998
|
-
|
|
235999
|
-
disabled:
|
|
236452
|
+
label: labels.zoomOut,
|
|
236453
|
+
disabled: zoomLevel <= MIN_ZOOM,
|
|
236000
236454
|
onClick: () => setZoomLevel(nextZoomOut),
|
|
236001
|
-
|
|
236002
|
-
size: 16,
|
|
236003
|
-
color: style.textStyle.color
|
|
236004
|
-
})
|
|
236455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Minus, { ...iconProps })
|
|
236005
236456
|
}),
|
|
236006
236457
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text$1, {
|
|
236007
236458
|
strong: true,
|
|
236008
236459
|
style: style.textStyle,
|
|
236009
236460
|
children: [Math.round(zoomLevel * 100), "%"]
|
|
236010
236461
|
}),
|
|
236011
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236462
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolbarButton, {
|
|
236012
236463
|
className: UI_CLASSNAME + "zoom-in",
|
|
236013
|
-
|
|
236014
|
-
disabled: maxZoom
|
|
236464
|
+
label: labels.zoomIn,
|
|
236465
|
+
disabled: maxZoom <= zoomLevel,
|
|
236015
236466
|
onClick: () => setZoomLevel(nextZoomIn),
|
|
236016
|
-
|
|
236017
|
-
|
|
236018
|
-
|
|
236019
|
-
|
|
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 })
|
|
236020
236483
|
})
|
|
236021
236484
|
]
|
|
236022
236485
|
});
|
|
@@ -236077,7 +236540,7 @@ var ContextMenu = ({ items, style }) => /* @__PURE__ */ (0, import_jsx_runtime.j
|
|
|
236077
236540
|
var CtlBar = (props) => {
|
|
236078
236541
|
const { token } = theme_default.useToken();
|
|
236079
236542
|
const i18n = (0, import_react$9.useContext)(I18nContext);
|
|
236080
|
-
const { size, pageCursor, pageNum, setPageCursor, zoomLevel, setZoomLevel, addPageAfter, removePage } = props;
|
|
236543
|
+
const { size, pageCursor, pageNum, setPageCursor, zoomLevel, setZoomLevel, zoomMode, fitWidth, fitHeight, addPageAfter, removePage } = props;
|
|
236081
236544
|
const contextMenuItems = [];
|
|
236082
236545
|
if (addPageAfter) contextMenuItems.push({
|
|
236083
236546
|
key: "1",
|
|
@@ -236093,9 +236556,6 @@ var CtlBar = (props) => {
|
|
|
236093
236556
|
children: i18n("removePage")
|
|
236094
236557
|
})
|
|
236095
236558
|
});
|
|
236096
|
-
const barWidth = 300;
|
|
236097
|
-
const contextMenuWidth = contextMenuItems.length > 0 ? 50 : 0;
|
|
236098
|
-
const width = (pageNum > 1 ? barWidth : barWidth / 2) + contextMenuWidth;
|
|
236099
236559
|
const textStyle = {
|
|
236100
236560
|
color: token.colorWhite,
|
|
236101
236561
|
fontSize: token.fontSize,
|
|
@@ -236106,23 +236566,26 @@ var CtlBar = (props) => {
|
|
|
236106
236566
|
position: "absolute",
|
|
236107
236567
|
top: "auto",
|
|
236108
236568
|
bottom: "6%",
|
|
236109
|
-
width: size.width
|
|
236569
|
+
width: size.width,
|
|
236570
|
+
display: "flex",
|
|
236571
|
+
justifyContent: "center",
|
|
236572
|
+
pointerEvents: "none"
|
|
236110
236573
|
},
|
|
236111
236574
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
236112
236575
|
className: UI_CLASSNAME + "control-bar",
|
|
236113
236576
|
style: {
|
|
236114
|
-
display: "flex",
|
|
236577
|
+
display: "inline-flex",
|
|
236115
236578
|
alignItems: "center",
|
|
236116
|
-
justifyContent: "
|
|
236579
|
+
justifyContent: "center",
|
|
236117
236580
|
position: "relative",
|
|
236118
236581
|
zIndex: 1,
|
|
236119
|
-
left: `calc(50% - ${width / 2}px)`,
|
|
236120
|
-
width,
|
|
236121
236582
|
height: 40,
|
|
236122
236583
|
boxSizing: "border-box",
|
|
236123
236584
|
padding: token.paddingSM,
|
|
236585
|
+
gap: token.marginXS,
|
|
236124
236586
|
borderRadius: token.borderRadius,
|
|
236125
|
-
backgroundColor: token.colorBgMask
|
|
236587
|
+
backgroundColor: token.colorBgMask,
|
|
236588
|
+
pointerEvents: "auto"
|
|
236126
236589
|
},
|
|
236127
236590
|
children: [
|
|
236128
236591
|
pageNum > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
@@ -236139,7 +236602,16 @@ var CtlBar = (props) => {
|
|
|
236139
236602
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Zoom, {
|
|
236140
236603
|
style: { textStyle },
|
|
236141
236604
|
zoomLevel,
|
|
236142
|
-
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
|
+
}
|
|
236143
236615
|
})
|
|
236144
236616
|
}),
|
|
236145
236617
|
contextMenuItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContextMenu, {
|
|
@@ -236175,16 +236647,36 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236175
236647
|
const [activeElements, setActiveElements] = (0, import_react$9.useState)([]);
|
|
236176
236648
|
const [schemasList, setSchemasList] = (0, import_react$9.useState)([[]]);
|
|
236177
236649
|
const [pageCursor, setPageCursor] = (0, import_react$9.useState)(0);
|
|
236178
|
-
const [zoomLevel, setZoomLevel] = (0, import_react$9.useState)(options.zoomLevel ?? 1);
|
|
236179
236650
|
const [sidebarOpen, setSidebarOpen] = (0, import_react$9.useState)(options.sidebarOpen ?? true);
|
|
236180
236651
|
const [canvasHeight, setCanvasHeight] = (0, import_react$9.useState)(0);
|
|
236181
236652
|
const [prevTemplate, setPrevTemplate] = (0, import_react$9.useState)(null);
|
|
236182
|
-
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({
|
|
236183
236663
|
template,
|
|
236184
|
-
size,
|
|
236185
|
-
zoomLevel,
|
|
236664
|
+
size: sizeExcSidebars,
|
|
236665
|
+
zoomLevel: 1,
|
|
236186
236666
|
maxZoom
|
|
236187
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);
|
|
236188
236680
|
const getElementsByIds = (ids) => ids.map((id) => document.getElementById(id)).filter((element) => element instanceof HTMLElement);
|
|
236189
236681
|
const onEdit = (targets) => {
|
|
236190
236682
|
setActiveElements(targets.filter((target) => target instanceof HTMLElement));
|
|
@@ -236210,7 +236702,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236210
236702
|
if (targetPageIndex !== pageCursor) {
|
|
236211
236703
|
setPageCursor(targetPageIndex);
|
|
236212
236704
|
onPageCursorChange(targetPageIndex, schemasList.length);
|
|
236213
|
-
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);
|
|
236214
236706
|
setTimeout(editSelectedSchemas);
|
|
236215
236707
|
return;
|
|
236216
236708
|
}
|
|
@@ -236218,7 +236710,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236218
236710
|
}, [
|
|
236219
236711
|
pageCursor,
|
|
236220
236712
|
pageSizes,
|
|
236221
|
-
|
|
236713
|
+
displayScale,
|
|
236222
236714
|
schemasList,
|
|
236223
236715
|
onPageCursorChange
|
|
236224
236716
|
]);
|
|
@@ -236243,15 +236735,18 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236243
236735
|
setHoveringSchemaId(null);
|
|
236244
236736
|
};
|
|
236245
236737
|
(0, import_react$9.useEffect)(() => {
|
|
236738
|
+
if (previousOptionsZoomLevelRef.current === options.zoomLevel) return;
|
|
236739
|
+
previousOptionsZoomLevelRef.current = options.zoomLevel;
|
|
236246
236740
|
if (typeof options.zoomLevel === "number") setZoomLevel(options.zoomLevel);
|
|
236247
|
-
}, [options.zoomLevel]);
|
|
236741
|
+
}, [options.zoomLevel, setZoomLevel]);
|
|
236248
236742
|
(0, import_react$9.useEffect)(() => {
|
|
236249
236743
|
if (typeof options.sidebarOpen === "boolean") setSidebarOpen(options.sidebarOpen);
|
|
236250
236744
|
}, [options.sidebarOpen]);
|
|
236251
236745
|
useScrollPageCursor({
|
|
236252
236746
|
ref: canvasRef,
|
|
236747
|
+
paperRefs,
|
|
236253
236748
|
pageSizes,
|
|
236254
|
-
scale,
|
|
236749
|
+
scale: displayScale,
|
|
236255
236750
|
pageCursor,
|
|
236256
236751
|
onChangePageCursor: (p) => {
|
|
236257
236752
|
setPageCursor(p);
|
|
@@ -236269,7 +236764,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236269
236764
|
observer.observe(canvasRef.current);
|
|
236270
236765
|
return () => observer.disconnect();
|
|
236271
236766
|
}
|
|
236272
|
-
}, [
|
|
236767
|
+
}, [displayScale]);
|
|
236273
236768
|
const commitSchemas = (0, import_react$9.useCallback)((newSchemas) => {
|
|
236274
236769
|
future.current = [];
|
|
236275
236770
|
past.current.push(cloneDeep$1(schemasList[pageCursor]));
|
|
@@ -236337,12 +236832,12 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236337
236832
|
} else setPageCursor((prev) => {
|
|
236338
236833
|
const clamped = Math.min(prev, sl.length - 1);
|
|
236339
236834
|
if (clamped !== prev && canvasRef.current) canvasRef.current.scroll({
|
|
236340
|
-
top: getPagesScrollTopByIndex(pageSizes, clamped,
|
|
236835
|
+
top: getPagesScrollTopByIndex(pageSizes, clamped, displayScale),
|
|
236341
236836
|
behavior: "smooth"
|
|
236342
236837
|
});
|
|
236343
236838
|
return clamped;
|
|
236344
236839
|
});
|
|
236345
|
-
}, [pageSizes,
|
|
236840
|
+
}, [pageSizes, displayScale]);
|
|
236346
236841
|
const addSchema = (defaultSchema) => {
|
|
236347
236842
|
const [paddingTop, paddingRight, paddingBottom, paddingLeft] = isBlankPdf(template.basePdf) ? template.basePdf.padding : [
|
|
236348
236843
|
0,
|
|
@@ -236393,7 +236888,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236393
236888
|
refresh(newTemplate);
|
|
236394
236889
|
onPageCursorChange(newPageCursor, sl.length);
|
|
236395
236890
|
setTimeout(() => {
|
|
236396
|
-
if (canvasRef.current) canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, newPageCursor,
|
|
236891
|
+
if (canvasRef.current) canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, newPageCursor, displayScale);
|
|
236397
236892
|
}, 0);
|
|
236398
236893
|
};
|
|
236399
236894
|
const handleRemovePage = () => {
|
|
@@ -236412,11 +236907,6 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236412
236907
|
setPrevTemplate(template);
|
|
236413
236908
|
updateTemplate(template, true);
|
|
236414
236909
|
}
|
|
236415
|
-
const canvasWidth = size.width - 45;
|
|
236416
|
-
const sizeExcSidebars = {
|
|
236417
|
-
width: sidebarOpen ? canvasWidth - 400 : canvasWidth,
|
|
236418
|
-
height: size.height
|
|
236419
|
-
};
|
|
236420
236910
|
if (error) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorScreen, {
|
|
236421
236911
|
size,
|
|
236422
236912
|
error
|
|
@@ -236427,7 +236917,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236427
236917
|
} : {};
|
|
236428
236918
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root_default, {
|
|
236429
236919
|
size,
|
|
236430
|
-
scale,
|
|
236920
|
+
scale: displayScale,
|
|
236431
236921
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DndContext, {
|
|
236432
236922
|
onDragEnd: (event) => {
|
|
236433
236923
|
if (!event.active) return;
|
|
@@ -236435,10 +236925,10 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236435
236925
|
const pageRect = paperRefs.current[pageCursor].getBoundingClientRect();
|
|
236436
236926
|
const dragStartLeft = active.rect.current.initial?.left || 0;
|
|
236437
236927
|
const dragStartTop = active.rect.current.initial?.top || 0;
|
|
236438
|
-
const canvasLeftOffsetFromPageCorner = pageRect.left - dragStartLeft + scaleDragPosAdjustment(20,
|
|
236928
|
+
const canvasLeftOffsetFromPageCorner = pageRect.left - dragStartLeft + scaleDragPosAdjustment(20, displayScale);
|
|
236439
236929
|
const canvasTopOffsetFromPageCorner = pageRect.top - dragStartTop;
|
|
236440
|
-
const moveY = (event.delta.y - canvasTopOffsetFromPageCorner) /
|
|
236441
|
-
const moveX = (event.delta.x - canvasLeftOffsetFromPageCorner) /
|
|
236930
|
+
const moveY = (event.delta.y - canvasTopOffsetFromPageCorner) / displayScale;
|
|
236931
|
+
const moveX = (event.delta.x - canvasLeftOffsetFromPageCorner) / displayScale;
|
|
236442
236932
|
const position = {
|
|
236443
236933
|
x: round$2(px2mm(Math.max(0, moveX)), 2),
|
|
236444
236934
|
y: round$2(px2mm(Math.max(0, moveY)), 2)
|
|
@@ -236451,7 +236941,7 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236451
236941
|
onDragStart: onEditEnd,
|
|
236452
236942
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LeftSidebar, {
|
|
236453
236943
|
height: canvasHeight,
|
|
236454
|
-
scale,
|
|
236944
|
+
scale: displayScale,
|
|
236455
236945
|
basePdf: template.basePdf
|
|
236456
236946
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
236457
236947
|
style: {
|
|
@@ -236466,13 +236956,16 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236466
236956
|
pageNum: schemasList.length,
|
|
236467
236957
|
setPageCursor: (p) => {
|
|
236468
236958
|
if (!canvasRef.current) return;
|
|
236469
|
-
canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p,
|
|
236959
|
+
canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p, displayScale);
|
|
236470
236960
|
setPageCursor(p);
|
|
236471
236961
|
onPageCursorChange(p, schemasList.length);
|
|
236472
236962
|
onEditEnd();
|
|
236473
236963
|
},
|
|
236474
236964
|
zoomLevel,
|
|
236475
236965
|
setZoomLevel,
|
|
236966
|
+
zoomMode,
|
|
236967
|
+
fitWidth,
|
|
236968
|
+
fitHeight,
|
|
236476
236969
|
...pageManipulation
|
|
236477
236970
|
}),
|
|
236478
236971
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sidebar, {
|
|
@@ -236504,7 +236997,8 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
236504
236997
|
onChangeHoveringSchemaId,
|
|
236505
236998
|
height: size.height - 30 * ZOOM,
|
|
236506
236999
|
pageCursor,
|
|
236507
|
-
scale,
|
|
237000
|
+
scale: displayScale,
|
|
237001
|
+
renderScale,
|
|
236508
237002
|
size: sizeExcSidebars,
|
|
236509
237003
|
pageSizes,
|
|
236510
237004
|
backgrounds,
|
|
@@ -236669,7 +237163,7 @@ var Designer = class extends BaseUIClass {
|
|
|
236669
237163
|
}
|
|
236670
237164
|
};
|
|
236671
237165
|
//#endregion
|
|
236672
|
-
//#region ../schemas/dist/dynamicTemplate-
|
|
237166
|
+
//#region ../schemas/dist/dynamicTemplate-C4UKzQbP.js
|
|
236673
237167
|
var normalizeListItems = (value) => {
|
|
236674
237168
|
if (Array.isArray(value)) return value.map((item) => String(item));
|
|
236675
237169
|
if (typeof value !== "string") return value == null ? [] : [String(value)];
|
|
@@ -236915,14 +237409,24 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
236915
237409
|
const paperRefs = (0, import_react$9.useRef)([]);
|
|
236916
237410
|
const [unitCursor, setUnitCursor] = (0, import_react$9.useState)(0);
|
|
236917
237411
|
const [pageCursor, setPageCursor] = (0, import_react$9.useState)(0);
|
|
236918
|
-
const [zoomLevel, setZoomLevel] = (0, import_react$9.useState)(options.zoomLevel ?? 1);
|
|
236919
237412
|
const [schemasList, setSchemasList] = (0, import_react$9.useState)([[]]);
|
|
236920
|
-
const { backgrounds, pageSizes,
|
|
237413
|
+
const { backgrounds, pageSizes, baseScale, error, refresh } = useUIPreProcessor({
|
|
236921
237414
|
template,
|
|
236922
237415
|
size,
|
|
236923
|
-
zoomLevel,
|
|
237416
|
+
zoomLevel: 1,
|
|
236924
237417
|
maxZoom
|
|
236925
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);
|
|
236926
237430
|
const isForm = Boolean(onChangeInput);
|
|
236927
237431
|
const input = inputs[unitCursor];
|
|
236928
237432
|
const latestFontRef = (0, import_react$9.useRef)(font);
|
|
@@ -236961,8 +237465,10 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
236961
237465
|
}).catch((err) => console.error(`[@pdfme/ui] `, err));
|
|
236962
237466
|
}, []);
|
|
236963
237467
|
(0, import_react$9.useEffect)(() => {
|
|
237468
|
+
if (previousOptionsZoomLevelRef.current === options.zoomLevel) return;
|
|
237469
|
+
previousOptionsZoomLevelRef.current = options.zoomLevel;
|
|
236964
237470
|
if (typeof options.zoomLevel === "number") setZoomLevel(options.zoomLevel);
|
|
236965
|
-
}, [options.zoomLevel]);
|
|
237471
|
+
}, [options.zoomLevel, setZoomLevel]);
|
|
236966
237472
|
(0, import_react$9.useEffect)(() => {
|
|
236967
237473
|
if (unitCursor > inputs.length - 1) {
|
|
236968
237474
|
setUnitCursor(inputs.length - 1);
|
|
@@ -236978,8 +237484,9 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
236978
237484
|
]);
|
|
236979
237485
|
useScrollPageCursor({
|
|
236980
237486
|
ref: containerRef,
|
|
237487
|
+
paperRefs,
|
|
236981
237488
|
pageSizes,
|
|
236982
|
-
scale,
|
|
237489
|
+
scale: displayScale,
|
|
236983
237490
|
pageCursor,
|
|
236984
237491
|
onChangePageCursor: (p) => {
|
|
236985
237492
|
setPageCursor(p);
|
|
@@ -237042,7 +237549,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237042
237549
|
});
|
|
237043
237550
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Root_default, {
|
|
237044
237551
|
size,
|
|
237045
|
-
scale,
|
|
237552
|
+
scale: displayScale,
|
|
237046
237553
|
children: [
|
|
237047
237554
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CtlBar, {
|
|
237048
237555
|
size,
|
|
@@ -237050,7 +237557,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237050
237557
|
pageNum: schemasList.length,
|
|
237051
237558
|
setPageCursor: (p) => {
|
|
237052
237559
|
if (!containerRef.current) return;
|
|
237053
|
-
containerRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p,
|
|
237560
|
+
containerRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, p, displayScale);
|
|
237054
237561
|
setPageCursor(p);
|
|
237055
237562
|
if (onPageChange) onPageChange({
|
|
237056
237563
|
currentPage: p,
|
|
@@ -237058,7 +237565,10 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237058
237565
|
});
|
|
237059
237566
|
},
|
|
237060
237567
|
zoomLevel,
|
|
237061
|
-
setZoomLevel
|
|
237568
|
+
setZoomLevel,
|
|
237569
|
+
zoomMode,
|
|
237570
|
+
fitWidth,
|
|
237571
|
+
fitHeight
|
|
237062
237572
|
}),
|
|
237063
237573
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnitPager, {
|
|
237064
237574
|
size,
|
|
@@ -237075,7 +237585,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237075
237585
|
},
|
|
237076
237586
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Paper, {
|
|
237077
237587
|
paperRefs,
|
|
237078
|
-
scale,
|
|
237588
|
+
scale: displayScale,
|
|
237079
237589
|
size,
|
|
237080
237590
|
schemasList,
|
|
237081
237591
|
pageSizes,
|
|
@@ -237102,12 +237612,12 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
|
|
|
237102
237612
|
handleOnChangeRenderer(Array.isArray(arg) ? arg : [arg], schema);
|
|
237103
237613
|
},
|
|
237104
237614
|
outline: isForm && !schema.readOnly ? `1px dashed ${token.colorPrimary}` : "transparent",
|
|
237105
|
-
scale
|
|
237615
|
+
scale: renderScale
|
|
237106
237616
|
}, schema.id);
|
|
237107
237617
|
},
|
|
237108
237618
|
renderPaper: ({ index }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StaticSchema, {
|
|
237109
237619
|
template,
|
|
237110
|
-
scale,
|
|
237620
|
+
scale: renderScale,
|
|
237111
237621
|
input,
|
|
237112
237622
|
totalPages: schemasList.length,
|
|
237113
237623
|
currentPage: index + 1
|