@mythpe/quasar-ui-qui 0.0.46 → 0.0.48

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.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/src/components/datatable/MDatatable.vue +66 -70
  3. package/src/components/form/MBtn.vue +8 -155
  4. package/src/components/form/MEditor.vue +2 -4
  5. package/src/components/form/MField.vue +2 -6
  6. package/src/components/form/MFile.vue +6 -4
  7. package/src/components/form/MInput.vue +6 -1
  8. package/src/components/form/MMobile.vue +3 -3
  9. package/src/components/form/MOptions.vue +1 -3
  10. package/src/components/form/MOtp.vue +1 -3
  11. package/src/components/form/MPicker.vue +4 -7
  12. package/src/components/form/MRadio.vue +4 -7
  13. package/src/components/form/MSelect.vue +3 -5
  14. package/src/components/form/MToggle.vue +3 -6
  15. package/src/components/form/MUploader.vue +10 -12
  16. package/src/components/grid/MBlock.vue +14 -4
  17. package/src/components/grid/MContainer.vue +10 -5
  18. package/src/components/grid/MRow.vue +5 -4
  19. package/src/components/parials/{UploaderItem.vue → MUploaderItem.vue} +6 -7
  20. package/src/components/parials/index.ts +2 -2
  21. package/src/composable/useBindInput.ts +12 -11
  22. package/src/composable/useMyth.ts +19 -16
  23. package/src/plugin/defineAsyncComponents.ts +59 -0
  24. package/src/plugin/defineComponents.ts +8 -0
  25. package/src/types/components.d.ts +5 -2
  26. package/src/types/index.d.ts +1 -4
  27. package/src/types/install-options.d.ts +16 -5
  28. package/src/types/myth-api.ts +36 -0
  29. package/src/types/plugin-props-option.d.ts +1 -11
  30. package/src/types/theme.d.ts +47 -0
  31. package/src/utils/const.ts +1 -0
  32. package/src/utils/createMyth.ts +42 -0
  33. package/src/utils/index.ts +3 -2
  34. package/src/utils/vue-plugin.ts +13 -93
  35. package/src/utils/myth.ts +0 -112
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mythpe/quasar-ui-qui",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "MyTh Quasar UI Kit App Extension",
5
5
  "author": {
6
6
  "name": "MyTh Ahmed Faiz",
@@ -167,7 +167,6 @@ interface Emits {
167
167
 
168
168
  const emit = defineEmits<Emits>()
169
169
 
170
- const $myth = useMyth()
171
170
  const {
172
171
  __,
173
172
  parseHeaders,
@@ -177,9 +176,12 @@ const {
177
176
  confirmMessage,
178
177
  alertSuccess,
179
178
  scrollToElementFromErrors,
180
- downloadFromResponse
181
- } = $myth
182
- const { mOptions, api, themeInput, isSmall } = reactive($myth)
179
+ downloadFromResponse,
180
+ props: pluginOptions,
181
+ theme,
182
+ isSmall,
183
+ api
184
+ } = useMyth()
183
185
  const slots = useSlots()
184
186
  const router = useRouter()
185
187
  const route = useRoute()
@@ -201,10 +203,10 @@ const resetVeeForm = async (attrs?: Record<string, any>) => {
201
203
  }
202
204
  const serviceName = computed(() => props.serviceName)
203
205
  const exportToBlob = computed(() => {
204
- if (props.exportUrl === undefined && mOptions.datatable?.exportUrl === undefined) {
206
+ if (props.exportUrl === undefined && pluginOptions.value.datatable?.exportUrl === undefined) {
205
207
  return !0
206
208
  }
207
- const t = props.exportUrl === undefined ? mOptions.datatable?.exportUrl : props.exportUrl
209
+ const t = props.exportUrl === undefined ? pluginOptions.value.datatable?.exportUrl : props.exportUrl
208
210
  if (t !== undefined) {
209
211
  if (t.toString() === 'true' || t.toString() === '') {
210
212
  return !1
@@ -320,8 +322,8 @@ const addListBtnComputed = computed(() => {
320
322
  if (props.addListBtn !== undefined) {
321
323
  return props.addListBtn
322
324
  }
323
- if (mOptions.datatable?.addListBtn !== undefined) {
324
- return mOptions.datatable?.addListBtn
325
+ if (pluginOptions.value.datatable?.addListBtn !== undefined) {
326
+ return pluginOptions.value.datatable?.addListBtn
325
327
  }
326
328
  return !1
327
329
  })
@@ -384,7 +386,7 @@ const getMythApiServicesSchema = (): MDtMythApiServicesSchema => {
384
386
  if (typeof serviceName.value === 'function') {
385
387
  return serviceName.value() as MDtMythApiServicesSchema
386
388
  }
387
- const c = api[serviceName.value]
389
+ const c = api.value.services[serviceName.value]
388
390
  if (!c) {
389
391
  throw Error(`No Service: ${serviceName.value}`)
390
392
  }
@@ -880,7 +882,7 @@ const onSuccess: SubmissionHandler = async (form) => {
880
882
  const onInvalidSubmit: InvalidSubmissionHandler = ({ errors }) => {
881
883
  const keys: (keyof typeof errors)[] = Object.keys(errors)
882
884
  if (keys[0]) {
883
- const message = errors[keys[0]] as string || $myth.__('messages.the_given_data_was_invalid')
885
+ const message = errors[keys[0]] as string || __('messages.the_given_data_was_invalid')
884
886
  scrollToElementFromErrors({ [keys[0]]: [message] }, undefined, '.m--datatable__dialog-form-container')
885
887
  }
886
888
  }
@@ -952,13 +954,7 @@ const deleteSelectionItem = () => {
952
954
  })
953
955
  }
954
956
  const logoutDatatable = () => {
955
- // const { logout, removeStorage } = $myth.store.state.
956
- // removeStorage()
957
- // logout(window.push_token)
958
- // const name = this.$routes.auth.login
959
- // if (this.$route.name !== name) {
960
- // this.$router.replace({ name })
961
- // }
957
+ //
962
958
  }
963
959
  /**
964
960
  * ---
@@ -993,7 +989,7 @@ const contextmenuItems = computed<any>(() => ([
993
989
  ...(contextmenuItemsProp.value || []).sort((a, b) => (a.order ?? 0) - (b.order ?? 0)),
994
990
  {
995
991
  name: 'show',
996
- label: mOptions?.dt?.contextmenu?.btnStyle?.showLabel ? 'labels.show' : undefined,
992
+ label: pluginOptions.value?.dt?.contextmenu?.btnStyle?.showLabel ? 'labels.show' : undefined,
997
993
  click: (item: MDtItem, index: MDtItemIndex) => {
998
994
  openShowDialog(item, index)
999
995
  },
@@ -1001,7 +997,7 @@ const contextmenuItems = computed<any>(() => ([
1001
997
  },
1002
998
  {
1003
999
  name: 'update',
1004
- label: mOptions?.dt?.contextmenu?.btnStyle?.showLabel ? 'labels.update' : undefined,
1000
+ label: pluginOptions.value?.dt?.contextmenu?.btnStyle?.showLabel ? 'labels.update' : undefined,
1005
1001
  click: (item: MDtItem, index: MDtItemIndex) => {
1006
1002
  openUpdateDialog(item, index)
1007
1003
  },
@@ -1009,7 +1005,7 @@ const contextmenuItems = computed<any>(() => ([
1009
1005
  },
1010
1006
  {
1011
1007
  name: 'destroy',
1012
- label: mOptions?.dt?.contextmenu?.btnStyle?.showLabel ? 'labels.destroy' : undefined,
1008
+ label: pluginOptions.value?.dt?.contextmenu?.btnStyle?.showLabel ? 'labels.destroy' : undefined,
1013
1009
  click: (item: MDtItem, index: MDtItemIndex) => {
1014
1010
  selected.value = [item]
1015
1011
  onDeleteItem(item, index)
@@ -1053,7 +1049,7 @@ const closeImageDialog = () => {
1053
1049
  onMounted(() => refresh())
1054
1050
 
1055
1051
  watch(loading, v => {
1056
- if (mOptions?.dt?.useQuasarLoading) {
1052
+ if (pluginOptions.value?.dt?.useQuasarLoading) {
1057
1053
  if (v) {
1058
1054
  $q.loading.show()
1059
1055
  } else {
@@ -1140,8 +1136,8 @@ const getProp = computed(() => (k: keyof Props) => {
1140
1136
  if (props[k] !== undefined) {
1141
1137
  return props[k]
1142
1138
  }
1143
- if (mOptions.datatable?.[k] !== undefined) {
1144
- return mOptions.datatable?.[k]
1139
+ if (pluginOptions.value.datatable?.[k] !== undefined) {
1140
+ return pluginOptions.value.datatable?.[k]
1145
1141
  }
1146
1142
  return props[k]
1147
1143
  })
@@ -1161,9 +1157,9 @@ defineOptions({
1161
1157
  <div
1162
1158
  :class="{
1163
1159
  'm--datatable-component': !0,
1164
- 'm--datatable-component__fixed': fixed === undefined ? ( mOptions.datatable?.fixed === undefined ? undefined : mOptions.datatable?.fixed) : fixed,
1160
+ 'm--datatable-component__fixed': fixed === undefined ? ( pluginOptions.datatable?.fixed === undefined ? undefined : pluginOptions.datatable?.fixed) : fixed,
1165
1161
  'm--datatable-component__too_small': $q.screen.height < 900,
1166
- 'm--datatable-component__fab': hasAddBtn && (addFabBtn === undefined ? !!mOptions.datatable?.addFabBtn : addFabBtn)
1162
+ 'm--datatable-component__fab': hasAddBtn && (addFabBtn === undefined ? !!pluginOptions.datatable?.addFabBtn : addFabBtn)
1167
1163
  }"
1168
1164
  >
1169
1165
  <!-- Context Menu -->
@@ -1173,14 +1169,14 @@ defineOptions({
1173
1169
  context-menu
1174
1170
  position="standard"
1175
1171
  touch-position
1176
- v-bind="mOptions.dt?.contextmenu?.menu"
1172
+ v-bind="pluginOptions.dt?.contextmenu?.menu"
1177
1173
  @hide="resetDialogs()"
1178
1174
  >
1179
1175
  <q-list
1180
1176
  v-if="dialogs.item"
1181
1177
  :separator="!isSmall"
1182
1178
  style="min-width: 280px;"
1183
- v-bind="mOptions.dt?.contextmenu?.list"
1179
+ v-bind="pluginOptions.dt?.contextmenu?.list"
1184
1180
  >
1185
1181
  <template
1186
1182
  v-for="(contextmenuItem,i) in contextmenuItems"
@@ -1189,7 +1185,7 @@ defineOptions({
1189
1185
  <MDtBtn
1190
1186
  v-if="typeof contextmenuItem.showIf === 'function' ? contextmenuItem.showIf(dialogs.item,dialogs.index) : contextmenuItem.showIf"
1191
1187
  :[contextmenuItem.name]="!0"
1192
- :dense="dense === undefined ? (themeInput.dense !== undefined ? themeInput.dense : mOptions.datatable?.dense) : dense"
1188
+ :dense="dense === undefined ? (theme.buttons.dense !== undefined ? theme.buttons.dense : pluginOptions.datatable?.dense) : dense"
1193
1189
  :label="contextmenuItem.contextLabel !== undefined ? (contextmenuItem.contextLabel === null ? undefined : __(contextmenuItem.contextLabel)) : __(contextmenuItem.label || contextmenuItem.name) "
1194
1190
  list-item
1195
1191
  v-bind="contextmenuItem.attr"
@@ -1225,11 +1221,11 @@ defineOptions({
1225
1221
  v-bind="{
1226
1222
  virtualScroll: !0,
1227
1223
  wrapCells:!0,
1228
- ...mOptions.datatable,
1224
+ ...pluginOptions.datatable,
1229
1225
  ...$attrs,
1230
- bordered: bordered === undefined ? mOptions.datatable?.bordered : bordered,
1231
- dense: dense === undefined ? ( themeInput.dense !== undefined ? themeInput.dense : mOptions.datatable?.dense) : dense,
1232
- flat: flat === undefined ? mOptions.datatable?.flat : flat,
1226
+ bordered: bordered === undefined ? pluginOptions.datatable?.bordered : bordered,
1227
+ dense: dense === undefined ? ( theme.inputs.dense !== undefined ? theme.inputs.dense : pluginOptions.datatable?.dense) : dense,
1228
+ flat: flat === undefined ? pluginOptions.datatable?.flat : flat,
1233
1229
  }"
1234
1230
  @request="fetchDatatableItems"
1235
1231
  @update:selected="onUpdateSelectedItems"
@@ -1292,7 +1288,7 @@ defineOptions({
1292
1288
  :key="col.name"
1293
1289
  >
1294
1290
  <MRow
1295
- v-if="col.name !== controlKey || (col.name === controlKey && ( showCardControlHeader === undefined ? mOptions.datatable?.showCardControlHeader : showCardControlHeader ))"
1291
+ v-if="col.name !== controlKey || (col.name === controlKey && ( showCardControlHeader === undefined ? pluginOptions.datatable?.showCardControlHeader : showCardControlHeader ))"
1296
1292
  class="justify-between"
1297
1293
  >
1298
1294
  <MCol
@@ -1409,13 +1405,13 @@ defineOptions({
1409
1405
  v-if="!hideSearch && !dialogs.form"
1410
1406
  v-model="tableOptions.search"
1411
1407
  :debounce="searchDebounce"
1412
- :dense="dense === undefined ? (mOptions.datatable?.dense !== undefined ? mOptions.datatable?.dense : !0) : dense"
1408
+ :dense="dense === undefined ? (pluginOptions.datatable?.dense !== undefined ? pluginOptions.datatable?.dense : !0) : dense"
1413
1409
  :placeholder="searchPlaceholder"
1414
1410
  autocomplete="none"
1415
1411
  col="12"
1416
1412
  name="search"
1417
1413
  outlined
1418
- v-bind="mOptions.dt?.searchInput?.props"
1414
+ v-bind="pluginOptions.dt?.searchInput?.props"
1419
1415
  >
1420
1416
  <template #prepend>
1421
1417
  <q-icon
@@ -1440,16 +1436,16 @@ defineOptions({
1440
1436
  <template #after>
1441
1437
  <q-btn
1442
1438
  :aria-label="__('menu')"
1443
- :icon="mOptions.dt?.searchInput?.optionsIcon || 'ion-ios-options'"
1439
+ :icon="pluginOptions.dt?.searchInput?.optionsIcon || 'ion-ios-options'"
1444
1440
  dense
1445
1441
  flat
1446
1442
  round
1447
- v-bind="mOptions.dt?.searchInput?.menuBtn"
1443
+ v-bind="pluginOptions.dt?.searchInput?.menuBtn"
1448
1444
  >
1449
1445
  <MModalMenu
1450
1446
  :offset="[10,10]"
1451
1447
  no-close-btn
1452
- v-bind="mOptions.dt?.searchInput?.menuProps as any"
1448
+ v-bind="pluginOptions.dt?.searchInput?.menuProps as any"
1453
1449
  >
1454
1450
  <q-toolbar>
1455
1451
  <q-toolbar-title>
@@ -1511,23 +1507,23 @@ defineOptions({
1511
1507
  :disable="tableOptions.loading"
1512
1508
  icon="ion-ios-options"
1513
1509
  tooltip="myth.datatable.hints.more"
1514
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.buttons?.more}"
1510
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.buttons?.more}"
1515
1511
  >
1516
1512
  <MModalMenu
1517
1513
  :offset="[10,10]"
1518
1514
  position="top"
1519
- v-bind="mOptions.dt?.buttons?.moreMenu as any"
1515
+ v-bind="pluginOptions.dt?.buttons?.moreMenu as any"
1520
1516
  >
1521
1517
  <q-list
1522
1518
  style="min-width: 250px"
1523
- v-bind="mOptions.dt?.buttons?.moreList"
1519
+ v-bind="pluginOptions.dt?.buttons?.moreList"
1524
1520
  >
1525
1521
  <!-- Add Btn -->
1526
1522
  <q-item
1527
1523
  v-if="hasAddBtn && !!addListBtnComputed"
1528
1524
  v-close-popup
1529
1525
  clickable
1530
- v-bind="mOptions.dt?.buttons?.moreItem"
1526
+ v-bind="pluginOptions.dt?.buttons?.moreItem"
1531
1527
  @click="openCreateDialog()"
1532
1528
  >
1533
1529
  <q-item-section thumbnail>
@@ -1546,7 +1542,7 @@ defineOptions({
1546
1542
  v-if="pdf"
1547
1543
  v-close-popup
1548
1544
  clickable
1549
- v-bind="mOptions.dt?.buttons?.moreItem"
1545
+ v-bind="pluginOptions.dt?.buttons?.moreItem"
1550
1546
  @click="exportData('pdf')"
1551
1547
  >
1552
1548
  <q-item-section thumbnail>
@@ -1573,7 +1569,7 @@ defineOptions({
1573
1569
  v-if="excel"
1574
1570
  v-close-popup
1575
1571
  clickable
1576
- v-bind="mOptions.dt?.buttons?.moreItem"
1572
+ v-bind="pluginOptions.dt?.buttons?.moreItem"
1577
1573
  @click="exportData('excel')"
1578
1574
  >
1579
1575
  <q-item-section thumbnail>
@@ -1597,10 +1593,10 @@ defineOptions({
1597
1593
  </q-item-section>
1598
1594
  </q-item>
1599
1595
  <q-item
1600
- v-if="fullscreenBtn === undefined ? ( !!mOptions.datatable?.fullscreenBtn) : fullscreenBtn"
1596
+ v-if="fullscreenBtn === undefined ? ( !!pluginOptions.datatable?.fullscreenBtn) : fullscreenBtn"
1601
1597
  v-close-popup
1602
1598
  clickable
1603
- v-bind="mOptions.dt?.buttons?.moreItem"
1599
+ v-bind="pluginOptions.dt?.buttons?.moreItem"
1604
1600
  @click="tableOptions.fullscreen = !tableOptions.fullscreen"
1605
1601
  >
1606
1602
  <q-item-section thumbnail>
@@ -1622,13 +1618,13 @@ defineOptions({
1622
1618
  key="filter-selection-btn"
1623
1619
  icon="o_filter_alt"
1624
1620
  tooltip="myth.datatable.hints.filter"
1625
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.buttons?.filter}"
1621
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.buttons?.filter}"
1626
1622
  @click="openFilterDialog()"
1627
1623
  >
1628
1624
  <MModalMenu
1629
1625
  no-close-btn
1630
1626
  persistent
1631
- v-bind="mOptions.dt?.filterDialogProps"
1627
+ v-bind="pluginOptions.dt?.filterDialogProps"
1632
1628
  >
1633
1629
  <q-card
1634
1630
  :style="$q.screen.gt.sm?`width: ${Math.ceil($q.screen.width/2)}px` : undefined"
@@ -1665,7 +1661,7 @@ defineOptions({
1665
1661
  :label="__('myth.datatable.filter.cancel')"
1666
1662
  color="negative"
1667
1663
  flat
1668
- v-bind="mOptions.dt?.dialogButtonsProps"
1664
+ v-bind="pluginOptions.dt?.dialogButtonsProps"
1669
1665
  @click="closeFilterDialog"
1670
1666
  />
1671
1667
  <MBtn
@@ -1673,7 +1669,7 @@ defineOptions({
1673
1669
  :label="__('myth.datatable.filter.save')"
1674
1670
  color="positive"
1675
1671
  flat
1676
- v-bind="mOptions.dt?.dialogButtonsProps"
1672
+ v-bind="pluginOptions.dt?.dialogButtonsProps"
1677
1673
  @click="saveFilterDialog"
1678
1674
  />
1679
1675
  </MRow>
@@ -1690,17 +1686,17 @@ defineOptions({
1690
1686
  :disable="tableOptions.loading"
1691
1687
  icon="ion-ios-refresh"
1692
1688
  tooltip="myth.datatable.hints.refresh"
1693
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.buttons?.refresh}"
1689
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.buttons?.refresh}"
1694
1690
  @click="refreshNoUpdate()"
1695
1691
  />
1696
1692
  <!--Fullscreen-->
1697
1693
  <MDtBtn
1698
- v-if="fullscreenBtn === undefined ? ( !!mOptions.datatable?.fullscreenBtn) : fullscreenBtn"
1694
+ v-if="fullscreenBtn === undefined ? ( !!pluginOptions.datatable?.fullscreenBtn) : fullscreenBtn"
1699
1695
  key="fullscreen-selection-btn"
1700
1696
  :disable="tableOptions.loading"
1701
1697
  :icon="tableOptions.fullscreen ? 'ion-ios-contract' : 'ion-ios-desktop'"
1702
- :tooltip="`$myth.datatable.${tableOptions.fullscreen ? 'exitFullscreen' : 'fullscreen'}`"
1703
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.buttons?.fullscreen}"
1698
+ :tooltip="`myth.datatable.${tableOptions.fullscreen ? 'exitFullscreen' : 'fullscreen'}`"
1699
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.buttons?.fullscreen}"
1704
1700
  @click="tableOptions.fullscreen = !tableOptions.fullscreen"
1705
1701
  />
1706
1702
 
@@ -1711,7 +1707,7 @@ defineOptions({
1711
1707
  :disable="tableOptions.loading"
1712
1708
  icon="ion-ios-create"
1713
1709
  update
1714
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.topSelection?.btn}"
1710
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn}"
1715
1711
  @click="openUpdateDialogNoIndex(tableOptions.selected[0] as any)"
1716
1712
  />
1717
1713
  <MDtBtn
@@ -1720,7 +1716,7 @@ defineOptions({
1720
1716
  :disable="tableOptions.loading"
1721
1717
  icon="ion-ios-eye"
1722
1718
  show
1723
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.topSelection?.btn}"
1719
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn}"
1724
1720
  @click="openShowDialogNoIndex(tableOptions.selected[0] as any)"
1725
1721
  />
1726
1722
  <MDtBtn
@@ -1730,7 +1726,7 @@ defineOptions({
1730
1726
  color="negative"
1731
1727
  destroy
1732
1728
  icon="ion-ios-trash"
1733
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.topSelection?.btn}"
1729
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn}"
1734
1730
  @click="deleteSelectionItem()"
1735
1731
  />
1736
1732
  <template
@@ -1740,7 +1736,7 @@ defineOptions({
1740
1736
  <MDtBtn
1741
1737
  v-if="(typeof contextBtn.showIf === 'function' ? contextBtn.showIf(tableOptions.selected[0],0) : contextBtn.showIf) && ( (contextBtn.click && isSingleSelectedItem) || (contextBtn.multiClick && !isSingleSelectedItem) )"
1742
1738
  :tooltip="__(contextBtn.tooltip || contextBtn.name)"
1743
- v-bind="{...defaultTopBtnProps,...mOptions.dt?.topSelection?.btn,...contextBtn,...contextBtn.attr}"
1739
+ v-bind="{...defaultTopBtnProps,...pluginOptions.dt?.topSelection?.btn,...contextBtn,...contextBtn.attr}"
1744
1740
  @click="contextBtn.click ? contextBtn.click(tableOptions.selected[0],0) : (contextBtn.multiClick ? contextBtn.multiClick(tableOptions.selected) : undefined)"
1745
1741
  />
1746
1742
  </template>
@@ -1749,7 +1745,7 @@ defineOptions({
1749
1745
  <q-space />
1750
1746
  <!-- Add Btn -->
1751
1747
  <template
1752
- v-if="hasAddBtn && (addTopBtn===undefined?(mOptions.datatable?.addTopBtn===undefined?!0:mOptions.datatable?.addTopBtn):addTopBtn)"
1748
+ v-if="hasAddBtn && (addTopBtn===undefined?(pluginOptions.datatable?.addTopBtn===undefined?!0:pluginOptions.datatable?.addTopBtn):addTopBtn)"
1753
1749
  >
1754
1750
  <MBtn
1755
1751
  :label="getFormTitle"
@@ -1879,7 +1875,7 @@ defineOptions({
1879
1875
  color="primary"
1880
1876
  dense
1881
1877
  outline
1882
- v-bind="mOptions.dt?.controlDropdown"
1878
+ v-bind="pluginOptions.dt?.controlDropdown"
1883
1879
  >
1884
1880
  <q-list>
1885
1881
  <MDtContextmenuItems
@@ -1968,7 +1964,7 @@ defineOptions({
1968
1964
  <!-- Show Dialog -->
1969
1965
  <MDialog
1970
1966
  v-model="dialogs.show"
1971
- v-bind="mOptions.dt?.showDialogProps"
1967
+ v-bind="pluginOptions.dt?.showDialogProps"
1972
1968
  >
1973
1969
  <q-card class="m--dialog-card">
1974
1970
  <q-card-section ref="showTitleRef">
@@ -2010,7 +2006,7 @@ defineOptions({
2010
2006
  <MBtn
2011
2007
  :label="__('myth.titles.close')"
2012
2008
  color="negative"
2013
- v-bind="mOptions.dt?.dialogButtonsProps"
2009
+ v-bind="pluginOptions.dt?.dialogButtonsProps"
2014
2010
  @click="closeShowDialog"
2015
2011
  />
2016
2012
  </q-card-actions>
@@ -2020,7 +2016,7 @@ defineOptions({
2020
2016
  <!-- Form Dialog -->
2021
2017
  <MDialog
2022
2018
  v-model="dialogs.form"
2023
- v-bind="mOptions.dt?.formDialogProps"
2019
+ v-bind="pluginOptions.dt?.formDialogProps"
2024
2020
  >
2025
2021
  <div
2026
2022
  class="m--form__container full-height no-wrap"
@@ -2134,7 +2130,7 @@ defineOptions({
2134
2130
  color="positive"
2135
2131
  no-caps
2136
2132
  type="submit"
2137
- v-bind="mOptions.dt?.dialogButtonsProps"
2133
+ v-bind="pluginOptions.dt?.dialogButtonsProps"
2138
2134
  />
2139
2135
  </slot>
2140
2136
  <MBtn
@@ -2143,7 +2139,7 @@ defineOptions({
2143
2139
  :label="__('myth.titles.close')"
2144
2140
  color="negative"
2145
2141
  no-caps
2146
- v-bind="mOptions.dt?.dialogButtonsProps"
2142
+ v-bind="pluginOptions.dt?.dialogButtonsProps"
2147
2143
  @click="closeFormDialog"
2148
2144
  />
2149
2145
  </q-card-actions>
@@ -2203,16 +2199,16 @@ defineOptions({
2203
2199
 
2204
2200
  <!-- Add Btn -->
2205
2201
  <q-page-sticky
2206
- v-if="hasAddBtn && (addFabBtn === undefined ? !!mOptions.datatable?.addFabBtn : addFabBtn)"
2207
- :offset="mOptions.dt?.fabBtn?.offset|| [25,25]"
2208
- :position="mOptions.dt?.fabBtn?.position || 'bottom-right'"
2209
- v-bind="mOptions.dt?.fabBtn?.pageStickyProps"
2202
+ v-if="hasAddBtn && (addFabBtn === undefined ? !!pluginOptions.datatable?.addFabBtn : addFabBtn)"
2203
+ :offset="pluginOptions.dt?.fabBtn?.offset|| [25,25]"
2204
+ :position="pluginOptions.dt?.fabBtn?.position || 'bottom-right'"
2205
+ v-bind="pluginOptions.dt?.fabBtn?.pageStickyProps"
2210
2206
  >
2211
2207
  <q-btn
2212
2208
  color="primary"
2213
2209
  fab
2214
2210
  icon="ion-ios-add"
2215
- v-bind="mOptions.dt?.fabBtn?.buttonProps"
2211
+ v-bind="pluginOptions.dt?.fabBtn?.buttonProps"
2216
2212
  @click="openCreateDialog()"
2217
2213
  >
2218
2214
  <MTooltip
@@ -10,166 +10,17 @@
10
10
  lang="ts"
11
11
  setup
12
12
  >
13
- import type { MBtnProps as Props } from '../../types'
13
+ import type { ButtonLoadingOptions, MBtnProps as Props } from '../../types'
14
14
  import { computed } from 'vue'
15
- import { myth } from '../../utils'
16
15
  import { useBindInput, useMyth } from '../../composable'
17
16
  import type { QBtnProps } from 'quasar'
18
17
 
19
- // const props = withDefaults(defineProps<Props>(), {
20
- // /**
21
- // * Size in CSS units, including unit name or standard size name (xs|sm|md|lg|xl)
22
- // */
23
- // size: undefined,
24
- // /**
25
- // * 1) Define the button native type attribute (submit, reset, button) or 2) render component with <a> tag so you can access events even if disable or 3) Use 'href' prop and specify 'type' as a media tag
26
- // * Default value: 'button'
27
- // */
28
- // type: undefined,
29
- // /**
30
- // * Equivalent to Vue Router <router-link> 'to' property; Superseded by 'href' prop if used
31
- // */
32
- // to: undefined,
33
- // /**
34
- // * Equivalent to Vue Router <router-link> 'replace' property; Superseded by 'href' prop if used
35
- // */
36
- // replace: undefined,
37
- // /**
38
- // * Native <a> link href attribute; Has priority over the 'to' and 'replace' props
39
- // */
40
- // href: undefined,
41
- // /**
42
- // * Native <a> link target attribute; Use it only with 'to' or 'href' props
43
- // */
44
- // target: undefined,
45
- // /**
46
- // * The text that will be shown on the button
47
- // */
48
- // label: undefined,
49
- // /**
50
- // * Icon name following Quasar convention; Make sure you have the icon library installed unless you are using 'img:' prefix; If 'none' (Str) is used as value then no icon is rendered (but screen real estate will still be used for it)
51
- // */
52
- // icon: undefined,
53
- // /**
54
- // * Icon name following Quasar convention; Make sure you have the icon library installed unless you are using 'img:' prefix; If 'none' (Str) is used as value then no icon is rendered (but screen real estate will still be used for it)
55
- // */
56
- // iconRight: undefined,
57
- // /**
58
- // * Use 'outline' design
59
- // */
60
- // outline: undefined,
61
- // /**
62
- // * Use 'flat' design
63
- // */
64
- // flat: undefined,
65
- // /**
66
- // * Remove shadow
67
- // */
68
- // unelevated: undefined,
69
- // /**
70
- // * Applies a more prominent border-radius for a squared shape button
71
- // */
72
- // rounded: undefined,
73
- // /**
74
- // * Use 'push' design
75
- // */
76
- // push: undefined,
77
- // /**
78
- // * Removes border-radius so borders are squared
79
- // */
80
- // square: undefined,
81
- // /**
82
- // * Applies a glossy effect
83
- // */
84
- // glossy: undefined,
85
- // /**
86
- // * Makes button size and shape to fit a Floating Action Button
87
- // */
88
- // fab: undefined,
89
- // /**
90
- // * Makes button size and shape to fit a small Floating Action Button
91
- // */
92
- // fabMini: undefined,
93
- // /**
94
- // * Apply custom padding (vertical [horizontal]); Size in CSS units, including unit name or standard size name (none|xs|sm|md|lg|xl); Also removes the min width and height when set
95
- // */
96
- // padding: undefined,
97
- // /**
98
- // * Color name for component from the Quasar Color Palette
99
- // */
100
- // color: 'primary',
101
- // /**
102
- // * Overrides text color (if needed); Color name from the Quasar Color Palette
103
- // */
104
- // textColor: undefined,
105
- // /**
106
- // * Avoid turning label text into caps (which happens by default)
107
- // */
108
- // noCaps: undefined,
109
- // /**
110
- // * Avoid label text wrapping
111
- // */
112
- // noWrap: undefined,
113
- // /**
114
- // * Dense mode; occupies less space
115
- // */
116
- // dense: undefined,
117
- // /**
118
- // * Configure material ripple (disable it by setting it to 'false' or supply a config object)
119
- // * Default value: true
120
- // */
121
- // ripple: undefined,
122
- // /**
123
- // * Tabindex HTML attribute value
124
- // */
125
- // tabindex: undefined,
126
- // /**
127
- // * Label or content alignment
128
- // * Default value: 'center'
129
- // */
130
- // align: undefined,
131
- // /**
132
- // * Stack icon and label vertically instead of on same line (like it is by default)
133
- // */
134
- // stack: undefined,
135
- // /**
136
- // * When used on flexbox parent, button will stretch to parent's height
137
- // */
138
- // stretch: undefined,
139
- // /**
140
- // * Put button into loading state (displays a QSpinner -- can be overridden by using a 'loading' slot)
141
- // * Default value: null
142
- // */
143
- // loading: undefined,
144
- // /**
145
- // * Put component in disabled mode
146
- // */
147
- // disable: undefined,
148
- // /**
149
- // * Makes a circle shaped button
150
- // */
151
- // round: undefined,
152
- // /**
153
- // * Percentage (0.0 < x < 100.0); To be used along 'loading' prop; Display a progress bar on the background
154
- // */
155
- // percentage: undefined,
156
- // /**
157
- // * Progress bar on the background should have dark color; To be used along with 'percentage' and 'loading' props
158
- // */
159
- // darkPercentage: undefined,
160
- // /**
161
- // * Emitted when the component is clicked
162
- // * @param evt JS event object; If you are using route navigation ('to'/'replace' props) and you want to cancel navigation then call evt.preventDefault() synchronously in your event handler
163
- // * @param go Available ONLY if you are using route navigation ('to'/'replace' props); When you need to control the time at which the component should trigger the route navigation then call evt.preventDefault() synchronously and then call this function at your convenience; Useful if you have async work to be done before the actual route navigation or if you want to redirect somewhere else
164
- // */
165
- // onClick: undefined
166
- // })
167
18
  const props = defineProps<Props>()
168
- const { __ } = useMyth()
169
- const btnLoading = computed(() => myth.btnLoading.value)
19
+ const { __, theme } = useMyth()
20
+ const btnLoading = computed(() => theme.value.buttonLoading as ButtonLoadingOptions)
170
21
  const getLabel = computed<string | undefined>(() => props.label ? (__(props.label) ?? undefined) : undefined)
171
- const getSize = computed<string>(() => myth.btnLoading.value?.size || '20px')
172
- const getColor = computed<string | undefined>(() => myth.btnLoading.value?.color || undefined)
22
+ const getSize = computed<string | undefined>(() => btnLoading.value.size)
23
+ const getColor = computed<string | undefined>(() => btnLoading.value.color)
173
24
  const { attrs } = useBindInput<QBtnProps & { name: string }>(() => props, 'btn')
174
25
  defineOptions({
175
26
  name: 'MBtn',
@@ -180,9 +31,11 @@ defineOptions({
180
31
  <template>
181
32
  <q-btn
182
33
  v-bind="{
34
+ ariaLabel: getLabel,
35
+ ...$attrs,
183
36
  ...attrs,
37
+ ...theme.buttons,
184
38
  label: loading ? `${getLabel} ...` : getLabel,
185
- ariaLabel: 'ariaLabel' in attrs && attrs.ariaLabel ? __(attrs.ariaLabel) : getLabel
186
39
  }"
187
40
  >
188
41
  <template