@pdfme/ui 6.2.1-dev.18 → 6.2.1-dev.20
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/helper.d.ts +7 -0
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/helper.d.ts
CHANGED
|
@@ -14,6 +14,13 @@ export declare const stabilizeSchemaIds: <T extends {
|
|
|
14
14
|
export declare const debounce: <T extends (...args: unknown[]) => unknown>(cb: T, wait?: number) => T;
|
|
15
15
|
export declare const round: (number: number, precision: number) => number;
|
|
16
16
|
export declare const flatten: <T>(arr: T[][]) => T[];
|
|
17
|
+
/**
|
|
18
|
+
* Single source of truth for whether a schema type supports rotation in the
|
|
19
|
+
* Designer (rotate handle on the canvas and rotate input in the detail view).
|
|
20
|
+
* A plugin opts out by omitting `rotate` from its propPanel.defaultSchema or
|
|
21
|
+
* setting it to `undefined` (e.g. `{ ...text.propPanel.defaultSchema, rotate: undefined }`).
|
|
22
|
+
*/
|
|
23
|
+
export declare const isRotatableSchema: (defaultSchema?: Record<string, unknown>) => boolean;
|
|
17
24
|
export declare const initShortCuts: (arg: {
|
|
18
25
|
move: (command: 'up' | 'down' | 'left' | 'right', isShift: boolean) => void;
|
|
19
26
|
remove: () => void;
|
package/dist/index.js
CHANGED
|
@@ -87842,6 +87842,13 @@ var round$2 = (number, precision) => {
|
|
|
87842
87842
|
return shift(Math.round(shift(number, precision, false)), precision, true);
|
|
87843
87843
|
};
|
|
87844
87844
|
var flatten = (arr) => [].concat(...arr);
|
|
87845
|
+
/**
|
|
87846
|
+
* Single source of truth for whether a schema type supports rotation in the
|
|
87847
|
+
* Designer (rotate handle on the canvas and rotate input in the detail view).
|
|
87848
|
+
* A plugin opts out by omitting `rotate` from its propPanel.defaultSchema or
|
|
87849
|
+
* setting it to `undefined` (e.g. `{ ...text.propPanel.defaultSchema, rotate: undefined }`).
|
|
87850
|
+
*/
|
|
87851
|
+
var isRotatableSchema = (defaultSchema) => typeof defaultSchema?.rotate !== "undefined";
|
|
87845
87852
|
var up = "up";
|
|
87846
87853
|
var shiftUp = "shift+up";
|
|
87847
87854
|
var down = "down";
|
|
@@ -216090,7 +216097,7 @@ var DetailView = (props) => {
|
|
|
216090
216097
|
title: typedI18n("rotate"),
|
|
216091
216098
|
type: "number",
|
|
216092
216099
|
widget: "inputNumber",
|
|
216093
|
-
disabled:
|
|
216100
|
+
disabled: !isRotatableSchema(defaultSchema),
|
|
216094
216101
|
max: 360,
|
|
216095
216102
|
props: { min: 0 },
|
|
216096
216103
|
span: 6
|
|
@@ -236772,8 +236779,7 @@ var Canvas = (props, ref) => {
|
|
|
236772
236779
|
if (plugin.propPanel.defaultSchema) defaultSchemas.push(plugin.propPanel.defaultSchema);
|
|
236773
236780
|
});
|
|
236774
236781
|
return uniqueSchemaTypes.every((type) => {
|
|
236775
|
-
|
|
236776
|
-
return matchingSchema && "rotate" in matchingSchema;
|
|
236782
|
+
return isRotatableSchema(defaultSchemas.find((ds) => ds && "type" in ds && ds.type === type));
|
|
236777
236783
|
});
|
|
236778
236784
|
}, [
|
|
236779
236785
|
activeElements,
|