aloha-vue 2.74.0 → 2.75.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 +8 -0
- package/LICENSE +22 -21
- package/dist/aloha-vue.css +13594 -13594
- package/dist/aloha-vue.css.map +1 -1
- package/dist/aloha-vue.es.js +59266 -64918
- package/dist/aloha-vue.umd.js +338 -211
- package/package.json +27 -34
- package/scss/components/ATable.scss +2 -2
- package/scss/utils/button.scss +362 -362
- package/scss/utils/funktions.scss +162 -162
- package/src/AAccordion/AAccordionItem/AAccordionItem.js +235 -230
- package/src/ACarousel/ACarousel.js +7 -2
- package/src/ADropdown/ADropdown.js +4 -1
- package/src/AFilters/AFilterCenter/AFilterCenter.js +5 -1
- package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +7 -2
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +412 -396
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +102 -99
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +108 -108
- package/src/AFilters/AFiltersMain/AFiltersMain.js +114 -111
- package/src/AFilters/AFiltersSaveModal/compositionAPI/SaveAPI.js +65 -65
- package/src/ALinkCopy/ALinkCopy.js +98 -95
- package/src/ALinkCopy/compositionAPI/CopyAPI.js +48 -48
- package/src/AList/__tests__/AList.test.js +33 -33
- package/src/AList/compositionAPI/__tests__/TagAPI.test.js +43 -43
- package/src/AMenu/AMenu.js +4 -1
- package/src/AMenu/AMenuBreadcrumbs/AMenuBreadcrumbs.js +240 -237
- package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +4 -1
- package/src/AMenu/AMenuSearchPanelBreadcrumbs/AMenuSearchPanelBreadcrumbs.js +122 -119
- package/src/AModalWizard/AModalWizard.js +58 -53
- package/src/AModalWizard/compositionAPI/__tests__/ScrollAPI.test.js +46 -46
- package/src/APagination/APaginationPages/APaginationPages.js +15 -4
- package/src/ARate/ARate.js +254 -249
- package/src/ARate/ARateIcon/ADecimalIcon/ADecimalIcon.js +53 -50
- package/src/ARate/ARateIcon/ARateIcon.js +109 -104
- package/src/AResizer/AResizer.js +167 -162
- package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +172 -167
- package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +14 -4
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +191 -184
- package/src/ATable/ATablePreviewDown/ATablePreviewDown.js +72 -69
- package/src/ATable/ATablePreviewRight/ATablePreviewRight.js +265 -258
- package/src/ATable/ATableSortingAdditional/ATableSortingAdditional.js +224 -219
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.AttributesAPI.test.js +39 -39
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ColumnsAPI.test.js +68 -68
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.DropdownAPI.test.js +45 -45
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.FormAPI.test.js +95 -95
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +1 -1
- package/src/ATable/ATableTd/ATableTd.js +4 -1
- package/src/ATable/ATableTdAction/ATableTdAction.js +19 -12
- package/src/ATable/ATableTopPanel/ATableTopPanel.js +11 -3
- package/src/ATable/ATableTr/ATableTr.js +408 -405
- package/src/ATable/__tests__/ATable.HeaderSlot.test.js +102 -97
- package/src/ATable/__tests__/ATable.RowIdsAPI.test.js +66 -66
- package/src/ATableForm/ATableForm.js +88 -85
- package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +14 -4
- package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +196 -187
- package/src/ATableForm/ATableFormRow/compositionAPI/EditAPI.js +104 -104
- package/src/ATableForm/__tests__/ATableForm.DragAndDropAPI.test.js +200 -212
- package/src/ATableForm/__tests__/ATableForm.ListView.test.js +134 -174
- package/src/ATableForm/compositionAPI/IconsAPI.js +24 -21
- package/src/AVerticalScroll/AVerticalScroll.js +182 -177
- package/src/AWizard/AWizard.js +26 -21
- package/src/AWizard/AWizardStep/AWizardStep.js +275 -270
- package/src/AWizard/compositionAPI/__tests__/ChangeStepAPI.test.js +32 -32
- package/src/AWizard/compositionAPI/__tests__/LocalAPI.test.js +55 -55
- package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.js +646 -648
- package/src/PuxDatepicker/panel/PanelDate/PanelDate.js +300 -301
- package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.js +148 -149
- package/src/PuxDatepicker/panel/PanelTime/PanelTime.js +256 -257
- package/src/PuxDatepicker/panel/PanelYear/PanelYear.js +136 -137
- package/src/PuxDatepicker/utils/index.js +100 -100
- package/src/compositionAPI/AHttpAPI.js +593 -593
- package/src/compositionAPI/__tests__/AHttpAPI.test.js +42 -42
- package/src/filters/__tests__/filterBoolean.test.js +38 -38
- package/src/filters/__tests__/filterCapitalize.test.js +38 -38
- package/src/filters/__tests__/filterCurrency.test.js +21 -21
- package/src/filters/__tests__/filterDate.test.js +42 -42
- package/src/filters/__tests__/filterDefaultForEmpty.test.js +24 -24
- package/src/filters/__tests__/filterEmail.test.js +42 -42
- package/src/filters/__tests__/filterEscapeHtml.test.js +45 -45
- package/src/filters/__tests__/filterFileSize.test.js +45 -45
- package/src/filters/__tests__/filterFloat.test.js +74 -74
- package/src/filters/__tests__/filterJson.test.js +74 -74
- package/src/filters/__tests__/filterKeyValue.test.js +50 -50
- package/src/filters/__tests__/filterLimitTo.test.js +39 -39
- package/src/filters/__tests__/filterLink.test.js +41 -41
- package/src/filters/__tests__/filterList.test.js +149 -149
- package/src/filters/__tests__/filterLowerCase.test.js +38 -38
- package/src/filters/__tests__/filterMask.test.js +80 -80
- package/src/filters/__tests__/filterPropertyByValue.test.js +27 -27
- package/src/filters/__tests__/filterSearchHighlight.test.js +129 -129
- package/src/filters/__tests__/filterUpperCase.test.js +38 -38
- package/src/filters/__tests__/filterValueByCondition.test.js +3 -3
- package/src/filters/filterJson.js +39 -39
- package/src/filters/filterValueByCondition.js +2 -2
- package/src/plugins/AAlertPlugin.js +16 -5
- package/src/plugins/AMultiselectOrderedPlugin.js +88 -81
- package/src/plugins/ASelectPlugin.js +12 -10
- package/src/ui/ACheckbox/ACheckbox.js +82 -79
- package/src/ui/ADatepicker/compositionAPI/EventsAPI.js +297 -297
- package/src/ui/ADatepicker/utils/index.js +76 -76
- package/src/ui/ADatepickerAlt/ADatepicker.js +912 -912
- package/src/ui/ADatepickerAlt/utils/index.js +98 -98
- package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +113 -114
- package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +4 -1
- package/src/ui/AInputCurrency/AInputCurrency.js +20 -15
- package/src/ui/AInputCurrency/__tests__/AInputCurrency.ModelAPI.test.js +73 -73
- package/src/ui/AInputNumber/AInputNumber.js +17 -12
- package/src/ui/AJson/AJson.js +12 -3
- package/src/ui/AJson/compositionAPI/JsonAPI.js +116 -116
- package/src/ui/ALabel/__tests__/ALabel.IdAPI.test.js +42 -42
- package/src/ui/ALabel/__tests__/ALabel.LabelAPI.test.js +33 -33
- package/src/ui/ARadio/ARadio.js +80 -77
- package/src/ui/ASelect/ASelect.js +390 -383
- package/src/ui/ASelect/ASelectElement/ASelectElement.js +179 -176
- package/src/ui/ASelect/ASelectValueCloseable/ASelectValueCloseable.js +143 -141
- package/src/ui/ASelect/__tests__/SelectedFirstAPI.test.js +101 -101
- package/src/ui/ASelect/__tests__/SelectedVisibleAPI.test.js +98 -98
- package/src/ui/ASlider/compositionAPI/SliderAPI.js +23 -23
- package/src/ui/AValidatedJson/AValidatedJson.js +4 -1
- package/src/ui/AValidatedJson/AValidatedJsonItem/AValidatedJsonItem.js +308 -298
- package/src/ui/compositionApi/UiCollapseAPI.js +68 -63
- package/src/ui/compositionApi/UiInputAutofillAPI.js +41 -41
- package/src/ui/compositionApi/__tests__/UIDataGroupAPI.test.js +106 -106
- package/src/ui/compositionApi/__tests__/UIExcludeRenderAttributesAPI.test.js +39 -39
- package/src/ui/compositionApi/__tests__/UiDataWithKeyIdAndLabelAPI.test.js +128 -128
- package/src/ui/compositionApi/__tests__/UiSearchAPI.test.js +71 -71
- package/src/utils/EventBus.js +51 -8
- package/src/utils/__tests__/EventBus.test.js +138 -0
- package/src/utils/__tests__/utils.aOrderBy.test.js +1 -1
- package/src/utils/__tests__/utils.aSortBy.test.js +1 -1
- package/src/utils/__tests__/utils.getTotalNestedCount.test.js +56 -56
- package/src/utils/__tests__/utils.isArrayOfArrays.test.js +44 -44
- package/src/utils/__tests__/utils.isArrayOfStrings.test.js +36 -36
- package/src/utils/__tests__/utilsArray.aFirst.test.js +1 -1
- package/src/utils/__tests__/utilsArray.aLast.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArguments.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArray.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isBoolean.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isBuffer.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isDate.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isElement.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isError.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isFinite.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isFunction.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isInteger.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isMap.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNaN.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNil.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNull.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNumber.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isObject.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isObjectLike.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isPlainObject.test.js +3 -2
- package/src/utils/__tests__/utilsLang.isPromise.test.js +5 -2
- package/src/utils/__tests__/utilsLang.isRegExp.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isSet.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isString.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isSymbol.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isUndefined.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isWeakMap.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isWeakSet.test.js +1 -1
- package/src/utils/__tests__/utilsMath.isEven.test.js +43 -43
- package/src/utils/__tests__/utilsMath.isOdd.test.js +43 -43
- package/src/utils/__tests__/utilsUi.isModelForFilterNotEmpty.test.js +65 -65
- package/src/utils/autosize.js +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterPropertyByValue from "../filterPropertyByValue";
|
|
8
|
-
|
|
9
|
-
describe("Filter property by value", () => {
|
|
10
|
-
it("Returns the mapped value if it exists", () => {
|
|
11
|
-
const mapping = { 20: "twenty" };
|
|
12
|
-
|
|
13
|
-
expect(filterPropertyByValue("20", { mapping })).toEqual("twenty");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("Returns the defaultValue if the value does not exist in the mapping", () => {
|
|
17
|
-
const mapping = { 30: "thirty" };
|
|
18
|
-
|
|
19
|
-
expect(filterPropertyByValue("20", { mapping, defaultValue: "default" })).toEqual("default");
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("Returns an empty string if the value does not exist in the mapping and no defaultValue is set", () => {
|
|
23
|
-
const mapping = { 30: "thirty" };
|
|
24
|
-
|
|
25
|
-
expect(filterPropertyByValue("20", { mapping })).toEqual("");
|
|
26
|
-
});
|
|
27
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterPropertyByValue from "../filterPropertyByValue";
|
|
8
|
+
|
|
9
|
+
describe("Filter property by value", () => {
|
|
10
|
+
it("Returns the mapped value if it exists", () => {
|
|
11
|
+
const mapping = { 20: "twenty" };
|
|
12
|
+
|
|
13
|
+
expect(filterPropertyByValue("20", { mapping })).toEqual("twenty");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("Returns the defaultValue if the value does not exist in the mapping", () => {
|
|
17
|
+
const mapping = { 30: "thirty" };
|
|
18
|
+
|
|
19
|
+
expect(filterPropertyByValue("20", { mapping, defaultValue: "default" })).toEqual("default");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("Returns an empty string if the value does not exist in the mapping and no defaultValue is set", () => {
|
|
23
|
+
const mapping = { 30: "thirty" };
|
|
24
|
+
|
|
25
|
+
expect(filterPropertyByValue("20", { mapping })).toEqual("");
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterSearchHighlight from "../filterSearchHighlight";
|
|
8
|
-
|
|
9
|
-
describe("filterSearchHighlight function", () => {
|
|
10
|
-
// test focuses on a single use case
|
|
11
|
-
it("should return empty string when the value provided is non truthy", () => {
|
|
12
|
-
const result = filterSearchHighlight(null, {
|
|
13
|
-
searchModel: "",
|
|
14
|
-
searchClass: "a_search_highlight",
|
|
15
|
-
});
|
|
16
|
-
expect(result).toBe("");
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("should return original value when searchModel is empty, undefined or null", () => {
|
|
20
|
-
let result = filterSearchHighlight("test value", {
|
|
21
|
-
searchModel: "",
|
|
22
|
-
searchClass: "a_search_highlight",
|
|
23
|
-
});
|
|
24
|
-
expect(result).toBe("test value");
|
|
25
|
-
|
|
26
|
-
result = filterSearchHighlight("test value", {
|
|
27
|
-
searchModel: undefined,
|
|
28
|
-
searchClass: "a_search_highlight",
|
|
29
|
-
});
|
|
30
|
-
expect(result).toBe("test value");
|
|
31
|
-
|
|
32
|
-
result = filterSearchHighlight("test value", {
|
|
33
|
-
searchModel: null,
|
|
34
|
-
searchClass: "a_search_highlight",
|
|
35
|
-
});
|
|
36
|
-
expect(result).toBe("test value");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("should return value with replaced searchModel content wrapped in mark with searchClass, when searchModel is provided", () => {
|
|
40
|
-
let result = filterSearchHighlight("test searchModel", {
|
|
41
|
-
searchModel: "searchModel",
|
|
42
|
-
searchClass: "test",
|
|
43
|
-
});
|
|
44
|
-
expect(result).toBe("test <mark class=\"test\">searchModel</mark>");
|
|
45
|
-
|
|
46
|
-
result = filterSearchHighlight("test searchModel", {
|
|
47
|
-
searchModel: "searchModel",
|
|
48
|
-
});
|
|
49
|
-
expect(result).toBe("test <mark class=\"a_search_highlight\">searchModel</mark>");
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// Test for `tag` argument
|
|
53
|
-
it("should wrap matched text in the specified HTML tag", () => {
|
|
54
|
-
const result = filterSearchHighlight("Aloha Vue", {
|
|
55
|
-
searchModel: "Vue",
|
|
56
|
-
tag: "strong",
|
|
57
|
-
});
|
|
58
|
-
expect(result).toBe("Aloha <strong class=\"a_search_highlight\">Vue</strong>");
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it("should use the default mark tag if tag is not provided", () => {
|
|
62
|
-
const result = filterSearchHighlight("Aloha Vue", {
|
|
63
|
-
searchModel: "Vue",
|
|
64
|
-
});
|
|
65
|
-
expect(result).toBe("Aloha <mark class=\"a_search_highlight\">Vue</mark>");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Test for `attributes` argument
|
|
69
|
-
it("should add extra attributes to the tag", () => {
|
|
70
|
-
const result = filterSearchHighlight("Aloha Vue", {
|
|
71
|
-
searchModel: "Vue",
|
|
72
|
-
attributes: ["data-aloha=\"search\"", "title=\"Highlight\""],
|
|
73
|
-
});
|
|
74
|
-
expect(result).toBe("Aloha <mark class=\"a_search_highlight\" data-aloha=\"search\" title=\"Highlight\">Vue</mark>");
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Test for `caseSensitive` argument
|
|
78
|
-
it("should replace text case-sensitively when caseSensitive is true", () => {
|
|
79
|
-
const result = filterSearchHighlight("Aloha Vue vue", {
|
|
80
|
-
searchModel: "Vue",
|
|
81
|
-
caseSensitive: true,
|
|
82
|
-
});
|
|
83
|
-
expect(result).toBe("Aloha <mark class=\"a_search_highlight\">Vue</mark> vue");
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("should replace text case-insensitively by default", () => {
|
|
87
|
-
const result = filterSearchHighlight("Aloha Vue vue", {
|
|
88
|
-
searchModel: "Vue",
|
|
89
|
-
});
|
|
90
|
-
expect(result).toBe("Aloha <mark class=\"a_search_highlight\">Vue</mark> <mark class=\"a_search_highlight\">vue</mark>");
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe("filterSearchHighlight with isHtml=true", () => {
|
|
95
|
-
it("should highlight 'Vue' inside strong tag and ignore href attribute", () => {
|
|
96
|
-
const input = "Aloha <strong>Vue</strong> is a <a href=\"https://vue.com\">framework</a>";
|
|
97
|
-
const result = filterSearchHighlight(input, { searchModel: "vue", isHtml: true });
|
|
98
|
-
|
|
99
|
-
expect(result).toBe("Aloha <strong><mark class=\"a_search_highlight\">Vue</mark></strong> is a <a href=\"https://vue.com\">framework</a>");
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("should highlight multiple occurrences of 'Vue' across different tags", () => {
|
|
103
|
-
const input = "<div><p>Vue is amazing.</p><span>Vue framework</span></div>";
|
|
104
|
-
const result = filterSearchHighlight(input, { searchModel: "Vue", isHtml: true });
|
|
105
|
-
|
|
106
|
-
expect(result).toBe("<div><p><mark class=\"a_search_highlight\">Vue</mark> is amazing.</p><span><mark class=\"a_search_highlight\">Vue</mark> framework</span></div>");
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("should not break HTML structure when highlighting text", () => {
|
|
110
|
-
const input = "<div><h1>Vue.js</h1><p>This is a Vue framework.</p></div>";
|
|
111
|
-
const result = filterSearchHighlight(input, { searchModel: "Vue", isHtml: true });
|
|
112
|
-
|
|
113
|
-
expect(result).toBe("<div><h1><mark class=\"a_search_highlight\">Vue</mark>.js</h1><p>This is a <mark class=\"a_search_highlight\">Vue</mark> framework.</p></div>");
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it("should NOT highlight 'Vue.js' if it is split across multiple tags", () => {
|
|
117
|
-
const input = "<p>Welcome to <strong>Vue</strong><span>.js</span> world.</p>";
|
|
118
|
-
const result = filterSearchHighlight(input, { searchModel: "Vue.js", isHtml: true });
|
|
119
|
-
|
|
120
|
-
expect(result).toBe("<p>Welcome to <strong>Vue</strong><span>.js</span> world.</p>");
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
it("should NOT highlight text inside HTML attributes", () => {
|
|
124
|
-
const input = "<a href=\"https://vue.com\" title=\"Vue framework\">Click here</a>";
|
|
125
|
-
const result = filterSearchHighlight(input, { searchModel: "Vue", isHtml: true });
|
|
126
|
-
|
|
127
|
-
expect(result).toBe("<a href=\"https://vue.com\" title=\"Vue framework\">Click here</a>");
|
|
128
|
-
});
|
|
129
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterSearchHighlight from "../filterSearchHighlight";
|
|
8
|
+
|
|
9
|
+
describe("filterSearchHighlight function", () => {
|
|
10
|
+
// test focuses on a single use case
|
|
11
|
+
it("should return empty string when the value provided is non truthy", () => {
|
|
12
|
+
const result = filterSearchHighlight(null, {
|
|
13
|
+
searchModel: "",
|
|
14
|
+
searchClass: "a_search_highlight",
|
|
15
|
+
});
|
|
16
|
+
expect(result).toBe("");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should return original value when searchModel is empty, undefined or null", () => {
|
|
20
|
+
let result = filterSearchHighlight("test value", {
|
|
21
|
+
searchModel: "",
|
|
22
|
+
searchClass: "a_search_highlight",
|
|
23
|
+
});
|
|
24
|
+
expect(result).toBe("test value");
|
|
25
|
+
|
|
26
|
+
result = filterSearchHighlight("test value", {
|
|
27
|
+
searchModel: undefined,
|
|
28
|
+
searchClass: "a_search_highlight",
|
|
29
|
+
});
|
|
30
|
+
expect(result).toBe("test value");
|
|
31
|
+
|
|
32
|
+
result = filterSearchHighlight("test value", {
|
|
33
|
+
searchModel: null,
|
|
34
|
+
searchClass: "a_search_highlight",
|
|
35
|
+
});
|
|
36
|
+
expect(result).toBe("test value");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("should return value with replaced searchModel content wrapped in mark with searchClass, when searchModel is provided", () => {
|
|
40
|
+
let result = filterSearchHighlight("test searchModel", {
|
|
41
|
+
searchModel: "searchModel",
|
|
42
|
+
searchClass: "test",
|
|
43
|
+
});
|
|
44
|
+
expect(result).toBe("test <mark class=\"test\">searchModel</mark>");
|
|
45
|
+
|
|
46
|
+
result = filterSearchHighlight("test searchModel", {
|
|
47
|
+
searchModel: "searchModel",
|
|
48
|
+
});
|
|
49
|
+
expect(result).toBe("test <mark class=\"a_search_highlight\">searchModel</mark>");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Test for `tag` argument
|
|
53
|
+
it("should wrap matched text in the specified HTML tag", () => {
|
|
54
|
+
const result = filterSearchHighlight("Aloha Vue", {
|
|
55
|
+
searchModel: "Vue",
|
|
56
|
+
tag: "strong",
|
|
57
|
+
});
|
|
58
|
+
expect(result).toBe("Aloha <strong class=\"a_search_highlight\">Vue</strong>");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("should use the default mark tag if tag is not provided", () => {
|
|
62
|
+
const result = filterSearchHighlight("Aloha Vue", {
|
|
63
|
+
searchModel: "Vue",
|
|
64
|
+
});
|
|
65
|
+
expect(result).toBe("Aloha <mark class=\"a_search_highlight\">Vue</mark>");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Test for `attributes` argument
|
|
69
|
+
it("should add extra attributes to the tag", () => {
|
|
70
|
+
const result = filterSearchHighlight("Aloha Vue", {
|
|
71
|
+
searchModel: "Vue",
|
|
72
|
+
attributes: ["data-aloha=\"search\"", "title=\"Highlight\""],
|
|
73
|
+
});
|
|
74
|
+
expect(result).toBe("Aloha <mark class=\"a_search_highlight\" data-aloha=\"search\" title=\"Highlight\">Vue</mark>");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Test for `caseSensitive` argument
|
|
78
|
+
it("should replace text case-sensitively when caseSensitive is true", () => {
|
|
79
|
+
const result = filterSearchHighlight("Aloha Vue vue", {
|
|
80
|
+
searchModel: "Vue",
|
|
81
|
+
caseSensitive: true,
|
|
82
|
+
});
|
|
83
|
+
expect(result).toBe("Aloha <mark class=\"a_search_highlight\">Vue</mark> vue");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("should replace text case-insensitively by default", () => {
|
|
87
|
+
const result = filterSearchHighlight("Aloha Vue vue", {
|
|
88
|
+
searchModel: "Vue",
|
|
89
|
+
});
|
|
90
|
+
expect(result).toBe("Aloha <mark class=\"a_search_highlight\">Vue</mark> <mark class=\"a_search_highlight\">vue</mark>");
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe("filterSearchHighlight with isHtml=true", () => {
|
|
95
|
+
it("should highlight 'Vue' inside strong tag and ignore href attribute", () => {
|
|
96
|
+
const input = "Aloha <strong>Vue</strong> is a <a href=\"https://vue.com\">framework</a>";
|
|
97
|
+
const result = filterSearchHighlight(input, { searchModel: "vue", isHtml: true });
|
|
98
|
+
|
|
99
|
+
expect(result).toBe("Aloha <strong><mark class=\"a_search_highlight\">Vue</mark></strong> is a <a href=\"https://vue.com\">framework</a>");
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("should highlight multiple occurrences of 'Vue' across different tags", () => {
|
|
103
|
+
const input = "<div><p>Vue is amazing.</p><span>Vue framework</span></div>";
|
|
104
|
+
const result = filterSearchHighlight(input, { searchModel: "Vue", isHtml: true });
|
|
105
|
+
|
|
106
|
+
expect(result).toBe("<div><p><mark class=\"a_search_highlight\">Vue</mark> is amazing.</p><span><mark class=\"a_search_highlight\">Vue</mark> framework</span></div>");
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("should not break HTML structure when highlighting text", () => {
|
|
110
|
+
const input = "<div><h1>Vue.js</h1><p>This is a Vue framework.</p></div>";
|
|
111
|
+
const result = filterSearchHighlight(input, { searchModel: "Vue", isHtml: true });
|
|
112
|
+
|
|
113
|
+
expect(result).toBe("<div><h1><mark class=\"a_search_highlight\">Vue</mark>.js</h1><p>This is a <mark class=\"a_search_highlight\">Vue</mark> framework.</p></div>");
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it("should NOT highlight 'Vue.js' if it is split across multiple tags", () => {
|
|
117
|
+
const input = "<p>Welcome to <strong>Vue</strong><span>.js</span> world.</p>";
|
|
118
|
+
const result = filterSearchHighlight(input, { searchModel: "Vue.js", isHtml: true });
|
|
119
|
+
|
|
120
|
+
expect(result).toBe("<p>Welcome to <strong>Vue</strong><span>.js</span> world.</p>");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("should NOT highlight text inside HTML attributes", () => {
|
|
124
|
+
const input = "<a href=\"https://vue.com\" title=\"Vue framework\">Click here</a>";
|
|
125
|
+
const result = filterSearchHighlight(input, { searchModel: "Vue", isHtml: true });
|
|
126
|
+
|
|
127
|
+
expect(result).toBe("<a href=\"https://vue.com\" title=\"Vue framework\">Click here</a>");
|
|
128
|
+
});
|
|
129
|
+
});
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterUpperCase from "../filterUpperCase";
|
|
8
|
-
|
|
9
|
-
describe("filterUpperCase", () => {
|
|
10
|
-
it("should convert a string to lowercase", () => {
|
|
11
|
-
expect(filterUpperCase("--Foo-Bar--")).toBe("--FOO-BAR--");
|
|
12
|
-
expect(filterUpperCase("fooBar")).toBe("FOOBAR");
|
|
13
|
-
expect(filterUpperCase("__FOO_BAR__")).toBe("__FOO_BAR__");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should handle empty strings", () => {
|
|
17
|
-
expect(filterUpperCase("")).toBe("");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("should handle strings with no alphabetic characters", () => {
|
|
21
|
-
expect(filterUpperCase("12345")).toBe("12345");
|
|
22
|
-
expect(filterUpperCase("!@#$%")).toBe("!@#$%");
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("should handle mixed case strings", () => {
|
|
26
|
-
expect(filterUpperCase("FoObAr")).toBe("FOOBAR");
|
|
27
|
-
expect(filterUpperCase("HELLOworld")).toBe("HELLOWORLD");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("should handle strings with spaces", () => {
|
|
31
|
-
expect(filterUpperCase("Hello World")).toBe("HELLO WORLD");
|
|
32
|
-
expect(filterUpperCase(" foo bar ")).toBe(" FOO BAR ");
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should return the same string if already in uppercase", () => {
|
|
36
|
-
expect(filterUpperCase("ALREADY UPPERCASE")).toBe("ALREADY UPPERCASE");
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterUpperCase from "../filterUpperCase";
|
|
8
|
+
|
|
9
|
+
describe("filterUpperCase", () => {
|
|
10
|
+
it("should convert a string to lowercase", () => {
|
|
11
|
+
expect(filterUpperCase("--Foo-Bar--")).toBe("--FOO-BAR--");
|
|
12
|
+
expect(filterUpperCase("fooBar")).toBe("FOOBAR");
|
|
13
|
+
expect(filterUpperCase("__FOO_BAR__")).toBe("__FOO_BAR__");
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should handle empty strings", () => {
|
|
17
|
+
expect(filterUpperCase("")).toBe("");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should handle strings with no alphabetic characters", () => {
|
|
21
|
+
expect(filterUpperCase("12345")).toBe("12345");
|
|
22
|
+
expect(filterUpperCase("!@#$%")).toBe("!@#$%");
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should handle mixed case strings", () => {
|
|
26
|
+
expect(filterUpperCase("FoObAr")).toBe("FOOBAR");
|
|
27
|
+
expect(filterUpperCase("HELLOworld")).toBe("HELLOWORLD");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should handle strings with spaces", () => {
|
|
31
|
+
expect(filterUpperCase("Hello World")).toBe("HELLO WORLD");
|
|
32
|
+
expect(filterUpperCase(" foo bar ")).toBe(" FOO BAR ");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should return the same string if already in uppercase", () => {
|
|
36
|
+
expect(filterUpperCase("ALREADY UPPERCASE")).toBe("ALREADY UPPERCASE");
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
describe,
|
|
3
3
|
expect,
|
|
4
4
|
it,
|
|
5
|
-
} from "
|
|
5
|
+
} from "vitest";
|
|
6
6
|
|
|
7
7
|
import filterValueByCondition from "../filterValueByCondition";
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ describe("Filter value by condition", () => {
|
|
|
26
26
|
const conditions = [
|
|
27
27
|
{
|
|
28
28
|
if: "value > 3",
|
|
29
|
-
thenTemplate:
|
|
29
|
+
thenTemplate: `(\${ value * 3 } Aloha)`,
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
if: "value < 2",
|
|
@@ -62,7 +62,7 @@ describe("Filter value by condition", () => {
|
|
|
62
62
|
|
|
63
63
|
expect(filterValueByCondition(2, {
|
|
64
64
|
conditions,
|
|
65
|
-
defaultTemplate:
|
|
65
|
+
defaultTemplate: `\${ value / 2 }`,
|
|
66
66
|
})).toBe("1");
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isNil,
|
|
3
|
-
} from "lodash-es";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Converts a JavaScript value to a formatted JSON string.
|
|
7
|
-
*
|
|
8
|
-
* @param {*} value - The value to be converted to JSON.
|
|
9
|
-
* @param {Object} [options] - Optional parameters.
|
|
10
|
-
* @param {Function} [options.replacer] - A function that alters the behavior of the stringification process.
|
|
11
|
-
* @param {number} [options.space=2] - The number of spaces used for indentation in the resulting string.
|
|
12
|
-
* @param {boolean} [options.isHtml=false] - Determines if the output should be formatted as HTML.
|
|
13
|
-
* When set to false, the output is returned as a plain text string.
|
|
14
|
-
* @param {string} [options.jsonClass="a_code_content"] - The CSS class to be applied when `isHtml` is true.
|
|
15
|
-
* @param {string} [options.tag="pre"] - The HTML tag to wrap the formatted JSON string when `isHtml` is true.
|
|
16
|
-
*
|
|
17
|
-
* @returns {string} The JSON string representation of the value.
|
|
18
|
-
* Returns an empty string if the value is `undefined` or `null`,
|
|
19
|
-
* or if an error occurred during the stringification process.
|
|
20
|
-
*/
|
|
21
|
-
export default function(value, { replacer, space = 2, isHtml = false, jsonClass = "a_code_content", tag = "pre" } = {}) {
|
|
22
|
-
if (isNil(value)) {
|
|
23
|
-
return "";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const RESULT_STRING = JSON.stringify(value, replacer, space);
|
|
28
|
-
if (isHtml) {
|
|
29
|
-
const CLASS = jsonClass ?
|
|
30
|
-
` class="${ jsonClass }"` :
|
|
31
|
-
"";
|
|
32
|
-
return `<${ tag }${ CLASS }>${ RESULT_STRING }</${ tag }>`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return RESULT_STRING;
|
|
36
|
-
} catch
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
isNil,
|
|
3
|
+
} from "lodash-es";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Converts a JavaScript value to a formatted JSON string.
|
|
7
|
+
*
|
|
8
|
+
* @param {*} value - The value to be converted to JSON.
|
|
9
|
+
* @param {Object} [options] - Optional parameters.
|
|
10
|
+
* @param {Function} [options.replacer] - A function that alters the behavior of the stringification process.
|
|
11
|
+
* @param {number} [options.space=2] - The number of spaces used for indentation in the resulting string.
|
|
12
|
+
* @param {boolean} [options.isHtml=false] - Determines if the output should be formatted as HTML.
|
|
13
|
+
* When set to false, the output is returned as a plain text string.
|
|
14
|
+
* @param {string} [options.jsonClass="a_code_content"] - The CSS class to be applied when `isHtml` is true.
|
|
15
|
+
* @param {string} [options.tag="pre"] - The HTML tag to wrap the formatted JSON string when `isHtml` is true.
|
|
16
|
+
*
|
|
17
|
+
* @returns {string} The JSON string representation of the value.
|
|
18
|
+
* Returns an empty string if the value is `undefined` or `null`,
|
|
19
|
+
* or if an error occurred during the stringification process.
|
|
20
|
+
*/
|
|
21
|
+
export default function(value, { replacer, space = 2, isHtml = false, jsonClass = "a_code_content", tag = "pre" } = {}) {
|
|
22
|
+
if (isNil(value)) {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const RESULT_STRING = JSON.stringify(value, replacer, space);
|
|
28
|
+
if (isHtml) {
|
|
29
|
+
const CLASS = jsonClass ?
|
|
30
|
+
` class="${ jsonClass }"` :
|
|
31
|
+
"";
|
|
32
|
+
return `<${ tag }${ CLASS }>${ RESULT_STRING }</${ tag }>`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return RESULT_STRING;
|
|
36
|
+
} catch(e) {
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -2,7 +2,7 @@ const executeExpression = ({ expression, value }) => {
|
|
|
2
2
|
try {
|
|
3
3
|
// eslint-disable-next-line no-new-func
|
|
4
4
|
return Function("value", `"use strict"; return (${ expression });`)(value);
|
|
5
|
-
} catch
|
|
5
|
+
} catch(e) {
|
|
6
6
|
return undefined;
|
|
7
7
|
}
|
|
8
8
|
};
|
|
@@ -11,7 +11,7 @@ const executeTemplate = ({ template, value }) => {
|
|
|
11
11
|
try {
|
|
12
12
|
// eslint-disable-next-line no-new-func
|
|
13
13
|
return Function("value", `"use strict"; return \`${ template }\`;`)(value);
|
|
14
|
-
} catch
|
|
14
|
+
} catch(e) {
|
|
15
15
|
return "";
|
|
16
16
|
}
|
|
17
17
|
};
|
|
@@ -2,11 +2,22 @@ import {
|
|
|
2
2
|
ref,
|
|
3
3
|
} from "vue";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
const CheckCircleFill = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-circle-fill" viewBox="0 0 16 16">
|
|
6
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
|
|
7
|
+
</svg>`;
|
|
8
|
+
const ExclamationCircleFill = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-circle-fill" viewBox="0 0 16 16">
|
|
9
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M8 4a.905.905 0 0 0-.9.995l.35 3.507a.552.552 0 0 0 1.1 0l.35-3.507A.905.905 0 0 0 8 4m.002 6a1 1 0 1 0 0 2 1 1 0 0 0 0-2"/>
|
|
10
|
+
</svg>`;
|
|
11
|
+
const InfoCircleFill = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-info-circle-fill" viewBox="0 0 16 16">
|
|
12
|
+
<path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2"/>
|
|
13
|
+
</svg>`;
|
|
14
|
+
const XCircleFill = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle-fill" viewBox="0 0 16 16">
|
|
15
|
+
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0M5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293z"/>
|
|
16
|
+
</svg>`;
|
|
17
|
+
const XLg = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
|
|
18
|
+
<path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"/>
|
|
19
|
+
</svg>`;
|
|
20
|
+
|
|
10
21
|
|
|
11
22
|
export const alertPluginOptions = ref({
|
|
12
23
|
propsDefault: {
|