@mythpe/quasar-ui-qui 0.1.11 → 0.1.13

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": "@mythpe/quasar-ui-qui",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -282,12 +282,17 @@ const resetDialogs = () => {
282
282
  /** Table */
283
283
 
284
284
  /** --- */
285
- const headersProp = computed(() => props.headers)
286
- const getHeaders = computed<any[]>(() => parseHeaders(headersProp.value, reactive({ noSort: props.imageColumns })) || [])
287
- const visibleHeaders = ref<string[]>(parseHeaders(props.visibleColumns || headersProp.value).map(e => e.name))
288
- watch(() => toValue(props.visibleColumns), v => {
285
+ const getHeaders = computed<any[]>(() => parseHeaders(toValue(props.headers), { noSort: props.imageColumns }) || [])
286
+ const visibleHeaders = ref<string[]>([])
287
+ watch([
288
+ () => toValue(props.visibleColumns),
289
+ () => toValue(props.headers)
290
+ ], ([v]) => {
291
+ if (!v) {
292
+ v = toValue(getHeaders)
293
+ }
289
294
  visibleHeaders.value = v ? parseHeaders(v).map(e => e.name) : []
290
- }, { deep: !0 })
295
+ }, { deep: !0, immediate: !0 })
291
296
  /** --- */
292
297
 
293
298
  const selected = ref<MDtItem[]>([])
@@ -300,10 +305,18 @@ const onUpdateSelectedItems = () => {
300
305
  const meta = ref<MDatatableMetaServer>({ ...initMetaServer })
301
306
  const pagination = ref<MDatatablePagination>({ ...initPaginationOptions })
302
307
  const search = ref<string | null>(null)
303
- const searchColumnsProp = computed(() => props.searchColumns)
304
- const searchColumnsRef = ref<string[]>(parseHeaders(searchColumnsProp.value || headersProp.value)
305
- .filter(e => e?.field !== props.controlKey)
306
- .map(e => e.name))
308
+ const searchColumnsRef = ref<string[]>([])
309
+ watch([
310
+ () => toValue(props.searchColumns),
311
+ () => toValue(props.headers)
312
+ ], ([v]) => {
313
+ if (!v) {
314
+ v = toValue(getHeaders) as any
315
+ }
316
+ searchColumnsRef.value = parseHeaders(v as any)
317
+ .filter(e => e?.field !== props.controlKey)
318
+ .map(e => e.name)
319
+ }, { deep: !0, immediate: !0 })
307
320
  const searchPlaceholder = computed<string>(() => {
308
321
  if (searchColumnsRef.value.length > 0) {
309
322
  return __('myth.datatable.searchInputPlaceholder',
@@ -478,12 +491,10 @@ const getDatatableParams = ({
478
491
  pagination,
479
492
  filter
480
493
  }: FetchRowsArgs = {}, merge: Partial<ApiServiceParams> = {}): ApiServiceParams => {
494
+ const headerItems = getHeaders.value.map((e: any) => e.name).join(',')
495
+ // console.log(headerItems)
481
496
  let params: ApiServiceParams = {
482
- // filter: tableOptions.filter,
483
- // search: filter || undefined,
484
- headerItems: getHeaders.value.map((e: any) => e.name).join(','),
485
- // headers: ['name'],
486
- // ids: tableOptions.selected.map((e: any) => e.id),
497
+ headerItems,
487
498
  indexType: 'index',
488
499
  fdt: 'i',
489
500
  itemsPerPage: pagination?.rowsPerPage === 0 ? -1 : (pagination?.rowsPerPage !== undefined ? pagination?.rowsPerPage : 0),
@@ -589,6 +600,7 @@ const exportData = (type: MDtExportOptions) => {
589
600
  const ex = async () => {
590
601
  loading.value = !0
591
602
  const toBLob = exportToBlob.value === !0 || exportToBlob.value === type
603
+ const headerItems = getHeaders.value.filter(e => e?.field !== props.controlKey && visibleHeaders.value.indexOf(e.name) !== -1)
592
604
  const data = getDatatableParams({
593
605
  pagination: tableOptions.pagination,
594
606
  filter: tableOptions.search
@@ -596,7 +608,7 @@ const exportData = (type: MDtExportOptions) => {
596
608
  indexType: type,
597
609
  fdt: 'e',
598
610
  toUrl: toBLob === !0 ? !1 : exportToBlob.value !== type,
599
- headerItems: getHeaders.value.filter(e => e?.field !== props.controlKey && visibleHeaders.value.indexOf(e.name) !== -1)
611
+ headerItems
600
612
  })
601
613
  if (tableOptions.selected.length > 0) {
602
614
  data.ids = tableOptions.selected.map((e: any) => e.id)
@@ -1815,7 +1827,7 @@ defineOptions({
1815
1827
  <span>
1816
1828
  {{ getHeaders.find(e => e.name === filterKey)?.label || __(`attributes.${filterKey}`) }}
1817
1829
  </span>
1818
- <span v-if="typeof filterValue === 'boolean'">: {{ __(filterValue ? 'yes' : 'no') }}</span>
1830
+ <span v-if="typeof filterValue === 'boolean'">: {{ __(`labels.${filterValue ? 'yes' : 'no'}`) }}</span>
1819
1831
  <span v-else-if="typeof filterValue === 'string'">: {{ filterValue }}</span>
1820
1832
  <span
1821
1833
  v-else-if="lodash.isArray(filterValue) && !quasarHelpers.object(filterValue[0])"