fds-vue-core 4.4.3 → 4.4.4

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.
@@ -4583,6 +4583,7 @@ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
4583
4583
  });
4584
4584
  const MIN_WIDTH = 288;
4585
4585
  const MIN_HEIGHT = 200;
4586
+ const getStorageKey = (key) => `fds-modal-${key}`;
4586
4587
  function useModalDragResize(options) {
4587
4588
  const isDragging = vue.ref(false);
4588
4589
  const isResizing = vue.ref(false);
@@ -4595,6 +4596,36 @@ function useModalDragResize(options) {
4595
4596
  const resizeStart = vue.ref({ x: 0, y: 0, width: 0, height: 0, left: 0, top: 0 });
4596
4597
  const lastInteractionEnd = vue.ref(0);
4597
4598
  const isCustomPositioned = vue.computed(() => hasBeenDragged.value || hasBeenResized.value);
4599
+ const canPersist = () => (options.movable.value || options.resizable.value) && !!options.heading.value && typeof window !== "undefined";
4600
+ const save = () => {
4601
+ if (!canPersist()) return;
4602
+ const data = {};
4603
+ if (modalPosition.value) data.position = modalPosition.value;
4604
+ if (modalSize.value) data.size = modalSize.value;
4605
+ try {
4606
+ window.localStorage.setItem(getStorageKey(options.heading.value), JSON.stringify(data));
4607
+ } catch {
4608
+ }
4609
+ };
4610
+ const restore = () => {
4611
+ if (!canPersist()) return false;
4612
+ try {
4613
+ const raw = window.localStorage.getItem(getStorageKey(options.heading.value));
4614
+ if (!raw) return false;
4615
+ const data = JSON.parse(raw);
4616
+ if (data.position) {
4617
+ modalPosition.value = data.position;
4618
+ hasBeenDragged.value = true;
4619
+ }
4620
+ if (data.size) {
4621
+ modalSize.value = data.size;
4622
+ hasBeenResized.value = true;
4623
+ }
4624
+ return true;
4625
+ } catch {
4626
+ return false;
4627
+ }
4628
+ };
4598
4629
  const style = vue.computed(() => {
4599
4630
  if (!isCustomPositioned.value) return void 0;
4600
4631
  const s = {};
@@ -4650,6 +4681,7 @@ function useModalDragResize(options) {
4650
4681
  document.removeEventListener("selectstart", preventSelection);
4651
4682
  document.removeEventListener("mousemove", onDragMove);
4652
4683
  document.removeEventListener("mouseup", onDragEnd);
4684
+ save();
4653
4685
  };
4654
4686
  const onResizeStart = (e, direction) => {
4655
4687
  if (!options.resizable.value) return;
@@ -4703,6 +4735,7 @@ function useModalDragResize(options) {
4703
4735
  document.removeEventListener("selectstart", preventSelection);
4704
4736
  document.removeEventListener("mousemove", onResizeMove);
4705
4737
  document.removeEventListener("mouseup", onResizeEnd);
4738
+ save();
4706
4739
  };
4707
4740
  const reset = () => {
4708
4741
  hasBeenDragged.value = false;
@@ -4726,6 +4759,7 @@ function useModalDragResize(options) {
4726
4759
  onDragStart,
4727
4760
  onResizeStart,
4728
4761
  reset,
4762
+ restore,
4729
4763
  cleanup,
4730
4764
  shouldBlockBackdropClick
4731
4765
  };
@@ -4765,17 +4799,20 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
4765
4799
  onDragStart,
4766
4800
  onResizeStart,
4767
4801
  reset: resetDragResize,
4802
+ restore: restoreDragResize,
4768
4803
  cleanup: cleanupDragResize,
4769
4804
  shouldBlockBackdropClick
4770
4805
  } = useModalDragResize({
4771
4806
  movable: vue.computed(() => props.movable),
4772
4807
  resizable: vue.computed(() => props.resizable),
4773
- elementRef: modalInnerRef
4808
+ elementRef: modalInnerRef,
4809
+ heading: vue.computed(() => props.heading)
4774
4810
  });
4775
4811
  const modalOuterClasses = vue.computed(() => ["fixed top-0 left-0 w-full h-full overflow-auto z-100"]);
4776
4812
  const modalInnerClasses = vue.computed(() => {
4777
4813
  const base = [
4778
- "bg-white rounded-lg overflow-auto z-[99999] shadow-lg px-6 pt-6.5",
4814
+ "bg-white rounded-lg z-[99999] shadow-lg px-6 pt-6.5",
4815
+ props.resizable ? "overflow-hidden flex flex-col" : "overflow-auto",
4779
4816
  props.stickyFooter ? "pb-0" : "pb-8"
4780
4817
  ];
4781
4818
  if (isCustomPositioned.value) {
@@ -4888,6 +4925,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
4888
4925
  isOpen.value = newValue;
4889
4926
  if (newValue) {
4890
4927
  previouslyFocusedElement.value = document.activeElement;
4928
+ restoreDragResize();
4891
4929
  if (props.lockScroll) {
4892
4930
  setHtmlOverflow("hidden");
4893
4931
  }
@@ -4912,6 +4950,7 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
4912
4950
  document.addEventListener("keydown", handleKeyDown, true);
4913
4951
  if (props.open) {
4914
4952
  previouslyFocusedElement.value = document.activeElement;
4953
+ restoreDragResize();
4915
4954
  if (props.lockScroll) {
4916
4955
  setHtmlOverflow("hidden");
4917
4956
  }
@@ -4954,36 +4993,40 @@ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
4954
4993
  onMousedown: _cache[10] || (_cache[10] = //@ts-ignore
4955
4994
  (...args) => vue.unref(onDragStart) && vue.unref(onDragStart)(...args))
4956
4995
  }), [
4957
- vue.createElementVNode("div", _hoisted_1$d, [
4958
- vue.createElementVNode("h3", {
4959
- tabindex: "-1",
4960
- class: vue.normalizeClass(headerTitleClasses.value)
4961
- }, [
4962
- iconName.value ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
4996
+ vue.createElementVNode("div", {
4997
+ class: vue.normalizeClass(__props.resizable ? "overflow-auto flex-1 min-h-0" : "")
4998
+ }, [
4999
+ vue.createElementVNode("div", _hoisted_1$d, [
5000
+ vue.createElementVNode("h3", {
5001
+ tabindex: "-1",
5002
+ class: vue.normalizeClass(headerTitleClasses.value)
5003
+ }, [
5004
+ iconName.value ? (vue.openBlock(), vue.createBlock(_sfc_main$D, {
5005
+ key: 0,
5006
+ name: iconName.value,
5007
+ size: 24,
5008
+ class: vue.normalizeClass(iconClasses.value)
5009
+ }, null, 8, ["name", "class"])) : vue.createCommentVNode("", true),
5010
+ vue.createTextVNode(" " + vue.toDisplayString(__props.heading), 1)
5011
+ ], 2),
5012
+ !__props.strict ? (vue.openBlock(), vue.createBlock(_sfc_main$C, vue.mergeProps({
4963
5013
  key: 0,
4964
- name: iconName.value,
4965
- size: 24,
4966
- class: vue.normalizeClass(iconClasses.value)
4967
- }, null, 8, ["name", "class"])) : vue.createCommentVNode("", true),
4968
- vue.createTextVNode(" " + vue.toDisplayString(__props.heading), 1)
4969
- ], 2),
4970
- !__props.strict ? (vue.openBlock(), vue.createBlock(_sfc_main$C, vue.mergeProps({
5014
+ icon: "cross",
5015
+ size: 28,
5016
+ onClick: _cache[0] || (_cache[0] = ($event) => handleClose())
5017
+ }, { "aria-label": closeLabel.value }, { class: "ml-4" }), null, 16)) : vue.createCommentVNode("", true)
5018
+ ]),
5019
+ vue.createElementVNode("div", _hoisted_2$c, [
5020
+ vue.renderSlot(_ctx.$slots, "default")
5021
+ ]),
5022
+ vue.unref(hasFooterSlot) ? (vue.openBlock(), vue.createElementBlock("div", {
4971
5023
  key: 0,
4972
- icon: "cross",
4973
- size: 28,
4974
- onClick: _cache[0] || (_cache[0] = ($event) => handleClose())
4975
- }, { "aria-label": closeLabel.value }, { class: "ml-4" }), null, 16)) : vue.createCommentVNode("", true)
4976
- ]),
4977
- vue.createElementVNode("div", _hoisted_2$c, [
4978
- vue.renderSlot(_ctx.$slots, "default")
4979
- ]),
4980
- vue.unref(hasFooterSlot) ? (vue.openBlock(), vue.createElementBlock("div", {
4981
- key: 0,
4982
- class: vue.normalizeClass(footerClasses.value)
4983
- }, [
4984
- vue.renderSlot(_ctx.$slots, "modal-footer")
4985
- ], 2)) : vue.createCommentVNode("", true),
4986
- __props.resizable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
5024
+ class: vue.normalizeClass(footerClasses.value)
5025
+ }, [
5026
+ vue.renderSlot(_ctx.$slots, "modal-footer")
5027
+ ], 2)) : vue.createCommentVNode("", true)
5028
+ ], 2),
5029
+ __props.resizable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
4987
5030
  vue.createElementVNode("div", {
4988
5031
  class: "absolute top-0 left-3 right-3 h-1.5 cursor-n-resize z-100000",
4989
5032
  onMousedown: _cache[1] || (_cache[1] = ($event) => vue.unref(onResizeStart)($event, "n"))