aloha-vue 2.56.0 → 2.57.0
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/CHANGELOG.md +9 -0
- package/dist/aloha-vue.css +312 -2
- package/dist/aloha-vue.css.map +1 -1
- package/dist/aloha-vue.es.js +21629 -19204
- package/dist/aloha-vue.umd.js +70 -70
- package/package.json +1 -1
- package/scss/aloha-vue.scss +1 -0
- package/scss/components/ATableForm.scss +230 -0
- package/scss/components/ui/ADatepicker.scss +12 -0
- package/scss/components/ui/ASelect.scss +39 -0
- package/scss/components/ui/ASwitch.scss +28 -0
- package/scss/components/ui/ui.scss +31 -2
- package/src/AAccordion/AAccordion.js +0 -1
- package/src/AElement/AElement.js +506 -506
- package/src/ATableForm/ATableForm.js +578 -0
- package/src/ATableForm/ATableFormCell/ATableFormCell.js +182 -0
- package/src/ATableForm/ATableFormCell/compositionAPI/DisabledAPI.js +20 -0
- package/src/ATableForm/ATableFormCell/compositionAPI/ReadonlyAPI.js +28 -0
- package/src/ATableForm/ATableFormCell/compositionAPI/SlotAPI.js +38 -0
- package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +238 -0
- package/src/ATableForm/ATableFormCellAction/compositionAPI/DeleteAPI.js +80 -0
- package/src/ATableForm/ATableFormCellAction/compositionAPI/DisabledAPI.js +60 -0
- package/src/ATableForm/ATableFormCellAction/compositionAPI/HiddenAPI.js +46 -0
- package/src/ATableForm/ATableFormCellAction/compositionAPI/StylesAPI.js +29 -0
- package/src/ATableForm/ATableFormCellAction/compositionAPI/TitleAPI.js +47 -0
- package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +174 -0
- package/src/ATableForm/ATableFormCellDnd/compositionAPI/IdAPI.js +21 -0
- package/src/ATableForm/ATableFormRow/ATableFormRow.js +431 -0
- package/src/ATableForm/ATableFormRow/compositionAPI/ClassAPI.js +55 -0
- package/src/ATableForm/ATableFormRow/compositionAPI/EditAPI.js +97 -0
- package/src/ATableForm/ATableFormRow/compositionAPI/ErrorsAPI.js +40 -0
- package/src/ATableForm/ATableFormRow/compositionAPI/FocusAPI.js +33 -0
- package/src/ATableForm/ATableFormRow/compositionAPI/IdAPI.js +19 -0
- package/src/ATableForm/ATableFormTh/ATableFormTh.js +70 -0
- package/src/ATableForm/compositionAPI/ColumnsAPI.js +34 -0
- package/src/ATableForm/compositionAPI/ColumnsGrowAPI.js +208 -0
- package/src/ATableForm/compositionAPI/DeleteAPI.js +9 -0
- package/src/ATableForm/compositionAPI/DragAndDropAPI.js +258 -0
- package/src/ATableForm/compositionAPI/EditAPI.js +107 -0
- package/src/ATableForm/compositionAPI/IconsAPI.js +21 -0
- package/src/ATableForm/compositionAPI/RowsAPI.js +42 -0
- package/src/ATableForm/compositionAPI/StylesAPI.js +62 -0
- package/src/ATableForm/compositionAPI/TextsAPI.js +34 -0
- package/src/ATableForm/compositionAPI/WidthsAPI.js +21 -0
- package/src/ATableForm/i18n/ATableFormI18n.js +19 -0
- package/src/ATableForm/i18n/ar.json +17 -0
- package/src/ATableForm/i18n/de.json +17 -0
- package/src/ATableForm/i18n/en.json +17 -0
- package/src/ATableForm/i18n/es.json +17 -0
- package/src/ATableForm/i18n/fr.json +17 -0
- package/src/ATableForm/i18n/hr.json +17 -0
- package/src/ATableForm/i18n/it.json +17 -0
- package/src/ATableForm/i18n/ru.json +17 -0
- package/src/i18n/allLanguages.js +9 -0
- package/src/index.js +10 -8
- package/src/ui/ACheckbox/ACheckbox.js +196 -195
- package/src/ui/ADatepicker/ADatepicker.js +19 -0
- package/src/ui/ADatepickerRange/ADatepickerRange.js +6 -0
- package/src/ui/AErrorsText/AErrorsText.js +62 -57
- package/src/ui/AFieldset/AFieldset.js +535 -529
- package/src/ui/AFormElement/AFormElement.js +10 -0
- package/src/ui/AGroup/AGroup.js +427 -421
- package/src/ui/AInput/AInput.js +516 -494
- package/src/ui/AInput/compositionAPI/ClassAPI.js +6 -0
- package/src/ui/AInputCurrency/AInputCurrency.js +21 -0
- package/src/ui/AInputCurrency/compositionAPI/InputEventsAPI.js +93 -18
- package/src/ui/AInputCurrency/compositionAPI/ModelAPI.js +12 -7
- package/src/ui/AInputFile/AInputFile.js +1 -0
- package/src/ui/AInputNumber/AInputNumber.js +18 -0
- package/src/ui/AInputNumber/compositionAPI/InputEventsAPI.js +196 -196
- package/src/ui/AInputNumber/compositionAPI/ModelAPI.js +72 -72
- package/src/ui/AInputNumberRange/AInputNumberRange.js +6 -0
- package/src/ui/AJson/AJson.js +6 -0
- package/src/ui/AMultiselectOrdered/AMultiselectOrdered.js +185 -179
- package/src/ui/AOneCheckbox/AOneCheckbox.js +366 -360
- package/src/ui/ARadio/ARadio.js +195 -189
- package/src/ui/ASelect/ASelect.js +25 -0
- package/src/ui/ASlider/ASlider.js +6 -0
- package/src/ui/ASwitch/ASwitch.js +25 -1
- package/src/ui/ATextarea/ATextarea.js +23 -0
- package/src/ui/AValidatedJson/AValidatedJson.js +7 -0
- package/src/ui/compositionApi/UiDataFromServerAPI.js +5 -3
- package/src/ui/mixins/UiMixinProps.js +5 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
h,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import AFormElement from "../../ui/AFormElement/AFormElement";
|
|
7
|
+
|
|
8
|
+
import DisabledAPI from "./compositionAPI/DisabledAPI";
|
|
9
|
+
import ReadonlyAPI from "./compositionAPI/ReadonlyAPI";
|
|
10
|
+
import SlotAPI from "./compositionAPI/SlotAPI";
|
|
11
|
+
import StylesAPI from "../compositionAPI/StylesAPI";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
get,
|
|
15
|
+
} from "lodash-es";
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: "ATableFormCell",
|
|
19
|
+
props: {
|
|
20
|
+
column: {
|
|
21
|
+
type: Object,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
columnIndex: {
|
|
25
|
+
type: Number,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
columnStyle: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: false,
|
|
31
|
+
default: undefined,
|
|
32
|
+
},
|
|
33
|
+
errorIcon: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: false,
|
|
36
|
+
default: undefined,
|
|
37
|
+
},
|
|
38
|
+
errors: {
|
|
39
|
+
type: Object,
|
|
40
|
+
required: false,
|
|
41
|
+
default: () => ({}),
|
|
42
|
+
},
|
|
43
|
+
id: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
isEditMode: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
isEditable: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
isFooter: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
62
|
+
row: {
|
|
63
|
+
type: Object,
|
|
64
|
+
required: true,
|
|
65
|
+
},
|
|
66
|
+
rowData: {
|
|
67
|
+
type: Object,
|
|
68
|
+
required: false,
|
|
69
|
+
default: undefined,
|
|
70
|
+
},
|
|
71
|
+
rowIndex: {
|
|
72
|
+
type: Number,
|
|
73
|
+
required: true,
|
|
74
|
+
},
|
|
75
|
+
rows: {
|
|
76
|
+
type: Array,
|
|
77
|
+
required: true,
|
|
78
|
+
},
|
|
79
|
+
tag: {
|
|
80
|
+
type: String,
|
|
81
|
+
required: false,
|
|
82
|
+
default: "td",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
emits: [
|
|
86
|
+
"updateRowData",
|
|
87
|
+
],
|
|
88
|
+
setup(props) {
|
|
89
|
+
const {
|
|
90
|
+
columnStyles,
|
|
91
|
+
} = StylesAPI({
|
|
92
|
+
column: props.column,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const {
|
|
96
|
+
readonlyLocal,
|
|
97
|
+
} = ReadonlyAPI(props);
|
|
98
|
+
|
|
99
|
+
const {
|
|
100
|
+
disabledLocal,
|
|
101
|
+
} = DisabledAPI(props);
|
|
102
|
+
|
|
103
|
+
const {
|
|
104
|
+
hasSlot,
|
|
105
|
+
hasSlotAfter,
|
|
106
|
+
slotName,
|
|
107
|
+
slotNameAfter,
|
|
108
|
+
} = SlotAPI(props);
|
|
109
|
+
|
|
110
|
+
const rowDataLocal = computed(() => {
|
|
111
|
+
return props.rowData || props.row;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
columnStyles,
|
|
116
|
+
disabledLocal,
|
|
117
|
+
hasSlot,
|
|
118
|
+
hasSlotAfter,
|
|
119
|
+
readonlyLocal,
|
|
120
|
+
rowDataLocal,
|
|
121
|
+
slotName,
|
|
122
|
+
slotNameAfter,
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
methods: {
|
|
126
|
+
updateRowData({ item, model }) {
|
|
127
|
+
this.$emit("updateRowData", {
|
|
128
|
+
column: this.column,
|
|
129
|
+
columnId: this.column.id,
|
|
130
|
+
item,
|
|
131
|
+
model,
|
|
132
|
+
value: model,
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
render() {
|
|
137
|
+
const {
|
|
138
|
+
type = "text",
|
|
139
|
+
...formElement
|
|
140
|
+
} = this.column.formElement || {};
|
|
141
|
+
|
|
142
|
+
const slotProps = {
|
|
143
|
+
column: this.column,
|
|
144
|
+
columnIndex: this.columnIndex,
|
|
145
|
+
row: this.row,
|
|
146
|
+
rowIndex: this.rowIndex,
|
|
147
|
+
rows: this.rows,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return h(this.tag, {
|
|
151
|
+
class: [
|
|
152
|
+
"a_table_form__cell",
|
|
153
|
+
`a_table_form__cell_${ this.tag }`,
|
|
154
|
+
this.column.class,
|
|
155
|
+
this.isFooter ? this.column.classFooter : this.column.classRow,
|
|
156
|
+
],
|
|
157
|
+
style: [
|
|
158
|
+
this.columnStyles,
|
|
159
|
+
this.columnStyle,
|
|
160
|
+
],
|
|
161
|
+
}, [
|
|
162
|
+
(this.hasSlot && this.$slots[this.slotName]) ?
|
|
163
|
+
this.$slots[this.slotName](slotProps) :
|
|
164
|
+
h(AFormElement, {
|
|
165
|
+
id: this.column.id,
|
|
166
|
+
errorIcon: this.errorIcon,
|
|
167
|
+
idPrefix: this.id,
|
|
168
|
+
...formElement,
|
|
169
|
+
change: this.updateRowData,
|
|
170
|
+
disabled: this.disabledLocal,
|
|
171
|
+
errors: get(this.errors, this.column.id),
|
|
172
|
+
errorsClass: "a_sr_only",
|
|
173
|
+
modelValue: get(this.rowDataLocal, this.column.id),
|
|
174
|
+
readonly: this.readonlyLocal,
|
|
175
|
+
type,
|
|
176
|
+
}),
|
|
177
|
+
(this.hasSlotAfter && this.$slots[this.slotNameAfter]) ?
|
|
178
|
+
this.$slots[this.slotNameAfter](slotProps) :
|
|
179
|
+
null,
|
|
180
|
+
]);
|
|
181
|
+
},
|
|
182
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
export default function DisabledAPI(props) {
|
|
7
|
+
const column = toRef(props, "column");
|
|
8
|
+
const isEditable = toRef(props, "isEditable");
|
|
9
|
+
const isEditMode = toRef(props, "isEditMode");
|
|
10
|
+
|
|
11
|
+
const disabledLocal = computed(() => {
|
|
12
|
+
return !!column.value?.formElement?.disabled ||
|
|
13
|
+
(isEditable.value &&
|
|
14
|
+
!isEditMode.value);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
disabledLocal,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
export default function ReadonlyAPI(props) {
|
|
7
|
+
const column = toRef(props, "column");
|
|
8
|
+
const isEditable = toRef(props, "isEditable");
|
|
9
|
+
const isEditMode = toRef(props, "isEditMode");
|
|
10
|
+
const isFooter = toRef(props, "isFooter");
|
|
11
|
+
|
|
12
|
+
const readonlyLocal = computed(() => {
|
|
13
|
+
if (isFooter.value) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (isEditable.value) {
|
|
17
|
+
if (column.value?.formElement?.useRowReadonly) {
|
|
18
|
+
return !isEditMode.value;
|
|
19
|
+
}
|
|
20
|
+
return !!column.value?.formElement?.readonly;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
readonlyLocal,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
export default function SlotAPI(props) {
|
|
7
|
+
const column = toRef(props, "column");
|
|
8
|
+
const isFooter = toRef(props, "isFooter");
|
|
9
|
+
|
|
10
|
+
const slotName = computed(() => {
|
|
11
|
+
if (isFooter.value) {
|
|
12
|
+
return column.value.footerSlot;
|
|
13
|
+
}
|
|
14
|
+
return column.value.slot;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const slotNameAfter = computed(() => {
|
|
18
|
+
if (isFooter.value) {
|
|
19
|
+
return column.value.footerSlotAfter;
|
|
20
|
+
}
|
|
21
|
+
return column.value.slotAfter;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const hasSlot = computed(() => {
|
|
25
|
+
return !!slotName.value;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const hasSlotAfter = computed(() => {
|
|
29
|
+
return !!slotNameAfter.value;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
hasSlot,
|
|
34
|
+
hasSlotAfter,
|
|
35
|
+
slotName,
|
|
36
|
+
slotNameAfter,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import {
|
|
2
|
+
h,
|
|
3
|
+
} from "vue";
|
|
4
|
+
|
|
5
|
+
import AButton from "../../AButton/AButton";
|
|
6
|
+
import ATranslation from "../../ATranslation/ATranslation";
|
|
7
|
+
|
|
8
|
+
import DeleteAPI from "./compositionAPI/DeleteAPI";
|
|
9
|
+
import DisabledAPI from "./compositionAPI/DisabledAPI";
|
|
10
|
+
import HiddenAPI from "./compositionAPI/HiddenAPI";
|
|
11
|
+
import StylesAPI from "./compositionAPI/StylesAPI";
|
|
12
|
+
import TitleAPI from "./compositionAPI/TitleAPI";
|
|
13
|
+
|
|
14
|
+
import Floppy2Fill from "aloha-svg/dist/js/bootstrap/Floppy2Fill";
|
|
15
|
+
import PencilFill from "aloha-svg/dist/js/bootstrap/PencilFill";
|
|
16
|
+
import Trash from "aloha-svg/dist/js/bootstrap/Trash";
|
|
17
|
+
import XLg from "aloha-svg/dist/js/bootstrap/XLg";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
name: "ATableFormCellAction",
|
|
22
|
+
props: {
|
|
23
|
+
hasActiveEditRow: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
required: false,
|
|
26
|
+
default: false,
|
|
27
|
+
},
|
|
28
|
+
actionsDisabledCallback: {
|
|
29
|
+
type: Object,
|
|
30
|
+
required: false,
|
|
31
|
+
default: () => ({}),
|
|
32
|
+
},
|
|
33
|
+
actionsHideCallback: {
|
|
34
|
+
type: Object,
|
|
35
|
+
required: false,
|
|
36
|
+
default: () => ({}),
|
|
37
|
+
},
|
|
38
|
+
actionsTitleCallback: {
|
|
39
|
+
type: Object,
|
|
40
|
+
required: false,
|
|
41
|
+
default: () => ({}),
|
|
42
|
+
},
|
|
43
|
+
id: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
isActiveEditMode: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
isActionsSticky: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false,
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
isDeletable: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false,
|
|
60
|
+
default: false,
|
|
61
|
+
},
|
|
62
|
+
isDeletableConfirm: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
required: false,
|
|
65
|
+
default: false,
|
|
66
|
+
},
|
|
67
|
+
isEditable: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
required: false,
|
|
70
|
+
default: false,
|
|
71
|
+
},
|
|
72
|
+
isFooter: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
required: false,
|
|
75
|
+
default: false,
|
|
76
|
+
},
|
|
77
|
+
isHeader: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
required: false,
|
|
80
|
+
default: false,
|
|
81
|
+
},
|
|
82
|
+
isSaving: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
required: false,
|
|
85
|
+
default: false,
|
|
86
|
+
},
|
|
87
|
+
onCancelEditRow: {
|
|
88
|
+
type: Function,
|
|
89
|
+
required: true,
|
|
90
|
+
},
|
|
91
|
+
onDeleteRow: {
|
|
92
|
+
type: Function,
|
|
93
|
+
required: true,
|
|
94
|
+
},
|
|
95
|
+
onEditRow: {
|
|
96
|
+
type: Function,
|
|
97
|
+
required: true,
|
|
98
|
+
},
|
|
99
|
+
onSaveEditRow: {
|
|
100
|
+
type: Function,
|
|
101
|
+
required: true,
|
|
102
|
+
},
|
|
103
|
+
row: {
|
|
104
|
+
type: Object,
|
|
105
|
+
required: true,
|
|
106
|
+
},
|
|
107
|
+
rowIndex: {
|
|
108
|
+
type: Number,
|
|
109
|
+
required: true,
|
|
110
|
+
},
|
|
111
|
+
texts: {
|
|
112
|
+
type: Object,
|
|
113
|
+
required: false,
|
|
114
|
+
default: () => ({}),
|
|
115
|
+
},
|
|
116
|
+
widths: {
|
|
117
|
+
type: Object,
|
|
118
|
+
required: false,
|
|
119
|
+
default: () => ({}),
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
setup(props) {
|
|
123
|
+
const {
|
|
124
|
+
isDeleteDisabled,
|
|
125
|
+
isEditDisabled,
|
|
126
|
+
} = DisabledAPI(props);
|
|
127
|
+
|
|
128
|
+
const {
|
|
129
|
+
isDeleteHidden,
|
|
130
|
+
isEditHidden,
|
|
131
|
+
} = HiddenAPI(props);
|
|
132
|
+
|
|
133
|
+
const {
|
|
134
|
+
idBtnDelete,
|
|
135
|
+
onDeleteClick,
|
|
136
|
+
} = DeleteAPI(props, {
|
|
137
|
+
isActionsDisabled: isDeleteDisabled,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const {
|
|
141
|
+
columnStyles,
|
|
142
|
+
} = StylesAPI(props);
|
|
143
|
+
|
|
144
|
+
const {
|
|
145
|
+
deleteTitle,
|
|
146
|
+
editTitle,
|
|
147
|
+
} = TitleAPI(props);
|
|
148
|
+
|
|
149
|
+
return {
|
|
150
|
+
columnStyles,
|
|
151
|
+
deleteTitle,
|
|
152
|
+
editTitle,
|
|
153
|
+
idBtnDelete,
|
|
154
|
+
isDeleteDisabled,
|
|
155
|
+
isDeleteHidden,
|
|
156
|
+
isEditDisabled,
|
|
157
|
+
isEditHidden,
|
|
158
|
+
onDeleteClick,
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
render() {
|
|
162
|
+
const tag = this.isHeader ? "th" : "td";
|
|
163
|
+
|
|
164
|
+
return h(tag, {
|
|
165
|
+
class: [
|
|
166
|
+
"a_table_form__cell",
|
|
167
|
+
`a_table_form__cell_${ tag }`,
|
|
168
|
+
"a_table_form__cell_actions",
|
|
169
|
+
{
|
|
170
|
+
a_table_form__cell_actions_sticky: this.isActionsSticky,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
style: this.columnStyles,
|
|
174
|
+
}, [
|
|
175
|
+
this.isHeader ?
|
|
176
|
+
h("span", {
|
|
177
|
+
class: "a_sr_only",
|
|
178
|
+
}, [
|
|
179
|
+
h(ATranslation, {
|
|
180
|
+
tag: "span",
|
|
181
|
+
text: this.texts.actionsColumn,
|
|
182
|
+
}),
|
|
183
|
+
]) :
|
|
184
|
+
this.isFooter ?
|
|
185
|
+
null :
|
|
186
|
+
h("div", {
|
|
187
|
+
class: "a_table_form__actions",
|
|
188
|
+
role: "group",
|
|
189
|
+
}, this.isActiveEditMode ?
|
|
190
|
+
[
|
|
191
|
+
h(AButton, {
|
|
192
|
+
class: "a_btn a_btn_transparent_primary a_table_form__action_button",
|
|
193
|
+
disabled: this.isSaving,
|
|
194
|
+
iconLeft: XLg,
|
|
195
|
+
title: this.texts.actionEditCancel,
|
|
196
|
+
textScreenReader: this.texts.actionEditCancel,
|
|
197
|
+
onClick: () => this.onCancelEditRow({
|
|
198
|
+
row: this.row,
|
|
199
|
+
rowIndex: this.rowIndex,
|
|
200
|
+
}),
|
|
201
|
+
}),
|
|
202
|
+
h(AButton, {
|
|
203
|
+
class: "a_btn a_btn_transparent_primary a_table_form__action_button",
|
|
204
|
+
disabled: this.isSaving,
|
|
205
|
+
iconLeft: Floppy2Fill,
|
|
206
|
+
title: this.texts.actionEditSave,
|
|
207
|
+
textScreenReader: this.texts.actionEditSave,
|
|
208
|
+
onClick: () => this.onSaveEditRow({
|
|
209
|
+
row: this.row,
|
|
210
|
+
rowIndex: this.rowIndex,
|
|
211
|
+
}),
|
|
212
|
+
}),
|
|
213
|
+
] :
|
|
214
|
+
[
|
|
215
|
+
(this.isDeletable || this.isDeletableConfirm) && !this.isDeleteHidden && h(AButton, {
|
|
216
|
+
id: this.idBtnDelete,
|
|
217
|
+
class: "a_btn a_btn_transparent_danger a_table_form__action_button",
|
|
218
|
+
disabled: this.isDeleteDisabled,
|
|
219
|
+
iconLeft: Trash,
|
|
220
|
+
title: this.deleteTitle,
|
|
221
|
+
textScreenReader: this.deleteTitle,
|
|
222
|
+
onClick: this.onDeleteClick,
|
|
223
|
+
}),
|
|
224
|
+
this.isEditable && !this.isEditHidden && h(AButton, {
|
|
225
|
+
class: "a_btn a_btn_transparent_primary a_table_form__action_button",
|
|
226
|
+
disabled: this.isEditDisabled,
|
|
227
|
+
iconLeft: PencilFill,
|
|
228
|
+
title: this.editTitle,
|
|
229
|
+
textScreenReader: this.editTitle,
|
|
230
|
+
onClick: () => this.onEditRow({
|
|
231
|
+
row: this.row,
|
|
232
|
+
rowIndex: this.rowIndex,
|
|
233
|
+
}),
|
|
234
|
+
}),
|
|
235
|
+
]),
|
|
236
|
+
]);
|
|
237
|
+
},
|
|
238
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
nextTick,
|
|
4
|
+
toRef,
|
|
5
|
+
} from "vue";
|
|
6
|
+
import {
|
|
7
|
+
AConfirmAPI,
|
|
8
|
+
setFocusToElement,
|
|
9
|
+
} from "../../../index";
|
|
10
|
+
|
|
11
|
+
export default function DeleteAPI(props, {
|
|
12
|
+
isActionsDisabled = computed(() => false),
|
|
13
|
+
}) {
|
|
14
|
+
const id = toRef(props, "id");
|
|
15
|
+
const isDeletable = toRef(props, "isDeletable");
|
|
16
|
+
const isDeletableConfirm = toRef(props, "isDeletableConfirm");
|
|
17
|
+
const onDeleteRow = toRef(props, "onDeleteRow");
|
|
18
|
+
const row = toRef(props, "row");
|
|
19
|
+
const rowIndex = toRef(props, "rowIndex");
|
|
20
|
+
const texts = toRef(props, "texts");
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
closeConfirm,
|
|
24
|
+
openConfirm,
|
|
25
|
+
} = AConfirmAPI();
|
|
26
|
+
|
|
27
|
+
const idBtnDelete = computed(() => {
|
|
28
|
+
return `${ id.value }_delete`;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const closeConfirmLocal = () => {
|
|
32
|
+
closeConfirm();
|
|
33
|
+
nextTick().then(
|
|
34
|
+
() => {
|
|
35
|
+
setFocusToElement({ selector: `#${ idBtnDelete.value }` });
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const openDeleteConfirm = () => {
|
|
41
|
+
openConfirm({
|
|
42
|
+
bodyHtml: texts.value.actionDeleteConfirmBody,
|
|
43
|
+
closeButtonText: texts.value.actionDeleteConfirmClose,
|
|
44
|
+
headerText: texts.value.actionDeleteConfirmHeader,
|
|
45
|
+
save: async() => {
|
|
46
|
+
await onDeleteRow.value({
|
|
47
|
+
row: row.value,
|
|
48
|
+
rowIndex: rowIndex.value,
|
|
49
|
+
});
|
|
50
|
+
closeConfirm();
|
|
51
|
+
},
|
|
52
|
+
close: closeConfirmLocal,
|
|
53
|
+
saveButtonText: texts.value.actionDeleteConfirmSave,
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const onDeleteClick = () => {
|
|
58
|
+
if (isActionsDisabled.value) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (isDeletableConfirm.value) {
|
|
63
|
+
openDeleteConfirm();
|
|
64
|
+
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (isDeletable.value) {
|
|
69
|
+
onDeleteRow.value({
|
|
70
|
+
row: row.value,
|
|
71
|
+
rowIndex: rowIndex.value,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
idBtnDelete,
|
|
78
|
+
onDeleteClick,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
get,
|
|
8
|
+
isFunction,
|
|
9
|
+
} from "lodash-es";
|
|
10
|
+
|
|
11
|
+
export default function DisabledAPI(props) {
|
|
12
|
+
const actionsDisabledCallback = toRef(props, "actionsDisabledCallback");
|
|
13
|
+
const hasActiveEditRow = toRef(props, "hasActiveEditRow");
|
|
14
|
+
const isActiveEditMode = toRef(props, "isActiveEditMode");
|
|
15
|
+
const row = toRef(props, "row");
|
|
16
|
+
const rowIndex = toRef(props, "rowIndex");
|
|
17
|
+
|
|
18
|
+
const isActionsDisabled = computed(() => {
|
|
19
|
+
return hasActiveEditRow.value && !isActiveEditMode.value;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const isDeleteDisabled = computed(() => {
|
|
23
|
+
if (isActionsDisabled.value) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const deleteDisabledCallback = get(actionsDisabledCallback.value, "delete");
|
|
28
|
+
|
|
29
|
+
if (isFunction(deleteDisabledCallback)) {
|
|
30
|
+
return deleteDisabledCallback({
|
|
31
|
+
row: row.value,
|
|
32
|
+
rowIndex: rowIndex.value,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return false;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const isEditDisabled = computed(() => {
|
|
40
|
+
if (isActionsDisabled.value) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const editDisabledCallback = get(actionsDisabledCallback.value, "edit");
|
|
45
|
+
|
|
46
|
+
if (isFunction(editDisabledCallback)) {
|
|
47
|
+
return editDisabledCallback({
|
|
48
|
+
row: row.value,
|
|
49
|
+
rowIndex: rowIndex.value,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return false;
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
isDeleteDisabled,
|
|
58
|
+
isEditDisabled,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
get,
|
|
8
|
+
isFunction,
|
|
9
|
+
} from "lodash-es";
|
|
10
|
+
|
|
11
|
+
export default function HiddenAPI(props) {
|
|
12
|
+
const actionsHideCallback = toRef(props, "actionsHideCallback");
|
|
13
|
+
const row = toRef(props, "row");
|
|
14
|
+
const rowIndex = toRef(props, "rowIndex");
|
|
15
|
+
|
|
16
|
+
const isDeleteHidden = computed(() => {
|
|
17
|
+
const deleteHideCallback = get(actionsHideCallback.value, "delete");
|
|
18
|
+
|
|
19
|
+
if (isFunction(deleteHideCallback)) {
|
|
20
|
+
return deleteHideCallback({
|
|
21
|
+
row: row.value,
|
|
22
|
+
rowIndex: rowIndex.value,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return false;
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const isEditHidden = computed(() => {
|
|
30
|
+
const editHideCallback = get(actionsHideCallback.value, "edit");
|
|
31
|
+
|
|
32
|
+
if (isFunction(editHideCallback)) {
|
|
33
|
+
return editHideCallback({
|
|
34
|
+
row: row.value,
|
|
35
|
+
rowIndex: rowIndex.value,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return false;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
isDeleteHidden,
|
|
44
|
+
isEditHidden,
|
|
45
|
+
};
|
|
46
|
+
}
|