web-mojo 2.1.381 → 2.1.443
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/admin.cjs.js +1 -1
- package/dist/admin.cjs.js.map +1 -1
- package/dist/admin.es.js +32 -43
- package/dist/admin.es.js.map +1 -1
- package/dist/auth.cjs.js +1 -1
- package/dist/auth.cjs.js.map +1 -1
- package/dist/auth.es.js +3 -3
- package/dist/auth.es.js.map +1 -1
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +2 -2
- package/dist/chunks/{ContextMenu-D7MrKGO7.js → ContextMenu-Cao6A-Lu.js} +4 -2
- package/dist/chunks/{ContextMenu-D7MrKGO7.js.map → ContextMenu-Cao6A-Lu.js.map} +1 -1
- package/dist/chunks/ContextMenu-TK4-wzDb.js +3 -0
- package/dist/chunks/ContextMenu-TK4-wzDb.js.map +1 -0
- package/dist/chunks/DataView-CHoPxbYT.js +2 -0
- package/dist/chunks/DataView-CHoPxbYT.js.map +1 -0
- package/dist/chunks/{DataView-CBdDVkrM.js → DataView-Qnk-TnHd.js} +17 -3
- package/dist/chunks/DataView-Qnk-TnHd.js.map +1 -0
- package/dist/chunks/{Dialog-C2ku3o7e.js → Dialog-B_ZJYlVS.js} +2 -2
- package/dist/chunks/{Dialog-C2ku3o7e.js.map → Dialog-B_ZJYlVS.js.map} +1 -1
- package/dist/chunks/{Dialog-CL5v9LoA.js → Dialog-DbZ2jB_m.js} +5 -5
- package/dist/chunks/{Dialog-CL5v9LoA.js.map → Dialog-DbZ2jB_m.js.map} +1 -1
- package/dist/chunks/FilePreviewView-DeGgRRbW.js +2 -0
- package/dist/chunks/FilePreviewView-DeGgRRbW.js.map +1 -0
- package/dist/chunks/{FilePreviewView-JVRNaQew.js → FilePreviewView-nuZku1yG.js} +68 -19
- package/dist/chunks/FilePreviewView-nuZku1yG.js.map +1 -0
- package/dist/chunks/{FormView-BoxBaXnl.js → FormView-BDKrUX1-.js} +25 -12
- package/dist/chunks/FormView-BDKrUX1-.js.map +1 -0
- package/dist/chunks/FormView-BZInlDfZ.js +2 -0
- package/dist/chunks/FormView-BZInlDfZ.js.map +1 -0
- package/dist/chunks/{MetricsChart-cZ4Dx3bJ.js → MetricsChart-Aqum5Znr.js} +3 -3
- package/dist/chunks/{MetricsChart-cZ4Dx3bJ.js.map → MetricsChart-Aqum5Znr.js.map} +1 -1
- package/dist/chunks/{MetricsChart-Dzkzbf7f.js → MetricsChart-BbaBczOZ.js} +2 -2
- package/dist/chunks/{MetricsChart-Dzkzbf7f.js.map → MetricsChart-BbaBczOZ.js.map} +1 -1
- package/dist/chunks/{PDFViewer-CeW32Luz.js → PDFViewer-Bq-NM6JH.js} +2 -2
- package/dist/chunks/{PDFViewer-CeW32Luz.js.map → PDFViewer-Bq-NM6JH.js.map} +1 -1
- package/dist/chunks/{PDFViewer-C3CBpSEM.js → PDFViewer-CGj7cZut.js} +3 -3
- package/dist/chunks/{PDFViewer-C3CBpSEM.js.map → PDFViewer-CGj7cZut.js.map} +1 -1
- package/dist/chunks/{Page-Dv1wCWd3.js → Page-BkkXMFuP.js} +2 -2
- package/dist/chunks/{Page-Dv1wCWd3.js.map → Page-BkkXMFuP.js.map} +1 -1
- package/dist/chunks/{Page-CySYnXIy.js → Page-QhPYRY-q.js} +2 -2
- package/dist/chunks/{Page-CySYnXIy.js.map → Page-QhPYRY-q.js.map} +1 -1
- package/dist/chunks/{TopNav-60lav94N.js → TopNav-D6c7gsox.js} +2 -2
- package/dist/chunks/{TopNav-60lav94N.js.map → TopNav-D6c7gsox.js.map} +1 -1
- package/dist/chunks/{TopNav-0VwJTJYX.js → TopNav-DUwNnOuM.js} +2 -2
- package/dist/chunks/{TopNav-0VwJTJYX.js.map → TopNav-DUwNnOuM.js.map} +1 -1
- package/dist/chunks/{WebApp-DoFA_eUd.js → WebApp-BPWJVv80.js} +19 -13
- package/dist/chunks/{WebApp-DoFA_eUd.js.map → WebApp-BPWJVv80.js.map} +1 -1
- package/dist/chunks/WebApp-CYqazUo5.js +2 -0
- package/dist/chunks/{WebApp-DOjTfhdO.js.map → WebApp-CYqazUo5.js.map} +1 -1
- package/dist/core.css +10 -0
- package/dist/css/web-mojo.css +1 -1
- package/dist/docit.cjs.js +1 -1
- package/dist/docit.es.js +5 -5
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +11 -11
- package/dist/lightbox.cjs.js +1 -1
- package/dist/lightbox.es.js +4 -4
- package/package.json +1 -1
- package/dist/chunks/ContextMenu-DoiC5aBP.js +0 -3
- package/dist/chunks/ContextMenu-DoiC5aBP.js.map +0 -1
- package/dist/chunks/DataView-BkYIt0kh.js +0 -2
- package/dist/chunks/DataView-BkYIt0kh.js.map +0 -1
- package/dist/chunks/DataView-CBdDVkrM.js.map +0 -1
- package/dist/chunks/FilePreviewView-JVRNaQew.js.map +0 -1
- package/dist/chunks/FilePreviewView-PBLBpsc2.js +0 -2
- package/dist/chunks/FilePreviewView-PBLBpsc2.js.map +0 -1
- package/dist/chunks/FormView-B7UZBs0x.js +0 -2
- package/dist/chunks/FormView-B7UZBs0x.js.map +0 -1
- package/dist/chunks/FormView-BoxBaXnl.js.map +0 -1
- package/dist/chunks/WebApp-DOjTfhdO.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-
|
|
1
|
+
import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-BPWJVv80.js";
|
|
2
2
|
class FormBuilder {
|
|
3
3
|
constructor(config = {}) {
|
|
4
4
|
this.fields = config.fields || [];
|
|
@@ -345,10 +345,7 @@ class FormBuilder {
|
|
|
345
345
|
const fieldsHTML = this.buildFieldsHTML();
|
|
346
346
|
const buttonsHTML = this.buildButtonsHTML();
|
|
347
347
|
return `
|
|
348
|
-
<form class="${this.options.formClass}"
|
|
349
|
-
method="${this.options.formMethod}"
|
|
350
|
-
${this.options.formAction ? `action="${this.options.formAction}"` : ""}
|
|
351
|
-
novalidate>
|
|
348
|
+
<form class="${this.options.formClass}" novalidate>
|
|
352
349
|
${fieldsHTML}
|
|
353
350
|
${buttonsHTML}
|
|
354
351
|
</form>
|
|
@@ -2754,6 +2751,8 @@ class CollectionSelectView extends View {
|
|
|
2754
2751
|
this.handleDocumentClick = this.handleDocumentClick.bind(this);
|
|
2755
2752
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
2756
2753
|
this.handleInputEvents = this.handleInputEvents.bind(this);
|
|
2754
|
+
}
|
|
2755
|
+
onInit() {
|
|
2757
2756
|
if (this.collection) {
|
|
2758
2757
|
this.setupCollection();
|
|
2759
2758
|
}
|
|
@@ -2791,16 +2790,18 @@ class CollectionSelectView extends View {
|
|
|
2791
2790
|
}
|
|
2792
2791
|
async loadSelectedItem() {
|
|
2793
2792
|
try {
|
|
2793
|
+
if (!this.selectedValue || this.selectedValue == "0") return;
|
|
2794
|
+
if (this.selectedLabel) return;
|
|
2794
2795
|
const selectedModel = this.collection?.get(this.selectedValue);
|
|
2795
2796
|
if (selectedModel) {
|
|
2796
2797
|
this.selectedLabel = selectedModel.get(this.labelField);
|
|
2797
|
-
this.render();
|
|
2798
|
+
this.render(false);
|
|
2798
2799
|
return;
|
|
2799
2800
|
}
|
|
2800
2801
|
let model = await this.collection.fetchOne(this.selectedValue);
|
|
2801
2802
|
if (model) {
|
|
2802
2803
|
this.selectedLabel = model.get(this.labelField, `${model.constructor.name} #${model.id}`);
|
|
2803
|
-
this.render();
|
|
2804
|
+
this.render(false);
|
|
2804
2805
|
}
|
|
2805
2806
|
} catch (error) {
|
|
2806
2807
|
console.error("Error loading selected item:", error);
|
|
@@ -4172,7 +4173,7 @@ class FormView extends View {
|
|
|
4172
4173
|
fields,
|
|
4173
4174
|
model = null,
|
|
4174
4175
|
data = {},
|
|
4175
|
-
defaults =
|
|
4176
|
+
defaults = null,
|
|
4176
4177
|
errors = {},
|
|
4177
4178
|
fileHandling = "base64",
|
|
4178
4179
|
// 'base64' | 'multipart'
|
|
@@ -4186,7 +4187,7 @@ class FormView extends View {
|
|
|
4186
4187
|
...viewOptions
|
|
4187
4188
|
});
|
|
4188
4189
|
this.model = model;
|
|
4189
|
-
this.defaults = defaults;
|
|
4190
|
+
this.defaults = defaults || data;
|
|
4190
4191
|
this._originalData = data;
|
|
4191
4192
|
this.errors = errors;
|
|
4192
4193
|
this.loading = false;
|
|
@@ -4241,6 +4242,13 @@ class FormView extends View {
|
|
|
4241
4242
|
this.populateFormValues();
|
|
4242
4243
|
this.initializeFormComponents();
|
|
4243
4244
|
this.initializeChangeHandlers();
|
|
4245
|
+
const form = this.getFormElement();
|
|
4246
|
+
if (form) {
|
|
4247
|
+
form.addEventListener("submit", (e) => {
|
|
4248
|
+
e.preventDefault();
|
|
4249
|
+
return false;
|
|
4250
|
+
});
|
|
4251
|
+
}
|
|
4244
4252
|
}
|
|
4245
4253
|
/**
|
|
4246
4254
|
* Populate all form fields with current data values
|
|
@@ -4401,6 +4409,10 @@ class FormView extends View {
|
|
|
4401
4409
|
containerId: null
|
|
4402
4410
|
// We'll mount directly
|
|
4403
4411
|
});
|
|
4412
|
+
let value = MOJOUtils.getContextData(this.data, fieldName);
|
|
4413
|
+
if (value) {
|
|
4414
|
+
collectionSelect.setFormValue(value);
|
|
4415
|
+
}
|
|
4404
4416
|
collectionSelect.render(true, placeholder);
|
|
4405
4417
|
this.customComponents.set(fieldName, collectionSelect);
|
|
4406
4418
|
collectionSelect.on("change", (data) => {
|
|
@@ -5066,7 +5078,7 @@ class FormView extends View {
|
|
|
5066
5078
|
getFieldCurrentValue(fieldElement, fieldConfig) {
|
|
5067
5079
|
switch (fieldConfig.type) {
|
|
5068
5080
|
case "checkbox":
|
|
5069
|
-
|
|
5081
|
+
case "toggle":
|
|
5070
5082
|
case "switch":
|
|
5071
5083
|
return fieldElement.checked;
|
|
5072
5084
|
case "radio":
|
|
@@ -5088,6 +5100,7 @@ class FormView extends View {
|
|
|
5088
5100
|
setFieldValue(fieldElement, fieldConfig, newValue) {
|
|
5089
5101
|
switch (fieldConfig.type) {
|
|
5090
5102
|
case "checkbox":
|
|
5103
|
+
case "toggle":
|
|
5091
5104
|
case "switch":
|
|
5092
5105
|
fieldElement.checked = Boolean(newValue);
|
|
5093
5106
|
break;
|
|
@@ -5302,7 +5315,7 @@ class FormView extends View {
|
|
|
5302
5315
|
}
|
|
5303
5316
|
}
|
|
5304
5317
|
}
|
|
5305
|
-
if (fieldType === "switch" || fieldType === "checkbox") {
|
|
5318
|
+
if (fieldType === "switch" || fieldType === "checkbox" || fieldType === "toggle") {
|
|
5306
5319
|
const newBool = !!newValue;
|
|
5307
5320
|
const originalBool = !!originalValue;
|
|
5308
5321
|
return newBool !== originalBool;
|
|
@@ -5938,4 +5951,4 @@ export {
|
|
|
5938
5951
|
applyFileDropMixin as a,
|
|
5939
5952
|
FormView$1 as b
|
|
5940
5953
|
};
|
|
5941
|
-
//# sourceMappingURL=FormView-
|
|
5954
|
+
//# sourceMappingURL=FormView-BDKrUX1-.js.map
|