aloha-vue 1.0.70 → 1.0.72

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.
@@ -164,6 +164,71 @@ export default {
164
164
  id: "aloha13",
165
165
  classColumn: "a_column_8",
166
166
  },
167
+ {
168
+ type: "fieldset",
169
+ label: "Aloha fieldset",
170
+ id: "aloha111",
171
+ classColumn: "a_column_8",
172
+ helpText: "ALOHA help!!!",
173
+ children: [
174
+ {
175
+ type: "text",
176
+ label: "Aloha 12",
177
+ id: "aloha122",
178
+ classColumn: "a_column_4",
179
+ },
180
+ {
181
+ type: "text",
182
+ label: "Aloha 13",
183
+ id: "aloha132",
184
+ classColumn: "a_column_8",
185
+ },
186
+ ],
187
+ },
188
+ ],
189
+ },
190
+ {
191
+ type: "fieldset",
192
+ id: "aloha112",
193
+ classColumn: "a_column_8",
194
+ inputClass: "a_p_0",
195
+ helpText: "fieldset without border",
196
+ hasBorder: false,
197
+ children: [
198
+ {
199
+ type: "text",
200
+ label: "Aloha 12",
201
+ id: "aloha122",
202
+ classColumn: "a_column_4",
203
+ },
204
+ {
205
+ type: "text",
206
+ label: "Aloha 13",
207
+ id: "aloha132",
208
+ classColumn: "a_column_8",
209
+ },
210
+ ],
211
+ },
212
+ {
213
+ type: "group",
214
+ id: "group1",
215
+ helpText: "group text",
216
+ children: [
217
+ {
218
+ type: "text",
219
+ label: "Group text",
220
+ labelClass: "a_column_4 a_text_right",
221
+ id: "group_text",
222
+ classColumn: "a_column_4",
223
+ },
224
+ {
225
+ type: "switch",
226
+ label: "Group switch",
227
+ id: "group_switch",
228
+ classColumn: "a_column_4",
229
+ labelClass: "a_sr_only",
230
+ helpText: "ALOHA help!!!",
231
+ },
167
232
  ],
168
233
  },
169
234
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aloha-vue",
3
3
  "description": "Project aloha",
4
- "version": "1.0.70",
4
+ "version": "1.0.72",
5
5
  "author": "Ilia Brykin",
6
6
  "scripts": {
7
7
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1"
package/src/AGet/AGet.js CHANGED
@@ -59,37 +59,9 @@ export default {
59
59
  },
60
60
  },
61
61
  setup() {
62
- const {
63
- filterBoolean,
64
- filterCurrency,
65
- filterDate,
66
- filterDefaultForEmpty,
67
- filterEmail,
68
- filterFileSize,
69
- filterIban,
70
- filterJson,
71
- filterKeyValue,
72
- filterLimitTo,
73
- filterLink,
74
- filterList,
75
- filterSearchHighlight,
76
- } = AFiltersAPI();
62
+ const filters = AFiltersAPI();
77
63
 
78
- return {
79
- filterBoolean,
80
- filterCurrency,
81
- filterDate,
82
- filterDefaultForEmpty,
83
- filterEmail,
84
- filterFileSize,
85
- filterIban,
86
- filterJson,
87
- filterKeyValue,
88
- filterLimitTo,
89
- filterLink,
90
- filterList,
91
- filterSearchHighlight,
92
- };
64
+ return filters;
93
65
  },
94
66
  computed: {
95
67
  valueLocal() {
@@ -10,10 +10,14 @@
10
10
  border-radius: var(--a_fieldset_border_radius);
11
11
  border: var(--a_fieldset_border_width) solid var(--a_fieldset_border_color);
12
12
  }
13
+ .a_fieldset_no_border {
14
+ --a_fieldset_border_color: transparent;
15
+ }
13
16
  .a_fieldset_invalid {
14
17
  --a_fieldset_border_color: var(--a_fieldset_invalid_color);
15
18
  }
16
19
 
20
+
17
21
  .a_legend {
18
22
  --a_legend_padding_x: .5rem;
19
23
  --a_legend_color: inherit;
@@ -24,4 +28,4 @@
24
28
  }
25
29
  .a_legend_invalid {
26
30
  --a_legend_color: var(--a_flegend_invalid_color);
27
- }
31
+ }
@@ -1,5 +1,5 @@
1
1
  import {
2
- h,
2
+ h, resolveComponent,
3
3
  toRef,
4
4
  } from "vue";
5
5
 
@@ -10,7 +10,11 @@ import UiMixinProps from "../mixins/UiMixinProps";
10
10
 
11
11
  import UiAPI from "../compositionApi/UiAPI";
12
12
  import UiStyleHideAPI from "../compositionApi/UiStyleHideAPI";
13
- import { cloneDeep } from "lodash-es";
13
+
14
+ import AUiTypesContainer from "../const/AUiTypesContainer";
15
+ import {
16
+ cloneDeep,
17
+ } from "lodash-es";
14
18
 
15
19
  export default {
16
20
  name: "AFieldset",
@@ -27,9 +31,17 @@ export default {
27
31
  required: false,
28
32
  default: () => [],
29
33
  },
34
+ hasBorder: {
35
+ type: Boolean,
36
+ required: false,
37
+ default: true,
38
+ },
30
39
  },
31
40
  setup(props, context) {
32
- const componentTypesMapping = AUiComponents;
41
+ const componentTypesMapping = {
42
+ fieldset: resolveComponent("AFieldset"),
43
+ ...AUiComponents
44
+ };
33
45
 
34
46
  const {
35
47
  componentStyleHide,
@@ -47,9 +59,13 @@ export default {
47
59
 
48
60
  const modelValue = toRef(props, "modelValue");
49
61
  const onUpdateModelLocal = ({ item, model }) => {
50
- const MODEL_VALUE = cloneDeep(modelValue.value);
51
- MODEL_VALUE[item.id] = cloneDeep(model);
52
- context.emit("update:modelValue", MODEL_VALUE);
62
+ if (AUiTypesContainer[item.type]) {
63
+ context.emit("update:modelValue", model);
64
+ } else {
65
+ const MODEL_VALUE = cloneDeep(modelValue.value);
66
+ MODEL_VALUE[item.id] = cloneDeep(model);
67
+ context.emit("update:modelValue", MODEL_VALUE);
68
+ }
53
69
  };
54
70
 
55
71
  return {
@@ -74,8 +90,9 @@ export default {
74
90
  h("fieldset", {
75
91
  id: this.htmlIdLocal,
76
92
  tabindex: -1,
77
- class: ["a_fieldset", {
93
+ class: ["a_fieldset", this.inputClass, {
78
94
  a_fieldset_invalid: this.isErrors,
95
+ a_fieldset_no_border: !this.hasBorder,
79
96
  }],
80
97
  "aria-describedby": this.ariaDescribedbyLocal,
81
98
  }, [
@@ -89,9 +106,10 @@ export default {
89
106
  class: "a_columns a_columns_count_12 a_columns_gab_2",
90
107
  }, [
91
108
  this.children.map((item, itemIndex) => {
109
+ const IS_CONTAINER = AUiTypesContainer[item.type];
92
110
  return h(this.componentTypesMapping[item.type], {
93
111
  key: itemIndex,
94
- modelValue: this.modelValue[item.id],
112
+ modelValue: IS_CONTAINER ? this.modelValue : this.modelValue[item.id],
95
113
  modelDependencies: this.modelValue,
96
114
  class: ["a_column", item.classColumn || "a_column_12"],
97
115
  errors: this.errorsAll[item.id],
@@ -1,11 +1,16 @@
1
- import { computed, h, toRef, } from "vue";
1
+ import {
2
+ computed,
3
+ h,
4
+ toRef,
5
+ } from "vue";
2
6
 
3
- import AFieldset from "../AFieldset/AFieldset";
4
7
  import AErrors from "../AErrors/AErrors";
5
8
  import ARequired from "../ARequired/ARequired";
6
9
 
7
10
  import AUiComponents from "../AUiComponents";
11
+ import AUiContainerComponents from "../AUiContainerComponents";
8
12
 
13
+ import AUiTypesContainer from "../const/AUiTypesContainer";
9
14
  import {
10
15
  cloneDeep,
11
16
  forEach,
@@ -63,8 +68,8 @@ export default {
63
68
  ],
64
69
  setup(props, { emit }) {
65
70
  const componentTypesMapping = {
66
- fieldset: AFieldset,
67
71
  ...AUiComponents,
72
+ ...AUiContainerComponents,
68
73
  };
69
74
 
70
75
  const modelValue = toRef(props, "modelValue");
@@ -73,9 +78,13 @@ export default {
73
78
  });
74
79
 
75
80
  const onUpdateModelLocal = ({ item, model }) => {
76
- const MODEL_VALUE = cloneDeep(modelValueLocal.value);
77
- MODEL_VALUE[item.id] = cloneDeep(model);
78
- emit("update:modelValue", MODEL_VALUE);
81
+ if (AUiTypesContainer[item.type]) {
82
+ emit("update:modelValue", model);
83
+ } else {
84
+ const MODEL_VALUE = cloneDeep(modelValueLocal.value);
85
+ MODEL_VALUE[item.id] = cloneDeep(model);
86
+ emit("update:modelValue", MODEL_VALUE);
87
+ }
79
88
  };
80
89
 
81
90
  const isRequired = toRef(props, "isRequired");
@@ -127,10 +136,10 @@ export default {
127
136
  }, [
128
137
  this.$slots.formDataPrepend && this.$slots.formDataPrepend(),
129
138
  ...this.data.map((item, itemIndex) => {
130
- const IS_FIELDSET = item.type === "fieldset";
139
+ const IS_CONTAINER = AUiTypesContainer[item.type];
131
140
  return h(this.componentTypesMapping[item.type], {
132
141
  key: itemIndex,
133
- modelValue: IS_FIELDSET ? this.modelValueLocal : this.modelValueLocal[item.id],
142
+ modelValue: IS_CONTAINER ? this.modelValueLocal : this.modelValueLocal[item.id],
134
143
  modelDependencies: this.modelValueLocal,
135
144
  class: ["a_column", item.classColumn || "a_column_12"],
136
145
  errors: this.errors[item.id],
@@ -0,0 +1,151 @@
1
+ import {
2
+ computed,
3
+ h,
4
+ toRef,
5
+ } from "vue";
6
+
7
+ import AErrorsText from "../AErrorsText/AErrorsText";
8
+ import ALabel from "../ALabel/ALabel";
9
+ import AUiComponents from "../AUiComponents";
10
+
11
+ import UiMixinProps from "../mixins/UiMixinProps";
12
+
13
+ import UiAPI, { getHtmlId } from "../compositionApi/UiAPI";
14
+ import UiStyleHideAPI from "../compositionApi/UiStyleHideAPI";
15
+
16
+ import {
17
+ cloneDeep,
18
+ } from "lodash-es";
19
+
20
+ export default {
21
+ name: "AGroup",
22
+ mixins: [
23
+ UiMixinProps,
24
+ ],
25
+ props: {
26
+ modelValue: {
27
+ type: Object,
28
+ required: false,
29
+ default: () => ({}),
30
+ },
31
+ children: {
32
+ type: Array,
33
+ required: false,
34
+ default: () => [],
35
+ },
36
+ classColumns: {
37
+ type: [String, Object],
38
+ required: false,
39
+ default: "a_columns_count_12 a_columns_gab_2",
40
+ },
41
+ },
42
+ setup(props, context) {
43
+ const componentTypesMapping = {
44
+ ...AUiComponents
45
+ };
46
+
47
+ const {
48
+ componentStyleHide,
49
+ } = UiStyleHideAPI(props);
50
+
51
+ const {
52
+ ariaDescribedbyLocal,
53
+ changeModel,
54
+ clearModel,
55
+ errorsId,
56
+ helpTextId,
57
+ htmlIdLocal,
58
+ isErrors,
59
+ } = UiAPI(props, context);
60
+
61
+ const modelValue = toRef(props, "modelValue");
62
+
63
+ const onUpdateModelLocal = ({ item, model }) => {
64
+ const MODEL_VALUE = cloneDeep(modelValue.value);
65
+ MODEL_VALUE[item.id] = cloneDeep(model);
66
+ context.emit("update:modelValue", MODEL_VALUE);
67
+ };
68
+
69
+ const children = toRef(props, "children");
70
+ const idPrefix = toRef(props, "idPrefix");
71
+
72
+ const firstChild = computed(() => {
73
+ return children.value[0] || {};
74
+ });
75
+
76
+ const htmlIdFirstChild = computed(() => {
77
+ return getHtmlId({
78
+ id: firstChild.value.id,
79
+ idPrefix: firstChild.value.idPrefix || idPrefix.value,
80
+ htmlId: firstChild.value.htmlId,
81
+ });
82
+ });
83
+
84
+ return {
85
+ componentTypesMapping,
86
+ firstChild,
87
+ htmlIdFirstChild,
88
+ onUpdateModelLocal,
89
+
90
+ componentStyleHide,
91
+
92
+ ariaDescribedbyLocal,
93
+ changeModel,
94
+ clearModel,
95
+ errorsId,
96
+ helpTextId,
97
+ htmlIdLocal,
98
+ isErrors,
99
+ };
100
+ },
101
+ render() {
102
+ return this.isRender && h("div", {
103
+ style: this.componentStyleHide,
104
+ }, [
105
+ h("div", {
106
+ id: this.htmlIdLocal,
107
+ role: "group",
108
+ tabindex: -1,
109
+ class: [this.inputClass, {
110
+ a_group_invalid: this.isErrors,
111
+ }],
112
+ "aria-describedby": this.ariaDescribedbyLocal,
113
+ }, [
114
+ h("div", {
115
+ class: ["a_columns", this.classColumns],
116
+ }, [
117
+ this.firstChild.label && h(ALabel, {
118
+ id: this.htmlIdFirstChild,
119
+ label: this.firstChild.label,
120
+ labelClass: ["a_column", this.firstChild.labelClass],
121
+ required: this.firstChild.required,
122
+ type: this.firstChild.type,
123
+ isLabelFloat: false,
124
+ }),
125
+ this.children.map((item, itemIndex) => {
126
+ return h(this.componentTypesMapping[item.type], {
127
+ key: itemIndex,
128
+ modelValue: this.modelValue[item.id],
129
+ modelDependencies: this.modelValue,
130
+ class: ["a_column", item.classColumn || "a_column_2"],
131
+ errors: this.errorsAll[item.id],
132
+ idPrefix: item.idPrefix || this.idPrefix,
133
+ "onUpdate:modelValue": model => this.onUpdateModelLocal({ item, model }),
134
+ ...item,
135
+ label: itemIndex === 0 ? undefined : item.label,
136
+ }, this.$slots);
137
+ }),
138
+ ]),
139
+ ]),
140
+ this.helpText && h("div", {
141
+ id: this.helpTextId,
142
+ class: "a_form_element__help_text",
143
+ innerHTML: this.helpText,
144
+ }),
145
+ this.isErrors && h(AErrorsText, {
146
+ id: this.errorsId,
147
+ errors: this.errors,
148
+ }),
149
+ ]);
150
+ },
151
+ };
@@ -0,0 +1,7 @@
1
+ import AFieldset from "./AFieldset/AFieldset";
2
+ import AGroup from "./AGroup/AGroup";
3
+
4
+ export default {
5
+ fieldset: AFieldset,
6
+ group: AGroup,
7
+ };
@@ -0,0 +1,4 @@
1
+ export default {
2
+ fieldset: true,
3
+ group: true,
4
+ };