@moluoxixi/ajax-package 0.0.50 → 0.0.51

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.
Files changed (2) hide show
  1. package/es/index.mjs +36 -9
  2. package/package.json +1 -1
package/es/index.mjs CHANGED
@@ -2,9 +2,9 @@
2
2
  "use strict";
3
3
  try {
4
4
  if (typeof document !== "undefined") {
5
- if (!document.getElementById("21f1b1ee-40a7-42c8-b118-6f00dc3b69bd")) {
5
+ if (!document.getElementById("c3461b9e-b5cd-4c9d-80e0-89cc777f094e")) {
6
6
  var elementStyle = document.createElement("style");
7
- elementStyle.id = "21f1b1ee-40a7-42c8-b118-6f00dc3b69bd";
7
+ elementStyle.id = "c3461b9e-b5cd-4c9d-80e0-89cc777f094e";
8
8
  elementStyle.appendChild(document.createTextNode("._root_11p33_1 .el-dialog__header {\n padding: 0 12px 12px;\n}\n\n._root_11p33_1 .el-dialog__body {\n border-top: 1px solid #e5e7eb;\n border-bottom: 1px solid #e5e7eb;\n padding: 0 12px;\n}\n\n._root_11p33_1 .el-dialog__footer {\n padding: 0 12px;\n}"));
9
9
  document.head.appendChild(elementStyle);
10
10
  }
@@ -7499,7 +7499,32 @@ const _BaseHttpClient = class _BaseHttpClient {
7499
7499
  if (!this.hasDocument) {
7500
7500
  return document.body;
7501
7501
  }
7502
- return document.body;
7502
+ if (!this.appendTo) {
7503
+ return document.body;
7504
+ }
7505
+ if (this.appendTo instanceof HTMLElement) {
7506
+ return this.appendTo;
7507
+ }
7508
+ if (typeof this.appendTo === "string") {
7509
+ const element = document.querySelector(this.appendTo);
7510
+ if (element) {
7511
+ return element;
7512
+ }
7513
+ if (this.appendToFallback === null) {
7514
+ console.warn(`appendTo 选择器 "${this.appendTo}" 未找到元素,appendToFallback 为 null,返回 null`);
7515
+ return null;
7516
+ } else if (this.appendToFallback === "body") {
7517
+ return document.body;
7518
+ } else if (typeof this.appendToFallback === "string") {
7519
+ const fallbackElement = document.querySelector(this.appendToFallback);
7520
+ if (fallbackElement) {
7521
+ return fallbackElement;
7522
+ }
7523
+ console.warn(`appendTo 选择器 "${this.appendTo}" 和 appendToFallback 选择器 "${this.appendToFallback}" 都未找到元素,返回 null`);
7524
+ return null;
7525
+ }
7526
+ }
7527
+ return null;
7503
7528
  }
7504
7529
  getContainer() {
7505
7530
  if (!this.hasDocument) {
@@ -7510,12 +7535,18 @@ const _BaseHttpClient = class _BaseHttpClient {
7510
7535
  this.containerId = `ajaxPackage-container-${targetElementId}`;
7511
7536
  this.popoverContainerId = `ajaxPackage-popover-${targetElementId}`;
7512
7537
  this.messageContainerId = `ajaxPackage-message-${targetElementId}`;
7538
+ /* @__PURE__ */ console.log("333333333333333333333", this.messageContainerId);
7513
7539
  }
7514
7540
  let container = document.getElementById(this.containerId);
7515
7541
  if (!container) {
7516
7542
  container = document.createElement("div");
7517
7543
  container.id = this.containerId;
7518
- document.body.appendChild(container);
7544
+ const targetElement = this.resolveAppendToTarget();
7545
+ if (targetElement) {
7546
+ targetElement.appendChild(container);
7547
+ } else {
7548
+ return null;
7549
+ }
7519
7550
  const popoverContainer = document.createElement("div");
7520
7551
  popoverContainer.id = this.popoverContainerId;
7521
7552
  popoverContainer.style.position = "relative";
@@ -8027,10 +8058,7 @@ const _BaseApi = class _BaseApi extends BaseHttpClient {
8027
8058
  try {
8028
8059
  const { default: SystemErrorDialog2 } = await dynamicImports(Promise.resolve().then(() => SystemErrorDialog$1), ["default"]);
8029
8060
  const popoverContainer = this.getPopoverContainer();
8030
- /* @__PURE__ */ console.log("1111111111", popoverContainer);
8031
- /* @__PURE__ */ console.log("2222222222", SystemErrorDialog2);
8032
8061
  this.systemErrorDialogInstance = createApiDialog(SystemErrorDialog2, popoverContainer);
8033
- /* @__PURE__ */ console.log("3333333333", this.systemErrorDialogInstance);
8034
8062
  } catch (error) {
8035
8063
  console.warn("Failed to load SystemErrorDialog:", error);
8036
8064
  throw error;
@@ -8585,7 +8613,7 @@ const SystemErrorDialog = defineComponent({
8585
8613
  return typeof props.width === "number" ? `${props.width}px` : props.width;
8586
8614
  });
8587
8615
  return () => {
8588
- const popoverContainer = getAjaxPackagePopoverContainer();
8616
+ getAjaxPackagePopoverContainer();
8589
8617
  return h(
8590
8618
  ElDialog,
8591
8619
  {
@@ -8596,7 +8624,6 @@ const SystemErrorDialog = defineComponent({
8596
8624
  "closeOnClickModal": false,
8597
8625
  "closeOnPressEscape": false,
8598
8626
  "style": { padding: "16px 0" },
8599
- "appendTo": popoverContainer || void 0,
8600
8627
  "onUpdate:modelValue": handleModelValueChange
8601
8628
  },
8602
8629
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moluoxixi/ajax-package",
3
- "version": "0.0.50",
3
+ "version": "0.0.51",
4
4
  "description": "AjaxPackage 组件",
5
5
  "sideEffects": [
6
6
  "*.css",