aloha-vue 2.57.4 → 2.57.5
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 +7 -0
- package/dist/aloha-vue.es.js +9722 -9673
- package/dist/aloha-vue.umd.js +51 -51
- package/package.json +1 -1
- package/src/AButton/AButton.js +275 -270
- package/src/AElement/AElement.js +23 -11
- package/src/AElement/{comositionAPI → compositionAPI}/AttributesAPI.js +51 -51
- package/src/AElement/{comositionAPI → compositionAPI}/ClickAPI.js +30 -30
- package/src/AElement/{comositionAPI → compositionAPI}/ComponentLocalAPI.js +23 -23
- package/src/AElement/{comositionAPI → compositionAPI}/DisabledAPI.js +22 -22
- package/src/AElement/{comositionAPI → compositionAPI}/HtmlTitleAPI.js +33 -33
- package/src/AElement/compositionAPI/KeydownAPI.js +35 -0
- package/src/AElement/{comositionAPI → compositionAPI}/LoadingAPI.js +22 -22
- package/src/AElement/{comositionAPI → compositionAPI}/RouterLinkAPI.js +20 -20
- package/src/AElement/{comositionAPI → compositionAPI}/SwitchAPI.js +33 -33
- package/src/AElement/{comositionAPI → compositionAPI}/TagAPI.js +34 -34
- package/src/AElement/{comositionAPI → compositionAPI}/TextAPI.js +78 -78
- package/src/AElement/{comositionAPI → compositionAPI}/TitleAPI.js +29 -29
- package/src/ALink/ALink.js +253 -248
- package/src/ATableForm/ATableForm.js +5 -0
- package/src/ATableForm/ATableFormCellAction/compositionAPI/DeleteAPI.js +5 -0
- package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +2 -0
- package/src/ATableForm/ATableFormTh/ATableFormTh.js +0 -6
- package/src/ATableForm/compositionAPI/ColumnsGrowAPI.js +4 -1
- package/src/ATableForm/compositionAPI/DeleteAPI.js +2 -2
- package/src/ATableForm/compositionAPI/DragAndDropAPI.js +24 -14
package/src/ALink/ALink.js
CHANGED
|
@@ -1,248 +1,253 @@
|
|
|
1
|
-
import {
|
|
2
|
-
h,
|
|
3
|
-
} from "vue";
|
|
4
|
-
|
|
5
|
-
import AElement from "../AElement/AElement";
|
|
6
|
-
|
|
7
|
-
import EmitsAPI from "../AButton/compositionAPI/EmitsAPI";
|
|
8
|
-
|
|
9
|
-
import placements from "../const/placements";
|
|
10
|
-
import {
|
|
11
|
-
isInteger,
|
|
12
|
-
isString,
|
|
13
|
-
uniqueId,
|
|
14
|
-
} from "lodash-es";
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: "ALink",
|
|
18
|
-
inheritAttrs: false,
|
|
19
|
-
props: {
|
|
20
|
-
alwaysTranslate: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
required: false,
|
|
23
|
-
},
|
|
24
|
-
ariaLabel: {
|
|
25
|
-
type: [String, Number, Object],
|
|
26
|
-
required: false,
|
|
27
|
-
default: undefined,
|
|
28
|
-
},
|
|
29
|
-
attributes: {
|
|
30
|
-
type: Object,
|
|
31
|
-
required: false,
|
|
32
|
-
default: () => ({}),
|
|
33
|
-
},
|
|
34
|
-
class: {
|
|
35
|
-
type: [String, Object],
|
|
36
|
-
required: false,
|
|
37
|
-
default: undefined,
|
|
38
|
-
},
|
|
39
|
-
classDefault: {
|
|
40
|
-
type: String,
|
|
41
|
-
required: false,
|
|
42
|
-
default: "aloha_element",
|
|
43
|
-
},
|
|
44
|
-
classDefaultHidden: {
|
|
45
|
-
type: String,
|
|
46
|
-
required: false,
|
|
47
|
-
default: "aloha_element__hidden",
|
|
48
|
-
},
|
|
49
|
-
classDisabled: {
|
|
50
|
-
type: String,
|
|
51
|
-
required: false,
|
|
52
|
-
default: "disabled",
|
|
53
|
-
},
|
|
54
|
-
disabled: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
required: false,
|
|
57
|
-
default: undefined,
|
|
58
|
-
},
|
|
59
|
-
excludeRenderAttributes: {
|
|
60
|
-
type: Array,
|
|
61
|
-
required: false,
|
|
62
|
-
default: () => [],
|
|
63
|
-
},
|
|
64
|
-
extra: {
|
|
65
|
-
type: Object,
|
|
66
|
-
required: false,
|
|
67
|
-
default: undefined,
|
|
68
|
-
},
|
|
69
|
-
extraData: {
|
|
70
|
-
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol, null, undefined],
|
|
71
|
-
required: false,
|
|
72
|
-
default: undefined,
|
|
73
|
-
},
|
|
74
|
-
href: {
|
|
75
|
-
type: String,
|
|
76
|
-
required: false,
|
|
77
|
-
default: undefined,
|
|
78
|
-
},
|
|
79
|
-
html: {
|
|
80
|
-
type: [String, Number, Object, Array],
|
|
81
|
-
required: false,
|
|
82
|
-
default: undefined,
|
|
83
|
-
},
|
|
84
|
-
htmlScreenReader: {
|
|
85
|
-
type: [String, Number, Object, Array],
|
|
86
|
-
required: false,
|
|
87
|
-
default: undefined,
|
|
88
|
-
},
|
|
89
|
-
iconAttributes: {
|
|
90
|
-
type: Object,
|
|
91
|
-
required: false,
|
|
92
|
-
default: () => ({}),
|
|
93
|
-
},
|
|
94
|
-
iconClass: {
|
|
95
|
-
type: [String, Object],
|
|
96
|
-
required: false,
|
|
97
|
-
default: undefined,
|
|
98
|
-
},
|
|
99
|
-
iconLeft: {
|
|
100
|
-
type: [String, Object],
|
|
101
|
-
required: false,
|
|
102
|
-
default: undefined,
|
|
103
|
-
},
|
|
104
|
-
iconRight: {
|
|
105
|
-
type: [String, Object],
|
|
106
|
-
required: false,
|
|
107
|
-
default: undefined,
|
|
108
|
-
},
|
|
109
|
-
iconTag: {
|
|
110
|
-
type: String,
|
|
111
|
-
required: false,
|
|
112
|
-
default: undefined,
|
|
113
|
-
},
|
|
114
|
-
id: {
|
|
115
|
-
type: String,
|
|
116
|
-
required: false,
|
|
117
|
-
default: () => uniqueId("a_link_"),
|
|
118
|
-
},
|
|
119
|
-
isTitleHtml: {
|
|
120
|
-
type: Boolean,
|
|
121
|
-
required: false,
|
|
122
|
-
default: undefined,
|
|
123
|
-
},
|
|
124
|
-
loading: {
|
|
125
|
-
type: Boolean,
|
|
126
|
-
required: false,
|
|
127
|
-
default: false,
|
|
128
|
-
},
|
|
129
|
-
loadingAlign: {
|
|
130
|
-
type: String,
|
|
131
|
-
required: false,
|
|
132
|
-
default: "right",
|
|
133
|
-
validator: value => ["right", "left"].indexOf(value) !== -1,
|
|
134
|
-
},
|
|
135
|
-
loadingClass: {
|
|
136
|
-
type: [String, Object],
|
|
137
|
-
required: false,
|
|
138
|
-
default: "a_spinner_small",
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
type:
|
|
142
|
-
required: false,
|
|
143
|
-
default:
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
type: [String, Number, Object, Array],
|
|
147
|
-
required: false,
|
|
148
|
-
default: undefined,
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
type:
|
|
152
|
-
required: false,
|
|
153
|
-
default: undefined,
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
type:
|
|
157
|
-
required: false,
|
|
158
|
-
default: undefined,
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
type:
|
|
162
|
-
required: false,
|
|
163
|
-
default: undefined,
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
type: [String, Number, Object],
|
|
167
|
-
required: false,
|
|
168
|
-
default: undefined,
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
type:
|
|
172
|
-
required: false,
|
|
173
|
-
default: undefined,
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
type:
|
|
177
|
-
required: false,
|
|
178
|
-
default: undefined,
|
|
179
|
-
},
|
|
180
|
-
|
|
181
|
-
type: String,
|
|
182
|
-
required: false,
|
|
183
|
-
default: undefined,
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
type:
|
|
187
|
-
required: false,
|
|
188
|
-
default: undefined,
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
type: String,
|
|
192
|
-
required: false,
|
|
193
|
-
default:
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
type:
|
|
197
|
-
required: false,
|
|
198
|
-
default:
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
type: Object,
|
|
202
|
-
required: false,
|
|
203
|
-
default:
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
type:
|
|
207
|
-
required: false,
|
|
208
|
-
default:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
1
|
+
import {
|
|
2
|
+
h,
|
|
3
|
+
} from "vue";
|
|
4
|
+
|
|
5
|
+
import AElement from "../AElement/AElement";
|
|
6
|
+
|
|
7
|
+
import EmitsAPI from "../AButton/compositionAPI/EmitsAPI";
|
|
8
|
+
|
|
9
|
+
import placements from "../const/placements";
|
|
10
|
+
import {
|
|
11
|
+
isInteger,
|
|
12
|
+
isString,
|
|
13
|
+
uniqueId,
|
|
14
|
+
} from "lodash-es";
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
name: "ALink",
|
|
18
|
+
inheritAttrs: false,
|
|
19
|
+
props: {
|
|
20
|
+
alwaysTranslate: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
required: false,
|
|
23
|
+
},
|
|
24
|
+
ariaLabel: {
|
|
25
|
+
type: [String, Number, Object],
|
|
26
|
+
required: false,
|
|
27
|
+
default: undefined,
|
|
28
|
+
},
|
|
29
|
+
attributes: {
|
|
30
|
+
type: Object,
|
|
31
|
+
required: false,
|
|
32
|
+
default: () => ({}),
|
|
33
|
+
},
|
|
34
|
+
class: {
|
|
35
|
+
type: [String, Object],
|
|
36
|
+
required: false,
|
|
37
|
+
default: undefined,
|
|
38
|
+
},
|
|
39
|
+
classDefault: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false,
|
|
42
|
+
default: "aloha_element",
|
|
43
|
+
},
|
|
44
|
+
classDefaultHidden: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: false,
|
|
47
|
+
default: "aloha_element__hidden",
|
|
48
|
+
},
|
|
49
|
+
classDisabled: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: false,
|
|
52
|
+
default: "disabled",
|
|
53
|
+
},
|
|
54
|
+
disabled: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
required: false,
|
|
57
|
+
default: undefined,
|
|
58
|
+
},
|
|
59
|
+
excludeRenderAttributes: {
|
|
60
|
+
type: Array,
|
|
61
|
+
required: false,
|
|
62
|
+
default: () => [],
|
|
63
|
+
},
|
|
64
|
+
extra: {
|
|
65
|
+
type: Object,
|
|
66
|
+
required: false,
|
|
67
|
+
default: undefined,
|
|
68
|
+
},
|
|
69
|
+
extraData: {
|
|
70
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol, null, undefined],
|
|
71
|
+
required: false,
|
|
72
|
+
default: undefined,
|
|
73
|
+
},
|
|
74
|
+
href: {
|
|
75
|
+
type: String,
|
|
76
|
+
required: false,
|
|
77
|
+
default: undefined,
|
|
78
|
+
},
|
|
79
|
+
html: {
|
|
80
|
+
type: [String, Number, Object, Array],
|
|
81
|
+
required: false,
|
|
82
|
+
default: undefined,
|
|
83
|
+
},
|
|
84
|
+
htmlScreenReader: {
|
|
85
|
+
type: [String, Number, Object, Array],
|
|
86
|
+
required: false,
|
|
87
|
+
default: undefined,
|
|
88
|
+
},
|
|
89
|
+
iconAttributes: {
|
|
90
|
+
type: Object,
|
|
91
|
+
required: false,
|
|
92
|
+
default: () => ({}),
|
|
93
|
+
},
|
|
94
|
+
iconClass: {
|
|
95
|
+
type: [String, Object],
|
|
96
|
+
required: false,
|
|
97
|
+
default: undefined,
|
|
98
|
+
},
|
|
99
|
+
iconLeft: {
|
|
100
|
+
type: [String, Object],
|
|
101
|
+
required: false,
|
|
102
|
+
default: undefined,
|
|
103
|
+
},
|
|
104
|
+
iconRight: {
|
|
105
|
+
type: [String, Object],
|
|
106
|
+
required: false,
|
|
107
|
+
default: undefined,
|
|
108
|
+
},
|
|
109
|
+
iconTag: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: false,
|
|
112
|
+
default: undefined,
|
|
113
|
+
},
|
|
114
|
+
id: {
|
|
115
|
+
type: String,
|
|
116
|
+
required: false,
|
|
117
|
+
default: () => uniqueId("a_link_"),
|
|
118
|
+
},
|
|
119
|
+
isTitleHtml: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
required: false,
|
|
122
|
+
default: undefined,
|
|
123
|
+
},
|
|
124
|
+
loading: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
required: false,
|
|
127
|
+
default: false,
|
|
128
|
+
},
|
|
129
|
+
loadingAlign: {
|
|
130
|
+
type: String,
|
|
131
|
+
required: false,
|
|
132
|
+
default: "right",
|
|
133
|
+
validator: value => ["right", "left"].indexOf(value) !== -1,
|
|
134
|
+
},
|
|
135
|
+
loadingClass: {
|
|
136
|
+
type: [String, Object],
|
|
137
|
+
required: false,
|
|
138
|
+
default: "a_spinner_small",
|
|
139
|
+
},
|
|
140
|
+
preventKeyboardRepeat: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
required: false,
|
|
143
|
+
default: false,
|
|
144
|
+
},
|
|
145
|
+
safeHtml: {
|
|
146
|
+
type: [String, Number, Object, Array],
|
|
147
|
+
required: false,
|
|
148
|
+
default: undefined,
|
|
149
|
+
},
|
|
150
|
+
safeHtmlScreenReader: {
|
|
151
|
+
type: [String, Number, Object, Array],
|
|
152
|
+
required: false,
|
|
153
|
+
default: undefined,
|
|
154
|
+
},
|
|
155
|
+
stop: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
required: false,
|
|
158
|
+
default: undefined,
|
|
159
|
+
},
|
|
160
|
+
target: {
|
|
161
|
+
type: String,
|
|
162
|
+
required: false,
|
|
163
|
+
default: undefined,
|
|
164
|
+
},
|
|
165
|
+
text: {
|
|
166
|
+
type: [String, Number, Object, Array],
|
|
167
|
+
required: false,
|
|
168
|
+
default: undefined,
|
|
169
|
+
},
|
|
170
|
+
textAfter: {
|
|
171
|
+
type: [String, Number, Object],
|
|
172
|
+
required: false,
|
|
173
|
+
default: undefined,
|
|
174
|
+
},
|
|
175
|
+
textAriaHidden: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
required: false,
|
|
178
|
+
default: undefined,
|
|
179
|
+
},
|
|
180
|
+
textBefore: {
|
|
181
|
+
type: [String, Number, Object],
|
|
182
|
+
required: false,
|
|
183
|
+
default: undefined,
|
|
184
|
+
},
|
|
185
|
+
textClass: {
|
|
186
|
+
type: String,
|
|
187
|
+
required: false,
|
|
188
|
+
default: undefined,
|
|
189
|
+
},
|
|
190
|
+
textScreenReader: {
|
|
191
|
+
type: [String, Number, Object, Array],
|
|
192
|
+
required: false,
|
|
193
|
+
default: undefined,
|
|
194
|
+
},
|
|
195
|
+
textTag: {
|
|
196
|
+
type: String,
|
|
197
|
+
required: false,
|
|
198
|
+
default: "span",
|
|
199
|
+
},
|
|
200
|
+
title: {
|
|
201
|
+
type: [String, Number, Object, Array],
|
|
202
|
+
required: false,
|
|
203
|
+
default: undefined,
|
|
204
|
+
},
|
|
205
|
+
titleAttributes: {
|
|
206
|
+
type: Object,
|
|
207
|
+
required: false,
|
|
208
|
+
default: () => ({}),
|
|
209
|
+
},
|
|
210
|
+
titlePlacement: {
|
|
211
|
+
type: String,
|
|
212
|
+
required: false,
|
|
213
|
+
default: "top",
|
|
214
|
+
validator: placement => placements.indexOf(placement) !== -1,
|
|
215
|
+
},
|
|
216
|
+
titleZIndex: {
|
|
217
|
+
type: [Number, String],
|
|
218
|
+
required: false,
|
|
219
|
+
default: "auto",
|
|
220
|
+
validator: value => {
|
|
221
|
+
if (isString(value)) {
|
|
222
|
+
return value === "auto";
|
|
223
|
+
}
|
|
224
|
+
return isInteger(value);
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
to: {
|
|
228
|
+
type: [Object, String],
|
|
229
|
+
required: false,
|
|
230
|
+
default: undefined,
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
emits: [
|
|
234
|
+
"click",
|
|
235
|
+
],
|
|
236
|
+
setup(props, context) {
|
|
237
|
+
const {
|
|
238
|
+
clickEmit,
|
|
239
|
+
} = EmitsAPI(props, context);
|
|
240
|
+
|
|
241
|
+
return {
|
|
242
|
+
clickEmit,
|
|
243
|
+
};
|
|
244
|
+
},
|
|
245
|
+
render() {
|
|
246
|
+
return h(AElement, {
|
|
247
|
+
...this.$attrs,
|
|
248
|
+
...this.$props,
|
|
249
|
+
type: "link",
|
|
250
|
+
onClick: this.clickEmit,
|
|
251
|
+
}, this.$slots);
|
|
252
|
+
},
|
|
253
|
+
};
|
|
@@ -12,6 +12,7 @@ export default function DeleteAPI(props, {
|
|
|
12
12
|
idBtnDelete = computed(() => ""),
|
|
13
13
|
isActionsDisabled = computed(() => false),
|
|
14
14
|
}) {
|
|
15
|
+
const id = toRef(props, "id");
|
|
15
16
|
const isDeletable = toRef(props, "isDeletable");
|
|
16
17
|
const isDeletableConfirm = toRef(props, "isDeletableConfirm");
|
|
17
18
|
const onDeleteRow = toRef(props, "onDeleteRow");
|
|
@@ -40,8 +41,10 @@ export default function DeleteAPI(props, {
|
|
|
40
41
|
headerText: texts.value.actionDeleteConfirmHeader,
|
|
41
42
|
save: async() => {
|
|
42
43
|
await onDeleteRow.value({
|
|
44
|
+
btnDeleteId: idBtnDelete.value,
|
|
43
45
|
row: row.value,
|
|
44
46
|
rowIndex: rowIndex.value,
|
|
47
|
+
rowId: id.value,
|
|
45
48
|
});
|
|
46
49
|
closeConfirm();
|
|
47
50
|
},
|
|
@@ -63,8 +66,10 @@ export default function DeleteAPI(props, {
|
|
|
63
66
|
|
|
64
67
|
if (isDeletable.value) {
|
|
65
68
|
onDeleteRow.value({
|
|
69
|
+
btnDeleteId: idBtnDelete.value,
|
|
66
70
|
row: row.value,
|
|
67
71
|
rowIndex: rowIndex.value,
|
|
72
|
+
rowId: id.value,
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
75
|
};
|
|
@@ -133,6 +133,7 @@ export default {
|
|
|
133
133
|
class: "a_sr_only_focusable a_btn a_btn_transparent_dark a_table_form__reorder_button",
|
|
134
134
|
disabled: this.isDndDisabled,
|
|
135
135
|
iconLeft: ChevronUp,
|
|
136
|
+
preventKeyboardRepeat: true,
|
|
136
137
|
tabindex: this.isDndDisabled ? -1 : undefined,
|
|
137
138
|
title: this.texts.reorderUp,
|
|
138
139
|
textScreenReader: this.texts.reorderUp,
|
|
@@ -163,6 +164,7 @@ export default {
|
|
|
163
164
|
class: "a_sr_only_focusable a_btn a_btn_transparent_dark a_table_form__reorder_button",
|
|
164
165
|
disabled: this.isDndDisabled,
|
|
165
166
|
iconLeft: ChevronDown,
|
|
167
|
+
preventKeyboardRepeat: true,
|
|
166
168
|
tabindex: this.isDndDisabled ? -1 : undefined,
|
|
167
169
|
title: this.texts.reorderDown,
|
|
168
170
|
textScreenReader: this.texts.reorderDown,
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
isString,
|
|
15
15
|
} from "lodash-es";
|
|
16
16
|
|
|
17
|
+
const TABLE_WIDTH_SAFE_DELTA = 2;
|
|
18
|
+
|
|
17
19
|
export default function ColumnsGrowAPI(props, {
|
|
18
20
|
hasActionsColumn = computed(() => false),
|
|
19
21
|
widthsLocal = computed(() => ({})),
|
|
@@ -106,7 +108,8 @@ export default function ColumnsGrowAPI(props, {
|
|
|
106
108
|
}
|
|
107
109
|
|
|
108
110
|
const columnsLocal = columns.value || [];
|
|
109
|
-
|
|
111
|
+
// Leave a small buffer to avoid subpixel overflow triggering a useless scrollbar.
|
|
112
|
+
const tableWidthAvailable = tableWidth.value - actionsColumnWidth.value - dndColumnWidth.value - TABLE_WIDTH_SAFE_DELTA;
|
|
110
113
|
|
|
111
114
|
if (tableWidthAvailable <= 0) {
|
|
112
115
|
columnsStylesGrow.value = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default function DeleteAPI(props, { emit }) {
|
|
2
|
-
const onDeleteRow = ({ row, rowIndex }) => {
|
|
3
|
-
emit("deleteRow", { row, rowIndex });
|
|
2
|
+
const onDeleteRow = ({ row, rowIndex, rowId, btnDeleteId }) => {
|
|
3
|
+
emit("deleteRow", { row, rowIndex, rowId, btnDeleteId });
|
|
4
4
|
};
|
|
5
5
|
|
|
6
6
|
return {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
export default function DragAndDropAPI(props, { emit }, {
|
|
13
13
|
isDndDisabled = computed(() => false),
|
|
14
14
|
} = {}) {
|
|
15
|
+
const focusAfterMove = toRef(props, "focusAfterMove");
|
|
15
16
|
const id = toRef(props, "id");
|
|
16
17
|
const isDragAndDrop = toRef(props, "isDragAndDrop");
|
|
17
18
|
const rows = toRef(props, "rows");
|
|
@@ -82,7 +83,7 @@ export default function DragAndDropAPI(props, { emit }, {
|
|
|
82
83
|
};
|
|
83
84
|
};
|
|
84
85
|
|
|
85
|
-
const moveRow = ({ fromIndex, toIndex, trigger }) => {
|
|
86
|
+
const moveRow = ({ focusId, fromIndex, toIndex, trigger }) => {
|
|
86
87
|
if (!isDragAndDrop.value ||
|
|
87
88
|
isDndDisabled.value ||
|
|
88
89
|
fromIndex === toIndex ||
|
|
@@ -97,8 +98,9 @@ export default function DragAndDropAPI(props, { emit }, {
|
|
|
97
98
|
const [movedRow] = ROWS_LOCAL.splice(fromIndex, 1);
|
|
98
99
|
ROWS_LOCAL.splice(toIndex, 0, movedRow);
|
|
99
100
|
|
|
100
|
-
emit("updateRows", { rows: ROWS_LOCAL, trigger, fromIndex, toIndex });
|
|
101
|
+
emit("updateRows", { focusId, rows: ROWS_LOCAL, trigger, fromIndex, toIndex });
|
|
101
102
|
emit("moveRow", {
|
|
103
|
+
focusId,
|
|
102
104
|
fromIndex,
|
|
103
105
|
row: movedRow,
|
|
104
106
|
toIndex,
|
|
@@ -128,34 +130,42 @@ export default function DragAndDropAPI(props, { emit }, {
|
|
|
128
130
|
});
|
|
129
131
|
};
|
|
130
132
|
|
|
133
|
+
const setFocusAfterMoveLocal = ({ focusId }) => {
|
|
134
|
+
if (!focusAfterMove.value) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
nextTick().then(
|
|
139
|
+
() => {
|
|
140
|
+
setFocusToElement({ selector: `#${ focusId }` });
|
|
141
|
+
},
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
131
145
|
const moveRowUp = rowIndex => {
|
|
146
|
+
const focusIndex = Math.max(1, rowIndex - 1);
|
|
147
|
+
const focusId = `${ id.value }_${ focusIndex }_up`;
|
|
132
148
|
moveRow({
|
|
149
|
+
focusId,
|
|
133
150
|
fromIndex: rowIndex,
|
|
134
151
|
toIndex: rowIndex - 1,
|
|
135
152
|
trigger: "moveRowUp",
|
|
136
153
|
});
|
|
137
154
|
|
|
138
|
-
|
|
139
|
-
() => {
|
|
140
|
-
const INDEX = Math.max(1, rowIndex - 1);
|
|
141
|
-
setFocusToElement({ selector: `#${ id.value }_${ INDEX }_up` });
|
|
142
|
-
},
|
|
143
|
-
);
|
|
155
|
+
setFocusAfterMoveLocal({ focusId });
|
|
144
156
|
};
|
|
145
157
|
|
|
146
158
|
const moveRowDown = rowIndex => {
|
|
159
|
+
const focusIndex = Math.min(rows.value.length - 2, rowIndex + 1);
|
|
160
|
+
const focusId = `${ id.value }_${ focusIndex }_down`;
|
|
147
161
|
moveRow({
|
|
162
|
+
focusId,
|
|
148
163
|
fromIndex: rowIndex,
|
|
149
164
|
toIndex: rowIndex + 1,
|
|
150
165
|
trigger: "moveRowDown",
|
|
151
166
|
});
|
|
152
167
|
|
|
153
|
-
|
|
154
|
-
() => {
|
|
155
|
-
const INDEX = Math.min(rows.value.length - 2, rowIndex + 1);
|
|
156
|
-
setFocusToElement({ selector: `#${ id.value }_${ INDEX }_down` });
|
|
157
|
-
},
|
|
158
|
-
);
|
|
168
|
+
setFocusAfterMoveLocal({ focusId });
|
|
159
169
|
};
|
|
160
170
|
|
|
161
171
|
const onDragstart = ($event, rowIndex) => {
|