quasar-ui-danx 0.2.21 → 0.2.22

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-danx",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
4
4
  "author": "Dan <dan@flytedesk.com>",
5
5
  "description": "DanX Vue / Quasar component library",
6
6
  "license": "MIT",
@@ -4,7 +4,7 @@
4
4
  disabled
5
5
  min-width="0"
6
6
  max-width="18rem"
7
- name="admin-ads"
7
+ :name="name"
8
8
  @update:collapse="$emit('update:show-filters', !$event)"
9
9
  >
10
10
  <FilterFieldList
@@ -15,7 +15,7 @@
15
15
  </QBtn>
16
16
  </div>
17
17
  <a
18
- v-if="activeCount > 0"
18
+ v-if="activeCount > 0 && showFilters"
19
19
  class="text-blue-600 hover:text-blue-plus-1 text-sm ml-4"
20
20
  @click="$emit('update:filter', {})"
21
21
  >Clear All</a>
@@ -4,7 +4,7 @@
4
4
  :show-filters="showFilters"
5
5
  :filter="filter"
6
6
  class="border-r p-4 flex-shrink-0"
7
- @update:show-filters="$emit('update:show-filters', $event)"
7
+ @update:show-filters="onFilter"
8
8
  @update:filter="$emit('update:filter', $event)"
9
9
  />
10
10
 
@@ -22,12 +22,15 @@
22
22
  import { QSeparator } from "quasar";
23
23
  import { FilterListToggle } from "../Filters";
24
24
 
25
- defineEmits(["update:show-filters", "update:filter"]);
26
- defineProps({
25
+ const emit = defineEmits(["update:show-filters", "update:filter"]);
26
+ const props = defineProps({
27
27
  filter: {
28
28
  type: Object,
29
29
  default: null
30
30
  },
31
31
  showFilters: Boolean
32
32
  });
33
+ function onFilter() {
34
+ emit("update:show-filters", !props.showFilters);
35
+ }
33
36
  </script>
@@ -28,12 +28,17 @@ export function useListControls(name: string, {
28
28
  const pagedItems = ref(null);
29
29
  const filter = ref({});
30
30
  const globalFilter = ref({});
31
- const showFilters = ref(getItem(`${name}-show-filters`, true));
31
+ const showFilters = ref(false);
32
32
  const selectedRows = ref([]);
33
33
  const isLoadingList = ref(false);
34
34
  const isLoadingSummary = ref(false);
35
35
  const summary = ref(null);
36
36
 
37
+ // Filter fields are the field values available for the currently applied filter on Creative Groups
38
+ // (ie: all states available under the current filter)
39
+ const filterFieldOptions = ref({});
40
+ const isLoadingFilters = ref(false);
41
+
37
42
  const filterActiveCount = computed(() => Object.keys(filter.value).filter(key => filter.value[key] !== undefined).length);
38
43
 
39
44
  const PAGING_DEFAULT = {
@@ -87,15 +92,11 @@ export function useListControls(name: string, {
87
92
  isLoadingSummary.value = false;
88
93
  }
89
94
 
90
- // Filter fields are the field values available for the currently applied filter on Creative Groups
91
- // (ie: all states available under the current filter)
92
- const filterFieldOptions = ref({});
93
- const isLoadingFilters = ref(false);
94
-
95
- watch(() => showFilters.value, (show) => {
96
- setItem(`${name}-show-filters`, show);
97
- });
98
-
95
+ /**
96
+ * Loads the filter field options for the current filter.
97
+ *
98
+ * @returns {Promise<void>}
99
+ */
99
100
  async function loadFilterFieldOptions() {
100
101
  if (!filterFieldOptionsRoute || !isInitialized) return;
101
102
  isLoadingFilters.value = true;
@@ -46,6 +46,7 @@
46
46
  <script setup>
47
47
  import { ChevronLeftIcon as ToggleIcon } from "@heroicons/vue/outline";
48
48
  import { computed, onMounted, ref, watch } from "vue";
49
+ import { getItem, setItem } from "../../../helpers";
49
50
 
50
51
  const emit = defineEmits(["collapse", "update:collapse"]);
51
52
  const props = defineProps({
@@ -76,24 +77,19 @@ const props = defineProps({
76
77
  hideToggleOnCollapse: Boolean
77
78
  });
78
79
 
79
- const isCollapsed = ref(props.collapse);
80
+ const isCollapsed = ref(getItem(props.name + "-is-collapsed", props.collapse));
80
81
 
81
- const stored = localStorage.getItem(props.name + "-is-collapsed");
82
-
83
- if (stored !== null) {
84
- isCollapsed.value = stored === "1";
82
+ function setCollapse(state) {
83
+ isCollapsed.value = state;
84
+ setItem(props.name + "-is-collapsed", isCollapsed.value ? "1" : "");
85
85
  }
86
+
86
87
  function toggleCollapse() {
87
88
  setCollapse(!isCollapsed.value);
88
89
  emit("collapse", isCollapsed.value);
89
90
  emit("update:collapse", isCollapsed.value);
90
91
  }
91
92
 
92
- function setCollapse(state) {
93
- isCollapsed.value = state;
94
- localStorage.setItem(props.name + "-is-collapsed", isCollapsed.value ? "1" : "");
95
- }
96
-
97
93
  onMounted(() => {
98
94
  emit("collapse", isCollapsed.value);
99
95
  emit("update:collapse", isCollapsed.value);
package/tsconfig.json CHANGED
@@ -33,11 +33,7 @@
33
33
  "sourceMap": true,
34
34
  // Base directory to resolve non-relative module names,
35
35
  "baseUrl": "./",
36
- "paths": {
37
- "@/*": [
38
- "./src/*"
39
- ]
40
- }
36
+ "paths": {}
41
37
  },
42
38
  "include": [
43
39
  "src/**/*.ts",