aloha-vue 1.2.195 → 1.2.197
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/package.json +1 -1
- package/src/AMenu/compositionAPI/AMenuSearchAPI.js +2 -1
- package/src/AMenu2/compositionAPI/SearchAPI.js +6 -1
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/AttributesComponentAPI.js +5 -1
- package/src/ATable/ATableTdAction/ATableTdAction.js +0 -3
- package/src/ATable/compositionAPI/RowActionsAPI.js +43 -12
- package/src/filters/filterSearchHighlight.js +2 -1
- package/src/ui/compositionApi/UiSearchAPI.js +12 -3
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import AKeyId from "../../const/AKeyId";
|
|
7
7
|
import AKeyLabel from "../../const/AKeyLabel";
|
|
8
8
|
import {
|
|
9
|
+
escapeRegExp,
|
|
9
10
|
forEach,
|
|
10
11
|
} from "lodash-es";
|
|
11
12
|
|
|
@@ -49,7 +50,7 @@ export default function AMenuSearchAPI(props, {
|
|
|
49
50
|
rest: {},
|
|
50
51
|
};
|
|
51
52
|
if (isSearchActive.value) {
|
|
52
|
-
const RE = new RegExp(modelSearch.value, "gi");
|
|
53
|
+
const RE = new RegExp(escapeRegExp(modelSearch.value), "gi");
|
|
53
54
|
forEach(dataProParentList.value, (items, index) => {
|
|
54
55
|
let isVisible = false;
|
|
55
56
|
forEach(items, item => {
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
import AKeyLabel from "../../const/AKeyLabel";
|
|
8
8
|
import {
|
|
9
|
+
escapeRegExp,
|
|
9
10
|
forEach,
|
|
10
11
|
} from "lodash-es";
|
|
11
12
|
|
|
@@ -40,10 +41,14 @@ export default function SearchAPI(props, {
|
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
|
|
44
|
+
const modelSearchEscapeRegExp = computed(() => {
|
|
45
|
+
return escapeRegExp(modelSearch.value);
|
|
46
|
+
});
|
|
47
|
+
|
|
43
48
|
const itemsWithSearch = computed(() => {
|
|
44
49
|
const ITEMS = [];
|
|
45
50
|
if (isSearchActive.value) {
|
|
46
|
-
const RE = new RegExp(
|
|
51
|
+
const RE = new RegExp(modelSearchEscapeRegExp.value, "gi");
|
|
47
52
|
forEach(dataKeyById.value, item => {
|
|
48
53
|
const ITEM_LABEL = item[AKeyLabel];
|
|
49
54
|
if (`${ ITEM_LABEL }`.search(RE) !== -1) {
|
|
@@ -3,6 +3,10 @@ import {
|
|
|
3
3
|
toRef,
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
|
+
import {
|
|
7
|
+
escapeRegExp,
|
|
8
|
+
} from "lodash-es";
|
|
9
|
+
|
|
6
10
|
export default function AttributesComponentAPI(props, {
|
|
7
11
|
attributesForRoot = computed(() => ({})),
|
|
8
12
|
isColumnVisible = computed(() => false),
|
|
@@ -15,7 +19,7 @@ export default function AttributesComponentAPI(props, {
|
|
|
15
19
|
if (!searchColumnModel.value) {
|
|
16
20
|
return true;
|
|
17
21
|
}
|
|
18
|
-
const RE = new RegExp(searchColumnModel.value, "gi");
|
|
22
|
+
const RE = new RegExp(escapeRegExp(searchColumnModel.value), "gi");
|
|
19
23
|
return `${ labelTranslated.value }`.search(RE) !== -1;
|
|
20
24
|
});
|
|
21
25
|
|
|
@@ -71,7 +71,6 @@ export default {
|
|
|
71
71
|
|
|
72
72
|
const {
|
|
73
73
|
buttonActionsId,
|
|
74
|
-
buttonFirstActionId,
|
|
75
74
|
isRowActionsDropdownVisible,
|
|
76
75
|
rowActionsFiltered,
|
|
77
76
|
} = RowActionsAPI(props);
|
|
@@ -92,7 +91,6 @@ export default {
|
|
|
92
91
|
|
|
93
92
|
return {
|
|
94
93
|
buttonActionsId,
|
|
95
|
-
buttonFirstActionId,
|
|
96
94
|
columnsScrollInvisibleText,
|
|
97
95
|
countColumnsScrollInvisible,
|
|
98
96
|
isColumnsScrollInvisibleDropdownVisible,
|
|
@@ -214,7 +212,6 @@ export default {
|
|
|
214
212
|
indexFirstDropdownActionMobile: isUndefined(this.columnActionsOnePlusDropdownOptions.indexFirstDropdownActionMobile) ? 1 : this.columnActionsOnePlusDropdownOptions.indexFirstDropdownActionMobile,
|
|
215
213
|
minDropdownActions: isUndefined(this.columnActionsOnePlusDropdownOptions.minDropdownActions) ? 1 : this.columnActionsOnePlusDropdownOptions.minDropdownActions,
|
|
216
214
|
actionsClasses: this.columnActionsOnePlusDropdownOptions.actionsClasses || ["a_btn a_btn_primary a_text_truncate"],
|
|
217
|
-
actionsIds: [this.buttonFirstActionId],
|
|
218
215
|
}, this.$slots) :
|
|
219
216
|
"",
|
|
220
217
|
]) :
|
|
@@ -20,21 +20,24 @@ import {
|
|
|
20
20
|
|
|
21
21
|
export default function RowActionsAPI(props) {
|
|
22
22
|
const columnActionsView = toRef(props, "columnActionsView");
|
|
23
|
+
const isFooter = toRef(props, "isFooter");
|
|
23
24
|
const row = toRef(props, "row");
|
|
24
25
|
const rowIndex = toRef(props, "rowIndex");
|
|
25
|
-
const isFooter = toRef(props, "isFooter");
|
|
26
26
|
|
|
27
|
+
const columnActionsOnePlusDropdownOptions = inject("columnActionsOnePlusDropdownOptions");
|
|
27
28
|
const rowActions = inject("rowActions");
|
|
28
29
|
const tableId = inject("tableId");
|
|
29
30
|
|
|
30
|
-
const buttonFirstActionId = computed(() => {
|
|
31
|
-
return `${ tableId.value }_action_${ rowIndex.value }_first`;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
31
|
const buttonActionsId = computed(() => {
|
|
35
32
|
return `${ tableId.value }_action_${ rowIndex.value }`;
|
|
36
33
|
});
|
|
37
34
|
|
|
35
|
+
const indexFirstDropdownActionLocal = computed(() => {
|
|
36
|
+
return isUndefined(columnActionsOnePlusDropdownOptions.value.indexFirstDropdownAction) ?
|
|
37
|
+
1 :
|
|
38
|
+
columnActionsOnePlusDropdownOptions.value.indexFirstDropdownAction;
|
|
39
|
+
});
|
|
40
|
+
|
|
38
41
|
const getRowActionText = ({ rowAction }) => {
|
|
39
42
|
if (rowAction.text) {
|
|
40
43
|
return rowAction.text;
|
|
@@ -204,6 +207,30 @@ export default function RowActionsAPI(props) {
|
|
|
204
207
|
return undefined;
|
|
205
208
|
};
|
|
206
209
|
|
|
210
|
+
const getRowActionIds = ({ rowActionIndexVisible }) => {
|
|
211
|
+
if (columnActionsView.value === "dropdown") {
|
|
212
|
+
return {
|
|
213
|
+
id: buttonActionsId.value,
|
|
214
|
+
ids: [buttonActionsId.value, tableId.value],
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (rowActionIndexVisible < indexFirstDropdownActionLocal.value) {
|
|
219
|
+
const buttonId = `${ buttonActionsId.value }_${ rowActionIndexVisible }`;
|
|
220
|
+
|
|
221
|
+
return {
|
|
222
|
+
buttonId,
|
|
223
|
+
id: buttonId,
|
|
224
|
+
ids: [buttonId, tableId.value],
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return {
|
|
229
|
+
id: buttonActionsId.value,
|
|
230
|
+
ids: [buttonActionsId.value, tableId.value],
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
|
|
207
234
|
const replacePropertiesByRowAction = rowAction => {
|
|
208
235
|
forEach(rowAction, (_, key) => {
|
|
209
236
|
if (endsWith(key, "Callback")) {
|
|
@@ -265,17 +292,22 @@ export default function RowActionsAPI(props) {
|
|
|
265
292
|
}
|
|
266
293
|
}
|
|
267
294
|
if (isFunction(rowAction.callback)) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
295
|
+
const {
|
|
296
|
+
buttonId,
|
|
297
|
+
id,
|
|
298
|
+
ids,
|
|
299
|
+
} = getRowActionIds({
|
|
300
|
+
rowActionIndexVisible,
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
rowAction.id = buttonId;
|
|
272
304
|
|
|
273
305
|
const CALLBACK_DEFAULT = rowAction.callback;
|
|
274
306
|
rowAction.callback = () => CALLBACK_DEFAULT({
|
|
275
307
|
row: row.value,
|
|
276
308
|
rowIndex: rowIndex.value,
|
|
277
|
-
id
|
|
278
|
-
ids
|
|
309
|
+
id,
|
|
310
|
+
ids,
|
|
279
311
|
rowAction,
|
|
280
312
|
});
|
|
281
313
|
}
|
|
@@ -296,7 +328,6 @@ export default function RowActionsAPI(props) {
|
|
|
296
328
|
|
|
297
329
|
return {
|
|
298
330
|
buttonActionsId,
|
|
299
|
-
buttonFirstActionId,
|
|
300
331
|
isRowActionsDropdownVisible,
|
|
301
332
|
rowActionsFiltered,
|
|
302
333
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
escapeRegExp,
|
|
2
3
|
isNil,
|
|
3
4
|
} from "lodash-es";
|
|
4
5
|
|
|
@@ -20,6 +21,6 @@ export default function(value, { searchModel = "", searchClass = "a_search_highl
|
|
|
20
21
|
if (searchModel === "" || isNil(searchModel)) {
|
|
21
22
|
return value;
|
|
22
23
|
}
|
|
23
|
-
const RE = new RegExp(searchModel, "gi");
|
|
24
|
+
const RE = new RegExp(escapeRegExp(searchModel), "gi");
|
|
24
25
|
return value.replace(RE, val => `<span class="${ searchClass }">${ val }</span>`);
|
|
25
26
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import AKeyLabel from "../../const/AKeyLabel";
|
|
8
8
|
import AKeyId from "../../const/AKeyId";
|
|
9
9
|
import {
|
|
10
|
+
escapeRegExp,
|
|
10
11
|
forEach,
|
|
11
12
|
get,
|
|
12
13
|
isEmpty,
|
|
@@ -46,6 +47,14 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
46
47
|
return toLower(modelSearch.value || "");
|
|
47
48
|
});
|
|
48
49
|
|
|
50
|
+
const modelSearchEscapeRegExp = computed(() => {
|
|
51
|
+
return escapeRegExp(modelSearchLowerCase.value);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const modelSearchRE = computed(() => {
|
|
55
|
+
return new RegExp(modelSearchEscapeRegExp.value, "gi");
|
|
56
|
+
});
|
|
57
|
+
|
|
49
58
|
const setElementsVisibleWithSearch = () => {
|
|
50
59
|
const ELEMENTS_EXTRA_VISIBLE = {};
|
|
51
60
|
const ELEMENTS_VISIBLE = {};
|
|
@@ -56,7 +65,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
56
65
|
forEach(data.value, element => {
|
|
57
66
|
const ELEMENT_LABEL = element[AKeyLabel];
|
|
58
67
|
const ELEMENT_ID = element[AKeyId];
|
|
59
|
-
if (
|
|
68
|
+
if (`${ ELEMENT_LABEL }`.search(modelSearchRE.value) !== -1) {
|
|
60
69
|
ELEMENTS_VISIBLE[ELEMENT_ID] = true;
|
|
61
70
|
let allGroupKeys = "";
|
|
62
71
|
forEach(keyGroupArray.value, keyGroup => {
|
|
@@ -73,7 +82,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
73
82
|
forEach(data.value, element => {
|
|
74
83
|
const ELEMENT_LABEL = element[AKeyLabel];
|
|
75
84
|
const ELEMENT_ID = element[AKeyId];
|
|
76
|
-
if (
|
|
85
|
+
if (`${ ELEMENT_LABEL }`.search(modelSearchRE.value) !== -1) {
|
|
77
86
|
ELEMENTS_VISIBLE[ELEMENT_ID] = true;
|
|
78
87
|
}
|
|
79
88
|
});
|
|
@@ -81,7 +90,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
81
90
|
forEach(dataExtra.value, element => {
|
|
82
91
|
const ELEMENT_LABEL = element[AKeyLabel];
|
|
83
92
|
const ELEMENT_ID = element[AKeyId];
|
|
84
|
-
if (
|
|
93
|
+
if (`${ ELEMENT_LABEL }`.search(modelSearchRE.value) !== -1) {
|
|
85
94
|
ELEMENTS_EXTRA_VISIBLE[ELEMENT_ID] = true;
|
|
86
95
|
}
|
|
87
96
|
});
|