adminforth 1.2.46 → 1.2.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.
@@ -404,7 +404,7 @@ class CodeInjector {
404
404
  const pluginPackages = [];
405
405
  // for every installed plugin generate packages
406
406
  for (const plugin of this.adminforth.activatedPlugins) {
407
- console.log('🔧 Checking packages for plugin', plugin.customFolderPath);
407
+ process.env.HEAVY_DEBUG && console.log('🔧 Checking packages for plugin', plugin.constructor.name, plugin.customFolderPath);
408
408
  const [lockHash, packages] = yield this.packagesFromNpm(plugin.customFolderPath);
409
409
  if (packages.length) {
410
410
  pluginPackages.push({
@@ -244,7 +244,6 @@ export function createRGBA(color, opacity) {
244
244
  else if (color.startsWith("rgba")) {
245
245
  //add opacity to existing rgba color
246
246
  const rgb = color.match(/[\d.]+/g);
247
- console.log('rgb', rgb);
248
247
  return `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${Number(rgb[3]) * opacity})`;
249
248
  }
250
249
  else if (color.startsWith("rgb")) {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <nav class="flex" aria-label="Breadcrumb">
3
- <ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse">
3
+ <ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse flex-wrap">
4
4
  <li class="inline-flex items-center">
5
5
  <RouterLink :to="{name: 'home'}" class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
6
6
  <svg class="w-3 h-3 me-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
@@ -23,7 +23,8 @@
23
23
  <svg class="rtl:rotate-180 w-3 h-3 text-gray-400 mx-1" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
24
24
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 9 4-4-4-4"/>
25
25
  </svg>
26
- <span class="ms-1 text-sm font-medium text-gray-500 md:ms-2 dark:text-gray-400">
26
+ <span class="ms-1 text-sm font-medium text-gray-500 md:ms-2 dark:text-gray-400
27
+ max-w-80 truncate">
27
28
  {{ $route.name === 'resource-edit' ? 'Edit' : 'Show' }} {{ coreStore.record?._label }}</span>
28
29
  </div>
29
30
  </li>
@@ -99,11 +99,13 @@ const start = computed(() => {
99
99
  return date.utc().toISOString();
100
100
  })
101
101
 
102
- function updateFromProps() {
102
+ async function updateFromProps() {
103
103
  if (!props.valueStart) {
104
104
  datepickerStartEl.value.value = '';
105
105
  startTime.value = '';
106
106
  } else {
107
+ // wait ref to initialize
108
+ await (new Promise(resolve => setTimeout(resolve, 0)));
107
109
  datepickerObject.value.setDate(dayjs(props.valueStart).format('DD MMM YYYY'));
108
110
  startTime.value = dayjs(props.valueStart).format('HH:mm:ss')
109
111
  }
@@ -5,21 +5,24 @@
5
5
  >
6
6
  <form autocomplete="off" @submit.prevent>
7
7
  <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 ">
8
- <thead class="text-xs text-gray-700 uppercase bg-lightFormHeading dark:bg-gray-700 dark:text-gray-400">
8
+ <thead class="text-xs text-gray-700 uppercase bg-lightFormHeading dark:bg-gray-700 dark:text-gray-400 block md:table-row">
9
9
  <tr>
10
- <th scope="col" class="px-6 py-3">
10
+ <th scope="col" class="px-6 py-3 hidden md:table-cell">
11
11
  Field
12
12
  </th>
13
- <th scope="col" class="px-6 py-3 w-4/6">
13
+ <th scope="col" class="px-6 py-3 w-4/6 hidden md:table-cell">
14
14
  Value
15
15
  </th>
16
+
17
+
16
18
  </tr>
17
19
  </thead>
18
20
  <tbody>
19
21
  <tr v-for="column, i in editableColumns" :key="column.name"
20
- class="bg-ligftForm dark:bg-gray-800 border-b dark:border-gray-700"
22
+ v-if="currentValues !== null"
23
+ class="bg-ligftForm dark:bg-gray-800 border-b dark:border-gray-700 block md:table-row"
21
24
  >
22
- <td class="px-6 py-4 whitespace-nowrap flex items-center"> <!--align-top-->
25
+ <td class="px-6 py-4 sm:pb-0 whitespace-nowrap flex items-center block md:table-cell"> <!--align-top-->
23
26
  {{ column.label }}
24
27
  <span :data-tooltip-target="`tooltip-show-${i}`" class="ml-1 relative inline-block">
25
28
  <IconExclamationCircleSolid v-if="column.required[mode]" class="w-4 h-4"
@@ -33,7 +36,7 @@
33
36
  <div class="tooltip-arrow" data-popper-arrow></div>
34
37
  </div>
35
38
  </td>
36
- <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap relative">
39
+ <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap relative block md:table-cell">
37
40
  <template v-if="column?.components?.[props.source]?.file">
38
41
  <component
39
42
  :is="getCustomComponent(column.components[props.source])"
@@ -168,7 +171,7 @@ const mode = computed(() => props.record && Object.keys(props.record).length ?
168
171
 
169
172
  const emit = defineEmits(['update:record', 'update:isValid']);
170
173
 
171
- const currentValues = ref({});
174
+ const currentValues = ref(null);
172
175
 
173
176
  const customComponentsInValidity = ref({});
174
177
  const customComponentsEmptiness = ref({});
@@ -176,6 +179,9 @@ const customComponentsEmptiness = ref({});
176
179
 
177
180
  const columnError = (column) => {
178
181
  const val = computed(() => {
182
+ if (!currentValues.value) {
183
+ return null;
184
+ }
179
185
  if (customComponentsInValidity.value[column.name]) {
180
186
  return customComponentsInValidity.value[column.name];
181
187
  }
@@ -244,9 +250,8 @@ const setCurrentValue = (key, value) => {
244
250
  };
245
251
 
246
252
  onMounted(() => {
247
- Object.keys(props.record).forEach((key) => {
248
- currentValues.value[key] = props.record[key];
249
- });
253
+ currentValues.value = Object.assign({}, props.record);
254
+ console.log('2️⃣ currentValues', JSON.stringify(currentValues.value));
250
255
  initFlowbite();
251
256
  emit('update:isValid', isValid.value);
252
257
  });
@@ -462,7 +462,7 @@ class CodeInjector implements ICodeInjector {
462
462
 
463
463
  // for every installed plugin generate packages
464
464
  for (const plugin of this.adminforth.activatedPlugins) {
465
- console.log('🔧 Checking packages for plugin', plugin.customFolderPath);
465
+ process.env.HEAVY_DEBUG && console.log('🔧 Checking packages for plugin', plugin.constructor.name, plugin.customFolderPath);
466
466
  const [lockHash, packages] = await this.packagesFromNpm(plugin.customFolderPath);
467
467
  if (packages.length) {
468
468
  pluginPackages.push({
package/modules/utils.ts CHANGED
@@ -259,7 +259,6 @@ function hexToRGBA(hex,opacity){
259
259
  else if (color.startsWith("rgba")) {
260
260
  //add opacity to existing rgba color
261
261
  const rgb = color.match(/[\d.]+/g);
262
- console.log('rgb',rgb)
263
262
  return `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, ${Number(rgb[3]) * opacity})`;
264
263
  }
265
264
  else if (color.startsWith("rgb")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.2.46",
3
+ "version": "1.2.48",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <nav class="flex" aria-label="Breadcrumb">
3
- <ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse">
3
+ <ol class="inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse flex-wrap">
4
4
  <li class="inline-flex items-center">
5
5
  <RouterLink :to="{name: 'home'}" class="inline-flex items-center text-sm font-medium text-gray-700 hover:text-blue-600 dark:text-gray-400 dark:hover:text-white">
6
6
  <svg class="w-3 h-3 me-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
@@ -23,7 +23,8 @@
23
23
  <svg class="rtl:rotate-180 w-3 h-3 text-gray-400 mx-1" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 6 10">
24
24
  <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 9 4-4-4-4"/>
25
25
  </svg>
26
- <span class="ms-1 text-sm font-medium text-gray-500 md:ms-2 dark:text-gray-400">
26
+ <span class="ms-1 text-sm font-medium text-gray-500 md:ms-2 dark:text-gray-400
27
+ max-w-80 truncate">
27
28
  {{ $route.name === 'resource-edit' ? 'Edit' : 'Show' }} {{ coreStore.record?._label }}</span>
28
29
  </div>
29
30
  </li>
@@ -99,11 +99,13 @@ const start = computed(() => {
99
99
  return date.utc().toISOString();
100
100
  })
101
101
 
102
- function updateFromProps() {
102
+ async function updateFromProps() {
103
103
  if (!props.valueStart) {
104
104
  datepickerStartEl.value.value = '';
105
105
  startTime.value = '';
106
106
  } else {
107
+ // wait ref to initialize
108
+ await (new Promise(resolve => setTimeout(resolve, 0)));
107
109
  datepickerObject.value.setDate(dayjs(props.valueStart).format('DD MMM YYYY'));
108
110
  startTime.value = dayjs(props.valueStart).format('HH:mm:ss')
109
111
  }
@@ -5,21 +5,24 @@
5
5
  >
6
6
  <form autocomplete="off" @submit.prevent>
7
7
  <table class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400 ">
8
- <thead class="text-xs text-gray-700 uppercase bg-lightFormHeading dark:bg-gray-700 dark:text-gray-400">
8
+ <thead class="text-xs text-gray-700 uppercase bg-lightFormHeading dark:bg-gray-700 dark:text-gray-400 block md:table-row">
9
9
  <tr>
10
- <th scope="col" class="px-6 py-3">
10
+ <th scope="col" class="px-6 py-3 hidden md:table-cell">
11
11
  Field
12
12
  </th>
13
- <th scope="col" class="px-6 py-3 w-4/6">
13
+ <th scope="col" class="px-6 py-3 w-4/6 hidden md:table-cell">
14
14
  Value
15
15
  </th>
16
+
17
+
16
18
  </tr>
17
19
  </thead>
18
20
  <tbody>
19
21
  <tr v-for="column, i in editableColumns" :key="column.name"
20
- class="bg-ligftForm dark:bg-gray-800 border-b dark:border-gray-700"
22
+ v-if="currentValues !== null"
23
+ class="bg-ligftForm dark:bg-gray-800 border-b dark:border-gray-700 block md:table-row"
21
24
  >
22
- <td class="px-6 py-4 whitespace-nowrap flex items-center"> <!--align-top-->
25
+ <td class="px-6 py-4 sm:pb-0 whitespace-nowrap flex items-center block md:table-cell"> <!--align-top-->
23
26
  {{ column.label }}
24
27
  <span :data-tooltip-target="`tooltip-show-${i}`" class="ml-1 relative inline-block">
25
28
  <IconExclamationCircleSolid v-if="column.required[mode]" class="w-4 h-4"
@@ -33,7 +36,7 @@
33
36
  <div class="tooltip-arrow" data-popper-arrow></div>
34
37
  </div>
35
38
  </td>
36
- <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap relative">
39
+ <td class="px-6 py-4 whitespace-nowrap whitespace-pre-wrap relative block md:table-cell">
37
40
  <template v-if="column?.components?.[props.source]?.file">
38
41
  <component
39
42
  :is="getCustomComponent(column.components[props.source])"
@@ -168,7 +171,7 @@ const mode = computed(() => props.record && Object.keys(props.record).length ?
168
171
 
169
172
  const emit = defineEmits(['update:record', 'update:isValid']);
170
173
 
171
- const currentValues = ref({});
174
+ const currentValues = ref(null);
172
175
 
173
176
  const customComponentsInValidity = ref({});
174
177
  const customComponentsEmptiness = ref({});
@@ -176,6 +179,9 @@ const customComponentsEmptiness = ref({});
176
179
 
177
180
  const columnError = (column) => {
178
181
  const val = computed(() => {
182
+ if (!currentValues.value) {
183
+ return null;
184
+ }
179
185
  if (customComponentsInValidity.value[column.name]) {
180
186
  return customComponentsInValidity.value[column.name];
181
187
  }
@@ -244,9 +250,8 @@ const setCurrentValue = (key, value) => {
244
250
  };
245
251
 
246
252
  onMounted(() => {
247
- Object.keys(props.record).forEach((key) => {
248
- currentValues.value[key] = props.record[key];
249
- });
253
+ currentValues.value = Object.assign({}, props.record);
254
+ console.log('2️⃣ currentValues', JSON.stringify(currentValues.value));
250
255
  initFlowbite();
251
256
  emit('update:isValid', isValid.value);
252
257
  });