lkt-item-crud 2.0.13 → 2.0.15
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/dist/build.d.ts +6 -6
- package/dist/build.js +543 -374
- package/dist/components/ButtonNav.vue.d.ts +66 -23
- package/dist/components/ButtonNavButtons.vue.d.ts +75 -0
- package/dist/lib-components/LktItemCrud.vue.d.ts +33 -20
- package/package.json +1 -1
- package/src/components/ButtonNav.vue +90 -77
- package/src/lib-components/LktItemCrud.vue +130 -18
|
@@ -3,6 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
item: LktObject;
|
|
4
4
|
editing?: boolean;
|
|
5
5
|
loading?: boolean;
|
|
6
|
+
grouped?: boolean;
|
|
6
7
|
view: ItemCrudView;
|
|
7
8
|
mode: ItemCrudMode;
|
|
8
9
|
createButton?: ButtonConfig | false;
|
|
@@ -10,7 +11,11 @@ type __VLS_Props = {
|
|
|
10
11
|
dropButton?: ButtonConfig | false;
|
|
11
12
|
editModeButton?: ButtonConfig | false;
|
|
12
13
|
groupButton?: ButtonConfig | boolean;
|
|
14
|
+
groupButtonAsModalActions?: boolean;
|
|
13
15
|
dataChanged: boolean;
|
|
16
|
+
ableToCreate?: boolean;
|
|
17
|
+
ableToUpdate?: boolean;
|
|
18
|
+
ableToDrop?: boolean;
|
|
14
19
|
canUpdate?: boolean;
|
|
15
20
|
canDrop?: boolean;
|
|
16
21
|
canSwitchEditMode?: boolean;
|
|
@@ -18,83 +23,121 @@ type __VLS_Props = {
|
|
|
18
23
|
httpSuccessRead?: boolean;
|
|
19
24
|
buttonNavVisibility: ItemCrudButtonNavVisibility;
|
|
20
25
|
};
|
|
21
|
-
declare var
|
|
26
|
+
declare var __VLS_5: {
|
|
22
27
|
canUpdate: boolean | undefined;
|
|
23
28
|
canDrop: boolean | undefined;
|
|
24
29
|
perms: string[] | undefined;
|
|
25
|
-
},
|
|
30
|
+
}, __VLS_7: {
|
|
26
31
|
canUpdate: boolean | undefined;
|
|
27
32
|
canDrop: boolean | undefined;
|
|
28
33
|
perms: string[] | undefined;
|
|
29
|
-
},
|
|
34
|
+
}, __VLS_21: {
|
|
30
35
|
item: LktObject;
|
|
31
36
|
editMode: boolean;
|
|
32
37
|
isCreate: boolean;
|
|
33
38
|
canUpdate: boolean | undefined;
|
|
34
39
|
canDrop: boolean | undefined;
|
|
35
|
-
},
|
|
40
|
+
}, __VLS_35: {
|
|
36
41
|
item: LktObject;
|
|
37
42
|
editMode: boolean;
|
|
38
43
|
isCreate: boolean;
|
|
39
44
|
canUpdate: boolean | undefined;
|
|
40
45
|
canDrop: boolean | undefined;
|
|
41
|
-
},
|
|
46
|
+
}, __VLS_49: {
|
|
42
47
|
item: LktObject;
|
|
43
48
|
editMode: boolean;
|
|
44
49
|
isCreate: boolean;
|
|
45
50
|
canUpdate: boolean | undefined;
|
|
46
51
|
canDrop: boolean | undefined;
|
|
47
|
-
},
|
|
52
|
+
}, __VLS_51: {}, __VLS_63: {
|
|
48
53
|
canUpdate: boolean | undefined;
|
|
49
54
|
canDrop: boolean | undefined;
|
|
50
55
|
perms: string[] | undefined;
|
|
51
|
-
},
|
|
56
|
+
}, __VLS_65: {
|
|
52
57
|
canUpdate: boolean | undefined;
|
|
53
58
|
canDrop: boolean | undefined;
|
|
54
59
|
perms: string[] | undefined;
|
|
55
|
-
},
|
|
60
|
+
}, __VLS_79: {
|
|
56
61
|
item: LktObject;
|
|
57
62
|
editMode: boolean;
|
|
58
63
|
isCreate: boolean;
|
|
59
64
|
canUpdate: boolean | undefined;
|
|
60
65
|
canDrop: boolean | undefined;
|
|
61
|
-
},
|
|
66
|
+
}, __VLS_93: {
|
|
67
|
+
item: LktObject;
|
|
68
|
+
editMode: boolean;
|
|
69
|
+
isCreate: boolean;
|
|
70
|
+
canUpdate: boolean | undefined;
|
|
71
|
+
canDrop: boolean | undefined;
|
|
72
|
+
}, __VLS_107: {
|
|
73
|
+
item: LktObject;
|
|
74
|
+
editMode: boolean;
|
|
75
|
+
isCreate: boolean;
|
|
76
|
+
canUpdate: boolean | undefined;
|
|
77
|
+
canDrop: boolean | undefined;
|
|
78
|
+
}, __VLS_109: {}, __VLS_111: {
|
|
79
|
+
canUpdate: boolean | undefined;
|
|
80
|
+
canDrop: boolean | undefined;
|
|
81
|
+
perms: string[] | undefined;
|
|
82
|
+
}, __VLS_113: {
|
|
83
|
+
canUpdate: boolean | undefined;
|
|
84
|
+
canDrop: boolean | undefined;
|
|
85
|
+
perms: string[] | undefined;
|
|
86
|
+
}, __VLS_127: {
|
|
87
|
+
item: LktObject;
|
|
88
|
+
editMode: boolean;
|
|
89
|
+
isCreate: boolean;
|
|
90
|
+
canUpdate: boolean | undefined;
|
|
91
|
+
canDrop: boolean | undefined;
|
|
92
|
+
}, __VLS_141: {
|
|
62
93
|
item: LktObject;
|
|
63
94
|
editMode: boolean;
|
|
64
95
|
isCreate: boolean;
|
|
65
96
|
canUpdate: boolean | undefined;
|
|
66
97
|
canDrop: boolean;
|
|
67
|
-
},
|
|
98
|
+
}, __VLS_155: {
|
|
68
99
|
item: LktObject;
|
|
69
100
|
editMode: boolean;
|
|
70
101
|
isCreate: boolean;
|
|
71
102
|
canUpdate: boolean | undefined;
|
|
72
103
|
canDrop: boolean | undefined;
|
|
73
|
-
},
|
|
104
|
+
}, __VLS_157: {};
|
|
74
105
|
type __VLS_Slots = {} & {
|
|
75
|
-
'prev-buttons-ever'?: (props: typeof
|
|
106
|
+
'prev-buttons-ever'?: (props: typeof __VLS_5) => any;
|
|
107
|
+
} & {
|
|
108
|
+
'prev-buttons'?: (props: typeof __VLS_7) => any;
|
|
109
|
+
} & {
|
|
110
|
+
'button-save'?: (props: typeof __VLS_21) => any;
|
|
111
|
+
} & {
|
|
112
|
+
'button-save'?: (props: typeof __VLS_35) => any;
|
|
113
|
+
} & {
|
|
114
|
+
'button-drop'?: (props: typeof __VLS_49) => any;
|
|
115
|
+
} & {
|
|
116
|
+
buttons?: (props: typeof __VLS_51) => any;
|
|
117
|
+
} & {
|
|
118
|
+
'prev-buttons-ever'?: (props: typeof __VLS_63) => any;
|
|
76
119
|
} & {
|
|
77
|
-
'prev-buttons'?: (props: typeof
|
|
120
|
+
'prev-buttons'?: (props: typeof __VLS_65) => any;
|
|
78
121
|
} & {
|
|
79
|
-
'button-save'?: (props: typeof
|
|
122
|
+
'button-save'?: (props: typeof __VLS_79) => any;
|
|
80
123
|
} & {
|
|
81
|
-
'button-save'?: (props: typeof
|
|
124
|
+
'button-save'?: (props: typeof __VLS_93) => any;
|
|
82
125
|
} & {
|
|
83
|
-
'button-drop'?: (props: typeof
|
|
126
|
+
'button-drop'?: (props: typeof __VLS_107) => any;
|
|
84
127
|
} & {
|
|
85
|
-
buttons?: (props: typeof
|
|
128
|
+
buttons?: (props: typeof __VLS_109) => any;
|
|
86
129
|
} & {
|
|
87
|
-
'prev-buttons-ever'?: (props: typeof
|
|
130
|
+
'prev-buttons-ever'?: (props: typeof __VLS_111) => any;
|
|
88
131
|
} & {
|
|
89
|
-
'prev-buttons'?: (props: typeof
|
|
132
|
+
'prev-buttons'?: (props: typeof __VLS_113) => any;
|
|
90
133
|
} & {
|
|
91
|
-
'button-save'?: (props: typeof
|
|
134
|
+
'button-save'?: (props: typeof __VLS_127) => any;
|
|
92
135
|
} & {
|
|
93
|
-
'button-save'?: (props: typeof
|
|
136
|
+
'button-save'?: (props: typeof __VLS_141) => any;
|
|
94
137
|
} & {
|
|
95
|
-
'button-drop'?: (props: typeof
|
|
138
|
+
'button-drop'?: (props: typeof __VLS_155) => any;
|
|
96
139
|
} & {
|
|
97
|
-
buttons?: (props: typeof
|
|
140
|
+
buttons?: (props: typeof __VLS_157) => any;
|
|
98
141
|
};
|
|
99
142
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
|
|
100
143
|
doSave: () => void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ButtonConfig, ItemCrudButtonNavVisibility, ItemCrudMode, ItemCrudView, LktObject } from 'lkt-vue-kernel';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
item: LktObject;
|
|
4
|
+
editing?: boolean;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
view: ItemCrudView;
|
|
7
|
+
mode: ItemCrudMode;
|
|
8
|
+
createButton?: ButtonConfig | false;
|
|
9
|
+
updateButton?: ButtonConfig | false;
|
|
10
|
+
dropButton?: ButtonConfig | false;
|
|
11
|
+
editModeButton?: ButtonConfig | false;
|
|
12
|
+
groupButton?: ButtonConfig | boolean;
|
|
13
|
+
groupButtonAsModalActions?: boolean;
|
|
14
|
+
dataChanged: boolean;
|
|
15
|
+
ableToCreate?: boolean;
|
|
16
|
+
ableToUpdate?: boolean;
|
|
17
|
+
ableToDrop?: boolean;
|
|
18
|
+
canUpdate?: boolean;
|
|
19
|
+
canDrop?: boolean;
|
|
20
|
+
canSwitchEditMode?: boolean;
|
|
21
|
+
perms?: Array<string>;
|
|
22
|
+
httpSuccessRead?: boolean;
|
|
23
|
+
buttonNavVisibility: ItemCrudButtonNavVisibility;
|
|
24
|
+
};
|
|
25
|
+
declare var __VLS_5: {
|
|
26
|
+
canUpdate: boolean | undefined;
|
|
27
|
+
canDrop: boolean | undefined;
|
|
28
|
+
perms: string[] | undefined;
|
|
29
|
+
}, __VLS_7: {
|
|
30
|
+
canUpdate: boolean | undefined;
|
|
31
|
+
canDrop: boolean | undefined;
|
|
32
|
+
perms: string[] | undefined;
|
|
33
|
+
}, __VLS_21: {
|
|
34
|
+
item: LktObject;
|
|
35
|
+
editMode: any;
|
|
36
|
+
isCreate: boolean;
|
|
37
|
+
canUpdate: boolean | undefined;
|
|
38
|
+
canDrop: boolean | undefined;
|
|
39
|
+
}, __VLS_35: {
|
|
40
|
+
item: LktObject;
|
|
41
|
+
editMode: any;
|
|
42
|
+
isCreate: boolean;
|
|
43
|
+
canUpdate: boolean | undefined;
|
|
44
|
+
canDrop: boolean | undefined;
|
|
45
|
+
}, __VLS_49: {
|
|
46
|
+
item: LktObject;
|
|
47
|
+
editMode: any;
|
|
48
|
+
isCreate: boolean;
|
|
49
|
+
canUpdate: boolean | undefined;
|
|
50
|
+
canDrop: boolean | undefined;
|
|
51
|
+
}, __VLS_51: {};
|
|
52
|
+
type __VLS_Slots = {} & {
|
|
53
|
+
'prev-buttons-ever'?: (props: typeof __VLS_5) => any;
|
|
54
|
+
} & {
|
|
55
|
+
'prev-buttons'?: (props: typeof __VLS_7) => any;
|
|
56
|
+
} & {
|
|
57
|
+
'button-save'?: (props: typeof __VLS_21) => any;
|
|
58
|
+
} & {
|
|
59
|
+
'button-save'?: (props: typeof __VLS_35) => any;
|
|
60
|
+
} & {
|
|
61
|
+
'button-drop'?: (props: typeof __VLS_49) => any;
|
|
62
|
+
} & {
|
|
63
|
+
buttons?: (props: typeof __VLS_51) => any;
|
|
64
|
+
};
|
|
65
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
66
|
+
item: LktObject;
|
|
67
|
+
editing: boolean;
|
|
68
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
69
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
70
|
+
export default _default;
|
|
71
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
72
|
+
new (): {
|
|
73
|
+
$slots: S;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import { ItemCrudButtonNavPosition, ItemCrudConfig, ItemCrudMode, ItemCrudView, LktObject, NotificationType } from 'lkt-vue-kernel';
|
|
2
|
-
declare var
|
|
1
|
+
import { ButtonConfig, ItemCrudButtonNavPosition, ItemCrudConfig, ItemCrudMode, ItemCrudView, LktObject, ModalConfig, NotificationType } from 'lkt-vue-kernel';
|
|
2
|
+
declare var __VLS_17: {
|
|
3
|
+
canUpdate: boolean | undefined;
|
|
4
|
+
canDrop: boolean | undefined;
|
|
5
|
+
perms: string[] | undefined;
|
|
6
|
+
}, __VLS_19: {
|
|
7
|
+
canUpdate: boolean | undefined;
|
|
8
|
+
canDrop: boolean | undefined;
|
|
9
|
+
perms: string[] | undefined;
|
|
10
|
+
}, __VLS_21: {
|
|
3
11
|
item: LktObject;
|
|
4
12
|
loading: boolean;
|
|
5
|
-
},
|
|
13
|
+
}, __VLS_23: {
|
|
6
14
|
item: LktObject;
|
|
7
15
|
loading: boolean;
|
|
8
|
-
},
|
|
16
|
+
}, __VLS_36: {
|
|
9
17
|
canUpdate: boolean | undefined;
|
|
10
18
|
canDrop: boolean | undefined;
|
|
11
19
|
perms: string[] | undefined;
|
|
12
|
-
},
|
|
20
|
+
}, __VLS_38: {
|
|
13
21
|
canUpdate: boolean | undefined;
|
|
14
22
|
canDrop: boolean | undefined;
|
|
15
23
|
perms: string[] | undefined;
|
|
16
|
-
},
|
|
24
|
+
}, __VLS_48: {
|
|
17
25
|
item: LktObject;
|
|
18
26
|
loading: false;
|
|
19
27
|
editMode: boolean;
|
|
@@ -22,21 +30,25 @@ declare var __VLS_6: {
|
|
|
22
30
|
canDrop: boolean;
|
|
23
31
|
itemBeingEdited: boolean;
|
|
24
32
|
perms: string[];
|
|
25
|
-
},
|
|
33
|
+
}, __VLS_69: {}, __VLS_71: {};
|
|
26
34
|
type __VLS_Slots = {} & {
|
|
27
|
-
'
|
|
35
|
+
'prev-buttons-ever'?: (props: typeof __VLS_17) => any;
|
|
36
|
+
} & {
|
|
37
|
+
'prev-buttons'?: (props: typeof __VLS_19) => any;
|
|
38
|
+
} & {
|
|
39
|
+
'pre-title'?: (props: typeof __VLS_21) => any;
|
|
28
40
|
} & {
|
|
29
|
-
'post-title'?: (props: typeof
|
|
41
|
+
'post-title'?: (props: typeof __VLS_23) => any;
|
|
30
42
|
} & {
|
|
31
|
-
'prev-buttons-ever'?: (props: typeof
|
|
43
|
+
'prev-buttons-ever'?: (props: typeof __VLS_36) => any;
|
|
32
44
|
} & {
|
|
33
|
-
'prev-buttons'?: (props: typeof
|
|
45
|
+
'prev-buttons'?: (props: typeof __VLS_38) => any;
|
|
34
46
|
} & {
|
|
35
|
-
item?: (props: typeof
|
|
47
|
+
item?: (props: typeof __VLS_48) => any;
|
|
36
48
|
} & {
|
|
37
|
-
'prev-buttons-ever'?: (props: typeof
|
|
49
|
+
'prev-buttons-ever'?: (props: typeof __VLS_69) => any;
|
|
38
50
|
} & {
|
|
39
|
-
'prev-buttons'?: (props: typeof
|
|
51
|
+
'prev-buttons'?: (props: typeof __VLS_71) => any;
|
|
40
52
|
};
|
|
41
53
|
declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
42
54
|
doDrop: () => void;
|
|
@@ -73,14 +85,15 @@ declare const __VLS_component: import("vue").DefineComponent<ItemCrudConfig, {
|
|
|
73
85
|
modelValue: LktObject;
|
|
74
86
|
editing: boolean;
|
|
75
87
|
perms: import("lkt-vue-kernel").ValidTablePermission[];
|
|
76
|
-
editModeButton:
|
|
77
|
-
dropButton:
|
|
78
|
-
createButton:
|
|
79
|
-
updateButton:
|
|
80
|
-
groupButton:
|
|
88
|
+
editModeButton: ButtonConfig | false;
|
|
89
|
+
dropButton: ButtonConfig | false;
|
|
90
|
+
createButton: ButtonConfig | false;
|
|
91
|
+
updateButton: ButtonConfig | false;
|
|
92
|
+
groupButton: ButtonConfig | boolean;
|
|
93
|
+
groupButtonAsModalActions: boolean;
|
|
81
94
|
buttonNavPosition: ItemCrudButtonNavPosition;
|
|
82
95
|
buttonNavVisibility: import("lkt-vue-kernel").ItemCrudButtonNavVisibility;
|
|
83
|
-
modalConfig:
|
|
96
|
+
modalConfig: ModalConfig;
|
|
84
97
|
saveConfig: import("lkt-vue-kernel").SaveConfig;
|
|
85
98
|
dataStateConfig: import("lkt-data-state").DataStateConfig;
|
|
86
99
|
readResource: string;
|
package/package.json
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref, SetupContext, useSlots, watch } from 'vue';
|
|
3
|
-
import {
|
|
4
|
-
ButtonConfig,
|
|
5
|
-
ensureButtonConfig,
|
|
6
|
-
ItemCrudButtonNavVisibility,
|
|
7
|
-
ItemCrudMode,
|
|
8
|
-
ItemCrudView,
|
|
9
|
-
LktObject,
|
|
10
|
-
LktSettings,
|
|
11
|
-
} from 'lkt-vue-kernel';
|
|
3
|
+
import { ButtonConfig, ItemCrudButtonNavVisibility, ItemCrudMode, ItemCrudView, LktObject } from 'lkt-vue-kernel';
|
|
12
4
|
import { HTTPResponse } from 'lkt-http-client';
|
|
13
5
|
|
|
14
6
|
const emit = defineEmits([
|
|
@@ -23,6 +15,7 @@
|
|
|
23
15
|
item: LktObject,
|
|
24
16
|
editing?: boolean
|
|
25
17
|
loading?: boolean
|
|
18
|
+
grouped?: boolean
|
|
26
19
|
|
|
27
20
|
view: ItemCrudView
|
|
28
21
|
mode: ItemCrudMode
|
|
@@ -32,9 +25,13 @@
|
|
|
32
25
|
dropButton?: ButtonConfig|false
|
|
33
26
|
editModeButton?: ButtonConfig|false
|
|
34
27
|
groupButton?: ButtonConfig|boolean
|
|
28
|
+
groupButtonAsModalActions?: boolean
|
|
35
29
|
|
|
36
30
|
dataChanged: boolean
|
|
37
31
|
|
|
32
|
+
ableToCreate?: boolean
|
|
33
|
+
ableToUpdate?: boolean
|
|
34
|
+
ableToDrop?: boolean
|
|
38
35
|
canUpdate?: boolean
|
|
39
36
|
canDrop?: boolean
|
|
40
37
|
canSwitchEditMode?: boolean
|
|
@@ -49,28 +46,6 @@
|
|
|
49
46
|
isLoading: false,
|
|
50
47
|
});
|
|
51
48
|
|
|
52
|
-
const safeCreateButton = ref(ensureButtonConfig(props.createButton, LktSettings.defaultCreateButton)),
|
|
53
|
-
safeUpdateButton = ref(ensureButtonConfig(props.updateButton, LktSettings.defaultUpdateButton)),
|
|
54
|
-
safeDropButton = ref(ensureButtonConfig(props.dropButton, LktSettings.defaultDropButton)),
|
|
55
|
-
safeEditModeButton = ref(ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton)),
|
|
56
|
-
safeGroupButton = ref(ensureButtonConfig(props.groupButton, LktSettings.defaultGroupButton));
|
|
57
|
-
|
|
58
|
-
watch(() => props.createButton, v => {
|
|
59
|
-
safeCreateButton.value = ensureButtonConfig(v, LktSettings.defaultCreateButton);
|
|
60
|
-
}, { deep: true });
|
|
61
|
-
|
|
62
|
-
watch(() => props.updateButton, v => {
|
|
63
|
-
safeUpdateButton.value = ensureButtonConfig(v, LktSettings.defaultUpdateButton);
|
|
64
|
-
}, { deep: true });
|
|
65
|
-
|
|
66
|
-
watch(() => props.dropButton, v => {
|
|
67
|
-
safeDropButton.value = ensureButtonConfig(v, LktSettings.defaultDropButton);
|
|
68
|
-
}, { deep: true });
|
|
69
|
-
|
|
70
|
-
watch(() => props.editModeButton, v => {
|
|
71
|
-
safeEditModeButton.value = ensureButtonConfig(v, LktSettings.defaultEditModeButton);
|
|
72
|
-
}, { deep: true });
|
|
73
|
-
|
|
74
49
|
const slots: SetupContext['slots'] = useSlots();
|
|
75
50
|
|
|
76
51
|
const saveButtonRef = ref(<HTMLButtonElement | null>null);
|
|
@@ -116,34 +91,7 @@
|
|
|
116
91
|
});
|
|
117
92
|
|
|
118
93
|
|
|
119
|
-
const
|
|
120
|
-
if (props.mode !== ItemCrudMode.Update || !props.canUpdate) return false;
|
|
121
|
-
if (!props.dataChanged) return false;
|
|
122
|
-
|
|
123
|
-
if (typeof safeUpdateButton.value?.disabled === 'function') return !safeUpdateButton.value.disabled(props.item);
|
|
124
|
-
if (typeof safeUpdateButton.value?.disabled === 'boolean') return !safeUpdateButton.value.disabled;
|
|
125
|
-
|
|
126
|
-
return true;
|
|
127
|
-
}),
|
|
128
|
-
ableToCreate = computed(() => {
|
|
129
|
-
if (props.mode !== ItemCrudMode.Create) return false;
|
|
130
|
-
if (!props.dataChanged) return false;
|
|
131
|
-
|
|
132
|
-
if (typeof safeCreateButton.value?.disabled === 'function') return !safeCreateButton.value.disabled(props.item);
|
|
133
|
-
if (typeof safeCreateButton.value?.disabled === 'boolean') return !safeCreateButton.value.disabled;
|
|
134
|
-
|
|
135
|
-
return true;
|
|
136
|
-
}),
|
|
137
|
-
ableToDrop = computed(() => {
|
|
138
|
-
|
|
139
|
-
if (!props.canDrop) return false;
|
|
140
|
-
|
|
141
|
-
if (typeof safeDropButton.value?.disabled === 'function') return !safeDropButton.value.disabled(props.item);
|
|
142
|
-
if (typeof safeDropButton.value?.disabled === 'boolean') return !safeDropButton.value.disabled;
|
|
143
|
-
|
|
144
|
-
return true;
|
|
145
|
-
}),
|
|
146
|
-
showDropButton = computed(() => {
|
|
94
|
+
const showDropButton = computed(() => {
|
|
147
95
|
if (!props.canDrop || props.dropButton === false) return false;
|
|
148
96
|
if (!props.canUpdate && props.canDrop) return true;
|
|
149
97
|
|
|
@@ -156,14 +104,6 @@
|
|
|
156
104
|
if (props.mode === ItemCrudMode.Update && props.updateButton === false) return false;
|
|
157
105
|
if (isLoading.value) return false;
|
|
158
106
|
|
|
159
|
-
// if (props.dataChanged) {
|
|
160
|
-
// return ableToUpdate.value || ableToCreate.value;
|
|
161
|
-
// }
|
|
162
|
-
|
|
163
|
-
// if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) {
|
|
164
|
-
// return false;
|
|
165
|
-
// }
|
|
166
|
-
|
|
167
107
|
return props.editing
|
|
168
108
|
&& props.httpSuccessRead;
|
|
169
109
|
}),
|
|
@@ -189,16 +129,89 @@
|
|
|
189
129
|
<template>
|
|
190
130
|
<div v-if="showButtons" class="lkt-item-crud-buttons">
|
|
191
131
|
|
|
192
|
-
<template v-if="
|
|
132
|
+
<template v-if="grouped && groupButtonAsModalActions">
|
|
133
|
+
<lkt-button
|
|
134
|
+
v-if="showSwitchButton"
|
|
135
|
+
v-bind="editModeButton"
|
|
136
|
+
v-model:checked="isEditing"
|
|
137
|
+
class="lkt-item-crud--switch-mode-button" />
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
<template v-if="slots['prev-buttons-ever']" v-show="!isLoading">
|
|
141
|
+
<slot name="prev-buttons-ever"
|
|
142
|
+
:can-update="canUpdate"
|
|
143
|
+
:can-drop="canDrop"
|
|
144
|
+
:perms="perms"
|
|
145
|
+
/>
|
|
146
|
+
</template>
|
|
147
|
+
|
|
148
|
+
<template v-if="slots['prev-buttons']" v-show="isEditing && !isLoading">
|
|
149
|
+
<slot name="prev-buttons"
|
|
150
|
+
:can-update="canUpdate"
|
|
151
|
+
:can-drop="canDrop"
|
|
152
|
+
:perms="perms"
|
|
153
|
+
/>
|
|
154
|
+
</template>
|
|
155
|
+
|
|
156
|
+
<lkt-button
|
|
157
|
+
ref="saveButtonRef"
|
|
158
|
+
v-show="mode === ItemCrudMode.Update && showSaveButton"
|
|
159
|
+
v-bind="updateButton"
|
|
160
|
+
:disabled="!ableToUpdate"
|
|
161
|
+
@loading="onButtonLoading"
|
|
162
|
+
@loaded="onButtonLoaded"
|
|
163
|
+
@click="onSave">
|
|
164
|
+
<slot v-if="!!slots['button-save']" name="button-save" :item="item"
|
|
165
|
+
:edit-mode="isEditing"
|
|
166
|
+
:is-create="false"
|
|
167
|
+
:can-update="canUpdate"
|
|
168
|
+
:can-drop="canDrop" />
|
|
169
|
+
</lkt-button>
|
|
170
|
+
|
|
171
|
+
<lkt-button
|
|
172
|
+
ref="saveButtonRef"
|
|
173
|
+
v-show="mode === ItemCrudMode.Create && showSaveButton"
|
|
174
|
+
v-bind="createButton"
|
|
175
|
+
:disabled="!ableToCreate"
|
|
176
|
+
@loading="onButtonLoading"
|
|
177
|
+
@loaded="onButtonLoaded"
|
|
178
|
+
@click="onCreate">
|
|
179
|
+
<slot v-if="!!slots['button-save']" name="button-save" :item="item"
|
|
180
|
+
:edit-mode="isEditing"
|
|
181
|
+
:is-create="true"
|
|
182
|
+
:can-update="canUpdate"
|
|
183
|
+
:can-drop="canDrop" />
|
|
184
|
+
</lkt-button>
|
|
185
|
+
|
|
186
|
+
<lkt-button
|
|
187
|
+
ref="dropButtonRef"
|
|
188
|
+
v-show="showDropButton && mode !== ItemCrudMode.Create"
|
|
189
|
+
v-bind="dropButton"
|
|
190
|
+
:disabled="!ableToDrop"
|
|
191
|
+
@loading="onButtonLoading"
|
|
192
|
+
@loaded="onButtonLoaded"
|
|
193
|
+
@click="onDrop">
|
|
194
|
+
<slot v-if="!!slots['button-drop']" name="button-drop" :item="item"
|
|
195
|
+
:edit-mode="isEditing"
|
|
196
|
+
:is-create="false"
|
|
197
|
+
:can-update="canUpdate"
|
|
198
|
+
:can-drop="canDrop" />
|
|
199
|
+
</lkt-button>
|
|
200
|
+
|
|
201
|
+
<template v-if="slots.buttons" v-show="isEditing && !isLoading">
|
|
202
|
+
<slot name="buttons" />
|
|
203
|
+
</template>
|
|
204
|
+
</template>
|
|
205
|
+
<template v-else-if="grouped">
|
|
193
206
|
<lkt-button
|
|
194
207
|
ref="groupButton"
|
|
195
|
-
v-bind="
|
|
208
|
+
v-bind="groupButton"
|
|
196
209
|
class="lkt-item-crud-group-button"
|
|
197
210
|
>
|
|
198
211
|
<template #split>
|
|
199
212
|
<lkt-button
|
|
200
213
|
v-if="showSwitchButton"
|
|
201
|
-
v-bind="
|
|
214
|
+
v-bind="editModeButton"
|
|
202
215
|
v-model:checked="isEditing"
|
|
203
216
|
class="lkt-item-crud--switch-mode-button" />
|
|
204
217
|
|
|
@@ -222,7 +235,7 @@
|
|
|
222
235
|
<lkt-button
|
|
223
236
|
ref="saveButtonRef"
|
|
224
237
|
v-show="mode === ItemCrudMode.Update && showSaveButton"
|
|
225
|
-
v-bind="
|
|
238
|
+
v-bind="updateButton"
|
|
226
239
|
:disabled="!ableToUpdate"
|
|
227
240
|
@loading="onButtonLoading"
|
|
228
241
|
@loaded="onButtonLoaded"
|
|
@@ -237,7 +250,7 @@
|
|
|
237
250
|
<lkt-button
|
|
238
251
|
ref="saveButtonRef"
|
|
239
252
|
v-show="mode === ItemCrudMode.Create && showSaveButton"
|
|
240
|
-
v-bind="
|
|
253
|
+
v-bind="createButton"
|
|
241
254
|
:disabled="!ableToCreate"
|
|
242
255
|
@loading="onButtonLoading"
|
|
243
256
|
@loaded="onButtonLoaded"
|
|
@@ -252,7 +265,7 @@
|
|
|
252
265
|
<lkt-button
|
|
253
266
|
ref="dropButtonRef"
|
|
254
267
|
v-show="showDropButton && mode !== ItemCrudMode.Create"
|
|
255
|
-
v-bind="
|
|
268
|
+
v-bind="dropButton"
|
|
256
269
|
:disabled="!ableToDrop"
|
|
257
270
|
@loading="onButtonLoading"
|
|
258
271
|
@loaded="onButtonLoaded"
|
|
@@ -292,7 +305,7 @@
|
|
|
292
305
|
<lkt-button
|
|
293
306
|
ref="saveButtonRef"
|
|
294
307
|
v-show="mode === ItemCrudMode.Update && showSaveButton"
|
|
295
|
-
v-bind="
|
|
308
|
+
v-bind="updateButton"
|
|
296
309
|
:disabled="!ableToUpdate"
|
|
297
310
|
@loading="onButtonLoading"
|
|
298
311
|
@loaded="onButtonLoaded"
|
|
@@ -307,7 +320,7 @@
|
|
|
307
320
|
<lkt-button
|
|
308
321
|
ref="saveButtonRef"
|
|
309
322
|
v-show="mode === ItemCrudMode.Create && showSaveButton"
|
|
310
|
-
v-bind="
|
|
323
|
+
v-bind="createButton"
|
|
311
324
|
:disabled="!ableToCreate"
|
|
312
325
|
@loading="onButtonLoading"
|
|
313
326
|
@loaded="onButtonLoaded"
|
|
@@ -322,7 +335,7 @@
|
|
|
322
335
|
<lkt-button
|
|
323
336
|
ref="dropButtonRef"
|
|
324
337
|
v-show="showDropButton && mode !== ItemCrudMode.Create"
|
|
325
|
-
v-bind="
|
|
338
|
+
v-bind="dropButton"
|
|
326
339
|
:disabled="!ableToDrop"
|
|
327
340
|
@loading="onButtonLoading"
|
|
328
341
|
@loaded="onButtonLoaded"
|
|
@@ -340,7 +353,7 @@
|
|
|
340
353
|
|
|
341
354
|
<lkt-button
|
|
342
355
|
v-if="showSwitchButton"
|
|
343
|
-
v-bind="
|
|
356
|
+
v-bind="editModeButton"
|
|
344
357
|
v-model:checked="isEditing"
|
|
345
358
|
class="lkt-item-crud--switch-mode-button" />
|
|
346
359
|
|