frayerjj-frontend 0.8.36 → 0.8.37
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/package.json +1 -1
- package/src/hasMany.js +18 -8
- package/src/scss/_tokenfield.scss +26 -0
package/package.json
CHANGED
package/src/hasMany.js
CHANGED
|
@@ -25,13 +25,17 @@ export const hasMany = {
|
|
|
25
25
|
msg.verbose('Building Has Many Inupt');
|
|
26
26
|
// Create container
|
|
27
27
|
let container = document.createElement('div');
|
|
28
|
+
container.className = 'hasmany';
|
|
29
|
+
// Create card wrapper
|
|
30
|
+
let card = document.createElement('div');
|
|
31
|
+
card.className = 'card';
|
|
28
32
|
// Create list of selected items
|
|
29
33
|
let list = document.createElement('ul');
|
|
30
34
|
list.id = 'id_' + args.name;
|
|
31
|
-
list.className = 'list-group list-group-flush';
|
|
35
|
+
list.className = 'list-group list-group-flush hasmany-selected-list';
|
|
32
36
|
// Create list of all options for modal
|
|
33
37
|
let modalList = document.createElement('ul');
|
|
34
|
-
modalList.className = 'list-group list-group-flush';
|
|
38
|
+
modalList.className = 'list-group list-group-flush hasmany-modal-list';
|
|
35
39
|
// Create hidden input for when there is no selected items
|
|
36
40
|
let input = document.createElement('input');
|
|
37
41
|
input.type = 'hidden';
|
|
@@ -61,14 +65,19 @@ export const hasMany = {
|
|
|
61
65
|
// Create button to open modal
|
|
62
66
|
let button = document.createElement('button');
|
|
63
67
|
button.type = 'button';
|
|
64
|
-
button.className = 'btn btn-outline-secondary
|
|
68
|
+
button.className = 'btn btn-outline-secondary w-100';
|
|
65
69
|
button.setAttribute('data-bs-toggle', 'modal');
|
|
66
70
|
button.setAttribute('data-bs-target', '#' + randomId);
|
|
67
71
|
button.textContent = args.messages?.button ?? hasMany.sampleArgs.messages.button;
|
|
72
|
+
// Create card footer for action button
|
|
73
|
+
let footer = document.createElement('div');
|
|
74
|
+
footer.className = 'card-footer bg-transparent';
|
|
75
|
+
footer.appendChild(button);
|
|
68
76
|
// Add elements to container
|
|
69
77
|
container.appendChild(input);
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
card.appendChild(list);
|
|
79
|
+
card.appendChild(footer);
|
|
80
|
+
container.appendChild(card);
|
|
72
81
|
// Return container
|
|
73
82
|
return container.outerHTML;
|
|
74
83
|
},
|
|
@@ -76,10 +85,10 @@ export const hasMany = {
|
|
|
76
85
|
checkItem: (name, option) => {
|
|
77
86
|
// Create list item
|
|
78
87
|
let item = document.createElement('li');
|
|
79
|
-
item.className = 'list-group-item';
|
|
88
|
+
item.className = 'list-group-item hasmany-check-item';
|
|
80
89
|
// Create checkbox
|
|
81
90
|
let input = document.createElement('input');
|
|
82
|
-
input.classList.add('form-check-input');
|
|
91
|
+
input.classList.add('form-check-input', 'mt-0');
|
|
83
92
|
if (option.notb)
|
|
84
93
|
input.classList.add('hasmany-' + name + 'notb');
|
|
85
94
|
else
|
|
@@ -92,6 +101,7 @@ export const hasMany = {
|
|
|
92
101
|
item.appendChild(input);
|
|
93
102
|
// Create label
|
|
94
103
|
let label = document.createElement('label');
|
|
104
|
+
label.className = 'form-check-label ms-2 flex-grow-1';
|
|
95
105
|
label.setAttribute('for', name + option.id);
|
|
96
106
|
label.textContent = option.label;
|
|
97
107
|
item.appendChild(label);
|
|
@@ -103,7 +113,7 @@ export const hasMany = {
|
|
|
103
113
|
let item = document.createElement('li');
|
|
104
114
|
item.id = 'id_' + name + '_' + option.id;
|
|
105
115
|
item.textContent = option.label;
|
|
106
|
-
item.className = 'list-group-item';
|
|
116
|
+
item.className = 'list-group-item hasmany-selected-item';
|
|
107
117
|
// Create hidden input
|
|
108
118
|
let input = document.createElement('input');
|
|
109
119
|
input.type = 'hidden';
|
|
@@ -33,3 +33,29 @@
|
|
|
33
33
|
right: .45rem;
|
|
34
34
|
font-size: 18pt;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
.hasmany {
|
|
38
|
+
.card {
|
|
39
|
+
border-color: var(--bs-border-color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.card-footer {
|
|
43
|
+
padding: 0.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.hasmany-selected-list .list-group-item {
|
|
47
|
+
padding-top: 0.5rem;
|
|
48
|
+
padding-bottom: 0.5rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.hasmany-selected-item {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.hasmany-check-item {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
}
|