web-mojo 2.1.46 → 2.1.70
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 +12 -11
- package/dist/admin.es.js.map +1 -1
- package/dist/auth.cjs.js +1 -1
- package/dist/auth.es.js +3 -3
- package/dist/charts.cjs.js +1 -1
- package/dist/charts.es.js +2 -2
- package/dist/chunks/{ContextMenu-gEcpSz56.js → ContextMenu-CD5yoYTS.js} +2 -2
- package/dist/chunks/{ContextMenu-gEcpSz56.js.map → ContextMenu-CD5yoYTS.js.map} +1 -1
- package/dist/chunks/{ContextMenu-BrHqj0fn.js → ContextMenu-Cds78Jny.js} +2 -2
- package/dist/chunks/{ContextMenu-BrHqj0fn.js.map → ContextMenu-Cds78Jny.js.map} +1 -1
- package/dist/chunks/{DataView-DPryYpEW.js → DataView-CfPr57_R.js} +2 -2
- package/dist/chunks/{DataView-DPryYpEW.js.map → DataView-CfPr57_R.js.map} +1 -1
- package/dist/chunks/{DataView-DjZQrpba.js → DataView-DPSnw5Nb.js} +2 -2
- package/dist/chunks/{DataView-DjZQrpba.js.map → DataView-DPSnw5Nb.js.map} +1 -1
- package/dist/chunks/{Dialog-DSlctbon.js → Dialog-B9C-Tivh.js} +5 -5
- package/dist/chunks/{Dialog-DSlctbon.js.map → Dialog-B9C-Tivh.js.map} +1 -1
- package/dist/chunks/{Dialog-BsRx4eg3.js → Dialog-BqNrby-G.js} +2 -2
- package/dist/chunks/{Dialog-BsRx4eg3.js.map → Dialog-BqNrby-G.js.map} +1 -1
- package/dist/chunks/{FilePreviewView-BmFHzK5K.js → FilePreviewView-Bp09ZiEw.js} +54 -32
- package/dist/chunks/FilePreviewView-Bp09ZiEw.js.map +1 -0
- package/dist/chunks/FilePreviewView-CnZhI3Yw.js +2 -0
- package/dist/chunks/FilePreviewView-CnZhI3Yw.js.map +1 -0
- package/dist/chunks/{FormView-CmBuwKGD.js → FormView-D0dUMQGM.js} +2 -2
- package/dist/chunks/FormView-D0dUMQGM.js.map +1 -0
- package/dist/chunks/{FormView-DqUBMPJ9.js → FormView-DWR9Albb.js} +55 -34
- package/dist/chunks/FormView-DWR9Albb.js.map +1 -0
- package/dist/chunks/{MetricsChart-CPidSMaN.js → MetricsChart-BHv1mj0l.js} +2 -2
- package/dist/chunks/{MetricsChart-CPidSMaN.js.map → MetricsChart-BHv1mj0l.js.map} +1 -1
- package/dist/chunks/{MetricsChart-CM4CI6eA.js → MetricsChart-Du8mtBlY.js} +3 -3
- package/dist/chunks/{MetricsChart-CM4CI6eA.js.map → MetricsChart-Du8mtBlY.js.map} +1 -1
- package/dist/chunks/{PDFViewer-Dyo-Oeyd.js → PDFViewer-9beaQaeq.js} +3 -3
- package/dist/chunks/{PDFViewer-Dyo-Oeyd.js.map → PDFViewer-9beaQaeq.js.map} +1 -1
- package/dist/chunks/{PDFViewer-BNQlnS83.js → PDFViewer-C-RkFhlV.js} +2 -2
- package/dist/chunks/{PDFViewer-BNQlnS83.js.map → PDFViewer-C-RkFhlV.js.map} +1 -1
- package/dist/chunks/{Page-B524zSQs.js → Page-Dg7X1BML.js} +2 -2
- package/dist/chunks/{Page-B524zSQs.js.map → Page-Dg7X1BML.js.map} +1 -1
- package/dist/chunks/{Page-BFgj0pAA.js → Page-KLwFxSBF.js} +2 -2
- package/dist/chunks/{Page-BFgj0pAA.js.map → Page-KLwFxSBF.js.map} +1 -1
- package/dist/chunks/{TopNav-D3I3_25f.js → TopNav-47rWUwBU.js} +2 -2
- package/dist/chunks/{TopNav-D3I3_25f.js.map → TopNav-47rWUwBU.js.map} +1 -1
- package/dist/chunks/{TopNav-MDjL4kV0.js → TopNav-DAB4M5C6.js} +2 -2
- package/dist/chunks/{TopNav-MDjL4kV0.js.map → TopNav-DAB4M5C6.js.map} +1 -1
- package/dist/chunks/{User-DwIT-CTQ.js → User-DNxU39NR.js} +2 -2
- package/dist/chunks/{User-DwIT-CTQ.js.map → User-DNxU39NR.js.map} +1 -1
- package/dist/chunks/{User-BalfYTEF.js → User-lVECCjCu.js} +2 -2
- package/dist/chunks/{User-BalfYTEF.js.map → User-lVECCjCu.js.map} +1 -1
- package/dist/chunks/WebApp-Bci5ZTRS.js +2 -0
- package/dist/chunks/WebApp-Bci5ZTRS.js.map +1 -0
- package/dist/chunks/{WebApp-B6mgbNn2.js → WebApp-No-qysKc.js} +17 -17
- package/dist/chunks/WebApp-No-qysKc.js.map +1 -0
- package/dist/docit.cjs.js +1 -1
- package/dist/docit.css +531 -0
- package/dist/docit.es.js +6 -6
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +34 -14
- package/dist/index.es.js.map +1 -1
- package/dist/lightbox.cjs.js +1 -1
- package/dist/lightbox.es.js +4 -4
- package/package.json +2 -10
- package/dist/chunks/FilePreviewView-BmFHzK5K.js.map +0 -1
- package/dist/chunks/FilePreviewView-DcdRl_ta.js +0 -2
- package/dist/chunks/FilePreviewView-DcdRl_ta.js.map +0 -1
- package/dist/chunks/FormView-CmBuwKGD.js.map +0 -1
- package/dist/chunks/FormView-DqUBMPJ9.js.map +0 -1
- package/dist/chunks/WebApp-B6mgbNn2.js.map +0 -1
- package/dist/chunks/WebApp-DqDowtkl.js +0 -2
- package/dist/chunks/WebApp-DqDowtkl.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-No-qysKc.js";
|
|
2
2
|
class FormBuilder {
|
|
3
3
|
constructor(config = {}) {
|
|
4
4
|
this.fields = config.fields || [];
|
|
@@ -2481,7 +2481,7 @@ class CollectionSelectView extends View {
|
|
|
2481
2481
|
this.debounceMs = options.debounceMs || 1e3;
|
|
2482
2482
|
this.name = options.name || "collection_select";
|
|
2483
2483
|
this.emptyFetch = options.emptyFetch !== false;
|
|
2484
|
-
this.selectedValue = options.value || "";
|
|
2484
|
+
this.selectedValue = options.value || "0";
|
|
2485
2485
|
this.selectedLabel = "";
|
|
2486
2486
|
this.searchValue = "";
|
|
2487
2487
|
this.showDropdown = false;
|
|
@@ -2490,6 +2490,10 @@ class CollectionSelectView extends View {
|
|
|
2490
2490
|
this.focusedIndex = -1;
|
|
2491
2491
|
this.hasError = false;
|
|
2492
2492
|
this.errorMessage = "";
|
|
2493
|
+
if (this.selectedValue && typeof this.selectedValue === "object") {
|
|
2494
|
+
this.selectedLabel = this.selectedValue[this.labelField] || "";
|
|
2495
|
+
this.selectedValue = this.selectedValue[this.valueField] || "0";
|
|
2496
|
+
}
|
|
2493
2497
|
this.searchTimer = null;
|
|
2494
2498
|
this.dropdownView = null;
|
|
2495
2499
|
this.defaultParams = {};
|
|
@@ -2541,7 +2545,8 @@ class CollectionSelectView extends View {
|
|
|
2541
2545
|
}
|
|
2542
2546
|
let model = await this.collection.fetchOne(this.selectedValue);
|
|
2543
2547
|
if (model) {
|
|
2544
|
-
this.selectedLabel = model.get(this.labelField);
|
|
2548
|
+
this.selectedLabel = model.get(this.labelField, `${model.constructor.name} #${model.id}`);
|
|
2549
|
+
this.render();
|
|
2545
2550
|
}
|
|
2546
2551
|
} catch (error) {
|
|
2547
2552
|
console.error("Error loading selected item:", error);
|
|
@@ -2559,7 +2564,7 @@ class CollectionSelectView extends View {
|
|
|
2559
2564
|
placeholder: this.placeholder,
|
|
2560
2565
|
displayValue,
|
|
2561
2566
|
selectedValue: this.selectedValue,
|
|
2562
|
-
showClear: !!(this.selectedValue && this.selectedLabel),
|
|
2567
|
+
showClear: !!(this.selectedValue && this.selectedValue !== "0" && this.selectedLabel),
|
|
2563
2568
|
hasError: this.hasError,
|
|
2564
2569
|
errorMessage: this.errorMessage
|
|
2565
2570
|
};
|
|
@@ -2622,9 +2627,9 @@ class CollectionSelectView extends View {
|
|
|
2622
2627
|
this.hasSearched = true;
|
|
2623
2628
|
this.focusedIndex = -1;
|
|
2624
2629
|
if (this.searchValue !== this.selectedLabel) {
|
|
2625
|
-
this.selectedValue = "";
|
|
2630
|
+
this.selectedValue = "0";
|
|
2626
2631
|
this.selectedLabel = "";
|
|
2627
|
-
this.emit("change", { value: "", label: "" });
|
|
2632
|
+
this.emit("change", { value: "0", label: "" });
|
|
2628
2633
|
}
|
|
2629
2634
|
if (this.searchTimer) {
|
|
2630
2635
|
clearTimeout(this.searchTimer);
|
|
@@ -2641,7 +2646,7 @@ class CollectionSelectView extends View {
|
|
|
2641
2646
|
this.clearSelection();
|
|
2642
2647
|
}
|
|
2643
2648
|
clearSelection() {
|
|
2644
|
-
this.selectedValue = "";
|
|
2649
|
+
this.selectedValue = "0";
|
|
2645
2650
|
this.selectedLabel = "";
|
|
2646
2651
|
this.searchValue = "";
|
|
2647
2652
|
this.showDropdown = false;
|
|
@@ -2655,11 +2660,11 @@ class CollectionSelectView extends View {
|
|
|
2655
2660
|
}
|
|
2656
2661
|
const hiddenInput = this.getHiddenInput();
|
|
2657
2662
|
if (hiddenInput) {
|
|
2658
|
-
hiddenInput.value = "";
|
|
2663
|
+
hiddenInput.value = "0";
|
|
2659
2664
|
}
|
|
2660
2665
|
this.updateDropdown();
|
|
2661
2666
|
this.render();
|
|
2662
|
-
this.emit("change", { value: "", label: "" });
|
|
2667
|
+
this.emit("change", { value: "0", label: "" });
|
|
2663
2668
|
}
|
|
2664
2669
|
async performSearch() {
|
|
2665
2670
|
if (!this.collection) return;
|
|
@@ -2803,25 +2808,29 @@ class CollectionSelectView extends View {
|
|
|
2803
2808
|
return this.selectedValue;
|
|
2804
2809
|
}
|
|
2805
2810
|
setFormValue(value) {
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2811
|
+
let newValue = value;
|
|
2812
|
+
let newLabel = "";
|
|
2813
|
+
if (newValue && typeof newValue === "object") {
|
|
2814
|
+
newLabel = newValue[this.labelField] || "";
|
|
2815
|
+
newValue = newValue[this.valueField];
|
|
2816
|
+
}
|
|
2817
|
+
newValue = newValue || "0";
|
|
2818
|
+
if (newValue == this.selectedValue) {
|
|
2819
|
+
return;
|
|
2820
|
+
}
|
|
2821
|
+
this.selectedValue = newValue;
|
|
2822
|
+
this.selectedLabel = newLabel;
|
|
2823
|
+
this.searchValue = "";
|
|
2824
|
+
this.hasSearched = false;
|
|
2825
|
+
this.showDropdown = false;
|
|
2826
|
+
this.hasError = false;
|
|
2827
|
+
if (this.selectedValue && this.selectedValue !== "0") {
|
|
2828
|
+
if (!this.selectedLabel) {
|
|
2829
|
+
this.selectedLabel = `${this.collection.getModelName()} #${this.selectedValue}`;
|
|
2830
|
+
}
|
|
2814
2831
|
this.loadSelectedItem();
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
this.selectedValue = value;
|
|
2818
|
-
this.selectedLabel = `${this.collection.getModelName()} #${value}`;
|
|
2819
|
-
this.searchValue = `${this.collection.getModelName()} #${value}`;
|
|
2820
|
-
this.hasSearched = false;
|
|
2821
|
-
this.showDropdown = false;
|
|
2822
|
-
this.hasError = false;
|
|
2823
|
-
if (this.selectedValue) this.loadSelectedItem();
|
|
2824
|
-
this.setValue(this.selectedValue, this.selectedLabel);
|
|
2832
|
+
} else {
|
|
2833
|
+
this.render();
|
|
2825
2834
|
}
|
|
2826
2835
|
}
|
|
2827
2836
|
}
|
|
@@ -4118,7 +4127,7 @@ class FormView extends View {
|
|
|
4118
4127
|
*/
|
|
4119
4128
|
handleFieldChange(fieldName, value) {
|
|
4120
4129
|
this.data[fieldName] = value;
|
|
4121
|
-
if (this.model &&
|
|
4130
|
+
if (this.model && this.options.allowModelChange) {
|
|
4122
4131
|
this.model.set(fieldName, value);
|
|
4123
4132
|
}
|
|
4124
4133
|
this.emit("field:change", { field: fieldName, value });
|
|
@@ -4613,7 +4622,7 @@ class FormView extends View {
|
|
|
4613
4622
|
}
|
|
4614
4623
|
}
|
|
4615
4624
|
if (this.model && typeof this.model.save === "function") {
|
|
4616
|
-
const result = await this.saveModel();
|
|
4625
|
+
const result = await this.saveModel(formData);
|
|
4617
4626
|
if (result && result.success !== false) {
|
|
4618
4627
|
return {
|
|
4619
4628
|
success: true,
|
|
@@ -4646,11 +4655,11 @@ class FormView extends View {
|
|
|
4646
4655
|
* Only saves changed data for efficiency
|
|
4647
4656
|
* @returns {Promise<Object>} Save result from model
|
|
4648
4657
|
*/
|
|
4649
|
-
async saveModel() {
|
|
4658
|
+
async saveModel(formData = null) {
|
|
4650
4659
|
if (!this.model || typeof this.model.save !== "function") {
|
|
4651
4660
|
throw new Error("No model available for saving");
|
|
4652
4661
|
}
|
|
4653
|
-
|
|
4662
|
+
if (!formData) formData = await this.getFormData();
|
|
4654
4663
|
const changes = this.getChangedData(formData);
|
|
4655
4664
|
if (!changes || Object.keys(changes).length === 0) {
|
|
4656
4665
|
console.log("No changes detected, skipping save");
|
|
@@ -4757,7 +4766,7 @@ class FormView extends View {
|
|
|
4757
4766
|
const newValue = currentData[key];
|
|
4758
4767
|
const originalValue = resolveDotNotation(originalData, key);
|
|
4759
4768
|
const fieldType = fieldConfig.type || "text";
|
|
4760
|
-
if (this.valuesAreDifferent(newValue, originalValue, fieldType)) {
|
|
4769
|
+
if (this.valuesAreDifferent(newValue, originalValue, fieldType, fieldConfig)) {
|
|
4761
4770
|
changedData[key] = newValue;
|
|
4762
4771
|
hasChanges = true;
|
|
4763
4772
|
}
|
|
@@ -4769,15 +4778,27 @@ class FormView extends View {
|
|
|
4769
4778
|
* @param {*} newValue - New value from form
|
|
4770
4779
|
* @param {*} originalValue - Original value from model
|
|
4771
4780
|
* @param {string} fieldType - The type of the field from the form config
|
|
4781
|
+
* @param {object} fieldConfig - The configuration of the field from the form config
|
|
4772
4782
|
* @returns {boolean} True if values are different
|
|
4773
4783
|
*/
|
|
4774
|
-
valuesAreDifferent(newValue, originalValue, fieldType = "text") {
|
|
4784
|
+
valuesAreDifferent(newValue, originalValue, fieldType = "text", fieldConfig = {}) {
|
|
4775
4785
|
if (newValue instanceof File) {
|
|
4776
4786
|
return newValue.size > 0 && newValue.name !== "" && newValue.name !== "blob";
|
|
4777
4787
|
}
|
|
4778
4788
|
if (typeof newValue === "string" && newValue.startsWith("data:image/")) {
|
|
4779
4789
|
return true;
|
|
4780
4790
|
}
|
|
4791
|
+
if (fieldType === "collection") {
|
|
4792
|
+
if (typeof originalValue === "object" && typeof newValue === "string") {
|
|
4793
|
+
if (newValue === "0") {
|
|
4794
|
+
return originalValue !== null;
|
|
4795
|
+
}
|
|
4796
|
+
const valueField = fieldConfig.valueField || "id";
|
|
4797
|
+
if (originalValue[valueField] == newValue) {
|
|
4798
|
+
return false;
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
}
|
|
4781
4802
|
if (fieldType === "switch" || fieldType === "checkbox") {
|
|
4782
4803
|
const newBool = !!newValue;
|
|
4783
4804
|
const originalBool = !!originalValue;
|
|
@@ -5051,4 +5072,4 @@ export {
|
|
|
5051
5072
|
applyFileDropMixin as a,
|
|
5052
5073
|
FormView$1 as b
|
|
5053
5074
|
};
|
|
5054
|
-
//# sourceMappingURL=FormView-
|
|
5075
|
+
//# sourceMappingURL=FormView-DWR9Albb.js.map
|