@pdfme/ui 4.2.2 → 4.2.3-dev.4

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/README.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # PDFME
2
2
 
3
- <p>
3
+ <p align="center">
4
+ <img src="https://raw.githubusercontent.com/pdfme/pdfme/main/website/static/img/logo.svg" width="300"/>
5
+ </p>
6
+
7
+ <h4 align="center">
8
+ <a href="https://pdfme.com/">Website</a> |
9
+ <a href="https://app.pdfme.com/">pdfme Cloud</a> |
10
+ <a href="https://discord.gg/xWPTJbmgNV">Discord</a>
11
+ </h4>
12
+
13
+ <p align="center">
4
14
  <a href="https://github.com/pdfme/pdfme/blob/master/LICENSE.md">
5
15
  <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="pdfme is released under the MIT license." />
6
16
  </a>
@@ -13,20 +23,9 @@
13
23
  <a href="https://npmcharts.com/compare/@pdfme/ui?minimal=true">
14
24
  <img src="https://img.shields.io/npm/dm/@pdfme/ui.svg" alt="Downloads per month on npm." />
15
25
  </a>
16
- <a href="https://pdfme.com/docs/development-guide#contribution">
17
- <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
18
- </a>
19
- <a href="https://twitter.com/intent/tweet?text=Awesome+pdf+library%21&url=https://pdfme.com">
20
- <img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" alt="Tweet" />
21
- </a>
22
26
  </p>
23
27
 
24
- TypeScript base PDF generator and React base UI.
25
- Open source, developed by the community, and completely free to use under the MIT license!
26
-
27
- <p align="center">
28
- <img src="https://raw.githubusercontent.com/pdfme/pdfme/main/website/static/img/logo.svg" width="300"/>
29
- </p>
28
+ <p align="center">TypeScript base PDF generator and React base UI. Open source, developed by the community, and completely free to use under the MIT license!</p>
30
29
 
31
30
  ## Features
32
31
 
@@ -302,3 +301,18 @@ const viewer = new Viewer({ domContainer, template, inputs });
302
301
 
303
302
  If you want to contribute to pdfme, please check the [Development Guide](https://pdfme.com/docs/development-guide) page.
304
303
  We look forward to your contribution!
304
+
305
+ ## Cloud Service Option
306
+
307
+ While pdfme is a powerful open-source library, we understand that some users might prefer a managed solution. For those looking for a ready-to-use, scalable PDF generation service without the need for setup and maintenance, we offer pdfme Cloud.
308
+
309
+ **[Try pdfme Cloud - Hassle-free PDF Generation](https://app.pdfme.com/)**
310
+
311
+ pdfme Cloud provides all the features of the open-source library, plus:
312
+
313
+ - PDF generation at scale without infrastructure management
314
+ - Hosted WYSIWYG template designer
315
+ - Simple API integration
316
+ - Automatic updates and maintenance
317
+
318
+ \*pdfme is and will always remain open-source. The cloud service is an optional offering for those who prefer a managed solution.
package/dist/index.es.js CHANGED
@@ -9307,7 +9307,6 @@ const ColorType = z.enum(["rgb", "cmyk"]).optional();
9307
9307
  z.object({ height: z.number(), width: z.number() });
9308
9308
  const Schema$1 = z.object({
9309
9309
  type: z.string(),
9310
- icon: z.string().optional(),
9311
9310
  content: z.string().optional(),
9312
9311
  position: z.object({ x: z.number(), y: z.number() }),
9313
9312
  width: z.number(),
@@ -9355,7 +9354,8 @@ CommonProps.extend({
9355
9354
  const UIOptions = CommonOptions.extend({
9356
9355
  lang: Lang.optional(),
9357
9356
  labels: z.record(z.string(), z.string()).optional(),
9358
- theme: z.record(z.string(), z.unknown()).optional()
9357
+ theme: z.record(z.string(), z.unknown()).optional(),
9358
+ icons: z.record(z.string(), z.string()).optional()
9359
9359
  }), HTMLElementSchema = z.any().refine((a) => a instanceof HTMLElement), UIProps = CommonProps.extend({
9360
9360
  domContainer: HTMLElementSchema,
9361
9361
  options: UIOptions.optional()
@@ -60275,7 +60275,9 @@ const uuid$6 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (a)
60275
60275
  const tt = (nt = Object.values(_).find(
60276
60276
  (at) => (at == null ? void 0 : at.propPanel.defaultSchema.type) === $
60277
60277
  )) == null ? void 0 : nt.propPanel;
60278
- Object.assign(a, (tt == null ? void 0 : tt.defaultSchema) || {});
60278
+ Object.keys((tt == null ? void 0 : tt.defaultSchema) || {}).forEach((at) => {
60279
+ a.hasOwnProperty(at) || (a[at] = tt == null ? void 0 : tt.defaultSchema[at]);
60280
+ });
60279
60281
  }, changeSchemas = (a) => {
60280
60282
  const { objs: s, schemas: $, basePdf: _, pluginsRegistry: _e, pageSize: tt, commitSchemas: nt } = a, at = s.reduce((ot, { key: rt, value: st, schemaId: lt }) => {
60281
60283
  const et = ot.find((it) => it.id === lt);
@@ -81843,7 +81845,6 @@ const UseDynamicFontSize = (a) => {
81843
81845
  widgets: { UseDynamicFontSize },
81844
81846
  defaultSchema: {
81845
81847
  type: "text",
81846
- icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-text-cursor-input"><path d="M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1"/><path d="M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5"/><path d="M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1"/><path d="M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7"/><path d="M9 7v10"/></svg>',
81847
81848
  content: "Type Something...",
81848
81849
  position: { x: 0, y: 0 },
81849
81850
  width: 45,
@@ -81968,14 +81969,19 @@ const UseDynamicFontSize = (a) => {
81968
81969
  return "flex-end";
81969
81970
  }
81970
81971
  return "flex-start";
81971
- }, getBackgroundColor = (a, s) => !a || !s.backgroundColor ? "transparent" : s.backgroundColor, textSchema = { pdf: pdfRender, ui: uiRender, propPanel }, text = textSchema;
81972
+ }, getBackgroundColor = (a, s) => !a || !s.backgroundColor ? "transparent" : s.backgroundColor, textSchema = {
81973
+ pdf: pdfRender,
81974
+ ui: uiRender,
81975
+ propPanel,
81976
+ icon: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-text-cursor-input"><path d="M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1"/><path d="M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5"/><path d="M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1"/><path d="M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7"/><path d="M9 7v10"/></svg>'
81977
+ }, text = textSchema;
81972
81978
  textSchema.pdf, textSchema.ui, {
81973
81979
  ...textSchema.propPanel,
81974
81980
  defaultSchema: {
81975
81981
  ...textSchema.propPanel.defaultSchema
81976
81982
  }
81977
81983
  };
81978
- const getBody$1 = (a) => JSON.parse(a || "[]"), getBodyWithRange = (a, s) => {
81984
+ const getBody$1 = (a) => typeof a == "string" ? JSON.parse(a || "[]") : a || [], getBodyWithRange = (a, s) => {
81979
81985
  const $ = getBody$1(a);
81980
81986
  return s ? $.slice(s.start, s.end) : $;
81981
81987
  };
@@ -82468,7 +82474,7 @@ const modifyTemplateForTable = async (a) => {
82468
82474
  for (const [rt, st] of Object.entries(at))
82469
82475
  if (st.type === "table") {
82470
82476
  st.__bodyRange = void 0;
82471
- const lt = JSON.parse(($ == null ? void 0 : $[rt]) || "[]"), et = await createMultiTables(lt, {
82477
+ const lt = getBody$1($ == null ? void 0 : $[rt]), et = await createMultiTables(lt, {
82472
82478
  schema: st,
82473
82479
  basePdf: tt.basePdf,
82474
82480
  options: _,
@@ -82489,7 +82495,7 @@ const modifyTemplateForTable = async (a) => {
82489
82495
  start: ut.slice(0, dt + 1).reduce((mt, ct) => mt + ct.length, 0),
82490
82496
  end: ut.slice(0, dt + 2).reduce((mt, ct) => mt + ct.length, 0)
82491
82497
  },
82492
- content: $[rt]
82498
+ content: typeof $[rt] != "string" ? JSON.stringify($[rt] || "[]") : $[rt]
82493
82499
  }
82494
82500
  };
82495
82501
  ot[gt] = pt;
@@ -151858,82 +151864,61 @@ const FormRender = withProvider(FormCore, defaultWidgets), svgBaseProp = {
151858
151864
  );
151859
151865
  }) }) });
151860
151866
  }, ButtonGroupWidget$1 = ButtonGroupWidget, { Text: Text$2 } = Typography$1, DetailView = (a) => {
151861
- const { token: s } = theme.useToken(), { size: $, changeSchemas: _, deselectSchema: _e, activeSchema: tt, activeElements: nt } = a, at = useForm(), ot = reactExports.useContext(I18nContext), rt = reactExports.useContext(PluginsRegistry), st = reactExports.useContext(OptionsContext), [lt, et] = reactExports.useState({});
151867
+ const { token: s } = theme.useToken(), { size: $, changeSchemas: _, deselectSchema: _e, activeSchema: tt } = a, nt = useForm(), at = reactExports.useContext(I18nContext), ot = reactExports.useContext(PluginsRegistry), rt = reactExports.useContext(OptionsContext);
151862
151868
  reactExports.useEffect(() => {
151863
- const pt = {
151864
- AlignWidget: (mt) => /* @__PURE__ */ jsxRuntimeExports.jsx(AlignWidget$1, { ...mt, ...a, options: st }),
151865
- Divider: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Divider$1, { style: { marginTop: s.marginXS, marginBottom: s.marginXS } }),
151866
- ButtonGroup: (mt) => /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonGroupWidget$1, { ...mt, ...a, options: st })
151867
- };
151868
- for (const mt of Object.values(rt)) {
151869
- const ct = (mt == null ? void 0 : mt.propPanel.widgets) || {};
151870
- Object.entries(ct).forEach(([vt, At]) => {
151871
- pt[vt] = (xt) => /* @__PURE__ */ jsxRuntimeExports.jsx(
151872
- WidgetRenderer$1,
151873
- {
151874
- ...xt,
151875
- ...a,
151876
- options: st,
151877
- theme: s,
151878
- i18n: ot,
151879
- widget: At
151880
- }
151881
- );
151882
- });
151869
+ const dt = { ...tt };
151870
+ dt.x = dt.position.x, dt.y = dt.position.y, delete dt.position, nt.setValues(dt);
151871
+ }, [tt, nt]);
151872
+ const st = (dt) => {
151873
+ const gt = (mt, ct) => typeof mt == "object" ? JSON.stringify(mt) !== JSON.stringify(ct) : mt !== ct;
151874
+ let pt = [];
151875
+ for (let mt in dt) {
151876
+ if (["id", "content"].includes(mt))
151877
+ continue;
151878
+ let ct = dt[mt], vt = !1;
151879
+ ["x", "y"].includes(mt) ? (vt = ct !== tt.position[mt], mt = "position." + mt) : vt = gt(ct, tt[mt]), vt && (ct === null && ["rotate", "opacity"].includes(mt) && (ct = void 0), pt.push({ key: mt, value: ct, schemaId: tt.id }));
151883
151880
  }
151884
- et(pt);
151885
- }, [tt, nt, rt, JSON.stringify(st)]), reactExports.useEffect(() => {
151886
- const pt = { ...tt };
151887
- pt.x = pt.position.x, pt.y = pt.position.y, delete pt.position, pt.key !== (at.getValues() || {}).key && at.resetFields(), at.setValues(pt);
151888
- }, [at, tt]);
151889
- const it = (pt) => {
151890
- let mt = [];
151891
- for (let ct in pt)
151892
- if (!["id", "content"].includes(ct) && (ct === "x" && (ct = "position.x"), ct === "y" && (ct = "position.y"), pt[ct] !== tt[ct])) {
151893
- let vt = pt[ct];
151894
- vt === null && ["rotate", "opacity"].includes(ct) && (vt = void 0), mt.push({ key: ct, value: vt, schemaId: tt.id });
151895
- }
151896
- mt.length && at.validateFields().then(() => _(mt)).catch((ct) => {
151897
- ct.errorFields.length && (mt = mt.filter((vt) => !ct.errorFields.find(
151898
- (At) => At.name.includes(vt.key)
151899
- ))), mt.length && _(mt);
151881
+ pt.length && nt.validateFields().then(() => _(pt)).catch((mt) => {
151882
+ mt.errorFields.length && (pt = pt.filter((ct) => !mt.errorFields.find(
151883
+ (vt) => vt.name.includes(ct.key)
151884
+ ))), pt.length && _(pt);
151900
151885
  });
151901
- }, ut = Object.values(rt).find(
151902
- (pt) => (pt == null ? void 0 : pt.propPanel.defaultSchema.type) === tt.type
151903
- ), ft = ut == null ? void 0 : ut.propPanel.schema;
151904
- ft || console.error(`[@pdfme/ui] No propPanel.schema for ${tt.type}.
151886
+ }, lt = Object.values(ot).find(
151887
+ (dt) => (dt == null ? void 0 : dt.propPanel.defaultSchema.type) === tt.type
151888
+ ), et = lt == null ? void 0 : lt.propPanel.schema;
151889
+ et || console.error(`[@pdfme/ui] No propPanel.schema for ${tt.type}.
151905
151890
  Check this document: https://pdfme.com/docs/custom-schemas`);
151906
- const ht = Object.entries(rt).map(([pt, mt]) => ({
151907
- label: pt,
151908
- value: mt == null ? void 0 : mt.propPanel.defaultSchema.type
151909
- })), dt = ut.propPanel.defaultSchema, gt = {
151891
+ const it = Object.entries(ot).map(([dt, gt]) => ({
151892
+ label: dt,
151893
+ value: gt == null ? void 0 : gt.propPanel.defaultSchema.type
151894
+ })), ut = lt.propPanel.defaultSchema, ft = {
151910
151895
  type: "object",
151911
151896
  column: 2,
151912
151897
  properties: {
151913
151898
  type: {
151914
- title: ot("type"),
151899
+ title: at("type"),
151915
151900
  type: "string",
151916
151901
  widget: "select",
151917
- props: { options: ht },
151902
+ props: { options: it },
151918
151903
  required: !0,
151919
151904
  span: 12
151920
151905
  },
151921
- key: { title: ot("fieldName"), type: "string", required: !0, span: 12 },
151906
+ key: { title: at("fieldName"), type: "string", required: !0, span: 12 },
151922
151907
  "-": { type: "void", widget: "Divider" },
151923
- align: { title: ot("align"), type: "void", widget: "AlignWidget" },
151908
+ align: { title: at("align"), type: "void", widget: "AlignWidget" },
151924
151909
  x: { title: "X", type: "number", widget: "inputNumber", required: !0, span: 8, min: 0 },
151925
151910
  y: { title: "Y", type: "number", widget: "inputNumber", required: !0, span: 8, min: 0 },
151926
151911
  rotate: {
151927
- title: ot("rotate"),
151912
+ title: at("rotate"),
151928
151913
  type: "number",
151929
151914
  widget: "inputNumber",
151930
- disabled: (dt == null ? void 0 : dt.rotate) === void 0,
151915
+ disabled: (ut == null ? void 0 : ut.rotate) === void 0,
151931
151916
  max: 360,
151932
151917
  props: { min: 0 },
151933
151918
  span: 8
151934
151919
  },
151935
151920
  width: {
151936
- title: ot("width"),
151921
+ title: at("width"),
151937
151922
  type: "number",
151938
151923
  widget: "inputNumber",
151939
151924
  required: !0,
@@ -151941,7 +151926,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
151941
151926
  props: { min: 0 }
151942
151927
  },
151943
151928
  height: {
151944
- title: ot("height"),
151929
+ title: at("height"),
151945
151930
  type: "number",
151946
151931
  widget: "inputNumber",
151947
151932
  required: !0,
@@ -151949,35 +151934,56 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
151949
151934
  props: { min: 0 }
151950
151935
  },
151951
151936
  opacity: {
151952
- title: ot("opacity"),
151937
+ title: at("opacity"),
151953
151938
  type: "number",
151954
151939
  widget: "inputNumber",
151955
- disabled: (dt == null ? void 0 : dt.opacity) === void 0,
151940
+ disabled: (ut == null ? void 0 : ut.opacity) === void 0,
151956
151941
  props: { step: 0.1, min: 0, max: 1 },
151957
151942
  span: 8
151958
151943
  }
151959
151944
  }
151960
151945
  };
151961
- if (typeof ft == "function") {
151962
- const pt = ft({
151946
+ if (typeof et == "function") {
151947
+ const dt = et({
151963
151948
  ...a,
151964
- options: st,
151949
+ options: rt,
151965
151950
  theme: s,
151966
- i18n: ot
151951
+ i18n: at
151967
151952
  }) || {};
151968
- gt.properties = {
151969
- ...gt.properties,
151970
- ...Object.keys(pt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151971
- ...pt
151953
+ ft.properties = {
151954
+ ...ft.properties,
151955
+ ...Object.keys(dt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151956
+ ...dt
151972
151957
  };
151973
151958
  } else {
151974
- const pt = ft || {};
151975
- gt.properties = {
151976
- ...gt.properties,
151977
- ...Object.keys(pt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151978
- ...pt
151959
+ const dt = et || {};
151960
+ ft.properties = {
151961
+ ...ft.properties,
151962
+ ...Object.keys(dt).length === 0 ? {} : { "--": { type: "void", widget: "Divider" } },
151963
+ ...dt
151979
151964
  };
151980
151965
  }
151966
+ const ht = {
151967
+ AlignWidget: (dt) => /* @__PURE__ */ jsxRuntimeExports.jsx(AlignWidget$1, { ...dt, ...a, options: rt }),
151968
+ Divider: () => /* @__PURE__ */ jsxRuntimeExports.jsx(Divider$1, { style: { marginTop: s.marginXS, marginBottom: s.marginXS } }),
151969
+ ButtonGroup: (dt) => /* @__PURE__ */ jsxRuntimeExports.jsx(ButtonGroupWidget$1, { ...dt, ...a, options: rt })
151970
+ };
151971
+ for (const dt of Object.values(ot)) {
151972
+ const gt = (dt == null ? void 0 : dt.propPanel.widgets) || {};
151973
+ Object.entries(gt).forEach(([pt, mt]) => {
151974
+ ht[pt] = (ct) => /* @__PURE__ */ jsxRuntimeExports.jsx(
151975
+ WidgetRenderer$1,
151976
+ {
151977
+ ...ct,
151978
+ ...a,
151979
+ options: rt,
151980
+ theme: s,
151981
+ i18n: at,
151982
+ widget: mt
151983
+ }
151984
+ );
151985
+ });
151986
+ }
151981
151987
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
151982
151988
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { height: 40, display: "flex", alignItems: "center" }, children: [
151983
151989
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -151994,7 +152000,7 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
151994
152000
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuOutlined$1, {})
151995
152001
  }
151996
152002
  ),
151997
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { strong: !0, style: { textAlign: "center", width: "100%" }, children: ot("editField") })
152003
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { strong: !0, style: { textAlign: "center", width: "100%" }, children: at("editField") })
151998
152004
  ] }),
151999
152005
  /* @__PURE__ */ jsxRuntimeExports.jsx(Divider$1, { style: { marginTop: s.marginXS, marginBottom: s.marginXS } }),
152000
152006
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -152008,17 +152014,17 @@ Check this document: https://pdfme.com/docs/custom-schemas`);
152008
152014
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
152009
152015
  FormRender,
152010
152016
  {
152011
- form: at,
152012
- schema: gt,
152013
- widgets: lt,
152014
- watch: { "#": it },
152017
+ form: nt,
152018
+ schema: ft,
152019
+ widgets: ht,
152020
+ watch: { "#": st },
152015
152021
  locale: "en-US"
152016
152022
  }
152017
152023
  )
152018
152024
  }
152019
152025
  )
152020
152026
  ] });
152021
- }, DetailView$1 = DetailView, Sidebar = (a) => {
152027
+ }, propsAreUnchanged = (a, s) => JSON.stringify(a.activeSchema) == JSON.stringify(s.activeSchema), DetailView$1 = React$a.memo(DetailView, propsAreUnchanged), Sidebar = (a) => {
152022
152028
  const { sidebarOpen: s, setSidebarOpen: $, activeElements: _, schemas: _e } = a, { token: tt } = theme.useToken(), nt = () => _e.filter((ot) => _.map((rt) => rt.id).includes(ot.id)), at = () => {
152023
152029
  const ot = nt();
152024
152030
  return ot[ot.length - 1];
@@ -152152,15 +152158,15 @@ Check this document: https://pdfme.com/docs/custom-schemas`), /* @__PURE__ */ js
152152
152158
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { visibility: lt ? "hidden" : "visible" }, children: a.children })
152153
152159
  ] });
152154
152160
  }, LeftSidebar = ({ height: a, scale: s, basePdf: $ }) => {
152155
- const { token: _ } = theme.useToken(), _e = reactExports.useContext(PluginsRegistry), [tt, nt] = reactExports.useState(!1);
152161
+ const { token: _ } = theme.useToken(), _e = reactExports.useContext(PluginsRegistry), tt = reactExports.useContext(OptionsContext), [nt, at] = reactExports.useState(!1);
152156
152162
  return reactExports.useEffect(() => {
152157
- const at = () => {
152158
- tt && nt(!1);
152163
+ const ot = () => {
152164
+ nt && at(!1);
152159
152165
  };
152160
- return document.addEventListener("mouseup", at), () => {
152161
- document.removeEventListener("mouseup", at);
152166
+ return document.addEventListener("mouseup", ot), () => {
152167
+ document.removeEventListener("mouseup", ot);
152162
152168
  };
152163
- }, [tt]), /* @__PURE__ */ jsxRuntimeExports.jsx(
152169
+ }, [nt]), /* @__PURE__ */ jsxRuntimeExports.jsx(
152164
152170
  "div",
152165
152171
  {
152166
152172
  style: {
@@ -152172,28 +152178,34 @@ Check this document: https://pdfme.com/docs/custom-schemas`), /* @__PURE__ */ js
152172
152178
  width: 45,
152173
152179
  background: _.colorBgLayout,
152174
152180
  textAlign: "center",
152175
- overflow: tt ? "visible" : "auto"
152181
+ overflow: nt ? "visible" : "auto"
152176
152182
  },
152177
- children: Object.entries(_e).map(([at, ot]) => ot != null && ot.propPanel.defaultSchema ? /* @__PURE__ */ jsxRuntimeExports.jsx(
152178
- Draggable$1,
152179
- {
152180
- scale: s,
152181
- basePdf: $,
152182
- plugin: ot,
152183
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
152184
- Button$2,
152185
- {
152186
- title: at,
152187
- onMouseDown: () => {
152188
- nt(!0);
152189
- },
152190
- style: { width: 35, height: 35, marginTop: "0.25rem", padding: "0.25rem" },
152191
- children: ot.propPanel.defaultSchema.icon ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: ot.propPanel.defaultSchema.icon } }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { overflow: "hidden", textOverflow: "ellipsis" }, children: at })
152192
- }
152193
- )
152194
- },
152195
- at
152196
- ) : null)
152183
+ children: Object.entries(_e).map(([ot, rt]) => {
152184
+ var lt;
152185
+ if (!(rt != null && rt.propPanel.defaultSchema))
152186
+ return null;
152187
+ const st = ((lt = tt.icons) == null ? void 0 : lt[rt.propPanel.defaultSchema.type]) ?? rt.icon;
152188
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
152189
+ Draggable$1,
152190
+ {
152191
+ scale: s,
152192
+ basePdf: $,
152193
+ plugin: rt,
152194
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
152195
+ Button$2,
152196
+ {
152197
+ title: ot,
152198
+ onMouseDown: () => {
152199
+ at(!0);
152200
+ },
152201
+ style: { width: 35, height: 35, marginTop: "0.25rem", padding: "0.25rem" },
152202
+ children: st ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: st } }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { overflow: "hidden", textOverflow: "ellipsis" }, children: ot })
152203
+ }
152204
+ )
152205
+ },
152206
+ ot
152207
+ );
152208
+ })
152197
152209
  }
152198
152210
  );
152199
152211
  }, LeftSidebar$1 = LeftSidebar, Paper = (a) => {
@@ -162367,7 +162379,7 @@ const Guides$2 = Guides$1, guideStyle = (a, s, $, _) => ({
162367
162379
  var rr, Yt;
162368
162380
  if (!$t.active)
162369
162381
  return;
162370
- const Pt = $t.active, Dt = ot.current[dt].getBoundingClientRect(), Ut = ((rr = Pt.rect.current.initial) == null ? void 0 : rr.left) || 0, Vt = ((Yt = Pt.rect.current.initial) == null ? void 0 : Yt.top) || 0, Qt = Dt.left - Ut + scaleDragPosAdjustment(20, St), qt = Dt.top - Vt, Zt = ($t.delta.y - qt) / St, ar = ($t.delta.x - Qt) / St, Jt = { x: px2mm(Math.max(0, ar)), y: px2mm(Math.max(0, Zt)) };
162382
+ const Pt = $t.active, Dt = ot.current[dt].getBoundingClientRect(), Ut = ((rr = Pt.rect.current.initial) == null ? void 0 : rr.left) || 0, Vt = ((Yt = Pt.rect.current.initial) == null ? void 0 : Yt.top) || 0, Qt = Dt.left - Ut + scaleDragPosAdjustment(20, St), qt = Dt.top - Vt, Zt = ($t.delta.y - qt) / St, ar = ($t.delta.x - Qt) / St, Jt = { x: round(px2mm(Math.max(0, ar)), 2), y: round(px2mm(Math.max(0, Zt)), 2) };
162371
162383
  kt({ ...Pt.data.current, position: Jt });
162372
162384
  },
162373
162385
  onDragStart: wt,