@pdfme/ui 5.3.17-dev.1 → 5.3.17-dev.2
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/index.es.js +139 -171
- package/dist/index.umd.js +12 -13
- package/dist/types/src/class.d.ts +2 -2
- package/dist/types/src/components/AppContextProvider.d.ts +2 -2
- package/dist/types/src/contexts.d.ts +2 -2
- package/dist/types/src/helper.d.ts +2 -2
- package/package.json +1 -1
- package/src/class.ts +4 -3
- package/src/components/AppContextProvider.tsx +2 -2
- package/src/components/Designer/Canvas/index.tsx +2 -11
- package/src/components/Designer/LeftSidebar.tsx +1 -1
- package/src/components/Designer/PluginIcon.tsx +2 -11
- package/src/components/Designer/RightSidebar/DetailView/index.tsx +9 -64
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableContainer.tsx +1 -20
- package/src/components/Designer/RightSidebar/ListView/SelectableSortableItem.tsx +1 -20
- package/src/components/Renderer.tsx +2 -9
- package/src/contexts.ts +2 -2
- package/src/helper.ts +9 -88
package/dist/index.es.js
CHANGED
@@ -9025,10 +9025,19 @@ const SchemaPageArray = z.array(z.array(Schema$1)), Template = z.object({
|
|
9025
9025
|
data: z.union([z.string(), ArrayBufferSchema, Uint8ArraySchema]),
|
9026
9026
|
fallback: z.boolean().optional(),
|
9027
9027
|
subset: z.boolean().optional()
|
9028
|
-
})),
|
9028
|
+
})), Plugin = z.object({
|
9029
|
+
ui: z.function().args(z.any()).returns(z.any()),
|
9030
|
+
pdf: z.function().args(z.any()).returns(z.any()),
|
9031
|
+
propPanel: z.object({
|
9032
|
+
schema: z.unknown(),
|
9033
|
+
widgets: z.record(z.any()).optional(),
|
9034
|
+
defaultSchema: Schema$1
|
9035
|
+
}),
|
9036
|
+
icon: z.string().optional()
|
9037
|
+
}).passthrough(), CommonOptions = z.object({ font: Font.optional() }).passthrough(), CommonProps = z.object({
|
9029
9038
|
template: Template,
|
9030
9039
|
options: CommonOptions.optional(),
|
9031
|
-
plugins: z.record(
|
9040
|
+
plugins: z.record(Plugin).optional()
|
9032
9041
|
}), GeneratorOptions = CommonOptions.extend({
|
9033
9042
|
colorType: ColorType,
|
9034
9043
|
author: z.string().optional(),
|
@@ -9110,14 +9119,15 @@ Check this document: https://pdfme.com/docs/custom-fonts`);
|
|
9110
9119
|
s.parse(a);
|
9111
9120
|
} catch (c) {
|
9112
9121
|
if (c instanceof z.ZodError) {
|
9113
|
-
const
|
9114
|
-
ERROR MESSAGE: ${
|
9115
|
-
--------------------------`)
|
9116
|
-
`);
|
9122
|
+
const u = c.issues.map((d) => `ERROR POSITION: ${d.path.join(".")}
|
9123
|
+
ERROR MESSAGE: ${d.message}
|
9124
|
+
--------------------------`);
|
9117
9125
|
throw Error(`[@pdfme/common] Invalid argument:
|
9118
9126
|
--------------------------
|
9119
|
-
${
|
9120
|
-
|
9127
|
+
${u.join(`
|
9128
|
+
`)}`);
|
9129
|
+
} else
|
9130
|
+
throw Error(`[@pdfme/common] Unexpected parsing error: ${c instanceof Error ? c.message : String(c)}`);
|
9121
9131
|
}
|
9122
9132
|
if (a && typeof a == "object" && "template" in a && "options" in a) {
|
9123
9133
|
const { template: c, options: u } = a;
|
@@ -12647,7 +12657,26 @@ const expressionCache = /* @__PURE__ */ new Map(), parseDataCache = /* @__PURE__
|
|
12647
12657
|
return Object.entries(g).forEach(([x, y]) => {
|
12648
12658
|
typeof y == "string" && y.includes("{") && y.includes("}") && (g[x] = evaluatePlaceholders({ content: y, context: g }));
|
12649
12659
|
}), evaluatePlaceholders({ content: s, context: g });
|
12650
|
-
},
|
12660
|
+
}, pluginRegistry = (a) => ({
|
12661
|
+
plugins: a,
|
12662
|
+
entries: () => Object.entries(a),
|
12663
|
+
values: () => Object.values(a),
|
12664
|
+
exists: () => Object.values(a).length > 0,
|
12665
|
+
findWithLabelByType(s) {
|
12666
|
+
for (const [c, u] of Object.entries(this.plugins)) {
|
12667
|
+
if (!u || typeof u != "object" || !u.propPanel || typeof u.propPanel != "object")
|
12668
|
+
continue;
|
12669
|
+
const d = u.propPanel.defaultSchema;
|
12670
|
+
if (d && "type" in d && d.type === s)
|
12671
|
+
return [c, u];
|
12672
|
+
}
|
12673
|
+
return ["", void 0];
|
12674
|
+
},
|
12675
|
+
findByType(s) {
|
12676
|
+
const [, c] = this.findWithLabelByType(s);
|
12677
|
+
return c;
|
12678
|
+
}
|
12679
|
+
}), DEFAULT_LANG = "en", DESTROYED_ERR_MSG = "[@pdfme/ui] this instance is already destroyed", SELECTABLE_CLASSNAME = "selectable", RULER_HEIGHT = 30, PAGE_GAP = 10, LEFT_SIDEBAR_WIDTH = 45, RIGHT_SIDEBAR_WIDTH = 400, BACKGROUND_COLOR = "rgb(74, 74, 74)", DEFAULT_MAX_ZOOM = 2, isff = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1;
|
12651
12680
|
function addEvent$1(a, s, c, u) {
|
12652
12681
|
a.addEventListener ? a.addEventListener(s, c, u) : a.attachEvent && a.attachEvent("on".concat(s), c);
|
12653
12682
|
}
|
@@ -80504,7 +80533,7 @@ const UseDynamicFontSize = (a) => {
|
|
80504
80533
|
ui: uiRender,
|
80505
80534
|
propPanel,
|
80506
80535
|
icon: createSvgStr(TextCursorInput)
|
80507
|
-
}, builtInPlugins = { Text: textSchema }, I18nContext = reactExports.createContext(i18n), FontContext = reactExports.createContext(getDefaultFont()), PluginsRegistry = reactExports.createContext(builtInPlugins), OptionsContext = reactExports.createContext({}), CacheContext = reactExports.createContext(/* @__PURE__ */ new Map()), hotkeys = function(a, s) {
|
80536
|
+
}, builtInPlugins = { Text: textSchema }, I18nContext = reactExports.createContext(i18n), FontContext = reactExports.createContext(getDefaultFont()), PluginsRegistry = reactExports.createContext(pluginRegistry(builtInPlugins)), OptionsContext = reactExports.createContext({}), CacheContext = reactExports.createContext(/* @__PURE__ */ new Map()), hotkeys = function(a, s) {
|
80508
80537
|
return hotkeys$1(a, s);
|
80509
80538
|
};
|
80510
80539
|
hotkeys.shift = !1;
|
@@ -80708,43 +80737,16 @@ const arrayBufferToBase64 = (a) => {
|
|
80708
80737
|
}, handleTypeChange = (a, s, c, u) => {
|
80709
80738
|
if (s !== "type") return;
|
80710
80739
|
const d = ["id", "name", "type", "position", "required"];
|
80711
|
-
Object.keys(a).forEach((
|
80712
|
-
d.includes(
|
80740
|
+
Object.keys(a).forEach((v) => {
|
80741
|
+
d.includes(v) || delete a[v];
|
80713
80742
|
});
|
80714
|
-
const p = c;
|
80715
|
-
|
80716
|
-
|
80717
|
-
|
80718
|
-
|
80719
|
-
|
80720
|
-
|
80721
|
-
const y = x.propPanel;
|
80722
|
-
if (!("defaultSchema" in y) || !y.defaultSchema || typeof y.defaultSchema != "object")
|
80723
|
-
continue;
|
80724
|
-
const f = y.defaultSchema;
|
80725
|
-
if (!("type" in f) || typeof f.type != "string") continue;
|
80726
|
-
const m = f.type;
|
80727
|
-
if (m === p) {
|
80728
|
-
const C = {
|
80729
|
-
type: m
|
80730
|
-
};
|
80731
|
-
Object.keys(f).forEach((S) => {
|
80732
|
-
S !== "type" && Object.prototype.hasOwnProperty.call(f, S) && (C[S] = f[S]);
|
80733
|
-
}), v = {
|
80734
|
-
propPanel: {
|
80735
|
-
defaultSchema: C
|
80736
|
-
}
|
80737
|
-
};
|
80738
|
-
break;
|
80739
|
-
}
|
80740
|
-
}
|
80741
|
-
const b = v == null ? void 0 : v.propPanel;
|
80742
|
-
if (b != null && b.defaultSchema) {
|
80743
|
-
const g = b.defaultSchema, x = a;
|
80744
|
-
for (const y of Object.keys(g))
|
80745
|
-
if (!Object.prototype.hasOwnProperty.call(a, y) && Object.prototype.hasOwnProperty.call(g, y)) {
|
80746
|
-
const f = g[y];
|
80747
|
-
f !== void 0 && (x[y] = f);
|
80743
|
+
const p = u.findByType(c);
|
80744
|
+
if (p != null && p.propPanel.defaultSchema) {
|
80745
|
+
const v = p.propPanel.defaultSchema, A = a;
|
80746
|
+
for (const b of Object.keys(v))
|
80747
|
+
if (!Object.prototype.hasOwnProperty.call(a, b)) {
|
80748
|
+
const g = v[b];
|
80749
|
+
g !== void 0 && (A[b] = g);
|
80748
80750
|
}
|
80749
80751
|
}
|
80750
80752
|
a.readOnly && (a.required = !1);
|
@@ -80760,7 +80762,7 @@ const arrayBufferToBase64 = (a) => {
|
|
80760
80762
|
};
|
80761
80763
|
class BaseUIClass {
|
80762
80764
|
constructor(s) {
|
80763
|
-
this.lang = DEFAULT_LANG, this.font = getDefaultFont(), this.pluginsRegistry = builtInPlugins, this.options = {}, this.setSize = debounce$1(() => {
|
80765
|
+
this.lang = DEFAULT_LANG, this.font = getDefaultFont(), this.pluginsRegistry = pluginRegistry(builtInPlugins), this.options = {}, this.setSize = debounce$1(() => {
|
80764
80766
|
this.domContainer && (this.size = {
|
80765
80767
|
height: this.domContainer.clientHeight || window.innerHeight,
|
80766
80768
|
width: this.domContainer.clientWidth || window.innerWidth
|
@@ -80772,7 +80774,7 @@ class BaseUIClass {
|
|
80772
80774
|
width: this.domContainer.clientWidth || window.innerWidth
|
80773
80775
|
}, this.resizeObserver.observe(this.domContainer);
|
80774
80776
|
const { lang: v, font: A } = d;
|
80775
|
-
v && (this.lang = v), A && (this.font = A), Object.values(p).length > 0 && (this.pluginsRegistry = p);
|
80777
|
+
v && (this.lang = v), A && (this.font = A), Object.values(p).length > 0 && (this.pluginsRegistry = pluginRegistry(p));
|
80776
80778
|
}
|
80777
80779
|
getLang() {
|
80778
80780
|
return this.lang;
|
@@ -136933,8 +136935,8 @@ const usePrevious = (a) => {
|
|
136933
136935
|
};
|
136934
136936
|
return Array.from(p.body.children).forEach((A) => v(A)), /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: u, title: s, dangerouslySetInnerHTML: { __html: p.body.innerHTML } });
|
136935
136937
|
}, PluginIcon = (a) => {
|
136936
|
-
var x;
|
136937
|
-
const { plugin: s, label: c, size: u, styles: d } = a, { token: p } = theme.useToken(), v = reactExports.useContext(OptionsContext), A =
|
136938
|
+
var x, y;
|
136939
|
+
const { plugin: s, label: c, size: u, styles: d } = a, { token: p } = theme.useToken(), v = reactExports.useContext(OptionsContext), A = ((x = s.propPanel.defaultSchema) == null ? void 0 : x.type) ?? "", b = ((y = v.icons) == null ? void 0 : y[A]) ?? s.icon, g = {
|
136938
136940
|
...d,
|
136939
136941
|
color: p.colorText,
|
136940
136942
|
display: "flex",
|
@@ -136955,18 +136957,13 @@ const usePrevious = (a) => {
|
|
136955
136957
|
id: d.id
|
136956
136958
|
}), I = useMountStatus(), _ = m && !I, $ = {
|
136957
136959
|
...f,
|
136958
|
-
onClick: (
|
136959
|
-
}, P
|
136960
|
-
|
136961
|
-
|
136962
|
-
|
136963
|
-
|
136964
|
-
|
136965
|
-
let B;
|
136966
|
-
d.name ? p.find((O) => d.name && O.name === d.name && O.id !== d.id) && (B = "is-danger") : B = "is-warning";
|
136967
|
-
let M = g("edit");
|
136968
|
-
B === "is-warning" ? M = g("plsInputName") : B === "is-danger" && (M = g("fieldMustUniq"));
|
136969
|
-
const k = a ? { background: b.colorPrimary, opacity: C || m ? 0.5 : 1 } : {};
|
136960
|
+
onClick: (M) => c(d.id, M.shiftKey)
|
136961
|
+
}, [P, E] = x.findWithLabelByType(d.type);
|
136962
|
+
let R;
|
136963
|
+
d.name ? p.find((M) => d.name && M.name === d.name && M.id !== d.id) && (R = "is-danger") : R = "is-warning";
|
136964
|
+
let T = g("edit");
|
136965
|
+
R === "is-warning" ? T = g("plsInputName") : R === "is-danger" && (T = g("fieldMustUniq"));
|
136966
|
+
const B = a ? { background: b.colorPrimary, opacity: C || m ? 0.5 : 1 } : {};
|
136970
136967
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
136971
136968
|
Item,
|
136972
136969
|
{
|
@@ -136974,13 +136971,13 @@ const usePrevious = (a) => {
|
|
136974
136971
|
onMouseEnter: v,
|
136975
136972
|
onMouseLeave: A,
|
136976
136973
|
onClick: () => u(d.id),
|
136977
|
-
icon:
|
136974
|
+
icon: E && /* @__PURE__ */ jsxRuntimeExports.jsx(PluginIcon, { plugin: E, label: P, size: 20 }),
|
136978
136975
|
value: d.name,
|
136979
|
-
status:
|
136980
|
-
title:
|
136976
|
+
status: R,
|
136977
|
+
title: T,
|
136981
136978
|
required: d.required,
|
136982
136979
|
readOnly: d.readOnly,
|
136983
|
-
style: { ...
|
136980
|
+
style: { ...B, ...s },
|
136984
136981
|
dragging: m,
|
136985
136982
|
sorting: C,
|
136986
136983
|
transition: w,
|
@@ -137005,19 +137002,14 @@ const usePrevious = (a) => {
|
|
137005
137002
|
else
|
137006
137003
|
b([]);
|
137007
137004
|
}, I = (_) => {
|
137008
|
-
const $ = typeof _ == "string" ? c.find((
|
137005
|
+
const $ = typeof _ == "string" ? c.find((R) => R.id === _) : _;
|
137009
137006
|
if (!$) return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
137010
|
-
const P
|
137011
|
-
|
137012
|
-
return !1;
|
137013
|
-
const M = B.propPanel.defaultSchema;
|
137014
|
-
return "type" in M && typeof M.type == "string" && M.type === P;
|
137015
|
-
}), [R, T] = E || ["", void 0];
|
137016
|
-
return T ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
137007
|
+
const [P, E] = m.findWithLabelByType($.type);
|
137008
|
+
return E ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
137017
137009
|
PluginIcon,
|
137018
137010
|
{
|
137019
|
-
plugin:
|
137020
|
-
label:
|
137011
|
+
plugin: E,
|
137012
|
+
label: P,
|
137021
137013
|
size: 20,
|
137022
137014
|
styles: { marginRight: "0.5rem" }
|
137023
137015
|
}
|
@@ -152845,103 +152837,83 @@ const FormRenderComponent = withProvider(FormCore, defaultWidgets), AlignWidget
|
|
152845
152837
|
);
|
152846
152838
|
}) }) });
|
152847
152839
|
}, { Text: Text$2 } = Typography, DetailView = (a) => {
|
152848
|
-
var B
|
152849
|
-
const { token: s } = theme.useToken(), { size: c, schemasList: u, changeSchemas: d, deselectSchema: p, activeSchema: v } = a, A = useForm(), b = reactExports.useContext(I18nContext), g = reactExports.useContext(PluginsRegistry), x = reactExports.useContext(OptionsContext), y = (
|
152840
|
+
var B;
|
152841
|
+
const { token: s } = theme.useToken(), { size: c, schemasList: u, changeSchemas: d, deselectSchema: p, activeSchema: v } = a, A = useForm(), b = reactExports.useContext(I18nContext), g = reactExports.useContext(PluginsRegistry), x = reactExports.useContext(OptionsContext), y = (M) => typeof b == "function" ? b(M) : M, [f, m] = reactExports.useState({});
|
152850
152842
|
reactExports.useEffect(() => {
|
152851
|
-
const
|
152852
|
-
AlignWidget: (
|
152843
|
+
const M = {
|
152844
|
+
AlignWidget: (k) => /* @__PURE__ */ jsxRuntimeExports.jsx(AlignWidget, { ...k, ...a, options: x }),
|
152853
152845
|
Divider: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { style: { marginTop: s.marginXS, marginBottom: s.marginXS } }),
|
152854
|
-
ButtonGroup: (
|
152846
|
+
ButtonGroup: (k) => /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonGroupWidget, { ...k, ...a, options: x })
|
152855
152847
|
};
|
152856
|
-
for (const
|
152857
|
-
const
|
152858
|
-
Object.entries(
|
152859
|
-
|
152848
|
+
for (const k of g.values()) {
|
152849
|
+
const O = k.propPanel.widgets || {};
|
152850
|
+
Object.entries(O).forEach(([H, j]) => {
|
152851
|
+
M[H] = (q) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
152860
152852
|
WidgetRenderer,
|
152861
152853
|
{
|
152862
|
-
...
|
152854
|
+
...q,
|
152863
152855
|
...a,
|
152864
152856
|
options: x,
|
152865
152857
|
theme: s,
|
152866
152858
|
i18n: y,
|
152867
|
-
widget:
|
152859
|
+
widget: j
|
152868
152860
|
}
|
152869
152861
|
);
|
152870
152862
|
});
|
152871
152863
|
}
|
152872
|
-
m(
|
152864
|
+
m(M);
|
152873
152865
|
}, [v, g, JSON.stringify(x)]), reactExports.useEffect(() => {
|
152874
|
-
const
|
152875
|
-
|
152866
|
+
const M = { ...v }, k = typeof M.readOnly == "boolean" ? M.readOnly : !1;
|
152867
|
+
M.editable = !k, A.setValues(M);
|
152876
152868
|
}, [v, A]), reactExports.useEffect(() => A.resetFields(), [v.id]), reactExports.useEffect(() => {
|
152877
|
-
C.current = (
|
152878
|
-
for (const
|
152879
|
-
for (const
|
152880
|
-
if (
|
152869
|
+
C.current = (M) => {
|
152870
|
+
for (const k of u)
|
152871
|
+
for (const O of Object.values(k))
|
152872
|
+
if (O.name === M && O.id !== v.id)
|
152881
152873
|
return !1;
|
152882
152874
|
return !0;
|
152883
152875
|
};
|
152884
152876
|
}, [u, v]);
|
152885
152877
|
const C = reactExports.useRef(
|
152886
152878
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
152887
|
-
(
|
152888
|
-
), S = (
|
152889
|
-
const
|
152890
|
-
let
|
152891
|
-
for (const
|
152892
|
-
if (["id", "content"].includes(
|
152893
|
-
let
|
152894
|
-
if (
|
152895
|
-
if (
|
152896
|
-
const
|
152897
|
-
|
152879
|
+
(M) => !0
|
152880
|
+
), S = (M, k) => C.current(k), w = debounce$1(function(...M) {
|
152881
|
+
const k = M[0], O = (j, q) => typeof j == "object" && j !== null ? JSON.stringify(j) !== JSON.stringify(q) : j !== q;
|
152882
|
+
let H = [];
|
152883
|
+
for (const j in k) {
|
152884
|
+
if (["id", "content"].includes(j)) continue;
|
152885
|
+
let q = k[j];
|
152886
|
+
if (O(q, v[j])) {
|
152887
|
+
if (q === null && ["rotate", "opacity"].includes(j) && (q = void 0), j === "editable") {
|
152888
|
+
const L = !q;
|
152889
|
+
H.push({ key: "readOnly", value: L, schemaId: v.id }), L && H.push({ key: "required", value: !1, schemaId: v.id });
|
152898
152890
|
continue;
|
152899
152891
|
}
|
152900
|
-
|
152892
|
+
H.push({ key: j, value: q, schemaId: v.id });
|
152901
152893
|
}
|
152902
152894
|
}
|
152903
|
-
|
152904
|
-
|
152905
|
-
(
|
152906
|
-
(
|
152895
|
+
H.length && A.validateFields().then(() => d(H)).catch((j) => {
|
152896
|
+
j.errorFields.length && (H = H.filter(
|
152897
|
+
(q) => !j.errorFields.find(
|
152898
|
+
(L) => L.name.includes(q.key)
|
152907
152899
|
)
|
152908
|
-
)),
|
152909
|
-
});
|
152910
|
-
}, 100), I =
|
152911
|
-
|
152912
|
-
|
152913
|
-
|
152914
|
-
|
152915
|
-
|
152916
|
-
|
152917
|
-
Check this document: https://pdfme.com/docs/custom-schemas`);
|
152918
|
-
const $ = [];
|
152919
|
-
Object.entries(g).forEach(([k, O]) => {
|
152920
|
-
if (!O || typeof O != "object") {
|
152921
|
-
$.push({ label: k, value: void 0 });
|
152922
|
-
return;
|
152923
|
-
}
|
152924
|
-
if (!("propPanel" in O) || !O.propPanel || typeof O.propPanel != "object") {
|
152925
|
-
$.push({ label: k, value: void 0 });
|
152926
|
-
return;
|
152927
|
-
}
|
152928
|
-
if (!("defaultSchema" in O.propPanel) || !O.propPanel.defaultSchema || typeof O.propPanel.defaultSchema != "object") {
|
152929
|
-
$.push({ label: k, value: void 0 });
|
152930
|
-
return;
|
152931
|
-
}
|
152932
|
-
const H = O.propPanel.defaultSchema;
|
152933
|
-
let j;
|
152934
|
-
"type" in H && typeof H.type == "string" && (j = H.type), $.push({ label: k, value: j });
|
152900
|
+
)), H.length && d(H);
|
152901
|
+
});
|
152902
|
+
}, 100), I = g.findByType(v.type);
|
152903
|
+
if (!I)
|
152904
|
+
throw Error(`[@pdfme/ui] Failed to find plugin used for ${v.type}`);
|
152905
|
+
const _ = I.propPanel.schema, $ = [];
|
152906
|
+
g.entries().forEach(([M, k]) => {
|
152907
|
+
var O;
|
152908
|
+
$.push({ label: M, value: ((O = k.propPanel.defaultSchema) == null ? void 0 : O.type) ?? void 0 });
|
152935
152909
|
});
|
152936
|
-
const P = {}, E = (
|
152910
|
+
const P = {}, E = (B = I == null ? void 0 : I.propPanel) != null && B.defaultSchema ? (
|
152937
152911
|
// Create a safe copy of the schema
|
152938
152912
|
(() => {
|
152939
|
-
|
152940
|
-
|
152941
|
-
|
152942
|
-
|
152943
|
-
Object.prototype.hasOwnProperty.call(I.propPanel.defaultSchema, O) && (k[O] = I.propPanel.defaultSchema[O]);
|
152944
|
-
return k;
|
152913
|
+
const M = {};
|
152914
|
+
for (const k in I.propPanel.defaultSchema)
|
152915
|
+
Object.prototype.hasOwnProperty.call(I.propPanel.defaultSchema, k) && (M[k] = I.propPanel.defaultSchema[k]);
|
152916
|
+
return M;
|
152945
152917
|
})()
|
152946
152918
|
) : P, R = {
|
152947
152919
|
type: "object",
|
@@ -153026,31 +152998,31 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
153026
152998
|
}
|
153027
152999
|
}, T = { ...R.properties };
|
153028
153000
|
if (typeof _ == "function") {
|
153029
|
-
const { size:
|
153001
|
+
const { size: M, schemas: k, pageSize: O, changeSchemas: H, activeElements: j, deselectSchema: q, activeSchema: L } = a, U = _({
|
153030
153002
|
...{
|
153031
|
-
size:
|
153032
|
-
schemas:
|
153033
|
-
pageSize:
|
153034
|
-
changeSchemas:
|
153035
|
-
activeElements:
|
153036
|
-
deselectSchema:
|
153037
|
-
activeSchema:
|
153003
|
+
size: M,
|
153004
|
+
schemas: k,
|
153005
|
+
pageSize: O,
|
153006
|
+
changeSchemas: H,
|
153007
|
+
activeElements: j,
|
153008
|
+
deselectSchema: q,
|
153009
|
+
activeSchema: L
|
153038
153010
|
},
|
153039
153011
|
options: x,
|
153040
153012
|
theme: s,
|
153041
153013
|
i18n: y
|
153042
|
-
}),
|
153014
|
+
}), N = U && typeof U == "object" ? U : {}, D = Object.keys(N).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } };
|
153043
153015
|
R.properties = {
|
153044
153016
|
...T,
|
153045
|
-
...
|
153046
|
-
...
|
153017
|
+
...D,
|
153018
|
+
...N
|
153047
153019
|
};
|
153048
153020
|
} else {
|
153049
|
-
const
|
153021
|
+
const M = _ && typeof _ == "object" ? _ : {}, k = Object.keys(M).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } };
|
153050
153022
|
R.properties = {
|
153051
153023
|
...T,
|
153052
|
-
...
|
153053
|
-
...
|
153024
|
+
...k,
|
153025
|
+
...M
|
153054
153026
|
};
|
153055
153027
|
}
|
153056
153028
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
@@ -153198,12 +153170,8 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
153198
153170
|
]
|
153199
153171
|
}
|
153200
153172
|
), Renderer = (a) => {
|
153201
|
-
const { schema: s, basePdf: c, value: u, mode: d, onChange: p, stopEditing: v, tabIndex: A, placeholder: b, scale: g } = a, x = reactExports.useContext(PluginsRegistry), y = reactExports.useContext(OptionsContext), f = reactExports.useContext(I18nContext), { token: m } = theme.useToken(), C = reactExports.useRef(null), S = reactExports.useContext(CacheContext), w =
|
153202
|
-
|
153203
|
-
const P = (E = $ == null ? void 0 : $.propPanel) == null ? void 0 : E.defaultSchema;
|
153204
|
-
return (P == null ? void 0 : P.type) === w;
|
153205
|
-
}), _ = useRerenderDependencies({
|
153206
|
-
plugin: I || {},
|
153173
|
+
const { schema: s, basePdf: c, value: u, mode: d, onChange: p, stopEditing: v, tabIndex: A, placeholder: b, scale: g } = a, x = reactExports.useContext(PluginsRegistry), y = reactExports.useContext(OptionsContext), f = reactExports.useContext(I18nContext), { token: m } = theme.useToken(), C = reactExports.useRef(null), S = reactExports.useContext(CacheContext), w = x.findByType(s.type), I = useRerenderDependencies({
|
153174
|
+
plugin: w || void 0,
|
153207
153175
|
value: u,
|
153208
153176
|
mode: d,
|
153209
153177
|
scale: g,
|
@@ -153211,10 +153179,10 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
153211
153179
|
options: y
|
153212
153180
|
});
|
153213
153181
|
return reactExports.useEffect(() => {
|
153214
|
-
if (!(
|
153182
|
+
if (!(w != null && w.ui) || !C.current || !s.type) return;
|
153215
153183
|
C.current.innerHTML = "";
|
153216
|
-
const
|
153217
|
-
return
|
153184
|
+
const _ = w.ui;
|
153185
|
+
return _({
|
153218
153186
|
value: u,
|
153219
153187
|
schema: s,
|
153220
153188
|
basePdf: c,
|
@@ -153231,7 +153199,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
|
|
153231
153199
|
}), () => {
|
153232
153200
|
C.current && (C.current.innerHTML = "");
|
153233
153201
|
};
|
153234
|
-
}, [
|
153202
|
+
}, [w == null ? void 0 : w.ui, s.type, I]), !w || !w.ui ? (console.error(`[@pdfme/ui] Renderer for type ${s.type} not found.
|
153235
153203
|
Check this document: https://pdfme.com/docs/custom-schemas`), /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})) : /* @__PURE__ */ jsxRuntimeExports.jsx(Wrapper, { ...a, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: "100%", width: "100%" }, ref: C }) });
|
153236
153204
|
}, Draggable$1 = (a) => {
|
153237
153205
|
const { scale: s, basePdf: c, plugin: u } = a, { token: d } = theme.useToken(), p = u.propPanel.defaultSchema, v = useDraggable({ id: p.type, data: p }), { listeners: A, setNodeRef: b, attributes: g, transform: x, isDragging: y } = v, f = { transform: CSS$1.Translate.toString(x) }, m = React.useMemo(() => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { transform: `scale(${s})` }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
@@ -153278,7 +153246,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`), /* @__PURE__ */ js
|
|
153278
153246
|
textAlign: "center",
|
153279
153247
|
overflow: p ? "visible" : "auto"
|
153280
153248
|
},
|
153281
|
-
children:
|
153249
|
+
children: d.entries().map(([A, b]) => b != null && b.propPanel.defaultSchema ? /* @__PURE__ */ jsxRuntimeExports.jsx(Draggable$1, { scale: s, basePdf: c, plugin: b, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
153282
153250
|
Button$1,
|
153283
153251
|
{
|
153284
153252
|
onMouseDown: () => v(!0),
|
@@ -164889,8 +164857,8 @@ const guideStyle = (a, s, c, u) => ({
|
|
164889
164857
|
const V = (g[u] || []).filter(
|
164890
164858
|
(ie) => b.map((ce) => ce.id).includes(ie.id)
|
164891
164859
|
).map((ie) => ie.type), K = [...new Set(V)], te = [];
|
164892
|
-
return
|
164893
|
-
ie
|
164860
|
+
return _.entries().forEach(([, ie]) => {
|
164861
|
+
ie.propPanel.defaultSchema && te.push(ie.propPanel.defaultSchema);
|
164894
164862
|
}), K.every((ie) => {
|
164895
164863
|
const ce = te.find((me) => me && "type" in me && me.type === ie);
|
164896
164864
|
return ce && "rotate" in ce;
|