aloha-vue 2.74.0 → 2.75.1
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 +12 -0
- package/LICENSE +22 -21
- package/dist/aloha-vue.css +105 -105
- package/dist/aloha-vue.css.map +1 -1
- package/dist/aloha-vue.es.js +59267 -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/ADatepicker.js +6 -5
- 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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
h,
|
|
4
|
-
nextTick,
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
h,
|
|
4
|
+
nextTick,
|
|
5
5
|
reactive,
|
|
6
6
|
ref,
|
|
7
7
|
} from "vue";
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
describe,
|
|
10
10
|
expect,
|
|
11
11
|
it,
|
|
12
|
-
|
|
13
|
-
} from "
|
|
12
|
+
vi,
|
|
13
|
+
} from "vitest";
|
|
14
14
|
import {
|
|
15
15
|
mount,
|
|
16
16
|
} from "@vue/test-utils";
|
|
@@ -30,13 +30,12 @@ import TableEditAPI from "../compositionAPI/EditAPI";
|
|
|
30
30
|
import ATableForm from "../ATableForm";
|
|
31
31
|
import getFormElement from "../utils/getFormElement";
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
vi.mock("../../ui/AForm/AForm", async() => {
|
|
34
34
|
const {
|
|
35
35
|
h,
|
|
36
|
-
} =
|
|
36
|
+
} = await vi.importActual("vue");
|
|
37
37
|
|
|
38
38
|
return {
|
|
39
|
-
__esModule: true,
|
|
40
39
|
default: {
|
|
41
40
|
name: "AForm",
|
|
42
41
|
props: {
|
|
@@ -70,13 +69,12 @@ jest.mock("../../ui/AForm/AForm", () => {
|
|
|
70
69
|
};
|
|
71
70
|
});
|
|
72
71
|
|
|
73
|
-
|
|
72
|
+
vi.mock("../../ui/AFormElement/AFormElement", async() => {
|
|
74
73
|
const {
|
|
75
74
|
h,
|
|
76
|
-
} =
|
|
75
|
+
} = await vi.importActual("vue");
|
|
77
76
|
|
|
78
77
|
return {
|
|
79
|
-
__esModule: true,
|
|
80
78
|
default: {
|
|
81
79
|
name: "AFormElement",
|
|
82
80
|
render() {
|
|
@@ -86,10 +84,10 @@ jest.mock("../../ui/AFormElement/AFormElement", () => {
|
|
|
86
84
|
};
|
|
87
85
|
});
|
|
88
86
|
|
|
89
|
-
|
|
87
|
+
vi.mock("../../index", async() => {
|
|
90
88
|
const {
|
|
91
89
|
h,
|
|
92
|
-
} =
|
|
90
|
+
} = await vi.importActual("vue");
|
|
93
91
|
|
|
94
92
|
return {
|
|
95
93
|
AAlert: {
|
|
@@ -99,8 +97,8 @@ jest.mock("../../index", () => {
|
|
|
99
97
|
},
|
|
100
98
|
},
|
|
101
99
|
AConfirmAPI: () => ({
|
|
102
|
-
closeConfirm:
|
|
103
|
-
openConfirm:
|
|
100
|
+
closeConfirm: vi.fn(),
|
|
101
|
+
openConfirm: vi.fn(),
|
|
104
102
|
}),
|
|
105
103
|
AErrors: {
|
|
106
104
|
name: "AErrors",
|
|
@@ -111,13 +109,12 @@ jest.mock("../../index", () => {
|
|
|
111
109
|
};
|
|
112
110
|
});
|
|
113
111
|
|
|
114
|
-
|
|
112
|
+
vi.mock("../../AButton/AButton", async() => {
|
|
115
113
|
const {
|
|
116
114
|
h,
|
|
117
|
-
} =
|
|
115
|
+
} = await vi.importActual("vue");
|
|
118
116
|
|
|
119
117
|
return {
|
|
120
|
-
__esModule: true,
|
|
121
118
|
default: {
|
|
122
119
|
name: "AButton",
|
|
123
120
|
props: {
|
|
@@ -138,46 +135,6 @@ jest.mock("../../AButton/AButton", () => {
|
|
|
138
135
|
};
|
|
139
136
|
});
|
|
140
137
|
|
|
141
|
-
jest.mock("aloha-svg/dist/js/bootstrap/ChevronDown", () => ({
|
|
142
|
-
__esModule: true,
|
|
143
|
-
default: "<svg></svg>",
|
|
144
|
-
}));
|
|
145
|
-
jest.mock("aloha-svg/dist/js/bootstrap/ChevronUp", () => ({
|
|
146
|
-
__esModule: true,
|
|
147
|
-
default: "<svg></svg>",
|
|
148
|
-
}));
|
|
149
|
-
jest.mock("aloha-svg/dist/js/bootstrap/ExclamationCircleFill", () => ({
|
|
150
|
-
__esModule: true,
|
|
151
|
-
default: "<svg></svg>",
|
|
152
|
-
}));
|
|
153
|
-
jest.mock("aloha-svg/dist/js/bootstrap/Floppy2Fill", () => ({
|
|
154
|
-
__esModule: true,
|
|
155
|
-
default: "<svg></svg>",
|
|
156
|
-
}));
|
|
157
|
-
jest.mock("aloha-svg/dist/js/bootstrap/GripVertical", () => ({
|
|
158
|
-
__esModule: true,
|
|
159
|
-
default: "<svg></svg>",
|
|
160
|
-
}));
|
|
161
|
-
jest.mock("aloha-svg/dist/js/bootstrap/LockFill", () => ({
|
|
162
|
-
__esModule: true,
|
|
163
|
-
default: "<svg></svg>",
|
|
164
|
-
}));
|
|
165
|
-
jest.mock("aloha-svg/dist/js/bootstrap/PencilFill", () => ({
|
|
166
|
-
__esModule: true,
|
|
167
|
-
default: "<svg></svg>",
|
|
168
|
-
}));
|
|
169
|
-
jest.mock("aloha-svg/dist/js/bootstrap/Plus", () => ({
|
|
170
|
-
__esModule: true,
|
|
171
|
-
default: "<svg></svg>",
|
|
172
|
-
}));
|
|
173
|
-
jest.mock("aloha-svg/dist/js/bootstrap/Trash", () => ({
|
|
174
|
-
__esModule: true,
|
|
175
|
-
default: "<svg></svg>",
|
|
176
|
-
}));
|
|
177
|
-
jest.mock("aloha-svg/dist/js/bootstrap/XLg", () => ({
|
|
178
|
-
__esModule: true,
|
|
179
|
-
default: "<svg></svg>",
|
|
180
|
-
}));
|
|
181
138
|
|
|
182
139
|
describe("ATableForm list view", () => {
|
|
183
140
|
it("uses disabled fields for editable rows and readonly fields for non-editable rows", () => {
|
|
@@ -206,7 +163,7 @@ describe("ATableForm list view", () => {
|
|
|
206
163
|
});
|
|
207
164
|
|
|
208
165
|
it("merges row-specific form element props only in edit mode", () => {
|
|
209
|
-
const formElementEditPropsCallback =
|
|
166
|
+
const formElementEditPropsCallback = vi.fn(({ rowData }) => ({
|
|
210
167
|
disabled: rowData.locked,
|
|
211
168
|
min: rowData.minimum,
|
|
212
169
|
readonly: true,
|
|
@@ -348,9 +305,12 @@ describe("ATableForm list view", () => {
|
|
|
348
305
|
it("grows all columns equally only when no column has a positive grow value", async() => {
|
|
349
306
|
const resizeObserverOriginal = global.ResizeObserver;
|
|
350
307
|
global.ResizeObserver = class {
|
|
351
|
-
disconnect() {
|
|
352
|
-
|
|
353
|
-
|
|
308
|
+
disconnect() {
|
|
309
|
+
}
|
|
310
|
+
observe() {
|
|
311
|
+
}
|
|
312
|
+
unobserve() {
|
|
313
|
+
}
|
|
354
314
|
};
|
|
355
315
|
|
|
356
316
|
const wrapperElement = document.createElement("div");
|
|
@@ -419,7 +379,7 @@ describe("ATableForm list view", () => {
|
|
|
419
379
|
it("allows adding editable data when row editing is disabled", async() => {
|
|
420
380
|
const wrapper = mount(ATableForm, {
|
|
421
381
|
props: {
|
|
422
|
-
addRow:
|
|
382
|
+
addRow: vi.fn(),
|
|
423
383
|
columns: [
|
|
424
384
|
{
|
|
425
385
|
id: "name",
|
|
@@ -444,7 +404,7 @@ describe("ATableForm list view", () => {
|
|
|
444
404
|
expect(wrapper.findComponent(AForm).props("readonly")).toBe(false);
|
|
445
405
|
});
|
|
446
406
|
|
|
447
|
-
it("allows DND but not row-click editing when rows are not editable", async() => {
|
|
407
|
+
it("allows DND but not row-click editing when rows are not editable", async() => {
|
|
448
408
|
const wrapper = mount(ATableForm, {
|
|
449
409
|
props: {
|
|
450
410
|
columns: [
|
|
@@ -466,112 +426,112 @@ describe("ATableForm list view", () => {
|
|
|
466
426
|
|
|
467
427
|
await wrapper.find("tbody tr.a_table_form__row").trigger("click");
|
|
468
428
|
|
|
469
|
-
expect(wrapper.find("tbody button[id$='_save']").exists()).toBe(false);
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
it("renders a matching row as one full-width cell", async() => {
|
|
473
|
-
const rows = [
|
|
474
|
-
{
|
|
475
|
-
id: 1,
|
|
476
|
-
name: "Section",
|
|
477
|
-
type: "separator",
|
|
478
|
-
},
|
|
479
|
-
{
|
|
480
|
-
id: 2,
|
|
481
|
-
name: "Regular row",
|
|
482
|
-
type: "data",
|
|
483
|
-
},
|
|
484
|
-
];
|
|
485
|
-
const fullWidthRowCallback =
|
|
486
|
-
const wrapper = mount(ATableForm, {
|
|
487
|
-
props: {
|
|
488
|
-
columns: [
|
|
489
|
-
{
|
|
490
|
-
id: "id",
|
|
491
|
-
label: "ID",
|
|
492
|
-
},
|
|
493
|
-
{
|
|
494
|
-
id: "name",
|
|
495
|
-
label: "Name",
|
|
496
|
-
},
|
|
497
|
-
],
|
|
498
|
-
fullWidthRowCallback,
|
|
499
|
-
isDragAndDrop: true,
|
|
500
|
-
isEditable: true,
|
|
501
|
-
isEditOnRowClick: true,
|
|
502
|
-
keyId: "id",
|
|
503
|
-
rows,
|
|
504
|
-
},
|
|
505
|
-
slots: {
|
|
506
|
-
fullWidthRow: ({ isFooter, row, rowIndex, rows: rowsSlot }) => h("strong", {
|
|
507
|
-
class: "full-width-row-content",
|
|
508
|
-
"data-is-footer": `${ isFooter }`,
|
|
509
|
-
"data-row-index": rowIndex,
|
|
510
|
-
"data-rows-length": rowsSlot.length,
|
|
511
|
-
}, row.name),
|
|
512
|
-
},
|
|
513
|
-
});
|
|
514
|
-
|
|
515
|
-
const bodyRows = wrapper.findAll("tbody tr.a_table_form__row");
|
|
516
|
-
const fullWidthCell = bodyRows[0].find(".a_table_form__cell_full_width");
|
|
517
|
-
|
|
518
|
-
expect(bodyRows).toHaveLength(2);
|
|
519
|
-
expect(bodyRows[0].findAll("td")).toHaveLength(1);
|
|
520
|
-
expect(fullWidthCell.attributes("colspan")).toBe("4");
|
|
521
|
-
expect(fullWidthCell.text()).toBe("Section");
|
|
522
|
-
expect(fullWidthCell.find(".full-width-row-content").attributes()).toEqual(expect.objectContaining({
|
|
523
|
-
"data-is-footer": "false",
|
|
524
|
-
"data-row-index": "0",
|
|
525
|
-
"data-rows-length": "2",
|
|
526
|
-
}));
|
|
527
|
-
expect(bodyRows[0].find(".a_table_form__cell_reorder").exists()).toBe(false);
|
|
528
|
-
expect(bodyRows[0].find(".a_table_form__cell_actions").exists()).toBe(false);
|
|
529
|
-
expect(bodyRows[0].classes()).not.toContain("a_table_form__row_edit_on_click");
|
|
530
|
-
expect(bodyRows[1].findAll("td")).toHaveLength(4);
|
|
531
|
-
expect(bodyRows[1].classes()).toContain("a_table_form__row_edit_on_click");
|
|
532
|
-
expect(fullWidthRowCallback).toHaveBeenCalledWith({
|
|
533
|
-
isFooter: false,
|
|
534
|
-
row: rows[0],
|
|
535
|
-
rowIndex: 0,
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
await bodyRows[0].trigger("click");
|
|
539
|
-
|
|
540
|
-
expect(wrapper.find("tbody button[id$='_save']").exists()).toBe(false);
|
|
541
|
-
});
|
|
542
|
-
|
|
543
|
-
it("renders matching footer rows through the full-width slot", () => {
|
|
544
|
-
const footerRow = {
|
|
545
|
-
label: "Summary",
|
|
546
|
-
type: "summary",
|
|
547
|
-
};
|
|
548
|
-
const wrapper = mount(ATableForm, {
|
|
549
|
-
props: {
|
|
550
|
-
columns: [
|
|
551
|
-
{
|
|
552
|
-
id: "name",
|
|
553
|
-
label: "Name",
|
|
554
|
-
},
|
|
555
|
-
{
|
|
556
|
-
id: "value",
|
|
557
|
-
label: "Value",
|
|
558
|
-
},
|
|
559
|
-
],
|
|
560
|
-
fullWidthRowCallback: ({ row }) => row.type === "summary",
|
|
561
|
-
rows: [{ name: "Item", value: 1 }],
|
|
562
|
-
rowsFooter: [footerRow],
|
|
563
|
-
},
|
|
564
|
-
slots: {
|
|
565
|
-
fullWidthRow: ({ isFooter, row }) => h("span", `${ isFooter }:${ row.label }`),
|
|
566
|
-
},
|
|
567
|
-
});
|
|
568
|
-
|
|
569
|
-
const footerCells = wrapper.findAll("tfoot td");
|
|
570
|
-
|
|
571
|
-
expect(footerCells).toHaveLength(1);
|
|
572
|
-
expect(footerCells[0].attributes("colspan")).toBe("2");
|
|
573
|
-
expect(footerCells[0].text()).toBe("true:Summary");
|
|
574
|
-
});
|
|
429
|
+
expect(wrapper.find("tbody button[id$='_save']").exists()).toBe(false);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it("renders a matching row as one full-width cell", async() => {
|
|
433
|
+
const rows = [
|
|
434
|
+
{
|
|
435
|
+
id: 1,
|
|
436
|
+
name: "Section",
|
|
437
|
+
type: "separator",
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
id: 2,
|
|
441
|
+
name: "Regular row",
|
|
442
|
+
type: "data",
|
|
443
|
+
},
|
|
444
|
+
];
|
|
445
|
+
const fullWidthRowCallback = vi.fn(({ row }) => row.type === "separator");
|
|
446
|
+
const wrapper = mount(ATableForm, {
|
|
447
|
+
props: {
|
|
448
|
+
columns: [
|
|
449
|
+
{
|
|
450
|
+
id: "id",
|
|
451
|
+
label: "ID",
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
id: "name",
|
|
455
|
+
label: "Name",
|
|
456
|
+
},
|
|
457
|
+
],
|
|
458
|
+
fullWidthRowCallback,
|
|
459
|
+
isDragAndDrop: true,
|
|
460
|
+
isEditable: true,
|
|
461
|
+
isEditOnRowClick: true,
|
|
462
|
+
keyId: "id",
|
|
463
|
+
rows,
|
|
464
|
+
},
|
|
465
|
+
slots: {
|
|
466
|
+
fullWidthRow: ({ isFooter, row, rowIndex, rows: rowsSlot }) => h("strong", {
|
|
467
|
+
class: "full-width-row-content",
|
|
468
|
+
"data-is-footer": `${ isFooter }`,
|
|
469
|
+
"data-row-index": rowIndex,
|
|
470
|
+
"data-rows-length": rowsSlot.length,
|
|
471
|
+
}, row.name),
|
|
472
|
+
},
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
const bodyRows = wrapper.findAll("tbody tr.a_table_form__row");
|
|
476
|
+
const fullWidthCell = bodyRows[0].find(".a_table_form__cell_full_width");
|
|
477
|
+
|
|
478
|
+
expect(bodyRows).toHaveLength(2);
|
|
479
|
+
expect(bodyRows[0].findAll("td")).toHaveLength(1);
|
|
480
|
+
expect(fullWidthCell.attributes("colspan")).toBe("4");
|
|
481
|
+
expect(fullWidthCell.text()).toBe("Section");
|
|
482
|
+
expect(fullWidthCell.find(".full-width-row-content").attributes()).toEqual(expect.objectContaining({
|
|
483
|
+
"data-is-footer": "false",
|
|
484
|
+
"data-row-index": "0",
|
|
485
|
+
"data-rows-length": "2",
|
|
486
|
+
}));
|
|
487
|
+
expect(bodyRows[0].find(".a_table_form__cell_reorder").exists()).toBe(false);
|
|
488
|
+
expect(bodyRows[0].find(".a_table_form__cell_actions").exists()).toBe(false);
|
|
489
|
+
expect(bodyRows[0].classes()).not.toContain("a_table_form__row_edit_on_click");
|
|
490
|
+
expect(bodyRows[1].findAll("td")).toHaveLength(4);
|
|
491
|
+
expect(bodyRows[1].classes()).toContain("a_table_form__row_edit_on_click");
|
|
492
|
+
expect(fullWidthRowCallback).toHaveBeenCalledWith({
|
|
493
|
+
isFooter: false,
|
|
494
|
+
row: rows[0],
|
|
495
|
+
rowIndex: 0,
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
await bodyRows[0].trigger("click");
|
|
499
|
+
|
|
500
|
+
expect(wrapper.find("tbody button[id$='_save']").exists()).toBe(false);
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
it("renders matching footer rows through the full-width slot", () => {
|
|
504
|
+
const footerRow = {
|
|
505
|
+
label: "Summary",
|
|
506
|
+
type: "summary",
|
|
507
|
+
};
|
|
508
|
+
const wrapper = mount(ATableForm, {
|
|
509
|
+
props: {
|
|
510
|
+
columns: [
|
|
511
|
+
{
|
|
512
|
+
id: "name",
|
|
513
|
+
label: "Name",
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
id: "value",
|
|
517
|
+
label: "Value",
|
|
518
|
+
},
|
|
519
|
+
],
|
|
520
|
+
fullWidthRowCallback: ({ row }) => row.type === "summary",
|
|
521
|
+
rows: [{ name: "Item", value: 1 }],
|
|
522
|
+
rowsFooter: [footerRow],
|
|
523
|
+
},
|
|
524
|
+
slots: {
|
|
525
|
+
fullWidthRow: ({ isFooter, row }) => h("span", `${ isFooter }:${ row.label }`),
|
|
526
|
+
},
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
const footerCells = wrapper.findAll("tfoot td");
|
|
530
|
+
|
|
531
|
+
expect(footerCells).toHaveLength(1);
|
|
532
|
+
expect(footerCells[0].attributes("colspan")).toBe("2");
|
|
533
|
+
expect(footerCells[0].text()).toBe("true:Summary");
|
|
534
|
+
});
|
|
575
535
|
|
|
576
536
|
it("enters edit mode by row click only when enabled and row edit is available", async() => {
|
|
577
537
|
const rows = [
|
|
@@ -762,7 +722,7 @@ describe("ATableForm list view", () => {
|
|
|
762
722
|
hasRequiredEditableColumns,
|
|
763
723
|
} = TableEditAPI(props, {
|
|
764
724
|
columnsVisible,
|
|
765
|
-
getRowKey:
|
|
725
|
+
getRowKey: vi.fn(),
|
|
766
726
|
});
|
|
767
727
|
|
|
768
728
|
expect(allColumnsLength.value).toBe(3);
|
|
@@ -937,14 +897,14 @@ describe("ATableForm list view", () => {
|
|
|
937
897
|
updateModelLocal,
|
|
938
898
|
} = RowEditAPI(reactive({
|
|
939
899
|
changeModel: undefined,
|
|
940
|
-
onCancelEditRow:
|
|
900
|
+
onCancelEditRow: vi.fn(),
|
|
941
901
|
row: {
|
|
942
902
|
negative: 10,
|
|
943
903
|
positive: 10,
|
|
944
904
|
},
|
|
945
905
|
rowIndex: 0,
|
|
946
906
|
rows: [],
|
|
947
|
-
saveRow:
|
|
907
|
+
saveRow: vi.fn(),
|
|
948
908
|
}), {
|
|
949
909
|
errorsLocal,
|
|
950
910
|
});
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
toRef,
|
|
4
|
-
} from "vue";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import {
|
|
2
|
+
computed,
|
|
3
|
+
toRef,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
const Plus = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus" viewBox="0 0 16 16">
|
|
7
|
+
<path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"/>
|
|
8
|
+
</svg>`;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export default function IconsAPI(props) {
|
|
12
|
+
const icons = toRef(props, "icons");
|
|
13
|
+
|
|
14
|
+
const iconsLocal = computed(() => {
|
|
15
|
+
return {
|
|
16
|
+
actionAddRow: Plus,
|
|
17
|
+
...icons.value,
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
iconsLocal,
|
|
23
|
+
};
|
|
24
|
+
}
|