pgo-ui 1.1.13 → 1.1.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgo-ui",
3
- "version": "1.1.13",
3
+ "version": "1.1.16",
4
4
  "description": "A Vue 3 component library with PGO design system",
5
5
  "private": false,
6
6
  "type": "module",
@@ -351,7 +351,7 @@
351
351
  })
352
352
  function selectLanguage(lang: string) {
353
353
  if (typeof setLanguage === 'function') setLanguage(lang)
354
- // window.location.reload()
354
+ window.location.reload()
355
355
  isLangOpen.value = false
356
356
  }
357
357
 
@@ -855,6 +855,16 @@ const initializeAllFunctions = () => {
855
855
 
856
856
  if (props.settings?.functions) {
857
857
 
858
+ // Helper function to set a value on an item (DataTable equivalent of DynamicForm's setFieldValue)
859
+ const setFieldValue = (key, value) => {
860
+ // In DataTable context, this sets a value on tableVariables
861
+ tableVariables[key] = value
862
+ }
863
+
864
+ const getFieldValue = (key) => {
865
+ return tableVariables[key]
866
+ }
867
+
858
868
  const functionContext = {
859
869
  items: props.items,
860
870
  headers: headers.value,
@@ -868,9 +878,8 @@ const initializeAllFunctions = () => {
868
878
  console,
869
879
  snackbar: snackbar,
870
880
  api: api,
871
- this: {
872
- variables: tableVariables
873
- }
881
+ setFieldValue,
882
+ getFieldValue,
874
883
  }
875
884
 
876
885
  compiledFunctions.value = initializeFunctions(props.settings.functions, functionContext)
@@ -898,12 +907,12 @@ const executeFunction = (functionName, ...args) => {
898
907
  const getCustomColumnData = (header, item) => {
899
908
 
900
909
  if (header.columnData && (header.displayType === 'html' || header.displayType === 'custom')) {
901
- // Extract function name from columnData (e.g., "customeColumnData(item)")
902
910
  const functionMatch = header.columnData.match(/(\w+)\(/)
903
911
  if (functionMatch) {
904
912
  const functionName = functionMatch[1]
905
- // Execute the compiled function with the item data as the first argument
906
- const result = executeFunction(functionName, item)
913
+ // Pass item as BOTH first arg (response) and second arg (item)
914
+ // so the function body can access it as 'item'
915
+ const result = executeFunction(functionName, item, item)
907
916
  return result || ''
908
917
  }
909
918
  }