@mythpe/quasar-ui-qui 0.4.18 → 0.4.19
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 +1 -1
- package/src/components/datatable/MDatatable.vue +101 -96
- package/src/components/datatable/MDtBtn.vue +7 -2
- package/src/components/datatable/MDtContextmenuItems.vue +5 -2
- package/src/style/m-dt.sass +1 -1
- package/src/types/m-datatable.d.ts +7 -1
- package/src/types/plugin-props-option.d.ts +1 -0
package/package.json
CHANGED
|
@@ -59,7 +59,7 @@ type Props = {
|
|
|
59
59
|
updateQueryParams?: boolean;
|
|
60
60
|
showRoute?: MDatatableProps['showRoute'];
|
|
61
61
|
showQueryParams?: boolean;
|
|
62
|
-
|
|
62
|
+
noMouse?: MDatatableProps['noMouse'];
|
|
63
63
|
noRefreshBtn?: boolean;
|
|
64
64
|
endReach?: boolean;
|
|
65
65
|
showSelection?: boolean;
|
|
@@ -70,7 +70,8 @@ type Props = {
|
|
|
70
70
|
ignoreKeys?: MDatatableProps['ignoreKeys'];
|
|
71
71
|
grid?: MDatatableProps['grid'];
|
|
72
72
|
title?: MDatatableProps['title'];
|
|
73
|
-
manageColumns?:
|
|
73
|
+
manageColumns?: MDatatableProps['manageColumns'];
|
|
74
|
+
manageColumnsInline?: MDatatableProps['manageColumnsInline'];
|
|
74
75
|
visibleColumns?: MDatatableProps['visibleColumns'];
|
|
75
76
|
searchColumns?: MDatatableProps['searchColumns'];
|
|
76
77
|
addTopBtn?: boolean;
|
|
@@ -104,6 +105,7 @@ type Props = {
|
|
|
104
105
|
importBtn?: MDatatableProps['importBtn'];
|
|
105
106
|
noExampleBtn?: MDatatableProps['noExampleBtn'];
|
|
106
107
|
wrapCells?: MDatatableProps['wrapCells'];
|
|
108
|
+
tooSmall?: MDatatableProps['tooSmall'];
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -141,7 +143,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
141
143
|
updateQueryParams: !1,
|
|
142
144
|
showRoute: undefined,
|
|
143
145
|
showQueryParams: !1,
|
|
144
|
-
|
|
146
|
+
noMouse: !1,
|
|
145
147
|
noRefreshBtn: !1,
|
|
146
148
|
endReach: !1,
|
|
147
149
|
showSelection: !1,
|
|
@@ -153,6 +155,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
153
155
|
grid: undefined,
|
|
154
156
|
title: undefined,
|
|
155
157
|
manageColumns: undefined,
|
|
158
|
+
manageColumnsInline: undefined,
|
|
156
159
|
visibleColumns: undefined,
|
|
157
160
|
searchColumns: undefined,
|
|
158
161
|
addTopBtn: undefined,
|
|
@@ -184,7 +187,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
184
187
|
align: 'left',
|
|
185
188
|
importBtn: undefined,
|
|
186
189
|
noExampleBtn: undefined,
|
|
187
|
-
wrapCells: undefined
|
|
190
|
+
wrapCells: undefined,
|
|
191
|
+
tooSmall: undefined
|
|
188
192
|
})
|
|
189
193
|
|
|
190
194
|
interface Emits {
|
|
@@ -515,6 +519,7 @@ const showIfContext = (contextBtn: GenericMDtBtn): boolean => {
|
|
|
515
519
|
}
|
|
516
520
|
return !1
|
|
517
521
|
}
|
|
522
|
+
const tooSmall = computed(() => props.tooSmall === 0 ? false : ($q.screen.height < (props.tooSmall || 600)))
|
|
518
523
|
defineOptions({
|
|
519
524
|
name: 'MDatatable',
|
|
520
525
|
inheritAttrs: !1
|
|
@@ -567,8 +572,8 @@ defineExpose({
|
|
|
567
572
|
'm-datatable-component',
|
|
568
573
|
{
|
|
569
574
|
'm-datatable-component__fixed': fixed === undefined ? ( pluginOptions?.datatable?.fixed === undefined ? undefined : pluginOptions.datatable?.fixed) : fixed,
|
|
570
|
-
'm-datatable-component__too_small':
|
|
571
|
-
'm-datatable-component__fab': hasAddBtn && (addFabBtn === undefined ? !!pluginOptions.datatable?.addFabBtn : addFabBtn)
|
|
575
|
+
'm-datatable-component__too_small': tooSmall,
|
|
576
|
+
'm-datatable-component__fab': hasAddBtn && (addFabBtn === undefined ? !!pluginOptions.datatable?.addFabBtn : addFabBtn),
|
|
572
577
|
}]"
|
|
573
578
|
>
|
|
574
579
|
<!-- Context Menu -->
|
|
@@ -605,7 +610,7 @@ defineExpose({
|
|
|
605
610
|
</MModalMenu>
|
|
606
611
|
|
|
607
612
|
<q-pull-to-refresh
|
|
608
|
-
:no-mouse="
|
|
613
|
+
:no-mouse="noMouse"
|
|
609
614
|
color="primary"
|
|
610
615
|
@refresh="refresh"
|
|
611
616
|
>
|
|
@@ -769,7 +774,10 @@ defineExpose({
|
|
|
769
774
|
</template>
|
|
770
775
|
<template #top="topSlotProps">
|
|
771
776
|
<MCol col="12">
|
|
772
|
-
<MContainer
|
|
777
|
+
<MContainer
|
|
778
|
+
:fluid="!1"
|
|
779
|
+
size="none"
|
|
780
|
+
>
|
|
773
781
|
<!--Top Slot-->
|
|
774
782
|
<slot
|
|
775
783
|
:dt="datatableItemsScope"
|
|
@@ -780,10 +788,7 @@ defineExpose({
|
|
|
780
788
|
v-bind="topSlotProps"
|
|
781
789
|
/>
|
|
782
790
|
<!--Title and Search-->
|
|
783
|
-
<MRow
|
|
784
|
-
:class="{hidden: !hasAddBtn && !getTableTitle && hideTitle && hideSearch}"
|
|
785
|
-
col
|
|
786
|
-
>
|
|
791
|
+
<MRow :class="{hidden: !hasAddBtn && !getTableTitle && hideTitle && hideSearch}">
|
|
787
792
|
<!--Default Title Slot-->
|
|
788
793
|
<slot
|
|
789
794
|
:dt="datatableItemsScope"
|
|
@@ -796,91 +801,86 @@ defineExpose({
|
|
|
796
801
|
v-if="!hideTitle"
|
|
797
802
|
col="12"
|
|
798
803
|
>
|
|
799
|
-
<q-
|
|
800
|
-
<
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
+
<div class="q-mb-sm">
|
|
805
|
+
<MRow class="justify-between">
|
|
806
|
+
<!--Back Button-->
|
|
807
|
+
<MCol
|
|
808
|
+
v-if="!noBackBtn"
|
|
809
|
+
auto
|
|
804
810
|
>
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
811
|
+
<q-btn
|
|
812
|
+
:icon="backIcon || `ion-ios-arrow-${$q.lang.rtl ? 'forward' : 'back'}`"
|
|
813
|
+
class="m-datatable__table-back-btn q-mr-sm"
|
|
814
|
+
flat
|
|
815
|
+
@click="$router.back()"
|
|
816
|
+
/>
|
|
817
|
+
</MCol>
|
|
818
|
+
<!--Table Title-->
|
|
819
|
+
<MCol col>
|
|
820
|
+
<div
|
|
821
|
+
v-if="!!getTableTitle"
|
|
822
|
+
:class="['text-h5 ellipsis m-datatable__table-title',titleClass]"
|
|
823
|
+
>
|
|
824
|
+
<span>{{ getTableTitle }}</span>
|
|
825
|
+
<span v-if="!!help">
|
|
826
|
+
<q-icon
|
|
827
|
+
class="cursor-pointer"
|
|
828
|
+
name="ion-ios-information-circle-outline"
|
|
829
|
+
right
|
|
830
|
+
size="18px"
|
|
831
|
+
>
|
|
832
|
+
<q-tooltip>
|
|
833
|
+
<div class="text-body1">
|
|
834
|
+
{{ __(help) }}
|
|
835
|
+
</div>
|
|
836
|
+
</q-tooltip>
|
|
837
|
+
</q-icon>
|
|
838
|
+
</span>
|
|
839
|
+
</div>
|
|
840
|
+
<slot
|
|
841
|
+
:dt="datatableItemsScope"
|
|
842
|
+
:form="useFormContext"
|
|
843
|
+
:index="dialogItemIndex"
|
|
844
|
+
:item="dialogItem"
|
|
845
|
+
name="subtitle"
|
|
809
846
|
>
|
|
810
|
-
<q-btn
|
|
811
|
-
:icon="backIcon || `ion-ios-arrow-${$q.lang.rtl ? 'forward' : 'back'}`"
|
|
812
|
-
class="m-datatable__table-back-btn"
|
|
813
|
-
flat
|
|
814
|
-
@click="$router.back()"
|
|
815
|
-
/>
|
|
816
|
-
</MCol>
|
|
817
|
-
<!--Table Title-->
|
|
818
|
-
<MCol col>
|
|
819
847
|
<div
|
|
820
|
-
v-if="!!
|
|
821
|
-
:class="['
|
|
848
|
+
v-if="!!subtitle"
|
|
849
|
+
:class="['m-datatable__table-subtitle',subtitleClass]"
|
|
822
850
|
>
|
|
823
|
-
|
|
824
|
-
<span v-if="!!help">
|
|
825
|
-
<q-icon
|
|
826
|
-
class="cursor-pointer"
|
|
827
|
-
name="ion-ios-information-circle-outline"
|
|
828
|
-
right
|
|
829
|
-
size="18px"
|
|
830
|
-
>
|
|
831
|
-
<q-tooltip>
|
|
832
|
-
<div class="text-body1">
|
|
833
|
-
{{ __(help) }}
|
|
834
|
-
</div>
|
|
835
|
-
</q-tooltip>
|
|
836
|
-
</q-icon>
|
|
837
|
-
</span>
|
|
851
|
+
{{ __(subtitle) }}
|
|
838
852
|
</div>
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
<!-- Add Btn -->
|
|
871
|
-
<MCol
|
|
872
|
-
v-if="hasAddBtn && (addTopBtn===undefined?(pluginOptions.datatable?.addTopBtn===undefined?!0:pluginOptions.datatable?.addTopBtn):addTopBtn)"
|
|
873
|
-
auto
|
|
874
|
-
>
|
|
875
|
-
<MBtn
|
|
876
|
-
:label="getFormTitle"
|
|
877
|
-
no-caps
|
|
878
|
-
@click="openCreateDialog()"
|
|
879
|
-
/>
|
|
880
|
-
</MCol>
|
|
881
|
-
</MRow>
|
|
882
|
-
</q-card-section>
|
|
883
|
-
</q-card>
|
|
853
|
+
</slot>
|
|
854
|
+
</MCol>
|
|
855
|
+
<div class="flex-break xs" />
|
|
856
|
+
<!--Import Btn-->
|
|
857
|
+
<MCol
|
|
858
|
+
v-if="!!importBtn"
|
|
859
|
+
auto
|
|
860
|
+
>
|
|
861
|
+
<MDtBtn
|
|
862
|
+
color="green"
|
|
863
|
+
icon="far fa-file-excel"
|
|
864
|
+
label="labels.import"
|
|
865
|
+
no-caps
|
|
866
|
+
text-color="white"
|
|
867
|
+
@click="onOpenImportDialog()"
|
|
868
|
+
/>
|
|
869
|
+
</MCol>
|
|
870
|
+
<!-- Add Btn -->
|
|
871
|
+
<MCol
|
|
872
|
+
v-if="hasAddBtn && (addTopBtn===undefined?(pluginOptions.datatable?.addTopBtn===undefined?!0:pluginOptions.datatable?.addTopBtn):addTopBtn)"
|
|
873
|
+
auto
|
|
874
|
+
>
|
|
875
|
+
<MBtn
|
|
876
|
+
:label="getFormTitle"
|
|
877
|
+
no-caps
|
|
878
|
+
@click="openCreateDialog()"
|
|
879
|
+
/>
|
|
880
|
+
</MCol>
|
|
881
|
+
<q-space class="xs" />
|
|
882
|
+
</MRow>
|
|
883
|
+
</div>
|
|
884
884
|
</MCol>
|
|
885
885
|
</slot>
|
|
886
886
|
<slot
|
|
@@ -1037,11 +1037,11 @@ defineExpose({
|
|
|
1037
1037
|
name="bottom-search"
|
|
1038
1038
|
/>
|
|
1039
1039
|
</MRow>
|
|
1040
|
-
|
|
1041
1040
|
<!--Buttons-->
|
|
1042
1041
|
<MRow
|
|
1043
1042
|
class="items-center justify-between m-datatable__table-top-buttons"
|
|
1044
1043
|
gutter="xs"
|
|
1044
|
+
style="margin-top: 5px;"
|
|
1045
1045
|
>
|
|
1046
1046
|
<MCol auto>
|
|
1047
1047
|
<MRow
|
|
@@ -1217,14 +1217,18 @@ defineExpose({
|
|
|
1217
1217
|
</template>
|
|
1218
1218
|
</MRow>
|
|
1219
1219
|
</MCol>
|
|
1220
|
-
|
|
1220
|
+
|
|
1221
|
+
<MCol
|
|
1222
|
+
v-if="computedNoWrapBtn || manageColumns"
|
|
1223
|
+
auto
|
|
1224
|
+
>
|
|
1221
1225
|
<MRow
|
|
1222
1226
|
class="items-center"
|
|
1223
1227
|
gutter="xs"
|
|
1224
1228
|
>
|
|
1225
1229
|
<!-- Manage Columns -->
|
|
1226
1230
|
<MDtBtn
|
|
1227
|
-
v-if="manageColumns"
|
|
1231
|
+
v-if="manageColumns && !manageColumnsInline"
|
|
1228
1232
|
key="manage-columns-btn"
|
|
1229
1233
|
:disable="loading"
|
|
1230
1234
|
color="primary"
|
|
@@ -1301,7 +1305,7 @@ defineExpose({
|
|
|
1301
1305
|
|
|
1302
1306
|
<!-- Manage Columns -->
|
|
1303
1307
|
<MRow
|
|
1304
|
-
v-if="manageColumns &&
|
|
1308
|
+
v-if="manageColumns && manageColumnsInline"
|
|
1305
1309
|
class="items-center m-datatable__table-manage-columns"
|
|
1306
1310
|
>
|
|
1307
1311
|
<q-list
|
|
@@ -1450,6 +1454,7 @@ defineExpose({
|
|
|
1450
1454
|
:index="noBodyProps.rowIndex"
|
|
1451
1455
|
:item="noBodyProps.row"
|
|
1452
1456
|
:items="contextmenuItems"
|
|
1457
|
+
:no-icons="pluginOptions.dt?.contextmenu?.btnStyle?.noIcons"
|
|
1453
1458
|
/>
|
|
1454
1459
|
</MRow>
|
|
1455
1460
|
</div>
|
|
@@ -28,6 +28,7 @@ interface Props {
|
|
|
28
28
|
round?: boolean | undefined;
|
|
29
29
|
dense?: boolean | undefined;
|
|
30
30
|
fabMini?: boolean | undefined;
|
|
31
|
+
noIcons?: boolean;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -42,7 +43,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
42
43
|
label: undefined,
|
|
43
44
|
round: undefined,
|
|
44
45
|
dense: undefined,
|
|
45
|
-
fabMini: undefined
|
|
46
|
+
fabMini: undefined,
|
|
47
|
+
noIcons: undefined
|
|
46
48
|
})
|
|
47
49
|
type Events = {
|
|
48
50
|
(e: 'click', evt: Event): void;
|
|
@@ -66,6 +68,9 @@ const getTooltip = computed(() => {
|
|
|
66
68
|
return props.tooltip
|
|
67
69
|
})
|
|
68
70
|
const getIcon = computed(() => {
|
|
71
|
+
if (props.noIcons) {
|
|
72
|
+
return undefined
|
|
73
|
+
}
|
|
69
74
|
if (props.show) {
|
|
70
75
|
return 'ion-ios-eye'
|
|
71
76
|
} else if (props.update) {
|
|
@@ -141,8 +146,8 @@ defineOptions({
|
|
|
141
146
|
<q-btn
|
|
142
147
|
v-else
|
|
143
148
|
v-bind="{
|
|
144
|
-
...pluginOptions.dt?.MDtBtn?.btn?.props,
|
|
145
149
|
...$attrs,
|
|
150
|
+
...pluginOptions.dt?.MDtBtn?.btn?.props,
|
|
146
151
|
fabMini: fabMini !== undefined ? fabMini : ( pluginOptions.dt?.btn?.fabMini !== undefined ? pluginOptions.dt.btn.fabMini : label === undefined),
|
|
147
152
|
round: round !== undefined ? round : ( pluginOptions.dt?.btn?.round !== undefined ? pluginOptions.dt.btn.round : label === undefined),
|
|
148
153
|
dense: dense !== undefined ? dense : ( pluginOptions.dt?.btn?.dense !== undefined ? pluginOptions.dt.btn.dense : label === undefined),
|
|
@@ -21,14 +21,16 @@ interface Props {
|
|
|
21
21
|
items: MDatatableProps['contextItems'],
|
|
22
22
|
item: UnwrapRef<MDatatableDialogsOptions['item']>,
|
|
23
23
|
index: UnwrapRef<MDatatableDialogsOptions['index']>,
|
|
24
|
-
displayMode?: 'icon' | 'item'
|
|
24
|
+
displayMode?: 'icon' | 'item',
|
|
25
|
+
noIcons?: boolean
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
const props = withDefaults(defineProps<Props>(), {
|
|
28
29
|
items: () => ([]),
|
|
29
30
|
item: undefined,
|
|
30
31
|
index: undefined,
|
|
31
|
-
displayMode: () => 'icon'
|
|
32
|
+
displayMode: () => 'icon',
|
|
33
|
+
noIcons: undefined
|
|
32
34
|
})
|
|
33
35
|
const itemMode = computed(() => props.displayMode === 'item')
|
|
34
36
|
const { __ } = useMyth()
|
|
@@ -52,6 +54,7 @@ defineOptions({
|
|
|
52
54
|
(te(`labels.${m.name}`)?__(`labels.${m.name}`):__(m.tooltip || m.attr?.label || m.attr?.tooltip || m.name))
|
|
53
55
|
: ( m.label !== undefined ? (typeof m.label === 'function' ? m.label(item,index) : ( __(m.label || m.name)) ) : undefined ) "
|
|
54
56
|
:list-item="itemMode"
|
|
57
|
+
:no-icons="noIcons"
|
|
55
58
|
:tooltip="m.tooltip !== undefined ? (typeof m.tooltip === 'function' ? m.tooltip(item,index) : m.tooltip) : (m.label === undefined ? ( te(`labels.${m.name}`) ? `labels.${m.name}` : undefined) : undefined)"
|
|
56
59
|
dense
|
|
57
60
|
flat
|
package/src/style/m-dt.sass
CHANGED
|
@@ -126,6 +126,7 @@ export interface MDtBtnProps extends MBtnProps {
|
|
|
126
126
|
round?: boolean;
|
|
127
127
|
dense?: boolean;
|
|
128
128
|
label?: string | undefined;
|
|
129
|
+
noIcons?: boolean;
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
export interface MDtBtnSlots extends MBtnSlots {
|
|
@@ -263,7 +264,7 @@ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = O
|
|
|
263
264
|
updateQueryParams?: boolean;
|
|
264
265
|
showRoute?: string | RouteLocationRaw;
|
|
265
266
|
showQueryParams?: boolean;
|
|
266
|
-
|
|
267
|
+
noMouse?: boolean;
|
|
267
268
|
noRefreshBtn?: boolean;
|
|
268
269
|
endReach?: boolean;
|
|
269
270
|
showSelection?: boolean;
|
|
@@ -273,6 +274,7 @@ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = O
|
|
|
273
274
|
rowsPerPageOptions?: (string | number)[];
|
|
274
275
|
ignoreKeys?: string[] | ((form: Record<string, any>) => string[]) | any[];
|
|
275
276
|
manageColumns?: boolean;
|
|
277
|
+
manageColumnsInline?: boolean;
|
|
276
278
|
visibleColumns?: (string | null | undefined)[] | any[];
|
|
277
279
|
searchColumns?: string[];
|
|
278
280
|
/**
|
|
@@ -368,6 +370,10 @@ export type MDatatableProps<I extends GenericFormValues = GenericFormValues> = O
|
|
|
368
370
|
* Align all table columns to the left, center, or right.
|
|
369
371
|
*/
|
|
370
372
|
align?: 'left' | 'right' | 'center';
|
|
373
|
+
/**
|
|
374
|
+
* too small a screen size in px.
|
|
375
|
+
*/
|
|
376
|
+
tooSmall?: number;
|
|
371
377
|
}
|
|
372
378
|
|
|
373
379
|
export interface MDtAvatarProps extends QAvatarProps {
|