@mythpe/quasar-ui-qui 0.1.12 → 0.1.14

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.12",
3
+ "version": "0.1.14",
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)
@@ -1745,9 +1757,11 @@ defineOptions({
1745
1757
  >
1746
1758
  <MDtBtn
1747
1759
  v-if="(typeof contextBtn.showIf === 'function' ? contextBtn.showIf(tableOptions.selected[0],0) : contextBtn.showIf) && ( (contextBtn.click && isSingleSelectedItem) || (contextBtn.multiClick && !isSingleSelectedItem) )"
1748
- :tooltip="__(contextBtn.tooltip || contextBtn.name)"
1760
+ :tooltip="__(contextBtn.tooltip || contextBtn.label || contextBtn.name)"
1749
1761
  v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn,...contextBtn,...contextBtn.attr}"
1750
- @click="contextBtn.click ? contextBtn.click(tableOptions.selected[0],0) : (contextBtn.multiClick ? contextBtn.multiClick(tableOptions.selected) : undefined)"
1762
+ @click="contextBtn.multiClick && tableOptions.selected.length > 1 ? contextBtn.multiClick(tableOptions.selected) : (
1763
+ contextBtn.click ? contextBtn.click(tableOptions.selected[0],0) : undefined
1764
+ )"
1751
1765
  />
1752
1766
  </template>
1753
1767
  </template>
@@ -40,7 +40,7 @@ const props = withDefaults(defineProps<P>(), {
40
40
  service: undefined,
41
41
  guest: undefined,
42
42
  requestWith: undefined,
43
- params: () => () => ({}),
43
+ params: () => ({}),
44
44
  lazy: () => !1,
45
45
  useChoice: undefined
46
46
  })
@@ -106,7 +106,7 @@ onMounted(() => {
106
106
  prepare()
107
107
  }
108
108
  })
109
- watch(props.params, () => prepare(!0), { deep: !0 })
109
+ watch(() => toValue(props.params), () => prepare(!0), { deep: !0 })
110
110
  const input = useTemplateRef<InstanceType<typeof MSelect>>('input')
111
111
  defineExpose<{ input: typeof input }>({ input })
112
112
  defineOptions({ name: 'MAxios', inheritAttrs: !1 })