pgo-ui 1.0.92 → 1.0.93

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.0.92",
3
+ "version": "1.0.93",
4
4
  "description": "A Vue 3 component library with PGO design system",
5
5
  "private": false,
6
6
  "type": "module",
@@ -1,5 +1,15 @@
1
1
  <template>
2
2
  <div>
3
+ <!-- PDF viewer (self-contained — driven from card buttons with action="viewPdf") -->
4
+ <DocumentViewer
5
+ v-model="showViewer"
6
+ :src="pdfMeta.src"
7
+ :title="pdfMeta.title"
8
+ :show-download="pdfMeta.showDownload"
9
+ :show-print="pdfMeta.showPrint"
10
+ z-index="z-[99999999]"
11
+ />
12
+
3
13
  <!-- Loading bar -->
4
14
  <div v-if="loading" class="w-full h-1 bg-primary/20 overflow-hidden rounded">
5
15
  <div class="h-full bg-primary animate-[indeterminate_1.5s_infinite_ease-in-out] w-1/3 rounded" />
@@ -155,11 +165,12 @@
155
165
  </template>
156
166
 
157
167
  <script setup>
158
- import { computed, inject } from 'vue'
168
+ import { computed, inject, ref } from 'vue'
159
169
  import Card from './Card.vue'
160
170
  import Chip from './buttons/Chip.vue'
161
171
  import Button from './Button.vue'
162
172
  import Pagination from './Pagination.vue'
173
+ import DocumentViewer from './DocumentViewer.vue'
163
174
 
164
175
  const { language } = inject('i18n')
165
176
 
@@ -204,6 +215,15 @@
204
215
 
205
216
  const emit = defineEmits(['update:options', 'card-click', 'action-click'])
206
217
 
218
+ // --- PDF viewer state (driven by buttons with action="viewPdf") ---
219
+ const showViewer = ref(false)
220
+ const pdfMeta = ref({
221
+ src: '',
222
+ title: '',
223
+ showDownload: true,
224
+ showPrint: true,
225
+ })
226
+
207
227
  // --- Computed ---
208
228
  const stacks = computed(() => props.settings?.cardLayout?.stacks || [])
209
229
 
@@ -313,24 +333,42 @@
313
333
  })
314
334
  }
315
335
 
316
- const handleActionClick = (item, field) => {
317
- if (!field.linkKey) {
318
- emit('action-click', { item, field, url: null })
319
- return
320
- }
321
-
322
- let url
336
+ /**
337
+ * @param {Record<string, any>} item
338
+ * @param {Record<string, any>} field
339
+ */
340
+ const resolveButtonUrl = (item, field) => {
341
+ if (!field.linkKey) { return null }
323
342
  const linkKey = String(field.linkKey)
324
343
  if (linkKey.startsWith('/') || linkKey.startsWith('http')) {
325
344
  // URL template — interpolate :param and {param} placeholders with item values
326
- url = field.linkKey
345
+ return field.linkKey
327
346
  .replace(/:(\w+)/g, (_, key) => item[key] ?? key)
328
347
  .replace(/\{(\w+)\}/g, (_, key) => item[key] ?? key)
329
- } else {
330
- // Data path — extract URL from item
331
- url = getNestedValue(item, field.linkKey)
348
+ }
349
+ // Data path — extract URL from item
350
+ return getNestedValue(item, field.linkKey)
351
+ }
352
+
353
+ const handleActionClick = (item, field) => {
354
+ const url = resolveButtonUrl(item, field)
355
+
356
+ // PDF viewer action — handled locally, does not bubble to ListView
357
+ if (field.action === 'viewPdf') {
358
+ if (!url) { return }
359
+ pdfMeta.value = {
360
+ src: url,
361
+ title: field.titleKey
362
+ ? (getNestedValue(item, field.titleKey) ?? resolveLocalizedValue(field.label))
363
+ : resolveLocalizedValue(field.label),
364
+ showDownload: field.showDownload ?? true,
365
+ showPrint: field.showPrint ?? true,
366
+ }
367
+ showViewer.value = true
368
+ return
332
369
  }
333
370
 
371
+ // Default: bubble up so ListView can router.push / window.open
334
372
  emit('action-click', { item, field, url })
335
373
  }
336
374
  </script>
@@ -212,7 +212,7 @@
212
212
  ]"
213
213
  >
214
214
  <template v-if="getCustomColumnData(header, item)?.type === 'CopyTextBox'">
215
- <div :class="['flex flex-wrap items-center gap-1 font-en', header.columnView ? 'flex-col' : 'flex-row', ]">
215
+ <div :class="['flex flex-wrap gap-1 font-en', header.columnView ? 'flex-col' : 'flex-row items-center', ]">
216
216
  <template
217
217
  v-for="(chip, idx) in getCustomColumnData(header, item).CopyTextBox"
218
218
  :key="idx"
@@ -654,7 +654,24 @@ const handleFormSubmit = (msg) => {
654
654
  fetchData({ page: options.value.page, per_page: options.value.itemsPerPage })
655
655
  }
656
656
  const handleRefresh = (msg) => {
657
- fetchData()
657
+ quickFilterValues.value = {}
658
+ filterSectionValues.value = {}
659
+
660
+ // Reset options to initial state
661
+ options.value = {
662
+ ...options.value,
663
+ page: 1,
664
+ sortBy: [],
665
+ sortDesc: [],
666
+ }
667
+
668
+ const queryParams = {
669
+ page: 1,
670
+ per_page: options.value.itemsPerPage
671
+ }
672
+
673
+ fetchData(queryParams)
674
+ syncQueryParams(queryParams) // This removes filter/sort from URL since they're not in queryParams
658
675
  }
659
676
  // Handle quick search from searchbar
660
677
  const handleQuickSearch = (filters) => {
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./index-zHSlMjns.js";
2
- export {
3
- f as default
4
- };