adminforth 1.5.11-next.2 → 1.5.11

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.
@@ -116,8 +116,12 @@ const options = computed(() => {
116
116
 
117
117
  // for each of ...props.options merge on lowest level. so if { chart: {height : 2} }, it should not replace chart level, only height level
118
118
  function mergeOptions(options: any, newOptions: any) {
119
+ if (!newOptions) {
120
+ return;
121
+ }
119
122
  for (const key in newOptions) {
120
- if (typeof newOptions[key] === 'object') {
123
+ // and is not array
124
+ if (typeof newOptions[key] === 'object' && !Array.isArray(newOptions[key])) {
121
125
  if (!options[key]) {
122
126
  options[key] = {};
123
127
  }
@@ -128,8 +128,12 @@ const options = computed(() => {
128
128
 
129
129
  // for each of ...props.options merge on lowest level. so if { chart: {height : 2} }, it should not replace chart level, only height level
130
130
  function mergeOptions(options: any, newOptions: any) {
131
+ if (!newOptions) {
132
+ return;
133
+ }
131
134
  for (const key in newOptions) {
132
- if (typeof newOptions[key] === 'object') {
135
+ // and is not array
136
+ if (typeof newOptions[key] === 'object' && !Array.isArray(newOptions[key])) {
133
137
  if (!options[key]) {
134
138
  options[key] = {};
135
139
  }
@@ -42,7 +42,7 @@ const optionsBase = {
42
42
  chart: {
43
43
  height: 400,
44
44
  width: "100%",
45
- type: "donut",
45
+ type: "pie",
46
46
  },
47
47
  stroke: {
48
48
  colors: ["transparent"],
@@ -137,7 +137,8 @@ const options = computed(() => {
137
137
  return;
138
138
  }
139
139
  for (const key in newOptions) {
140
- if (typeof newOptions[key] === 'object') {
140
+ // and is not array
141
+ if (typeof newOptions[key] === 'object' && !Array.isArray(newOptions[key])) {
141
142
  if (!options[key]) {
142
143
  options[key] = {};
143
144
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="relative inline-block afcl-select">
2
+ <div class="relative inline-block afcl-select" ref="internalSelect">
3
3
  <div class="relative">
4
4
  <input
5
5
  ref="inputEl"
@@ -89,7 +89,6 @@ import { ref, computed, onMounted, onUnmounted, watch, type Ref } from 'vue';
89
89
  import { IconCaretDownSolid } from '@iconify-prerendered/vue-flowbite';
90
90
  import { useElementSize } from '@vueuse/core'
91
91
 
92
-
93
92
  const props = defineProps({
94
93
  options: Array,
95
94
  modelValue: {
@@ -123,6 +122,7 @@ const dropdownStyle = ref<{ top?: string; }>({
123
122
  });
124
123
 
125
124
  const selectedItems: Ref<any[]> = ref([]);
125
+ const internalSelect = ref<HTMLElement | null>(null);
126
126
 
127
127
  function inputInput() {
128
128
  if (!props.multiple && selectedItems.value.length) {
@@ -147,15 +147,12 @@ function updateFromProps() {
147
147
  }
148
148
 
149
149
  function inputClick() {
150
- if (props.isReadonly) {
151
- return;
152
- }
153
- if (!showDropdown.value) {
154
- showDropdown.value = true;
155
- } else {
156
- if (!search.value) {
157
- showDropdown.value = false;
158
- }
150
+ if (props.isReadonly) return;
151
+ // Toggle local dropdown
152
+ showDropdown.value = !showDropdown.value;
153
+ // If the dropdown is about to close, reset the search
154
+ if (!showDropdown.value && !search.value) {
155
+ search.value = '';
159
156
  }
160
157
  }
161
158
 
@@ -198,10 +195,12 @@ const filteredItems = computed(() => {
198
195
  );
199
196
  });
200
197
 
201
- const handleClickOutside = (event) => {
202
- if (!event.target.closest('.afcl-select')) {
198
+
199
+ const handleClickOutside = (event: MouseEvent) => {
200
+ const targetEl = event.target as HTMLElement | null;
201
+ const closestSelect = targetEl?.closest('.afcl-select');
202
+ if (closestSelect !== internalSelect.value)
203
203
  showDropdown.value = false;
204
- }
205
204
  };
206
205
 
207
206
  const addClickListener = () => {
@@ -228,7 +227,7 @@ const toogleItem = (item) => {
228
227
  if (!props.multiple && search.value) {
229
228
  search.value = '';
230
229
  }
231
-
230
+
232
231
  const list = selectedItems.value.map(item => item.value);
233
232
  const updValue = list.length ? list : null;
234
233
  let emitValue;
@@ -238,13 +237,10 @@ const toogleItem = (item) => {
238
237
  emitValue = updValue;
239
238
  }
240
239
  emit('update:modelValue', emitValue);
241
-
242
240
  };
243
241
 
244
-
245
242
  onUnmounted(() => {
246
243
  removeClickListener();
247
244
  });
248
245
 
249
-
250
246
  </script>
@@ -7,7 +7,7 @@
7
7
  <th scope="col" class="px-6 py-3"
8
8
  v-for="column in columns"
9
9
  >
10
- <slot v-if="$slots[`header:${column.fieldName}`]" :name="$slots[`header:${column.fieldName}`]" :column="column" />
10
+ <slot v-if="$slots[`header:${column.fieldName}`]" :name="`header:${column.fieldName}`" :column="column" />
11
11
 
12
12
  <span v-else>
13
13
  {{ column.label }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.5.11-next.2",
3
+ "version": "1.5.11",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",