@daracl/form 0.0.2 → 0.0.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.
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <head>
5
5
  <meta charset="utf-8" />
6
6
  <title>Dara Form</title>
7
- <script defer src="daracl.form.js"></script></head>
7
+ </head>
8
8
 
9
9
  <body>
10
10
  <div class="header">
@@ -30,7 +30,7 @@
30
30
  <form id="formArea" class="test-form aaa-test"></form>
31
31
 
32
32
  </div>
33
- </body>
33
+ <script src="daracl.form.js"></script></body>
34
34
 
35
35
  </html>
36
36
  <style>
@@ -58,7 +58,7 @@
58
58
  color: var(--bg-color);
59
59
  }
60
60
  </style>
61
- <script type="module">
61
+ <script>
62
62
 
63
63
  const THEME_KEY = "form-theme";
64
64
  const theme = localStorage.getItem(THEME_KEY);
@@ -404,7 +404,7 @@
404
404
  var formObj = {
405
405
  load: () => {
406
406
  // formBuilder = loginForm;
407
- formBuilder = new DaraForm(document.getElementById("formArea"), formInfo);
407
+ formBuilder = Daracl.form.create(document.getElementById("formArea"), formInfo);
408
408
  },
409
409
  addItem: () => {
410
410
  rowIdx += 1;
package/dist/index.js CHANGED
@@ -2505,6 +2505,7 @@ var init_dist = __esm({
2505
2505
  mode: "date",
2506
2506
  enableTodayBtn: true,
2507
2507
  showMonthAfterYear: false,
2508
+ isPositionFixed: false,
2508
2509
  format: "",
2509
2510
  zIndex: 1e3,
2510
2511
  minDate: "",
@@ -2853,14 +2854,21 @@ var init_dist = __esm({
2853
2854
  const rect = this.targetElement.getBoundingClientRect();
2854
2855
  const scrollTop = window.scrollY || document.documentElement.scrollTop;
2855
2856
  const scrollLeft = window.scrollX || document.documentElement.scrollLeft;
2856
- const offsetTop = rect.top + scrollTop;
2857
- let top = offsetTop + this.targetElement.offsetHeight + 2;
2858
- const left = rect.left + scrollLeft;
2859
- if (top + this.datetimeElement.offsetHeight > docSize.clientHeight) {
2860
- const newTop = offsetTop - (this.datetimeElement.offsetHeight + 2);
2861
- top = newTop > 0 ? newTop : top;
2857
+ const elementHeight = this.datetimeElement.offsetHeight;
2858
+ const targetElementHeight = this.targetElement.offsetHeight + 2;
2859
+ let left = rect.left + scrollLeft;
2860
+ let top = 0;
2861
+ if (this.options.isPositionFixed) {
2862
+ top = rect.top + targetElementHeight;
2863
+ left = rect.left;
2864
+ } else {
2865
+ if (rect.top + targetElementHeight + elementHeight > docSize.clientHeight && rect.top >= elementHeight) {
2866
+ top = scrollTop + rect.top - elementHeight - 2;
2867
+ } else {
2868
+ top = scrollTop + rect.top + targetElementHeight;
2869
+ }
2862
2870
  }
2863
- this.datetimeElement.setAttribute("style", `top:${top}px;left:${left}px;z-index:${this.options.zIndex}`);
2871
+ this.datetimeElement.setAttribute("style", `${this.options.isPositionFixed ? "position:fixed;" : ""}top:${top}px;left:${left}px;z-index:${this.options.zIndex}`);
2864
2872
  document.addEventListener("click", this._documentClickEvent);
2865
2873
  }
2866
2874
  /**