pgo-ui 1.1.113 → 1.1.115
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/Radio-D6HWZ9Vd.js +4 -0
- package/dist/{index-DYzxrPKU.js → index-Drp7tLIs.js} +6230 -6227
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +45 -45
- package/package.json +1 -1
- package/src/components/pgo/forms/DynamicForm.vue +18 -159
- package/dist/Radio-BD0Sd7W4.js +0 -4
package/package.json
CHANGED
|
@@ -115,14 +115,14 @@
|
|
|
115
115
|
label="buttons.update"
|
|
116
116
|
color="warning"
|
|
117
117
|
:loading="isSubmitting && clickedButton === 'update'"
|
|
118
|
-
:disabled="isSubmitting || !isFormDirty || !valid"
|
|
118
|
+
:disabled="isSubmitting || (!isFormDirty && !dataChanged) || !valid"
|
|
119
119
|
@click="handleSubmit('update')"
|
|
120
120
|
/>
|
|
121
121
|
<Button
|
|
122
122
|
label="buttons.submit"
|
|
123
123
|
color="primary"
|
|
124
124
|
:loading="isSubmitting && clickedButton === 'submit'"
|
|
125
|
-
:disabled="isSubmitting || !valid"
|
|
125
|
+
:disabled="isSubmitting || !valid || (hasFileFields && !allFileFieldsFilled)"
|
|
126
126
|
@click="handleSubmit('submit')"
|
|
127
127
|
/>
|
|
128
128
|
<!-- <Button v-if="items" label="buttons.submit" color="primary" @click="handleSubmit('submit')"/> -->
|
|
@@ -533,86 +533,7 @@ const compiledFunctions = ref({});
|
|
|
533
533
|
return true
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
|
-
|
|
537
|
-
// // Add null check for group
|
|
538
|
-
// if (!group) {
|
|
539
|
-
// return false;
|
|
540
|
-
// }
|
|
541
|
-
|
|
542
|
-
// // If no condition, always show the group
|
|
543
|
-
// if (!group.condition) {
|
|
544
|
-
// return true;
|
|
545
|
-
// }
|
|
546
|
-
|
|
547
|
-
// try {
|
|
548
|
-
// // Normalize the condition string (trim spaces)
|
|
549
|
-
// let expression = group.condition.trim();
|
|
550
|
-
|
|
551
|
-
// // Create enhanced evaluation context
|
|
552
|
-
// const context = createEvaluationContext();
|
|
553
|
-
|
|
554
|
-
// // Helper function to safely evaluate expressions
|
|
555
|
-
// const evaluateCondition = (expr) => {
|
|
556
|
-
// // Handle various condition patterns:
|
|
557
|
-
|
|
558
|
-
// // Pattern 1: Simple variable check "variableName" -> check if variable is truthy
|
|
559
|
-
// if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(expr)) {
|
|
560
|
-
// return !!context[expr];
|
|
561
|
-
// }
|
|
562
|
-
|
|
563
|
-
// // Pattern 2: Negation "!variableName"
|
|
564
|
-
// if (/^!/.test(expr)) {
|
|
565
|
-
// const variableName = expr.substring(1).trim();
|
|
566
|
-
// if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(variableName)) {
|
|
567
|
-
// return !context[variableName];
|
|
568
|
-
// }
|
|
569
|
-
// }
|
|
570
|
-
|
|
571
|
-
// // Pattern 3: Complex expression with &&, ||, ===, !==, >, <, etc.
|
|
572
|
-
// // Create variable declarations from context — skip keys that aren't
|
|
573
|
-
// // valid JS identifiers (e.g. dotted keys spread from formData) and
|
|
574
|
-
// // reserved words (can't be used as `const` binding names).
|
|
575
|
-
// const RESERVED = new Set(['break','case','catch','class','const','continue','debugger','default','delete','do','else','enum','export','extends','false','finally','for','function','if','import','in','instanceof','new','null','return','super','switch','this','throw','true','try','typeof','var','void','while','with','yield','let','static','implements','interface','package','private','protected','public','await','async']);
|
|
576
|
-
// const varDeclarations = Object.keys(context)
|
|
577
|
-
// .filter(key => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) && !RESERVED.has(key))
|
|
578
|
-
// .map(key => {
|
|
579
|
-
// const value = context[key];
|
|
580
|
-
// // Properly stringify different value types
|
|
581
|
-
// if (value === null || value === undefined) {
|
|
582
|
-
// return `const ${key} = null;`;
|
|
583
|
-
// } else if (typeof value === 'string') {
|
|
584
|
-
// return `const ${key} = ${JSON.stringify(value)};`;
|
|
585
|
-
// } else if (typeof value === 'boolean') {
|
|
586
|
-
// return `const ${key} = ${value};`;
|
|
587
|
-
// } else if (typeof value === 'number') {
|
|
588
|
-
// return `const ${key} = ${value};`;
|
|
589
|
-
// } else {
|
|
590
|
-
// const json = JSON.stringify(value);
|
|
591
|
-
// return `const ${key} = ${json === undefined ? 'null' : json};`;
|
|
592
|
-
// }
|
|
593
|
-
// })
|
|
594
|
-
// .join('\n');
|
|
595
|
-
|
|
596
|
-
// // Create and execute the function with the context
|
|
597
|
-
// const fn = new Function(varDeclarations + `\nreturn (${expr});`);
|
|
598
|
-
// return fn();
|
|
599
|
-
// };
|
|
600
|
-
|
|
601
|
-
// // Evaluate the condition expression
|
|
602
|
-
// return !!evaluateCondition(expression);
|
|
603
|
-
// } catch (error) {
|
|
604
|
-
// console.warn(`Error evaluating group condition "${group.condition}":`, error.message);
|
|
605
|
-
// // Fallback: check if the condition is a simple variable reference
|
|
606
|
-
// const simpleVariable = group.condition.trim().replace(/^!/, '');
|
|
607
|
-
// if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(simpleVariable)) {
|
|
608
|
-
// const context = createEvaluationContext();
|
|
609
|
-
// const value = context[simpleVariable];
|
|
610
|
-
// return group.condition.trim().startsWith('!') ? !value : !!value;
|
|
611
|
-
// }
|
|
612
|
-
// return true; // Show group by default if evaluation fails
|
|
613
|
-
// }
|
|
614
|
-
// };
|
|
615
|
-
// Helper to get nested value by dot notation key e.g. "submissionDetails.form_ref_number"
|
|
536
|
+
|
|
616
537
|
const getNestedValue = (obj, path) => {
|
|
617
538
|
if (!path || !obj) return undefined
|
|
618
539
|
return path.split('.').reduce((acc, key) => {
|
|
@@ -653,84 +574,21 @@ const compiledFunctions = ref({});
|
|
|
653
574
|
return true
|
|
654
575
|
}
|
|
655
576
|
};
|
|
656
|
-
// const shouldShowField = (field) => {
|
|
657
|
-
// // Add null check for field
|
|
658
|
-
// if (!field) {
|
|
659
|
-
// return false;
|
|
660
|
-
// }
|
|
661
577
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
// // Helper function to safely evaluate expressions
|
|
678
|
-
// const evaluateCondition = (expr) => {
|
|
679
|
-
// // Handle various condition patterns:
|
|
680
|
-
|
|
681
|
-
// // Pattern 1: Simple field check "fieldName" -> check if field is truthy
|
|
682
|
-
// if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(expr)) {
|
|
683
|
-
// return !!context[expr];
|
|
684
|
-
// }
|
|
685
|
-
|
|
686
|
-
// // Pattern 2: Negation "!fieldName"
|
|
687
|
-
// if (/^!/.test(expr)) {
|
|
688
|
-
// const fieldName = expr.substring(1).trim();
|
|
689
|
-
// if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(fieldName)) {
|
|
690
|
-
// return !context[fieldName];
|
|
691
|
-
// }
|
|
692
|
-
// }
|
|
693
|
-
|
|
694
|
-
// // Pattern 3: Complex expression with &&, ||, ===, !==, >, <, etc.
|
|
695
|
-
// const RESERVED = new Set(['break','case','catch','class','const','continue','debugger','default','delete','do','else','enum','export','extends','false','finally','for','function','if','import','in','instanceof','new','null','return','super','switch','this','throw','true','try','typeof','var','void','while','with','yield','let','static','implements','interface','package','private','protected','public','await','async']);
|
|
696
|
-
// const varDeclarations = Object.keys(context)
|
|
697
|
-
// .filter(key => /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) && !RESERVED.has(key))
|
|
698
|
-
// .map(key => {
|
|
699
|
-
// const value = context[key];
|
|
700
|
-
// if (value === null || value === undefined) {
|
|
701
|
-
// return `const ${key} = null;`;
|
|
702
|
-
// } else if (typeof value === 'string') {
|
|
703
|
-
// return `const ${key} = ${JSON.stringify(value)};`;
|
|
704
|
-
// } else if (typeof value === 'boolean') {
|
|
705
|
-
// return `const ${key} = ${value};`;
|
|
706
|
-
// } else if (typeof value === 'number') {
|
|
707
|
-
// return `const ${key} = ${value};`;
|
|
708
|
-
// } else {
|
|
709
|
-
// const json = JSON.stringify(value);
|
|
710
|
-
// return `const ${key} = ${json === undefined ? 'null' : json};`;
|
|
711
|
-
// }
|
|
712
|
-
// })
|
|
713
|
-
// .join('\n');
|
|
714
|
-
|
|
715
|
-
// // Create and execute the function with the context
|
|
716
|
-
// const fn = new Function(varDeclarations + `\nreturn (${expr});`);
|
|
717
|
-
// return fn();
|
|
718
|
-
// };
|
|
719
|
-
|
|
720
|
-
// // Evaluate the condition expression
|
|
721
|
-
// return !!evaluateCondition(expression);
|
|
722
|
-
// } catch (error) {
|
|
723
|
-
// console.warn(`Error evaluating condition "${field.condition}":`, error.message);
|
|
724
|
-
// // Fallback: check if the condition is a simple field reference
|
|
725
|
-
// const simpleField = field.condition.trim().replace(/^!/, '');
|
|
726
|
-
// if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(simpleField)) {
|
|
727
|
-
// const context = createEvaluationContext();
|
|
728
|
-
// const value = context[simpleField];
|
|
729
|
-
// return field.condition.trim().startsWith('!') ? !value : !!value;
|
|
730
|
-
// }
|
|
731
|
-
// return true; // Show field by default if evaluation fails
|
|
732
|
-
// }
|
|
733
|
-
// };
|
|
578
|
+
const hasFileFields = computed(() => {
|
|
579
|
+
if (!props.form.fields || !Array.isArray(props.form.fields)) return false
|
|
580
|
+
return props.form.fields.some(f => f && (f.inputType === 'file' || f.inputType === 'filefield'))
|
|
581
|
+
})
|
|
582
|
+
|
|
583
|
+
const allFileFieldsFilled = computed(() => {
|
|
584
|
+
if (!props.form.fields || !Array.isArray(props.form.fields)) return true
|
|
585
|
+
return props.form.fields
|
|
586
|
+
.filter(f => f && (f.inputType === 'file' || f.inputType === 'filefield'))
|
|
587
|
+
.every(f => {
|
|
588
|
+
const list = FormDataList.value?.[f.dataKey ?? f.key]
|
|
589
|
+
return Array.isArray(list) && list.length > 0
|
|
590
|
+
})
|
|
591
|
+
})
|
|
734
592
|
|
|
735
593
|
const componentMap = computed(() => {
|
|
736
594
|
const map = {}
|
|
@@ -987,6 +845,7 @@ const compiledFunctions = ref({});
|
|
|
987
845
|
formRef.value?.reset()
|
|
988
846
|
}else {
|
|
989
847
|
await fetchData()
|
|
848
|
+
dataChanged.value = false
|
|
990
849
|
}
|
|
991
850
|
|
|
992
851
|
}
|
package/dist/Radio-BD0Sd7W4.js
DELETED