web-mojo 2.1.381 → 2.1.457
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 +33 -52
- 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-BMuMohZ9.js} +4 -2
- package/dist/chunks/{ContextMenu-D7MrKGO7.js.map → ContextMenu-BMuMohZ9.js.map} +1 -1
- package/dist/chunks/ContextMenu-pXNFdhbl.js +3 -0
- package/dist/chunks/ContextMenu-pXNFdhbl.js.map +1 -0
- package/dist/chunks/{DataView-CBdDVkrM.js → DataView-CMd3nckm.js} +17 -3
- package/dist/chunks/DataView-CMd3nckm.js.map +1 -0
- package/dist/chunks/DataView-D4G05RAV.js +2 -0
- package/dist/chunks/DataView-D4G05RAV.js.map +1 -0
- package/dist/chunks/{Dialog-CL5v9LoA.js → Dialog-BuNPCIb4.js} +5 -5
- package/dist/chunks/{Dialog-CL5v9LoA.js.map → Dialog-BuNPCIb4.js.map} +1 -1
- package/dist/chunks/{Dialog-C2ku3o7e.js → Dialog-DlEYRkv-.js} +2 -2
- package/dist/chunks/{Dialog-C2ku3o7e.js.map → Dialog-DlEYRkv-.js.map} +1 -1
- package/dist/chunks/FilePreviewView-BM4SUlOg.js +2 -0
- package/dist/chunks/FilePreviewView-BM4SUlOg.js.map +1 -0
- package/dist/chunks/{FilePreviewView-JVRNaQew.js → FilePreviewView-Bb0x1dL3.js} +80 -24
- package/dist/chunks/FilePreviewView-Bb0x1dL3.js.map +1 -0
- package/dist/chunks/{FormView-BoxBaXnl.js → FormView-CKGDtfCk.js} +91 -24
- package/dist/chunks/FormView-CKGDtfCk.js.map +1 -0
- package/dist/chunks/FormView-CSBAU5VK.js +3 -0
- package/dist/chunks/FormView-CSBAU5VK.js.map +1 -0
- package/dist/chunks/{MetricsChart-cZ4Dx3bJ.js → MetricsChart-BDNoq2zS.js} +3 -3
- package/dist/chunks/{MetricsChart-cZ4Dx3bJ.js.map → MetricsChart-BDNoq2zS.js.map} +1 -1
- package/dist/chunks/{MetricsChart-Dzkzbf7f.js → MetricsChart-BdO9G_5-.js} +2 -2
- package/dist/chunks/{MetricsChart-Dzkzbf7f.js.map → MetricsChart-BdO9G_5-.js.map} +1 -1
- package/dist/chunks/{PDFViewer-CeW32Luz.js → PDFViewer-DdZdueyK.js} +2 -2
- package/dist/chunks/{PDFViewer-CeW32Luz.js.map → PDFViewer-DdZdueyK.js.map} +1 -1
- package/dist/chunks/{PDFViewer-C3CBpSEM.js → PDFViewer-Ds8kDWiF.js} +3 -3
- package/dist/chunks/{PDFViewer-C3CBpSEM.js.map → PDFViewer-Ds8kDWiF.js.map} +1 -1
- package/dist/chunks/{Page-CySYnXIy.js → Page-B-G-nq-K.js} +2 -2
- package/dist/chunks/{Page-CySYnXIy.js.map → Page-B-G-nq-K.js.map} +1 -1
- package/dist/chunks/{Page-Dv1wCWd3.js → Page-CsFumM60.js} +2 -2
- package/dist/chunks/{Page-Dv1wCWd3.js.map → Page-CsFumM60.js.map} +1 -1
- package/dist/chunks/{TopNav-60lav94N.js → TopNav-BwTzAU7I.js} +2 -2
- package/dist/chunks/{TopNav-60lav94N.js.map → TopNav-BwTzAU7I.js.map} +1 -1
- package/dist/chunks/{TopNav-0VwJTJYX.js → TopNav-BzcFnFt0.js} +2 -2
- package/dist/chunks/{TopNav-0VwJTJYX.js.map → TopNav-BzcFnFt0.js.map} +1 -1
- package/dist/chunks/{WebApp-DoFA_eUd.js → WebApp-BXOZii-s.js} +45 -24
- package/dist/chunks/WebApp-BXOZii-s.js.map +1 -0
- package/dist/chunks/WebApp-BYO0uKSI.js +2 -0
- package/dist/chunks/WebApp-BYO0uKSI.js.map +1 -0
- 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
- package/dist/chunks/WebApp-DOjTfhdO.js.map +0 -1
- package/dist/chunks/WebApp-DoFA_eUd.js.map +0 -1
|
@@ -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-BXOZii-s.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);
|
|
@@ -3780,10 +3781,9 @@ class DateRangePicker extends View {
|
|
|
3780
3781
|
config.setup = (picker) => {
|
|
3781
3782
|
picker.on("select", (e) => {
|
|
3782
3783
|
const { start, end } = e.detail;
|
|
3783
|
-
this.
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
);
|
|
3784
|
+
const startDate = start ? this.normalizeDateFromPicker(start) : "";
|
|
3785
|
+
const endDate = end ? this.normalizeDateFromPicker(end) : "";
|
|
3786
|
+
this.handleRangeChange(startDate, endDate);
|
|
3787
3787
|
});
|
|
3788
3788
|
picker.on("clear", () => {
|
|
3789
3789
|
this.handleRangeChange("", "");
|
|
@@ -3881,16 +3881,55 @@ class DateRangePicker extends View {
|
|
|
3881
3881
|
// ========================================
|
|
3882
3882
|
// Utility Methods
|
|
3883
3883
|
// ========================================
|
|
3884
|
+
/**
|
|
3885
|
+
* Normalize date from Easepick DateTime object
|
|
3886
|
+
* Easepick DateTime objects may have timezone issues, so extract the date components directly
|
|
3887
|
+
*/
|
|
3888
|
+
normalizeDateFromPicker(dateObj) {
|
|
3889
|
+
if (!dateObj) return "";
|
|
3890
|
+
if (typeof dateObj.toJSDate === "function") {
|
|
3891
|
+
const jsDate = dateObj.toJSDate();
|
|
3892
|
+
return this.formatDate(jsDate, this.format);
|
|
3893
|
+
}
|
|
3894
|
+
if (typeof dateObj.getFullYear === "function") {
|
|
3895
|
+
const year = dateObj.getFullYear();
|
|
3896
|
+
const month = String(dateObj.getMonth() + 1).padStart(2, "0");
|
|
3897
|
+
const day = String(dateObj.getDate()).padStart(2, "0");
|
|
3898
|
+
switch (this.format) {
|
|
3899
|
+
case "YYYY-MM-DD":
|
|
3900
|
+
return `${year}-${month}-${day}`;
|
|
3901
|
+
case "MM/DD/YYYY":
|
|
3902
|
+
return `${month}/${day}/${year}`;
|
|
3903
|
+
case "DD/MM/YYYY":
|
|
3904
|
+
return `${day}/${month}/${year}`;
|
|
3905
|
+
default:
|
|
3906
|
+
return `${year}-${month}-${day}`;
|
|
3907
|
+
}
|
|
3908
|
+
}
|
|
3909
|
+
return this.formatDate(dateObj, this.format);
|
|
3910
|
+
}
|
|
3884
3911
|
/**
|
|
3885
3912
|
* Format date for different contexts
|
|
3886
3913
|
*/
|
|
3887
3914
|
formatDate(date, format = this.format) {
|
|
3888
3915
|
if (!date) return "";
|
|
3889
|
-
|
|
3890
|
-
if (
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3916
|
+
let year, month, day, d;
|
|
3917
|
+
if (typeof date === "string" && /^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
3918
|
+
const parts = date.split("-");
|
|
3919
|
+
year = parseInt(parts[0]);
|
|
3920
|
+
month = String(parseInt(parts[1])).padStart(2, "0");
|
|
3921
|
+
day = String(parseInt(parts[2])).padStart(2, "0");
|
|
3922
|
+
} else {
|
|
3923
|
+
if (date instanceof Date) {
|
|
3924
|
+
d = date;
|
|
3925
|
+
} else {
|
|
3926
|
+
d = new Date(date);
|
|
3927
|
+
}
|
|
3928
|
+
if (isNaN(d.getTime())) return "";
|
|
3929
|
+
year = d.getFullYear();
|
|
3930
|
+
month = String(d.getMonth() + 1).padStart(2, "0");
|
|
3931
|
+
day = String(d.getDate()).padStart(2, "0");
|
|
3932
|
+
}
|
|
3894
3933
|
switch (format) {
|
|
3895
3934
|
case "YYYY-MM-DD":
|
|
3896
3935
|
return `${year}-${month}-${day}`;
|
|
@@ -3913,7 +3952,8 @@ class DateRangePicker extends View {
|
|
|
3913
3952
|
"Nov",
|
|
3914
3953
|
"Dec"
|
|
3915
3954
|
];
|
|
3916
|
-
|
|
3955
|
+
const monthIndex = parseInt(month) - 1;
|
|
3956
|
+
return `${monthNames[monthIndex]} ${day}, ${year}`;
|
|
3917
3957
|
}
|
|
3918
3958
|
default:
|
|
3919
3959
|
return `${year}-${month}-${day}`;
|
|
@@ -3924,6 +3964,19 @@ class DateRangePicker extends View {
|
|
|
3924
3964
|
*/
|
|
3925
3965
|
formatForOutput(date) {
|
|
3926
3966
|
if (!date) return "";
|
|
3967
|
+
if (typeof date === "string" && /^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
|
3968
|
+
switch (this.outputFormat) {
|
|
3969
|
+
case "epoch":
|
|
3970
|
+
const parts = date.split("-");
|
|
3971
|
+
const d2 = new Date(parseInt(parts[0]), parseInt(parts[1]) - 1, parseInt(parts[2]));
|
|
3972
|
+
return Math.floor(d2.getTime() / 1e3).toString();
|
|
3973
|
+
case "iso":
|
|
3974
|
+
return (/* @__PURE__ */ new Date(date + "T00:00:00")).toISOString();
|
|
3975
|
+
case "date":
|
|
3976
|
+
default:
|
|
3977
|
+
return date;
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3927
3980
|
const d = new Date(date);
|
|
3928
3981
|
if (isNaN(d.getTime())) return "";
|
|
3929
3982
|
switch (this.outputFormat) {
|
|
@@ -3984,8 +4037,10 @@ class DateRangePicker extends View {
|
|
|
3984
4037
|
const endInput = endFieldName ? this.element?.querySelector(`[name="${endFieldName}"]`) : null;
|
|
3985
4038
|
const combinedInput = this.name ? this.element?.querySelector(`[name="${this.name}"]`) : null;
|
|
3986
4039
|
const fieldNameInput = this.fieldName ? this.element?.querySelector(`[name="${this.fieldName}"]`) : null;
|
|
3987
|
-
|
|
3988
|
-
|
|
4040
|
+
const startValue = this.currentStartDate ? this.formatForOutput(this.currentStartDate) : "";
|
|
4041
|
+
const endValue = this.currentEndDate ? this.formatForOutput(this.currentEndDate) : "";
|
|
4042
|
+
if (startInput) startInput.value = startValue;
|
|
4043
|
+
if (endInput) endInput.value = endValue;
|
|
3989
4044
|
if (combinedInput) combinedInput.value = this.getDisplayValue();
|
|
3990
4045
|
if (fieldNameInput) fieldNameInput.value = this.name || "";
|
|
3991
4046
|
}
|
|
@@ -4172,7 +4227,7 @@ class FormView extends View {
|
|
|
4172
4227
|
fields,
|
|
4173
4228
|
model = null,
|
|
4174
4229
|
data = {},
|
|
4175
|
-
defaults =
|
|
4230
|
+
defaults = null,
|
|
4176
4231
|
errors = {},
|
|
4177
4232
|
fileHandling = "base64",
|
|
4178
4233
|
// 'base64' | 'multipart'
|
|
@@ -4186,7 +4241,7 @@ class FormView extends View {
|
|
|
4186
4241
|
...viewOptions
|
|
4187
4242
|
});
|
|
4188
4243
|
this.model = model;
|
|
4189
|
-
this.defaults = defaults;
|
|
4244
|
+
this.defaults = defaults || data;
|
|
4190
4245
|
this._originalData = data;
|
|
4191
4246
|
this.errors = errors;
|
|
4192
4247
|
this.loading = false;
|
|
@@ -4241,6 +4296,13 @@ class FormView extends View {
|
|
|
4241
4296
|
this.populateFormValues();
|
|
4242
4297
|
this.initializeFormComponents();
|
|
4243
4298
|
this.initializeChangeHandlers();
|
|
4299
|
+
const form = this.getFormElement();
|
|
4300
|
+
if (form) {
|
|
4301
|
+
form.addEventListener("submit", (e) => {
|
|
4302
|
+
e.preventDefault();
|
|
4303
|
+
return false;
|
|
4304
|
+
});
|
|
4305
|
+
}
|
|
4244
4306
|
}
|
|
4245
4307
|
/**
|
|
4246
4308
|
* Populate all form fields with current data values
|
|
@@ -4401,6 +4463,10 @@ class FormView extends View {
|
|
|
4401
4463
|
containerId: null
|
|
4402
4464
|
// We'll mount directly
|
|
4403
4465
|
});
|
|
4466
|
+
let value = MOJOUtils.getContextData(this.data, fieldName);
|
|
4467
|
+
if (value) {
|
|
4468
|
+
collectionSelect.setFormValue(value);
|
|
4469
|
+
}
|
|
4404
4470
|
collectionSelect.render(true, placeholder);
|
|
4405
4471
|
this.customComponents.set(fieldName, collectionSelect);
|
|
4406
4472
|
collectionSelect.on("change", (data) => {
|
|
@@ -5066,7 +5132,7 @@ class FormView extends View {
|
|
|
5066
5132
|
getFieldCurrentValue(fieldElement, fieldConfig) {
|
|
5067
5133
|
switch (fieldConfig.type) {
|
|
5068
5134
|
case "checkbox":
|
|
5069
|
-
|
|
5135
|
+
case "toggle":
|
|
5070
5136
|
case "switch":
|
|
5071
5137
|
return fieldElement.checked;
|
|
5072
5138
|
case "radio":
|
|
@@ -5088,6 +5154,7 @@ class FormView extends View {
|
|
|
5088
5154
|
setFieldValue(fieldElement, fieldConfig, newValue) {
|
|
5089
5155
|
switch (fieldConfig.type) {
|
|
5090
5156
|
case "checkbox":
|
|
5157
|
+
case "toggle":
|
|
5091
5158
|
case "switch":
|
|
5092
5159
|
fieldElement.checked = Boolean(newValue);
|
|
5093
5160
|
break;
|
|
@@ -5302,7 +5369,7 @@ class FormView extends View {
|
|
|
5302
5369
|
}
|
|
5303
5370
|
}
|
|
5304
5371
|
}
|
|
5305
|
-
if (fieldType === "switch" || fieldType === "checkbox") {
|
|
5372
|
+
if (fieldType === "switch" || fieldType === "checkbox" || fieldType === "toggle") {
|
|
5306
5373
|
const newBool = !!newValue;
|
|
5307
5374
|
const originalBool = !!originalValue;
|
|
5308
5375
|
return newBool !== originalBool;
|
|
@@ -5938,4 +6005,4 @@ export {
|
|
|
5938
6005
|
applyFileDropMixin as a,
|
|
5939
6006
|
FormView$1 as b
|
|
5940
6007
|
};
|
|
5941
|
-
//# sourceMappingURL=FormView-
|
|
6008
|
+
//# sourceMappingURL=FormView-CKGDtfCk.js.map
|