@antscorp/antsomi-ui 1.3.5-beta.926 → 1.3.5-beta.927

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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { PayloadInfo } from '@antscorp/antsomi-ui/es/types';
3
2
  export type TDisplayFormat = 'number' | 'percentage' | 'currency' | 'datetime';
4
3
  type DisplayFormatProps = {
@@ -26,6 +26,7 @@ const TagifyInput = forwardRef((props, ref) => {
26
26
  // States
27
27
  const [isLineBreak, setIsLineBreak] = useState(hasLineBreak(initialValue));
28
28
  const [tooltipRefresher, setTooltipRefresher] = useState(1);
29
+ const [labelTagRefreshness, setLabelTagRefreshness] = useState(1);
29
30
  // Refs
30
31
  const inputRef = useRef(null);
31
32
  const tagifyRef = useRef(null);
@@ -426,6 +427,12 @@ const TagifyInput = forwardRef((props, ref) => {
426
427
  tagifyRef.current.loadOriginalValues(newContent);
427
428
  }
428
429
  },
430
+ onLabelTagRefreshness() {
431
+ if (!tagifyRef.current) {
432
+ throw new Error('Tagify instance is not initialized');
433
+ }
434
+ setLabelTagRefreshness(prev => prev + 1);
435
+ },
429
436
  }), [acceptableTagPattern, escapeHTML, onInjectTagAtCaret, placeCaretAfterNode]);
430
437
  const onTagItemClick = useCallback((event) => {
431
438
  event.stopPropagation();
@@ -518,7 +525,7 @@ const TagifyInput = forwardRef((props, ref) => {
518
525
  * Any map attribute change will sync label of the tags
519
526
  */
520
527
  const makeValidLabelTags = useCallback((attributes, errorAttributes) => {
521
- if (tagifyRef.current) {
528
+ if (tagifyRef.current && labelTagRefreshness) {
522
529
  const tagElements = tagifyRef.current.getTagElms();
523
530
  const { pattern, name: cachePatternName, acceptablePattern: acceptableType, } = patternHandlers[PERSONALIZE_PTN];
524
531
  tagElements.forEach(tagElement => {
@@ -633,7 +640,7 @@ const TagifyInput = forwardRef((props, ref) => {
633
640
  });
634
641
  setTooltipRefresher(prev => prev + 1);
635
642
  }
636
- }, [acceptableTagPattern]);
643
+ }, [acceptableTagPattern, labelTagRefreshness]);
637
644
  const initializeTagify = useCallback(() => {
638
645
  if (inputRef.current && !tagifyRef.current) {
639
646
  tagifyRef.current = new Tagify(inputRef.current, {
@@ -130,6 +130,7 @@ export interface TagifyInputRef {
130
130
  onAddNewTag: (newTag: TagDataCustomize | string) => void;
131
131
  onReplaceTag: (currentTagEle: HTMLElement, newTag: TagDataCustomize) => void;
132
132
  onReload: (newValue: string) => void;
133
+ onLabelTagRefreshness: () => void;
133
134
  }
134
135
  export type EmojiCollection = (typeof EMOJI_COLLECTIONS)[keyof typeof EMOJI_COLLECTIONS];
135
136
  export type TagType = (typeof TAG_TYPE)[keyof typeof TAG_TYPE];
@@ -3,5 +3,4 @@
3
3
  * Asynchronously loads the component for TemplateListing
4
4
  *
5
5
  */
6
- /// <reference types="react" />
7
6
  export declare const TemplateListing: (props: import("./types").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.926",
3
+ "version": "1.3.5-beta.927",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",
@@ -256,3 +256,4 @@
256
256
  "react-router-dom": ">= 5.1.0"
257
257
  }
258
258
  }
259
+