aloha-vue 1.0.10 → 1.0.13

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 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.9",
14
+ "aloha-css": "1.0.11",
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",
@@ -1,3 +1,4 @@
1
+ import AModalConfirm from "../../../src/AModalConfirm/AModalConfirm";
1
2
  import TheMenu from "../components/TheMenu/TheMenu.vue";
2
3
  import TheNavbar from "../components/TheNavbar/TheNavbar.vue";
3
4
 
@@ -8,6 +9,7 @@ import {
8
9
 
9
10
  export default defineComponent({
10
11
  components: {
12
+ AModalConfirm,
11
13
  TheMenu,
12
14
  TheNavbar,
13
15
  },
@@ -8,3 +8,5 @@ div
8
8
  style="width: calc(100vw - 280px);"
9
9
  )
10
10
  router-view
11
+
12
+ a-modal-confirm
@@ -43,6 +43,21 @@ export default {
43
43
  name: "PageAccordion",
44
44
  label: "Accordion",
45
45
  },
46
+ {
47
+ id: "alert",
48
+ name: "PageAlert",
49
+ label: "Alert",
50
+ },
51
+ {
52
+ id: "modal",
53
+ name: "PageModal",
54
+ label: "Modal",
55
+ },
56
+ {
57
+ id: "confirm",
58
+ name: "PageConfirm",
59
+ label: "Confirm",
60
+ },
46
61
  ],
47
62
  };
48
63
  },
@@ -54,6 +54,21 @@ 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
+ },
62
+ {
63
+ path: "/modal",
64
+ name: "PageModal",
65
+ component: () => import(/* webpackChunkName: "PageModal" */ "../views/PageModal/PageModal.vue"),
66
+ },
67
+ {
68
+ path: "/confirm",
69
+ name: "PageConfirm",
70
+ component: () => import(/* webpackChunkName: "PageConfirm" */ "../views/PageConfirm/PageConfirm.vue"),
71
+ },
57
72
  {
58
73
  // If the routing configuration '*' reports an error, replace it with '/: catchAll(. *)'
59
74
  // 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
+ };
@@ -0,0 +1,10 @@
1
+ div
2
+ a-alert(
3
+ v-for="alert in alerts"
4
+ :key="alert"
5
+ :type="alert"
6
+ :is-visible="!isAlertsHidden[alert]"
7
+ :is-dismissible="true"
8
+ @on-dismiss="closeAlert(alert)"
9
+ )
10
+ div Alert {{ alert }}
@@ -0,0 +1,2 @@
1
+ <template lang="pug" src="./PageAlert.pug"></template>
2
+ <script src="./PageAlert.js"></script>
@@ -0,0 +1,33 @@
1
+ import AModal from "../../../../src/AModal/AModal";
2
+
3
+ import ConfirmAPI from "../../../../src/compositionAPI/ConfirmAPI";
4
+
5
+ export default {
6
+ name: "PageConfirm",
7
+ components: {
8
+ AModal,
9
+ },
10
+ setup() {
11
+ const {
12
+ closeConfirm,
13
+ openConfirm,
14
+ } = ConfirmAPI();
15
+
16
+ const save = () => {
17
+ console.log("Aloha");
18
+ closeConfirm();
19
+ };
20
+
21
+ const openConfirmLocal = () => {
22
+ openConfirm({
23
+ headerText: "Aloha",
24
+ bodyHtml: "<div>Aloha <strong>Hola</strong></div>",
25
+ save: save,
26
+ });
27
+ };
28
+
29
+ return {
30
+ openConfirmLocal,
31
+ };
32
+ },
33
+ };
@@ -0,0 +1,6 @@
1
+ div
2
+ h1 AConfirm
3
+ button(
4
+ type="button"
5
+ @click="openConfirmLocal"
6
+ ) Open confirm
@@ -0,0 +1,2 @@
1
+ <template lang="pug" src="./PageConfirm.pug"></template>
2
+ <script src="./PageConfirm.js"></script>
@@ -0,0 +1,22 @@
1
+ import AModal from "../../../../src/AModal/AModal";
2
+
3
+ export default {
4
+ name: "PageModal",
5
+ components: {
6
+ AModal,
7
+ },
8
+ data() {
9
+ return {
10
+ isModalOpen: false,
11
+ };
12
+ },
13
+ methods: {
14
+ openModal() {
15
+ this.isModalOpen = true;
16
+ },
17
+
18
+ closeModal() {
19
+ this.isModalOpen = false;
20
+ },
21
+ },
22
+ };
@@ -0,0 +1,11 @@
1
+ div
2
+ h1 AModal
3
+ button(
4
+ type="button"
5
+ @click="openModal"
6
+ ) Open Modal
7
+
8
+ a-modal(
9
+ v-if="isModalOpen"
10
+ :close="closeModal"
11
+ )
@@ -0,0 +1,2 @@
1
+ <template lang="pug" src="./PageModal.pug"></template>
2
+ <script src="./PageModal.js"></script>
@@ -47,6 +47,8 @@ export default {
47
47
  id: "obj",
48
48
  path: "obj.aloha",
49
49
  sortId: "obj.aloha",
50
+ slot: "get",
51
+ filter: "boolean",
50
52
  },
51
53
  {
52
54
  label: "Obj2",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.10",
4
+ "version": "1.0.13",
5
5
  "author": "Ilia Brykin",
6
6
  "dependencies": {
7
7
  "@popperjs/core": "2.11.5",
8
- "aloha-css": "1.0.8",
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
+ };
@@ -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
+ };
@@ -0,0 +1,406 @@
1
+ import {
2
+ h,
3
+ Teleport,
4
+ } from "vue";
5
+
6
+ import {
7
+ filter,
8
+ isString,
9
+ forEach,
10
+ isFunction,
11
+ get,
12
+ } from "lodash-es";
13
+
14
+ const TAB_ELEMENTS = `a[href]:not([disabled]) a[role="button"]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled])`;
15
+ const KEY_CODE_TAB = 9;
16
+ const KEY_CODE_ESCAPE = 27;
17
+
18
+ // @vue/component
19
+ export default {
20
+ name: "Modal",
21
+ props: {
22
+ disabled: {
23
+ type: Boolean,
24
+ required: false,
25
+ default: false,
26
+ },
27
+ selectorClose: {
28
+ type: [String, Array],
29
+ required: false,
30
+ default: undefined,
31
+ },
32
+ withoutEscape: {
33
+ type: Boolean,
34
+ required: false,
35
+ },
36
+ size: {
37
+ type: String,
38
+ validator: value => ["small", "large", "xl", "fullscreen"].indexOf(value) !== -1,
39
+ default: undefined,
40
+ },
41
+ isModalHidden: {
42
+ type: Boolean,
43
+ required: false,
44
+ default: false,
45
+ },
46
+ save: {
47
+ type: Function,
48
+ required: false,
49
+ default: undefined,
50
+ },
51
+ saveButtonText: {
52
+ type: String,
53
+ required: false,
54
+ default: "Speichern",
55
+ },
56
+ saveButtonClass: {
57
+ type: [String, Array, Object],
58
+ required: false,
59
+ default: "a_btn a_btn_primary",
60
+ },
61
+ close: {
62
+ type: Function,
63
+ required: true,
64
+ },
65
+ closeButtonText: {
66
+ type: String,
67
+ required: false,
68
+ default: "Abbrechen",
69
+ },
70
+ closeButtonClass: {
71
+ type: [String, Array, Object],
72
+ required: false,
73
+ default: "a_btn a_btn_secondary",
74
+ },
75
+ isCloseButtonHidden: {
76
+ type: Boolean,
77
+ required: false,
78
+ },
79
+ headerText: {
80
+ type: String,
81
+ required: false,
82
+ default: undefined,
83
+ },
84
+ headerTag: {
85
+ type: String,
86
+ required: false,
87
+ default: "h2",
88
+ },
89
+ bodyHtml: {
90
+ type: String,
91
+ required: false,
92
+ default: "",
93
+ },
94
+ },
95
+ data() {
96
+ return {
97
+ clientHeight: 0,
98
+ statusShow: false,
99
+ modalInModalCount: 0,
100
+ statusShowInfo: true,
101
+ };
102
+ },
103
+ computed: {
104
+ listFiltered() {
105
+ return filter(this.options.list, item => !item.readonly);
106
+ },
107
+
108
+ confirmOkLabel() {
109
+ return this.confirmOptions.okLabel || "_BTN_SAVE_";
110
+ },
111
+
112
+ confirmCancelLabel() {
113
+ return this.confirmOptions.cancelLabel || "_BTN_CANCEL_";
114
+ },
115
+
116
+ cancelLabel() {
117
+ return this.options.cancelLabel || "_BTN_CANCEL_";
118
+ },
119
+
120
+ autocomplete() {
121
+ return this.options.autocomplete || "on";
122
+ },
123
+
124
+ classSize() {
125
+ return `modal-${ this.size }`;
126
+ },
127
+
128
+ backdropStyle() {
129
+ if (this.modalInModalCount) {
130
+ return `z-index: ${ 1045 + (this.modalInModalCount * 10) };`;
131
+ }
132
+ return "";
133
+ },
134
+
135
+ modalStyle() {
136
+ if (this.modalInModalCount) {
137
+ return `z-index: ${ 1050 + (this.modalInModalCount * 10) };`;
138
+ }
139
+ return "";
140
+ },
141
+
142
+ htmlIdModalChild() {
143
+ return `modal_child_${ this.modalInModalCount }`;
144
+ },
145
+
146
+ htmlIdModal() {
147
+ return `modal_${ this.modalInModalCount }`;
148
+ },
149
+
150
+ htmlIdHeader() {
151
+ return `modal_header_${ this.modalInModalCount }`;
152
+ },
153
+
154
+ dependencyValues() {
155
+ const DEPS = {};
156
+ forEach(this.listFiltered, item => {
157
+ if (item.dependency) {
158
+ DEPS[item.id] = get(this.model, item.dependency);
159
+ }
160
+ });
161
+ return DEPS;
162
+ },
163
+
164
+ modalClassSize() {
165
+ if (this.size) {
166
+ return `a_modal_${ this.size }`;
167
+ }
168
+ return "";
169
+ },
170
+ },
171
+ mounted() {
172
+ this.showModal();
173
+ },
174
+ unmounted() {
175
+ this.hideModal();
176
+ },
177
+ methods: {
178
+ showModal() {
179
+ document.body.classList.add("modal-open");
180
+ this.setFocusToModal();
181
+ this.setListenerForPressButtons();
182
+ setTimeout(() => {
183
+ this.statusShow = true;
184
+ });
185
+ },
186
+
187
+ hideModal() {
188
+ document.body.classList.remove("modal-open");
189
+ this.onFocusByDestroy();
190
+ this.removeMouseEventListeners();
191
+ this.removeListenerForPressButtons();
192
+ },
193
+
194
+ setListenerForPressButtons() {
195
+ document.addEventListener("keydown", this.pressButton);
196
+ },
197
+
198
+ pressButton($event) {
199
+ const EVENT = $event || window.$event;
200
+ if (EVENT.key === "Escape" || EVENT.keyCode === KEY_CODE_ESCAPE) { // Escape
201
+ this.pressEscape();
202
+ } else if (EVENT.key === "Tab" || EVENT.keyCode === KEY_CODE_TAB) { // Tab
203
+ this.trapFocus(EVENT);
204
+ }
205
+ },
206
+
207
+ pressEscape() {
208
+ if (this.withoutEscape) {
209
+ return;
210
+ }
211
+ if (this.confirmOptions && isFunction(this.confirmOptions.cancelCallback)) {
212
+ this.confirmOptions.cancelCallback();
213
+ } else {
214
+ this.onClose();
215
+ }
216
+ },
217
+
218
+ trapFocus(EVENT) {
219
+ const FOCUSABLE_ELEMENTS = this.$refs.modal_parent.querySelectorAll(TAB_ELEMENTS);
220
+ if (FOCUSABLE_ELEMENTS.length === 0) {
221
+ EVENT.preventDefault();
222
+ return;
223
+ }
224
+ const FIRST_FOCUSABLE_ELEMENT = FOCUSABLE_ELEMENTS[0];
225
+ const LAST_FOCUSABLE_ELEMENT = FOCUSABLE_ELEMENTS[FOCUSABLE_ELEMENTS.length - 1];
226
+ if (EVENT.shiftKey) { // Shift + Tab
227
+ if (document.activeElement === FIRST_FOCUSABLE_ELEMENT) {
228
+ this.setFocusToModal(EVENT);
229
+ EVENT.preventDefault();
230
+ } else if (document.activeElement === this.$refs.modal) { // Focus in .modal
231
+ LAST_FOCUSABLE_ELEMENT.focus();
232
+ EVENT.preventDefault();
233
+ }
234
+ } else { // Tab
235
+ if (document.activeElement === LAST_FOCUSABLE_ELEMENT) {
236
+ this.setFocusToModal(EVENT);
237
+ EVENT.preventDefault();
238
+ }
239
+ }
240
+ },
241
+
242
+ setFocusToModal() {
243
+ if (this.$refs.modal) {
244
+ this.$refs.modal.focus();
245
+ }
246
+ },
247
+
248
+ removeListenerForPressButtons() {
249
+ document.removeEventListener("keydown", this.pressButton);
250
+ },
251
+
252
+ mousedown() {
253
+ this.addMouseEventListeners();
254
+ this.clientHeight = document.documentElement.clientHeight;
255
+ },
256
+
257
+ mousemove($event) {
258
+ const CLIENT_Y = $event.clientY;
259
+ const MODAL_BODY_HEIGHT = this.getModalBodyHeight(CLIENT_Y);
260
+ this.$refs.modal_body.style.maxHeight = `${ MODAL_BODY_HEIGHT }px`;
261
+ this.$refs.modal_body.style.height = `${ MODAL_BODY_HEIGHT }px`;
262
+ },
263
+
264
+ mouseup() {
265
+ this.removeMouseEventListeners();
266
+ },
267
+
268
+ mouseoutDocument() {
269
+ this.removeMouseEventListeners();
270
+ },
271
+
272
+ addMouseEventListeners() {
273
+ document.addEventListener("mousemove", this.mousemove);
274
+ document.addEventListener("mouseup", this.mouseup);
275
+ document.addEventListener("mouseleave", this.mouseoutDocument);
276
+ },
277
+
278
+ removeMouseEventListeners() {
279
+ document.removeEventListener("mouseup", this.mouseup);
280
+ document.removeEventListener("mousemove", this.mousemove);
281
+ document.removeEventListener("mouseout", this.mouseoutDocument);
282
+ },
283
+
284
+ getModalBodyHeight(clientY) {
285
+ const CLIENT_Y = clientY + 30 > this.clientHeight ? this.clientHeight - 15 : clientY;
286
+ const MODAL_HEADER_HEIGHT = this.$refs.modal_header.clientHeight;
287
+ const MODAL_FOOTER_HEIGHT = this.$refs.modal_footer.clientHeight;
288
+ const MODAL_BODY_HEIGHT = CLIENT_Y - MODAL_HEADER_HEIGHT - MODAL_FOOTER_HEIGHT - 15;
289
+ return MODAL_BODY_HEIGHT > 0 ? MODAL_BODY_HEIGHT : 0;
290
+ },
291
+
292
+ onFocusByDestroy() {
293
+ if (!this.selectorClose) {
294
+ return;
295
+ }
296
+ setTimeout(() => {
297
+ if (isString(this.selectorClose)) {
298
+ this.onFocusByDestroyForSelector({ selector: this.selectorClose });
299
+ } else {
300
+ forEach(this.selectorClose, selector => {
301
+ const STATUS_SUCCESS = this.onFocusByDestroyForSelector({ selector });
302
+ if (STATUS_SUCCESS) {
303
+ return false;
304
+ }
305
+ });
306
+ }
307
+ }, 300);
308
+ },
309
+
310
+ onFocusByDestroyForSelector({ selector }) {
311
+ const ELEMENT = document.querySelector(selector);
312
+ if (ELEMENT.length > 0) {
313
+ ELEMENT.focus();
314
+ return true;
315
+ }
316
+ return false;
317
+ },
318
+
319
+ saveLocal() {
320
+ if (isFunction(this.save)) {
321
+ this.save();
322
+ }
323
+ },
324
+
325
+ hideInfo() {
326
+ this.statusShowInfo = false;
327
+ },
328
+ },
329
+ render() {
330
+ return h(Teleport, {
331
+ to: "body",
332
+ }, [
333
+ h("div", {
334
+ ref: "modal_parent",
335
+ }, [
336
+ h("div", {
337
+ ref: "modal",
338
+ class: ["a_modal", {
339
+ a_modal_show: !this.isModalHidden
340
+ }],
341
+ tabindex: -1,
342
+ role: "dialog",
343
+ ariaModal: true,
344
+ }, [
345
+ h("div", {
346
+ class: ["a_modal_dialog a_modal_dialog_scrollable", this.modalClassSize],
347
+ }, [
348
+ h("div", {
349
+ class: "a_modal_content",
350
+ }, [
351
+ h("div", {
352
+ ref: "modal_header",
353
+ class: "a_modal_header",
354
+ }, [
355
+ this.$slots.header && this.$slots.header(),
356
+ this.headerText && h(this.headerTag, {
357
+ class: "a_modal_title",
358
+ }, [
359
+ h("span", null, this.headerText),
360
+ ]),
361
+ h("button", {
362
+ type: "button",
363
+ class: "a_btn_close",
364
+ ariaLabel: "Close",
365
+ disabled: this.disabled,
366
+ onClick: this.close,
367
+ })
368
+ ]),
369
+ h("div", {
370
+ ref: "modal_body",
371
+ class: "a_modal_body",
372
+ }, [
373
+ this.$slots.body && this.$slots.body(),
374
+ this.bodyHtml && h("div", {
375
+ innerHTML: this.bodyHtml,
376
+ }),
377
+ ]),
378
+ h("div", {
379
+ ref: "modal_footer",
380
+ class: "a_modal_footer",
381
+ }, [
382
+ this.$slots.footer && this.$slots.footer(),
383
+ this.save && h("button", {
384
+ type: "button",
385
+ class: this.saveButtonClass,
386
+ disabled: this.disabled,
387
+ onClick: this.save,
388
+ }, [
389
+ h("span", null, this.saveButtonText),
390
+ ]),
391
+ !this.isCloseButtonHidden && h("button", {
392
+ type: "button",
393
+ class: this.closeButtonClass,
394
+ disabled: this.disabled,
395
+ onClick: this.close,
396
+ }, [
397
+ h("span", null, this.closeButtonText),
398
+ ]),
399
+ ]),
400
+ ]),
401
+ ]),
402
+ ]),
403
+ ]),
404
+ ]);
405
+ },
406
+ };
@@ -0,0 +1,35 @@
1
+ import {
2
+ computed,
3
+ h,
4
+ } from "vue";
5
+
6
+ import AModal from "../AModal/AModal";
7
+
8
+ import ConfirmAPI from "../compositionAPI/ConfirmAPI";
9
+
10
+ // @vue/component
11
+ export default {
12
+ name: "AModalConfirm",
13
+ setup() {
14
+ const {
15
+ closeConfirm,
16
+ confirmOptions,
17
+ isModalHidden,
18
+ } = ConfirmAPI();
19
+
20
+ const modalProps = computed(() => {
21
+ return {
22
+ close: closeConfirm,
23
+ isModalHidden: isModalHidden.value,
24
+ ...confirmOptions.value
25
+ };
26
+ });
27
+
28
+ return {
29
+ modalProps,
30
+ };
31
+ },
32
+ render() {
33
+ return h(AModal, this.modalProps);
34
+ },
35
+ };
@@ -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, forEach, get, isArray, isNil, isPlainObject, keyBy,
25
+ cloneDeep,
26
+ forEach,
27
+ get,
28
+ isArray,
29
+ isNil,
30
+ isPlainObject,
31
+ keyBy,
25
32
  orderBy,
26
33
  startsWith,
27
34
  uniqueId,
@@ -474,7 +481,18 @@ export default {
474
481
  return h(ATableTr, {
475
482
  row,
476
483
  rowIndex,
477
- }, this.$slots);
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", {
@@ -0,0 +1,52 @@
1
+ import {
2
+ ref,
3
+ } from "vue";
4
+
5
+ import {
6
+ forEach, isFunction,
7
+ } from "lodash-es";
8
+
9
+ const isModalHidden = ref(true);
10
+ const confirmOptions = ref({});
11
+ // bodyHtml
12
+ // close
13
+ // closeButtonClass
14
+ // closeButtonText
15
+ // disabled
16
+ // headerTag
17
+ // headerText
18
+ // save
19
+ // saveButtonClass
20
+ // saveButtonText
21
+ // selectorClose
22
+ // size
23
+
24
+ export default function ConfirmAPI() {
25
+ const changeConfirmOptions = (args = {}) => {
26
+ forEach(args, (argumentValue, argumentKey) => {
27
+ confirmOptions.value[argumentKey] = argumentValue;
28
+ });
29
+ };
30
+
31
+ const openConfirm = (args = {}) => {
32
+ changeConfirmOptions(args);
33
+
34
+ isModalHidden.value = false;
35
+ };
36
+
37
+ const closeConfirm = () => {
38
+ if (isFunction(confirmOptions.value.close)) {
39
+ confirmOptions.value.close();
40
+ }
41
+ confirmOptions.value = {};
42
+ isModalHidden.value = true;
43
+ };
44
+
45
+ return {
46
+ changeConfirmOptions,
47
+ closeConfirm,
48
+ confirmOptions,
49
+ isModalHidden,
50
+ openConfirm,
51
+ };
52
+ }