@opengis/admin 0.4.34 → 0.4.36

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/admin",
3
- "version": "0.4.34",
3
+ "version": "0.4.36",
4
4
  "description": "This project Softpro Admin",
5
5
  "main": "dist/admin.js",
6
6
  "type": "module",
@@ -17,8 +17,11 @@ export default async function descriptionList(data, opt) {
17
17
 
18
18
  // no data
19
19
  if (hash.nodata && !data) {
20
- const noDataText = typeof hash.nodata == 'string' ? hash.nodata : '<div class="bg-gray-200 text-center p-6 rounded-xl"><h3 class="text-lg font-semibold">Інформація відсутня</h3></div>';
21
- return noDataText
20
+ const noDataText =
21
+ typeof hash.nodata == 'string'
22
+ ? hash.nodata
23
+ : '<div class="bg-gray-200 dark:bg-transparent dark:text-white text-center p-6 rounded-xl"><h3 class="text-lg font-semibold">Інформація відсутня</h3></div>';
24
+ return noDataText;
22
25
  }
23
26
  if (!hash.columns) return 'columns empty'
24
27
  const keys = hash.columns.split(hash.divider || ',').map(el => hash.comma ? el.trim().replace(new RegExp(hash.comma || '#', 'g'), ',') : el.trim());
@@ -35,12 +38,22 @@ export default async function descriptionList(data, opt) {
35
38
 
36
39
  const d1 = await format(data[key], key, data) || '-';
37
40
 
38
- result.push(`<div class="grid grid-cols-1 gap-1 py-3 sm:grid-cols-3 sm:gap-4 even:bg-gray-50 text-[12px]">
39
- <dt class="text-gray-900">${nameHBS || name}</dt>
40
- <dd class="text-gray-700 sm:col-span-2">${d1}</dd>
41
+ result.push(`
42
+ <div class="grid grid-cols-1 gap-1 py-3 sm:grid-cols-3 sm:gap-4
43
+ even:bg-gray-50 dark:bg-transparent bg-white
44
+ text-[12px] text-gray-700 dark:text-white">
45
+ <dt class="text-gray-900 dark:text-white">${nameHBS || name}</dt>
46
+ <dd class="text-gray-700 dark:text-white sm:col-span-2">${d1}</dd>
41
47
  </div>
42
48
  `);
43
49
 
44
50
  }
45
- return '<dl class=" divide-y divide-gray-100 py-[5px] w-full">' + result.join('') + '</dl>';
51
+ return `
52
+ <div class="min-w-full relative overflow-auto
53
+ divide-y divide-gray-200 dark:divide-gray-700
54
+ bg-white dark:bg-transparent
55
+ text-[12px] text-gray-600 dark:text-white">
56
+ ${result.join('')}
57
+ </div>
58
+ `;
46
59
  }
@@ -31,7 +31,7 @@ export default async function tableList(data, opt) {
31
31
  const keys = hash.columns.split(hash.divider || ',').map(el => hash.comma ? el.trim().replace(new RegExp(hash.comma, 'g'), ',') : el.trim()).concat(hash.uid && hash.table && hash.id && !hash.noactions ? ['Дії', 'actions'] : []);
32
32
 
33
33
  const result = [];
34
- result.push('<thead class="text-left font-medium text-gray-700"> <tr>');
34
+ result.push('<thead class="text-left font-medium text-gray-700 dark:text-white dark:bg-transparent"> <tr>');
35
35
 
36
36
  // thead
37
37
  const skip = {}
@@ -48,16 +48,19 @@ export default async function tableList(data, opt) {
48
48
  if (skip[name]) continue;
49
49
 
50
50
  const isActionsColumn = hash.noactions && i === keys.length - 2;
51
- result.push(`<th class="py-2 min-w-[200px] ${isActionsColumn ? 'last:min-w-[60px] last:max-w-[60px] last:bg-white last:sticky last:right-0' : ''}">
52
- ${nameHBS || name}
53
- </th>`)
51
+ result.push(`
52
+ <th class="py-2 min-w-[200px] ${isActionsColumn
53
+ ? 'last:min-w-[60px] last:max-w-[60px] last:bg-white last:sticky last:right-0'
54
+ : ''}">
55
+ ${nameHBS || name}
56
+ </th>`);
54
57
  }
55
- result.push('</tr></thead><tbody class="divide-y divide-gray-200">');
58
+ result.push('</tr></thead><tbody class="divide-y divide-gray-200 dark:divide-gray-700">');
56
59
 
57
60
  // body
58
61
  for (let k = 0; k < data.length; k += 1) {
59
62
  const row = data[k];
60
- result.push('<tr class="bg-white odd:bg-gray-50 ">');
63
+ result.push('<tr class="bg-white odd:bg-gray-50 dark:bg-transparent dark:odd:bg-transparent">');
61
64
  const obj = { form: hash.form, table: hash.table, id: row[hash.id] }
62
65
  const token = hash.table ? setToken({ ids: [JSON.stringify(obj)], uid: hash.uid, array: 1 })[0] : null;
63
66
  for (let i = 0; i < keys.length; i += 2) {
@@ -70,9 +73,10 @@ export default async function tableList(data, opt) {
70
73
  const tokenData = key == 'actions' ? token : null;
71
74
  const d1 = key.includes('{{') ? await handlebars.compile(key)({ ...row, token, hash }) || '-' : null
72
75
  const isActionsColumn = hash.noactions && i === keys.length - 2;
73
- result.push(`<td class="py-2 pr-5 ${isActionsColumn ? 'last:sticky last:right-0' : ''}">
74
- ${d1 || format(tokenData || row[key], key, row, hash)}
75
- </td>`);
76
+ result.push(`
77
+ <td class="py-2 pr-5 ${isActionsColumn ? 'last:sticky last:right-0' : ''} dark:text-white">
78
+ ${d1 || format(tokenData || row[key], key, row, hash)}
79
+ </td>`);
76
80
 
77
81
  }
78
82
  // action token
@@ -82,5 +86,10 @@ export default async function tableList(data, opt) {
82
86
  result.push('</tbody>');
83
87
 
84
88
  // console.log(Date.now() - time)
85
- return '<table class="min-w-full relative divide-y-2 divide-gray-200 bg-white min-w-full overflow-auto divide-y-2 divide-gray-200 bg-white text-[12px] text-gray-600">' + result.join('') + '</table>';
89
+ return `<table class="min-w-full relative overflow-auto
90
+ divide-y-2 divide-gray-200 dark:divide-gray-700
91
+ bg-white dark:bg-transparent
92
+ text-[12px] text-gray-600 dark:text-white">
93
+ ${result.join('')}
94
+ </table>`;
86
95
  }
@@ -110,11 +110,11 @@ export default async function plugin(fastify) {
110
110
  clsQuery.push(`insert into admin.cls(name,type,data,module,hash) values('${name}','sql','${(loadTemplate?.sql || loadTemplate)?.replace(/'/g, "''")}', '${module?.replace(/'/g, "''")}','${el.hash}')`);
111
111
  if (config.trace) console.log(name, type, 'insert fresh select');
112
112
  return el.hash;
113
- } else if (type === 'cls' && loadTemplate?.length && el.update) {
113
+ } else if (type === 'cls' && loadTemplate?.length && (el.update || Object.hasOwn(loadTemplate?.[0] || {}, 'color'))) {
114
114
  clsQuery.push(`insert into admin.cls(name,type, module,hash) values('${name}','json', '${module?.replace(/'/g, "''")}','${el.hash}');
115
- insert into admin.cls(code,name,parent,icon,data)
116
- select value->>'id',value->>'text','${name}',value->>'icon',value->>'data'
117
- from json_array_elements('${JSON.stringify(loadTemplate).replace(/'/g, "''")}'::json)`);
115
+ insert into admin.cls(code,name,parent,icon,color,data)
116
+ select value->>'id',value->>'text','${name}',value->>'icon',value->>'color',value->>'data'
117
+ from json_array_elements('${JSON.stringify(loadTemplate).replace(/'/g, "''")}'::json) on conflict (code,parent) do update set color=excluded.color;`);
118
118
  if (config.trace) console.log(name, type, 'insert fresh cls');
119
119
  return el.hash;
120
120
  } else if (hashes.includes(el.hash)) {