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,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
export default function StylesAPI(props) {
|
|
7
|
+
const isDeletable = toRef(props, "isDeletable");
|
|
8
|
+
const isDeletableConfirm = toRef(props, "isDeletableConfirm");
|
|
9
|
+
const isEditable = toRef(props, "isEditable");
|
|
10
|
+
const isActiveEditMode = toRef(props, "isActiveEditMode");
|
|
11
|
+
const widths = toRef(props, "widths");
|
|
12
|
+
|
|
13
|
+
const columnStyles = computed(() => {
|
|
14
|
+
const hasDeleteAction = isDeletable.value || isDeletableConfirm.value;
|
|
15
|
+
const width = isEditable.value || (isActiveEditMode.value && hasDeleteAction) ?
|
|
16
|
+
widths.value.actionsColumnDouble :
|
|
17
|
+
widths.value.actionsColumnSingle;
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
maxWidth: `${ width }px`,
|
|
21
|
+
minWidth: `${ width }px`,
|
|
22
|
+
width: `${ width }px`,
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
columnStyles,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 TitleAPI(props) {
|
|
12
|
+
const row = toRef(props, "row");
|
|
13
|
+
const rowIndex = toRef(props, "rowIndex");
|
|
14
|
+
const texts = toRef(props, "texts");
|
|
15
|
+
const actionsTitleCallback = toRef(props, "actionsTitleCallback");
|
|
16
|
+
|
|
17
|
+
const deleteTitle = computed(() => {
|
|
18
|
+
const deleteTitleCallback = get(actionsTitleCallback.value, "delete");
|
|
19
|
+
|
|
20
|
+
if (isFunction(deleteTitleCallback)) {
|
|
21
|
+
return deleteTitleCallback({
|
|
22
|
+
row: row.value,
|
|
23
|
+
rowIndex: rowIndex.value,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return texts.value.actionDelete;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const editTitle = computed(() => {
|
|
31
|
+
const editTitleCallback = get(actionsTitleCallback.value, "edit");
|
|
32
|
+
|
|
33
|
+
if (isFunction(editTitleCallback)) {
|
|
34
|
+
return editTitleCallback({
|
|
35
|
+
row: row.value,
|
|
36
|
+
rowIndex: rowIndex.value,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return texts.value.actionEdit;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
deleteTitle,
|
|
45
|
+
editTitle,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
h,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import AButton from "../../AButton/AButton";
|
|
7
|
+
import AIcon from "../../AIcon/AIcon";
|
|
8
|
+
import ATranslation from "../../ATranslation/ATranslation";
|
|
9
|
+
|
|
10
|
+
import IdAPI from "./compositionAPI/IdAPI";
|
|
11
|
+
|
|
12
|
+
import ChevronDown from "aloha-svg/dist/js/bootstrap/ChevronDown";
|
|
13
|
+
import ChevronUp from "aloha-svg/dist/js/bootstrap/ChevronUp";
|
|
14
|
+
import GripVertical from "aloha-svg/dist/js/bootstrap/GripVertical";
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: "ATableFormCellDnd",
|
|
18
|
+
props: {
|
|
19
|
+
canMoveRowDown: {
|
|
20
|
+
type: Function,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
canMoveRowUp: {
|
|
24
|
+
type: Function,
|
|
25
|
+
required: true,
|
|
26
|
+
},
|
|
27
|
+
id: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
},
|
|
31
|
+
isCreateMode: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
required: false,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
isDragAndDrop: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: false,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
isDndDisabled: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
required: false,
|
|
44
|
+
default: false,
|
|
45
|
+
},
|
|
46
|
+
isFooter: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
required: false,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
isHeader: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
required: false,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
moveRowDown: {
|
|
57
|
+
type: Function,
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
moveRowUp: {
|
|
61
|
+
type: Function,
|
|
62
|
+
required: true,
|
|
63
|
+
},
|
|
64
|
+
onDragend: {
|
|
65
|
+
type: Function,
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
onDragstart: {
|
|
69
|
+
type: Function,
|
|
70
|
+
required: true,
|
|
71
|
+
},
|
|
72
|
+
rowIndex: {
|
|
73
|
+
type: Number,
|
|
74
|
+
required: true,
|
|
75
|
+
},
|
|
76
|
+
texts: {
|
|
77
|
+
type: Object,
|
|
78
|
+
required: false,
|
|
79
|
+
default: () => ({}),
|
|
80
|
+
},
|
|
81
|
+
widths: {
|
|
82
|
+
type: Object,
|
|
83
|
+
required: false,
|
|
84
|
+
default: () => ({}),
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
setup(props) {
|
|
88
|
+
const {
|
|
89
|
+
idBtnDown,
|
|
90
|
+
idBtnUp,
|
|
91
|
+
} = IdAPI(props);
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
columnStyles: computed(() => ({
|
|
95
|
+
maxWidth: `${ props.widths.dndColumn }px`,
|
|
96
|
+
minWidth: `${ props.widths.dndColumn }px`,
|
|
97
|
+
width: `${ props.widths.dndColumn }px`,
|
|
98
|
+
})),
|
|
99
|
+
idBtnDown,
|
|
100
|
+
idBtnUp,
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
render() {
|
|
104
|
+
const tag = this.isHeader ? "th" : "td";
|
|
105
|
+
const isHandleDraggable = this.isDragAndDrop && !this.isDndDisabled;
|
|
106
|
+
|
|
107
|
+
return h(tag, {
|
|
108
|
+
class: [
|
|
109
|
+
"a_table_form__cell",
|
|
110
|
+
`a_table_form__cell_${ tag }`,
|
|
111
|
+
"a_table_form__cell_reorder",
|
|
112
|
+
],
|
|
113
|
+
style: this.columnStyles,
|
|
114
|
+
}, [
|
|
115
|
+
this.isHeader ?
|
|
116
|
+
h("span", {
|
|
117
|
+
class: "a_sr_only",
|
|
118
|
+
}, [
|
|
119
|
+
h(ATranslation, {
|
|
120
|
+
tag: "span",
|
|
121
|
+
text: this.texts.reorderColumn,
|
|
122
|
+
}),
|
|
123
|
+
]) :
|
|
124
|
+
this.isCreateMode ?
|
|
125
|
+
null :
|
|
126
|
+
this.isFooter ?
|
|
127
|
+
null :
|
|
128
|
+
h("div", {
|
|
129
|
+
class: "a_table_form__reorder_actions",
|
|
130
|
+
}, [
|
|
131
|
+
this.canMoveRowUp(this.rowIndex) && h(AButton, {
|
|
132
|
+
id: this.idBtnUp,
|
|
133
|
+
class: "a_sr_only_focusable a_btn a_btn_transparent_dark a_table_form__reorder_button",
|
|
134
|
+
disabled: this.isDndDisabled,
|
|
135
|
+
iconLeft: ChevronUp,
|
|
136
|
+
tabindex: this.isDndDisabled ? -1 : undefined,
|
|
137
|
+
title: this.texts.reorderUp,
|
|
138
|
+
textScreenReader: this.texts.reorderUp,
|
|
139
|
+
onClick: () => this.moveRowUp(this.rowIndex),
|
|
140
|
+
}),
|
|
141
|
+
h("span", {
|
|
142
|
+
ariaHidden: true,
|
|
143
|
+
class: "a_table_form__reorder_handle",
|
|
144
|
+
draggable: isHandleDraggable,
|
|
145
|
+
onDragend: isHandleDraggable ? this.onDragend : undefined,
|
|
146
|
+
onDragstart: isHandleDraggable ? ($event => this.onDragstart($event, this.rowIndex)) : undefined,
|
|
147
|
+
}, [
|
|
148
|
+
h(AIcon, {
|
|
149
|
+
class: "a_table_form__reorder_icon",
|
|
150
|
+
icon: GripVertical,
|
|
151
|
+
}),
|
|
152
|
+
]),
|
|
153
|
+
h("span", {
|
|
154
|
+
class: "a_sr_only",
|
|
155
|
+
}, [
|
|
156
|
+
h(ATranslation, {
|
|
157
|
+
tag: "span",
|
|
158
|
+
text: this.texts.reorderHandle,
|
|
159
|
+
}),
|
|
160
|
+
]),
|
|
161
|
+
this.canMoveRowDown(this.rowIndex) && h(AButton, {
|
|
162
|
+
id: this.idBtnDown,
|
|
163
|
+
class: "a_sr_only_focusable a_btn a_btn_transparent_dark a_table_form__reorder_button",
|
|
164
|
+
disabled: this.isDndDisabled,
|
|
165
|
+
iconLeft: ChevronDown,
|
|
166
|
+
tabindex: this.isDndDisabled ? -1 : undefined,
|
|
167
|
+
title: this.texts.reorderDown,
|
|
168
|
+
textScreenReader: this.texts.reorderDown,
|
|
169
|
+
onClick: () => this.moveRowDown(this.rowIndex),
|
|
170
|
+
}),
|
|
171
|
+
]),
|
|
172
|
+
]);
|
|
173
|
+
},
|
|
174
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
export default function IdAPI(props) {
|
|
7
|
+
const id = toRef(props, "id");
|
|
8
|
+
|
|
9
|
+
const idBtnUp = computed(() => {
|
|
10
|
+
return `${ id.value }_up`;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const idBtnDown = computed(() => {
|
|
14
|
+
return `${ id.value }_down`;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
idBtnDown,
|
|
19
|
+
idBtnUp,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import {
|
|
2
|
+
h,
|
|
3
|
+
nextTick,
|
|
4
|
+
} from "vue";
|
|
5
|
+
import {
|
|
6
|
+
AAlert,
|
|
7
|
+
AErrors,
|
|
8
|
+
} from "../../index";
|
|
9
|
+
|
|
10
|
+
import ATableFormCell from "../ATableFormCell/ATableFormCell";
|
|
11
|
+
import ATableFormCellAction from "../ATableFormCellAction/ATableFormCellAction";
|
|
12
|
+
import ATableFormCellDnd from "../ATableFormCellDnd/ATableFormCellDnd";
|
|
13
|
+
import ATableFormTh from "../ATableFormTh/ATableFormTh";
|
|
14
|
+
|
|
15
|
+
import ClassAPI from "./compositionAPI/ClassAPI";
|
|
16
|
+
import EditAPI from "./compositionAPI/EditAPI";
|
|
17
|
+
import ErrorsAPI from "./compositionAPI/ErrorsAPI";
|
|
18
|
+
import FocusAPI from "./compositionAPI/FocusAPI";
|
|
19
|
+
import IdAPI from "./compositionAPI/IdAPI";
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
cloneDeep,
|
|
23
|
+
} from "lodash-es";
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
name: "ATableFormRow",
|
|
27
|
+
props: {
|
|
28
|
+
allColumnsLength: {
|
|
29
|
+
type: Number,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
canMoveRowDown: {
|
|
33
|
+
type: Function,
|
|
34
|
+
required: true,
|
|
35
|
+
},
|
|
36
|
+
canMoveRowUp: {
|
|
37
|
+
type: Function,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
cellTag: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: false,
|
|
43
|
+
default: undefined,
|
|
44
|
+
},
|
|
45
|
+
changeModel: {
|
|
46
|
+
type: Function,
|
|
47
|
+
required: false,
|
|
48
|
+
default: undefined,
|
|
49
|
+
},
|
|
50
|
+
columns: {
|
|
51
|
+
type: Array,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
columnsStylesGrow: {
|
|
55
|
+
type: Object,
|
|
56
|
+
required: false,
|
|
57
|
+
default: () => ({}),
|
|
58
|
+
},
|
|
59
|
+
actionsDisabledCallback: {
|
|
60
|
+
type: Object,
|
|
61
|
+
required: false,
|
|
62
|
+
default: () => ({}),
|
|
63
|
+
},
|
|
64
|
+
actionsHideCallback: {
|
|
65
|
+
type: Object,
|
|
66
|
+
required: false,
|
|
67
|
+
default: () => ({}),
|
|
68
|
+
},
|
|
69
|
+
actionsTitleCallback: {
|
|
70
|
+
type: Object,
|
|
71
|
+
required: false,
|
|
72
|
+
default: () => ({}),
|
|
73
|
+
},
|
|
74
|
+
draggedRowIndex: {
|
|
75
|
+
type: Number,
|
|
76
|
+
required: false,
|
|
77
|
+
default: undefined,
|
|
78
|
+
},
|
|
79
|
+
editModel: {
|
|
80
|
+
type: Object,
|
|
81
|
+
required: false,
|
|
82
|
+
default: undefined,
|
|
83
|
+
},
|
|
84
|
+
errorIcon: {
|
|
85
|
+
type: String,
|
|
86
|
+
required: false,
|
|
87
|
+
default: undefined,
|
|
88
|
+
},
|
|
89
|
+
hasActionsColumn: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
required: false,
|
|
92
|
+
default: false,
|
|
93
|
+
},
|
|
94
|
+
hasActiveEditRow: {
|
|
95
|
+
type: Boolean,
|
|
96
|
+
required: false,
|
|
97
|
+
default: false,
|
|
98
|
+
},
|
|
99
|
+
id: {
|
|
100
|
+
type: String,
|
|
101
|
+
required: true,
|
|
102
|
+
},
|
|
103
|
+
isActiveEditMode: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
required: false,
|
|
106
|
+
default: false,
|
|
107
|
+
},
|
|
108
|
+
isActionsSticky: {
|
|
109
|
+
type: Boolean,
|
|
110
|
+
required: false,
|
|
111
|
+
default: false,
|
|
112
|
+
},
|
|
113
|
+
isCreateMode: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
required: false,
|
|
116
|
+
default: false,
|
|
117
|
+
},
|
|
118
|
+
isDeletable: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
required: false,
|
|
121
|
+
default: false,
|
|
122
|
+
},
|
|
123
|
+
isDeletableConfirm: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
required: false,
|
|
126
|
+
default: false,
|
|
127
|
+
},
|
|
128
|
+
isDndDisabled: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
required: false,
|
|
131
|
+
default: false,
|
|
132
|
+
},
|
|
133
|
+
isDragAndDrop: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
required: false,
|
|
136
|
+
default: false,
|
|
137
|
+
},
|
|
138
|
+
isEditable: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
required: false,
|
|
141
|
+
default: false,
|
|
142
|
+
},
|
|
143
|
+
isFooter: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
required: false,
|
|
146
|
+
default: false,
|
|
147
|
+
},
|
|
148
|
+
isHeader: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
required: false,
|
|
151
|
+
default: false,
|
|
152
|
+
},
|
|
153
|
+
moveRowDown: {
|
|
154
|
+
type: Function,
|
|
155
|
+
required: true,
|
|
156
|
+
},
|
|
157
|
+
moveRowUp: {
|
|
158
|
+
type: Function,
|
|
159
|
+
required: true,
|
|
160
|
+
},
|
|
161
|
+
onCancelEditRow: {
|
|
162
|
+
type: Function,
|
|
163
|
+
required: true,
|
|
164
|
+
},
|
|
165
|
+
onDeleteRow: {
|
|
166
|
+
type: Function,
|
|
167
|
+
required: true,
|
|
168
|
+
},
|
|
169
|
+
onDragend: {
|
|
170
|
+
type: Function,
|
|
171
|
+
required: true,
|
|
172
|
+
},
|
|
173
|
+
onDragleave: {
|
|
174
|
+
type: Function,
|
|
175
|
+
required: false,
|
|
176
|
+
default: undefined,
|
|
177
|
+
},
|
|
178
|
+
onDragover: {
|
|
179
|
+
type: Function,
|
|
180
|
+
required: false,
|
|
181
|
+
default: undefined,
|
|
182
|
+
},
|
|
183
|
+
onDragstart: {
|
|
184
|
+
type: Function,
|
|
185
|
+
required: true,
|
|
186
|
+
},
|
|
187
|
+
onDrop: {
|
|
188
|
+
type: Function,
|
|
189
|
+
required: false,
|
|
190
|
+
default: undefined,
|
|
191
|
+
},
|
|
192
|
+
onEditRow: {
|
|
193
|
+
type: Function,
|
|
194
|
+
required: true,
|
|
195
|
+
},
|
|
196
|
+
row: {
|
|
197
|
+
type: Object,
|
|
198
|
+
required: true,
|
|
199
|
+
},
|
|
200
|
+
rowClass: {
|
|
201
|
+
type: [String, Object, Array, Function],
|
|
202
|
+
required: false,
|
|
203
|
+
default: undefined,
|
|
204
|
+
},
|
|
205
|
+
rowIndex: {
|
|
206
|
+
type: Number,
|
|
207
|
+
required: true,
|
|
208
|
+
},
|
|
209
|
+
rows: {
|
|
210
|
+
type: Array,
|
|
211
|
+
required: true,
|
|
212
|
+
},
|
|
213
|
+
saveRow: {
|
|
214
|
+
type: Function,
|
|
215
|
+
required: true,
|
|
216
|
+
},
|
|
217
|
+
texts: {
|
|
218
|
+
type: Object,
|
|
219
|
+
required: false,
|
|
220
|
+
default: () => ({}),
|
|
221
|
+
},
|
|
222
|
+
trClass: {
|
|
223
|
+
type: [String, Object, Array],
|
|
224
|
+
required: false,
|
|
225
|
+
default: undefined,
|
|
226
|
+
},
|
|
227
|
+
widths: {
|
|
228
|
+
type: Object,
|
|
229
|
+
required: false,
|
|
230
|
+
default: () => ({}),
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
setup(props) {
|
|
234
|
+
const {
|
|
235
|
+
idTr,
|
|
236
|
+
} = IdAPI(props);
|
|
237
|
+
|
|
238
|
+
const {
|
|
239
|
+
focusFirstEditableElement,
|
|
240
|
+
} = FocusAPI({
|
|
241
|
+
idTr,
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const {
|
|
245
|
+
errorsLocal,
|
|
246
|
+
hasErrors,
|
|
247
|
+
optionsListForErrors,
|
|
248
|
+
} = ErrorsAPI(props);
|
|
249
|
+
|
|
250
|
+
const {
|
|
251
|
+
rowClassLocal,
|
|
252
|
+
trClassLocal,
|
|
253
|
+
} = ClassAPI(props, {
|
|
254
|
+
hasErrors,
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
const {
|
|
258
|
+
cancelEditRow,
|
|
259
|
+
isSaving,
|
|
260
|
+
modelLocal,
|
|
261
|
+
saveEditRow,
|
|
262
|
+
updateModelLocal,
|
|
263
|
+
} = EditAPI(props, {
|
|
264
|
+
errorsLocal,
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
return {
|
|
268
|
+
cancelEditRow,
|
|
269
|
+
errorsLocal,
|
|
270
|
+
focusFirstEditableElement,
|
|
271
|
+
hasErrors,
|
|
272
|
+
rowClassLocal,
|
|
273
|
+
idTr,
|
|
274
|
+
isSaving,
|
|
275
|
+
modelLocal,
|
|
276
|
+
optionsListForErrors,
|
|
277
|
+
saveEditRow,
|
|
278
|
+
trClassLocal,
|
|
279
|
+
updateModelLocal,
|
|
280
|
+
};
|
|
281
|
+
},
|
|
282
|
+
computed: {
|
|
283
|
+
currentRowData() {
|
|
284
|
+
return this.isActiveEditMode && this.modelLocal ? this.modelLocal : this.row;
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
watch: {
|
|
288
|
+
isActiveEditMode: {
|
|
289
|
+
immediate: true,
|
|
290
|
+
handler(isActiveEditMode) {
|
|
291
|
+
if (isActiveEditMode) {
|
|
292
|
+
this.modelLocal = cloneDeep(this.editModel === undefined ? this.row : this.editModel);
|
|
293
|
+
this.errorsLocal = {};
|
|
294
|
+
nextTick(() => {
|
|
295
|
+
this.focusFirstEditableElement();
|
|
296
|
+
});
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
this.errorsLocal = {};
|
|
301
|
+
this.isSaving = false;
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
render() {
|
|
306
|
+
const rows = [];
|
|
307
|
+
|
|
308
|
+
if (this.isActiveEditMode && this.texts.editInfoText) {
|
|
309
|
+
rows.push(h("tr", {
|
|
310
|
+
class: "a_table_form__row a_table_form__row_info",
|
|
311
|
+
key: `info_${ this.rowIndex }`,
|
|
312
|
+
}, [
|
|
313
|
+
h("td", {
|
|
314
|
+
class: "a_table_form__cell a_table_form__cell_info",
|
|
315
|
+
colspan: this.allColumnsLength,
|
|
316
|
+
}, [
|
|
317
|
+
h(AAlert, {
|
|
318
|
+
alertClass: "a_table_form__info",
|
|
319
|
+
html: this.texts.editInfoText,
|
|
320
|
+
isVisible: true,
|
|
321
|
+
type: "info",
|
|
322
|
+
}),
|
|
323
|
+
]),
|
|
324
|
+
]));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
rows.push(h("tr", {
|
|
328
|
+
id: this.idTr,
|
|
329
|
+
"aria-grabbed": !this.isHeader && !this.isFooter ? this.draggedRowIndex === this.rowIndex : undefined,
|
|
330
|
+
class: this.trClassLocal,
|
|
331
|
+
key: `main_${ this.rowIndex }`,
|
|
332
|
+
onDragleave: this.onDragleave && ($event => this.onDragleave($event, this.rowIndex)),
|
|
333
|
+
onDragover: this.onDragover && ($event => this.onDragover($event, this.rowIndex)),
|
|
334
|
+
onDrop: this.onDrop && ($event => this.onDrop($event, this.rowIndex)),
|
|
335
|
+
}, [
|
|
336
|
+
this.isDragAndDrop ?
|
|
337
|
+
h(ATableFormCellDnd, {
|
|
338
|
+
id: this.idTr,
|
|
339
|
+
canMoveRowDown: this.canMoveRowDown,
|
|
340
|
+
canMoveRowUp: this.canMoveRowUp,
|
|
341
|
+
isCreateMode: this.isCreateMode,
|
|
342
|
+
isDndDisabled: this.isDndDisabled,
|
|
343
|
+
isDragAndDrop: this.isDragAndDrop,
|
|
344
|
+
isFooter: this.isFooter,
|
|
345
|
+
isHeader: this.isHeader,
|
|
346
|
+
moveRowDown: this.moveRowDown,
|
|
347
|
+
moveRowUp: this.moveRowUp,
|
|
348
|
+
onDragend: this.onDragend,
|
|
349
|
+
onDragstart: this.onDragstart,
|
|
350
|
+
rowIndex: this.rowIndex,
|
|
351
|
+
texts: this.texts,
|
|
352
|
+
widths: this.widths,
|
|
353
|
+
}) :
|
|
354
|
+
null,
|
|
355
|
+
...this.columns.map((column, columnIndex) => {
|
|
356
|
+
if (this.isHeader) {
|
|
357
|
+
return h(ATableFormTh, {
|
|
358
|
+
column,
|
|
359
|
+
columnStyle: this.columnsStylesGrow[column.id],
|
|
360
|
+
isEditable: this.isEditable,
|
|
361
|
+
}, this.$slots);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return h(ATableFormCell, {
|
|
365
|
+
id: this.idTr,
|
|
366
|
+
column,
|
|
367
|
+
columnIndex,
|
|
368
|
+
columnStyle: this.columnsStylesGrow[column.id],
|
|
369
|
+
errorIcon: this.errorIcon,
|
|
370
|
+
errors: this.errorsLocal,
|
|
371
|
+
isEditable: this.isEditable,
|
|
372
|
+
isEditMode: this.isActiveEditMode,
|
|
373
|
+
isFooter: this.isFooter,
|
|
374
|
+
onUpdateRowData: this.updateModelLocal,
|
|
375
|
+
row: this.row,
|
|
376
|
+
rowData: this.currentRowData,
|
|
377
|
+
rowIndex: this.rowIndex,
|
|
378
|
+
rows: this.rows,
|
|
379
|
+
tag: this.cellTag,
|
|
380
|
+
}, this.$slots);
|
|
381
|
+
}),
|
|
382
|
+
this.hasActionsColumn ?
|
|
383
|
+
h(ATableFormCellAction, {
|
|
384
|
+
actionsDisabledCallback: this.actionsDisabledCallback,
|
|
385
|
+
actionsHideCallback: this.actionsHideCallback,
|
|
386
|
+
id: this.idTr,
|
|
387
|
+
hasActiveEditRow: this.hasActiveEditRow,
|
|
388
|
+
isActiveEditMode: this.isActiveEditMode,
|
|
389
|
+
isActionsSticky: this.isActionsSticky,
|
|
390
|
+
isDeletable: this.isDeletable,
|
|
391
|
+
isDeletableConfirm: this.isDeletableConfirm,
|
|
392
|
+
isEditable: this.isEditable,
|
|
393
|
+
isFooter: this.isFooter,
|
|
394
|
+
isHeader: this.isHeader,
|
|
395
|
+
isSaving: this.isSaving,
|
|
396
|
+
onCancelEditRow: this.cancelEditRow,
|
|
397
|
+
onDeleteRow: this.onDeleteRow,
|
|
398
|
+
onEditRow: this.onEditRow,
|
|
399
|
+
onSaveEditRow: this.saveEditRow,
|
|
400
|
+
row: this.row,
|
|
401
|
+
rowIndex: this.rowIndex,
|
|
402
|
+
texts: this.texts,
|
|
403
|
+
actionsTitleCallback: this.actionsTitleCallback,
|
|
404
|
+
widths: this.widths,
|
|
405
|
+
}) :
|
|
406
|
+
null,
|
|
407
|
+
]));
|
|
408
|
+
|
|
409
|
+
if (this.isActiveEditMode && this.hasErrors) {
|
|
410
|
+
rows.push(h("tr", {
|
|
411
|
+
class: "a_table_form__row a_table_form__row_errors",
|
|
412
|
+
key: `errors_${ this.rowIndex }`,
|
|
413
|
+
}, [
|
|
414
|
+
h("td", {
|
|
415
|
+
class: "a_table_form__cell a_table_form__cell_errors",
|
|
416
|
+
colspan: this.allColumnsLength,
|
|
417
|
+
}, [
|
|
418
|
+
h(AErrors, {
|
|
419
|
+
autoFocus: true,
|
|
420
|
+
closable: false,
|
|
421
|
+
errors: this.errorsLocal,
|
|
422
|
+
optionsList: this.optionsListForErrors,
|
|
423
|
+
idPrefix: this.idTr,
|
|
424
|
+
}),
|
|
425
|
+
]),
|
|
426
|
+
]));
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
return rows;
|
|
430
|
+
},
|
|
431
|
+
};
|