@pdfme/ui 6.1.2-dev.3 → 6.1.2-dev.31
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/Designer.d.ts +8 -0
- package/dist/components/Designer/index.d.ts +4 -1
- package/dist/designerSelection.d.ts +45 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +163 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/Designer.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Template, DesignerProps } from '@pdfme/common';
|
|
2
2
|
import { BaseUIClass } from './class.js';
|
|
3
|
+
import { type DesignerSelectSchemasOptions, type DesignerSchemaSelectionTarget, type DesignerSelectedSchema, type DesignerSelection, type DesignerSelectionChangeCallback } from './designerSelection.js';
|
|
3
4
|
declare class Designer extends BaseUIClass {
|
|
4
5
|
private onSaveTemplateCallback?;
|
|
5
6
|
private onChangeTemplateCallback?;
|
|
6
7
|
private onPageChangeCallback?;
|
|
8
|
+
private onChangeSelectionCallback?;
|
|
7
9
|
private pageCursor;
|
|
10
|
+
private selection;
|
|
11
|
+
private selectSchemasHandler;
|
|
8
12
|
constructor(props: DesignerProps);
|
|
9
13
|
saveTemplate(): void;
|
|
10
14
|
updateTemplate(template: Template): void;
|
|
@@ -14,6 +18,10 @@ declare class Designer extends BaseUIClass {
|
|
|
14
18
|
currentPage: number;
|
|
15
19
|
totalPages: number;
|
|
16
20
|
}) => void): void;
|
|
21
|
+
onChangeSelection(cb: DesignerSelectionChangeCallback): void;
|
|
22
|
+
getSelection(): DesignerSelection;
|
|
23
|
+
getSelectedSchemas(): DesignerSelectedSchema[];
|
|
24
|
+
selectSchemas(targets: DesignerSchemaSelectionTarget | DesignerSchemaSelectionTarget[], options?: DesignerSelectSchemasOptions): void;
|
|
17
25
|
getPageCursor(): number;
|
|
18
26
|
getTotalPages(): number;
|
|
19
27
|
protected render(): void;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Template, DesignerProps, Size } from '@pdfme/common';
|
|
3
|
-
|
|
3
|
+
import { type DesignerSelectSchemas, type DesignerSelection } from '../../designerSelection.js';
|
|
4
|
+
declare const TemplateEditor: ({ template, size, onSaveTemplate, onChangeTemplate, onPageCursorChange, onChangeSelection, onRegisterSchemaSelectionHandler, }: Omit<DesignerProps, "domContainer"> & {
|
|
4
5
|
size: Size;
|
|
5
6
|
onSaveTemplate: (t: Template) => void;
|
|
6
7
|
onChangeTemplate: (t: Template) => void;
|
|
8
|
+
onChangeSelection?: (selection: DesignerSelection) => void;
|
|
9
|
+
onRegisterSchemaSelectionHandler?: (handler: DesignerSelectSchemas | null) => void;
|
|
7
10
|
} & {
|
|
8
11
|
onChangeTemplate: (t: Template) => void;
|
|
9
12
|
onPageCursorChange: (newPageCursor: number, totalPages: number) => void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type Schema, type SchemaForUI } from '@pdfme/common';
|
|
2
|
+
export type DesignerSelectionBounds = {
|
|
3
|
+
height: number;
|
|
4
|
+
width: number;
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
};
|
|
8
|
+
export type DesignerSelectedSchema = {
|
|
9
|
+
name: string;
|
|
10
|
+
pageIndex: number;
|
|
11
|
+
schema: Schema;
|
|
12
|
+
schemaId: string;
|
|
13
|
+
schemaIndex: number;
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
export type DesignerSelection = {
|
|
17
|
+
bounds: DesignerSelectionBounds | null;
|
|
18
|
+
pageIndex: number;
|
|
19
|
+
schemas: DesignerSelectedSchema[];
|
|
20
|
+
};
|
|
21
|
+
export type DesignerSelectionChangeCallback = (selection: DesignerSelection) => void;
|
|
22
|
+
export type DesignerSchemaSelectionTarget = string | {
|
|
23
|
+
name?: string;
|
|
24
|
+
pageIndex?: number;
|
|
25
|
+
schemaId?: string;
|
|
26
|
+
schemaIndex?: number;
|
|
27
|
+
};
|
|
28
|
+
export type DesignerSelectSchemasOptions = {
|
|
29
|
+
pageIndex?: number;
|
|
30
|
+
scroll?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type DesignerSelectSchemas = (targets: DesignerSchemaSelectionTarget | DesignerSchemaSelectionTarget[], options?: DesignerSelectSchemasOptions) => void;
|
|
33
|
+
export declare const EMPTY_DESIGNER_SELECTION: DesignerSelection;
|
|
34
|
+
export declare const createDesignerSelection: ({ activeSchemaIds, pageIndex, schemasList, }: {
|
|
35
|
+
activeSchemaIds: string[];
|
|
36
|
+
pageIndex: number;
|
|
37
|
+
schemasList: SchemaForUI[][];
|
|
38
|
+
}) => DesignerSelection;
|
|
39
|
+
export declare const normalizeDesignerSchemaSelectionTargets: (targets: DesignerSchemaSelectionTarget | DesignerSchemaSelectionTarget[]) => DesignerSchemaSelectionTarget[];
|
|
40
|
+
export declare const getDesignerSelectionPageIndex: (targets: DesignerSchemaSelectionTarget[], fallbackPageIndex: number, options?: DesignerSelectSchemasOptions) => number;
|
|
41
|
+
export declare const getSelectedSchemaIds: ({ pageIndex, schemas, targets, }: {
|
|
42
|
+
pageIndex: number;
|
|
43
|
+
schemas: SchemaForUI[];
|
|
44
|
+
targets: DesignerSchemaSelectionTarget[];
|
|
45
|
+
}) => string[];
|
package/dist/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ import Designer from './Designer.js';
|
|
|
2
2
|
import Form from './Form.js';
|
|
3
3
|
import Viewer from './Viewer.js';
|
|
4
4
|
export { Designer, Viewer, Form };
|
|
5
|
+
export type { DesignerSchemaSelectionTarget, DesignerSelectSchemas, DesignerSelectSchemasOptions, DesignerSelectedSchema, DesignerSelection, DesignerSelectionBounds, DesignerSelectionChangeCallback, } from './designerSelection.js';
|
package/dist/index.js
CHANGED
|
@@ -45966,7 +45966,7 @@ var UIProps = CommonProps.extend({
|
|
|
45966
45966
|
});
|
|
45967
45967
|
var PreviewProps = UIProps.extend({ inputs: Inputs }).strict();
|
|
45968
45968
|
var DesignerProps = UIProps.extend({}).strict();
|
|
45969
|
-
var cloneDeep$1 = structuredClone;
|
|
45969
|
+
var cloneDeep$1 = (value) => structuredClone(value);
|
|
45970
45970
|
var uniq = (array) => Array.from(new Set(array));
|
|
45971
45971
|
var getFallbackFontName = (font) => {
|
|
45972
45972
|
const initial = "";
|
|
@@ -46665,6 +46665,10 @@ var getDynamicTemplate = async (arg) => {
|
|
|
46665
46665
|
const PARALLEL_LIMIT = 10;
|
|
46666
46666
|
for (let pageIndex = 0; pageIndex < template.schemas.length; pageIndex++) {
|
|
46667
46667
|
const pageSchemas = template.schemas[pageIndex];
|
|
46668
|
+
if (pageSchemas.length === 0) {
|
|
46669
|
+
resultPages.push([]);
|
|
46670
|
+
continue;
|
|
46671
|
+
}
|
|
46668
46672
|
const { items, orderMap } = normalizePageSchemas(pageSchemas, paddingTop);
|
|
46669
46673
|
for (let i = 0; i < items.length; i += PARALLEL_LIMIT) {
|
|
46670
46674
|
const chunk = items.slice(i, i + PARALLEL_LIMIT);
|
|
@@ -46681,7 +46685,6 @@ var getDynamicTemplate = async (arg) => {
|
|
|
46681
46685
|
const processedPages = processDynamicPage(items, orderMap, contentHeight, paddingTop);
|
|
46682
46686
|
resultPages.push(...processedPages);
|
|
46683
46687
|
}
|
|
46684
|
-
removeTrailingEmptyPages(resultPages);
|
|
46685
46688
|
if (resultPages.length === template.schemas.length) {
|
|
46686
46689
|
let unchanged = true;
|
|
46687
46690
|
for (let i = 0; i < resultPages.length && unchanged; i++) {
|
|
@@ -100555,7 +100558,7 @@ var Underline = [["path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }], ["line", {
|
|
|
100555
100558
|
y2: "20"
|
|
100556
100559
|
}]];
|
|
100557
100560
|
//#endregion
|
|
100558
|
-
//#region ../schemas/dist/builtins-
|
|
100561
|
+
//#region ../schemas/dist/builtins-D9sJvrz9.js
|
|
100559
100562
|
var addUriLinkAnnotation = (arg) => {
|
|
100560
100563
|
const { pdfDoc, page, uri, rect, borderWidth = 0 } = arg;
|
|
100561
100564
|
const safeUri = normalizeSafeLinkUri(uri);
|
|
@@ -101738,6 +101741,8 @@ var getRangedPlainTextValue = (arg) => {
|
|
|
101738
101741
|
var buildStyledTextContainer = (arg, fontKitFont, value, resolvedDynamicFontSize) => {
|
|
101739
101742
|
const { schema, rootElement, mode } = arg;
|
|
101740
101743
|
let dynamicFontSize = resolvedDynamicFontSize;
|
|
101744
|
+
const characterSpacing = schema.characterSpacing ?? 0;
|
|
101745
|
+
const editable = isEditable(mode, schema);
|
|
101741
101746
|
if (dynamicFontSize === void 0 && shouldUseDynamicFontSize(schema, arg.basePdf) && value) dynamicFontSize = calculateDynamicFontSize({
|
|
101742
101747
|
textSchema: schema,
|
|
101743
101748
|
fontKitFont,
|
|
@@ -101772,7 +101777,7 @@ var buildStyledTextContainer = (arg, fontKitFont, value, resolvedDynamicFontSize
|
|
|
101772
101777
|
justifyContent: mapVerticalAlignToFlex(verticalAlignment),
|
|
101773
101778
|
width: "100%",
|
|
101774
101779
|
height: "100%",
|
|
101775
|
-
cursor:
|
|
101780
|
+
cursor: editable ? "text" : "default"
|
|
101776
101781
|
};
|
|
101777
101782
|
Object.assign(container.style, containerStyle);
|
|
101778
101783
|
rootElement.innerHTML = "";
|
|
@@ -101784,7 +101789,7 @@ var buildStyledTextContainer = (arg, fontKitFont, value, resolvedDynamicFontSize
|
|
|
101784
101789
|
fontFamily: schema.fontName ? `'${schema.fontName}'` : "inherit",
|
|
101785
101790
|
color: schema.fontColor ? schema.fontColor : DEFAULT_FONT_COLOR,
|
|
101786
101791
|
fontSize: `${dynamicFontSize ?? schema.fontSize ?? 13}pt`,
|
|
101787
|
-
letterSpacing: `${
|
|
101792
|
+
letterSpacing: `${characterSpacing}pt`,
|
|
101788
101793
|
lineHeight: `${schema.lineHeight ?? 1}em`,
|
|
101789
101794
|
textAlign: schema.alignment ?? "left",
|
|
101790
101795
|
whiteSpace: "pre-wrap",
|
|
@@ -101796,6 +101801,7 @@ var buildStyledTextContainer = (arg, fontKitFont, value, resolvedDynamicFontSize
|
|
|
101796
101801
|
paddingTop: `${topAdjustment}px`,
|
|
101797
101802
|
backgroundColor: "transparent",
|
|
101798
101803
|
textDecoration: textDecorations.join(" "),
|
|
101804
|
+
...editable && characterSpacing > 0 ? { width: `calc(100% + ${characterSpacing}pt)` } : {},
|
|
101799
101805
|
...isTopAligned ? { height: "100%" } : {}
|
|
101800
101806
|
};
|
|
101801
101807
|
const textBlock = document.createElement("div");
|
|
@@ -213907,7 +213913,7 @@ withProvider(FormCore, { Html: html });
|
|
|
213907
213913
|
//#region ../../node_modules/form-render/es/index.js
|
|
213908
213914
|
var es_default = withProvider(FormCore, widgets_exports);
|
|
213909
213915
|
//#endregion
|
|
213910
|
-
//#region ../schemas/dist/helper-
|
|
213916
|
+
//#region ../schemas/dist/helper-Doen9Okh.js
|
|
213911
213917
|
var substituteVariables = (text, variablesIn, valueMapper = (value) => value) => {
|
|
213912
213918
|
if (!text) return "";
|
|
213913
213919
|
let substitutedText = text;
|
|
@@ -213936,14 +213942,14 @@ var validateVariables = (value, schema) => {
|
|
|
213936
213942
|
} catch {
|
|
213937
213943
|
throw new SyntaxError(`[@pdfme/generator] invalid JSON string '${value}' for variables in field ${schema.name}`);
|
|
213938
213944
|
}
|
|
213939
|
-
for (const variable of schema.variables) if (!values[variable]) {
|
|
213945
|
+
for (const variable of schema.variables) if (!Object.prototype.hasOwnProperty.call(values, variable) || values[variable] === null || values[variable] === void 0) {
|
|
213940
213946
|
if (schema.required) throw new Error(`[@pdfme/generator] variable ${variable} is missing for field ${schema.name}`);
|
|
213941
213947
|
return false;
|
|
213942
213948
|
}
|
|
213943
213949
|
return true;
|
|
213944
213950
|
};
|
|
213945
213951
|
//#endregion
|
|
213946
|
-
//#region ../schemas/dist/dynamicTemplate-
|
|
213952
|
+
//#region ../schemas/dist/dynamicTemplate-CRjx4Mjc.js
|
|
213947
213953
|
var getDynamicLayoutForMultiVariableText = async (value, args) => {
|
|
213948
213954
|
if (args.schema.type !== "multiVariableText") return { heights: [args.schema.height] };
|
|
213949
213955
|
const schema = args.schema;
|
|
@@ -235266,6 +235272,81 @@ var Canvas = (props, ref) => {
|
|
|
235266
235272
|
};
|
|
235267
235273
|
var Canvas_default = (0, import_react$9.forwardRef)(Canvas);
|
|
235268
235274
|
//#endregion
|
|
235275
|
+
//#region src/designerSelection.ts
|
|
235276
|
+
var EMPTY_DESIGNER_SELECTION = {
|
|
235277
|
+
bounds: null,
|
|
235278
|
+
pageIndex: 0,
|
|
235279
|
+
schemas: []
|
|
235280
|
+
};
|
|
235281
|
+
var toPersistedSchema = (schema) => {
|
|
235282
|
+
const cloned = cloneDeep$1(schema);
|
|
235283
|
+
delete cloned.id;
|
|
235284
|
+
return cloned;
|
|
235285
|
+
};
|
|
235286
|
+
var getSelectionBounds = (schemas) => {
|
|
235287
|
+
if (schemas.length === 0) return null;
|
|
235288
|
+
const left = Math.min(...schemas.map(({ schema }) => schema.position.x));
|
|
235289
|
+
const top = Math.min(...schemas.map(({ schema }) => schema.position.y));
|
|
235290
|
+
const right = Math.max(...schemas.map(({ schema }) => schema.position.x + schema.width));
|
|
235291
|
+
return {
|
|
235292
|
+
height: Math.max(...schemas.map(({ schema }) => schema.position.y + schema.height)) - top,
|
|
235293
|
+
width: right - left,
|
|
235294
|
+
x: left,
|
|
235295
|
+
y: top
|
|
235296
|
+
};
|
|
235297
|
+
};
|
|
235298
|
+
var createDesignerSelection = ({ activeSchemaIds, pageIndex, schemasList }) => {
|
|
235299
|
+
const pageSchemas = schemasList[pageIndex] ?? [];
|
|
235300
|
+
const selectedSchemas = activeSchemaIds.flatMap((schemaId) => {
|
|
235301
|
+
const schemaIndex = pageSchemas.findIndex((schema) => schema.id === schemaId);
|
|
235302
|
+
const schema = pageSchemas[schemaIndex];
|
|
235303
|
+
if (schemaIndex === -1 || !schema) return [];
|
|
235304
|
+
return [{
|
|
235305
|
+
name: schema.name,
|
|
235306
|
+
pageIndex,
|
|
235307
|
+
schema: toPersistedSchema(schema),
|
|
235308
|
+
schemaId: schema.id,
|
|
235309
|
+
schemaIndex,
|
|
235310
|
+
type: schema.type
|
|
235311
|
+
}];
|
|
235312
|
+
});
|
|
235313
|
+
return {
|
|
235314
|
+
bounds: getSelectionBounds(selectedSchemas),
|
|
235315
|
+
pageIndex,
|
|
235316
|
+
schemas: selectedSchemas
|
|
235317
|
+
};
|
|
235318
|
+
};
|
|
235319
|
+
var normalizeDesignerSchemaSelectionTargets = (targets) => Array.isArray(targets) ? targets : [targets];
|
|
235320
|
+
var getDesignerSelectionPageIndex = (targets, fallbackPageIndex, options = {}) => {
|
|
235321
|
+
const optionPageIndex = options.pageIndex;
|
|
235322
|
+
if (Number.isInteger(optionPageIndex) && optionPageIndex !== void 0 && optionPageIndex >= 0) return optionPageIndex;
|
|
235323
|
+
const targetPageIndex = targets.find((target) => typeof target === "object" && target !== null)?.pageIndex;
|
|
235324
|
+
return Number.isInteger(targetPageIndex) && targetPageIndex !== void 0 && targetPageIndex >= 0 ? targetPageIndex : fallbackPageIndex;
|
|
235325
|
+
};
|
|
235326
|
+
var getSelectedSchemaIds = ({ pageIndex, schemas, targets }) => {
|
|
235327
|
+
const selectedIds = /* @__PURE__ */ new Set();
|
|
235328
|
+
targets.forEach((target) => {
|
|
235329
|
+
schemas.forEach((schema, schemaIndex) => {
|
|
235330
|
+
if (typeof target === "string") {
|
|
235331
|
+
if (schema.id === target || schema.name === target) selectedIds.add(schema.id);
|
|
235332
|
+
return;
|
|
235333
|
+
}
|
|
235334
|
+
if (Number.isInteger(target.pageIndex) && target.pageIndex !== void 0 && target.pageIndex !== pageIndex) return;
|
|
235335
|
+
if (!(target.schemaId !== void 0 || target.schemaIndex !== void 0 || target.name !== void 0)) return;
|
|
235336
|
+
if (target.schemaId !== void 0 && target.schemaId === schema.id) {
|
|
235337
|
+
selectedIds.add(schema.id);
|
|
235338
|
+
return;
|
|
235339
|
+
}
|
|
235340
|
+
if (target.schemaIndex !== void 0 && target.schemaIndex === schemaIndex) {
|
|
235341
|
+
selectedIds.add(schema.id);
|
|
235342
|
+
return;
|
|
235343
|
+
}
|
|
235344
|
+
if (target.name !== void 0 && target.name === schema.name) selectedIds.add(schema.id);
|
|
235345
|
+
});
|
|
235346
|
+
});
|
|
235347
|
+
return [...selectedIds];
|
|
235348
|
+
};
|
|
235349
|
+
//#endregion
|
|
235269
235350
|
//#region src/components/Spinner.tsx
|
|
235270
235351
|
var Spinner = () => {
|
|
235271
235352
|
const { token } = theme_default.useToken();
|
|
@@ -235541,7 +235622,7 @@ var scaleDragPosAdjustment = (adjustment, scale) => {
|
|
|
235541
235622
|
if (scale < 1) return adjustment * -(1 - scale);
|
|
235542
235623
|
return 0;
|
|
235543
235624
|
};
|
|
235544
|
-
var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPageCursorChange }) => {
|
|
235625
|
+
var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPageCursorChange, onChangeSelection, onRegisterSchemaSelectionHandler }) => {
|
|
235545
235626
|
const past = (0, import_react$9.useRef)([]);
|
|
235546
235627
|
const future = (0, import_react$9.useRef)([]);
|
|
235547
235628
|
const canvasRef = (0, import_react$9.useRef)(null);
|
|
@@ -235564,10 +235645,59 @@ var TemplateEditor = ({ template, size, onSaveTemplate, onChangeTemplate, onPage
|
|
|
235564
235645
|
zoomLevel,
|
|
235565
235646
|
maxZoom
|
|
235566
235647
|
});
|
|
235648
|
+
const getElementsByIds = (ids) => ids.map((id) => document.getElementById(id)).filter((element) => element instanceof HTMLElement);
|
|
235567
235649
|
const onEdit = (targets) => {
|
|
235568
235650
|
setActiveElements(targets.filter((target) => target instanceof HTMLElement));
|
|
235569
235651
|
setHoveringSchemaId(null);
|
|
235570
235652
|
};
|
|
235653
|
+
const selectSchemas = (0, import_react$9.useCallback)((targets, options = {}) => {
|
|
235654
|
+
const normalizedTargets = normalizeDesignerSchemaSelectionTargets(targets);
|
|
235655
|
+
if (normalizedTargets.length === 0) {
|
|
235656
|
+
onEditEnd();
|
|
235657
|
+
return;
|
|
235658
|
+
}
|
|
235659
|
+
const targetPageIndex = getDesignerSelectionPageIndex(normalizedTargets, pageCursor, options);
|
|
235660
|
+
const selectedSchemaIds = getSelectedSchemaIds({
|
|
235661
|
+
pageIndex: targetPageIndex,
|
|
235662
|
+
schemas: schemasList[targetPageIndex] ?? [],
|
|
235663
|
+
targets: normalizedTargets
|
|
235664
|
+
});
|
|
235665
|
+
const editSelectedSchemas = () => onEdit(getElementsByIds(selectedSchemaIds));
|
|
235666
|
+
if (selectedSchemaIds.length === 0) {
|
|
235667
|
+
onEditEnd();
|
|
235668
|
+
return;
|
|
235669
|
+
}
|
|
235670
|
+
if (targetPageIndex !== pageCursor) {
|
|
235671
|
+
setPageCursor(targetPageIndex);
|
|
235672
|
+
onPageCursorChange(targetPageIndex, schemasList.length);
|
|
235673
|
+
if (options.scroll !== false && canvasRef.current) canvasRef.current.scrollTop = getPagesScrollTopByIndex(pageSizes, targetPageIndex, scale);
|
|
235674
|
+
setTimeout(editSelectedSchemas);
|
|
235675
|
+
return;
|
|
235676
|
+
}
|
|
235677
|
+
editSelectedSchemas();
|
|
235678
|
+
}, [
|
|
235679
|
+
pageCursor,
|
|
235680
|
+
pageSizes,
|
|
235681
|
+
scale,
|
|
235682
|
+
schemasList,
|
|
235683
|
+
onPageCursorChange
|
|
235684
|
+
]);
|
|
235685
|
+
(0, import_react$9.useEffect)(() => {
|
|
235686
|
+
onRegisterSchemaSelectionHandler?.(selectSchemas);
|
|
235687
|
+
return () => onRegisterSchemaSelectionHandler?.(null);
|
|
235688
|
+
}, [onRegisterSchemaSelectionHandler, selectSchemas]);
|
|
235689
|
+
(0, import_react$9.useEffect)(() => {
|
|
235690
|
+
onChangeSelection?.(createDesignerSelection({
|
|
235691
|
+
activeSchemaIds: activeElements.map((element) => element.id),
|
|
235692
|
+
pageIndex: pageCursor,
|
|
235693
|
+
schemasList
|
|
235694
|
+
}));
|
|
235695
|
+
}, [
|
|
235696
|
+
activeElements,
|
|
235697
|
+
onChangeSelection,
|
|
235698
|
+
pageCursor,
|
|
235699
|
+
schemasList
|
|
235700
|
+
]);
|
|
235571
235701
|
const onEditEnd = () => {
|
|
235572
235702
|
setActiveElements([]);
|
|
235573
235703
|
setHoveringSchemaId(null);
|
|
@@ -235913,7 +236043,10 @@ var Designer = class extends BaseUIClass {
|
|
|
235913
236043
|
_defineProperty$14(this, "onSaveTemplateCallback", void 0);
|
|
235914
236044
|
_defineProperty$14(this, "onChangeTemplateCallback", void 0);
|
|
235915
236045
|
_defineProperty$14(this, "onPageChangeCallback", void 0);
|
|
236046
|
+
_defineProperty$14(this, "onChangeSelectionCallback", void 0);
|
|
235916
236047
|
_defineProperty$14(this, "pageCursor", 0);
|
|
236048
|
+
_defineProperty$14(this, "selection", EMPTY_DESIGNER_SELECTION);
|
|
236049
|
+
_defineProperty$14(this, "selectSchemasHandler", null);
|
|
235917
236050
|
checkDesignerProps(props);
|
|
235918
236051
|
}
|
|
235919
236052
|
saveTemplate() {
|
|
@@ -235936,6 +236069,20 @@ var Designer = class extends BaseUIClass {
|
|
|
235936
236069
|
onPageChange(cb) {
|
|
235937
236070
|
this.onPageChangeCallback = cb;
|
|
235938
236071
|
}
|
|
236072
|
+
onChangeSelection(cb) {
|
|
236073
|
+
this.onChangeSelectionCallback = cb;
|
|
236074
|
+
}
|
|
236075
|
+
getSelection() {
|
|
236076
|
+
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
|
236077
|
+
return cloneDeep$1(this.selection);
|
|
236078
|
+
}
|
|
236079
|
+
getSelectedSchemas() {
|
|
236080
|
+
return this.getSelection().schemas;
|
|
236081
|
+
}
|
|
236082
|
+
selectSchemas(targets, options) {
|
|
236083
|
+
if (!this.domContainer) throw Error(DESTROYED_ERR_MSG);
|
|
236084
|
+
this.selectSchemasHandler?.(targets, options);
|
|
236085
|
+
}
|
|
235939
236086
|
getPageCursor() {
|
|
235940
236087
|
return this.pageCursor;
|
|
235941
236088
|
}
|
|
@@ -235969,6 +236116,13 @@ var Designer = class extends BaseUIClass {
|
|
|
235969
236116
|
totalPages
|
|
235970
236117
|
});
|
|
235971
236118
|
},
|
|
236119
|
+
onChangeSelection: (selection) => {
|
|
236120
|
+
this.selection = cloneDeep$1(selection);
|
|
236121
|
+
if (this.onChangeSelectionCallback) this.onChangeSelectionCallback(cloneDeep$1(selection));
|
|
236122
|
+
},
|
|
236123
|
+
onRegisterSchemaSelectionHandler: (handler) => {
|
|
236124
|
+
this.selectSchemasHandler = handler;
|
|
236125
|
+
},
|
|
235972
236126
|
size: this.size
|
|
235973
236127
|
})
|
|
235974
236128
|
}));
|