kempo-inventory 0.4.0 → 0.4.1
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/admin/index.page.html +6 -5
- package/package.json +4 -4
package/admin/index.page.html
CHANGED
|
@@ -17,6 +17,7 @@ locked: true
|
|
|
17
17
|
<script type="module" src="/kempo-ui/components/Toggle.js"></script>
|
|
18
18
|
<script type="module" src="/kempo-ui/components/Combobox.js"></script>
|
|
19
19
|
<script type="module" src="/kempo-ui/components/Icon.js"></script>
|
|
20
|
+
<script type="module" src="/kempo-ui/components/controls/TcOpen.js"></script>
|
|
20
21
|
<script type="module" src="/kempo/components/Permission.js"></script>
|
|
21
22
|
<script type="module" src="/inventory/components/RowAction.js"></script>
|
|
22
23
|
|
|
@@ -28,6 +29,7 @@ locked: true
|
|
|
28
29
|
-->
|
|
29
30
|
<k-table
|
|
30
31
|
id="itemsTable"
|
|
32
|
+
open-on-click
|
|
31
33
|
enable-pages
|
|
32
34
|
page-size="25"
|
|
33
35
|
page-size-options="[10,25,50,100]"
|
|
@@ -90,8 +92,9 @@ locked: true
|
|
|
90
92
|
$control.setAttribute('slot', slot);
|
|
91
93
|
for(const [name, value] of Object.entries(attributes)) $control.setAttribute(name, value);
|
|
92
94
|
$table.appendChild($control);
|
|
95
|
+
return $control;
|
|
93
96
|
};
|
|
94
|
-
if(can('items:update')) addControl('
|
|
97
|
+
if(can('items:update')) addControl('kc-tc-open', 'before', { title: 'Edit' }).appendChild(Object.assign(document.createElement('k-icon'), { name: 'edit' }));
|
|
95
98
|
if(can('quantity:adjust')) addControl('k-inventory-row-action', 'before', { action: 'adjust', icon: 'repeat', title: 'Adjust quantity' });
|
|
96
99
|
if(can('items:delete')){
|
|
97
100
|
$table.setAttribute('request-delete', '');
|
|
@@ -111,7 +114,7 @@ locked: true
|
|
|
111
114
|
user-supplied text itself.
|
|
112
115
|
*/
|
|
113
116
|
const decorate = (item, ctx) => {
|
|
114
|
-
const record = { ...item, qtyText: String(item.quantity), tagsText: item.tags.join(', '), ownerText: item.owner };
|
|
117
|
+
const record = { ...item, qtyText: String(item.quantity), tagsText: item.tags.join(', '), ownerText: item.owner, ...(can('items:update') && { _url: `/admin/extension/kempo-inventory/edit?id=${encodeURIComponent(item.id)}` }) };
|
|
115
118
|
/* Only the fields that apply to this item's category; a column another category's items fill stays blank here. */
|
|
116
119
|
for(const field of applicableFields(fields, item.category).filter(f => f.listed)) record[`f_${field.key}`] = displayValue(field, item.fields[field.key], ctx);
|
|
117
120
|
return record;
|
|
@@ -119,7 +122,7 @@ locked: true
|
|
|
119
122
|
|
|
120
123
|
const columns = () => [
|
|
121
124
|
{ name: 'sku', label: 'SKU', size: 130, editable: false },
|
|
122
|
-
{ name: 'name', label: 'Name',
|
|
125
|
+
{ name: 'name', label: 'Name', editable: false },
|
|
123
126
|
{ name: 'category', label: 'Category', size: 140, editable: false },
|
|
124
127
|
{ name: 'qtyText', label: 'Quantity', size: 100, editable: false },
|
|
125
128
|
{ name: 'tagsText', label: 'Tags', size: 160, editable: false },
|
|
@@ -185,8 +188,6 @@ locked: true
|
|
|
185
188
|
});
|
|
186
189
|
|
|
187
190
|
$table.addEventListener('itemAction', ({ detail: { action, record } }) => {
|
|
188
|
-
/* Editing is a page of its own, like adding: a dialog is too easy to dismiss and loses what was entered. */
|
|
189
|
-
if(action === 'edit') location.href = `/admin/extension/kempo-inventory/edit?id=${encodeURIComponent(record.id)}`;
|
|
190
191
|
if(action === 'adjust') openAdjustDialog({ item: record, onSaved: load });
|
|
191
192
|
});
|
|
192
193
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kempo-inventory",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "A basic inventory management system for kempo cms",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"author": "Dustin Poissant",
|
|
6
|
+
"author": "Dustin Poissant <dustinpoissant@gmail.com>",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/dustinpoissant/kempo-inventory.git"
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"drizzle-orm": "^0.45.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"kempo": ">=4.7
|
|
43
|
-
"kempo-ui": ">=0.
|
|
42
|
+
"kempo": ">=4.9.7",
|
|
43
|
+
"kempo-ui": ">=0.7.0",
|
|
44
44
|
"kempo-media": ">=0.3.0",
|
|
45
45
|
"kempo-files": ">=0.1.3",
|
|
46
46
|
"kempo-thumbs": ">=0.1.3"
|