@avakhula/ui 0.0.225 → 0.0.227

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@avakhula/ui",
3
- "version": "0.0.225",
3
+ "version": "0.0.227",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.umd.cjs",
6
6
  "source": "src/index.js",
package/src/App.vue CHANGED
@@ -1,35 +1,131 @@
1
1
  <template>
2
- <ib-tabs>
2
+ <ib-select :options="opt"/>
3
3
 
4
- <ib-tab v-for="availableType in availableTypes" id="my-profile" title="My profile">
5
- <p>My profile content</p>
6
- </ib-tab>
7
-
8
-
9
-
10
- <ib-tab
11
- id="account-settings"
12
- title="Account settings"
13
- >
14
- <p>Account settings content</p>
15
- </ib-tab>
16
-
17
- </ib-tabs>
18
4
  </template>
19
5
 
20
6
  <script>
21
- import IbTabs from "./components/Tabs/Tabs.vue"
22
- import IbTab from "./components/Tabs/Tab.vue"
7
+ import IbSelect from "./components/TreeSelect/Select.vue";
8
+ const testData1 = [
9
+ {
10
+ id: "1",
11
+ title: "A Education",
12
+ is_category: true,
13
+ initiallyVisible: true,
14
+ visible: true,
15
+ isDisabled: false,
16
+ checked: true,
17
+ isChildrenVisible: true,
18
+ },
19
+ {
20
+ id: "2",
21
+ title: "Education 2",
22
+ is_category: true,
23
+ initiallyVisible: true,
24
+ visible: true,
25
+ isDisabled: false,
26
+ checked: false,
27
+ isChildrenVisible: true,
28
+ },
29
+ {
30
+ id: "3",
31
+ title: "Education 3",
32
+ is_category: true,
33
+ initiallyVisible: true,
34
+ visible: true,
35
+ isDisabled: false,
36
+ checked: false,
37
+ isChildrenVisible: true,
38
+ },
39
+ {
40
+ id: "4",
41
+ title: "Education 4",
42
+ is_category: true,
43
+ initiallyVisible: true,
44
+ visible: true,
45
+ isDisabled: false,
46
+ checked: false,
47
+ isChildrenVisible: true,
48
+ },
49
+ {
50
+ id: "5",
51
+ title: "Education 5",
52
+ is_category: true,
53
+ initiallyVisible: true,
54
+ visible: true,
55
+ isDisabled: false,
56
+ checked: false,
57
+ isChildrenVisible: true,
58
+ },
23
59
 
60
+ {
61
+ id: "6",
62
+ title: "Education 6",
63
+ is_category: true,
64
+ initiallyVisible: true,
65
+ visible: true,
66
+ isDisabled: false,
67
+ checked: false,
68
+ isChildrenVisible: true,
69
+ },
70
+
71
+ {
72
+ id: "7",
73
+ title: "Education 7",
74
+ is_category: true,
75
+ initiallyVisible: true,
76
+ visible: true,
77
+ isDisabled: false,
78
+ checked: false,
79
+ isChildrenVisible: true,
80
+ },
81
+
82
+ {
83
+ id: "8",
84
+ title: "Education 8",
85
+ is_category: true,
86
+ initiallyVisible: true,
87
+ visible: true,
88
+ isDisabled: false,
89
+ checked: false,
90
+ isChildrenVisible: true,
91
+ },
92
+ {
93
+ id: "9",
94
+ title: "Education 9",
95
+ is_category: true,
96
+ initiallyVisible: true,
97
+ visible: true,
98
+ isDisabled: false,
99
+ checked: false,
100
+ isChildrenVisible: true,
101
+ },
102
+ {
103
+ id: "10",
104
+ title: "Education 10",
105
+ is_category: true,
106
+ initiallyVisible: true,
107
+ visible: true,
108
+ isDisabled: false,
109
+ checked: false,
110
+ isChildrenVisible: true,
111
+ },
112
+ {
113
+ id: "11",
114
+ title: "Education 11",
115
+ is_category: true,
116
+ initiallyVisible: true,
117
+ visible: true,
118
+ isDisabled: false,
119
+ checked: false,
120
+ isChildrenVisible: true,
121
+ },
122
+ ];
24
123
  export default {
25
124
  data() {
26
125
  return {
27
- availableTypes: [1,2,3,4]
126
+ opt: testData1,
28
127
  }
29
128
  },
30
- components: {
31
- IbTabs,
32
- IbTab
33
- }
129
+ components: {IbSelect}
34
130
  }
35
131
  </script>
@@ -91,6 +91,7 @@ export default {
91
91
  return getHrefFromId(id);
92
92
  },
93
93
  selectTab(id) {
94
+ this.$emit('changeTab', id);
94
95
  this.selectedTab = id;
95
96
  },
96
97
  },
@@ -1,241 +1,244 @@
1
1
  <template>
2
- <ib-alert class="tree-select-error" v-if="errorMessage">
3
- {{ errorMessage }}
4
- </ib-alert>
5
-
6
- <div class="tree-select" :class="classList">
7
- <ib-dropdown
8
- :disabled="isLoading"
9
- :is-resizable="isResizable"
10
- :vertical="vertical"
11
- ref="dropdown"
12
- @close="onClose"
13
- @open="isOpen = true"
14
- >
15
- <template v-if="hasTrigger" v-slot:trigger>
16
- <slot v-bind:selected-count="selectedKeys.length" name="trigger"></slot>
17
- </template>
18
-
19
- <template v-else v-slot:trigger="{ isOpened }">
20
- <div
21
- role="combobox"
22
- tabindex="0"
23
- class="tree-choice"
24
- ref="combobox"
25
- @click.prevent
26
- @blur="onBlur"
27
- @keyup.down="comboboxKeyupDown"
28
- @keyup.up="comboboxKeyupDown"
29
- :aria-label="ariaLabel"
30
- :aria-activedescendant="focusedOptionId"
31
- :class="{
32
- 'tree-choice-opened': isOpened,
33
- 'has-clear-button': !showClearButton,
34
- 'tree-choice-error': errorMessage,
35
- }"
36
- >
37
- <template v-if="htmlOptionTitle">
38
- <span
39
- :class="{ placeholder: !selectStatus }"
40
- v-html="selectStatus || placeholder"
41
- ></span>
42
- </template>
43
- <template v-else>
44
- <span :class="{ placeholder: !selectStatus }">
45
- {{ selectStatus || placeholder }}
46
- </span>
47
- </template>
48
- </div>
49
- <ib-icon-button
50
- v-if="showClearButton"
51
- kind="ghost"
52
- class="button-clear"
53
- @click.prevent="clearValue"
54
- :help-text="clearButtonMessage"
55
- v-show="Object.keys(selected).length"
56
- >
57
- <ib-icon name="close-outline"></ib-icon>
58
- </ib-icon-button>
59
-
60
- <ib-icon
61
- :name="isOpened ? 'chevron-up-outline' : 'chevron-down-outline'"
62
- :classes="'tree-select-caret'"
63
- />
64
- </template>
65
-
66
- <template v-slot:body>
67
- <div
68
- class="tree-drop"
69
- :class="{ 'not-tree-child': !hasTreeChildren }"
70
- :style="treeDropPos"
71
- >
2
+ <div class="tree-select-wrapper">
3
+ <ib-alert class="tree-select-error" v-if="errorMessage">
4
+ {{ errorMessage }}
5
+ </ib-alert>
6
+
7
+ <div class="tree-select" :class="classList">
8
+ <ib-dropdown
9
+ :disabled="isLoading"
10
+ :is-resizable="isResizable"
11
+ :vertical="vertical"
12
+ ref="dropdown"
13
+ @close="onClose"
14
+ @open="isOpen = true"
15
+ >
16
+ <template v-if="hasTrigger" v-slot:trigger>
17
+ <slot v-bind:selected-count="selectedKeys.length" name="trigger"></slot>
18
+ </template>
19
+
20
+ <template v-else v-slot:trigger="{ isOpened }">
72
21
  <div
73
- v-if="isResizable"
74
- class="ib-dropdown-resizer ib-dropdown-resizer-left"
75
- @mousedown="startResizing('left')"
76
- ></div>
77
- <div
78
- v-if="isResizable"
79
- class="ib-dropdown-resizer ib-dropdown-resizer-right"
80
- @mousedown="startResizing('right')"
81
- ></div>
82
- <list
83
- :class="{ 'has-hierarchy': hasHierarchy }"
84
- v-if="Object.keys(actualBookmarkedOptions).length > 0"
22
+ role="combobox"
23
+ tabindex="0"
24
+ class="tree-choice"
25
+ ref="combobox"
26
+ @click.prevent
27
+ @blur="onBlur"
28
+ @keyup.down="comboboxKeyupDown"
29
+ @keyup.up="comboboxKeyupDown"
30
+ :aria-label="ariaLabel"
31
+ :aria-activedescendant="focusedOptionId"
32
+ :class="{
33
+ 'tree-choice-opened': isOpened,
34
+ 'has-clear-button': !showClearButton,
35
+ 'tree-choice-error': errorMessage,
36
+ }"
85
37
  >
86
- <select-option
87
- :key="'bookmark' + option.id"
88
- v-for="option in actualBookmarkedOptions"
89
- :option="option"
90
- :parent-auto-check="false"
91
- :is-multiple="isMultiple"
92
- :is-bookmarkable="true"
93
- :is-bookmarked="true"
94
- @check="registerCheck"
95
- @toggle-bookmark="toggleBookmark"
96
- :uid="uid"
97
- :only-end-nodes="onlyEndNodes"
98
- :html-title="htmlOptionTitle"
99
- :show-input="showInputs"
100
- ></select-option>
101
- </list>
102
-
103
- <ib-input
104
- class="tree-search"
105
- v-if="showSearch"
106
- ref="search"
107
- :show-icon="true"
108
- :value="filterString"
109
- :aria-label="
110
- searchPlaceholderText
111
- ? searchPlaceholderText
112
- : actualStrings.searchPlaceholder"
113
- :placeholder="
114
- searchPlaceholderText
115
- ? searchPlaceholderText
116
- : actualStrings.searchPlaceholder
117
- "
118
- @input="filter($event, actualOptions)"
119
- @keyup.down="inputKeyupDown"
120
- ></ib-input>
121
-
122
- <list
123
- ref="list"
124
- role="listbox"
125
- :class="{ 'tree-select-list': true, 'has-hierarchy': hasHierarchy }"
38
+ <template v-if="htmlOptionTitle">
39
+ <span
40
+ :class="{ placeholder: !selectStatus }"
41
+ v-html="selectStatus || placeholder"
42
+ ></span>
43
+ </template>
44
+ <template v-else>
45
+ <span :class="{ placeholder: !selectStatus }">
46
+ {{ selectStatus || placeholder }}
47
+ </span>
48
+ </template>
49
+ </div>
50
+ <ib-icon-button
51
+ v-if="showClearButton"
52
+ kind="ghost"
53
+ class="button-clear"
54
+ @click.prevent="clearValue"
55
+ :help-text="clearButtonMessage"
56
+ v-show="Object.keys(selected).length"
57
+ >
58
+ <ib-icon name="close-outline"></ib-icon>
59
+ </ib-icon-button>
60
+
61
+ <ib-icon
62
+ :name="isOpened ? 'chevron-up-outline' : 'chevron-down-outline'"
63
+ :classes="'tree-select-caret'"
64
+ />
65
+ </template>
66
+
67
+ <template v-slot:body>
68
+ <div
69
+ class="tree-drop"
70
+ :class="{ 'not-tree-child': !hasTreeChildren }"
71
+ :style="treeDropPos"
126
72
  >
127
73
  <div
128
- v-if="
129
- !requiredDependencyNotFilled &&
130
- !visibleOptionsCount &&
131
- hasEmptyMessage
132
- "
133
- class="tree-select-empty"
134
- >
135
- <slot name="emptyMessage"></slot>
136
- </div>
74
+ v-if="isResizable"
75
+ class="ib-dropdown-resizer ib-dropdown-resizer-left"
76
+ @mousedown="startResizing('left')"
77
+ ></div>
137
78
  <div
138
- v-else-if="!requiredDependencyNotFilled && !visibleOptionsCount"
139
- class="tree-select-default-empty tree-select-empty"
140
- >
141
- {{ actualStrings.emptyTitle }}
142
- </div>
143
- <div v-show="requiredDependencyNotFilled" class="tree-select-empty">
144
- {{ actualStrings.requiredDependencyNotFilled }}
145
- </div>
146
-
147
- <template
148
- v-if="!isMultiple && !isRequired && actualOptions.length > 0"
79
+ v-if="isResizable"
80
+ class="ib-dropdown-resizer ib-dropdown-resizer-right"
81
+ @mousedown="startResizing('right')"
82
+ ></div>
83
+ <list
84
+ :class="{ 'has-hierarchy': hasHierarchy }"
85
+ v-if="Object.keys(actualBookmarkedOptions).length > 0"
149
86
  >
150
87
  <select-option
151
- :option="{
152
- title: lang('none', 'select'),
153
- id: null,
154
- checked: isEmpty,
155
- }"
156
- :name="actualName"
157
- :parent-auto-check="parentAutoCheck"
88
+ :key="'bookmark' + option.id"
89
+ v-for="option in actualBookmarkedOptions"
90
+ :option="option"
91
+ :parent-auto-check="false"
158
92
  :is-multiple="isMultiple"
93
+ :is-bookmarkable="true"
94
+ :is-bookmarked="true"
159
95
  @check="registerCheck"
160
96
  @toggle-bookmark="toggleBookmark"
161
97
  :uid="uid"
162
98
  :only-end-nodes="onlyEndNodes"
99
+ :html-title="htmlOptionTitle"
163
100
  :show-input="showInputs"
164
101
  ></select-option>
165
- </template>
166
-
167
- <template v-if="!requiredDependencyNotFilled">
168
- <template
102
+ </list>
103
+
104
+ <ib-input
105
+ class="tree-search"
106
+ v-if="showSearch"
107
+ ref="search"
108
+ :show-icon="true"
109
+ :value="filterString"
110
+ :aria-label="
111
+ searchPlaceholderText
112
+ ? searchPlaceholderText
113
+ : actualStrings.searchPlaceholder"
114
+ :placeholder="
115
+ searchPlaceholderText
116
+ ? searchPlaceholderText
117
+ : actualStrings.searchPlaceholder
118
+ "
119
+ @input="filter($event, actualOptions)"
120
+ @keyup.down="inputKeyupDown"
121
+ ></ib-input>
122
+
123
+ <list
124
+ ref="list"
125
+ role="listbox"
126
+ :class="{ 'tree-select-list': true, 'has-hierarchy': hasHierarchy }"
127
+ >
128
+ <div
169
129
  v-if="
170
- allOptions &&
171
- isMultiple &&
172
- visibleOptionsCount &&
173
- !requiredDependencyNotFilled
130
+ !requiredDependencyNotFilled &&
131
+ !visibleOptionsCount &&
132
+ hasEmptyMessage
174
133
  "
134
+ class="tree-select-empty"
135
+ >
136
+ <slot name="emptyMessage"></slot>
137
+ </div>
138
+ <div
139
+ v-else-if="!requiredDependencyNotFilled && !visibleOptionsCount"
140
+ class="tree-select-default-empty tree-select-empty"
141
+ >
142
+ {{ actualStrings.emptyTitle }}
143
+ </div>
144
+ <div v-show="requiredDependencyNotFilled" class="tree-select-empty">
145
+ {{ actualStrings.requiredDependencyNotFilled }}
146
+ </div>
147
+
148
+ <template
149
+ v-if="!isMultiple && !isRequired && actualOptions.length > 0"
175
150
  >
176
151
  <select-option
177
152
  :option="{
178
- title: actualStrings.selectAllOptions,
179
- id: '!all!',
180
- initiallyVisible: true,
181
- visible: true,
182
- isDisabled: visibleOptionsCount < optionsCount,
183
- checked: allOptionsIsChecked,
184
- isIndeterminate: Object.keys(selected).length
185
- ? true
186
- : false,
153
+ title: lang('none', 'select'),
154
+ id: null,
155
+ checked: isEmpty,
187
156
  }"
188
- :is-toggle="isToggle"
189
157
  :name="actualName"
190
- :parent-auto-check="false"
158
+ :parent-auto-check="parentAutoCheck"
191
159
  :is-multiple="isMultiple"
192
- :is-bookmarkable="false"
160
+ @check="registerCheck"
161
+ @toggle-bookmark="toggleBookmark"
193
162
  :uid="uid"
194
163
  :only-end-nodes="onlyEndNodes"
195
164
  :show-input="showInputs"
196
- @check="manageAll"
197
- @on-focus="(id) => focusedOptionId = id"
198
165
  ></select-option>
199
166
  </template>
200
167
 
201
- <template
202
- v-for="option in actualOptions"
203
- :key="name + option.value"
204
- >
205
- <slot
206
- :option="option"
207
- :name="actualName"
208
- :parent-auto-check="parentAutoCheck"
209
- :is-multiple="isMultiple"
210
- :uid="uid"
211
- :only-end-nodes="onlyEndNodes"
212
- :html-title="htmlOptionTitle"
213
- :show-input="showInputs"
168
+ <template v-if="!requiredDependencyNotFilled">
169
+ <template
170
+ v-if="
171
+ allOptions &&
172
+ isMultiple &&
173
+ visibleOptionsCount &&
174
+ !requiredDependencyNotFilled
175
+ "
214
176
  >
215
177
  <select-option
216
- v-show="option.visible"
217
- :option="option"
178
+ :option="{
179
+ title: actualStrings.selectAllOptions,
180
+ id: '!all!',
181
+ initiallyVisible: true,
182
+ visible: true,
183
+ isDisabled: visibleOptionsCount < optionsCount,
184
+ checked: allOptionsIsChecked,
185
+ isIndeterminate: Object.keys(selected).length
186
+ ? true
187
+ : false,
188
+ }"
218
189
  :is-toggle="isToggle"
219
190
  :name="actualName"
220
- :parent-auto-check="parentAutoCheck"
191
+ :parent-auto-check="false"
221
192
  :is-multiple="isMultiple"
222
- :is-bookmarkable="isBookmarkable"
193
+ :is-bookmarkable="false"
223
194
  :uid="uid"
224
195
  :only-end-nodes="onlyEndNodes"
225
- :html-title="htmlOptionTitle"
226
196
  :show-input="showInputs"
227
- @check="registerCheck"
228
- @toggle-bookmark="toggleBookmark"
197
+ @check="manageAll"
229
198
  @on-focus="(id) => focusedOptionId = id"
230
199
  ></select-option>
231
- </slot>
200
+ </template>
201
+
202
+ <template
203
+ v-for="option in actualOptions"
204
+ :key="name + option.value"
205
+ >
206
+ <slot
207
+ :option="option"
208
+ :name="actualName"
209
+ :parent-auto-check="parentAutoCheck"
210
+ :is-multiple="isMultiple"
211
+ :uid="uid"
212
+ :only-end-nodes="onlyEndNodes"
213
+ :html-title="htmlOptionTitle"
214
+ :show-input="showInputs"
215
+ >
216
+ <select-option
217
+ v-show="option.visible"
218
+ :option="option"
219
+ :is-toggle="isToggle"
220
+ :name="actualName"
221
+ :parent-auto-check="parentAutoCheck"
222
+ :is-multiple="isMultiple"
223
+ :is-bookmarkable="isBookmarkable"
224
+ :uid="uid"
225
+ :only-end-nodes="onlyEndNodes"
226
+ :html-title="htmlOptionTitle"
227
+ :show-input="showInputs"
228
+ @check="registerCheck"
229
+ @toggle-bookmark="toggleBookmark"
230
+ @on-focus="(id) => focusedOptionId = id"
231
+ ></select-option>
232
+ </slot>
233
+ </template>
232
234
  </template>
233
- </template>
234
- </list>
235
- </div>
236
- </template>
237
- </ib-dropdown>
235
+ </list>
236
+ </div>
237
+ </template>
238
+ </ib-dropdown>
239
+ </div>
238
240
  </div>
241
+
239
242
  </template>
240
243
 
241
244
  <script>