@antscorp/antsomi-ui 1.3.5-beta.269 → 1.3.5-beta.270

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,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
2
3
  export type TDisplayFormat = 'number' | 'percentage' | 'currency' | 'datetime';
3
4
  type DisplayFormatProps = {
@@ -48,8 +48,12 @@ export const ImageEditor = React.forwardRef((props, ref) => {
48
48
  ? { history: [defaultValue], historyStep: 0, current: defaultValue }
49
49
  : initialReducer);
50
50
  const { current: { arrows, circles, imageCoordinate, rectangles, scribbles, image }, } = state;
51
+ useEffect(() => {
52
+ // NOTE: reset initial reducer when change image (in ImageSlider)
53
+ dispatch({ type: 'RESET', payload: defaultValue ? defaultValue : initialReducer.current });
54
+ }, [defaultValue]);
51
55
  // const [imageFromUrl] = useImage(imageUrl);
52
- // console.log(imageUrl, '🚀 ~ ImageEditor ~ imageFromUrl:', imageFromUrl);
56
+ // console.log(imageUrl, '🚀 ~ ImageEditor ~ imageFromUrl:', imageUrl);
53
57
  const stageRef = useRef(null);
54
58
  const transformerRef = useRef(null);
55
59
  const selectionRectangleRef = useRef(null);
@@ -69,6 +69,9 @@ type ReducerAction = {
69
69
  } | {
70
70
  type: 'REDO';
71
71
  payload?: {};
72
+ } | {
73
+ type: 'RESET';
74
+ payload: CanvasState;
72
75
  };
73
76
  interface HistoryReducer {
74
77
  history: CanvasState[];
@@ -44,6 +44,9 @@ export const reducer = (state, action) => {
44
44
  }
45
45
  return Object.assign(Object.assign({}, state), { historyStep: state.historyStep + 1, current: state.history[state.historyStep + 1] });
46
46
  }
47
+ case 'RESET': {
48
+ return { history: [payload], historyStep: 0, current: payload };
49
+ }
47
50
  default:
48
51
  break;
49
52
  }
@@ -3,4 +3,5 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
+ /// <reference types="react" />
6
7
  export declare const TemplateListing: (props: import("@antscorp/antsomi-ui/es/components").TemplateListingProps<{}>) => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.269",
3
+ "version": "1.3.5-beta.270",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",