bootstrap-vue-top 1.0.13 → 1.0.14

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.
Files changed (57) hide show
  1. package/package.json +2 -7
  2. package/.browserslistrc +0 -12
  3. package/postcss.config.js +0 -5
  4. package/src/components/accordion/accordion-item.vue +0 -27
  5. package/src/components/accordion/accordion-keys.js +0 -1
  6. package/src/components/accordion/accordion.vue +0 -84
  7. package/src/components/alert/alert.js +0 -10
  8. package/src/components/alert-box/alert-box.vue +0 -73
  9. package/src/components/alert-box/index.js +0 -25
  10. package/src/components/alert-confirm/alert-confirm.vue +0 -80
  11. package/src/components/alert-confirm/index.js +0 -26
  12. package/src/components/alert-message/alert-message.vue +0 -63
  13. package/src/components/alert-message/index.js +0 -27
  14. package/src/components/backtop/backtop.vue +0 -61
  15. package/src/components/carousel/carousel.vue +0 -107
  16. package/src/components/collapse/collapse.js +0 -8
  17. package/src/components/dropdown/dropdown.js +0 -11
  18. package/src/components/image-preview/image-preview.vue +0 -261
  19. package/src/components/image-preview/index.js +0 -26
  20. package/src/components/loading/index.js +0 -45
  21. package/src/components/loading/loading-fullscreen.vue +0 -47
  22. package/src/components/loading/loading.vue +0 -47
  23. package/src/components/modal/modal.vue +0 -83
  24. package/src/components/modal-2/counter.js +0 -25
  25. package/src/components/modal-2/modal-2.vue +0 -256
  26. package/src/components/offcanvas/offcanvas.vue +0 -71
  27. package/src/components/pagination/pagination.vue +0 -216
  28. package/src/components/popover/popover.js +0 -10
  29. package/src/components/scrollspy/scrollspy.js +0 -16
  30. package/src/components/table/table-col.vue +0 -61
  31. package/src/components/table/table-keys.js +0 -2
  32. package/src/components/table/table.vue +0 -320
  33. package/src/components/tabs/tab-pane.vue +0 -32
  34. package/src/components/tabs/tabs-keys.js +0 -1
  35. package/src/components/tabs/tabs.vue +0 -240
  36. package/src/components/toast/index.js +0 -29
  37. package/src/components/toast/toast.vue +0 -92
  38. package/src/components/tooltip/tooltip.js +0 -10
  39. package/src/components/tree/tree-keys.js +0 -7
  40. package/src/components/tree/tree-node.vue +0 -144
  41. package/src/components/tree/tree.vue +0 -92
  42. package/src/components/treetable/treetable-col.vue +0 -37
  43. package/src/components/treetable/treetable-keys.js +0 -3
  44. package/src/components/treetable/treetable-node.vue +0 -104
  45. package/src/components/treetable/treetable.vue +0 -114
  46. package/src/components/uploader/file-uploader.vue +0 -68
  47. package/src/components/uploader/image-many-uploader.vue +0 -173
  48. package/src/components/uploader/image-one-uploader.vue +0 -78
  49. package/src/index.js +0 -64
  50. package/src/styles/alert.scss +0 -33
  51. package/src/styles/backtop.scss +0 -7
  52. package/src/styles/image-preview.scss +0 -11
  53. package/src/styles/index.scss +0 -97
  54. package/src/styles/loading.scss +0 -12
  55. package/src/styles/modal-2.scss +0 -8
  56. package/src/styles/uploader.scss +0 -29
  57. package/vite.config.js +0 -58
@@ -1,320 +0,0 @@
1
- <template>
2
- <table class="table" :class="tableClass">
3
- <caption v-if="caption">
4
- {{
5
- caption
6
- }}
7
- </caption>
8
- <slot></slot>
9
- <template v-if="ready">
10
- <colgroup>
11
- <template v-for="col in cols">
12
- <col :style="{ width: col.width }" />
13
- </template>
14
- </colgroup>
15
- <thead :class="theadClass">
16
- <tr>
17
- <template v-for="col in cols">
18
- <th scope="col">
19
- <template v-if="col.type === null">
20
- <template v-if="col.sortable === null">{{ col.header }}</template>
21
- <template v-else>
22
- <a
23
- href="#"
24
- role="button"
25
- class="link-body-emphasis text-decoration-none text-nowrap"
26
- @click.prevent="_sortBy(col)"
27
- >
28
- {{ col.header }}
29
- <bi-arrow-down-up v-if="sortField !== col.field || sortOrder === null" />
30
- <bi-sort-up-alt v-else-if="sortOrder === 'asc'" class="text-primary" />
31
- <bi-sort-down v-else-if="sortOrder === 'desc'" class="text-primary" />
32
- </a>
33
- </template>
34
- </template>
35
- <template v-else-if="col.type === 'index' || col.type === 'radio'">
36
- {{ col.header }}
37
- </template>
38
- <template v-else-if="col.type === 'checkbox'">
39
- <input class="form-check-input" type="checkbox" @change="_handleAllCheckboxChange" />
40
- </template>
41
- <template v-else-if="col.type === 'expand'">&nbsp;</template>
42
- </th>
43
- </template>
44
- </tr>
45
- </thead>
46
- <tbody :class="tbodyClass">
47
- <template v-for="(item, index) in items" :key="index">
48
- <tr :class="_tbodyTrClass(item)">
49
- <td v-for="col in cols">
50
- <template v-if="col.type === null && col.body === null">
51
- {{ get(item, col.field) }}
52
- </template>
53
- <template v-else-if="col.type === 'index'">{{ index + 1 }}</template>
54
- <template v-else-if="col.type === 'checkbox'">
55
- <input
56
- class="form-check-input"
57
- type="checkbox"
58
- :value="get(item, trKeyInfo.field)"
59
- v-model="checkboxSelectedKeys"
60
- />
61
- </template>
62
- <template v-else-if="col.type === 'radio'">
63
- <input
64
- class="form-check-input"
65
- type="radio"
66
- :value="get(item, trKeyInfo.field)"
67
- v-model="radioSelectedKey"
68
- />
69
- </template>
70
- <template v-else-if="col.type === 'expand'">
71
- <a
72
- href="#"
73
- role="button"
74
- class="link-body-emphasis text-decoration-none"
75
- @click.prevent="_handleToggleExpandTr(get(item, trKeyInfo.field))"
76
- >
77
- <BiChevronRight
78
- class="expand-icon"
79
- :class="{ 'rotate-90': expandKeys.includes(get(item, trKeyInfo.field)) }"
80
- />
81
- </a>
82
- </template>
83
- <component v-else :is="col.body" :item="item" :index="index" />
84
- </td>
85
- </tr>
86
- <tr v-if="trKeyInfo.type === 'expand' && expandKeys.includes(get(item, trKeyInfo.field))">
87
- <td :colspan="cols.length">
88
- <component :is="_getExpandBody()" :item="item" :index="index" />
89
- </td>
90
- </tr>
91
- </template>
92
- </tbody>
93
- <tfoot :class="tfootClass" v-if="tfootData !== null">
94
- <tr>
95
- <td v-for="item in tfootData">{{ item }}</td>
96
- </tr>
97
- </tfoot>
98
- </template>
99
- </table>
100
- </template>
101
-
102
- <script setup>
103
- import { useSlots, ref, provide, onMounted, watch, computed } from 'vue';
104
- import { get, orderBy } from 'lodash-es';
105
- import { cols_injection_key, tr_keyinfo_injection_key } from './table-keys.js';
106
-
107
- const emit = defineEmits(['sort-change', 'expand-change']);
108
-
109
- const props = defineProps({
110
- data: {
111
- type: Array,
112
- default: []
113
- },
114
- tableClass: {
115
- type: String,
116
- default: null
117
- },
118
- theadClass: {
119
- type: String,
120
- default: null
121
- },
122
- tbodyClass: {
123
- type: String,
124
- default: null
125
- },
126
- tbodyTrClass: {
127
- type: Function,
128
- default: null
129
- },
130
- tfootClass: {
131
- type: String,
132
- default: null
133
- },
134
- tfootData: {
135
- type: Array,
136
- default: null
137
- },
138
- caption: {
139
- type: String,
140
- default: null
141
- }
142
- });
143
- const ready = ref(false);
144
-
145
- const sortable = ref(null);
146
- const sortField = ref(null);
147
- const sortOrder = ref(null);
148
-
149
- const items = computed(() => {
150
- if (sortable.value === null || sortable.value === 'remote') {
151
- return props.data;
152
- } else if (sortable.value === 'local') {
153
- return orderBy(props.data, [sortField.value], [sortOrder.value]);
154
- }
155
- });
156
-
157
- const cols = [];
158
- provide(cols_injection_key, cols);
159
-
160
- const trKeyInfo = { type: null, field: null };
161
- provide(tr_keyinfo_injection_key, trKeyInfo);
162
- //checkbox
163
- let checkboxAllboxEl = null;
164
- const checkboxSelectedKeys = ref([]);
165
- //radio
166
- const radioSelectedKey = ref(null);
167
- //expand
168
- const expandKeys = ref([]);
169
-
170
- onMounted(() => {
171
- _initCols();
172
-
173
- if (trKeyInfo.type === 'checkbox') {
174
- _watchCheckboxCol();
175
- }
176
-
177
- ready.value = true;
178
- });
179
-
180
- function _initCols() {
181
- const slots = useSlots();
182
- const vNodes = slots.default();
183
-
184
- const colVNodes = [];
185
- for (const vNode of vNodes) {
186
- if (vNode.type.__name === 'table-col') {
187
- colVNodes.push(vNode);
188
- }
189
- }
190
-
191
- for (let i = 0; i < cols.length; i++) {
192
- if (colVNodes[i].children !== null && colVNodes[i].children.body !== 'undefined') {
193
- cols[i].body = colVNodes[i].children.body;
194
- } else {
195
- cols[i].body = null;
196
- }
197
- }
198
- }
199
-
200
- //tbody->tr色调调整
201
- function _tbodyTrClass(_item) {
202
- if (trKeyInfo.type === 'checkbox') {
203
- if (checkboxSelectedKeys.value.includes(get(_item, trKeyInfo.field))) {
204
- return 'table-active';
205
- }
206
- }
207
-
208
- if (trKeyInfo.type === 'radio') {
209
- if (radioSelectedKey.value === get(_item, trKeyInfo.field)) {
210
- return 'table-active';
211
- }
212
- }
213
-
214
- if (props.tbodyTrClass !== null) {
215
- return props.tbodyTrClass(_item);
216
- } else {
217
- return null;
218
- }
219
- }
220
-
221
- function _watchCheckboxCol() {
222
- watch(checkboxSelectedKeys, (val) => {
223
- if (checkboxAllboxEl === null) return;
224
- if (val.length === 0) {
225
- checkboxAllboxEl.checked = false;
226
- checkboxAllboxEl.indeterminate = false;
227
- return;
228
- }
229
- if (val.length < props.data.length) {
230
- checkboxAllboxEl.checked = false;
231
- checkboxAllboxEl.indeterminate = true;
232
- return;
233
- }
234
- if (val.length === props.data.length) {
235
- checkboxAllboxEl.checked = true;
236
- checkboxAllboxEl.indeterminate = false;
237
- return;
238
- }
239
- });
240
- }
241
-
242
- function _handleAllCheckboxChange(_event) {
243
- if (checkboxAllboxEl === null) {
244
- checkboxAllboxEl = _event.currentTarget;
245
- }
246
-
247
- checkboxSelectedKeys.value = [];
248
- if (checkboxAllboxEl.checked) {
249
- props.data.forEach((item) => {
250
- checkboxSelectedKeys.value.push(get(item, trKeyInfo.field));
251
- });
252
- }
253
- }
254
-
255
- function _sortBy(_col) {
256
- sortable.value = _col.sortable;
257
-
258
- if (sortField.value !== _col.field) {
259
- sortField.value = _col.field;
260
- sortOrder.value = 'asc';
261
- } else {
262
- if (sortOrder.value === null) {
263
- sortOrder.value = 'asc';
264
- } else if (sortOrder.value === 'asc') {
265
- sortOrder.value = 'desc';
266
- } else if (sortOrder.value === 'desc') {
267
- sortOrder.value = null;
268
- }
269
- }
270
-
271
- if (sortable.value === 'remote') {
272
- emit('sort-change', sortField.value, sortOrder.value);
273
- }
274
- }
275
-
276
- function _getExpandBody() {
277
- for (let i = 0; i < cols.length; i++) {
278
- if (cols[i].type === 'expand') {
279
- return cols[i].body;
280
- }
281
- }
282
- return null;
283
- }
284
-
285
- function _handleToggleExpandTr(_key) {
286
- const index = expandKeys.value.indexOf(_key);
287
- if (index > -1) {
288
- expandKeys.value.splice(index, 1);
289
- } else {
290
- expandKeys.value.push(_key);
291
-
292
- emit('expand-change', _key);
293
- }
294
- }
295
-
296
- defineExpose({
297
- getCheckboxSelectedKeys: function () {
298
- return checkboxSelectedKeys.value;
299
- },
300
- setCheckboxSelectedKeys: function (val) {
301
- checkboxSelectedKeys.value = val;
302
- },
303
- getRadioSelectedKey: function () {
304
- return radioSelectedKey.value;
305
- },
306
- setRadioSelectedKey: function (val) {
307
- radioSelectedKey.value = val;
308
- }
309
- });
310
- </script>
311
-
312
- <style lang="css" scoped>
313
- .expand-icon {
314
- transition: transform 0.3s ease;
315
- }
316
-
317
- .expand-icon.rotate-90 {
318
- transform: rotate(90deg);
319
- }
320
- </style>
@@ -1,32 +0,0 @@
1
- <template></template>
2
- <script setup>
3
- import { inject, onMounted, onBeforeUnmount, useId } from 'vue';
4
- import { panes_injection_key } from './tabs-keys.js';
5
-
6
- const props = defineProps({
7
- label: {
8
- type: String,
9
- default: 'Label'
10
- },
11
- disabled: {
12
- type: Boolean,
13
- default: false
14
- }
15
- });
16
-
17
- const panes = inject(panes_injection_key);
18
- const keyId = useId();
19
- onMounted(() => {
20
- const pane = {
21
- keyId: keyId,
22
- label: props.label,
23
- disabled: props.disabled
24
- };
25
- panes.push(pane);
26
- });
27
-
28
- onBeforeUnmount(() => {
29
- const index = panes.findIndex((item) => item.keyId === keyId);
30
- panes.splice(index, 1);
31
- });
32
- </script>
@@ -1 +0,0 @@
1
- export const panes_injection_key = Symbol();
@@ -1,240 +0,0 @@
1
- <template>
2
- <slot></slot>
3
- <template v-if="ready">
4
- <template v-if="position === 'top'">
5
- <nav class="nav" :class="tabsClass" :style="tabsStyle" role="tablist">
6
- <button
7
- v-for="pane in panes"
8
- type="button"
9
- class="nav-link"
10
- :id="`${pane.keyId}-tab`"
11
- :data-bs-target="`#${pane.keyId}`"
12
- role="tab"
13
- :aria-controls="pane.keyId"
14
- aria-selected="false"
15
- :disabled="pane.disabled"
16
- >
17
- {{ pane.label }}
18
- </button>
19
- </nav>
20
- <div class="tab-content">
21
- <div
22
- v-for="(pane, index) in panes"
23
- class="tab-pane fade"
24
- :id="pane.keyId"
25
- role="tabpanel"
26
- :aria-labelledby="`${pane.keyId}-tab`"
27
- tabindex="0"
28
- >
29
- <component v-if="renders[index]" :is="pane.body" />
30
- </div>
31
- </div>
32
- </template>
33
- <template v-else-if="position === 'bottom'">
34
- <div class="tab-content">
35
- <div
36
- v-for="(pane, index) in panes"
37
- class="tab-pane fade"
38
- :id="pane.keyId"
39
- role="tabpanel"
40
- :aria-labelledby="`${pane.keyId}-tab`"
41
- tabindex="0"
42
- >
43
- <component v-if="renders[index]" :is="pane.body" />
44
- </div>
45
- </div>
46
- <nav class="nav" :class="tabsClass" :style="tabsStyle" role="tablist">
47
- <button
48
- v-for="pane in panes"
49
- type="button"
50
- class="nav-link"
51
- :id="`${pane.keyId}-tab`"
52
- :data-bs-target="`#${pane.keyId}`"
53
- role="tab"
54
- :aria-controls="pane.keyId"
55
- aria-selected="false"
56
- :disabled="pane.disabled"
57
- >
58
- {{ pane.label }}
59
- </button>
60
- </nav>
61
- </template>
62
- <template v-else-if="position === 'start'">
63
- <div class="d-flex align-items-start">
64
- <nav
65
- class="nav flex-column me-3"
66
- :class="tabsClass"
67
- :style="tabsStyle"
68
- role="tablist"
69
- aria-orientation="vertical"
70
- >
71
- <button
72
- v-for="pane in panes"
73
- type="button"
74
- class="nav-link"
75
- :id="`${pane.keyId}-tab`"
76
- :data-bs-target="`#${pane.keyId}`"
77
- role="tab"
78
- :aria-controls="pane.keyId"
79
- aria-selected="false"
80
- :disabled="pane.disabled"
81
- >
82
- {{ pane.label }}
83
- </button>
84
- </nav>
85
- <div class="tab-content">
86
- <div
87
- v-for="(pane, index) in panes"
88
- class="tab-pane fade"
89
- :id="pane.keyId"
90
- role="tabpanel"
91
- :aria-labelledby="`${pane.keyId}-tab`"
92
- tabindex="0"
93
- >
94
- <component v-if="renders[index]" :is="pane.body" />
95
- </div>
96
- </div>
97
- </div>
98
- </template>
99
- <template v-else-if="position === 'end'">
100
- <div class="d-flex align-items-start">
101
- <div class="tab-content">
102
- <div
103
- v-for="(pane, index) in panes"
104
- class="tab-pane fade"
105
- :id="pane.keyId"
106
- role="tabpanel"
107
- :aria-labelledby="`${pane.keyId}-tab`"
108
- tabindex="0"
109
- >
110
- <component v-if="renders[index]" :is="pane.body" />
111
- </div>
112
- </div>
113
- <nav
114
- class="nav flex-column ms-3"
115
- :class="tabsClass"
116
- :style="tabsStyle"
117
- role="tablist"
118
- aria-orientation="vertical"
119
- >
120
- <button
121
- v-for="pane in panes"
122
- type="button"
123
- class="nav-link"
124
- :id="`${pane.keyId}-tab`"
125
- :data-bs-target="`#${pane.keyId}`"
126
- role="tab"
127
- :aria-controls="pane.keyId"
128
- aria-selected="false"
129
- :disabled="pane.disabled"
130
- >
131
- {{ pane.label }}
132
- </button>
133
- </nav>
134
- </div>
135
- </template>
136
- </template>
137
- </template>
138
-
139
- <script setup>
140
- import { useSlots, ref, provide, onMounted, onBeforeUnmount, nextTick } from 'vue';
141
- import { panes_injection_key } from './tabs-keys.js';
142
- import Tab from 'bootstrap/js/dist/tab';
143
-
144
- const emit = defineEmits(['tab-shown']);
145
-
146
- const ready = ref(false);
147
- const props = defineProps({
148
- tabsClass: {
149
- type: String,
150
- default: null
151
- },
152
- tabsStyle: {
153
- type: String,
154
- default: null
155
- },
156
- initActiveIndex: {
157
- type: Number,
158
- default: 0
159
- },
160
- lazy: {
161
- type: Boolean,
162
- default: false
163
- },
164
- position: {
165
- type: String,
166
- default: 'top',
167
- validator(value) {
168
- return ['start', 'end', 'top', 'bottom'].includes(value);
169
- }
170
- }
171
- });
172
-
173
- const panes = [];
174
- const renders = ref([]);
175
- provide(panes_injection_key, panes);
176
-
177
- onMounted(() => {
178
- _initPanes();
179
-
180
- ready.value = true;
181
-
182
- nextTick(() => {
183
- for (let i = 0; i < panes.length; i++) {
184
- let triggerEl = document.getElementById(`${panes[i].keyId}-tab`);
185
- const tabTrigger = new Tab(triggerEl);
186
-
187
- triggerEl.addEventListener('click', (event) => {
188
- event.preventDefault();
189
- tabTrigger.show();
190
- });
191
-
192
- triggerEl.addEventListener('show.bs.tab', (event) => {
193
- if (renders.value[i] === false) {
194
- renders.value[i] = true;
195
- }
196
- });
197
-
198
- triggerEl.addEventListener('shown.bs.tab', (event) => {
199
- emit('tab-shown', i);
200
- });
201
- }
202
-
203
- Tab.getInstance(`#${panes[props.initActiveIndex].keyId}-tab`).show();
204
- });
205
- });
206
-
207
- onBeforeUnmount(() => {
208
- panes.forEach((item) => {
209
- Tab.getInstance(`#${item.keyId}-tab`).dispose();
210
- });
211
- });
212
-
213
- function _initPanes() {
214
- const slots = useSlots();
215
- const vNodes = slots.default();
216
-
217
- const paneVNodes = [];
218
- for (const vNode of vNodes) {
219
- if (vNode.type.__name === 'tab-pane') {
220
- paneVNodes.push(vNode);
221
- }
222
- }
223
-
224
- for (let i = 0; i < panes.length; i++) {
225
- if (paneVNodes[i].children !== null && paneVNodes[i].children.default !== 'undefined') {
226
- panes[i].body = paneVNodes[i].children.default;
227
- } else {
228
- panes[i].body = null;
229
- }
230
-
231
- if (i === props.initActiveIndex) {
232
- renders.value.push(true);
233
- } else if (props.lazy) {
234
- renders.value.push(false);
235
- } else {
236
- renders.value.push(true);
237
- }
238
- }
239
- }
240
- </script>
@@ -1,29 +0,0 @@
1
- import { createVNode, render } from 'vue';
2
- import Toast from './toast.vue';
3
-
4
- let container = null;
5
- const toast = function (data) {
6
- if (container) {
7
- render(null, container);
8
- container = null;
9
- }
10
-
11
- container = document.createElement('div');
12
-
13
- const vnode = createVNode(Toast, {
14
- type: data.type,
15
- title: data.title,
16
- message: data.message,
17
- duration: data.duration,
18
- position: data.position,
19
- onDestroy: () => {
20
- render(null, container);
21
- }
22
- });
23
-
24
- render(vnode, container);
25
-
26
- document.body.appendChild(container.firstElementChild);
27
- };
28
-
29
- export default toast;