knt-shared 1.4.7 → 1.4.8

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/index.esm.js CHANGED
@@ -6874,6 +6874,25 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6874
6874
  const getProps = computed(() => {
6875
6875
  return { ...props, ...unref(propsRef) };
6876
6876
  });
6877
+ const isValidClass = (value) => {
6878
+ if (value === void 0 || value === null) return false;
6879
+ return typeof value === "string" || Array.isArray(value);
6880
+ };
6881
+ const isValidStyle = (value) => {
6882
+ if (value === void 0 || value === null) return false;
6883
+ if (typeof value === "string") return true;
6884
+ if (Array.isArray(value)) return true;
6885
+ if (typeof value === "object" && !Array.isArray(value)) return true;
6886
+ return false;
6887
+ };
6888
+ const isValidButtonProps = (value) => {
6889
+ if (value === void 0 || value === null) return false;
6890
+ return typeof value === "object" && !Array.isArray(value);
6891
+ };
6892
+ const isValidPopupContainer = (value) => {
6893
+ if (value === void 0 || value === null) return false;
6894
+ return typeof value === "string" || value instanceof HTMLElement;
6895
+ };
6877
6896
  const getBindValue = computed(() => {
6878
6897
  const propsData = unref(getProps);
6879
6898
  return {
@@ -6888,8 +6907,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6888
6907
  okText: propsData.okText,
6889
6908
  cancelText: propsData.cancelText,
6890
6909
  okLoading: propsData.okLoading,
6891
- okButtonProps: propsData.okButtonProps,
6892
- cancelButtonProps: propsData.cancelButtonProps,
6910
+ // 按钮属性需要类型检查
6911
+ okButtonProps: isValidButtonProps(propsData.okButtonProps) ? propsData.okButtonProps : void 0,
6912
+ cancelButtonProps: isValidButtonProps(propsData.cancelButtonProps) ? propsData.cancelButtonProps : void 0,
6893
6913
  fullscreen: fullscreenRef.value || propsData.fullscreen,
6894
6914
  alignCenter: propsData.alignCenter || propsData.centered,
6895
6915
  unmountOnClose: propsData.unmountOnClose,
@@ -6897,10 +6917,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6897
6917
  simple: propsData.simple,
6898
6918
  hideTitle: propsData.hideTitle,
6899
6919
  renderToBody: propsData.renderToBody,
6900
- popupContainer: propsData.popupContainer,
6901
- maskStyle: propsData.maskStyle,
6920
+ // popupContainer 需要类型检查
6921
+ popupContainer: isValidPopupContainer(propsData.popupContainer) ? propsData.popupContainer : void 0,
6922
+ // 样式属性需要类型检查
6923
+ maskStyle: isValidStyle(propsData.maskStyle) ? propsData.maskStyle : void 0,
6902
6924
  modalStyle: getModalStyle.value,
6903
- modalClass: propsData.modalClass,
6925
+ modalClass: isValidClass(propsData.modalClass) ? propsData.modalClass : void 0,
6904
6926
  escToClose: propsData.escToClose,
6905
6927
  draggable: propsData.draggable,
6906
6928
  footer: propsData.footer === false ? false : void 0,
@@ -6909,8 +6931,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
6909
6931
  maskAnimationName: propsData.maskAnimationName,
6910
6932
  modalAnimationName: propsData.modalAnimationName,
6911
6933
  // v2.31.0+ 新增属性
6912
- bodyClass: propsData.bodyClass,
6913
- bodyStyle: propsData.bodyStyle
6934
+ bodyClass: isValidClass(propsData.bodyClass) ? propsData.bodyClass : void 0,
6935
+ bodyStyle: isValidStyle(propsData.bodyStyle) ? propsData.bodyStyle : void 0
6914
6936
  };
6915
6937
  });
6916
6938
  const getModalStyle = computed(() => {
@@ -7234,7 +7256,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
7234
7256
  };
7235
7257
  }
7236
7258
  });
7237
- const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-9c2dbbc8"]]);
7259
+ const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-ce432825"]]);
7238
7260
  function useModal(props) {
7239
7261
  const modalRef = ref(null);
7240
7262
  const loadedRef = ref(false);