@onereach/ui-components 17.1.1 → 17.1.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/OrDropAreaV3/OrDropArea.js +28 -2
- package/dist/bundled/v2/components/OrDropAreaV3/OrDropArea.vue.d.ts +10 -0
- package/dist/bundled/v3/components/OrDropAreaV3/OrDropArea.js +1 -1
- package/dist/bundled/v3/components/OrDropAreaV3/OrDropArea.vue.d.ts +10 -0
- package/dist/bundled/v3/components/OrDropAreaV3/index.js +1 -1
- package/dist/bundled/v3/components/OrDropAreaV3/props.js +1 -1
- package/dist/bundled/v3/components/OrDropAreaV3/styles.js +1 -1
- package/dist/bundled/v3/components/OrDropAreaV3/utils/approximateFileSize.js +1 -1
- package/dist/bundled/v3/components/OrDropAreaV3/utils/index.js +1 -1
- package/dist/bundled/v3/components/{OrDropAreaV3-cf5ef7d5.js → OrDropAreaV3-a9883f18.js} +28 -2
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/index.js +1 -1
- package/dist/esm/v2/{OrDropArea-7cf24c23.js → OrDropArea-78f52187.js} +28 -2
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-drop-area-v3/OrDropArea.vue.d.ts +10 -0
- package/dist/esm/v2/components/or-drop-area-v3/index.js +1 -1
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/{OrDropArea-24fe94e7.js → OrDropArea-8b3fc35c.js} +28 -2
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-drop-area-v3/OrDropArea.vue.d.ts +10 -0
- package/dist/esm/v3/components/or-drop-area-v3/index.js +1 -1
- package/dist/esm/v3/index.js +1 -1
- package/package.json +3 -3
- package/src/components/or-drop-area-v3/OrDropArea.vue +33 -2
|
@@ -40,6 +40,10 @@ var script = defineComponent({
|
|
|
40
40
|
disabled: {
|
|
41
41
|
type: Boolean,
|
|
42
42
|
default: false
|
|
43
|
+
},
|
|
44
|
+
error: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
43
47
|
}
|
|
44
48
|
},
|
|
45
49
|
emits: ['update:modelValue'],
|
|
@@ -56,13 +60,34 @@ var script = defineComponent({
|
|
|
56
60
|
const constraintsStyles = computed(() => [...DropAreaConstraints]);
|
|
57
61
|
// State
|
|
58
62
|
const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
|
|
63
|
+
const accept = computed(() => {
|
|
64
|
+
if (!props.fileTypes || !Array.isArray(props.fileTypes)) return '';
|
|
65
|
+
return props.fileTypes.join(',');
|
|
66
|
+
});
|
|
59
67
|
const invalid = computed(() => {
|
|
60
|
-
|
|
68
|
+
/* External error */
|
|
69
|
+
if (props.error) return true;
|
|
70
|
+
/* No validation provided */
|
|
71
|
+
if (!props.fileTypes) return false;
|
|
72
|
+
/* File type match: strict and non-strict MIME-type comparison */
|
|
73
|
+
if (props.fileTypes.length > 0 && proxyModelValue.value.some(file => {
|
|
74
|
+
let match = props.fileTypes.some(fileType => {
|
|
75
|
+
if (fileType.match(/\/\*$/)) {
|
|
76
|
+
const baseType = fileType.replace('/*', '');
|
|
77
|
+
return file.type.indexOf(baseType) !== -1;
|
|
78
|
+
} else {
|
|
79
|
+
return file.type === fileType;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return !match;
|
|
83
|
+
})) {
|
|
61
84
|
return true;
|
|
62
85
|
}
|
|
86
|
+
/* Files count */
|
|
63
87
|
if (proxyModelValue.value.length > props.maxFiles) {
|
|
64
88
|
return true;
|
|
65
89
|
}
|
|
90
|
+
/* File size */
|
|
66
91
|
if (proxyModelValue.value.some(file => file.size > props.maxFileSize)) {
|
|
67
92
|
return true;
|
|
68
93
|
}
|
|
@@ -86,6 +111,7 @@ var script = defineComponent({
|
|
|
86
111
|
textEmphasisStyles,
|
|
87
112
|
constraintsStyles,
|
|
88
113
|
proxyModelValue,
|
|
114
|
+
accept,
|
|
89
115
|
invalid,
|
|
90
116
|
onChange,
|
|
91
117
|
isDesktop,
|
|
@@ -114,7 +140,7 @@ var __vue_render__ = function () {
|
|
|
114
140
|
class: _vm.controlStyles,
|
|
115
141
|
attrs: {
|
|
116
142
|
"type": 'file',
|
|
117
|
-
"accept": _vm.
|
|
143
|
+
"accept": _vm.accept,
|
|
118
144
|
"multiple": _vm.maxFiles > 1,
|
|
119
145
|
"disabled": _vm.disabled
|
|
120
146
|
},
|
|
@@ -26,6 +26,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
26
26
|
type: BooleanConstructor;
|
|
27
27
|
default: boolean;
|
|
28
28
|
};
|
|
29
|
+
error: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
29
33
|
}, {
|
|
30
34
|
root: import("vue-demi").Ref<HTMLElement | undefined>;
|
|
31
35
|
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
@@ -35,6 +39,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
35
39
|
textEmphasisStyles: import("vue-demi").ComputedRef<string[]>;
|
|
36
40
|
constraintsStyles: import("vue-demi").ComputedRef<string[]>;
|
|
37
41
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<File[]>;
|
|
42
|
+
accept: import("vue-demi").ComputedRef<string>;
|
|
38
43
|
invalid: import("vue-demi").ComputedRef<boolean>;
|
|
39
44
|
onChange: (event: Event) => void;
|
|
40
45
|
isDesktop: import("vue-demi").ComputedRef<boolean>;
|
|
@@ -65,6 +70,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
65
70
|
type: BooleanConstructor;
|
|
66
71
|
default: boolean;
|
|
67
72
|
};
|
|
73
|
+
error: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
default: boolean;
|
|
76
|
+
};
|
|
68
77
|
}>> & {
|
|
69
78
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
70
79
|
}, {
|
|
@@ -74,5 +83,6 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
74
83
|
maxFileSize: number;
|
|
75
84
|
size: "m" | "s";
|
|
76
85
|
disabled: boolean;
|
|
86
|
+
error: boolean;
|
|
77
87
|
}>;
|
|
78
88
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { s as default } from '../OrDropAreaV3-
|
|
1
|
+
export { s as default } from '../OrDropAreaV3-a9883f18.js';
|
|
@@ -26,6 +26,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
26
26
|
type: BooleanConstructor;
|
|
27
27
|
default: boolean;
|
|
28
28
|
};
|
|
29
|
+
error: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
29
33
|
}, {
|
|
30
34
|
root: import("vue-demi").Ref<HTMLElement | undefined>;
|
|
31
35
|
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
@@ -35,6 +39,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
35
39
|
textEmphasisStyles: import("vue-demi").ComputedRef<string[]>;
|
|
36
40
|
constraintsStyles: import("vue-demi").ComputedRef<string[]>;
|
|
37
41
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<File[]>;
|
|
42
|
+
accept: import("vue-demi").ComputedRef<string>;
|
|
38
43
|
invalid: import("vue-demi").ComputedRef<boolean>;
|
|
39
44
|
onChange: (event: Event) => void;
|
|
40
45
|
isDesktop: import("vue-demi").ComputedRef<boolean>;
|
|
@@ -65,6 +70,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
65
70
|
type: BooleanConstructor;
|
|
66
71
|
default: boolean;
|
|
67
72
|
};
|
|
73
|
+
error: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
default: boolean;
|
|
76
|
+
};
|
|
68
77
|
}>> & {
|
|
69
78
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
70
79
|
}, {
|
|
@@ -74,5 +83,6 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
74
83
|
maxFileSize: number;
|
|
75
84
|
size: "m" | "s";
|
|
76
85
|
disabled: boolean;
|
|
86
|
+
error: boolean;
|
|
77
87
|
}>;
|
|
78
88
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as DropAreaSize, s as OrDropAreaV3, a as approximateFileSize } from '../OrDropAreaV3-
|
|
1
|
+
export { D as DropAreaSize, s as OrDropAreaV3, a as approximateFileSize } from '../OrDropAreaV3-a9883f18.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { D as DropAreaSize } from '../OrDropAreaV3-
|
|
1
|
+
export { D as DropAreaSize } from '../OrDropAreaV3-a9883f18.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { b as DropArea, i as DropAreaConstraints, d as DropAreaControl, e as DropAreaIcon, f as DropAreaIconSizes, c as DropAreaSizes, g as DropAreaText, h as DropAreaTextEmphasis } from '../OrDropAreaV3-
|
|
1
|
+
export { b as DropArea, i as DropAreaConstraints, d as DropAreaControl, e as DropAreaIcon, f as DropAreaIconSizes, c as DropAreaSizes, g as DropAreaText, h as DropAreaTextEmphasis } from '../OrDropAreaV3-a9883f18.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as approximateFileSize } from '../../OrDropAreaV3-
|
|
1
|
+
export { a as approximateFileSize } from '../../OrDropAreaV3-a9883f18.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as approximateFileSize } from '../../OrDropAreaV3-
|
|
1
|
+
export { a as approximateFileSize } from '../../OrDropAreaV3-a9883f18.js';
|
|
@@ -120,6 +120,10 @@ var script = defineComponent({
|
|
|
120
120
|
disabled: {
|
|
121
121
|
type: Boolean,
|
|
122
122
|
default: false
|
|
123
|
+
},
|
|
124
|
+
error: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
default: false
|
|
123
127
|
}
|
|
124
128
|
},
|
|
125
129
|
emits: ['update:modelValue'],
|
|
@@ -136,13 +140,34 @@ var script = defineComponent({
|
|
|
136
140
|
const constraintsStyles = computed(() => [...DropAreaConstraints]);
|
|
137
141
|
// State
|
|
138
142
|
const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
|
|
143
|
+
const accept = computed(() => {
|
|
144
|
+
if (!props.fileTypes || !Array.isArray(props.fileTypes)) return '';
|
|
145
|
+
return props.fileTypes.join(',');
|
|
146
|
+
});
|
|
139
147
|
const invalid = computed(() => {
|
|
140
|
-
|
|
148
|
+
/* External error */
|
|
149
|
+
if (props.error) return true;
|
|
150
|
+
/* No validation provided */
|
|
151
|
+
if (!props.fileTypes) return false;
|
|
152
|
+
/* File type match: strict and non-strict MIME-type comparison */
|
|
153
|
+
if (props.fileTypes.length > 0 && proxyModelValue.value.some(file => {
|
|
154
|
+
let match = props.fileTypes.some(fileType => {
|
|
155
|
+
if (fileType.match(/\/\*$/)) {
|
|
156
|
+
const baseType = fileType.replace('/*', '');
|
|
157
|
+
return file.type.indexOf(baseType) !== -1;
|
|
158
|
+
} else {
|
|
159
|
+
return file.type === fileType;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return !match;
|
|
163
|
+
})) {
|
|
141
164
|
return true;
|
|
142
165
|
}
|
|
166
|
+
/* Files count */
|
|
143
167
|
if (proxyModelValue.value.length > props.maxFiles) {
|
|
144
168
|
return true;
|
|
145
169
|
}
|
|
170
|
+
/* File size */
|
|
146
171
|
if (proxyModelValue.value.some(file => file.size > props.maxFileSize)) {
|
|
147
172
|
return true;
|
|
148
173
|
}
|
|
@@ -166,6 +191,7 @@ var script = defineComponent({
|
|
|
166
191
|
textEmphasisStyles,
|
|
167
192
|
constraintsStyles,
|
|
168
193
|
proxyModelValue,
|
|
194
|
+
accept,
|
|
169
195
|
invalid,
|
|
170
196
|
onChange,
|
|
171
197
|
isDesktop,
|
|
@@ -193,7 +219,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
193
219
|
}, [createElementVNode("input", {
|
|
194
220
|
class: normalizeClass(_ctx.controlStyles),
|
|
195
221
|
type: 'file',
|
|
196
|
-
accept: _ctx.
|
|
222
|
+
accept: _ctx.accept,
|
|
197
223
|
multiple: _ctx.maxFiles > 1,
|
|
198
224
|
disabled: _ctx.disabled,
|
|
199
225
|
onChange: _cache[0] || (_cache[0] = $event => _ctx.onChange($event))
|
|
@@ -32,7 +32,7 @@ export { s as OrDateTimeFormatV3 } from './OrDateTimeFormatV3-295547f5.js';
|
|
|
32
32
|
export { D as DEFAULT_TEXT, s as OrDateTimePicker, n as OrDateTimePickerItemTypes, O as OrDateTimePickerTypes } from './OrDateTimePicker-30ec840a.js';
|
|
33
33
|
export { a as OrDateTimePickerDateControl, b as OrDateTimePickerDateSelect, c as OrDateTimePickerMobileControl, d as OrDateTimePickerMonthSelect, e as OrDateTimePickerPopoverFooter, g as OrDateTimePickerPopoverHeader, l as OrDateTimePickerTimeControl, m as OrDateTimePickerTimeSelect, s as OrDateTimePickerV3, f as formatDate, i as formatMobileDate, n as formatMobileTime, k as formatTime, h as getCurrentDate, j as getNextMonthDate } from './OrDateTimePickerV3-a996d0ed.js';
|
|
34
34
|
export { D as DrawerPlacement, s as OrDrawerV3 } from './OrDrawerV3-28a3fff2.js';
|
|
35
|
-
export { D as DropAreaSize, s as OrDropAreaV3, a as approximateFileSize } from './OrDropAreaV3-
|
|
35
|
+
export { D as DropAreaSize, s as OrDropAreaV3, a as approximateFileSize } from './OrDropAreaV3-a9883f18.js';
|
|
36
36
|
export { E as EditorTabsOverflow, s as OrEditorTabsV3 } from './OrEditorTabsV3-dd261195.js';
|
|
37
37
|
export { E as EmptyStateSize, s as OrEmptyStateV3 } from './OrEmptyStateV3-af47ab45.js';
|
|
38
38
|
export { default as OrError } from './OrError/OrError.js';
|
package/dist/bundled/v3/index.js
CHANGED
|
@@ -22,7 +22,7 @@ export { s as OrDateRangePickerV3 } from './components/OrDateRangePickerV3-90be1
|
|
|
22
22
|
export { s as OrDateTimeFormatV3 } from './components/OrDateTimeFormatV3-295547f5.js';
|
|
23
23
|
export { D as DEFAULT_TEXT, s as OrDateTimePicker, n as OrDateTimePickerItemTypes, O as OrDateTimePickerTypes } from './components/OrDateTimePicker-30ec840a.js';
|
|
24
24
|
export { D as DrawerPlacement, s as OrDrawerV3 } from './components/OrDrawerV3-28a3fff2.js';
|
|
25
|
-
export { D as DropAreaSize, s as OrDropAreaV3, a as approximateFileSize } from './components/OrDropAreaV3-
|
|
25
|
+
export { D as DropAreaSize, s as OrDropAreaV3, a as approximateFileSize } from './components/OrDropAreaV3-a9883f18.js';
|
|
26
26
|
export { E as EditorTabsOverflow, s as OrEditorTabsV3 } from './components/OrEditorTabsV3-dd261195.js';
|
|
27
27
|
export { E as EmptyStateSize, s as OrEmptyStateV3 } from './components/OrEmptyStateV3-af47ab45.js';
|
|
28
28
|
export { s as OrErrorTagV3 } from './components/OrErrorTagV3-1b00b9d5.js';
|
|
@@ -119,6 +119,10 @@ var script = defineComponent({
|
|
|
119
119
|
disabled: {
|
|
120
120
|
type: Boolean,
|
|
121
121
|
default: false
|
|
122
|
+
},
|
|
123
|
+
error: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: false
|
|
122
126
|
}
|
|
123
127
|
},
|
|
124
128
|
emits: ['update:modelValue'],
|
|
@@ -135,13 +139,34 @@ var script = defineComponent({
|
|
|
135
139
|
const constraintsStyles = computed(() => [...DropAreaConstraints]);
|
|
136
140
|
// State
|
|
137
141
|
const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
|
|
142
|
+
const accept = computed(() => {
|
|
143
|
+
if (!props.fileTypes || !Array.isArray(props.fileTypes)) return '';
|
|
144
|
+
return props.fileTypes.join(',');
|
|
145
|
+
});
|
|
138
146
|
const invalid = computed(() => {
|
|
139
|
-
|
|
147
|
+
/* External error */
|
|
148
|
+
if (props.error) return true;
|
|
149
|
+
/* No validation provided */
|
|
150
|
+
if (!props.fileTypes) return false;
|
|
151
|
+
/* File type match: strict and non-strict MIME-type comparison */
|
|
152
|
+
if (props.fileTypes.length > 0 && proxyModelValue.value.some(file => {
|
|
153
|
+
let match = props.fileTypes.some(fileType => {
|
|
154
|
+
if (fileType.match(/\/\*$/)) {
|
|
155
|
+
const baseType = fileType.replace('/*', '');
|
|
156
|
+
return file.type.indexOf(baseType) !== -1;
|
|
157
|
+
} else {
|
|
158
|
+
return file.type === fileType;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return !match;
|
|
162
|
+
})) {
|
|
140
163
|
return true;
|
|
141
164
|
}
|
|
165
|
+
/* Files count */
|
|
142
166
|
if (proxyModelValue.value.length > props.maxFiles) {
|
|
143
167
|
return true;
|
|
144
168
|
}
|
|
169
|
+
/* File size */
|
|
145
170
|
if (proxyModelValue.value.some(file => file.size > props.maxFileSize)) {
|
|
146
171
|
return true;
|
|
147
172
|
}
|
|
@@ -165,6 +190,7 @@ var script = defineComponent({
|
|
|
165
190
|
textEmphasisStyles,
|
|
166
191
|
constraintsStyles,
|
|
167
192
|
proxyModelValue,
|
|
193
|
+
accept,
|
|
168
194
|
invalid,
|
|
169
195
|
onChange,
|
|
170
196
|
isDesktop,
|
|
@@ -193,7 +219,7 @@ var __vue_render__ = function () {
|
|
|
193
219
|
class: _vm.controlStyles,
|
|
194
220
|
attrs: {
|
|
195
221
|
"type": 'file',
|
|
196
|
-
"accept": _vm.
|
|
222
|
+
"accept": _vm.accept,
|
|
197
223
|
"multiple": _vm.maxFiles > 1,
|
|
198
224
|
"disabled": _vm.disabled
|
|
199
225
|
},
|
|
@@ -47,7 +47,7 @@ export { f as formatDate, a as formatTime } from '../formatTime-3f37a00f.js';
|
|
|
47
47
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from '../getCurrentDate-e5a478c3.js';
|
|
48
48
|
export { g as getNextMonthDate } from '../getNextMonthDate-8ec29631.js';
|
|
49
49
|
export { D as DrawerPlacement, _ as OrDrawerV3 } from '../OrDrawer-ac6cdc09.js';
|
|
50
|
-
export { D as DropAreaSize, _ as OrDropAreaV3 } from '../OrDropArea-
|
|
50
|
+
export { D as DropAreaSize, _ as OrDropAreaV3 } from '../OrDropArea-78f52187.js';
|
|
51
51
|
export { a as approximateFileSize } from '../approximateFileSize-a48b356b.js';
|
|
52
52
|
export { E as EditorTabsOverflow, _ as OrEditorTabsV3 } from '../OrEditorTabs-17d79ae1.js';
|
|
53
53
|
export { E as EmptyStateSize, _ as OrEmptyStateV3 } from '../OrEmptyState-186f7abc.js';
|
|
@@ -26,6 +26,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
26
26
|
type: BooleanConstructor;
|
|
27
27
|
default: boolean;
|
|
28
28
|
};
|
|
29
|
+
error: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
29
33
|
}, {
|
|
30
34
|
root: import("vue-demi").Ref<HTMLElement | undefined>;
|
|
31
35
|
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
@@ -35,6 +39,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
35
39
|
textEmphasisStyles: import("vue-demi").ComputedRef<string[]>;
|
|
36
40
|
constraintsStyles: import("vue-demi").ComputedRef<string[]>;
|
|
37
41
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<File[]>;
|
|
42
|
+
accept: import("vue-demi").ComputedRef<string>;
|
|
38
43
|
invalid: import("vue-demi").ComputedRef<boolean>;
|
|
39
44
|
onChange: (event: Event) => void;
|
|
40
45
|
isDesktop: import("vue-demi").ComputedRef<boolean>;
|
|
@@ -65,6 +70,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
65
70
|
type: BooleanConstructor;
|
|
66
71
|
default: boolean;
|
|
67
72
|
};
|
|
73
|
+
error: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
default: boolean;
|
|
76
|
+
};
|
|
68
77
|
}>> & {
|
|
69
78
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
70
79
|
}, {
|
|
@@ -74,5 +83,6 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
74
83
|
maxFileSize: number;
|
|
75
84
|
size: "m" | "s";
|
|
76
85
|
disabled: boolean;
|
|
86
|
+
error: boolean;
|
|
77
87
|
}>;
|
|
78
88
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DropAreaSize, _ as OrDropAreaV3 } from '../../OrDropArea-
|
|
1
|
+
export { D as DropAreaSize, _ as OrDropAreaV3 } from '../../OrDropArea-78f52187.js';
|
|
2
2
|
export { a as approximateFileSize } from '../../approximateFileSize-a48b356b.js';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import '../../TimeFormat-a7f5565b.js';
|
package/dist/esm/v2/index.js
CHANGED
|
@@ -47,7 +47,7 @@ export { f as formatDate, a as formatTime } from './formatTime-3f37a00f.js';
|
|
|
47
47
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from './getCurrentDate-e5a478c3.js';
|
|
48
48
|
export { g as getNextMonthDate } from './getNextMonthDate-8ec29631.js';
|
|
49
49
|
export { D as DrawerPlacement, _ as OrDrawerV3 } from './OrDrawer-ac6cdc09.js';
|
|
50
|
-
export { D as DropAreaSize, _ as OrDropAreaV3 } from './OrDropArea-
|
|
50
|
+
export { D as DropAreaSize, _ as OrDropAreaV3 } from './OrDropArea-78f52187.js';
|
|
51
51
|
export { a as approximateFileSize } from './approximateFileSize-a48b356b.js';
|
|
52
52
|
export { E as EditorTabsOverflow, _ as OrEditorTabsV3 } from './OrEditorTabs-17d79ae1.js';
|
|
53
53
|
export { E as EmptyStateSize, _ as OrEmptyStateV3 } from './OrEmptyState-186f7abc.js';
|
|
@@ -119,6 +119,10 @@ var script = defineComponent({
|
|
|
119
119
|
disabled: {
|
|
120
120
|
type: Boolean,
|
|
121
121
|
default: false
|
|
122
|
+
},
|
|
123
|
+
error: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: false
|
|
122
126
|
}
|
|
123
127
|
},
|
|
124
128
|
emits: ['update:modelValue'],
|
|
@@ -135,13 +139,34 @@ var script = defineComponent({
|
|
|
135
139
|
const constraintsStyles = computed(() => [...DropAreaConstraints]);
|
|
136
140
|
// State
|
|
137
141
|
const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
|
|
142
|
+
const accept = computed(() => {
|
|
143
|
+
if (!props.fileTypes || !Array.isArray(props.fileTypes)) return '';
|
|
144
|
+
return props.fileTypes.join(',');
|
|
145
|
+
});
|
|
138
146
|
const invalid = computed(() => {
|
|
139
|
-
|
|
147
|
+
/* External error */
|
|
148
|
+
if (props.error) return true;
|
|
149
|
+
/* No validation provided */
|
|
150
|
+
if (!props.fileTypes) return false;
|
|
151
|
+
/* File type match: strict and non-strict MIME-type comparison */
|
|
152
|
+
if (props.fileTypes.length > 0 && proxyModelValue.value.some(file => {
|
|
153
|
+
let match = props.fileTypes.some(fileType => {
|
|
154
|
+
if (fileType.match(/\/\*$/)) {
|
|
155
|
+
const baseType = fileType.replace('/*', '');
|
|
156
|
+
return file.type.indexOf(baseType) !== -1;
|
|
157
|
+
} else {
|
|
158
|
+
return file.type === fileType;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return !match;
|
|
162
|
+
})) {
|
|
140
163
|
return true;
|
|
141
164
|
}
|
|
165
|
+
/* Files count */
|
|
142
166
|
if (proxyModelValue.value.length > props.maxFiles) {
|
|
143
167
|
return true;
|
|
144
168
|
}
|
|
169
|
+
/* File size */
|
|
145
170
|
if (proxyModelValue.value.some(file => file.size > props.maxFileSize)) {
|
|
146
171
|
return true;
|
|
147
172
|
}
|
|
@@ -165,6 +190,7 @@ var script = defineComponent({
|
|
|
165
190
|
textEmphasisStyles,
|
|
166
191
|
constraintsStyles,
|
|
167
192
|
proxyModelValue,
|
|
193
|
+
accept,
|
|
168
194
|
invalid,
|
|
169
195
|
onChange,
|
|
170
196
|
isDesktop,
|
|
@@ -192,7 +218,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
192
218
|
}, [createElementVNode("input", {
|
|
193
219
|
class: normalizeClass(_ctx.controlStyles),
|
|
194
220
|
type: 'file',
|
|
195
|
-
accept: _ctx.
|
|
221
|
+
accept: _ctx.accept,
|
|
196
222
|
multiple: _ctx.maxFiles > 1,
|
|
197
223
|
disabled: _ctx.disabled,
|
|
198
224
|
onChange: _cache[0] || (_cache[0] = $event => _ctx.onChange($event))
|
|
@@ -45,7 +45,7 @@ export { f as formatDate, a as formatTime } from '../formatTime-3f37a00f.js';
|
|
|
45
45
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from '../getCurrentDate-e5a478c3.js';
|
|
46
46
|
export { g as getNextMonthDate } from '../getNextMonthDate-8ec29631.js';
|
|
47
47
|
export { D as DrawerPlacement, s as OrDrawerV3 } from '../OrDrawer-f12faf1a.js';
|
|
48
|
-
export { D as DropAreaSize, s as OrDropAreaV3 } from '../OrDropArea-
|
|
48
|
+
export { D as DropAreaSize, s as OrDropAreaV3 } from '../OrDropArea-8b3fc35c.js';
|
|
49
49
|
export { a as approximateFileSize } from '../approximateFileSize-a48b356b.js';
|
|
50
50
|
export { E as EditorTabsOverflow, s as OrEditorTabsV3 } from '../OrEditorTabs-d5779ee7.js';
|
|
51
51
|
export { E as EmptyStateSize, s as OrEmptyStateV3 } from '../OrEmptyState-47f9d910.js';
|
|
@@ -26,6 +26,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
26
26
|
type: BooleanConstructor;
|
|
27
27
|
default: boolean;
|
|
28
28
|
};
|
|
29
|
+
error: {
|
|
30
|
+
type: BooleanConstructor;
|
|
31
|
+
default: boolean;
|
|
32
|
+
};
|
|
29
33
|
}, {
|
|
30
34
|
root: import("vue-demi").Ref<HTMLElement | undefined>;
|
|
31
35
|
rootStyles: import("vue-demi").ComputedRef<string[]>;
|
|
@@ -35,6 +39,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
35
39
|
textEmphasisStyles: import("vue-demi").ComputedRef<string[]>;
|
|
36
40
|
constraintsStyles: import("vue-demi").ComputedRef<string[]>;
|
|
37
41
|
proxyModelValue: import("../../hooks").UseProxyModelValueReturn<File[]>;
|
|
42
|
+
accept: import("vue-demi").ComputedRef<string>;
|
|
38
43
|
invalid: import("vue-demi").ComputedRef<boolean>;
|
|
39
44
|
onChange: (event: Event) => void;
|
|
40
45
|
isDesktop: import("vue-demi").ComputedRef<boolean>;
|
|
@@ -65,6 +70,10 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
65
70
|
type: BooleanConstructor;
|
|
66
71
|
default: boolean;
|
|
67
72
|
};
|
|
73
|
+
error: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
default: boolean;
|
|
76
|
+
};
|
|
68
77
|
}>> & {
|
|
69
78
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
70
79
|
}, {
|
|
@@ -74,5 +83,6 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
74
83
|
maxFileSize: number;
|
|
75
84
|
size: "m" | "s";
|
|
76
85
|
disabled: boolean;
|
|
86
|
+
error: boolean;
|
|
77
87
|
}>;
|
|
78
88
|
export default _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as DropAreaSize, s as OrDropAreaV3 } from '../../OrDropArea-
|
|
1
|
+
export { D as DropAreaSize, s as OrDropAreaV3 } from '../../OrDropArea-8b3fc35c.js';
|
|
2
2
|
export { a as approximateFileSize } from '../../approximateFileSize-a48b356b.js';
|
|
3
3
|
import 'vue-demi';
|
|
4
4
|
import '../../TimeFormat-a7f5565b.js';
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -45,7 +45,7 @@ export { f as formatDate, a as formatTime } from './formatTime-3f37a00f.js';
|
|
|
45
45
|
export { f as formatMobileDate, a as formatMobileTime, g as getCurrentDate } from './getCurrentDate-e5a478c3.js';
|
|
46
46
|
export { g as getNextMonthDate } from './getNextMonthDate-8ec29631.js';
|
|
47
47
|
export { D as DrawerPlacement, s as OrDrawerV3 } from './OrDrawer-f12faf1a.js';
|
|
48
|
-
export { D as DropAreaSize, s as OrDropAreaV3 } from './OrDropArea-
|
|
48
|
+
export { D as DropAreaSize, s as OrDropAreaV3 } from './OrDropArea-8b3fc35c.js';
|
|
49
49
|
export { a as approximateFileSize } from './approximateFileSize-a48b356b.js';
|
|
50
50
|
export { E as EditorTabsOverflow, s as OrEditorTabsV3 } from './OrEditorTabs-d5779ee7.js';
|
|
51
51
|
export { E as EmptyStateSize, s as OrEmptyStateV3 } from './OrEmptyState-47f9d910.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "17.1.
|
|
3
|
+
"version": "17.1.2",
|
|
4
4
|
"npmUnpacked": "4.15.2",
|
|
5
5
|
"description": "Vue components library for v2/3",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@codemirror/lang-json": "6.0.1",
|
|
41
41
|
"@codemirror/lang-markdown": "6.1.1",
|
|
42
42
|
"@floating-ui/dom": "1.5.3",
|
|
43
|
-
"@onereach/styles": "^17.1.
|
|
43
|
+
"@onereach/styles": "^17.1.2",
|
|
44
44
|
"@splidejs/splide": "4.0.6",
|
|
45
45
|
"@tiptap/core": "2.0.3",
|
|
46
46
|
"@tiptap/extension-blockquote": "2.0.3",
|
|
@@ -180,5 +180,5 @@
|
|
|
180
180
|
},
|
|
181
181
|
"./package.json": "./package.json"
|
|
182
182
|
},
|
|
183
|
-
"gitHead": "
|
|
183
|
+
"gitHead": "d86a8b3d0993a602dc7223b1d0927258bd023bb6"
|
|
184
184
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<input
|
|
9
9
|
:class="controlStyles"
|
|
10
10
|
:type="'file'"
|
|
11
|
-
:accept="
|
|
11
|
+
:accept="accept"
|
|
12
12
|
:multiple="maxFiles > 1"
|
|
13
13
|
:disabled="disabled"
|
|
14
14
|
@change="onChange($event)"
|
|
@@ -126,6 +126,11 @@ export default defineComponent({
|
|
|
126
126
|
type: Boolean,
|
|
127
127
|
default: false,
|
|
128
128
|
},
|
|
129
|
+
|
|
130
|
+
error: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false,
|
|
133
|
+
},
|
|
129
134
|
},
|
|
130
135
|
|
|
131
136
|
emits: [
|
|
@@ -173,15 +178,40 @@ export default defineComponent({
|
|
|
173
178
|
// State
|
|
174
179
|
const proxyModelValue = useProxyModelValue(toRef(props, 'modelValue'), context.emit);
|
|
175
180
|
|
|
181
|
+
const accept = computed(() => {
|
|
182
|
+
if (!props.fileTypes || !Array.isArray(props.fileTypes)) return '';
|
|
183
|
+
|
|
184
|
+
return props.fileTypes.join(',');
|
|
185
|
+
});
|
|
186
|
+
|
|
176
187
|
const invalid = computed(() => {
|
|
177
|
-
|
|
188
|
+
/* External error */
|
|
189
|
+
if (props.error) return true;
|
|
190
|
+
|
|
191
|
+
/* No validation provided */
|
|
192
|
+
if (!props.fileTypes) return false;
|
|
193
|
+
|
|
194
|
+
/* File type match: strict and non-strict MIME-type comparison */
|
|
195
|
+
if (props.fileTypes.length > 0 && proxyModelValue.value.some((file) => {
|
|
196
|
+
let match = props.fileTypes.some(fileType => {
|
|
197
|
+
if (fileType.match(/\/\*$/)) {
|
|
198
|
+
const baseType = fileType.replace('/*', '');
|
|
199
|
+
return file.type.indexOf(baseType) !== -1;
|
|
200
|
+
} else {
|
|
201
|
+
return file.type === fileType;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return !match;
|
|
205
|
+
})) {
|
|
178
206
|
return true;
|
|
179
207
|
}
|
|
180
208
|
|
|
209
|
+
/* Files count */
|
|
181
210
|
if (proxyModelValue.value.length > props.maxFiles) {
|
|
182
211
|
return true;
|
|
183
212
|
}
|
|
184
213
|
|
|
214
|
+
/* File size */
|
|
185
215
|
if (proxyModelValue.value.some((file) => file.size > props.maxFileSize)) {
|
|
186
216
|
return true;
|
|
187
217
|
}
|
|
@@ -208,6 +238,7 @@ export default defineComponent({
|
|
|
208
238
|
constraintsStyles,
|
|
209
239
|
|
|
210
240
|
proxyModelValue,
|
|
241
|
+
accept,
|
|
211
242
|
invalid,
|
|
212
243
|
|
|
213
244
|
onChange,
|