@oeos-components/utils 0.0.23 → 0.0.24

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.
package/dist/base.cjs CHANGED
@@ -624,28 +624,24 @@ function debounce(func, delay = 500, immediate, resultCallback) {
624
624
  };
625
625
  return _debounce;
626
626
  }
627
- function confirm(message, options) {
627
+ function confirm(message, options = {}, appContext = null) {
628
628
  const resolvedMessage = typeof message === "function" ? message() : message;
629
- const elContext = elementPlus.ElMessageBox.install?.context || elementPlus.ElMessageBox._context || document.querySelector("#app")?._vue_app?._context;
630
629
  const mergeOptions = {
631
630
  title: "\u63D0\u793A",
632
631
  draggable: true,
633
632
  showCancelButton: false,
634
633
  confirmButtonText: "\u786E\u5B9A",
635
634
  dangerouslyUseHTMLString: true,
636
- // 允许 HTML
637
- appContext: elContext,
638
- // 强制注入 Element Plus 的上下文
639
635
  ...options
640
636
  };
641
- return elementPlus.ElMessageBox.confirm(resolvedMessage, mergeOptions);
637
+ return elementPlus.ElMessageBox.confirm(resolvedMessage, mergeOptions, appContext || elementPlus.ElMessageBox._context);
642
638
  }
643
639
  function getVariable(propertyName) {
644
640
  let res = getComputedStyle(document.documentElement).getPropertyValue(propertyName).trim();
645
641
  return res;
646
642
  }
647
643
  function test() {
648
- return "\u54C8\u54C8\u54C8" + /* @__PURE__ */ new Date();
644
+ return "\u54C8\u54C8\u54C81111" + /* @__PURE__ */ new Date();
649
645
  }
650
646
 
651
647
  exports.$toast = $toast;
package/dist/base.d.cts CHANGED
@@ -346,7 +346,7 @@ declare function debounce(func: Func, delay?: number, immediate?: boolean, resul
346
346
  })
347
347
  * 如果是多个dialog嵌套, 可以给上层的dom设置个id如highSettingsForm, 然后appendTo: '#highSettingsForm'
348
348
  */
349
- declare function confirm(message: any, options: any): Promise<element_plus.MessageBoxData>;
349
+ declare function confirm(message: any, options?: {}, appContext?: null): Promise<element_plus.MessageBoxData>;
350
350
  /** Function to get a CSS custom property value
351
351
  *
352
352
  * getVariable('--blue');
package/dist/base.d.mts CHANGED
@@ -346,7 +346,7 @@ declare function debounce(func: Func, delay?: number, immediate?: boolean, resul
346
346
  })
347
347
  * 如果是多个dialog嵌套, 可以给上层的dom设置个id如highSettingsForm, 然后appendTo: '#highSettingsForm'
348
348
  */
349
- declare function confirm(message: any, options: any): Promise<element_plus.MessageBoxData>;
349
+ declare function confirm(message: any, options?: {}, appContext?: null): Promise<element_plus.MessageBoxData>;
350
350
  /** Function to get a CSS custom property value
351
351
  *
352
352
  * getVariable('--blue');
package/dist/base.d.ts CHANGED
@@ -346,7 +346,7 @@ declare function debounce(func: Func, delay?: number, immediate?: boolean, resul
346
346
  })
347
347
  * 如果是多个dialog嵌套, 可以给上层的dom设置个id如highSettingsForm, 然后appendTo: '#highSettingsForm'
348
348
  */
349
- declare function confirm(message: any, options: any): Promise<element_plus.MessageBoxData>;
349
+ declare function confirm(message: any, options?: {}, appContext?: null): Promise<element_plus.MessageBoxData>;
350
350
  /** Function to get a CSS custom property value
351
351
  *
352
352
  * getVariable('--blue');
package/dist/base.mjs CHANGED
@@ -622,28 +622,24 @@ function debounce(func, delay = 500, immediate, resultCallback) {
622
622
  };
623
623
  return _debounce;
624
624
  }
625
- function confirm(message, options) {
625
+ function confirm(message, options = {}, appContext = null) {
626
626
  const resolvedMessage = typeof message === "function" ? message() : message;
627
- const elContext = ElMessageBox.install?.context || ElMessageBox._context || document.querySelector("#app")?._vue_app?._context;
628
627
  const mergeOptions = {
629
628
  title: "\u63D0\u793A",
630
629
  draggable: true,
631
630
  showCancelButton: false,
632
631
  confirmButtonText: "\u786E\u5B9A",
633
632
  dangerouslyUseHTMLString: true,
634
- // 允许 HTML
635
- appContext: elContext,
636
- // 强制注入 Element Plus 的上下文
637
633
  ...options
638
634
  };
639
- return ElMessageBox.confirm(resolvedMessage, mergeOptions);
635
+ return ElMessageBox.confirm(resolvedMessage, mergeOptions, appContext || ElMessageBox._context);
640
636
  }
641
637
  function getVariable(propertyName) {
642
638
  let res = getComputedStyle(document.documentElement).getPropertyValue(propertyName).trim();
643
639
  return res;
644
640
  }
645
641
  function test() {
646
- return "\u54C8\u54C8\u54C8" + /* @__PURE__ */ new Date();
642
+ return "\u54C8\u54C8\u54C81111" + /* @__PURE__ */ new Date();
647
643
  }
648
644
 
649
645
  export { $toast, asyncWrapper, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getVariable, isEmpty, log, merge, notEmpty, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oeos-components/utils",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "utils of oeos-components",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",