builder-settings-types 0.0.115 → 0.0.117
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.
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
}
|
|
95
95
|
`,document.head.appendChild(l)}return i.appendChild(s),i.appendChild(n),t.appendChild(i),t}setDetectChange(t){this.detectChangeCallback=t}}const tt=`<svg width="16" height="15" viewBox="0 0 16 15" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
96
96
|
<path d="M1.25 7.5H1.2575M4.625 7.5H4.6325M11.375 7.5H11.3825M8 7.5H8.0075M14.75 7.5H14.7575M14.75 14.25V13.65C14.75 12.8099 14.75 12.3899 14.5865 12.069C14.4427 11.7868 14.2132 11.5573 13.931 11.4135C13.6101 11.25 13.1901 11.25 12.35 11.25H3.65C2.80992 11.25 2.38988 11.25 2.06901 11.4135C1.78677 11.5573 1.5573 11.7868 1.41349 12.069C1.25 12.3899 1.25 12.8099 1.25 13.65V14.25M14.75 0.75V1.35C14.75 2.19008 14.75 2.61012 14.5865 2.93099C14.4427 3.21323 14.2132 3.4427 13.931 3.58651C13.6101 3.75 13.1901 3.75 12.35 3.75H3.65C2.80992 3.75 2.38988 3.75 2.06901 3.58651C1.78677 3.4427 1.5573 3.21323 1.41349 2.93099C1.25 2.61012 1.25 2.19008 1.25 1.35V0.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
97
|
-
</svg>`;class et extends m{constructor(t={}){super(t),this.inputType="number",this.inputValues={}}draw(){const t=document.createElement("div");if(t.classList.add("gap-settings-container"),this.props.title||this.props.title===void 0){const e=document.createElement("div");e.classList.add("gap-settings-title"),e.textContent=this.props.title||"Spacing",t.appendChild(e)}if(this.props.rowGap!==!1){const e=this.createGapInput("Row Gap",this.value??0);t.appendChild(e),this.inputValues["Row Gap"]=this.value??0}if(this.props.columnGap!==!1){const e=this.createGapInput("Column Gap",this.value??0);t.appendChild(e),this.inputValues["Column Gap"]=this.value??0}if(this.props.rowGap===void 0&&this.props.columnGap===void 0){const e=this.createGapInput("Gap",this.value??0);t.appendChild(e),this.inputValues.Gap=this.value??0}return t}createGapInput(t,e){const i=document.createElement("div");i.classList.add("gap-input-wrapper");const s=document.createElement("div");s.classList.add("gap-label-container");const n=document.createElement("div");n.classList.add("gap-setting-icon"),n.innerHTML=this.props.icon||tt,s.appendChild(n);const a=document.createElement("label");a.classList.add("gap-input-label"),a.textContent=t,s.appendChild(a),i.appendChild(s);const o=u=>{this.props.minValue!==void 0&&(u.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(u.max=String(this.props.maxValue)),this.props.className&&u.classList.add(this.props.className),u.addEventListener("input",()=>{var f;const p=this.props.minValue??0,g=this.props.maxValue??100;let d=Number(u.value);d<p&&(d=p),d>g&&(d=g),u.value=String(d),this.value=d,this.inputValues[t]=d,console.log(`Gap Setting (${t}): ${d}${this.props.suffix||""}`),(f=this.onChange)==null||f.call(this,d)})},l=this.createInput({value:e,inputType:this.inputType,inputClassName:"gap-setting-input "+(this.props.inputClassName||""),wrapperClassName:"gap-setting-inner-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:o});if(!this.props.suffix||this.props.suffix==="none")return i.appendChild(l),i;l.classList.add("suffix-wrapper");const c=l.querySelector("input.gap-setting-input");c&&(c.style.paddingRight="35px");const r=document.createElement("span");return r.className="suffix-label",r.textContent=this.props.suffix,l.appendChild(r),i.appendChild(l),i}}class it extends m{constructor(t){var e;if(!t.tabs)throw new Error("Tabs array is required for TabsSettings");super(t),this.inputType="tabs",this.tabs=[],this.activeTabId="",this.tabsContainer=null,this.contentContainer=null,this.previousTabId="",this.tabValues=new Map,this.settingGroups=new Map,this.tabs=t.tabs,this.activeTabId=t.activeTabId||((e=this.tabs[0])==null?void 0:e.id)||"",this.previousTabId=this.activeTabId,this.onStateChangeCallback=t.onStateChange,this.value={},this.tabs.forEach(i=>{if(i.custom){const s={};Object.entries(i.settings).forEach(([n,a])=>{a instanceof m?s[n]=a.value:a instanceof C&&(s[n]=a.getValues())}),this.tabValues.set(i.id,s),this.value[i.id]=s}else{const s=new C({title:i.title||i.label,collapsed:i.collapsed,settings:i.settings,description:i.description,icon:i.icon,main:i.main,custom:i.custom,hideCondition:i.hideCondition,onBlur:i.onBlur});this.settingGroups.set(i.id,s);const n=s.getValues();this.tabValues.set(i.id,n),this.value[i.id]=n}}),t.onChange&&this.setOnChange(t.onChange),t.detectChange&&(this.detectChangeCallback=t.detectChange)}draw(){const t=document.createElement("div");t.classList.add("tabs-settings-container"),this.props.className&&t.classList.add(this.props.className);const e=document.createElement("div");e.classList.add("tabs-header"),this.tabsContainer=e,this.tabs.forEach(s=>{const n=document.createElement("button");n.classList.add("tab-button"),s.id===this.activeTabId&&n.classList.add("active"),n.textContent=s.label,n.onclick=()=>this.handleTabClick(s.id),e.appendChild(n)}),t.appendChild(e);const i=document.createElement("div");return i.classList.add("tab-content"),this.contentContainer=i,this.tabs.forEach(s=>{const n=document.createElement("div");if(n.classList.add("tab-panel"),s.id===this.activeTabId&&n.classList.add("active"),s.custom)Object.entries(s.settings).forEach(([a,o])=>{if(o instanceof m)n.appendChild(o.draw()),o.setOnChange(()=>{this.updateTabValues(s.id),this.handleTabChange(s.id)});else if(o instanceof C){const l=o.draw();n.appendChild(l),this.addChangeListeners(o,s.id)}});else{const a=this.settingGroups.get(s.id);if(a){const o=a.draw();n.appendChild(o),this.addChangeListeners(a,s.id)}}i.appendChild(n)}),t.appendChild(i),t}addChangeListeners(t,e){const i=t.settings;Object.values(i).forEach(s=>{s instanceof C?this.addChangeListeners(s,e):s.setOnChange(()=>{this.updateTabValues(e),this.handleTabChange(e)})})}updateTabValues(t){const e=this.tabs.find(i=>i.id===t);if(e)if(e.custom){const i={};Object.entries(e.settings).forEach(([s,n])=>{n instanceof m?i[s]=n.value:n instanceof C&&(i[s]=n.getValues())}),this.tabValues.set(t,i),this.value={...this.value,[t]:i}}else{const i=this.settingGroups.get(t);if(i){const s=i.getValues();this.tabValues.set(t,s),this.value={...this.value,[t]:s}}}}handleTabChange(t){var s,n;const e=this.tabValues.get(t)||{};(s=this.onStateChangeCallback)==null||s.call(this,t,e);const i={tabId:t,contentValues:e,previousTabId:this.previousTabId};(n=this.onChangeCallback)==null||n.call(this,i)
|
|
97
|
+
</svg>`;class et extends m{constructor(t={}){super(t),this.inputType="number",this.inputValues={}}draw(){const t=document.createElement("div");if(t.classList.add("gap-settings-container"),this.props.title||this.props.title===void 0){const e=document.createElement("div");e.classList.add("gap-settings-title"),e.textContent=this.props.title||"Spacing",t.appendChild(e)}if(this.props.rowGap!==!1){const e=this.createGapInput("Row Gap",this.value??0);t.appendChild(e),this.inputValues["Row Gap"]=this.value??0}if(this.props.columnGap!==!1){const e=this.createGapInput("Column Gap",this.value??0);t.appendChild(e),this.inputValues["Column Gap"]=this.value??0}if(this.props.rowGap===void 0&&this.props.columnGap===void 0){const e=this.createGapInput("Gap",this.value??0);t.appendChild(e),this.inputValues.Gap=this.value??0}return t}createGapInput(t,e){const i=document.createElement("div");i.classList.add("gap-input-wrapper");const s=document.createElement("div");s.classList.add("gap-label-container");const n=document.createElement("div");n.classList.add("gap-setting-icon"),n.innerHTML=this.props.icon||tt,s.appendChild(n);const a=document.createElement("label");a.classList.add("gap-input-label"),a.textContent=t,s.appendChild(a),i.appendChild(s);const o=u=>{this.props.minValue!==void 0&&(u.min=String(this.props.minValue)),this.props.maxValue!==void 0&&(u.max=String(this.props.maxValue)),this.props.className&&u.classList.add(this.props.className),u.addEventListener("input",()=>{var f;const p=this.props.minValue??0,g=this.props.maxValue??100;let d=Number(u.value);d<p&&(d=p),d>g&&(d=g),u.value=String(d),this.value=d,this.inputValues[t]=d,console.log(`Gap Setting (${t}): ${d}${this.props.suffix||""}`),(f=this.onChange)==null||f.call(this,d)})},l=this.createInput({value:e,inputType:this.inputType,inputClassName:"gap-setting-input "+(this.props.inputClassName||""),wrapperClassName:"gap-setting-inner-wrapper "+(this.props.wrapperClassName||""),inputCustomizer:o});if(!this.props.suffix||this.props.suffix==="none")return i.appendChild(l),i;l.classList.add("suffix-wrapper");const c=l.querySelector("input.gap-setting-input");c&&(c.style.paddingRight="35px");const r=document.createElement("span");return r.className="suffix-label",r.textContent=this.props.suffix,l.appendChild(r),i.appendChild(l),i}}class it extends m{constructor(t){var e;if(!t.tabs)throw new Error("Tabs array is required for TabsSettings");super(t),this.inputType="tabs",this.tabs=[],this.activeTabId="",this.tabsContainer=null,this.contentContainer=null,this.previousTabId="",this.tabValues=new Map,this.settingGroups=new Map,this.tabs=t.tabs,this.activeTabId=t.activeTabId||((e=this.tabs[0])==null?void 0:e.id)||"",this.previousTabId=this.activeTabId,this.onStateChangeCallback=t.onStateChange,this.value={},this.tabs.forEach(i=>{if(i.custom){const s={};Object.entries(i.settings).forEach(([n,a])=>{a instanceof m?s[n]=a.value:a instanceof C&&(s[n]=a.getValues())}),this.tabValues.set(i.id,s),this.value[i.id]=s}else{const s=new C({title:i.title||i.label,collapsed:i.collapsed,settings:i.settings,description:i.description,icon:i.icon,main:i.main,custom:i.custom,hideCondition:i.hideCondition,onBlur:i.onBlur});this.settingGroups.set(i.id,s);const n=s.getValues();this.tabValues.set(i.id,n),this.value[i.id]=n}}),t.onChange&&this.setOnChange(t.onChange),t.detectChange&&(this.detectChangeCallback=t.detectChange)}draw(){const t=document.createElement("div");t.classList.add("tabs-settings-container"),this.props.className&&t.classList.add(this.props.className);const e=document.createElement("div");e.classList.add("tabs-header"),this.tabsContainer=e,this.tabs.forEach(s=>{const n=document.createElement("button");n.classList.add("tab-button"),s.id===this.activeTabId&&n.classList.add("active"),n.textContent=s.label,n.onclick=()=>this.handleTabClick(s.id),e.appendChild(n)}),t.appendChild(e);const i=document.createElement("div");return i.classList.add("tab-content"),this.contentContainer=i,this.tabs.forEach(s=>{const n=document.createElement("div");if(n.classList.add("tab-panel"),s.id===this.activeTabId&&n.classList.add("active"),s.custom)Object.entries(s.settings).forEach(([a,o])=>{if(o instanceof m)n.appendChild(o.draw()),o.setOnChange(()=>{this.updateTabValues(s.id),this.handleTabChange(s.id)});else if(o instanceof C){const l=o.draw();n.appendChild(l),this.addChangeListeners(o,s.id)}});else{const a=this.settingGroups.get(s.id);if(a){const o=a.draw();n.appendChild(o),this.addChangeListeners(a,s.id)}}i.appendChild(n)}),t.appendChild(i),t}addChangeListeners(t,e){const i=t.settings;Object.values(i).forEach(s=>{s instanceof C?this.addChangeListeners(s,e):s.setOnChange(()=>{this.updateTabValues(e),this.handleTabChange(e)})})}updateTabValues(t){const e=this.tabs.find(i=>i.id===t);if(e){if(e.custom){const i={};Object.entries(e.settings).forEach(([s,n])=>{n instanceof m?i[s]=n.value:n instanceof C&&(i[s]=n.getValues())}),this.tabValues.set(t,i),this.value={...this.value,[t]:i}}else{const i=this.settingGroups.get(t);if(i){const s=i.getValues();this.tabValues.set(t,s),this.value={...this.value,[t]:s}}}this.detectChangeCallback&&this.detectChangeCallback(t)}}handleTabChange(t){var s,n;const e=this.tabValues.get(t)||{};(s=this.onStateChangeCallback)==null||s.call(this,t,e);const i={tabId:t,contentValues:e,previousTabId:this.previousTabId};(n=this.onChangeCallback)==null||n.call(this,i)}redrawContent(t){if(!this.contentContainer)return;this.contentContainer.innerHTML="";const e=this.tabs.find(s=>s.id===t);if(!e)return;const i=document.createElement("div");if(i.classList.add("tab-panel","active"),e.custom)Object.entries(e.settings).forEach(([s,n])=>{if(n instanceof m)i.appendChild(n.draw()),n.setOnChange(()=>{this.updateTabValues(e.id),this.handleTabChange(e.id)});else if(n instanceof C){const a=n.draw();i.appendChild(a),this.addChangeListeners(n,e.id)}});else{const s=this.settingGroups.get(e.id);if(s){const n=s.draw();i.appendChild(n),this.addChangeListeners(s,e.id)}}this.contentContainer.appendChild(i)}handleTabClick(t){var i;if(t===this.activeTabId)return;this.previousTabId=this.activeTabId,this.activeTabId=t;const e=(i=this.tabsContainer)==null?void 0:i.querySelectorAll(".tab-button");e==null||e.forEach(s=>{if(s instanceof HTMLElement){const n=this.tabs.find(a=>a.label===s.textContent);s.classList.toggle("active",(n==null?void 0:n.id)===t)}}),this.redrawContent(t),this.handleTabChange(t)}setOnChange(t){return this.onChangeCallback=t,this}setDetectChange(t){return this.detectChangeCallback=t,this}setOnStateChange(t){return this.onStateChangeCallback=t,this}getActiveTabValue(){return this.tabValues.get(this.activeTabId)}}const st=`
|
|
98
98
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
99
99
|
<path d="M5.625 9.5H5.6325M12.375 9.5H12.3825M9 9.5H9.0075M9 12.875H9.0075M9 6.125H9.0075M2.25 6.35L2.25 12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75L5.85 2.75C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
100
100
|
</svg>
|
|
@@ -233,7 +233,7 @@ const w = class w {
|
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
235
|
w.hiddenElements = /* @__PURE__ */ new Set();
|
|
236
|
-
let
|
|
236
|
+
let C = w;
|
|
237
237
|
function y(h) {
|
|
238
238
|
if (h === null || typeof h != "object")
|
|
239
239
|
return h;
|
|
@@ -400,7 +400,7 @@ class N extends O {
|
|
|
400
400
|
const g = p.value.split(",").map((H) => parseInt(H.trim()));
|
|
401
401
|
if (g.length !== 3 || g.some(isNaN))
|
|
402
402
|
return p.style.border = "1px solid red", !1;
|
|
403
|
-
const [d,
|
|
403
|
+
const [d, f, v] = g, L = d >= 0 && d <= 255 && f >= 0 && f <= 255 && v >= 0 && v <= 255;
|
|
404
404
|
return p.style.border = L ? "" : "1px solid red", L;
|
|
405
405
|
}, o = document.createElement("div");
|
|
406
406
|
o.className = "color-preview", o.style.backgroundColor = this.value ? `rgb(${this.value})` : "";
|
|
@@ -418,13 +418,13 @@ class N extends O {
|
|
|
418
418
|
let g = p.target.value.trim();
|
|
419
419
|
a(c) && (this.value = g, (d = this.onChange) == null || d.call(this, g), u.value = this.rgbToHex(g), o.style.backgroundColor = `rgb(${g})`);
|
|
420
420
|
}, u.oninput = (p) => {
|
|
421
|
-
var
|
|
421
|
+
var f, v;
|
|
422
422
|
const g = p.target.value, d = this.hexToRgb(g);
|
|
423
|
-
this.value = d, (
|
|
423
|
+
this.value = d, (f = this.onChange) == null || f.call(this, d), (v = this.detectChange) == null || v.call(this, d), c.value = d, o.style.backgroundColor = `rgb(${d})`;
|
|
424
424
|
}, u.onchange = (p) => {
|
|
425
|
-
var
|
|
425
|
+
var f, v;
|
|
426
426
|
const g = p.target.value, d = this.hexToRgb(g);
|
|
427
|
-
this.value = d, (
|
|
427
|
+
this.value = d, (f = this.onChange) == null || f.call(this, d), (v = this.detectChange) == null || v.call(this, d), c.value = d, o.style.backgroundColor = `rgb(${d})`;
|
|
428
428
|
}, n.appendChild(o), n.appendChild(r), n.appendChild(l), t.appendChild(e), t.appendChild(n), this.value && (c.value = this.value, u.value = this.rgbToHex(this.value), o.style.backgroundColor = `rgb(${this.value})`), t;
|
|
429
429
|
}
|
|
430
430
|
}
|
|
@@ -474,12 +474,12 @@ class M extends b {
|
|
|
474
474
|
...t,
|
|
475
475
|
minValue: 0,
|
|
476
476
|
maxValue: 100,
|
|
477
|
-
icon: t.icon ||
|
|
477
|
+
icon: t.icon || G,
|
|
478
478
|
title: t.title || "Opacity"
|
|
479
479
|
}), this.inputType = "number";
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
const
|
|
482
|
+
const G = `
|
|
483
483
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
484
484
|
<path d="M3.69749 15.365C3.54749 15.365 3.40502 15.305 3.30002 15.2C1.77752 13.6775 0.9375 11.6525 0.9375 9.5C0.9375 5.0525 4.5525 1.4375 9 1.4375C11.1525 1.4375 13.1775 2.2775 14.7 3.8C14.805 3.905 14.865 4.0475 14.865 4.1975C14.865 4.3475 14.805 4.49 14.7 4.595L4.09502 15.2C3.99002 15.305 3.84749 15.365 3.69749 15.365ZM9 2.5625C5.175 2.5625 2.0625 5.675 2.0625 9.5C2.0625 11.165 2.64751 12.74 3.71251 13.9925L13.4925 4.2125C12.24 3.1475 10.665 2.5625 9 2.5625Z" fill="#667085"/>
|
|
485
485
|
<path d="M9.00014 17.5623C6.84764 17.5623 4.82266 16.7223 3.30016 15.1998C3.19516 15.0948 3.13513 14.9523 3.13513 14.8023C3.13513 14.6523 3.19516 14.5098 3.30016 14.4048L13.9051 3.79984C14.1226 3.58234 14.4826 3.58234 14.7001 3.79984C16.2226 5.32234 17.0626 7.34734 17.0626 9.49984C17.0626 13.9473 13.4476 17.5623 9.00014 17.5623ZM4.50764 14.7873C5.76014 15.8523 7.33514 16.4373 9.00014 16.4373C12.8251 16.4373 15.9376 13.3248 15.9376 9.49984C15.9376 7.83484 15.3526 6.25984 14.2876 5.00734L4.50764 14.7873Z" fill="#667085"/>
|
|
@@ -487,7 +487,7 @@ const W = `
|
|
|
487
487
|
<path d="M13.4025 15.5225C13.26 15.5225 13.1175 15.47 13.005 15.3575L8.06999 10.4225C7.85249 10.205 7.85249 9.84498 8.06999 9.62748C8.28749 9.40998 8.64748 9.40998 8.86498 9.62748L13.8 14.5625C14.0175 14.78 14.0175 15.14 13.8 15.3575C13.6875 15.47 13.545 15.5225 13.4025 15.5225Z" fill="#667085"/>
|
|
488
488
|
<path d="M15.84 12.6648C15.6975 12.6648 15.555 12.6123 15.4425 12.4998L10.725 7.78234C10.5075 7.56484 10.5075 7.20484 10.725 6.98734C10.9425 6.76984 11.3025 6.76984 11.52 6.98734L16.2375 11.7048C16.455 11.9223 16.455 12.2823 16.2375 12.4998C16.1325 12.6048 15.99 12.6648 15.84 12.6648Z" fill="#667085"/>
|
|
489
489
|
</svg>
|
|
490
|
-
`,
|
|
490
|
+
`, W = `
|
|
491
491
|
<svg xmlns="http://www.w3.org/2000/svg" class="svg-select" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down">
|
|
492
492
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
493
493
|
</svg>
|
|
@@ -531,7 +531,7 @@ class I extends m {
|
|
|
531
531
|
o.onclick = (l) => this.selectOption(l, a, e), i.appendChild(o);
|
|
532
532
|
}), t.appendChild(i);
|
|
533
533
|
const s = document.createElement("div");
|
|
534
|
-
return s.classList.add("svg-container"), s.innerHTML =
|
|
534
|
+
return s.classList.add("svg-container"), s.innerHTML = W, t.appendChild(s), this.optionsListEl = i, this.svgContainer = s, this.props.getOptionsAsync && (this.isLoading = !0, this.updateButtonText(), this.props.getOptionsAsync().then((n) => {
|
|
535
535
|
this._options.push(...n), this.isLoading = !1, this.updateOptionsList(), this.updateButtonText();
|
|
536
536
|
}).catch((n) => {
|
|
537
537
|
console.error("Failed to fetch async options:", n), this.isLoading = !1, this.updateButtonText("Failed to load options");
|
|
@@ -576,7 +576,7 @@ class I extends m {
|
|
|
576
576
|
this.clickOutsideListener && (document.removeEventListener("click", this.clickOutsideListener), this.clickOutsideListener = null), super.destroy();
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
class
|
|
579
|
+
class $ extends m {
|
|
580
580
|
constructor(t = {}) {
|
|
581
581
|
super(t), this.inputType = "button", this.value || (this.value = "center");
|
|
582
582
|
}
|
|
@@ -831,8 +831,8 @@ class U extends m {
|
|
|
831
831
|
if (c)
|
|
832
832
|
try {
|
|
833
833
|
o.classList.add("loading"), o.disabled = !0;
|
|
834
|
-
const d = new FormData(),
|
|
835
|
-
d.append(
|
|
834
|
+
const d = new FormData(), f = this.props.formFieldName || "file";
|
|
835
|
+
d.append(f, c, c.name);
|
|
836
836
|
const v = this.props.uploadUrl;
|
|
837
837
|
if (!v)
|
|
838
838
|
throw new Error("No uploadUrl provided to UploadSetting.");
|
|
@@ -1105,10 +1105,10 @@ class pt extends m {
|
|
|
1105
1105
|
a.classList.add("gap-input-label"), a.textContent = t, s.appendChild(a), i.appendChild(s);
|
|
1106
1106
|
const o = (u) => {
|
|
1107
1107
|
this.props.minValue !== void 0 && (u.min = String(this.props.minValue)), this.props.maxValue !== void 0 && (u.max = String(this.props.maxValue)), this.props.className && u.classList.add(this.props.className), u.addEventListener("input", () => {
|
|
1108
|
-
var
|
|
1108
|
+
var f;
|
|
1109
1109
|
const p = this.props.minValue ?? 0, g = this.props.maxValue ?? 100;
|
|
1110
1110
|
let d = Number(u.value);
|
|
1111
|
-
d < p && (d = p), d > g && (d = g), u.value = String(d), this.value = d, this.inputValues[t] = d, console.log(`Gap Setting (${t}): ${d}${this.props.suffix || ""}`), (
|
|
1111
|
+
d < p && (d = p), d > g && (d = g), u.value = String(d), this.value = d, this.inputValues[t] = d, console.log(`Gap Setting (${t}): ${d}${this.props.suffix || ""}`), (f = this.onChange) == null || f.call(this, d);
|
|
1112
1112
|
});
|
|
1113
1113
|
}, l = this.createInput({
|
|
1114
1114
|
value: e,
|
|
@@ -1135,10 +1135,10 @@ class ut extends m {
|
|
|
1135
1135
|
if (i.custom) {
|
|
1136
1136
|
const s = {};
|
|
1137
1137
|
Object.entries(i.settings).forEach(([n, a]) => {
|
|
1138
|
-
a instanceof m ? s[n] = a.value : a instanceof
|
|
1138
|
+
a instanceof m ? s[n] = a.value : a instanceof C && (s[n] = a.getValues());
|
|
1139
1139
|
}), this.tabValues.set(i.id, s), this.value[i.id] = s;
|
|
1140
1140
|
} else {
|
|
1141
|
-
const s = new
|
|
1141
|
+
const s = new C({
|
|
1142
1142
|
title: i.title || i.label,
|
|
1143
1143
|
collapsed: i.collapsed,
|
|
1144
1144
|
settings: i.settings,
|
|
@@ -1172,7 +1172,7 @@ class ut extends m {
|
|
|
1172
1172
|
n.appendChild(o.draw()), o.setOnChange(() => {
|
|
1173
1173
|
this.updateTabValues(s.id), this.handleTabChange(s.id);
|
|
1174
1174
|
});
|
|
1175
|
-
else if (o instanceof
|
|
1175
|
+
else if (o instanceof C) {
|
|
1176
1176
|
const l = o.draw();
|
|
1177
1177
|
n.appendChild(l), this.addChangeListeners(o, s.id);
|
|
1178
1178
|
}
|
|
@@ -1190,18 +1190,18 @@ class ut extends m {
|
|
|
1190
1190
|
addChangeListeners(t, e) {
|
|
1191
1191
|
const i = t.settings;
|
|
1192
1192
|
Object.values(i).forEach((s) => {
|
|
1193
|
-
s instanceof
|
|
1193
|
+
s instanceof C ? this.addChangeListeners(s, e) : s.setOnChange(() => {
|
|
1194
1194
|
this.updateTabValues(e), this.handleTabChange(e);
|
|
1195
1195
|
});
|
|
1196
1196
|
});
|
|
1197
1197
|
}
|
|
1198
1198
|
updateTabValues(t) {
|
|
1199
1199
|
const e = this.tabs.find((i) => i.id === t);
|
|
1200
|
-
if (e)
|
|
1200
|
+
if (e) {
|
|
1201
1201
|
if (e.custom) {
|
|
1202
1202
|
const i = {};
|
|
1203
1203
|
Object.entries(e.settings).forEach(([s, n]) => {
|
|
1204
|
-
n instanceof m ? i[s] = n.value : n instanceof
|
|
1204
|
+
n instanceof m ? i[s] = n.value : n instanceof C && (i[s] = n.getValues());
|
|
1205
1205
|
}), this.tabValues.set(t, i), this.value = {
|
|
1206
1206
|
...this.value,
|
|
1207
1207
|
[t]: i
|
|
@@ -1216,6 +1216,8 @@ class ut extends m {
|
|
|
1216
1216
|
};
|
|
1217
1217
|
}
|
|
1218
1218
|
}
|
|
1219
|
+
this.detectChangeCallback && this.detectChangeCallback(t);
|
|
1220
|
+
}
|
|
1219
1221
|
}
|
|
1220
1222
|
handleTabChange(t) {
|
|
1221
1223
|
var s, n;
|
|
@@ -1226,30 +1228,45 @@ class ut extends m {
|
|
|
1226
1228
|
contentValues: e,
|
|
1227
1229
|
previousTabId: this.previousTabId
|
|
1228
1230
|
};
|
|
1229
|
-
(n = this.onChangeCallback) == null || n.call(this, i)
|
|
1231
|
+
(n = this.onChangeCallback) == null || n.call(this, i);
|
|
1232
|
+
}
|
|
1233
|
+
redrawContent(t) {
|
|
1234
|
+
if (!this.contentContainer) return;
|
|
1235
|
+
this.contentContainer.innerHTML = "";
|
|
1236
|
+
const e = this.tabs.find((s) => s.id === t);
|
|
1237
|
+
if (!e) return;
|
|
1238
|
+
const i = document.createElement("div");
|
|
1239
|
+
if (i.classList.add("tab-panel", "active"), e.custom)
|
|
1240
|
+
Object.entries(e.settings).forEach(([s, n]) => {
|
|
1241
|
+
if (n instanceof m)
|
|
1242
|
+
i.appendChild(n.draw()), n.setOnChange(() => {
|
|
1243
|
+
this.updateTabValues(e.id), this.handleTabChange(e.id);
|
|
1244
|
+
});
|
|
1245
|
+
else if (n instanceof C) {
|
|
1246
|
+
const a = n.draw();
|
|
1247
|
+
i.appendChild(a), this.addChangeListeners(n, e.id);
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
else {
|
|
1251
|
+
const s = this.settingGroups.get(e.id);
|
|
1252
|
+
if (s) {
|
|
1253
|
+
const n = s.draw();
|
|
1254
|
+
i.appendChild(n), this.addChangeListeners(s, e.id);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
this.contentContainer.appendChild(i);
|
|
1230
1258
|
}
|
|
1231
1259
|
handleTabClick(t) {
|
|
1232
1260
|
var i;
|
|
1233
1261
|
if (t === this.activeTabId) return;
|
|
1234
1262
|
this.previousTabId = this.activeTabId, this.activeTabId = t;
|
|
1235
1263
|
const e = (i = this.tabsContainer) == null ? void 0 : i.querySelectorAll(".tab-button");
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
"active",
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
}), this.contentContainer) {
|
|
1243
|
-
const s = this.contentContainer.querySelectorAll(".tab-panel"), n = this.tabs.findIndex(
|
|
1244
|
-
(o) => o.id === this.previousTabId
|
|
1245
|
-
), a = this.tabs.findIndex((o) => o.id === t);
|
|
1246
|
-
s.forEach((o, l) => {
|
|
1247
|
-
o instanceof HTMLElement && (l === a ? (o.classList.add("active"), o.classList.remove("slide-left", "slide-right")) : l === n ? (o.classList.remove("active"), o.classList.add(
|
|
1248
|
-
a > n ? "slide-left" : "slide-right"
|
|
1249
|
-
)) : o.classList.remove("active", "slide-left", "slide-right"));
|
|
1250
|
-
});
|
|
1251
|
-
}
|
|
1252
|
-
this.handleTabChange(t);
|
|
1264
|
+
e == null || e.forEach((s) => {
|
|
1265
|
+
if (s instanceof HTMLElement) {
|
|
1266
|
+
const n = this.tabs.find((a) => a.label === s.textContent);
|
|
1267
|
+
s.classList.toggle("active", (n == null ? void 0 : n.id) === t);
|
|
1268
|
+
}
|
|
1269
|
+
}), this.redrawContent(t), this.handleTabChange(t);
|
|
1253
1270
|
}
|
|
1254
1271
|
setOnChange(t) {
|
|
1255
1272
|
return this.onChangeCallback = t, this;
|
|
@@ -1260,6 +1277,10 @@ class ut extends m {
|
|
|
1260
1277
|
setOnStateChange(t) {
|
|
1261
1278
|
return this.onStateChangeCallback = t, this;
|
|
1262
1279
|
}
|
|
1280
|
+
// Helper method to get the value of the active tab
|
|
1281
|
+
getActiveTabValue() {
|
|
1282
|
+
return this.tabValues.get(this.activeTabId);
|
|
1283
|
+
}
|
|
1263
1284
|
}
|
|
1264
1285
|
const J = `
|
|
1265
1286
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
@@ -1270,7 +1291,7 @@ const J = `
|
|
|
1270
1291
|
<path d="M6 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V6.5M6 16.25H5.85C4.58988 16.25 3.95982 16.25 3.47852 16.0048C3.05516 15.789 2.71095 15.4448 2.49524 15.0215C2.25 14.5402 2.25 13.9101 2.25 12.65V12.5M15.75 6.5V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H12M15.75 12.5V12.65C15.75 13.9101 15.75 14.5402 15.5048 15.0215C15.289 15.4448 14.9448 15.789 14.5215 16.0048C14.0402 16.25 13.4101 16.25 12.15 16.25H12" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1271
1292
|
</svg>
|
|
1272
1293
|
`;
|
|
1273
|
-
class gt extends
|
|
1294
|
+
class gt extends C {
|
|
1274
1295
|
constructor(t) {
|
|
1275
1296
|
super({
|
|
1276
1297
|
title: "Border",
|
|
@@ -1326,7 +1347,7 @@ const Q = `
|
|
|
1326
1347
|
<path d="M6 5.75H12M9 5.75V13.25M5.85 16.25H12.15C13.4101 16.25 14.0402 16.25 14.5215 16.0048C14.9448 15.789 15.289 15.4448 15.5048 15.0215C15.75 14.5402 15.75 13.9101 15.75 12.65V6.35C15.75 5.08988 15.75 4.45982 15.5048 3.97852C15.289 3.55516 14.9448 3.21095 14.5215 2.99524C14.0402 2.75 13.4101 2.75 12.15 2.75H5.85C4.58988 2.75 3.95982 2.75 3.47852 2.99524C3.05516 3.21095 2.71095 3.55516 2.49524 3.97852C2.25 4.45982 2.25 5.08988 2.25 6.35V12.65C2.25 13.9101 2.25 14.5402 2.49524 15.0215C2.71095 15.4448 3.05516 15.789 3.47852 16.0048C3.95982 16.25 4.58988 16.25 5.85 16.25Z" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1327
1348
|
</svg>
|
|
1328
1349
|
`;
|
|
1329
|
-
class mt extends
|
|
1350
|
+
class mt extends C {
|
|
1330
1351
|
constructor(t = {}) {
|
|
1331
1352
|
super({
|
|
1332
1353
|
title: t.title || "Typography",
|
|
@@ -1369,7 +1390,7 @@ class mt extends f {
|
|
|
1369
1390
|
default: t.fontSizeDefault ?? 12,
|
|
1370
1391
|
suffix: "px"
|
|
1371
1392
|
}),
|
|
1372
|
-
align: new
|
|
1393
|
+
align: new $({
|
|
1373
1394
|
title: "Align",
|
|
1374
1395
|
default: t.alignDefault ?? "center"
|
|
1375
1396
|
})
|
|
@@ -1434,7 +1455,7 @@ class k extends m {
|
|
|
1434
1455
|
}), i;
|
|
1435
1456
|
}
|
|
1436
1457
|
}
|
|
1437
|
-
class Ct extends
|
|
1458
|
+
class Ct extends C {
|
|
1438
1459
|
constructor(t) {
|
|
1439
1460
|
super({
|
|
1440
1461
|
title: "Margins",
|
|
@@ -1487,7 +1508,7 @@ const tt = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewB
|
|
|
1487
1508
|
</svg>`, st = `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="19" viewBox="0 0 18 19" fill="none">
|
|
1488
1509
|
<path d="M5.625 2.75H5.6325M5.625 9.5H5.6325M5.625 16.25H5.6325M12.375 2.75H12.3825M12.375 9.5H12.3825M12.375 16.25H12.3825M9 2.75H9.0075M9 9.5H9.0075M9 16.25H9.0075M9 12.875H9.0075M9 6.125H9.0075M15.75 2.75H15.7575M15.75 9.5H15.7575M15.75 16.25H15.7575M15.75 12.875H15.7575M15.75 6.125H15.7575M2.25 16.25V2.75" stroke="#667085" stroke-linecap="round" stroke-linejoin="round"/>
|
|
1489
1510
|
</svg>`;
|
|
1490
|
-
class nt extends
|
|
1511
|
+
class nt extends C {
|
|
1491
1512
|
constructor(t, e, i) {
|
|
1492
1513
|
super({
|
|
1493
1514
|
title: `Tab ${t + 1}`,
|
|
@@ -1531,7 +1552,7 @@ class nt extends f {
|
|
|
1531
1552
|
return t;
|
|
1532
1553
|
}
|
|
1533
1554
|
}
|
|
1534
|
-
class ft extends
|
|
1555
|
+
class ft extends C {
|
|
1535
1556
|
// Store the rendered element
|
|
1536
1557
|
constructor(t) {
|
|
1537
1558
|
super({
|
|
@@ -1600,7 +1621,7 @@ class ft extends f {
|
|
|
1600
1621
|
}));
|
|
1601
1622
|
}
|
|
1602
1623
|
}
|
|
1603
|
-
class vt extends
|
|
1624
|
+
class vt extends C {
|
|
1604
1625
|
/**
|
|
1605
1626
|
* Constructs a new BackgroundSettingSet.
|
|
1606
1627
|
*
|
|
@@ -1675,7 +1696,7 @@ class vt extends f {
|
|
|
1675
1696
|
}
|
|
1676
1697
|
}
|
|
1677
1698
|
export {
|
|
1678
|
-
|
|
1699
|
+
$ as AlignSetting,
|
|
1679
1700
|
vt as BackgroundSettingSet,
|
|
1680
1701
|
gt as BorderSettingSet,
|
|
1681
1702
|
ot as ButtonSetting,
|
|
@@ -1690,7 +1711,7 @@ export {
|
|
|
1690
1711
|
ct as SelectApiSettings,
|
|
1691
1712
|
I as SelectSetting,
|
|
1692
1713
|
m as Setting,
|
|
1693
|
-
|
|
1714
|
+
C as SettingGroup,
|
|
1694
1715
|
O as StringSetting,
|
|
1695
1716
|
ft as TabsContainerGroup,
|
|
1696
1717
|
ut as TabsSettings,
|
package/dist/index.d.ts
CHANGED
|
@@ -546,10 +546,12 @@ export declare class TabsSettings<T = any> extends Setting<T, TabsSettingsProps<
|
|
|
546
546
|
private addChangeListeners;
|
|
547
547
|
private updateTabValues;
|
|
548
548
|
private handleTabChange;
|
|
549
|
+
private redrawContent;
|
|
549
550
|
private handleTabClick;
|
|
550
551
|
setOnChange(onChange: (value: T) => void): this;
|
|
551
552
|
setDetectChange(detectChange: (value: T | undefined) => void): this;
|
|
552
553
|
setOnStateChange(onStateChange: (tabId: string, values: Record<string, any>) => void): this;
|
|
554
|
+
getActiveTabValue(): Record<string, any> | undefined;
|
|
553
555
|
}
|
|
554
556
|
|
|
555
557
|
declare interface TabsSettingsProps<T = TabChangeValue> extends SettingProps<T> {
|
package/package.json
CHANGED