aloha-vue 1.2.25 → 1.2.27

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 dist/styles/styles.css"
12
12
  },
13
13
  "dependencies": {
14
- "@floating-ui/vue": "^1.0.2",
14
+ "@floating-ui/vue": "1.0.2",
15
15
  "aloha-css": "1.0.127",
16
16
  "axios": "1.4.0",
17
17
  "dompurify": "3.0.3",
@@ -174,7 +174,7 @@ export default {
174
174
  id: "aloha7",
175
175
  classColumn: "a_column_5",
176
176
  helpText: "ALOHA help!!!",
177
- disabled: true,
177
+ disabled: false,
178
178
  },
179
179
  {
180
180
  type: "switch",
@@ -27,7 +27,7 @@ function resolveAlias(mode) {
27
27
  "tiny-emitter": path.resolve(__dirname, "node_modules/tiny-emitter"),
28
28
  dompurify: path.resolve(__dirname, "node_modules/dompurify"),
29
29
  tinymce: path.resolve(__dirname, "node_modules/tinymce"),
30
- "@popperjs/core": path.resolve(__dirname, "node_modules/@popperjs/core"),
30
+ "@floating-ui/vue": path.resolve(__dirname, "node_modules/@floating-ui/vue"),
31
31
  };
32
32
  }
33
33
 
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.2.25",
17
+ "version": "1.2.27",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -40,7 +40,7 @@
40
40
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1"
41
41
  },
42
42
  "dependencies": {
43
- "@floating-ui/vue": "^1.0.2",
43
+ "@floating-ui/vue": "1.0.2",
44
44
  "aloha-css": "1.0.98",
45
45
  "axios": "^1.4.0",
46
46
  "dompurify": "^2.4.1",
@@ -650,6 +650,7 @@ export default {
650
650
  if (this.isDataArray) {
651
651
  return this.data.length;
652
652
  }
653
+ return 0;
653
654
  },
654
655
 
655
656
  isDataObject() {
@@ -27,6 +27,7 @@ export default function LinkAPI(props) {
27
27
  if (isPlainObject(column.value.to)) {
28
28
  const TO = cloneDeep(column.value.to);
29
29
  const PARAMS = TO.params || {};
30
+ const QUERY = TO.query || {};
30
31
  if (column.value.to.paramsDynamic) {
31
32
  let hasParamsDynamicError = false;
32
33
  forEach(column.value.to.paramsDynamic, (value, key) => {
@@ -41,7 +42,22 @@ export default function LinkAPI(props) {
41
42
  return undefined;
42
43
  }
43
44
  }
45
+ if (column.value.to.queryDynamic) {
46
+ let hasParamsDynamicError = false;
47
+ forEach(column.value.to.queryDynamic, (value, key) => {
48
+ const PARAMS_VALUE = get(row.value, value);
49
+ if (isUndefined(PARAMS_VALUE)) {
50
+ hasParamsDynamicError = true;
51
+ return false;
52
+ }
53
+ PARAMS[key] = PARAMS_VALUE;
54
+ });
55
+ if (hasParamsDynamicError) {
56
+ return undefined;
57
+ }
58
+ }
44
59
  TO.params = PARAMS;
60
+ TO.query = QUERY;
45
61
  return TO;
46
62
  }
47
63
  return undefined;
@@ -131,6 +131,7 @@ export default function RowActionsAPI(props) {
131
131
  if (isPlainObject(rowAction.to)) {
132
132
  const TO = cloneDeep(rowAction.to);
133
133
  const PARAMS = TO.params || {};
134
+ const QUERY = TO.query || {};
134
135
  if (rowAction.to.paramsDynamic) {
135
136
  let hasParamsDynamicError = false;
136
137
  forEach(rowAction.to.paramsDynamic, (value, key) => {
@@ -145,7 +146,22 @@ export default function RowActionsAPI(props) {
145
146
  return undefined;
146
147
  }
147
148
  }
149
+ if (rowAction.to.queryDynamic) {
150
+ let hasParamsDynamicError = false;
151
+ forEach(rowAction.to.queryDynamic, (value, key) => {
152
+ const PARAMS_VALUE = get(row.value, value);
153
+ if (isUndefined(PARAMS_VALUE)) {
154
+ hasParamsDynamicError = true;
155
+ return false;
156
+ }
157
+ PARAMS[key] = PARAMS_VALUE;
158
+ });
159
+ if (hasParamsDynamicError) {
160
+ return undefined;
161
+ }
162
+ }
148
163
  TO.params = PARAMS;
164
+ TO.query = QUERY;
149
165
  return TO;
150
166
  }
151
167
  return undefined;
@@ -51,9 +51,9 @@ export default function SortAPI(props) {
51
51
  const dataSorted = computed(() => {
52
52
  if (modelSortLocal.value.length &&
53
53
  !isSortingOutside.value) {
54
- return orderBy(data.value, sortOptions.value.models, sortOptions.value.directions);
54
+ return orderBy(data.value || [], sortOptions.value.models, sortOptions.value.directions);
55
55
  }
56
- return data.value;
56
+ return data.value || [];
57
57
  });
58
58
 
59
59
  watch(modelSort, () => {
@@ -1,7 +1,5 @@
1
1
  import {
2
- computed,
3
2
  h,
4
- toRef,
5
3
  } from "vue";
6
4
 
7
5
  import AErrorsText from "../AErrorsText/AErrorsText";
@@ -10,22 +8,130 @@ import ALabel from "../ALabel/ALabel";
10
8
  import ATooltip from "../../ATooltip/ATooltip";
11
9
  import ATranslation from "../../ATranslation/ATranslation";
12
10
 
13
- import UiMixinProps from "../mixins/UiMixinProps";
14
-
11
+ import CheckedAPI from "./compositionAPI/CheckedAPI";
12
+ import LabelAPI from "./compositionAPI/LabelAPI";
13
+ import ModelAPI from "./compositionAPI/ModelAPI";
14
+ import OnInputAPI from "./compositionAPI/OnInputAPI";
15
15
  import TitleAPI from "./compositionAPI/TitleAPI";
16
16
  import UiAPI from "../compositionApi/UiAPI";
17
17
  import UiStyleHideAPI from "../compositionApi/UiStyleHideAPI";
18
18
 
19
19
  import placements from "../../const/placements";
20
+ import {
21
+ uniqueId,
22
+ } from "lodash-es";
20
23
 
21
- const KEY_CODE_SPACE = 32;
22
24
 
23
25
  export default {
24
26
  name: "ASwitch",
25
- mixins: [
26
- UiMixinProps,
27
- ],
28
27
  props: {
28
+ disabled: {
29
+ type: Boolean,
30
+ required: false,
31
+ },
32
+ id: {
33
+ type: [String, Number],
34
+ required: false,
35
+ default: () => uniqueId("a_ui_"),
36
+ },
37
+ idPrefix: {
38
+ type: String,
39
+ required: false,
40
+ default: undefined,
41
+ },
42
+ htmlId: {
43
+ type: String,
44
+ required: false,
45
+ default: undefined,
46
+ },
47
+ inputAttributes: {
48
+ type: Object,
49
+ required: false,
50
+ default: () => ({}),
51
+ },
52
+ inputClass: {
53
+ required: false,
54
+ },
55
+ label: {
56
+ type: [String, Number],
57
+ required: false,
58
+ default: undefined,
59
+ },
60
+ labelClass: {
61
+ required: false,
62
+ default: undefined,
63
+ },
64
+ required: {
65
+ type: Boolean,
66
+ required: false,
67
+ default: false,
68
+ },
69
+ modelUndefined: {
70
+ required: false,
71
+ default: null,
72
+ },
73
+ isLabelFloat: {
74
+ type: Boolean,
75
+ required: false,
76
+ default: true,
77
+ },
78
+ errors: {
79
+ type: [String, Array],
80
+ required: false,
81
+ default: undefined,
82
+ },
83
+ errorsAll: {
84
+ type: Object,
85
+ required: false,
86
+ default: () => ({}),
87
+ },
88
+ classColumn: {
89
+ type: String,
90
+ required: false,
91
+ default: undefined,
92
+ },
93
+ modelDependencies: {
94
+ type: Object,
95
+ required: false,
96
+ default: () => ({}),
97
+ },
98
+ dependencies: {
99
+ type: [Array, Object],
100
+ required: false,
101
+ default: undefined,
102
+ },
103
+ helpText: {
104
+ type: String,
105
+ required: false,
106
+ },
107
+ type: {
108
+ type: String,
109
+ required: false,
110
+ },
111
+ isHide: {
112
+ type: Boolean,
113
+ required: false,
114
+ },
115
+ isRender: {
116
+ type: Boolean,
117
+ required: false,
118
+ default: true,
119
+ },
120
+ options: {
121
+ type: Object,
122
+ required: false,
123
+ default: () => ({}),
124
+ },
125
+ change: {
126
+ type: Function,
127
+ required: false,
128
+ default: () => {},
129
+ },
130
+ extra: {
131
+ type: Object,
132
+ required: false,
133
+ default: undefined,
134
+ },
29
135
  modelValue: {
30
136
  type: [Boolean, String, Number],
31
137
  required: false,
@@ -97,6 +203,11 @@ export default {
97
203
  required: false,
98
204
  },
99
205
  },
206
+ emits: [
207
+ "blur",
208
+ "focus",
209
+ "update:modelValue",
210
+ ],
100
211
  setup(props, context) {
101
212
  const {
102
213
  componentStyleHide,
@@ -119,102 +230,51 @@ export default {
119
230
  hasTitle,
120
231
  } = TitleAPI(props);
121
232
 
122
- const modelValue = toRef(props, "modelValue");
123
-
124
- const trueLabel = toRef(props, "trueLabel");
125
-
126
- const falseLabel = toRef(props, "falseLabel");
127
-
128
- const defaultLabel = toRef(props, "defaultLabel");
129
-
130
- const trueValue = toRef(props, "trueValue");
131
-
132
- const falseValue = toRef(props, "falseValue");
133
-
134
- const defaultValue = toRef(props, "defaultValue");
135
-
136
- const isModelTrue = computed(() => {
137
- return modelValue.value === trueValue.value ||
138
- modelValue.value === "true";
139
- });
140
-
141
- const isModelFalse = computed(() => {
142
- return modelValue.value === falseValue.value ||
143
- modelValue.value === "false";
144
- });
233
+ const {
234
+ isModelDefault,
235
+ isModelFalse,
236
+ isModelTrue,
237
+ } = ModelAPI(props);
145
238
 
146
- const isModelDefault = computed(() => {
147
- return !isModelTrue.value && !isModelFalse.value;
239
+ const {
240
+ labelValueLocal,
241
+ } = LabelAPI(props, {
242
+ isModelFalse,
243
+ isModelTrue,
148
244
  });
149
245
 
150
- const labelValueLocal = computed(() => {
151
- if (isModelTrue.value) {
152
- return trueLabel.value;
153
- }
154
- if (isModelFalse.value) {
155
- return falseLabel.value;
156
- }
157
- return defaultLabel.value;
246
+ const {
247
+ isChecked,
248
+ } = CheckedAPI({
249
+ isModelFalse,
250
+ isModelTrue,
158
251
  });
159
252
 
160
- const isThreeState = toRef(props, "isThreeState");
161
-
162
- const isChecked = computed(() => {
163
- if (isModelTrue.value) {
164
- return true;
165
- }
166
- if (isModelFalse.value) {
167
- return false;
168
- }
169
- return undefined;
253
+ const {
254
+ onInput,
255
+ onKeydown,
256
+ } = OnInputAPI(props, {
257
+ changeModel,
258
+ isModelFalse,
259
+ isModelTrue,
170
260
  });
171
261
 
172
- const disabled = toRef(props, "disabled");
173
- const onInput = $event => {
174
- if (disabled.value) {
175
- return;
176
- }
177
- let model;
178
- if (isModelTrue.value) {
179
- model = falseValue.value;
180
- } else if (isThreeState.value && isModelFalse.value) {
181
- model = defaultValue.value;
182
- } else {
183
- model = trueValue.value;
184
- }
185
-
186
- changeModel({
187
- model,
188
- $event,
189
- });
190
- };
191
-
192
- const onKeydown = $event => {
193
- if ($event.key === "Enter" ||
194
- $event.keyCode === KEY_CODE_SPACE) {
195
- onInput($event);
196
- $event.stopPropagation();
197
- $event.preventDefault();
198
- }
199
- };
200
262
 
201
263
  return {
202
- componentStyleHide,
203
-
204
264
  ariaDescribedbyLocal,
205
265
  clearModel,
266
+ componentStyleHide,
206
267
  errorsId,
207
268
  hasTitle,
208
269
  helpTextId,
209
270
  htmlIdLocal,
271
+ isChecked,
210
272
  isErrors,
211
273
  isModel,
212
- onBlur,
213
- onFocus,
214
-
215
- isChecked,
216
274
  isModelDefault,
217
275
  labelValueLocal,
276
+ onBlur,
277
+ onFocus,
218
278
  onInput,
219
279
  onKeydown,
220
280
  };
@@ -0,0 +1,22 @@
1
+ import {
2
+ computed,
3
+ } from "vue";
4
+
5
+ export default function CheckedAPI({
6
+ isModelFalse = computed(() => false),
7
+ isModelTrue = computed(() => false),
8
+ }) {
9
+ const isChecked = computed(() => {
10
+ if (isModelTrue.value) {
11
+ return true;
12
+ }
13
+ if (isModelFalse.value) {
14
+ return false;
15
+ }
16
+ return undefined;
17
+ });
18
+
19
+ return {
20
+ isChecked,
21
+ };
22
+ }
@@ -0,0 +1,27 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function LabelAPI(props, {
7
+ isModelFalse = computed(() => false),
8
+ isModelTrue = computed(() => false),
9
+ }) {
10
+ const trueLabel = toRef(props, "trueLabel");
11
+ const falseLabel = toRef(props, "falseLabel");
12
+ const defaultLabel = toRef(props, "defaultLabel");
13
+
14
+ const labelValueLocal = computed(() => {
15
+ if (isModelTrue.value) {
16
+ return trueLabel.value;
17
+ }
18
+ if (isModelFalse.value) {
19
+ return falseLabel.value;
20
+ }
21
+ return defaultLabel.value;
22
+ });
23
+
24
+ return {
25
+ labelValueLocal,
26
+ };
27
+ }
@@ -0,0 +1,30 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ export default function ModelAPI(props) {
7
+ const modelValue = toRef(props, "modelValue");
8
+ const trueValue = toRef(props, "trueValue");
9
+ const falseValue = toRef(props, "falseValue");
10
+
11
+ const isModelTrue = computed(() => {
12
+ return modelValue.value === trueValue.value ||
13
+ modelValue.value === "true";
14
+ });
15
+
16
+ const isModelFalse = computed(() => {
17
+ return modelValue.value === falseValue.value ||
18
+ modelValue.value === "false";
19
+ });
20
+
21
+ const isModelDefault = computed(() => {
22
+ return !isModelTrue.value && !isModelFalse.value;
23
+ });
24
+
25
+ return {
26
+ isModelDefault,
27
+ isModelFalse,
28
+ isModelTrue,
29
+ };
30
+ }
@@ -0,0 +1,51 @@
1
+ import {
2
+ computed,
3
+ toRef,
4
+ } from "vue";
5
+
6
+ import AKeysCode from "../../../const/AKeysCode";
7
+
8
+ export default function OnInputAPI(props, {
9
+ changeModel = () => {},
10
+ isModelFalse = computed(() => false),
11
+ isModelTrue = computed(() => false),
12
+ }) {
13
+ const defaultValue = toRef(props, "defaultValue");
14
+ const disabled = toRef(props, "disabled");
15
+ const falseValue = toRef(props, "falseValue");
16
+ const isThreeState = toRef(props, "isThreeState");
17
+ const trueValue = toRef(props, "trueValue");
18
+
19
+ const onInput = $event => {
20
+ if (disabled.value) {
21
+ return;
22
+ }
23
+ let model;
24
+ if (isModelTrue.value) {
25
+ model = falseValue.value;
26
+ } else if (isThreeState.value && isModelFalse.value) {
27
+ model = defaultValue.value;
28
+ } else {
29
+ model = trueValue.value;
30
+ }
31
+
32
+ changeModel({
33
+ model,
34
+ $event,
35
+ });
36
+ };
37
+
38
+ const onKeydown = $event => {
39
+ if ($event.keyCode === AKeysCode.enter ||
40
+ $event.keyCode === AKeysCode.space) {
41
+ onInput($event);
42
+ $event.stopPropagation();
43
+ $event.preventDefault();
44
+ }
45
+ };
46
+
47
+ return {
48
+ onInput,
49
+ onKeydown,
50
+ };
51
+ }