aloha-vue 1.0.9 → 1.0.12
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/docs/package.json +2 -2
- package/docs/src/components/TheMenu/TheMenu.js +5 -0
- package/docs/src/router/index.js +5 -0
- package/docs/src/views/PageAlert/PageAlert.js +27 -0
- package/docs/src/views/PageAlert/PageAlert.pug +10 -0
- package/docs/src/views/PageAlert/PageAlert.vue +2 -0
- package/docs/src/views/PageTable/PageTable.js +2 -0
- package/package.json +2 -2
- package/src/AAlert/AAlert.js +62 -0
- package/src/AGet/AGet.js +139 -0
- package/src/ATable/ATable.js +21 -3
- package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +7 -1
package/docs/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"build-css": "node-sass --include-path scss styles/styles.scss public/styles.css"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"aloha-css": "1.0.
|
|
14
|
+
"aloha-css": "1.0.10",
|
|
15
15
|
"lodash-es": "^4.17.21",
|
|
16
16
|
"vue": "3.2.31",
|
|
17
17
|
"vue-router": "4.0.14",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"sass-loader": "12.6.0",
|
|
42
42
|
"source-map-loader": "3.0.1",
|
|
43
43
|
"style-loader": "3.3.1",
|
|
44
|
-
"vue-loader": "17.0.0",
|
|
45
44
|
"vue-eslint-parser": "8.3.0",
|
|
45
|
+
"vue-loader": "17.0.0",
|
|
46
46
|
"vue-pug-loader": "1.1.26",
|
|
47
47
|
"webpack": "5.73.0",
|
|
48
48
|
"webpack-cli": "4.10.0",
|
package/docs/src/router/index.js
CHANGED
|
@@ -54,6 +54,11 @@ const ROUTES = [
|
|
|
54
54
|
name: "PageAccordion",
|
|
55
55
|
component: () => import(/* webpackChunkName: "PageAccordionBootstrap" */ "../views/PageAccordion/PageAccordion.vue"),
|
|
56
56
|
},
|
|
57
|
+
{
|
|
58
|
+
path: "/alert",
|
|
59
|
+
name: "PageAlert",
|
|
60
|
+
component: () => import(/* webpackChunkName: "PageAlert" */ "../views/PageAlert/PageAlert.vue"),
|
|
61
|
+
},
|
|
57
62
|
{
|
|
58
63
|
// If the routing configuration '*' reports an error, replace it with '/: catchAll(. *)'
|
|
59
64
|
// caught Error: Catch all routes ("*") must now be defined using a param with a custom regexp
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import AAlert from "../../../../src/AAlert/AAlert";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: "PageAlert",
|
|
5
|
+
components: {
|
|
6
|
+
AAlert,
|
|
7
|
+
},
|
|
8
|
+
data() {
|
|
9
|
+
return {
|
|
10
|
+
alerts: [
|
|
11
|
+
"primary",
|
|
12
|
+
"secondary",
|
|
13
|
+
"success",
|
|
14
|
+
"danger",
|
|
15
|
+
"warning",
|
|
16
|
+
"info",
|
|
17
|
+
"dark",
|
|
18
|
+
],
|
|
19
|
+
isAlertsHidden: {},
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
closeAlert(alert) {
|
|
24
|
+
this.isAlertsHidden[alert] = true;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aloha-vue",
|
|
3
3
|
"description": "Project aloha",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.12",
|
|
5
5
|
"author": "Ilia Brykin",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@popperjs/core": "2.11.5",
|
|
8
|
-
"aloha-css": "1.0.
|
|
8
|
+
"aloha-css": "1.0.10",
|
|
9
9
|
"lodash-es": "^4.17.21",
|
|
10
10
|
"vue": "3.2.37"
|
|
11
11
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
h,
|
|
3
|
+
} from "vue";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
name: "AAlert",
|
|
7
|
+
props: {
|
|
8
|
+
isVisible: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
required: false,
|
|
11
|
+
},
|
|
12
|
+
type: {
|
|
13
|
+
type: String,
|
|
14
|
+
required: false,
|
|
15
|
+
default: "danger",
|
|
16
|
+
},
|
|
17
|
+
isDismissible: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
required: false,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
alertClass: {
|
|
23
|
+
type: [String, Object],
|
|
24
|
+
required: false,
|
|
25
|
+
default: undefined,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
emits: [
|
|
29
|
+
"onDismiss",
|
|
30
|
+
],
|
|
31
|
+
computed: {
|
|
32
|
+
alertClassLocal() {
|
|
33
|
+
let alertClass = `a_alert a_alert_${ this.type }`;
|
|
34
|
+
if (this.isDismissible) {
|
|
35
|
+
alertClass += " a_alert_dismissible";
|
|
36
|
+
}
|
|
37
|
+
return alertClass;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
onDismissLocal() {
|
|
42
|
+
this.$emit("onDismiss");
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
render() {
|
|
46
|
+
return h("div", {
|
|
47
|
+
role: "alert",
|
|
48
|
+
}, [
|
|
49
|
+
this.isVisible && h("div", {
|
|
50
|
+
class: [this.alertClass, this.alertClassLocal],
|
|
51
|
+
}, [
|
|
52
|
+
this.$slots.default && this.$slots.default(),
|
|
53
|
+
this.isDismissible && h("button", {
|
|
54
|
+
type: "button",
|
|
55
|
+
class: "a_btn_close",
|
|
56
|
+
ariaLabel: "Close",
|
|
57
|
+
onClick: this.onDismissLocal,
|
|
58
|
+
})
|
|
59
|
+
]),
|
|
60
|
+
]);
|
|
61
|
+
},
|
|
62
|
+
};
|
package/src/AGet/AGet.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
capitalize,
|
|
3
|
+
h,
|
|
4
|
+
} from "vue";
|
|
5
|
+
|
|
6
|
+
import FiltersAPI from "../compositionAPI/FiltersAPI";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
forEach,
|
|
10
|
+
get,
|
|
11
|
+
isArray, isFunction,
|
|
12
|
+
isUndefined,
|
|
13
|
+
} from "lodash-es";
|
|
14
|
+
|
|
15
|
+
// @vue/component
|
|
16
|
+
export default {
|
|
17
|
+
name: "AGet",
|
|
18
|
+
props: {
|
|
19
|
+
path: {
|
|
20
|
+
type: [String, Array],
|
|
21
|
+
required: true,
|
|
22
|
+
info: "Weg zu Informationen. Z.B.('a[0].b.c', 'vertrag.antrag_obj.pk', ['vertrag', aloha, 'pk'])",
|
|
23
|
+
},
|
|
24
|
+
data: {
|
|
25
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
26
|
+
required: false,
|
|
27
|
+
default: undefined,
|
|
28
|
+
info: "Haupt-Objekt oder -Array, wo man sucht",
|
|
29
|
+
},
|
|
30
|
+
tag: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: false,
|
|
33
|
+
default: "span",
|
|
34
|
+
info: "Semantisch-relevanter HTML-Tag.(span, div, ...)",
|
|
35
|
+
},
|
|
36
|
+
defaultValue: {
|
|
37
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
38
|
+
required: false,
|
|
39
|
+
default: undefined,
|
|
40
|
+
info: "Standardwert, wenn Lodash-Funktion 'get' undefined zurückschickt",
|
|
41
|
+
},
|
|
42
|
+
filter: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: false,
|
|
45
|
+
default: undefined,
|
|
46
|
+
},
|
|
47
|
+
filterParameters: {
|
|
48
|
+
type: Array,
|
|
49
|
+
required: false,
|
|
50
|
+
default: () => [],
|
|
51
|
+
},
|
|
52
|
+
replacedWithDefault: {
|
|
53
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
54
|
+
required: false,
|
|
55
|
+
default: undefined,
|
|
56
|
+
info: "Wenn das Wert, das Lodash-Funktion 'get' zurückschickt, === this.replacedWithDefault, dann this.defaultValue",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
setup() {
|
|
60
|
+
const {
|
|
61
|
+
filterBoolean,
|
|
62
|
+
filterCurrency,
|
|
63
|
+
filterDate,
|
|
64
|
+
filterDefaultForEmpty,
|
|
65
|
+
filterEmail,
|
|
66
|
+
filterFileSize,
|
|
67
|
+
filterIban,
|
|
68
|
+
filterJson,
|
|
69
|
+
filterKeyValue,
|
|
70
|
+
filterLimitTo,
|
|
71
|
+
filterLink,
|
|
72
|
+
filterList,
|
|
73
|
+
filterSearchHighlight,
|
|
74
|
+
} = FiltersAPI();
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
filterBoolean,
|
|
78
|
+
filterCurrency,
|
|
79
|
+
filterDate,
|
|
80
|
+
filterDefaultForEmpty,
|
|
81
|
+
filterEmail,
|
|
82
|
+
filterFileSize,
|
|
83
|
+
filterIban,
|
|
84
|
+
filterJson,
|
|
85
|
+
filterKeyValue,
|
|
86
|
+
filterLimitTo,
|
|
87
|
+
filterLink,
|
|
88
|
+
filterList,
|
|
89
|
+
filterSearchHighlight,
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
valueLocal() {
|
|
94
|
+
const VALUE = get(this.data, this.pathLocal, this.defaultValue);
|
|
95
|
+
if (this.isValueEqualsWithValueThenDefaultValue(VALUE)) {
|
|
96
|
+
return this.defaultValue;
|
|
97
|
+
}
|
|
98
|
+
if (this.filter) {
|
|
99
|
+
const FILTER_FUNCTION_NAME = `filter${ capitalize(this.filter) }`;
|
|
100
|
+
if (isFunction(this[FILTER_FUNCTION_NAME])) {
|
|
101
|
+
return this[FILTER_FUNCTION_NAME](VALUE, ...this.filterParameters);
|
|
102
|
+
}
|
|
103
|
+
console.warn(`filter "${ FILTER_FUNCTION_NAME }" ist not defined`);
|
|
104
|
+
}
|
|
105
|
+
return VALUE;
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
pathLocal() {
|
|
109
|
+
if (isArray(this.path)) {
|
|
110
|
+
return this.path.join(".");
|
|
111
|
+
}
|
|
112
|
+
return this.path;
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
methods: {
|
|
116
|
+
isValueEqualsWithValueThenDefaultValue(value) {
|
|
117
|
+
if (isUndefined(this.replacedWithDefault)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
let isEquals = false;
|
|
121
|
+
if (isArray(this.replacedWithDefault)) {
|
|
122
|
+
forEach(this.replacedWithDefault, item => {
|
|
123
|
+
if (item === value) {
|
|
124
|
+
isEquals = true;
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
} else if (this.replacedWithDefault === value) {
|
|
129
|
+
isEquals = true;
|
|
130
|
+
}
|
|
131
|
+
return isEquals;
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
render() {
|
|
135
|
+
return h(this.tag, {
|
|
136
|
+
innerHTML: this.valueLocal,
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
};
|
package/src/ATable/ATable.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
toRef,
|
|
7
7
|
} from "vue";
|
|
8
8
|
|
|
9
|
+
import AGet from "../AGet/AGet";
|
|
9
10
|
import ATableCountProPage from "./ATableCountProPage/ATableCountProPage";
|
|
10
11
|
import ATableHeader from "./ATableHeader/ATableHeader";
|
|
11
12
|
import ATablePagination from "./ATablePagination/ATablePagination";
|
|
@@ -21,7 +22,13 @@ import {
|
|
|
21
22
|
getModelColumnsVisibleDefault,
|
|
22
23
|
} from "./utils/utils";
|
|
23
24
|
import {
|
|
24
|
-
cloneDeep,
|
|
25
|
+
cloneDeep,
|
|
26
|
+
forEach,
|
|
27
|
+
get,
|
|
28
|
+
isArray,
|
|
29
|
+
isNil,
|
|
30
|
+
isPlainObject,
|
|
31
|
+
keyBy,
|
|
25
32
|
orderBy,
|
|
26
33
|
startsWith,
|
|
27
34
|
uniqueId,
|
|
@@ -191,7 +198,7 @@ export default {
|
|
|
191
198
|
isLoadingOptions: computed(() => this.isLoadingOptions),
|
|
192
199
|
isLoadingTable: computed(() => this.isLoadingTable),
|
|
193
200
|
rowActions: computed(() => this.rowActions),
|
|
194
|
-
tableId: computed(() => this.
|
|
201
|
+
tableId: computed(() => this.id),
|
|
195
202
|
};
|
|
196
203
|
},
|
|
197
204
|
setup(props, context) {
|
|
@@ -474,7 +481,18 @@ export default {
|
|
|
474
481
|
return h(ATableTr, {
|
|
475
482
|
row,
|
|
476
483
|
rowIndex,
|
|
477
|
-
},
|
|
484
|
+
}, {
|
|
485
|
+
get: vm => [
|
|
486
|
+
h(AGet, {
|
|
487
|
+
data: vm.row,
|
|
488
|
+
path: vm.column.path,
|
|
489
|
+
filter: vm.column.filter,
|
|
490
|
+
filterParameters: vm.column.filterParameters,
|
|
491
|
+
defaultValue: vm.column.defaultValue,
|
|
492
|
+
}),
|
|
493
|
+
],
|
|
494
|
+
...this.$slots,
|
|
495
|
+
});
|
|
478
496
|
})),
|
|
479
497
|
]),
|
|
480
498
|
!this.hasRows && h("div", {
|
|
@@ -79,7 +79,7 @@ export default {
|
|
|
79
79
|
"a_table__th a_table__cell",
|
|
80
80
|
{
|
|
81
81
|
a_table__th_draggable: !this.isLocked && !this.isLoadingOptions,
|
|
82
|
-
a_table__th_sorting: this.
|
|
82
|
+
a_table__th_sorting: this.isSorting,
|
|
83
83
|
}
|
|
84
84
|
];
|
|
85
85
|
},
|
|
@@ -104,6 +104,12 @@ export default {
|
|
|
104
104
|
return this.column.sortId;
|
|
105
105
|
},
|
|
106
106
|
|
|
107
|
+
isSorting() {
|
|
108
|
+
return this.isSortable &&
|
|
109
|
+
(this.isSortAscending ||
|
|
110
|
+
this.isSortDescending);
|
|
111
|
+
},
|
|
112
|
+
|
|
107
113
|
isSortAscending() {
|
|
108
114
|
return this.modelSort === this.sortId;
|
|
109
115
|
},
|