barbican-reset 2.43.0 → 2.45.0
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/components/BrFormCheckbox/Component.vue +4 -2
- package/components/BrFormCheckboxGroup/Component.vue +9 -6
- package/components/BrFormCheckboxGroup/Demo.vue +12 -9
- package/components/BrFormInput/Component.vue +15 -14
- package/components/BrFormPassword.vue +5 -0
- package/components/BrFormRadio/Component.vue +2 -2
- package/components/BrFormRadioGroup/Component.vue +2 -1
- package/components/BrFormRadioGroup/Demo.vue +2 -2
- package/components/BrFormRow.vue +2 -2
- package/components/BrFormTextarea/Component.vue +8 -4
- package/mixins/inputs.js +37 -12
- package/package.json +1 -1
- package/scss/helpers/mixins/input/_text.scss +1 -0
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
@change="(event) => emitInputData(event, 'checkbox')"
|
|
6
6
|
:data-test="dataTest"
|
|
7
7
|
:disabled="disabled"
|
|
8
|
-
:checked="isDefault"
|
|
9
8
|
:success="success"
|
|
9
|
+
:checked="checked"
|
|
10
10
|
:id="generateID"
|
|
11
11
|
type="checkbox"
|
|
12
12
|
:table="table"
|
|
13
13
|
:value="value"
|
|
14
|
+
:name="name"
|
|
14
15
|
/>
|
|
15
16
|
<label v-if="$slots.default" :for="generateID" ref="label"><slot /></label>
|
|
16
17
|
</div>
|
|
@@ -25,10 +26,11 @@ export default {
|
|
|
25
26
|
"dataTest",
|
|
26
27
|
"disabled",
|
|
27
28
|
"success",
|
|
28
|
-
"
|
|
29
|
+
"checked",
|
|
29
30
|
"toggle",
|
|
30
31
|
"table",
|
|
31
32
|
"value",
|
|
33
|
+
"name",
|
|
32
34
|
"id",
|
|
33
35
|
],
|
|
34
36
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div role="group" :id="id">
|
|
3
3
|
<br-form-checkbox
|
|
4
|
-
v-for="({ value, text }, index) in options"
|
|
4
|
+
v-for="({ value, checked, text, name, dataTest }, index) in options"
|
|
5
5
|
@change="emitCheckboxGroupData"
|
|
6
|
+
:dataTest="dataTest"
|
|
7
|
+
:checked="checked"
|
|
6
8
|
:value="value"
|
|
9
|
+
:name="name"
|
|
7
10
|
:key="index"
|
|
8
|
-
|
|
11
|
+
>
|
|
9
12
|
{{ text }}
|
|
10
13
|
</br-form-checkbox>
|
|
11
14
|
</div>
|
|
@@ -13,18 +16,18 @@
|
|
|
13
16
|
|
|
14
17
|
<script>
|
|
15
18
|
import mixins from "../../mixins/inputs";
|
|
16
|
-
import BrFormCheckbox from "../BrFormCheckbox/Component"
|
|
19
|
+
import BrFormCheckbox from "../BrFormCheckbox/Component";
|
|
17
20
|
|
|
18
21
|
export default {
|
|
19
22
|
mixins: [mixins],
|
|
20
|
-
props: [
|
|
23
|
+
props: ["options", "name", "id", "model"],
|
|
21
24
|
components: {
|
|
22
25
|
BrFormCheckbox,
|
|
23
26
|
},
|
|
24
27
|
data() {
|
|
25
28
|
return {
|
|
26
29
|
store: this.model,
|
|
27
|
-
}
|
|
30
|
+
};
|
|
28
31
|
},
|
|
29
|
-
}
|
|
32
|
+
};
|
|
30
33
|
</script>
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div style="padding: 100px">
|
|
3
3
|
<br-form-checkbox
|
|
4
4
|
@change="({ value }) => (boolean = value)"
|
|
5
5
|
data-test="checkbox-test-data"
|
|
6
6
|
id="checkbox-id"
|
|
7
7
|
:disabled="false"
|
|
8
|
+
:toggle="true"
|
|
8
9
|
:table="false"
|
|
9
10
|
:value="true"
|
|
10
|
-
success
|
|
11
|
+
success
|
|
12
|
+
>
|
|
11
13
|
Lorem ipsum dolor sit amet.
|
|
12
14
|
</br-form-checkbox>
|
|
13
15
|
<br-form-checkbox-group
|
|
@@ -17,9 +19,10 @@
|
|
|
17
19
|
name="checkbox-name"
|
|
18
20
|
id="checkbox-id"
|
|
19
21
|
:options="options"
|
|
20
|
-
:model="model"
|
|
21
|
-
|
|
22
|
-
{{
|
|
22
|
+
:model="model"
|
|
23
|
+
/>
|
|
24
|
+
{{ boolean }}
|
|
25
|
+
{{ model.length ? model : "nothing" }}
|
|
23
26
|
</div>
|
|
24
27
|
</template>
|
|
25
28
|
|
|
@@ -30,10 +33,10 @@ export default {
|
|
|
30
33
|
boolean: false,
|
|
31
34
|
model: [],
|
|
32
35
|
options: [
|
|
33
|
-
{ text:
|
|
34
|
-
{ text:
|
|
36
|
+
{ text: "Orange text", value: "orange", checked: true },
|
|
37
|
+
{ text: "Apple text", value: "apple", checked: false },
|
|
35
38
|
],
|
|
36
|
-
}
|
|
39
|
+
};
|
|
37
40
|
},
|
|
38
|
-
}
|
|
41
|
+
};
|
|
39
42
|
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<input
|
|
3
|
+
@input="(event) => emitInputData(event, 'input')"
|
|
3
4
|
:autocomplete="autocomplete"
|
|
4
|
-
@input="emitInputData"
|
|
5
5
|
:data-test="dataTest"
|
|
6
6
|
:required="required"
|
|
7
7
|
:disabled="disabled"
|
|
@@ -10,26 +10,27 @@
|
|
|
10
10
|
:type="type"
|
|
11
11
|
:name="name"
|
|
12
12
|
:min="min"
|
|
13
|
-
:max="max"
|
|
13
|
+
:max="max"
|
|
14
|
+
/>
|
|
14
15
|
<label v-if="$slots.default" :for="generateID" ref="label"><slot /></label>
|
|
15
16
|
</template>
|
|
16
17
|
|
|
17
18
|
<script>
|
|
18
|
-
import mixins from
|
|
19
|
+
import mixins from "../../mixins/inputs";
|
|
19
20
|
|
|
20
21
|
export default {
|
|
21
22
|
mixins: [mixins],
|
|
22
23
|
props: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
"autocomplete",
|
|
25
|
+
"dataTest",
|
|
26
|
+
"required",
|
|
27
|
+
"disabled",
|
|
28
|
+
"value",
|
|
29
|
+
"name",
|
|
30
|
+
"type",
|
|
31
|
+
"min",
|
|
32
|
+
"max",
|
|
33
|
+
"id",
|
|
33
34
|
],
|
|
34
|
-
}
|
|
35
|
+
};
|
|
35
36
|
</script>
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<div class="br-form-password">
|
|
3
3
|
<input
|
|
4
4
|
:autocomplete="autocomplete"
|
|
5
|
+
:data-test="dataTest"
|
|
5
6
|
@input="inputChange"
|
|
6
7
|
:value="password"
|
|
7
8
|
name="password"
|
|
@@ -45,6 +46,10 @@ export default {
|
|
|
45
46
|
type: String,
|
|
46
47
|
default: "password",
|
|
47
48
|
},
|
|
49
|
+
dataTest: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "password-field",
|
|
52
|
+
}
|
|
48
53
|
},
|
|
49
54
|
methods: {
|
|
50
55
|
inputChange({ target }) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
@input="(event) => emitInputData(event, 'radio')"
|
|
5
5
|
:data-test="dataTest"
|
|
6
6
|
:disabled="disabled"
|
|
7
|
-
:checked="
|
|
7
|
+
:checked="checked"
|
|
8
8
|
:id="generateID"
|
|
9
9
|
:value="value"
|
|
10
10
|
type="radio"
|
|
@@ -18,6 +18,6 @@ import mixins from '../../mixins/inputs'
|
|
|
18
18
|
|
|
19
19
|
export default {
|
|
20
20
|
mixins: [mixins],
|
|
21
|
-
props: ['id', 'name', 'value', 'disabled', '
|
|
21
|
+
props: ['id', 'name', 'value', 'disabled', 'dataTest', 'checked'],
|
|
22
22
|
}
|
|
23
23
|
</script>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div role="radiogroup" :id="id">
|
|
3
3
|
<br-form-radio
|
|
4
|
-
v-for="({ value, text }, index) in options"
|
|
4
|
+
v-for="({ value, checked, text }, index) in options"
|
|
5
5
|
@change="(event) => $emit('change', event)"
|
|
6
|
+
:checked="checked"
|
|
6
7
|
:value="value"
|
|
7
8
|
:key="index"
|
|
8
9
|
:name="name">
|
|
@@ -13,8 +13,8 @@ export default {
|
|
|
13
13
|
return {
|
|
14
14
|
contactMeSelection: true,
|
|
15
15
|
yesNoOptions: [
|
|
16
|
-
{ text: 'Yes', value: true },
|
|
17
|
-
{ text: 'No', value: false },
|
|
16
|
+
{ text: 'Yes', value: true, checked: true },
|
|
17
|
+
{ text: 'No', value: false, checked: false },
|
|
18
18
|
],
|
|
19
19
|
}
|
|
20
20
|
},
|
package/components/BrFormRow.vue
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<div class="br-form-row">
|
|
3
3
|
<label v-if="label" :for="id">
|
|
4
4
|
<strong>{{ label }}</strong>
|
|
5
|
-
<span v-if="label && required"
|
|
6
|
-
><span v-if="label && optional"
|
|
5
|
+
<span v-if="label && required"> (required)</span
|
|
6
|
+
><span v-if="label && optional"> (optional)</span>
|
|
7
7
|
</label>
|
|
8
8
|
<div :class="[`content`, { editable }, { label }, { submit }, { radios }]">
|
|
9
9
|
<br-button v-if="editable" variant="input-edit" @click="$emit('edit')">
|
|
@@ -4,20 +4,24 @@
|
|
|
4
4
|
class="br-textarea form-control"
|
|
5
5
|
:placeholder="placeholder"
|
|
6
6
|
wrap="soft"
|
|
7
|
-
:id="id"
|
|
7
|
+
:id="id"
|
|
8
|
+
></textarea>
|
|
8
9
|
</template>
|
|
9
10
|
|
|
10
11
|
<script>
|
|
11
|
-
import mixins from
|
|
12
|
+
import mixins from "../../mixins/inputs";
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
mixins: [mixins],
|
|
15
|
-
props: [
|
|
16
|
-
}
|
|
16
|
+
props: ["id", "value", "disabled", "placeholder"],
|
|
17
|
+
};
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
20
|
<style lang="scss" scoped>
|
|
20
21
|
.br-textarea {
|
|
22
|
+
font-family: inherit;
|
|
23
|
+
display: block;
|
|
21
24
|
resize: none;
|
|
25
|
+
width: 100%;
|
|
22
26
|
}
|
|
23
27
|
</style>
|
package/mixins/inputs.js
CHANGED
|
@@ -5,26 +5,51 @@ export default {
|
|
|
5
5
|
|
|
6
6
|
return this.id ? this.id : random;
|
|
7
7
|
},
|
|
8
|
-
isDefault() {
|
|
9
|
-
return this.default == this.value;
|
|
10
|
-
},
|
|
11
8
|
},
|
|
12
9
|
methods: {
|
|
13
|
-
emitInputData({ target }, name
|
|
10
|
+
emitInputData({ target }, name) {
|
|
14
11
|
let { value, checked } = target;
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
if (this.name) name = this.name;
|
|
14
|
+
|
|
15
|
+
if (this.toggle) value = checked;
|
|
16
|
+
|
|
17
|
+
if (value === "true") value = true;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
if (value === "false") value = false;
|
|
19
20
|
|
|
20
|
-
console.log({
|
|
21
|
+
console.log({ name, value });
|
|
21
22
|
|
|
22
|
-
this.$emit("change", {
|
|
23
|
+
this.$emit("change", { name, value, checked });
|
|
23
24
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
findItemInStore(store, option) {
|
|
26
|
+
let alreadyExists = false;
|
|
27
|
+
|
|
28
|
+
store.forEach(function (item) {
|
|
29
|
+
if (item.name == option.name) {
|
|
30
|
+
if (item.value == option.value) alreadyExists = true;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return alreadyExists;
|
|
35
|
+
},
|
|
36
|
+
removeItemFromStore(store, option) {
|
|
37
|
+
return store.filter(function (item) {
|
|
38
|
+
if (item.name == option.name) {
|
|
39
|
+
if (item.value == option.value) return false;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
emitCheckboxGroupData(option) {
|
|
45
|
+
let alreadyExists = this.findItemInStore(this.store, option);
|
|
46
|
+
|
|
47
|
+
if (option.checked) {
|
|
48
|
+
delete option.checked;
|
|
49
|
+
if (!alreadyExists) this.store.push(option);
|
|
50
|
+
} else this.store = this.removeItemFromStore(this.store, option);
|
|
51
|
+
|
|
52
|
+
console.log("store: ", this.store);
|
|
28
53
|
|
|
29
54
|
this.$emit("change", this.store);
|
|
30
55
|
},
|
package/package.json
CHANGED