@onereach/ui-components 5.2.1 → 5.2.2
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/dist/bundled/v2/components/OrSelectV3/OrSelect.js +16 -3
- package/dist/bundled/v2/components/OrSelectV3/OrSelect.vue.d.ts +13 -0
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-a69c2fd5.js → OrSelect.vue_vue_type_script_lang-b029468d.js} +15 -2
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +3 -3
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.vue.d.ts +10 -0
- package/dist/bundled/v3/components/OrSelectV3/index.js +1 -1
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/index.js +1 -1
- package/dist/esm/v2/{OrSelect-dcc41043.js → OrSelect-f3a50dc9.js} +16 -3
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-select-v3/OrSelect.vue.d.ts +13 -0
- package/dist/esm/v2/components/or-select-v3/index.js +1 -1
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/{OrSelect-a6e29937.js → OrSelect-a2272840.js} +16 -3
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-select-v3/OrSelect.vue.d.ts +10 -0
- package/dist/esm/v3/components/or-select-v3/index.js +1 -1
- package/dist/esm/v3/index.js +1 -1
- package/package.json +2 -2
- package/src/components/or-select-v3/OrSelect.vue +16 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, ref, computed,
|
|
1
|
+
import { defineComponent, getCurrentInstance, ref, computed, toRefs, onMounted, watch } from 'vue-demi';
|
|
2
2
|
import { isEmptyValue } from '../../utils/isEmptyValue.js';
|
|
3
3
|
import { Select, SelectControl, SelectSearchControl, SelectPlaceholder, SelectDropdown, SelectDropdownFlipped, SelectDropdownDefault, SelectDropdownItem, SelectNoSearchResults } from './styles.js';
|
|
4
4
|
import __vue_component__$1 from '../OrCheckboxV3/OrCheckbox.js';
|
|
@@ -144,6 +144,10 @@ var script = defineComponent({
|
|
|
144
144
|
type: Boolean,
|
|
145
145
|
default: false
|
|
146
146
|
},
|
|
147
|
+
enableClear: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: false
|
|
150
|
+
},
|
|
147
151
|
searchFunction: {
|
|
148
152
|
type: Function,
|
|
149
153
|
default: async (searchText, options) => {
|
|
@@ -187,6 +191,11 @@ var script = defineComponent({
|
|
|
187
191
|
var _a;
|
|
188
192
|
return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
189
193
|
});
|
|
194
|
+
// Props
|
|
195
|
+
const {
|
|
196
|
+
enableClear,
|
|
197
|
+
modelValue
|
|
198
|
+
} = toRefs(props);
|
|
190
199
|
// Styles
|
|
191
200
|
const rootStyles = computed(() => ['or-select-v3', ...Select]);
|
|
192
201
|
const controlStyles = computed(() => [...SelectControl]);
|
|
@@ -200,10 +209,13 @@ var script = defineComponent({
|
|
|
200
209
|
const noSearchResultsStyles = computed(() => [...SelectNoSearchResults]);
|
|
201
210
|
// State
|
|
202
211
|
const controlId = ref((_a = context.attrs.id) !== null && _a !== void 0 ? _a : currentInstance.uid.toString());
|
|
203
|
-
const proxyModelValue = useProxyModelValue(
|
|
212
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
204
213
|
const isEmptyModelValue = computed(() => {
|
|
205
214
|
return Array.isArray(proxyModelValue.value) ? proxyModelValue.value.length === 0 : isEmptyValue(proxyModelValue.value);
|
|
206
215
|
});
|
|
216
|
+
const showClear = computed(() => {
|
|
217
|
+
return enableClear.value && !isEmptyModelValue.value;
|
|
218
|
+
});
|
|
207
219
|
onMounted(() => {
|
|
208
220
|
if (!proxyModelValue.value && props.multiple) {
|
|
209
221
|
proxyModelValue.value = [];
|
|
@@ -311,6 +323,7 @@ var script = defineComponent({
|
|
|
311
323
|
proxyModelValue,
|
|
312
324
|
readonly,
|
|
313
325
|
isEmptyModelValue,
|
|
326
|
+
showClear,
|
|
314
327
|
selection,
|
|
315
328
|
searchText,
|
|
316
329
|
internalSearchOptions,
|
|
@@ -448,7 +461,7 @@ var __vue_render__ = function () {
|
|
|
448
461
|
class: ['grow']
|
|
449
462
|
})], _vm._v(" "), _c('div', {
|
|
450
463
|
class: ['layout-inline-row', 'gap-sm']
|
|
451
|
-
}, [_vm.
|
|
464
|
+
}, [_vm.showClear ? [_c('OrIconButton', {
|
|
452
465
|
attrs: {
|
|
453
466
|
"icon": 'close',
|
|
454
467
|
"color": 'inherit',
|
|
@@ -29,6 +29,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
29
29
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[]>;
|
|
30
30
|
readonly: import("@vue/composition-api").ComputedRef<boolean>;
|
|
31
31
|
isEmptyModelValue: import("@vue/composition-api").ComputedRef<boolean>;
|
|
32
|
+
showClear: import("@vue/composition-api").ComputedRef<boolean>;
|
|
32
33
|
selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
|
|
33
34
|
searchText: import("@vue/composition-api").Ref<string>;
|
|
34
35
|
internalSearchOptions: import("@vue/composition-api").Ref<{
|
|
@@ -102,6 +103,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
102
103
|
type: BooleanConstructor;
|
|
103
104
|
default: boolean;
|
|
104
105
|
};
|
|
106
|
+
enableClear: {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
default: boolean;
|
|
109
|
+
};
|
|
105
110
|
searchFunction: {
|
|
106
111
|
type: PropType<SelectSearchFunction>;
|
|
107
112
|
default: SelectSearchFunction;
|
|
@@ -171,6 +176,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
171
176
|
type: BooleanConstructor;
|
|
172
177
|
default: boolean;
|
|
173
178
|
};
|
|
179
|
+
enableClear: {
|
|
180
|
+
type: BooleanConstructor;
|
|
181
|
+
default: boolean;
|
|
182
|
+
};
|
|
174
183
|
searchFunction: {
|
|
175
184
|
type: PropType<SelectSearchFunction>;
|
|
176
185
|
default: SelectSearchFunction;
|
|
@@ -198,6 +207,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
198
207
|
disabled: boolean;
|
|
199
208
|
disableDefaultStyles: boolean;
|
|
200
209
|
enableSearch: boolean;
|
|
210
|
+
enableClear: boolean;
|
|
201
211
|
searchFunction: SelectSearchFunction;
|
|
202
212
|
groupByFunction: SelectGroupByFunction;
|
|
203
213
|
externalControl: boolean;
|
|
@@ -231,6 +241,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
231
241
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[]>;
|
|
232
242
|
readonly: import("@vue/composition-api").ComputedRef<boolean>;
|
|
233
243
|
isEmptyModelValue: import("@vue/composition-api").ComputedRef<boolean>;
|
|
244
|
+
showClear: import("@vue/composition-api").ComputedRef<boolean>;
|
|
234
245
|
selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
|
|
235
246
|
searchText: import("@vue/composition-api").Ref<string>;
|
|
236
247
|
internalSearchOptions: import("@vue/composition-api").Ref<{
|
|
@@ -262,6 +273,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
262
273
|
disabled: boolean;
|
|
263
274
|
disableDefaultStyles: boolean;
|
|
264
275
|
enableSearch: boolean;
|
|
276
|
+
enableClear: boolean;
|
|
265
277
|
searchFunction: SelectSearchFunction;
|
|
266
278
|
groupByFunction: SelectGroupByFunction;
|
|
267
279
|
externalControl: boolean;
|
|
@@ -282,6 +294,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
282
294
|
disabled: boolean;
|
|
283
295
|
disableDefaultStyles: boolean;
|
|
284
296
|
enableSearch: boolean;
|
|
297
|
+
enableClear: boolean;
|
|
285
298
|
searchFunction: SelectSearchFunction;
|
|
286
299
|
groupByFunction: SelectGroupByFunction;
|
|
287
300
|
externalControl: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, ref, computed,
|
|
1
|
+
import { defineComponent, getCurrentInstance, ref, computed, toRefs, onMounted, watch } from 'vue-demi';
|
|
2
2
|
import { isEmptyValue } from './utils/isEmptyValue.js';
|
|
3
3
|
import { Select, SelectControl, SelectSearchControl, SelectPlaceholder, SelectDropdown, SelectDropdownFlipped, SelectDropdownDefault, SelectDropdownItem, SelectNoSearchResults } from './components/OrSelectV3/styles.js';
|
|
4
4
|
import './components/OrCheckboxV3/OrCheckbox.js';
|
|
@@ -112,6 +112,10 @@ var script = defineComponent({
|
|
|
112
112
|
type: Boolean,
|
|
113
113
|
default: false
|
|
114
114
|
},
|
|
115
|
+
enableClear: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: false
|
|
118
|
+
},
|
|
115
119
|
searchFunction: {
|
|
116
120
|
type: Function,
|
|
117
121
|
default: async (searchText, options) => {
|
|
@@ -155,6 +159,11 @@ var script = defineComponent({
|
|
|
155
159
|
var _a;
|
|
156
160
|
return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
157
161
|
});
|
|
162
|
+
// Props
|
|
163
|
+
const {
|
|
164
|
+
enableClear,
|
|
165
|
+
modelValue
|
|
166
|
+
} = toRefs(props);
|
|
158
167
|
// Styles
|
|
159
168
|
const rootStyles = computed(() => ['or-select-v3', ...Select]);
|
|
160
169
|
const controlStyles = computed(() => [...SelectControl]);
|
|
@@ -168,10 +177,13 @@ var script = defineComponent({
|
|
|
168
177
|
const noSearchResultsStyles = computed(() => [...SelectNoSearchResults]);
|
|
169
178
|
// State
|
|
170
179
|
const controlId = ref((_a = context.attrs.id) !== null && _a !== void 0 ? _a : currentInstance.uid.toString());
|
|
171
|
-
const proxyModelValue = useProxyModelValue(
|
|
180
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
172
181
|
const isEmptyModelValue = computed(() => {
|
|
173
182
|
return Array.isArray(proxyModelValue.value) ? proxyModelValue.value.length === 0 : isEmptyValue(proxyModelValue.value);
|
|
174
183
|
});
|
|
184
|
+
const showClear = computed(() => {
|
|
185
|
+
return enableClear.value && !isEmptyModelValue.value;
|
|
186
|
+
});
|
|
175
187
|
onMounted(() => {
|
|
176
188
|
if (!proxyModelValue.value && props.multiple) {
|
|
177
189
|
proxyModelValue.value = [];
|
|
@@ -279,6 +291,7 @@ var script = defineComponent({
|
|
|
279
291
|
proxyModelValue,
|
|
280
292
|
readonly,
|
|
281
293
|
isEmptyModelValue,
|
|
294
|
+
showClear,
|
|
282
295
|
selection,
|
|
283
296
|
searchText,
|
|
284
297
|
internalSearchOptions,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { s as script } from '../../OrSelect.vue_vue_type_script_lang-
|
|
2
|
-
export { s as default } from '../../OrSelect.vue_vue_type_script_lang-
|
|
1
|
+
import { s as script } from '../../OrSelect.vue_vue_type_script_lang-b029468d.js';
|
|
2
|
+
export { s as default } from '../../OrSelect.vue_vue_type_script_lang-b029468d.js';
|
|
3
3
|
import { resolveComponent, resolveDirective, openBlock, createElementBlock, normalizeClass, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, withDirectives, createElementVNode, Fragment, renderList, withModifiers, createVNode, vShow } from 'vue';
|
|
4
4
|
import 'vue-demi';
|
|
5
5
|
import '../../utils/isEmptyValue.js';
|
|
@@ -189,7 +189,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
189
189
|
size: _ctx.size,
|
|
190
190
|
"disable-default-styles": true,
|
|
191
191
|
onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
|
|
192
|
-
}, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div", _hoisted_5)), createElementVNode("div", _hoisted_6, [_ctx.
|
|
192
|
+
}, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div", _hoisted_5)), createElementVNode("div", _hoisted_6, [_ctx.showClear ? (openBlock(), createBlock(_component_OrIconButton, {
|
|
193
193
|
key: 0,
|
|
194
194
|
icon: 'close',
|
|
195
195
|
color: 'inherit',
|
|
@@ -58,6 +58,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
58
58
|
type: BooleanConstructor;
|
|
59
59
|
default: boolean;
|
|
60
60
|
};
|
|
61
|
+
enableClear: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
61
65
|
searchFunction: {
|
|
62
66
|
type: PropType<SelectSearchFunction>;
|
|
63
67
|
default: SelectSearchFunction;
|
|
@@ -90,6 +94,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
90
94
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[] | undefined>;
|
|
91
95
|
readonly: import("vue-demi").ComputedRef<boolean>;
|
|
92
96
|
isEmptyModelValue: import("vue-demi").ComputedRef<boolean>;
|
|
97
|
+
showClear: import("vue-demi").ComputedRef<boolean>;
|
|
93
98
|
selection: import("vue-demi").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
|
|
94
99
|
searchText: import("vue-demi").Ref<string>;
|
|
95
100
|
internalSearchOptions: import("vue-demi").Ref<{
|
|
@@ -163,6 +168,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
163
168
|
type: BooleanConstructor;
|
|
164
169
|
default: boolean;
|
|
165
170
|
};
|
|
171
|
+
enableClear: {
|
|
172
|
+
type: BooleanConstructor;
|
|
173
|
+
default: boolean;
|
|
174
|
+
};
|
|
166
175
|
searchFunction: {
|
|
167
176
|
type: PropType<SelectSearchFunction>;
|
|
168
177
|
default: SelectSearchFunction;
|
|
@@ -195,6 +204,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
195
204
|
disabled: boolean;
|
|
196
205
|
disableDefaultStyles: boolean;
|
|
197
206
|
enableSearch: boolean;
|
|
207
|
+
enableClear: boolean;
|
|
198
208
|
searchFunction: SelectSearchFunction;
|
|
199
209
|
groupByFunction: SelectGroupByFunction;
|
|
200
210
|
externalControl: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { s as OrSelectV3 } from '../../OrSelect.vue_vue_type_script_lang-
|
|
1
|
+
export { s as OrSelectV3 } from '../../OrSelect.vue_vue_type_script_lang-b029468d.js';
|
|
2
2
|
export { InputBoxSize as SelectSize } from '../OrInputBoxV3/props.js';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import '../../utils/isEmptyValue.js';
|
|
@@ -114,7 +114,7 @@ export { s as OrSearchV3 } from '../OrSearch.vue_vue_type_script_lang-67994b95.j
|
|
|
114
114
|
export { s as OrSegmentedControlV3 } from '../OrSegmentedControl.vue_vue_type_script_lang-3a7df112.js';
|
|
115
115
|
export { SegmentedControlSize } from './OrSegmentedControlV3/props.js';
|
|
116
116
|
export { s as OrSelect } from '../OrSelect.vue_vue_type_script_lang-594e7c11.js';
|
|
117
|
-
export { s as OrSelectV3 } from '../OrSelect.vue_vue_type_script_lang-
|
|
117
|
+
export { s as OrSelectV3 } from '../OrSelect.vue_vue_type_script_lang-b029468d.js';
|
|
118
118
|
export { s as OrSidebar } from '../OrSidebar.vue_vue_type_script_lang-81941fe6.js';
|
|
119
119
|
export { OrSidebarSide } from './OrSidebar/constants.js';
|
|
120
120
|
export { s as OrSidebarV3 } from '../OrSidebar.vue_vue_type_script_lang-3ed42b69.js';
|
package/dist/bundled/v3/index.js
CHANGED
|
@@ -74,7 +74,7 @@ export { s as OrSegmentedControlV3 } from './OrSegmentedControl.vue_vue_type_scr
|
|
|
74
74
|
import './components/OrSelect/OrSelect.js';
|
|
75
75
|
export { s as OrSelect } from './OrSelect.vue_vue_type_script_lang-594e7c11.js';
|
|
76
76
|
import './components/OrSelectV3/OrSelect.js';
|
|
77
|
-
export { s as OrSelectV3 } from './OrSelect.vue_vue_type_script_lang-
|
|
77
|
+
export { s as OrSelectV3 } from './OrSelect.vue_vue_type_script_lang-b029468d.js';
|
|
78
78
|
import './components/OrSidebar/OrSidebar.js';
|
|
79
79
|
export { s as OrSidebar } from './OrSidebar.vue_vue_type_script_lang-81941fe6.js';
|
|
80
80
|
import './components/OrSidebarV3/OrSidebar.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, ref, computed,
|
|
1
|
+
import { defineComponent, getCurrentInstance, ref, computed, toRefs, onMounted, watch } from 'vue-demi';
|
|
2
2
|
import { D as DropdownClose, a as DropdownOpen } from './dropdown-open-06d651cf.js';
|
|
3
3
|
import { u as useOverflow } from './useOverflow-c856b7b7.js';
|
|
4
4
|
import '@vueuse/core';
|
|
@@ -161,6 +161,10 @@ var script = defineComponent({
|
|
|
161
161
|
type: Boolean,
|
|
162
162
|
default: false
|
|
163
163
|
},
|
|
164
|
+
enableClear: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: false
|
|
167
|
+
},
|
|
164
168
|
searchFunction: {
|
|
165
169
|
type: Function,
|
|
166
170
|
default: async (searchText, options) => {
|
|
@@ -204,6 +208,11 @@ var script = defineComponent({
|
|
|
204
208
|
var _a;
|
|
205
209
|
return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
206
210
|
});
|
|
211
|
+
// Props
|
|
212
|
+
const {
|
|
213
|
+
enableClear,
|
|
214
|
+
modelValue
|
|
215
|
+
} = toRefs(props);
|
|
207
216
|
// Styles
|
|
208
217
|
const rootStyles = computed(() => ['or-select-v3', ...Select]);
|
|
209
218
|
const controlStyles = computed(() => [...SelectControl]);
|
|
@@ -217,10 +226,13 @@ var script = defineComponent({
|
|
|
217
226
|
const noSearchResultsStyles = computed(() => [...SelectNoSearchResults]);
|
|
218
227
|
// State
|
|
219
228
|
const controlId = ref((_a = context.attrs.id) !== null && _a !== void 0 ? _a : currentInstance.uid.toString());
|
|
220
|
-
const proxyModelValue = useProxyModelValue(
|
|
229
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
221
230
|
const isEmptyModelValue = computed(() => {
|
|
222
231
|
return Array.isArray(proxyModelValue.value) ? proxyModelValue.value.length === 0 : isEmptyValue(proxyModelValue.value);
|
|
223
232
|
});
|
|
233
|
+
const showClear = computed(() => {
|
|
234
|
+
return enableClear.value && !isEmptyModelValue.value;
|
|
235
|
+
});
|
|
224
236
|
onMounted(() => {
|
|
225
237
|
if (!proxyModelValue.value && props.multiple) {
|
|
226
238
|
proxyModelValue.value = [];
|
|
@@ -328,6 +340,7 @@ var script = defineComponent({
|
|
|
328
340
|
proxyModelValue,
|
|
329
341
|
readonly,
|
|
330
342
|
isEmptyModelValue,
|
|
343
|
+
showClear,
|
|
331
344
|
selection,
|
|
332
345
|
searchText,
|
|
333
346
|
internalSearchOptions,
|
|
@@ -465,7 +478,7 @@ var __vue_render__ = function () {
|
|
|
465
478
|
class: ['grow']
|
|
466
479
|
})], _vm._v(" "), _c('div', {
|
|
467
480
|
class: ['layout-inline-row', 'gap-sm']
|
|
468
|
-
}, [_vm.
|
|
481
|
+
}, [_vm.showClear ? [_c('OrIconButton', {
|
|
469
482
|
attrs: {
|
|
470
483
|
"icon": 'close',
|
|
471
484
|
"color": 'inherit',
|
|
@@ -78,7 +78,7 @@ export { _ as OrSearch } from '../OrSearch-ac542dd6.js';
|
|
|
78
78
|
export { _ as OrSearchV3 } from '../OrSearch-2cd05f40.js';
|
|
79
79
|
export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-35b54d3c.js';
|
|
80
80
|
export { _ as OrSelect } from '../OrSelect-c0d04cf6.js';
|
|
81
|
-
export { _ as OrSelectV3 } from '../OrSelect-
|
|
81
|
+
export { _ as OrSelectV3 } from '../OrSelect-f3a50dc9.js';
|
|
82
82
|
export { _ as OrSidebar, O as OrSidebarSide } from '../OrSidebar-c56a9221.js';
|
|
83
83
|
export { _ as OrSidebarV3 } from '../OrSidebar-c76d3d4a.js';
|
|
84
84
|
export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-ad5db793.js';
|
|
@@ -29,6 +29,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
29
29
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[]>;
|
|
30
30
|
readonly: import("@vue/composition-api").ComputedRef<boolean>;
|
|
31
31
|
isEmptyModelValue: import("@vue/composition-api").ComputedRef<boolean>;
|
|
32
|
+
showClear: import("@vue/composition-api").ComputedRef<boolean>;
|
|
32
33
|
selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
|
|
33
34
|
searchText: import("@vue/composition-api").Ref<string>;
|
|
34
35
|
internalSearchOptions: import("@vue/composition-api").Ref<{
|
|
@@ -102,6 +103,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
102
103
|
type: BooleanConstructor;
|
|
103
104
|
default: boolean;
|
|
104
105
|
};
|
|
106
|
+
enableClear: {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
default: boolean;
|
|
109
|
+
};
|
|
105
110
|
searchFunction: {
|
|
106
111
|
type: PropType<SelectSearchFunction>;
|
|
107
112
|
default: SelectSearchFunction;
|
|
@@ -171,6 +176,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
171
176
|
type: BooleanConstructor;
|
|
172
177
|
default: boolean;
|
|
173
178
|
};
|
|
179
|
+
enableClear: {
|
|
180
|
+
type: BooleanConstructor;
|
|
181
|
+
default: boolean;
|
|
182
|
+
};
|
|
174
183
|
searchFunction: {
|
|
175
184
|
type: PropType<SelectSearchFunction>;
|
|
176
185
|
default: SelectSearchFunction;
|
|
@@ -198,6 +207,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
198
207
|
disabled: boolean;
|
|
199
208
|
disableDefaultStyles: boolean;
|
|
200
209
|
enableSearch: boolean;
|
|
210
|
+
enableClear: boolean;
|
|
201
211
|
searchFunction: SelectSearchFunction;
|
|
202
212
|
groupByFunction: SelectGroupByFunction;
|
|
203
213
|
externalControl: boolean;
|
|
@@ -231,6 +241,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
231
241
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[]>;
|
|
232
242
|
readonly: import("@vue/composition-api").ComputedRef<boolean>;
|
|
233
243
|
isEmptyModelValue: import("@vue/composition-api").ComputedRef<boolean>;
|
|
244
|
+
showClear: import("@vue/composition-api").ComputedRef<boolean>;
|
|
234
245
|
selection: import("@vue/composition-api").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
|
|
235
246
|
searchText: import("@vue/composition-api").Ref<string>;
|
|
236
247
|
internalSearchOptions: import("@vue/composition-api").Ref<{
|
|
@@ -262,6 +273,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
262
273
|
disabled: boolean;
|
|
263
274
|
disableDefaultStyles: boolean;
|
|
264
275
|
enableSearch: boolean;
|
|
276
|
+
enableClear: boolean;
|
|
265
277
|
searchFunction: SelectSearchFunction;
|
|
266
278
|
groupByFunction: SelectGroupByFunction;
|
|
267
279
|
externalControl: boolean;
|
|
@@ -282,6 +294,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
282
294
|
disabled: boolean;
|
|
283
295
|
disableDefaultStyles: boolean;
|
|
284
296
|
enableSearch: boolean;
|
|
297
|
+
enableClear: boolean;
|
|
285
298
|
searchFunction: SelectSearchFunction;
|
|
286
299
|
groupByFunction: SelectGroupByFunction;
|
|
287
300
|
externalControl: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { _ as OrSelectV3 } from '../../OrSelect-
|
|
1
|
+
export { _ as OrSelectV3 } from '../../OrSelect-f3a50dc9.js';
|
|
2
2
|
export { I as SelectSize } from '../../OrInputBox.vue_rollup-plugin-vue_script-4fde9829.js';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import '../../dropdown-open-06d651cf.js';
|
package/dist/esm/v2/index.js
CHANGED
|
@@ -78,7 +78,7 @@ export { _ as OrSearch } from './OrSearch-ac542dd6.js';
|
|
|
78
78
|
export { _ as OrSearchV3 } from './OrSearch-2cd05f40.js';
|
|
79
79
|
export { _ as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-35b54d3c.js';
|
|
80
80
|
export { _ as OrSelect } from './OrSelect-c0d04cf6.js';
|
|
81
|
-
export { _ as OrSelectV3 } from './OrSelect-
|
|
81
|
+
export { _ as OrSelectV3 } from './OrSelect-f3a50dc9.js';
|
|
82
82
|
export { _ as OrSidebar, O as OrSidebarSide } from './OrSidebar-c56a9221.js';
|
|
83
83
|
export { _ as OrSidebarV3 } from './OrSidebar-c76d3d4a.js';
|
|
84
84
|
export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-ad5db793.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, getCurrentInstance, ref, computed,
|
|
1
|
+
import { defineComponent, getCurrentInstance, ref, computed, toRefs, onMounted, watch } from 'vue-demi';
|
|
2
2
|
import { D as DropdownClose, a as DropdownOpen } from './dropdown-open-06d651cf.js';
|
|
3
3
|
import { u as useOverflow } from './useOverflow-c856b7b7.js';
|
|
4
4
|
import '@vueuse/core';
|
|
@@ -160,6 +160,10 @@ var script = defineComponent({
|
|
|
160
160
|
type: Boolean,
|
|
161
161
|
default: false
|
|
162
162
|
},
|
|
163
|
+
enableClear: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: false
|
|
166
|
+
},
|
|
163
167
|
searchFunction: {
|
|
164
168
|
type: Function,
|
|
165
169
|
default: async (searchText, options) => {
|
|
@@ -203,6 +207,11 @@ var script = defineComponent({
|
|
|
203
207
|
var _a;
|
|
204
208
|
return (_a = popover.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
205
209
|
});
|
|
210
|
+
// Props
|
|
211
|
+
const {
|
|
212
|
+
enableClear,
|
|
213
|
+
modelValue
|
|
214
|
+
} = toRefs(props);
|
|
206
215
|
// Styles
|
|
207
216
|
const rootStyles = computed(() => ['or-select-v3', ...Select]);
|
|
208
217
|
const controlStyles = computed(() => [...SelectControl]);
|
|
@@ -216,10 +225,13 @@ var script = defineComponent({
|
|
|
216
225
|
const noSearchResultsStyles = computed(() => [...SelectNoSearchResults]);
|
|
217
226
|
// State
|
|
218
227
|
const controlId = ref((_a = context.attrs.id) !== null && _a !== void 0 ? _a : currentInstance.uid.toString());
|
|
219
|
-
const proxyModelValue = useProxyModelValue(
|
|
228
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
220
229
|
const isEmptyModelValue = computed(() => {
|
|
221
230
|
return Array.isArray(proxyModelValue.value) ? proxyModelValue.value.length === 0 : isEmptyValue(proxyModelValue.value);
|
|
222
231
|
});
|
|
232
|
+
const showClear = computed(() => {
|
|
233
|
+
return enableClear.value && !isEmptyModelValue.value;
|
|
234
|
+
});
|
|
223
235
|
onMounted(() => {
|
|
224
236
|
if (!proxyModelValue.value && props.multiple) {
|
|
225
237
|
proxyModelValue.value = [];
|
|
@@ -327,6 +339,7 @@ var script = defineComponent({
|
|
|
327
339
|
proxyModelValue,
|
|
328
340
|
readonly,
|
|
329
341
|
isEmptyModelValue,
|
|
342
|
+
showClear,
|
|
330
343
|
selection,
|
|
331
344
|
searchText,
|
|
332
345
|
internalSearchOptions,
|
|
@@ -451,7 +464,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
451
464
|
size: _ctx.size,
|
|
452
465
|
"disable-default-styles": true,
|
|
453
466
|
onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
|
|
454
|
-
}, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div", _hoisted_5)), createElementVNode("div", _hoisted_6, [_ctx.
|
|
467
|
+
}, null, 8 /* PROPS */, ["modelValue", "class", "placeholder", "size"])) : (openBlock(), createElementBlock("div", _hoisted_5)), createElementVNode("div", _hoisted_6, [_ctx.showClear ? (openBlock(), createBlock(_component_OrIconButton, {
|
|
455
468
|
key: 0,
|
|
456
469
|
icon: 'close',
|
|
457
470
|
color: 'inherit',
|
|
@@ -75,7 +75,7 @@ export { s as OrSearch } from '../OrSearch-2800e9bf.js';
|
|
|
75
75
|
export { s as OrSearchV3 } from '../OrSearch-98342176.js';
|
|
76
76
|
export { s as OrSegmentedControlV3, S as SegmentedControlSize } from '../OrSegmentedControl-851db474.js';
|
|
77
77
|
export { s as OrSelect } from '../OrSelect-9520d6e6.js';
|
|
78
|
-
export { s as OrSelectV3 } from '../OrSelect-
|
|
78
|
+
export { s as OrSelectV3 } from '../OrSelect-a2272840.js';
|
|
79
79
|
export { s as OrSidebar, O as OrSidebarSide } from '../OrSidebar-aaf73310.js';
|
|
80
80
|
export { s as OrSidebarV3 } from '../OrSidebar-8f9b7502.js';
|
|
81
81
|
export { O as OrSidebarPlacement } from '../OrSidebarCollapseButton-79a7c625.js';
|
|
@@ -58,6 +58,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
58
58
|
type: BooleanConstructor;
|
|
59
59
|
default: boolean;
|
|
60
60
|
};
|
|
61
|
+
enableClear: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
61
65
|
searchFunction: {
|
|
62
66
|
type: PropType<SelectSearchFunction>;
|
|
63
67
|
default: SelectSearchFunction;
|
|
@@ -90,6 +94,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
90
94
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<string | number | object | string[] | object[] | number[] | undefined>;
|
|
91
95
|
readonly: import("vue-demi").ComputedRef<boolean>;
|
|
92
96
|
isEmptyModelValue: import("vue-demi").ComputedRef<boolean>;
|
|
97
|
+
showClear: import("vue-demi").ComputedRef<boolean>;
|
|
93
98
|
selection: import("vue-demi").ComputedRef<SelectOption | (SelectOption | undefined)[] | undefined>;
|
|
94
99
|
searchText: import("vue-demi").Ref<string>;
|
|
95
100
|
internalSearchOptions: import("vue-demi").Ref<{
|
|
@@ -163,6 +168,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
163
168
|
type: BooleanConstructor;
|
|
164
169
|
default: boolean;
|
|
165
170
|
};
|
|
171
|
+
enableClear: {
|
|
172
|
+
type: BooleanConstructor;
|
|
173
|
+
default: boolean;
|
|
174
|
+
};
|
|
166
175
|
searchFunction: {
|
|
167
176
|
type: PropType<SelectSearchFunction>;
|
|
168
177
|
default: SelectSearchFunction;
|
|
@@ -195,6 +204,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
195
204
|
disabled: boolean;
|
|
196
205
|
disableDefaultStyles: boolean;
|
|
197
206
|
enableSearch: boolean;
|
|
207
|
+
enableClear: boolean;
|
|
198
208
|
searchFunction: SelectSearchFunction;
|
|
199
209
|
groupByFunction: SelectGroupByFunction;
|
|
200
210
|
externalControl: boolean;
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -75,7 +75,7 @@ export { s as OrSearch } from './OrSearch-2800e9bf.js';
|
|
|
75
75
|
export { s as OrSearchV3 } from './OrSearch-98342176.js';
|
|
76
76
|
export { s as OrSegmentedControlV3, S as SegmentedControlSize } from './OrSegmentedControl-851db474.js';
|
|
77
77
|
export { s as OrSelect } from './OrSelect-9520d6e6.js';
|
|
78
|
-
export { s as OrSelectV3 } from './OrSelect-
|
|
78
|
+
export { s as OrSelectV3 } from './OrSelect-a2272840.js';
|
|
79
79
|
export { s as OrSidebar, O as OrSidebarSide } from './OrSidebar-aaf73310.js';
|
|
80
80
|
export { s as OrSidebarV3 } from './OrSidebar-8f9b7502.js';
|
|
81
81
|
export { O as OrSidebarPlacement } from './OrSidebarCollapseButton-79a7c625.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.2",
|
|
4
4
|
"npmUnpacked": "4.15.2",
|
|
5
5
|
"description": "Vue components library for v2/3",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
},
|
|
158
158
|
"./package.json": "./package.json"
|
|
159
159
|
},
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "6708e2cad0bfb997315b7a072bc1450bd17e2eb2"
|
|
161
161
|
}
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
</template>
|
|
112
112
|
|
|
113
113
|
<div :class="['layout-inline-row', 'gap-sm']">
|
|
114
|
-
<template v-if="
|
|
114
|
+
<template v-if="showClear">
|
|
115
115
|
<OrIconButton
|
|
116
116
|
:icon="'close'"
|
|
117
117
|
:color="'inherit'"
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
</template>
|
|
270
270
|
|
|
271
271
|
<script lang="ts">
|
|
272
|
-
import { computed, defineComponent, getCurrentInstance, onMounted, PropType, ref,
|
|
272
|
+
import { computed, defineComponent, getCurrentInstance, onMounted, PropType, ref, toRefs, watch } from 'vue-demi';
|
|
273
273
|
import { DropdownClose, DropdownOpen } from '../../directives';
|
|
274
274
|
import { useOverflow, useProxyModelValue, useResponsive } from '../../hooks';
|
|
275
275
|
import { isEmptyValue } from '../../utils/isEmptyValue';
|
|
@@ -386,6 +386,11 @@ export default defineComponent({
|
|
|
386
386
|
default: false,
|
|
387
387
|
},
|
|
388
388
|
|
|
389
|
+
enableClear: {
|
|
390
|
+
type: Boolean,
|
|
391
|
+
default: false,
|
|
392
|
+
},
|
|
393
|
+
|
|
389
394
|
searchFunction: {
|
|
390
395
|
type: Function as PropType<SelectSearchFunction>,
|
|
391
396
|
|
|
@@ -435,6 +440,9 @@ export default defineComponent({
|
|
|
435
440
|
const popoverRoot = computed(() => popover.value?.root);
|
|
436
441
|
const popoverState = computed(() => popover.value?.state);
|
|
437
442
|
|
|
443
|
+
// Props
|
|
444
|
+
const { enableClear, modelValue } = toRefs(props);
|
|
445
|
+
|
|
438
446
|
// Styles
|
|
439
447
|
const rootStyles = computed(() => [
|
|
440
448
|
'or-select-v3',
|
|
@@ -469,7 +477,7 @@ export default defineComponent({
|
|
|
469
477
|
// State
|
|
470
478
|
const controlId = ref(context.attrs.id as string ?? currentInstance.uid.toString());
|
|
471
479
|
|
|
472
|
-
const proxyModelValue = useProxyModelValue(
|
|
480
|
+
const proxyModelValue = useProxyModelValue(modelValue, context.emit);
|
|
473
481
|
|
|
474
482
|
const isEmptyModelValue = computed(() => {
|
|
475
483
|
return Array.isArray(proxyModelValue.value)
|
|
@@ -477,6 +485,10 @@ export default defineComponent({
|
|
|
477
485
|
: isEmptyValue(proxyModelValue.value);
|
|
478
486
|
});
|
|
479
487
|
|
|
488
|
+
const showClear = computed(() => {
|
|
489
|
+
return enableClear.value && !isEmptyModelValue.value;
|
|
490
|
+
});
|
|
491
|
+
|
|
480
492
|
onMounted(() => {
|
|
481
493
|
if (!proxyModelValue.value && props.multiple) {
|
|
482
494
|
proxyModelValue.value = [];
|
|
@@ -606,6 +618,7 @@ export default defineComponent({
|
|
|
606
618
|
proxyModelValue,
|
|
607
619
|
readonly,
|
|
608
620
|
isEmptyModelValue,
|
|
621
|
+
showClear,
|
|
609
622
|
selection,
|
|
610
623
|
searchText,
|
|
611
624
|
internalSearchOptions,
|