quasar-ui-danx 0.3.22 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/.eslintrc.cjs +32 -30
  2. package/danx-local.sh +1 -1
  3. package/dist/danx.es.js +7490 -7519
  4. package/dist/danx.es.js.map +1 -1
  5. package/dist/danx.umd.js +5 -5
  6. package/dist/danx.umd.js.map +1 -1
  7. package/dist/style.css +1 -1
  8. package/package.json +1 -1
  9. package/src/components/ActionTable/ActionMenu.vue +1 -1
  10. package/src/components/ActionTable/ActionTable.vue +64 -45
  11. package/src/components/ActionTable/{ActionTableColumn.vue → Columns/ActionTableColumn.vue} +4 -3
  12. package/src/components/ActionTable/{ActionTableHeaderColumn.vue → Columns/ActionTableHeaderColumn.vue} +2 -2
  13. package/src/components/ActionTable/Columns/index.ts +2 -0
  14. package/src/components/ActionTable/Filters/CollapsableFiltersSidebar.vue +22 -21
  15. package/src/components/ActionTable/Form/Fields/DateRangeField.vue +3 -5
  16. package/src/components/ActionTable/Form/Fields/FileUploadButton.vue +33 -34
  17. package/src/components/ActionTable/Form/Fields/TextField.vue +36 -36
  18. package/src/components/ActionTable/Form/RenderedForm.vue +137 -112
  19. package/src/components/ActionTable/Form/form.d.ts +31 -0
  20. package/src/components/ActionTable/Layouts/ActionTableLayout.vue +88 -4
  21. package/src/components/ActionTable/TableSummaryRow.vue +4 -4
  22. package/src/components/ActionTable/Toolbars/ActionToolbar.vue +46 -0
  23. package/src/components/ActionTable/Toolbars/index.ts +1 -0
  24. package/src/components/ActionTable/index.ts +1 -2
  25. package/src/components/ActionTable/listControls.ts +512 -385
  26. package/src/components/ActionTable/listHelpers.ts +46 -44
  27. package/src/components/PanelsDrawer/PanelsDrawer.vue +37 -26
  28. package/src/components/PanelsDrawer/PanelsDrawerPanels.vue +1 -1
  29. package/src/components/PanelsDrawer/PanelsDrawerTabs.vue +1 -6
  30. package/src/components/Utility/Buttons/ExportButton.vue +1 -1
  31. package/src/components/Utility/Buttons/RefreshButton.vue +5 -5
  32. package/src/components/Utility/Controls/PreviousNextControls.vue +4 -4
  33. package/src/components/Utility/Layouts/CollapsableSidebar.vue +2 -8
  34. package/src/components/Utility/Popovers/PopoverMenu.vue +3 -3
  35. package/src/helpers/actions.ts +197 -187
  36. package/src/styles/general.scss +12 -11
  37. package/src/styles/quasar-reset.scss +59 -11
  38. package/src/styles/themes/danx/action-table.scss +19 -0
  39. package/src/styles/themes/danx/buttons.scss +13 -0
  40. package/src/styles/themes/danx/forms.scss +5 -0
  41. package/src/styles/themes/danx/index.scss +3 -0
  42. package/src/styles/themes/danx/panels.scss +19 -0
  43. package/src/styles/themes/danx/sidebar.scss +3 -0
  44. package/src/styles/themes/danx/toolbar.scss +3 -0
  45. package/types/index.d.ts +1 -0
  46. package/src/styles/actions.scss +0 -10
@@ -1,42 +1,44 @@
1
- import { onMounted } from "vue";
2
- import { getUrlParam } from "../../helpers";
1
+ import { ListControlsPagination } from "src/components/ActionTable/listControls";
2
+ import { TableColumn } from "src/components/ActionTable/tableColumns";
3
+ import { onMounted, Ref } from "vue";
4
+ import { AnyObject, getUrlParam } from "../../helpers";
3
5
 
4
- export function registerStickyScrolling(tableRef) {
5
- onMounted(() => {
6
- const scrollEl = tableRef.value.$el.getElementsByClassName("q-table__middle")[0];
7
- scrollEl.addEventListener("scroll", onScroll);
6
+ export function registerStickyScrolling(tableRef: Ref) {
7
+ onMounted(() => {
8
+ const scrollEl = tableRef.value.$el.getElementsByClassName("q-table__middle")[0];
9
+ scrollEl.addEventListener("scroll", onScroll);
8
10
 
9
- function onScroll({ target }) {
10
- // Add / remove scroll y class based on whether we're scrolling vertically
11
- if (target.scrollTop > 0) {
12
- scrollEl.classList.add("is-scrolling-y");
13
- } else {
14
- scrollEl.classList.remove("is-scrolling-y");
15
- }
11
+ function onScroll({ target }: { target: HTMLElement }) {
12
+ // Add / remove scroll y class based on whether we're scrolling vertically
13
+ if (target.scrollTop > 0) {
14
+ scrollEl.classList.add("is-scrolling-y");
15
+ } else {
16
+ scrollEl.classList.remove("is-scrolling-y");
17
+ }
16
18
 
17
- // Add / remove scroll x class based on whether we're scrolling horizontally
18
- if (target.scrollLeft > 0) {
19
- scrollEl.classList.add("is-scrolling-x");
20
- } else {
21
- scrollEl.classList.remove("is-scrolling-x");
22
- }
23
- }
24
- });
19
+ // Add / remove scroll x class based on whether we're scrolling horizontally
20
+ if (target.scrollLeft > 0) {
21
+ scrollEl.classList.add("is-scrolling-x");
22
+ } else {
23
+ scrollEl.classList.remove("is-scrolling-x");
24
+ }
25
+ }
26
+ });
25
27
  }
26
28
 
27
- export function mapSortBy(pagination, columns) {
28
- if (!pagination.sortBy) return null;
29
+ export function mapSortBy(pagination: ListControlsPagination, columns: TableColumn[]) {
30
+ if (!pagination.sortBy) return null;
29
31
 
30
- const column = columns.find(c => c.name === pagination.sortBy);
31
- if (!column) return null;
32
+ const column = columns.find(c => c.name === pagination.sortBy);
33
+ if (!column) return null;
32
34
 
33
- return [
34
- {
35
- column: column.sortBy || column.name,
36
- expression: column.sortByExpression || undefined,
37
- order: pagination.descending ? "desc" : "asc"
38
- }
39
- ];
35
+ return [
36
+ {
37
+ column: column.sortBy || column.name,
38
+ expression: column.sortByExpression || undefined,
39
+ order: pagination.descending ? "desc" : "asc"
40
+ }
41
+ ];
40
42
  }
41
43
 
42
44
  /**
@@ -44,16 +46,16 @@ export function mapSortBy(pagination, columns) {
44
46
  * @param url
45
47
  * @param allowedKeys
46
48
  */
47
- export function getFilterFromUrl(url: string, allowedKeys = null) {
48
- const filter = {};
49
- const urlFilter = getUrlParam("filter", url);
50
- if (urlFilter) {
51
- const fields = JSON.parse(urlFilter);
52
- Object.keys(fields).forEach((key) => {
53
- if (!allowedKeys || allowedKeys.includes(key)) {
54
- filter[key] = fields[key];
55
- }
56
- });
57
- }
58
- return filter;
49
+ export function getFilterFromUrl(url: string, allowedKeys: string[] | null = null) {
50
+ const filter: AnyObject = {};
51
+ const urlFilter = getUrlParam("filter", url);
52
+ if (urlFilter) {
53
+ const fields = JSON.parse(urlFilter);
54
+ Object.keys(fields).forEach((key) => {
55
+ if (!allowedKeys || allowedKeys.includes(key)) {
56
+ filter[key] = fields[key];
57
+ }
58
+ });
59
+ }
60
+ return filter;
59
61
  }
@@ -4,30 +4,40 @@
4
4
  :show="true"
5
5
  overlay
6
6
  content-class="h-full"
7
+ class="dx-panels-drawer"
7
8
  title=""
8
9
  @update:show="$emit('close')"
9
10
  >
10
11
  <div class="flex flex-col flex-nowrap h-full">
11
- <div class="flex items-center px-6 py-4 border-b">
12
+ <div class="dx-panels-drawer-header flex items-center px-6 py-4">
12
13
  <div class="flex-grow">
13
- <slot name="header" />
14
+ <slot name="header">
15
+ <h2>{{ title }}</h2>
16
+ </slot>
17
+ </div>
18
+ <div
19
+ v-if="$slots.controls"
20
+ class="mr-4"
21
+ >
22
+ <slot name="controls" />
14
23
  </div>
15
-
16
24
  <div>
17
- <QBtn @click="$emit('close')">
25
+ <QBtn
26
+ class="dx-close-button"
27
+ @click="$emit('close')"
28
+ >
18
29
  <CloseIcon class="w-4" />
19
30
  </QBtn>
20
31
  </div>
21
32
  </div>
22
- <div class="flex-grow overflow-hidden h-full">
33
+ <div class="dx-panels-drawer-body flex-grow overflow-hidden h-full">
23
34
  <div class="flex items-stretch flex-nowrap h-full">
24
- <div class="border-r w-[13.5rem] overflow-y-auto">
25
- <PanelsDrawerTabs
26
- v-model="activePanel"
27
- :panels="panels"
28
- @update:model-value="$emit('update:model-value', $event)"
29
- />
30
- </div>
35
+ <PanelsDrawerTabs
36
+ v-model="activePanel"
37
+ :class="tabsClass"
38
+ :panels="panels"
39
+ @update:model-value="$emit('update:model-value', $event)"
40
+ />
31
41
  <PanelsDrawerPanels
32
42
  :panels="panels"
33
43
  :active-panel="activePanel"
@@ -44,27 +54,28 @@
44
54
  </div>
45
55
  </ContentDrawer>
46
56
  </template>
47
- <script setup>
57
+ <script setup lang="ts">
48
58
  import { ref, watch } from "vue";
49
59
  import { XIcon as CloseIcon } from "../../svg";
60
+ import { ActionPanel } from "../ActionTable";
50
61
  import { ContentDrawer } from "../Utility";
51
62
  import PanelsDrawerPanels from "./PanelsDrawerPanels";
52
63
  import PanelsDrawerTabs from "./PanelsDrawerTabs";
53
64
 
65
+ export interface Props {
66
+ title?: string,
67
+ modelValue?: string,
68
+ tabsClass?: string | object,
69
+ panelsClass?: string | object,
70
+ panels: ActionPanel[]
71
+ }
72
+
54
73
  defineEmits(["update:model-value", "close"]);
55
- const props = defineProps({
56
- modelValue: {
57
- type: String,
58
- default: null
59
- },
60
- panelsClass: {
61
- type: [Object, String],
62
- default: "w-[35.5rem]"
63
- },
64
- panels: {
65
- type: Array,
66
- required: true
67
- }
74
+ const props = withDefaults(defineProps<Props>(), {
75
+ title: "",
76
+ modelValue: null,
77
+ tabsClass: "w-[13.5rem]",
78
+ panelsClass: "w-[35.5rem]"
68
79
  });
69
80
 
70
81
  const activePanel = ref(props.modelValue);
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <QTabPanels
3
3
  :model-value="activePanel"
4
- class="overflow-y-auto bg-gray-100 h-full transition-all"
4
+ class="dx-panels-drawer-panels overflow-y-auto h-full transition-all"
5
5
  >
6
6
  <QTabPanel
7
7
  v-for="panel in panels"
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <QTabs
3
+ class="dx-panels-drawer-tabs overflow-y-auto"
3
4
  :model-value="modelValue"
4
5
  vertical
5
6
  align="left"
@@ -50,8 +51,6 @@ defineProps({
50
51
 
51
52
  :global(.q-tab) {
52
53
  justify-content: start !important;
53
- padding: 0;
54
- @apply text-left py-2.5 px-2 rounded-lg hover:bg-slate-200;
55
54
 
56
55
  :global(.q-focus-helper), :global(.q-tab__indicator) {
57
56
  display: none;
@@ -61,9 +60,5 @@ defineProps({
61
60
  @apply p-0;
62
61
  }
63
62
  }
64
-
65
- :global(.q-tab.q-tab--active) {
66
- @apply text-white bg-blue-600;
67
- }
68
63
  }
69
64
  </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <QBtn
3
- class="bg-slate-200"
3
+ class="dx-export-button dx-action-button"
4
4
  :loading="isExporting"
5
5
  @click="onExport"
6
6
  >
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
  <QBtn
3
- class="bg-slate-200"
3
+ class="dx-refresh-button dx-action-button"
4
4
  :loading="loading"
5
5
  >
6
6
  <RefreshIcon class="w-5" />
7
7
  </QBtn>
8
8
  </template>
9
- <script setup>
9
+ <script setup lang="ts">
10
10
  import { RefreshIcon } from "@heroicons/vue/solid";
11
11
 
12
12
  defineEmits(["refresh"]);
13
- defineProps({
14
- loading: Boolean
15
- });
13
+ defineProps<{
14
+ loading?: boolean
15
+ }>();
16
16
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
- <div class="previous-next-controls">
2
+ <div class="dx-previous-next-controls">
3
3
  <QBtn
4
- class="bg-slate-200 border-gray-300 border border-solid !rounded-r-none !p-2 !min-w-0"
4
+ class="dx-control dx-control-previous border border-solid !rounded-r-none !p-2 !min-w-0"
5
5
  :disable="isLoading"
6
6
  :loading="isLoading"
7
7
  @click="$emit('next', -1)"
@@ -9,7 +9,7 @@
9
9
  <SkipPreviousIcon class="w-6" />
10
10
  </QBtn>
11
11
  <QBtn
12
- class="bg-slate-200 border-gray-300 border border-solid border-l-0 !rounded-l-none !p-2 !min-w-0"
12
+ class="dx-control dx-control-next border border-solid border-l-0 !rounded-l-none !p-2 !min-w-0"
13
13
  :disable="isLoading"
14
14
  :loading="isLoading"
15
15
  @click="$emit('next', 1)"
@@ -23,6 +23,6 @@ import { SkipNextIcon, SkipPreviousIcon } from "../../../svg";
23
23
 
24
24
  defineEmits(["next"]);
25
25
  defineProps({
26
- isLoading: Boolean
26
+ isLoading: Boolean
27
27
  });
28
28
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
+ class="dx-collapsable-sidebar overflow-y-auto overflow-x-hidden scroll-smooth flex-shrink-0 transition-all relative"
3
4
  :class="{
4
- [cls['collapsable-sidebar']]: true,
5
5
  'is-collapsed': isCollapsed,
6
6
  'is-right-side': rightSide,
7
7
  [displayClass]: true,
@@ -81,7 +81,7 @@ const isCollapsed = ref(getItem(props.name + "-is-collapsed", props.collapse));
81
81
 
82
82
  function setCollapse(state) {
83
83
  isCollapsed.value = state;
84
- setItem(props.name + "-is-collapsed", isCollapsed.value ? "1" : "");
84
+ setItem(props.name + "-is-collapsed", !!isCollapsed.value);
85
85
  }
86
86
 
87
87
  function toggleCollapse() {
@@ -104,9 +104,3 @@ watch(() => props.collapse, () => {
104
104
  setCollapse(props.collapse);
105
105
  });
106
106
  </script>
107
-
108
- <style module="cls" lang="scss">
109
- .collapsable-sidebar {
110
- @apply overflow-y-auto overflow-x-hidden scroll-smooth flex-shrink-0 border-r border-gray-200 transition-all relative;
111
- }
112
- </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <a
3
- class="p-3 actionable"
3
+ class="p-3 dx-popover-menu"
4
4
  :class="{'opacity-50 cursor-not-allowed': disabled}"
5
5
  >
6
6
  <QTooltip v-if="$slots.tooltip || tooltip">
@@ -16,7 +16,7 @@
16
16
  />
17
17
  <MenuIcon
18
18
  v-else
19
- class="w-4 text-black"
19
+ class="w-4 dx-menu-icon"
20
20
  />
21
21
  </Transition>
22
22
  <QMenu
@@ -73,7 +73,7 @@ defineProps({
73
73
  type: [Function, Object],
74
74
  default: () => ({
75
75
  is: QSpinner,
76
- props: { class: "w-4 h-4 text-black" }
76
+ props: { class: "w-4 h-4" }
77
77
  })
78
78
  }
79
79
  });