aloha-vue 1.0.301 → 1.0.303
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/src/views/PageInputNumber/PageInputNumber.js +3 -2
- package/docs/src/views/PageInputNumber/PageInputNumber.pug +34 -36
- package/package.json +1 -1
- package/src/ALink/ALink.js +11 -1
- package/src/ALink/compositionAPI/ClickAPI.js +29 -0
- package/src/AMenu/AMenu.js +2 -0
- package/src/AMenu/compositionAPI/AMenuPanelsAPI.js +6 -0
- package/src/ui/AInputNumber/AInputNumber.js +2 -2
- package/src/ui/AInputNumber/compositionAPI/InputEventsAPI.js +36 -0
- package/src/ui/AInputNumber/compositionAPI/MinAPI.js +10 -7
- package/src/ui/AUiComponents.js +2 -0
|
@@ -1,52 +1,50 @@
|
|
|
1
1
|
div
|
|
2
|
-
h1
|
|
3
|
-
h2
|
|
2
|
+
h1 Input number
|
|
3
|
+
h2 type "number"
|
|
4
4
|
a-input-number(
|
|
5
5
|
id="input1"
|
|
6
6
|
v-model="model1"
|
|
7
|
-
type="
|
|
7
|
+
type="number"
|
|
8
8
|
label="Input 1"
|
|
9
9
|
:required="true"
|
|
10
10
|
:step="2"
|
|
11
11
|
errors="not valid"
|
|
12
12
|
)
|
|
13
13
|
div model1: {{ model1 }}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
h2 type "integer-non-negative"
|
|
15
|
+
a-input-number(
|
|
16
|
+
id="input2"
|
|
17
|
+
v-model="model2"
|
|
18
|
+
type="integer-non-negative"
|
|
19
|
+
label="Input 2"
|
|
20
|
+
:required="true"
|
|
21
|
+
:step="2"
|
|
22
|
+
:disabled="true"
|
|
23
|
+
)
|
|
24
|
+
div model2: {{ model2 }}
|
|
25
|
+
h2 type "integer-positive"
|
|
26
|
+
a-input-number(
|
|
27
|
+
id="input3"
|
|
28
|
+
v-model="model3"
|
|
29
|
+
type="integer-positive"
|
|
30
|
+
label="Input 3"
|
|
31
|
+
:required="true"
|
|
32
|
+
:step="3"
|
|
33
|
+
)
|
|
34
|
+
div model3: {{ model3 }}
|
|
35
|
+
h2 type "integer"
|
|
36
|
+
a-input-number(
|
|
37
|
+
id="input4"
|
|
38
|
+
v-model="model4"
|
|
39
|
+
type="integer"
|
|
40
|
+
label="Input 4"
|
|
41
|
+
:required="true"
|
|
42
|
+
:step="4"
|
|
43
|
+
)
|
|
44
|
+
div model4: {{ model4 }}
|
|
25
45
|
input(
|
|
26
46
|
type="number"
|
|
27
47
|
)
|
|
28
|
-
//h2 Textarea
|
|
29
|
-
//a-textarea(
|
|
30
|
-
// id="textarea1"
|
|
31
|
-
// v-model="model2"
|
|
32
|
-
// type="text"
|
|
33
|
-
// label="Textarea 1"
|
|
34
|
-
// :required="true"
|
|
35
|
-
// :is-scalable="true"
|
|
36
|
-
//)
|
|
37
|
-
//div model2:
|
|
38
|
-
//pre {{ model2 }}
|
|
39
|
-
//
|
|
40
|
-
//h2 Textarea 2
|
|
41
|
-
// a-textarea(
|
|
42
|
-
// id="textarea3"
|
|
43
|
-
// v-model="model3"
|
|
44
|
-
// type="text"
|
|
45
|
-
// label="Textarea 2"
|
|
46
|
-
// :required="true"
|
|
47
|
-
// )
|
|
48
|
-
// div model3:
|
|
49
|
-
// pre {{ model3 }}
|
|
50
48
|
button.a_btn.a_btn_primary() Temp
|
|
51
49
|
|
|
52
50
|
|
package/package.json
CHANGED
package/src/ALink/ALink.js
CHANGED
|
@@ -7,6 +7,7 @@ import AIcon from "../AIcon/AIcon";
|
|
|
7
7
|
import ASpinner from "../ASpinner/ASpinner";
|
|
8
8
|
import ATranslation from "../ATranslation/ATranslation";
|
|
9
9
|
|
|
10
|
+
import ClickAPI from "./compositionAPI/ClickAPI";
|
|
10
11
|
import LoadingAPI from "../AButton/comositionAPI/LoadingAPI";
|
|
11
12
|
import TextAPI from "../AButton/comositionAPI/TextAPI";
|
|
12
13
|
import TitleAPI from "../AButton/comositionAPI/TitleAPI";
|
|
@@ -136,7 +137,10 @@ export default {
|
|
|
136
137
|
default: undefined,
|
|
137
138
|
},
|
|
138
139
|
},
|
|
139
|
-
|
|
140
|
+
emits: [
|
|
141
|
+
"click",
|
|
142
|
+
],
|
|
143
|
+
setup(props, context) {
|
|
140
144
|
const {
|
|
141
145
|
isTitleVisible,
|
|
142
146
|
} = TitleAPI(props);
|
|
@@ -151,6 +155,10 @@ export default {
|
|
|
151
155
|
isTextVisible,
|
|
152
156
|
} = TextAPI(props);
|
|
153
157
|
|
|
158
|
+
const {
|
|
159
|
+
onClick,
|
|
160
|
+
} = ClickAPI(props, context);
|
|
161
|
+
|
|
154
162
|
return {
|
|
155
163
|
isLoadingLeft,
|
|
156
164
|
isLoadingRight,
|
|
@@ -226,6 +234,7 @@ export default {
|
|
|
226
234
|
},
|
|
227
235
|
],
|
|
228
236
|
ariaDisabled: this.disabled,
|
|
237
|
+
onClick: this.onClick,
|
|
229
238
|
}, CHILDREN);
|
|
230
239
|
}
|
|
231
240
|
if (this.to) {
|
|
@@ -241,6 +250,7 @@ export default {
|
|
|
241
250
|
},
|
|
242
251
|
],
|
|
243
252
|
ariaDisabled: this.disabled,
|
|
253
|
+
onClick: this.onClick,
|
|
244
254
|
}, () => CHILDREN);
|
|
245
255
|
}
|
|
246
256
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toRef,
|
|
3
|
+
} from "vue";
|
|
4
|
+
|
|
5
|
+
export default function ClickAPI(props, { emit }) {
|
|
6
|
+
const onClick = $event => {
|
|
7
|
+
const prevent = toRef(props, "prevent");
|
|
8
|
+
const stop = toRef(props, "stop");
|
|
9
|
+
const disabled = toRef(props, "disabled");
|
|
10
|
+
|
|
11
|
+
if (prevent.value) {
|
|
12
|
+
$event.preventDefault();
|
|
13
|
+
}
|
|
14
|
+
if (stop.value) {
|
|
15
|
+
$event.stopPropagation();
|
|
16
|
+
}
|
|
17
|
+
if (disabled.value) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
emit("click", {
|
|
21
|
+
props,
|
|
22
|
+
$event,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
onClick,
|
|
28
|
+
};
|
|
29
|
+
}
|
package/src/AMenu/AMenu.js
CHANGED
|
@@ -186,6 +186,7 @@ export default {
|
|
|
186
186
|
clickMenuLink,
|
|
187
187
|
closeAllPanels,
|
|
188
188
|
panelParentsOpen,
|
|
189
|
+
setDefaultMenu,
|
|
189
190
|
togglePanel,
|
|
190
191
|
} = AMenuPanelsAPI(props, {
|
|
191
192
|
dataProParent,
|
|
@@ -232,6 +233,7 @@ export default {
|
|
|
232
233
|
modelSearch,
|
|
233
234
|
panelParentsOpen,
|
|
234
235
|
removeBodyClasses,
|
|
236
|
+
setDefaultMenu,
|
|
235
237
|
toggleMenu,
|
|
236
238
|
togglePanel,
|
|
237
239
|
updateModelSearch,
|
|
@@ -121,6 +121,11 @@ export default function AMenuPanelsAPI(props, {
|
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
+
const setDefaultMenu = () => {
|
|
125
|
+
resetSearch();
|
|
126
|
+
panelParentsOpen.value = [];
|
|
127
|
+
};
|
|
128
|
+
|
|
124
129
|
watch($router.currentRoute, () => {
|
|
125
130
|
if (isMenuLinkClicked.value) {
|
|
126
131
|
isMenuLinkClicked.value = false;
|
|
@@ -135,6 +140,7 @@ export default function AMenuPanelsAPI(props, {
|
|
|
135
140
|
clickMenuLink,
|
|
136
141
|
closeAllPanels,
|
|
137
142
|
panelParentsOpen,
|
|
143
|
+
setDefaultMenu,
|
|
138
144
|
togglePanel
|
|
139
145
|
};
|
|
140
146
|
}
|
|
@@ -50,8 +50,8 @@ export default {
|
|
|
50
50
|
type: String,
|
|
51
51
|
required: false,
|
|
52
52
|
default: "number",
|
|
53
|
-
validator: value => ["number", "integer-non-negative"].indexOf(value) !== -1,
|
|
54
|
-
// TODO: "
|
|
53
|
+
validator: value => ["number", "integer-non-negative", "integer-positive", "integer"].indexOf(value) !== -1,
|
|
54
|
+
// TODO: "float", "float-positiv", "float-non-negative"
|
|
55
55
|
},
|
|
56
56
|
iconPrepend: {
|
|
57
57
|
type: String,
|
|
@@ -82,6 +82,42 @@ export default function InputEventsAPI(props, {
|
|
|
82
82
|
setCurrentValue(newValue);
|
|
83
83
|
inputRef.value.value = newValue;
|
|
84
84
|
// TODO: cursor position
|
|
85
|
+
} else if (type.value === "integer-positive") {
|
|
86
|
+
if (newValue === "0") {
|
|
87
|
+
newValue = null;
|
|
88
|
+
} else {
|
|
89
|
+
const matches = newValue.match(/\d+/g);
|
|
90
|
+
let extractedValue = 0;
|
|
91
|
+
if (matches !== null) {
|
|
92
|
+
extractedValue = parseInt(matches.join(""), 10);
|
|
93
|
+
extractedValue = Math.max(extractedValue, 1);
|
|
94
|
+
newValue = extractedValue;
|
|
95
|
+
} else {
|
|
96
|
+
newValue = null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
setCurrentValue(newValue);
|
|
101
|
+
inputRef.value.value = newValue;
|
|
102
|
+
} else if (type.value === "integer") {
|
|
103
|
+
const matches = newValue.match(/\d+/g);
|
|
104
|
+
let extractedValue = 0;
|
|
105
|
+
if (matches !== null) {
|
|
106
|
+
extractedValue = parseInt(matches.join(""), 10);
|
|
107
|
+
if (newValue.indexOf("-") !== -1) {
|
|
108
|
+
extractedValue = -extractedValue;
|
|
109
|
+
}
|
|
110
|
+
newValue = extractedValue;
|
|
111
|
+
setCurrentValue(newValue);
|
|
112
|
+
inputRef.value.value = newValue;
|
|
113
|
+
} else if (newValue === "-") {
|
|
114
|
+
newValue = "-";
|
|
115
|
+
inputRef.value.value = newValue;
|
|
116
|
+
} else {
|
|
117
|
+
newValue = null;
|
|
118
|
+
setCurrentValue(newValue);
|
|
119
|
+
inputRef.value.value = newValue;
|
|
120
|
+
}
|
|
85
121
|
}
|
|
86
122
|
};
|
|
87
123
|
const handleInputChange = $event => {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
isNil,
|
|
8
|
+
isUndefined,
|
|
8
9
|
} from "lodash-es";
|
|
9
10
|
|
|
10
11
|
export default function MinAPI(props) {
|
|
@@ -12,15 +13,17 @@ export default function MinAPI(props) {
|
|
|
12
13
|
const min = toRef(props, "min");
|
|
13
14
|
|
|
14
15
|
const minLocal = computed(() => {
|
|
16
|
+
let minComputed;
|
|
15
17
|
if (type.value === "integer-non-negative") {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (min.value > 0) {
|
|
20
|
-
return min.value;
|
|
21
|
-
}
|
|
18
|
+
minComputed = 0;
|
|
19
|
+
} else if (type.value === "integer-positive") {
|
|
20
|
+
minComputed = 1;
|
|
22
21
|
}
|
|
23
|
-
|
|
22
|
+
if (isUndefined(minComputed) ||
|
|
23
|
+
!isNil(min.value) && min.value > minComputed) {
|
|
24
|
+
minComputed = min.value;
|
|
25
|
+
}
|
|
26
|
+
return minComputed;
|
|
24
27
|
});
|
|
25
28
|
|
|
26
29
|
return {
|
package/src/ui/AUiComponents.js
CHANGED