| | |
| | | deptOptions: [], |
| | | }); |
| | | |
| | | async function ensureForFields(fields) { |
| | | const sources = collectOptionSourcesFromFields(fields); |
| | | async function ensureForFields(fields, context = {}) { |
| | | const sources = collectOptionSourcesFromFields(fields, context); |
| | | if (!sources.length) return; |
| | | loading.value = true; |
| | | try { |
| | | const next = await fetchSelectOptionCaches(sources); |
| | | caches.users = next.users; |
| | | caches.deptOptions = next.deptOptions; |
| | | caches.employees = next.employees || []; |
| | | } finally { |
| | | loading.value = false; |
| | | } |
| | | } |
| | | |
| | | function getOptions(field) { |
| | | return resolveFieldSelectOptions(field, caches); |
| | | function getOptions(field, context = {}) { |
| | | return resolveFieldSelectOptions(field, caches, context); |
| | | } |
| | | |
| | | function getDisplayLabel(field, val) { |
| | | return resolveSelectDisplayLabel(field, val, caches); |
| | | function getDisplayLabel(field, val, context = {}) { |
| | | return resolveSelectDisplayLabel(field, val, caches, context); |
| | | } |
| | | |
| | | return { |