@conboai/storybook.components 0.5.70 → 0.5.72

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.
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
2
  import { IShapesProps } from './types';
3
3
 
4
- declare const Shapes: ({ children, mode: modeFromProps, onModeChange: _onModeChange, shapes: shapesFromProps, selected: selectedShapeFromProps, onShapeChange, onShapeSelect, onMouseMove, menu, showNumbers, showId, showOnlyPoints, showPoints, showDirection, selectedShapeZIndex, snapToBoundaries, styles, polygonMaxLength, polylineMaxLength, polylineProps }: IShapesProps) => React.JSX.Element;
4
+ declare const Shapes: ({ children, mode: modeFromProps, onModeChange: _onModeChange, shapes: shapesFromProps, selected: selectedShapeFromProps, onShapeChange, onShapeSelect, onMouseMove, menu, showNumbers, showId, showOnlyPoints, showPoints, showDirection, selectedShapeZIndex, snapToBoundaries, styles, polygonMaxLength, polylineMaxLength, polylineProps, }: IShapesProps) => React.JSX.Element;
5
5
  export default Shapes;
@@ -30,6 +30,8 @@ export interface Shape {
30
30
  header?: {
31
31
  text: string;
32
32
  };
33
+ showDirection?: boolean;
34
+ showEndDirection?: boolean;
33
35
  }
34
36
  export interface IShapesProps {
35
37
  children?: ReactNode;
@@ -75410,7 +75410,9 @@ const Qm = {
75410
75410
  C(null);
75411
75411
  return;
75412
75412
  }
75413
- const ge = R.filter((be) => be.id !== ce.id), ve = p ? [...ge, ce] : R;
75413
+ const ge = R.filter(
75414
+ (be) => be.id !== ce.id
75415
+ ), ve = p ? [...ge, ce] : R;
75414
75416
  s == null || s(ce, ve), C(ce), P(ve);
75415
75417
  },
75416
75418
  [w, R, p]
@@ -75458,13 +75460,17 @@ const Qm = {
75458
75460
  }, G = () => {
75459
75461
  _(null);
75460
75462
  }, Y = Mn(() => {
75461
- const ce = R.filter((ge) => ge.id !== (L == null ? void 0 : L.id));
75463
+ const ce = R.filter(
75464
+ (ge) => ge.id !== (L == null ? void 0 : L.id)
75465
+ );
75462
75466
  P(ce), C(null), i == null || i(null, ce), E(t);
75463
75467
  }, [i, L == null ? void 0 : L.id, R, t]), ie = Mn(
75464
75468
  (ce) => {
75465
75469
  var ye, we;
75466
75470
  if (!L || w === dn.View) return;
75467
- const ge = R.findIndex((Se) => Se.id === L.id);
75471
+ const ge = R.findIndex(
75472
+ (Se) => Se.id === L.id
75473
+ );
75468
75474
  if (ge === -1) return;
75469
75475
  let ve = [...L.points];
75470
75476
  if (L.type === qr.Polygon && (ce === 0 || ce === ve.length - 1) && ve.length > 0) {
@@ -75498,9 +75504,12 @@ const Qm = {
75498
75504
  ), le = (ce) => {
75499
75505
  w !== dn.View && A(ce);
75500
75506
  }, q = Mn(
75501
- Bi.debounce((ce, ge, ve) => {
75502
- i == null || i(ce, ge, ve);
75503
- }, 300),
75507
+ Bi.debounce(
75508
+ (ce, ge, ve) => {
75509
+ i == null || i(ce, ge, ve);
75510
+ },
75511
+ 300
75512
+ ),
75504
75513
  [i]
75505
75514
  ), Z = (ce) => {
75506
75515
  const ge = ce.currentTarget.getBoundingClientRect();
@@ -75510,7 +75519,10 @@ const Qm = {
75510
75519
  ge
75511
75520
  );
75512
75521
  if (ve = g ? L4(ve) : ve, l == null || l(ve), w === dn.CreatePolygon && U.length > 0) {
75513
- const be = x0(ve, U[0]);
75522
+ const be = x0(
75523
+ ve,
75524
+ U[0]
75525
+ );
75514
75526
  H(be), U.length > 1 ? W([...U.slice(0, -1), ve]) : W([U[0], ve]);
75515
75527
  } else if (w === dn.CreatePolyline && U.length > 0) {
75516
75528
  const be = U.length > 1 ? U.length - 2 : 0, ye = x0(
@@ -75527,7 +75539,9 @@ const Qm = {
75527
75539
  L.type === qr.Polygon && (k === 0 || k === Se.length - 1) && Se.length > 0 ? (Se[0] = we, Se[Se.length - 1] = we) : Se[k] = we;
75528
75540
  const Me = { ...L, points: Se };
75529
75541
  C(Me);
75530
- const Ie = R.findIndex((Ae) => Ae.id === L.id);
75542
+ const Ie = R.findIndex(
75543
+ (Ae) => Ae.id === L.id
75544
+ );
75531
75545
  if (Ie !== -1) {
75532
75546
  const Ae = [...R];
75533
75547
  Ae[Ie] = Me, P(Ae), C({ ...L, points: Se }), q(Me, Ae, be);
@@ -75541,7 +75555,11 @@ const Qm = {
75541
75555
  }
75542
75556
  }, J = Mn(
75543
75557
  (ce, ge, ve) => {
75544
- const be = fl(ce - ve.left, ge - ve.top, ve), ye = { x: be.x, y: be.y }, we = [...U, ye];
75558
+ const be = fl(
75559
+ ce - ve.left,
75560
+ ge - ve.top,
75561
+ ve
75562
+ ), ye = { x: be.x, y: be.y }, we = [...U, ye];
75545
75563
  W(we), i == null || i(
75546
75564
  {
75547
75565
  id: "draw polyline",
@@ -75563,9 +75581,15 @@ const Qm = {
75563
75581
  ce.clientX - be.left,
75564
75582
  ce.clientY - be.top,
75565
75583
  be
75566
- ), we = U.length - 1 >= 3, Se = U.length > v, Me = x0(ye, U[0]);
75584
+ ), we = U.length - 1 >= 3, Se = U.length > v, Me = x0(
75585
+ ye,
75586
+ U[0]
75587
+ );
75567
75588
  if (we && Me) {
75568
- const Ie = [...U.slice(0, -1), U[0]], Ae = {
75589
+ const Ie = [
75590
+ ...U.slice(0, -1),
75591
+ U[0]
75592
+ ], Ae = {
75569
75593
  type: qr.Polygon,
75570
75594
  id: S4(),
75571
75595
  points: Ie,
@@ -75638,8 +75662,17 @@ const Qm = {
75638
75662
  );
75639
75663
  P(Ie), C(Me), i == null || i(Me, Ie);
75640
75664
  },
75641
- [w, L, R, i, v, y]
75642
- ), se = R.filter((ce) => ce.id !== (L == null ? void 0 : L.id)), ue = Co(
75665
+ [
75666
+ w,
75667
+ L,
75668
+ R,
75669
+ i,
75670
+ v,
75671
+ y
75672
+ ]
75673
+ ), se = R.filter(
75674
+ (ce) => ce.id !== (L == null ? void 0 : L.id)
75675
+ ), ue = Co(
75643
75676
  () => p && L && se.length > 0 && R.some((ce) => ce.id === L.id) ? [...se, L] : R,
75644
75677
  [se, L, p, R]
75645
75678
  );
@@ -75762,7 +75795,15 @@ const Qm = {
75762
75795
  ce.id
75763
75796
  )
75764
75797
  ] }),
75765
- (ce.type === qr.Polygon || ce.type === qr.Polyline) && (L == null ? void 0 : L.id) === ce.id && u && ((ke = Mue(ce.points)) == null ? void 0 : ke.map((Mt, kt) => M ? /* @__PURE__ */ V.jsx(M4, { point: Mt, number: kt, rect: M }, kt) : null)),
75798
+ (ce.type === qr.Polygon || ce.type === qr.Polyline) && (L == null ? void 0 : L.id) === ce.id && u && ((ke = Mue(ce.points)) == null ? void 0 : ke.map((Mt, kt) => M ? /* @__PURE__ */ V.jsx(
75799
+ M4,
75800
+ {
75801
+ point: Mt,
75802
+ number: kt,
75803
+ rect: M
75804
+ },
75805
+ kt
75806
+ ) : null)),
75766
75807
  ce.type === qr.Polyline && /* @__PURE__ */ V.jsxs(P6, { children: [
75767
75808
  ((Re = ce == null ? void 0 : ce.crossLine) == null ? void 0 : Re.direction) && /* @__PURE__ */ V.jsx(
75768
75809
  Rue,
@@ -75793,7 +75834,7 @@ const Qm = {
75793
75834
  },
75794
75835
  ce.id
75795
75836
  ),
75796
- m && /* @__PURE__ */ V.jsxs("g", { children: [
75837
+ (m || ce.showDirection) && /* @__PURE__ */ V.jsxs("g", { children: [
75797
75838
  /* @__PURE__ */ V.jsx(
75798
75839
  "circle",
75799
75840
  {
@@ -75819,7 +75860,7 @@ const Qm = {
75819
75860
  }
75820
75861
  )
75821
75862
  ] }),
75822
- (x == null ? void 0 : x.showEndDirection) && we && /* @__PURE__ */ V.jsxs("g", { children: [
75863
+ x != null && x.showEndDirection && we || ce.showEndDirection && we ? /* @__PURE__ */ V.jsxs("g", { children: [
75823
75864
  /* @__PURE__ */ V.jsx(
75824
75865
  "circle",
75825
75866
  {
@@ -75844,7 +75885,7 @@ const Qm = {
75844
75885
  children: x == null ? void 0 : x.endMarkerLabel
75845
75886
  }
75846
75887
  )
75847
- ] })
75888
+ ] }) : null
75848
75889
  ] }, ce.id),
75849
75890
  ce.type === qr.Point && /* @__PURE__ */ V.jsx(
75850
75891
  zue,
@@ -75912,7 +75953,15 @@ const Qm = {
75912
75953
  `draw-shape-${ge}`
75913
75954
  );
75914
75955
  }),
75915
- w === dn.CreatePolygon && u && (U == null ? void 0 : U.map((ce, ge) => M ? /* @__PURE__ */ V.jsx(M4, { point: ce, number: ge, rect: M }, ge) : null))
75956
+ w === dn.CreatePolygon && u && (U == null ? void 0 : U.map((ce, ge) => M ? /* @__PURE__ */ V.jsx(
75957
+ M4,
75958
+ {
75959
+ point: ce,
75960
+ number: ge,
75961
+ rect: M
75962
+ },
75963
+ ge
75964
+ ) : null))
75916
75965
  ]
75917
75966
  }
75918
75967
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conboai/storybook.components",
3
- "version": "0.5.70",
3
+ "version": "0.5.72",
4
4
  "main": "dist/storybook.components.mjs",
5
5
  "types": "dist/build/index.d.ts",
6
6
  "files": [