@varlet/ui 2.16.2 → 2.16.3-alpha.1694361535255
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/es/action-sheet/ActionSheet.mjs +20 -16
- package/es/app-bar/AppBar.mjs +10 -9
- package/es/avatar/Avatar.mjs +16 -15
- package/es/avatar-group/AvatarGroup.mjs +4 -3
- package/es/back-top/BackTop.mjs +20 -19
- package/es/badge/Badge.mjs +4 -3
- package/es/bottom-navigation/BottomNavigation.mjs +70 -63
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +13 -10
- package/es/breadcrumb/Breadcrumb.mjs +5 -4
- package/es/breadcrumbs/Breadcrumbs.mjs +2 -1
- package/es/button/Button.mjs +10 -9
- package/es/button-group/ButtonGroup.mjs +2 -1
- package/es/card/Card.mjs +28 -26
- package/es/cell/Cell.mjs +5 -4
- package/es/checkbox/Checkbox.mjs +32 -29
- package/es/checkbox-group/CheckboxGroup.mjs +45 -40
- package/es/chip/Chip.mjs +6 -5
- package/es/col/Col.mjs +15 -14
- package/es/collapse/Collapse.mjs +30 -29
- package/es/collapse-item/CollapseItem.mjs +52 -47
- package/es/countdown/Countdown.mjs +36 -35
- package/es/counter/Counter.mjs +63 -60
- package/es/date-picker/DatePicker.mjs +67 -63
- package/es/dialog/Dialog.mjs +39 -29
- package/es/divider/Divider.mjs +6 -9
- package/es/drag/Drag.mjs +47 -45
- package/es/ellipsis/Ellipsis.mjs +6 -5
- package/es/fab/Fab.mjs +21 -20
- package/es/field-decorator/FieldDecorator.mjs +14 -13
- package/es/form/Form.mjs +41 -36
- package/es/form-details/FormDetails.mjs +2 -1
- package/es/hover-overlay/HoverOverlay.mjs +6 -7
- package/es/icon/Icon.mjs +14 -12
- package/es/image/Image.mjs +14 -12
- package/es/image-preview/ImagePreview.mjs +51 -50
- package/es/index-anchor/IndexAnchor.mjs +15 -12
- package/es/index-bar/IndexBar.mjs +68 -65
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +63 -56
- package/es/link/Link.mjs +6 -5
- package/es/list/List.mjs +55 -46
- package/es/loading/Loading.mjs +11 -8
- package/es/loading-bar/LoadingBar.mjs +2 -1
- package/es/menu/Menu.mjs +2 -1
- package/es/option/Option.mjs +14 -11
- package/es/overlay/Overlay.mjs +18 -18
- package/es/pagination/Pagination.mjs +67 -64
- package/es/paper/Paper.mjs +4 -3
- package/es/picker/Picker.mjs +95 -85
- package/es/popup/Popup.mjs +26 -23
- package/es/progress/Progress.mjs +9 -8
- package/es/pull-refresh/PullRefresh.mjs +54 -51
- package/es/radio/Radio.mjs +25 -22
- package/es/radio-group/RadioGroup.mjs +30 -25
- package/es/rate/Rate.mjs +35 -28
- package/es/result/Result.mjs +6 -5
- package/es/row/Row.mjs +14 -13
- package/es/select/Select.mjs +57 -54
- package/es/skeleton/Skeleton.mjs +8 -9
- package/es/slider/Slider.mjs +86 -79
- package/es/snackbar/Snackbar.mjs +4 -3
- package/es/snackbar/style/index.mjs +1 -1
- package/es/space/Space.mjs +5 -2
- package/es/step/Step.mjs +7 -4
- package/es/steps/Steps.mjs +5 -4
- package/es/sticky/Sticky.mjs +30 -27
- package/es/style-provider/StyleProvider.mjs +2 -1
- package/es/swipe/Swipe.mjs +95 -89
- package/es/swipe-item/SwipeItem.mjs +5 -4
- package/es/switch/Switch.mjs +22 -17
- package/es/tab/Tab.mjs +16 -12
- package/es/tab-item/TabItem.mjs +7 -6
- package/es/table/Table.mjs +8 -9
- package/es/tabs/Tabs.mjs +57 -52
- package/es/tabs-items/TabsItems.mjs +38 -29
- package/es/time-picker/TimePicker.mjs +63 -60
- package/es/tooltip/Tooltip.mjs +3 -2
- package/es/uploader/Uploader.mjs +100 -85
- package/es/utils/components.mjs +2 -1
- package/es/utils/shared.mjs +0 -1
- package/es/varlet.esm.js +9589 -8914
- package/es/watermark/Watermark.mjs +29 -26
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +2365 -2102
- package/package.json +12 -14
- package/umd/varlet.js +4 -4
package/es/uploader/Uploader.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import { call, useValidation, createNamespace, formatElevation } from '../utils/
|
|
|
15
15
|
import { useForm } from '../form/provide.mjs';
|
|
16
16
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
17
17
|
var {
|
|
18
|
+
name,
|
|
18
19
|
n,
|
|
19
20
|
classes
|
|
20
21
|
} = createNamespace('uploader');
|
|
@@ -131,7 +132,7 @@ function __render__(_ctx, _cache) {
|
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
var __sfc__ = defineComponent({
|
|
134
|
-
name
|
|
135
|
+
name,
|
|
135
136
|
directives: {
|
|
136
137
|
Ripple,
|
|
137
138
|
Hover
|
|
@@ -181,7 +182,25 @@ var __sfc__ = defineComponent({
|
|
|
181
182
|
}
|
|
182
183
|
return modelValue;
|
|
183
184
|
});
|
|
184
|
-
var
|
|
185
|
+
var callReset = false;
|
|
186
|
+
var varFileUtils = {
|
|
187
|
+
getSuccess,
|
|
188
|
+
getError,
|
|
189
|
+
getLoading
|
|
190
|
+
};
|
|
191
|
+
var uploaderProvider = {
|
|
192
|
+
validate,
|
|
193
|
+
resetValidation,
|
|
194
|
+
reset
|
|
195
|
+
};
|
|
196
|
+
call(bindForm, uploaderProvider);
|
|
197
|
+
watch(() => props.modelValue, () => {
|
|
198
|
+
!callReset && validateWithTrigger('onChange');
|
|
199
|
+
callReset = false;
|
|
200
|
+
}, {
|
|
201
|
+
deep: true
|
|
202
|
+
});
|
|
203
|
+
function preview(varFile) {
|
|
185
204
|
var {
|
|
186
205
|
disabled,
|
|
187
206
|
readonly,
|
|
@@ -201,39 +220,45 @@ var __sfc__ = defineComponent({
|
|
|
201
220
|
currentPreview.value = varFile;
|
|
202
221
|
showPreview.value = true;
|
|
203
222
|
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
223
|
+
}
|
|
224
|
+
function createVarFile(file) {
|
|
225
|
+
return {
|
|
226
|
+
id: fid++,
|
|
227
|
+
url: '',
|
|
228
|
+
cover: '',
|
|
229
|
+
name: file.name,
|
|
230
|
+
file,
|
|
231
|
+
progress: 0
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
function getFiles(event) {
|
|
214
235
|
var el = event.target;
|
|
215
236
|
var {
|
|
216
237
|
files: fileList
|
|
217
238
|
} = el;
|
|
218
239
|
return Array.from(fileList);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
240
|
+
}
|
|
241
|
+
function resolver(varFile) {
|
|
242
|
+
return new Promise(resolve => {
|
|
243
|
+
// For performance, only file reader processing is performed on images
|
|
244
|
+
if (!varFile.file.type.startsWith('image')) {
|
|
245
|
+
resolve(varFile);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
var fileReader = new FileReader();
|
|
249
|
+
fileReader.onload = () => {
|
|
250
|
+
var base64 = fileReader.result;
|
|
251
|
+
varFile.cover = base64;
|
|
252
|
+
varFile.url = base64;
|
|
253
|
+
resolve(varFile);
|
|
254
|
+
};
|
|
255
|
+
fileReader.readAsDataURL(varFile.file);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function getResolvers(varFiles) {
|
|
259
|
+
return varFiles.map(resolver);
|
|
260
|
+
}
|
|
261
|
+
function getBeforeReaders(varFiles) {
|
|
237
262
|
var {
|
|
238
263
|
onBeforeRead
|
|
239
264
|
} = props;
|
|
@@ -252,9 +277,12 @@ var __sfc__ = defineComponent({
|
|
|
252
277
|
});
|
|
253
278
|
});
|
|
254
279
|
}));
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
280
|
+
}
|
|
281
|
+
function handleChange(_x) {
|
|
282
|
+
return _handleChange.apply(this, arguments);
|
|
283
|
+
}
|
|
284
|
+
function _handleChange() {
|
|
285
|
+
_handleChange = _asyncToGenerator(function* (event) {
|
|
258
286
|
var {
|
|
259
287
|
maxsize,
|
|
260
288
|
maxlength,
|
|
@@ -280,7 +308,7 @@ var __sfc__ = defineComponent({
|
|
|
280
308
|
return varFiles.slice(0, limit);
|
|
281
309
|
};
|
|
282
310
|
var getFilterVarFiles = /*#__PURE__*/function () {
|
|
283
|
-
var
|
|
311
|
+
var _ref = _asyncToGenerator(function* (varFiles) {
|
|
284
312
|
if (!onBeforeFilter) {
|
|
285
313
|
return varFiles;
|
|
286
314
|
}
|
|
@@ -292,8 +320,8 @@ var __sfc__ = defineComponent({
|
|
|
292
320
|
}
|
|
293
321
|
return varFiles;
|
|
294
322
|
});
|
|
295
|
-
return function getFilterVarFiles(
|
|
296
|
-
return
|
|
323
|
+
return function getFilterVarFiles(_x3) {
|
|
324
|
+
return _ref.apply(this, arguments);
|
|
297
325
|
};
|
|
298
326
|
}();
|
|
299
327
|
|
|
@@ -307,27 +335,28 @@ var __sfc__ = defineComponent({
|
|
|
307
335
|
// pre resolve
|
|
308
336
|
var resolvedVarFiles = yield Promise.all(getResolvers(varFiles));
|
|
309
337
|
var validationVarFiles = yield Promise.all(getBeforeReaders(resolvedVarFiles));
|
|
310
|
-
var validVarFiles = validationVarFiles.filter(
|
|
338
|
+
var validVarFiles = validationVarFiles.filter(_ref2 => {
|
|
311
339
|
var {
|
|
312
340
|
valid
|
|
313
|
-
} =
|
|
341
|
+
} = _ref2;
|
|
314
342
|
return valid;
|
|
315
|
-
}).map(
|
|
343
|
+
}).map(_ref3 => {
|
|
316
344
|
var {
|
|
317
345
|
varFile
|
|
318
|
-
} =
|
|
346
|
+
} = _ref3;
|
|
319
347
|
return varFile;
|
|
320
348
|
});
|
|
321
349
|
call(props['onUpdate:modelValue'], [...modelValue, ...validVarFiles]);
|
|
322
350
|
event.target.value = '';
|
|
323
351
|
validVarFiles.forEach(varFile => call(onAfterRead, reactive(varFile)));
|
|
324
352
|
});
|
|
325
|
-
return
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
353
|
+
return _handleChange.apply(this, arguments);
|
|
354
|
+
}
|
|
355
|
+
function handleRemove(_x2) {
|
|
356
|
+
return _handleRemove.apply(this, arguments);
|
|
357
|
+
} // expose
|
|
358
|
+
function _handleRemove() {
|
|
359
|
+
_handleRemove = _asyncToGenerator(function* (removedVarFile) {
|
|
331
360
|
var {
|
|
332
361
|
disabled,
|
|
333
362
|
readonly,
|
|
@@ -349,37 +378,34 @@ var __sfc__ = defineComponent({
|
|
|
349
378
|
validateWithTrigger('onRemove');
|
|
350
379
|
call(props['onUpdate:modelValue'], expectedFiles);
|
|
351
380
|
});
|
|
352
|
-
return
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
// expose
|
|
358
|
-
var getSuccess = () => props.modelValue.filter(varFile => varFile.state === 'success');
|
|
381
|
+
return _handleRemove.apply(this, arguments);
|
|
382
|
+
}
|
|
383
|
+
function getSuccess() {
|
|
384
|
+
return props.modelValue.filter(varFile => varFile.state === 'success');
|
|
385
|
+
}
|
|
359
386
|
|
|
360
387
|
// expose
|
|
361
|
-
|
|
388
|
+
function getError() {
|
|
389
|
+
return props.modelValue.filter(varFile => varFile.state === 'error');
|
|
390
|
+
}
|
|
362
391
|
|
|
363
392
|
// expose
|
|
364
|
-
|
|
393
|
+
function getLoading() {
|
|
394
|
+
return props.modelValue.filter(varFile => varFile.state === 'loading');
|
|
395
|
+
}
|
|
365
396
|
|
|
366
397
|
// expose
|
|
367
|
-
|
|
398
|
+
function chooseFile() {
|
|
368
399
|
input.value.click();
|
|
369
|
-
}
|
|
400
|
+
}
|
|
370
401
|
|
|
371
402
|
// expose
|
|
372
|
-
|
|
403
|
+
function closePreview() {
|
|
373
404
|
currentPreview.value = null;
|
|
374
405
|
showPreview.value = false;
|
|
375
406
|
ImagePreview.close();
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
getSuccess,
|
|
379
|
-
getError,
|
|
380
|
-
getLoading
|
|
381
|
-
};
|
|
382
|
-
var validateWithTrigger = trigger => {
|
|
407
|
+
}
|
|
408
|
+
function validateWithTrigger(trigger) {
|
|
383
409
|
nextTick(() => {
|
|
384
410
|
var {
|
|
385
411
|
validateTrigger,
|
|
@@ -388,34 +414,20 @@ var __sfc__ = defineComponent({
|
|
|
388
414
|
} = props;
|
|
389
415
|
vt(validateTrigger, trigger, rules, modelValue, varFileUtils);
|
|
390
416
|
});
|
|
391
|
-
}
|
|
392
|
-
var callReset = false;
|
|
417
|
+
}
|
|
393
418
|
|
|
394
419
|
// expose
|
|
395
|
-
|
|
420
|
+
function validate() {
|
|
421
|
+
return v(props.rules, props.modelValue, varFileUtils);
|
|
422
|
+
}
|
|
396
423
|
|
|
397
424
|
// expose
|
|
398
|
-
|
|
425
|
+
function reset() {
|
|
399
426
|
callReset = true;
|
|
400
427
|
call(props['onUpdate:modelValue'], []);
|
|
401
428
|
resetValidation();
|
|
402
|
-
}
|
|
403
|
-
var uploaderProvider = {
|
|
404
|
-
validate,
|
|
405
|
-
resetValidation,
|
|
406
|
-
reset
|
|
407
|
-
};
|
|
408
|
-
call(bindForm, uploaderProvider);
|
|
409
|
-
watch(() => props.modelValue, () => {
|
|
410
|
-
!callReset && validateWithTrigger('onChange');
|
|
411
|
-
callReset = false;
|
|
412
|
-
}, {
|
|
413
|
-
deep: true
|
|
414
|
-
});
|
|
429
|
+
}
|
|
415
430
|
return {
|
|
416
|
-
n,
|
|
417
|
-
classes,
|
|
418
|
-
formatElevation,
|
|
419
431
|
input,
|
|
420
432
|
files,
|
|
421
433
|
showPreview,
|
|
@@ -425,6 +437,9 @@ var __sfc__ = defineComponent({
|
|
|
425
437
|
hovering,
|
|
426
438
|
formDisabled: form == null ? void 0 : form.disabled,
|
|
427
439
|
formReadonly: form == null ? void 0 : form.readonly,
|
|
440
|
+
n,
|
|
441
|
+
classes,
|
|
442
|
+
formatElevation,
|
|
428
443
|
toNumber,
|
|
429
444
|
handleHovering,
|
|
430
445
|
isHTMLSupportVideo,
|
package/es/utils/components.mjs
CHANGED
|
@@ -3,7 +3,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
import { useEventListener } from '@varlet/use';
|
|
5
5
|
import { createApp, h, getCurrentInstance, isVNode, ref, onActivated, onDeactivated, Comment, Fragment, computed, watch } from 'vue';
|
|
6
|
-
import { isArray } from '@varlet/shared';
|
|
6
|
+
import { bigCamelize, isArray } from '@varlet/shared';
|
|
7
7
|
export function pickProps(props, propsKey) {
|
|
8
8
|
return Array.isArray(propsKey) ? propsKey.reduce((pickedProps, key) => {
|
|
9
9
|
pickedProps[key] = props[key];
|
|
@@ -180,6 +180,7 @@ export function createNamespace(name) {
|
|
|
180
180
|
});
|
|
181
181
|
};
|
|
182
182
|
return {
|
|
183
|
+
name: bigCamelize(componentName),
|
|
183
184
|
n: createBEM,
|
|
184
185
|
classes
|
|
185
186
|
};
|
package/es/utils/shared.mjs
CHANGED
|
@@ -36,7 +36,6 @@ export var createCache = max => {
|
|
|
36
36
|
export var linear = value => value;
|
|
37
37
|
export var cubic = value => Math.pow(value, 3);
|
|
38
38
|
export var easeInOutCubic = value => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
|
39
|
-
export var dt = (value, defaultText) => value == null ? defaultText : value;
|
|
40
39
|
|
|
41
40
|
// eslint-disable-next-line default-param-last
|
|
42
41
|
export var padStart = function (str, maxLength, fillString) {
|