@dile/crud 1.8.0 → 1.8.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.
|
@@ -205,8 +205,8 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
205
205
|
<dile-crud-list-item
|
|
206
206
|
itemId="${this.computeItemId(element)}"
|
|
207
207
|
.actionIds="${this.actionIds}"
|
|
208
|
-
?disableEdit=${this.
|
|
209
|
-
?disableDelete=${this.
|
|
208
|
+
?disableEdit=${!this.isItemEditable(element)}
|
|
209
|
+
?disableDelete=${!this.isItemDeletable(element)}
|
|
210
210
|
?disableRestore=${this.config?.customization?.disableRestore}
|
|
211
211
|
?hideCheckboxSelection="${this.config?.customization?.hideCheckboxSelection}"
|
|
212
212
|
@item-checkbox-changed=${this.onItemsCheckboxChanged}
|
|
@@ -229,6 +229,18 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
229
229
|
return this.config.computeItemId(element);
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
isItemEditable(element) {
|
|
233
|
+
const isGloballyDisabled = this.config?.customization?.disableEdit;
|
|
234
|
+
const isItemEditable = this.config?.isItemEditable(element) ?? true;
|
|
235
|
+
return !isGloballyDisabled && isItemEditable;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
isItemDeletable(element) {
|
|
239
|
+
const isGloballyDisabled = this.config?.customization?.disableDelete;
|
|
240
|
+
const isItemDeletable = this.config?.isItemDeletable(element) ?? true;
|
|
241
|
+
return !isGloballyDisabled && isItemDeletable;
|
|
242
|
+
}
|
|
243
|
+
|
|
232
244
|
get allIdsUrl() {
|
|
233
245
|
return `${this.config.endpoint}/allids`;
|
|
234
246
|
}
|
package/lib/defaultConfig.js
CHANGED
|
@@ -39,12 +39,15 @@ export const defaultConfig = {
|
|
|
39
39
|
updateOperation: {
|
|
40
40
|
type: 'modal'
|
|
41
41
|
},
|
|
42
|
-
insertOperation: {
|
|
43
|
-
type: 'modal'
|
|
44
|
-
},
|
|
45
42
|
computeItemId(element) {
|
|
46
43
|
return element.id;
|
|
47
44
|
},
|
|
45
|
+
isItemEditable(element) {
|
|
46
|
+
return true;
|
|
47
|
+
},
|
|
48
|
+
isItemDeletable(element) {
|
|
49
|
+
return true;
|
|
50
|
+
},
|
|
48
51
|
actions: {
|
|
49
52
|
list: [
|
|
50
53
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Components to create a generic crud system based on Web Components and Lit",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "5c09eb3ba4a0f9fcc4235d670c00ab91bf68860c"
|
|
35
35
|
}
|