@mythpe/quasar-ui-qui 0.0.70 → 0.0.72
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
|
@@ -33,6 +33,7 @@ import { is as quasarHelpers, QCardSection, QTable, useQuasar } from 'quasar'
|
|
|
33
33
|
import lodash from 'lodash'
|
|
34
34
|
import { useRoute, useRouter } from 'vue-router'
|
|
35
35
|
import { useMyth } from '../../composable'
|
|
36
|
+
import { useI18n } from 'vue-i18n'
|
|
36
37
|
|
|
37
38
|
const initPaginationOptions: MDatatablePagination = {
|
|
38
39
|
sortBy: undefined,
|
|
@@ -184,11 +185,22 @@ const {
|
|
|
184
185
|
isSmall,
|
|
185
186
|
api
|
|
186
187
|
} = useMyth()
|
|
188
|
+
|
|
187
189
|
const slots = useSlots()
|
|
188
190
|
const router = useRouter()
|
|
189
191
|
const route = useRoute()
|
|
190
192
|
const $q = useQuasar()
|
|
193
|
+
const { te } = useI18n({ useScope: 'global' })
|
|
191
194
|
const defaultItem = computed(() => props.defaultItem)
|
|
195
|
+
const getTableTitle = computed(() => {
|
|
196
|
+
if (props.title) {
|
|
197
|
+
if (te(props.title)) {
|
|
198
|
+
return __(props.title)
|
|
199
|
+
}
|
|
200
|
+
return __('replace.index', { name: __(props.title) })
|
|
201
|
+
}
|
|
202
|
+
return undefined
|
|
203
|
+
})
|
|
192
204
|
const formRef = useForm<any, any>()
|
|
193
205
|
const formScope = reactive(formRef)
|
|
194
206
|
const { resetForm: resetDialogForm, setValues, handleSubmit } = formRef
|
|
@@ -286,8 +298,7 @@ const search = ref<string | null>(null)
|
|
|
286
298
|
const searchColumnsProp = computed(() => props.searchColumns)
|
|
287
299
|
const searchColumnsRef = ref<string[]>(parseHeaders(searchColumnsProp.value || headersProp.value)
|
|
288
300
|
.filter(e => e?.field !== props.controlKey)
|
|
289
|
-
.map(
|
|
290
|
-
e => e.name))
|
|
301
|
+
.map(e => e.name))
|
|
291
302
|
const searchPlaceholder = computed<string>(() => {
|
|
292
303
|
if (searchColumnsRef.value.length > 0) {
|
|
293
304
|
return __('myth.datatable.searchInputPlaceholder',
|
|
@@ -455,7 +466,10 @@ const getRequestWith = (type: 'withIndex' | 'withShow' | 'withUpdate' | 'withSto
|
|
|
455
466
|
}
|
|
456
467
|
return v.join(',') ?? null
|
|
457
468
|
}
|
|
458
|
-
const getDatatableParams = ({
|
|
469
|
+
const getDatatableParams = ({
|
|
470
|
+
pagination,
|
|
471
|
+
filter
|
|
472
|
+
}: FetchRowsArgs = {}, merge: Partial<ApiServiceParams> = {}): ApiServiceParams => {
|
|
459
473
|
let params: ApiServiceParams = {
|
|
460
474
|
// filter: tableOptions.filter,
|
|
461
475
|
// search: filter || undefined,
|
|
@@ -623,15 +637,16 @@ const openDialogTimeout = 100
|
|
|
623
637
|
* Filter Dialog
|
|
624
638
|
*/
|
|
625
639
|
const openFilterDialog = () => {
|
|
626
|
-
|
|
627
|
-
tempFilterForm.value = { ...tableOptions.filter }
|
|
628
|
-
}
|
|
629
|
-
const saveFilterDialog = () => {
|
|
630
|
-
filterForm.value = { ...tableOptions.tempFilter }
|
|
640
|
+
resetDialogForm({ values: {}, errors: {} }, { force: !0 })
|
|
631
641
|
nextTick(() => {
|
|
632
|
-
|
|
642
|
+
tempFilterForm.value = { ...tableOptions.filter }
|
|
643
|
+
dialogs.filter = !0
|
|
633
644
|
})
|
|
634
645
|
}
|
|
646
|
+
const saveFilterDialog = () => {
|
|
647
|
+
dialogs.filter = !1
|
|
648
|
+
nextTick(() => (filterForm.value = { ...tableOptions.tempFilter }))
|
|
649
|
+
}
|
|
635
650
|
const closeFilterDialog = () => {
|
|
636
651
|
dialogs.filter = !1
|
|
637
652
|
tempFilterForm.value = { ...tableOptions.filter }
|
|
@@ -1107,8 +1122,7 @@ const getShowSelection = computed<boolean | undefined>(() => {
|
|
|
1107
1122
|
})
|
|
1108
1123
|
const defaultTopBtnProps: any = {
|
|
1109
1124
|
dense: !0,
|
|
1110
|
-
flat: !0
|
|
1111
|
-
fabMini: !0
|
|
1125
|
+
flat: !0
|
|
1112
1126
|
}
|
|
1113
1127
|
const table = ref<InstanceType<typeof QTable>>()
|
|
1114
1128
|
defineExpose({
|
|
@@ -1227,7 +1241,6 @@ defineOptions({
|
|
|
1227
1241
|
:rows="getRows"
|
|
1228
1242
|
:rows-per-page-options="getRowsPerPageOptions"
|
|
1229
1243
|
:selection="getShowSelection ? (multiSelection ? 'multiple' : 'single') : 'none'"
|
|
1230
|
-
:title="title"
|
|
1231
1244
|
:visible-columns="visibleHeaders"
|
|
1232
1245
|
card-container-class="m--datatable-container"
|
|
1233
1246
|
table-class="m--datatable-container"
|
|
@@ -1236,6 +1249,7 @@ defineOptions({
|
|
|
1236
1249
|
wrapCells:!0,
|
|
1237
1250
|
...pluginOptions.datatable,
|
|
1238
1251
|
...$attrs,
|
|
1252
|
+
title: getTableTitle,
|
|
1239
1253
|
bordered: bordered === undefined ? pluginOptions.datatable?.bordered : bordered,
|
|
1240
1254
|
dense: dense === undefined ? ( theme.inputs.dense !== undefined ? theme.inputs.dense : pluginOptions.datatable?.dense) : dense,
|
|
1241
1255
|
flat: flat === undefined ? pluginOptions.datatable?.flat : flat,
|
|
@@ -1401,13 +1415,29 @@ defineOptions({
|
|
|
1401
1415
|
name="title"
|
|
1402
1416
|
>
|
|
1403
1417
|
<MCol
|
|
1404
|
-
v-if="!!
|
|
1418
|
+
v-if="!!getTableTitle"
|
|
1405
1419
|
col="12"
|
|
1406
1420
|
>
|
|
1407
|
-
<div
|
|
1408
|
-
class="
|
|
1409
|
-
|
|
1410
|
-
|
|
1421
|
+
<div class="row justify-between q-col-gutter-md">
|
|
1422
|
+
<div class="col">
|
|
1423
|
+
<div class="text-h5 bordered-bottom ellipsis">
|
|
1424
|
+
{{ getTableTitle }}
|
|
1425
|
+
</div>
|
|
1426
|
+
</div>
|
|
1427
|
+
|
|
1428
|
+
<!-- Add Btn -->
|
|
1429
|
+
<template
|
|
1430
|
+
v-if="hasAddBtn && (addTopBtn===undefined?(pluginOptions.datatable?.addTopBtn===undefined?!0:pluginOptions.datatable?.addTopBtn):addTopBtn)"
|
|
1431
|
+
>
|
|
1432
|
+
<div class="col-auto">
|
|
1433
|
+
<MBtn
|
|
1434
|
+
:label="getFormTitle"
|
|
1435
|
+
no-caps
|
|
1436
|
+
@click="openCreateDialog()"
|
|
1437
|
+
/>
|
|
1438
|
+
</div>
|
|
1439
|
+
</template>
|
|
1440
|
+
</div>
|
|
1411
1441
|
</MCol>
|
|
1412
1442
|
</slot>
|
|
1413
1443
|
<slot
|
|
@@ -1518,7 +1548,7 @@ defineOptions({
|
|
|
1518
1548
|
/>
|
|
1519
1549
|
</MRow>
|
|
1520
1550
|
<!--Buttons-->
|
|
1521
|
-
<MRow class="row q-gutter-x-sm q-gutter-xs-y-sm items-center
|
|
1551
|
+
<MRow class="row q-gutter-x-sm q-gutter-xs-y-sm items-center">
|
|
1522
1552
|
<!--More Menu-->
|
|
1523
1553
|
<MDtBtn
|
|
1524
1554
|
v-if="hasMenu"
|
|
@@ -1526,11 +1556,12 @@ defineOptions({
|
|
|
1526
1556
|
:disable="tableOptions.loading"
|
|
1527
1557
|
icon="ion-ios-options"
|
|
1528
1558
|
tooltip="myth.datatable.hints.more"
|
|
1559
|
+
label="myth.datatable.hints.options"
|
|
1529
1560
|
v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.buttons?.more}"
|
|
1530
1561
|
>
|
|
1531
1562
|
<MModalMenu
|
|
1532
1563
|
:offset="[10,10]"
|
|
1533
|
-
position="
|
|
1564
|
+
position="bottom"
|
|
1534
1565
|
v-bind="pluginOptions.dt?.buttons?.moreMenu as any"
|
|
1535
1566
|
>
|
|
1536
1567
|
<q-list
|
|
@@ -1639,12 +1670,14 @@ defineOptions({
|
|
|
1639
1670
|
key="filter-selection-btn"
|
|
1640
1671
|
icon="o_filter_alt"
|
|
1641
1672
|
tooltip="myth.datatable.hints.filter"
|
|
1673
|
+
label="myth.datatable.hints.filter"
|
|
1642
1674
|
v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.buttons?.filter}"
|
|
1643
1675
|
@click="openFilterDialog()"
|
|
1644
1676
|
>
|
|
1645
1677
|
<MModalMenu
|
|
1646
1678
|
no-close-btn
|
|
1647
1679
|
persistent
|
|
1680
|
+
position="top"
|
|
1648
1681
|
v-bind="pluginOptions.dt?.filterDialogProps"
|
|
1649
1682
|
>
|
|
1650
1683
|
<q-card
|
|
@@ -1726,7 +1759,6 @@ defineOptions({
|
|
|
1726
1759
|
v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.buttons?.fullscreen}"
|
|
1727
1760
|
@click="tableOptions.fullscreen = !tableOptions.fullscreen"
|
|
1728
1761
|
/>
|
|
1729
|
-
|
|
1730
1762
|
<template v-if="hasSelectedItem">
|
|
1731
1763
|
<MDtBtn
|
|
1732
1764
|
v-if="hasUpdateBtn && isSingleSelectedItem"
|
|
@@ -1768,18 +1800,6 @@ defineOptions({
|
|
|
1768
1800
|
/>
|
|
1769
1801
|
</template>
|
|
1770
1802
|
</template>
|
|
1771
|
-
|
|
1772
|
-
<q-space />
|
|
1773
|
-
<!-- Add Btn -->
|
|
1774
|
-
<template
|
|
1775
|
-
v-if="hasAddBtn && (addTopBtn===undefined?(pluginOptions.datatable?.addTopBtn===undefined?!0:pluginOptions.datatable?.addTopBtn):addTopBtn)"
|
|
1776
|
-
>
|
|
1777
|
-
<MBtn
|
|
1778
|
-
:label="getFormTitle"
|
|
1779
|
-
icon="ion-ios-add"
|
|
1780
|
-
@click="openCreateDialog()"
|
|
1781
|
-
/>
|
|
1782
|
-
</template>
|
|
1783
1803
|
</MRow>
|
|
1784
1804
|
|
|
1785
1805
|
<!-- Manage Columns -->
|
|
@@ -2050,21 +2070,11 @@ defineOptions({
|
|
|
2050
2070
|
v-model="dialogs.form"
|
|
2051
2071
|
v-bind="pluginOptions.dt?.formDialogProps"
|
|
2052
2072
|
>
|
|
2053
|
-
<div
|
|
2054
|
-
class="m--form__container full-height no-wrap"
|
|
2055
|
-
>
|
|
2073
|
+
<div class="m--form__container full-height no-wrap">
|
|
2056
2074
|
<form
|
|
2057
2075
|
class="m--form column full-height justify-between no-wrap"
|
|
2058
2076
|
@submit="defaultSubmitItem"
|
|
2059
2077
|
>
|
|
2060
|
-
<!--<MForm-->
|
|
2061
|
-
<!-- v-slot="form"-->
|
|
2062
|
-
<!-- :errors="dialogs.errors"-->
|
|
2063
|
-
<!-- :form="dialogs.item"-->
|
|
2064
|
-
<!-- :form-props="{class: 'column full-height justify-between no-wrap'}"-->
|
|
2065
|
-
<!-- class="full-height no-wrap"-->
|
|
2066
|
-
<!-- @submit="defaultSubmitItem"-->
|
|
2067
|
-
<!-->-->
|
|
2068
2078
|
<q-card class="m--dialog-card">
|
|
2069
2079
|
<q-card-section ref="formTitle">
|
|
2070
2080
|
<q-toolbar :class="{'q-pa-none': $q.screen.lt.md}">
|
|
@@ -2088,13 +2098,13 @@ defineOptions({
|
|
|
2088
2098
|
</template>
|
|
2089
2099
|
<template v-else>
|
|
2090
2100
|
<q-btn
|
|
2091
|
-
|
|
2092
|
-
fab-mini
|
|
2101
|
+
color="negative"
|
|
2093
2102
|
flat
|
|
2103
|
+
icon="close"
|
|
2094
2104
|
@click="closeFormDialog"
|
|
2095
2105
|
>
|
|
2096
2106
|
<q-tooltip class="m--dt-btn-tooltip">
|
|
2097
|
-
{{ __('myth.titles.
|
|
2107
|
+
{{ __('myth.titles.close') }}
|
|
2098
2108
|
</q-tooltip>
|
|
2099
2109
|
</q-btn>
|
|
2100
2110
|
{{ getFormTitle }}
|
|
@@ -2179,7 +2189,6 @@ defineOptions({
|
|
|
2179
2189
|
/>
|
|
2180
2190
|
</q-card-actions>
|
|
2181
2191
|
</q-card>
|
|
2182
|
-
<!--</MForm>-->
|
|
2183
2192
|
</form>
|
|
2184
2193
|
</div>
|
|
2185
2194
|
</MDialog>
|
|
@@ -14,18 +14,25 @@ import { copyToClipboard, extend, useQuasar } from 'quasar'
|
|
|
14
14
|
import { Helpers, MythKey, type MythType, Str, veeRules } from '../utils'
|
|
15
15
|
import type { MDtColumn, MDtHeadersParameter, ParseHeaderOptions, Vue3MAlertMessage, Vue3MAlertMessageOptions, Vue3MConfirmMessage } from '../types'
|
|
16
16
|
import { computed, inject } from 'vue'
|
|
17
|
+
import { useRoute } from 'vue-router'
|
|
17
18
|
|
|
18
19
|
export const useMyth = () => {
|
|
19
20
|
const plugin = inject(MythKey) as MythType
|
|
20
21
|
const { t, te } = useI18n({ useScope: 'global' })
|
|
21
22
|
const pluginOptions = computed(() => plugin.props.value)
|
|
22
23
|
const q = useQuasar()
|
|
24
|
+
const $route = useRoute()
|
|
23
25
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
26
|
// @ts-ignore
|
|
25
27
|
const __ = (key: any, ...rest: unknown[]) => !key ? '' : te(`attributes.${key}`) ? t(`attributes.${key}`, ...rest) : te(key) ? t(key, ...rest) : key
|
|
26
|
-
const getPageTitle = (route
|
|
28
|
+
const getPageTitle = (route?: RouteLocationNormalizedLoaded | number | string, number?: number | string): string => {
|
|
29
|
+
if (typeof route !== 'object') {
|
|
30
|
+
number = route
|
|
31
|
+
route = $route
|
|
32
|
+
}
|
|
27
33
|
number = number || 2
|
|
28
34
|
number = parseInt(number.toString())
|
|
35
|
+
route = route || $route
|
|
29
36
|
const defaultValue = ''
|
|
30
37
|
// Not is route
|
|
31
38
|
// No page title
|
|
@@ -36,8 +43,7 @@ export const useMyth = () => {
|
|
|
36
43
|
const routePath = route?.path?.toString() || null
|
|
37
44
|
const routeName = route?.name?.toString() || null
|
|
38
45
|
|
|
39
|
-
// Not is
|
|
40
|
-
// No page title
|
|
46
|
+
// # Not is Route, No page title
|
|
41
47
|
if (!routePath || !routeName) {
|
|
42
48
|
return defaultValue
|
|
43
49
|
}
|
package/src/style/main.sass
CHANGED
|
@@ -833,7 +833,7 @@ export interface MOptionsSlots extends QOptionGroupSlots, QFieldSlots, BaseInput
|
|
|
833
833
|
|
|
834
834
|
export interface MToggleProps extends Omit<BaseInputsProps, 'placeholder' | 'topLabel' | 'autocomplete' | 'modelValue'>,
|
|
835
835
|
Omit<QToggleProps, 'modelValue' | 'label' | 'name'> {
|
|
836
|
-
modelValue?:
|
|
836
|
+
modelValue?: any;
|
|
837
837
|
/**
|
|
838
838
|
* Customize the label when the toggle is true.
|
|
839
839
|
* Default is: Yes.
|