@mythpe/quasar-ui-qui 0.3.72 → 0.3.73

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.3.72",
3
+ "version": "0.3.73",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -23,6 +23,7 @@ import MDtColorColumn from './MDtColorColumn.vue'
23
23
  import MDtSarColumn from './MDtSarColumn.vue'
24
24
  import MDtCopyColumn from './MDtCopyColumn.vue'
25
25
  import { useRouter } from 'vue-router'
26
+ import MDtContextmenuItems from './MDtContextmenuItems.vue'
26
27
 
27
28
  type Props = {
28
29
  controlKey?: MDatatableProps['controlKey'];
@@ -474,13 +475,33 @@ const mainAttrs = computed(() => ({
474
475
  wrapCells: wrapCellsRef.value
475
476
  }))
476
477
  const attrs = useAttrs()
477
- console.log(attrs)
478
478
  const bindAttr = computed(() => ({
479
479
  virtualScroll: !0,
480
480
  ...pluginOptions.value.datatable as any,
481
481
  ...attrs as any,
482
482
  ...mainAttrs.value as any
483
483
  }))
484
+ const showIfContext = (contextBtn: GenericMDtBtn): boolean => {
485
+ contextBtn = toValue(contextBtn)
486
+ if (selected.value.length === 0) {
487
+ const per = typeof contextBtn.showIf === 'function' ? contextBtn.showIf(selected.value[0], 0) : contextBtn.showIf === !0
488
+ const single = (!!contextBtn.click || !!contextBtn.attr?.to)
489
+ const multi = !!contextBtn.multiClick
490
+ return per && (single || multi)
491
+ }
492
+ if (!contextBtn.multiClick) {
493
+ return !1
494
+ }
495
+ // console.log(typeof contextBtn.showIf, contextBtn.name)
496
+ for (let idx = 0; idx < selected.value.length; idx++) {
497
+ const item = toValue(selected.value[idx])
498
+ const per = typeof contextBtn.showIf === 'function' ? contextBtn.showIf(item, idx) : contextBtn.showIf === !0
499
+ if (per) {
500
+ return !0
501
+ }
502
+ }
503
+ return !1
504
+ }
484
505
  defineOptions({
485
506
  name: 'MDatatable',
486
507
  inheritAttrs: !1
@@ -1151,8 +1172,7 @@ defineExpose({
1151
1172
  :key="`top-s-${i}`"
1152
1173
  >
1153
1174
  <MDtBtn
1154
- v-if="(typeof contextBtn.showIf === 'function' ? contextBtn.showIf(selected[0],0) : contextBtn.showIf !==!1) && ( ((!!contextBtn.click || !!contextBtn.attr?.to) && isSingleSelectedItem)
1155
- || (contextBtn.multiClick && !isSingleSelectedItem) )"
1175
+ v-if="showIfContext(contextBtn)"
1156
1176
  :tooltip="contextBtn.tooltip?__(contextBtn.tooltip):(contextBtn.label?(te(`labels.${contextBtn.label}`) ?
1157
1177
  __(`labels.${contextBtn.label}`) : __(contextBtn.label) ):undefined)"
1158
1178
  v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn as any,...contextBtn as any,...contextBtn.attr as any,to: typeof contextBtn.attr?.to === 'function' ? contextBtn.attr.to(selected[0],0) : contextBtn.attr?.to}"