@pdfme/ui 6.1.8-dev.1 → 6.1.8

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.
@@ -6,9 +6,7 @@ type RendererProps = Omit<UIRenderProps<Schema>, 'schema' | 'rootElement' | 'opt
6
6
  value: string;
7
7
  outline: string;
8
8
  onChangeHoveringSchemaId?: (id: string | null) => void;
9
- onChangeActiveSchemaId?: (id: string | null) => void;
10
9
  scale: number;
11
- isActive?: boolean;
12
10
  selectable?: boolean;
13
11
  };
14
12
  declare const Renderer: (props: RendererProps) => React.JSX.Element;
package/dist/index.js CHANGED
@@ -44411,7 +44411,7 @@ pp$3.currentThisScope = function() {
44411
44411
  if (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) && !(scope.flags & SCOPE_ARROW)) return scope;
44412
44412
  }
44413
44413
  };
44414
- var Node$1 = function Node(parser, pos, loc) {
44414
+ var Node = function Node(parser, pos, loc) {
44415
44415
  this.type = "";
44416
44416
  this.start = pos;
44417
44417
  this.end = 0;
@@ -44421,10 +44421,10 @@ var Node$1 = function Node(parser, pos, loc) {
44421
44421
  };
44422
44422
  var pp$2 = Parser.prototype;
44423
44423
  pp$2.startNode = function() {
44424
- return new Node$1(this, this.start, this.startLoc);
44424
+ return new Node(this, this.start, this.startLoc);
44425
44425
  };
44426
44426
  pp$2.startNodeAt = function(pos, loc) {
44427
- return new Node$1(this, pos, loc);
44427
+ return new Node(this, pos, loc);
44428
44428
  };
44429
44429
  function finishNodeAt(node, type, pos, loc) {
44430
44430
  node.type = type;
@@ -44440,7 +44440,7 @@ pp$2.finishNodeAt = function(node, type, pos, loc) {
44440
44440
  return finishNodeAt.call(this, node, type, pos, loc);
44441
44441
  };
44442
44442
  pp$2.copyNode = function(node) {
44443
- var newNode = new Node$1(this, node.start, this.startLoc);
44443
+ var newNode = new Node(this, node.start, this.startLoc);
44444
44444
  for (var prop in node) newNode[prop] = node[prop];
44445
44445
  return newNode;
44446
44446
  };
@@ -46006,7 +46006,7 @@ Parser.acorn = {
46006
46006
  Position,
46007
46007
  SourceLocation,
46008
46008
  getLineInfo,
46009
- Node: Node$1,
46009
+ Node,
46010
46010
  TokenType,
46011
46011
  tokTypes: types$1,
46012
46012
  keywordTypes: keywords,
@@ -190243,51 +190243,35 @@ var useRenderKey = (arg) => {
190243
190243
  plugin
190244
190244
  ]);
190245
190245
  };
190246
- var Wrapper = ({ children, outline, onChangeHoveringSchemaId, onChangeActiveSchemaId, schema, mode, isActive = false, selectable = true }) => {
190247
- const { token } = theme_default.useToken();
190248
- const isFormEditable = mode === "form" && !schema.readOnly;
190249
- const activateSchema = () => {
190250
- if (isFormEditable) onChangeActiveSchemaId?.(schema.id);
190251
- };
190252
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
190253
- title: schema.name,
190254
- onMouseEnter: () => onChangeHoveringSchemaId && onChangeHoveringSchemaId(schema.id),
190255
- onMouseLeave: () => onChangeHoveringSchemaId && onChangeHoveringSchemaId(null),
190256
- onPointerDownCapture: activateSchema,
190257
- onClickCapture: activateSchema,
190258
- onFocusCapture: activateSchema,
190259
- onBlurCapture: (event) => {
190260
- const nextTarget = event.relatedTarget;
190261
- if (!(nextTarget instanceof Node) || !event.currentTarget.contains(nextTarget)) onChangeActiveSchemaId?.(null);
190262
- },
190263
- className: selectable ? SELECTABLE_CLASSNAME : "",
190264
- id: schema.id,
190246
+ var Wrapper = ({ children, outline, onChangeHoveringSchemaId, schema, selectable = true }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
190247
+ title: schema.name,
190248
+ onMouseEnter: () => onChangeHoveringSchemaId && onChangeHoveringSchemaId(schema.id),
190249
+ onMouseLeave: () => onChangeHoveringSchemaId && onChangeHoveringSchemaId(null),
190250
+ className: selectable ? SELECTABLE_CLASSNAME : "",
190251
+ id: schema.id,
190252
+ style: {
190253
+ position: "absolute",
190254
+ cursor: schema.readOnly ? "initial" : "pointer",
190255
+ height: schema.height * ZOOM,
190256
+ width: schema.width * ZOOM,
190257
+ top: schema.position.y * ZOOM,
190258
+ left: schema.position.x * ZOOM,
190259
+ transform: `rotate(${schema.rotate ?? 0}deg)`,
190260
+ opacity: schema.opacity ?? 1,
190261
+ outline
190262
+ },
190263
+ children: [schema.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
190265
190264
  style: {
190265
+ color: "red",
190266
190266
  position: "absolute",
190267
- cursor: schema.readOnly ? "initial" : "pointer",
190268
- height: schema.height * ZOOM,
190269
- width: schema.width * ZOOM,
190270
- top: schema.position.y * ZOOM,
190271
- left: schema.position.x * ZOOM,
190272
- transform: `rotate(${schema.rotate ?? 0}deg)`,
190273
- opacity: schema.opacity ?? 1,
190274
- outline,
190275
- boxShadow: isActive ? `0 0 0 2px ${token.colorPrimary}, 0 0 0 4px ${token.colorPrimaryBg}` : void 0,
190276
- zIndex: isActive ? 1 : void 0
190277
- },
190278
- children: [schema.required && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
190279
- style: {
190280
- color: "red",
190281
- position: "absolute",
190282
- top: -12,
190283
- left: -12,
190284
- fontSize: 18,
190285
- fontWeight: 700
190286
- },
190287
- children: "*"
190288
- }), children]
190289
- });
190290
- };
190267
+ top: -12,
190268
+ left: -12,
190269
+ fontSize: 18,
190270
+ fontWeight: 700
190271
+ },
190272
+ children: "*"
190273
+ }), children]
190274
+ });
190291
190275
  var Renderer = (props) => {
190292
190276
  const { schema, basePdf, value, mode, onChange, stopEditing, tabIndex, placeholder, scale } = props;
190293
190277
  const pluginsRegistry = (0, import_react$9.useContext)(PluginsRegistry);
@@ -212019,7 +212003,6 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
212019
212003
  const paperRefs = (0, import_react$9.useRef)([]);
212020
212004
  const [unitCursor, setUnitCursor] = (0, import_react$9.useState)(0);
212021
212005
  const [pageCursor, setPageCursor] = (0, import_react$9.useState)(0);
212022
- const [activeSchemaId, setActiveSchemaId] = (0, import_react$9.useState)(null);
212023
212006
  const [schemasList, setSchemasList] = (0, import_react$9.useState)([[]]);
212024
212007
  const { backgrounds, pageSizes, baseScale, error, refresh } = useUIPreProcessor({
212025
212008
  template,
@@ -212093,9 +212076,6 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
212093
212076
  template,
212094
212077
  unitCursor
212095
212078
  ]);
212096
- (0, import_react$9.useEffect)(() => {
212097
- setActiveSchemaId(null);
212098
- }, [unitCursor]);
212099
212079
  useScrollPageCursor({
212100
212080
  ref: containerRef,
212101
212081
  paperRefs,
@@ -212192,11 +212172,6 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
212192
212172
  }),
212193
212173
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
212194
212174
  ref: containerRef,
212195
- onPointerDown: (event) => {
212196
- if (!isForm) return;
212197
- const target = event.target;
212198
- if (!(target instanceof Element) || !target.closest(`.selectable`)) setActiveSchemaId(null);
212199
- },
212200
212175
  style: {
212201
212176
  ...size,
212202
212177
  position: "relative",
@@ -212231,9 +212206,7 @@ var Preview = ({ template, inputs, size, onChangeInput, onPageChange }) => {
212231
212206
  handleOnChangeRenderer(Array.isArray(arg) ? arg : [arg], schema);
212232
212207
  },
212233
212208
  outline: isForm && !schema.readOnly ? `1px dashed ${token.colorPrimary}` : "transparent",
212234
- scale: renderScale,
212235
- isActive: isForm && activeSchemaId === schema.id,
212236
- onChangeActiveSchemaId: isForm ? setActiveSchemaId : void 0
212209
+ scale: renderScale
212237
212210
  }, schema.id);
212238
212211
  },
212239
212212
  renderPaper: ({ index }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StaticSchema, {