@cregis/ui 1.0.9 → 1.0.13

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.
@@ -175,6 +175,15 @@ export declare interface CheckboxProps {
175
175
  indeterminate?: boolean;
176
176
  }
177
177
 
178
+ export declare interface ClickOutsideOptions {
179
+ /** 忽略的元素列表,点击这些元素内部不会触发回调(如触发弹窗的按钮) */
180
+ ignore?: ClickOutsideTarget[];
181
+ /** 是否在捕获阶段监听,默认 true,可穿透子元素的 event.stopPropagation() */
182
+ capture?: boolean;
183
+ }
184
+
185
+ export declare type ClickOutsideTarget = MaybeRef<HTMLElement | null | undefined>;
186
+
178
187
  /** 函数式确认弹框,点击确定 resolve,点击取消 reject('cancel') */
179
188
  declare function confirm_2(source: ConfirmParam): Promise<void>;
180
189
  export { confirm_2 as confirm }
@@ -280,6 +289,8 @@ export declare interface DividerProps {
280
289
  length?: string;
281
290
  }
282
291
 
292
+ export declare const getDialogZIndex: () => number;
293
+
283
294
  export declare type IconButtonType = 'rectangle' | 'square' | 'circle' | 'professional';
284
295
 
285
296
  export declare const Input: DefineComponent<InputProps, {
@@ -342,6 +353,8 @@ export declare interface InputProps {
342
353
 
343
354
  export declare type LanguageKey = 'zh-CN' | 'zh-TW' | 'en-US';
344
355
 
356
+ declare type MaybeRef<T> = T | Ref<T>;
357
+
345
358
  /** 函数式轻提示,默认停留 1s,可通过对象配置时长;已有提示展示时忽略新调用 */
346
359
  export declare function Message(source: MessageParam): void;
347
360
 
@@ -546,6 +559,8 @@ export declare interface SelectScrollPayload {
546
559
 
547
560
  export declare const setCregisUILocale: (lang: LanguageKey) => void;
548
561
 
562
+ export declare const setDialogZIndex: (_zIndex: number) => void;
563
+
549
564
  declare type Size = 'large' | 'medium' | 'small' | 'extraSmall';
550
565
 
551
566
  declare type Size_2 = 'large' | 'medium' | 'small' | 'extraSmall';
@@ -707,4 +722,20 @@ export declare interface UploadProps {
707
722
  onChange?: (file: FormData) => void;
708
723
  }
709
724
 
725
+ /**
726
+ * 点击目标元素外部时触发回调的 Hook。
727
+ *
728
+ * - 使用 pointerdown + click 组合,精准区分「拖拽」与「点击外部」
729
+ * - capture 默认开启,不被子节点 stopPropagation 干扰
730
+ * - 支持单个或多个目标元素,支持 ignore 排除列表
731
+ *
732
+ * @example
733
+ * const panelRef = ref<HTMLElement>()
734
+ * useClickOutside(panelRef, () => closePanel())
735
+ *
736
+ * @example
737
+ * useClickOutside([panelRef, triggerRef], callback, { ignore: [buttonRef] })
738
+ */
739
+ export declare function useClickOutside(target: ClickOutsideTarget | ClickOutsideTarget[], callback: (event: PointerEvent) => void, options?: ClickOutsideOptions): void;
740
+
710
741
  export { }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cregis/ui",
3
3
  "private": false,
4
- "version": "1.0.9",
4
+ "version": "1.0.13",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"