@varlet/ui 2.17.0 → 2.17.1

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/lib/varlet.cjs.js CHANGED
@@ -2156,13 +2156,13 @@ withInstall(stdin_default$3a);
2156
2156
  const _AppBarComponent = stdin_default$3a;
2157
2157
  var stdin_default$39 = stdin_default$3a;
2158
2158
  const isHTMLSupportImage = (val) => {
2159
- if (val == null) {
2159
+ if (!isString(val)) {
2160
2160
  return false;
2161
2161
  }
2162
- return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg|webp)$/.test(val);
2162
+ return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg|webp|ico)$/i.test(val);
2163
2163
  };
2164
2164
  const isHTMLSupportVideo = (val) => {
2165
- if (val == null) {
2165
+ if (!isString(val)) {
2166
2166
  return false;
2167
2167
  }
2168
2168
  return val.startsWith("data:video") || /\.(mp4|webm|ogg)$/.test(val);
@@ -16364,7 +16364,8 @@ function useSelect() {
16364
16364
  }
16365
16365
  const props$s = {
16366
16366
  label: {},
16367
- value: {}
16367
+ value: {},
16368
+ disabled: Boolean
16368
16369
  };
16369
16370
  const { name: name$s, n: n$v, classes: classes$p } = createNamespace("option");
16370
16371
  function __render__$x(_ctx, _cache) {
@@ -16375,7 +16376,7 @@ function __render__$x(_ctx, _cache) {
16375
16376
  return vue.withDirectives((vue.openBlock(), vue.createElementBlock(
16376
16377
  "div",
16377
16378
  {
16378
- class: vue.normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"), [_ctx.optionSelected, _ctx.n("--selected-color")])),
16379
+ class: vue.normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"), [_ctx.optionSelected, _ctx.n("--selected-color")], [_ctx.disabled, _ctx.n("--disabled")])),
16379
16380
  style: vue.normalizeStyle({
16380
16381
  color: _ctx.optionSelected ? _ctx.focusColor : void 0
16381
16382
  }),
@@ -16397,36 +16398,33 @@ function __render__$x(_ctx, _cache) {
16397
16398
  _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_var_checkbox, {
16398
16399
  key: 0,
16399
16400
  ref: "checkbox",
16400
- "checked-color": _ctx.focusColor,
16401
16401
  modelValue: _ctx.optionSelected,
16402
16402
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.optionSelected = $event),
16403
+ "checked-color": _ctx.focusColor,
16404
+ disabled: _ctx.disabled,
16403
16405
  onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
16404
16406
  }, ["stop"])),
16405
16407
  onChange: _ctx.handleSelect
16406
- }, null, 8, ["checked-color", "modelValue", "onChange"])) : vue.createCommentVNode("v-if", true),
16407
- vue.createElementVNode(
16408
- "div",
16409
- {
16410
- class: vue.normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
16411
- },
16412
- [
16413
- vue.renderSlot(_ctx.$slots, "default", {}, () => [
16414
- vue.createTextVNode(
16415
- vue.toDisplayString(_ctx.label),
16416
- 1
16417
- /* TEXT */
16418
- )
16419
- ])
16420
- ],
16421
- 2
16422
- /* CLASS */
16423
- ),
16424
- vue.createVNode(_component_var_hover_overlay, { hovering: _ctx.hovering }, null, 8, ["hovering"])
16408
+ }, null, 8, ["modelValue", "checked-color", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true),
16409
+ vue.renderSlot(_ctx.$slots, "default", {}, () => [
16410
+ vue.createElementVNode(
16411
+ "div",
16412
+ {
16413
+ class: vue.normalizeClass(_ctx.classes(_ctx.n("text"), _ctx.n("$--ellipsis")))
16414
+ },
16415
+ vue.toDisplayString(_ctx.label),
16416
+ 3
16417
+ /* TEXT, CLASS */
16418
+ )
16419
+ ]),
16420
+ vue.createVNode(_component_var_hover_overlay, {
16421
+ hovering: _ctx.hovering && !_ctx.disabled
16422
+ }, null, 8, ["hovering"])
16425
16423
  ],
16426
16424
  6
16427
16425
  /* CLASS, STYLE */
16428
16426
  )), [
16429
- [_directive_ripple],
16427
+ [_directive_ripple, { disabled: _ctx.disabled }],
16430
16428
  [_directive_hover, _ctx.handleHovering, "desktop"]
16431
16429
  ]);
16432
16430
  }
@@ -16455,24 +16453,27 @@ const __sfc__$y = vue.defineComponent({
16455
16453
  vue.watch([() => props2.label, () => props2.value], computeLabel);
16456
16454
  bindSelect(optionProvider);
16457
16455
  function handleClick() {
16456
+ if (props2.disabled) {
16457
+ return;
16458
+ }
16459
+ handleSelect();
16460
+ }
16461
+ function handleSelect() {
16458
16462
  if (multiple.value) {
16459
16463
  optionSelected.value = !optionSelected.value;
16460
16464
  }
16461
16465
  onSelect(optionProvider);
16462
16466
  }
16463
- function handleSelect() {
16464
- return onSelect(optionProvider);
16465
- }
16466
16467
  function sync(checked) {
16467
16468
  optionSelected.value = checked;
16468
16469
  }
16469
16470
  return {
16470
- n: n$v,
16471
- classes: classes$p,
16472
16471
  optionSelected,
16473
16472
  multiple,
16474
16473
  focusColor,
16475
16474
  hovering,
16475
+ n: n$v,
16476
+ classes: classes$p,
16476
16477
  handleHovering,
16477
16478
  handleClick,
16478
16479
  handleSelect
@@ -22257,7 +22258,7 @@ var stdin_default$c = {
22257
22258
  "--progress-label-color": "#fff"
22258
22259
  };
22259
22260
  var stdin_default$b = {
22260
- "--options-text-color": "#fff"
22261
+ "--option-text-color": "#fff"
22261
22262
  };
22262
22263
  var stdin_default$a = {
22263
22264
  "--countdown-text-color": "#fff"
@@ -23161,12 +23162,14 @@ const props$1 = {
23161
23162
  },
23162
23163
  rules: Array,
23163
23164
  hideList: Boolean,
23165
+ preventDefaultPreview: Boolean,
23164
23166
  onBeforeFilter: defineListenerProp(),
23165
23167
  onBeforeRead: defineListenerProp(),
23166
23168
  onAfterRead: defineListenerProp(),
23167
23169
  onBeforeRemove: defineListenerProp(),
23168
23170
  onRemove: defineListenerProp(),
23169
23171
  onOversize: defineListenerProp(),
23172
+ onPreview: defineListenerProp(),
23170
23173
  "onUpdate:modelValue": defineListenerProp()
23171
23174
  };
23172
23175
  var __async$1 = (__this, __arguments, generator) => {
@@ -23431,16 +23434,20 @@ const __sfc__$1 = vue.defineComponent({
23431
23434
  { deep: true }
23432
23435
  );
23433
23436
  function preview(varFile) {
23434
- const { disabled, previewed } = props2;
23437
+ const { disabled, previewed, preventDefaultPreview, onPreview } = props2;
23435
23438
  if ((form == null ? void 0 : form.disabled.value) || disabled || !previewed) {
23436
23439
  return;
23437
23440
  }
23441
+ call(onPreview, vue.reactive(varFile));
23442
+ if (preventDefaultPreview) {
23443
+ return;
23444
+ }
23438
23445
  const { url } = varFile;
23439
- if (isString(url) && isHTMLSupportImage(url)) {
23446
+ if (isHTMLSupportImage(url)) {
23440
23447
  stdin_default$1X(url);
23441
23448
  return;
23442
23449
  }
23443
- if (isString(url) && isHTMLSupportVideo(url)) {
23450
+ if (isHTMLSupportVideo(url)) {
23444
23451
  currentPreview.value = varFile;
23445
23452
  showPreview.value = true;
23446
23453
  }
@@ -24060,7 +24067,7 @@ const uploader = "";
24060
24067
  const UploaderSfc = "";
24061
24068
  const watermark = "";
24062
24069
  const WatermarkSfc = "";
24063
- const version = "2.17.0";
24070
+ const version = "2.17.1";
24064
24071
  function install(app) {
24065
24072
  stdin_default$3b.install && app.use(stdin_default$3b);
24066
24073
  stdin_default$39.install && app.use(stdin_default$39);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.17.0",
3
+ "version": "2.17.1",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -48,9 +48,9 @@
48
48
  "@popperjs/core": "^2.11.6",
49
49
  "dayjs": "^1.10.4",
50
50
  "decimal.js": "^10.2.1",
51
- "@varlet/icons": "2.17.0",
52
- "@varlet/shared": "2.17.0",
53
- "@varlet/use": "2.17.0"
51
+ "@varlet/icons": "2.17.1",
52
+ "@varlet/shared": "2.17.1",
53
+ "@varlet/use": "2.17.1"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@vue/runtime-core": "3.3.4",
@@ -66,9 +66,9 @@
66
66
  "typescript": "^5.1.5",
67
67
  "vue": "3.3.4",
68
68
  "vue-router": "4.2.0",
69
- "@varlet/cli": "2.17.0",
70
- "@varlet/touch-emulator": "2.17.0",
71
- "@varlet/ui": "2.17.0"
69
+ "@varlet/cli": "2.17.1",
70
+ "@varlet/ui": "2.17.1",
71
+ "@varlet/touch-emulator": "2.17.1"
72
72
  },
73
73
  "scripts": {
74
74
  "dev": "varlet-cli dev",
package/types/option.d.ts CHANGED
@@ -6,6 +6,7 @@ export declare const optionProps: Record<string, any>
6
6
  export interface OptionProps extends BasicAttributes {
7
7
  label?: any
8
8
  value?: any
9
+ disabled?: boolean
9
10
  }
10
11
 
11
12
  export class Option extends VarComponent {
@@ -43,6 +43,7 @@ export interface UploaderProps extends BasicAttributes {
43
43
  previewed?: boolean
44
44
  hideList?: boolean
45
45
  ripple?: boolean
46
+ preventDefaultPreview?: boolean
46
47
  resolveType?: UploaderResolveType
47
48
  validateTrigger?: Array<UploaderValidateTrigger>
48
49
  rules?: Array<(v: VarFile[], u: UploaderVarFileUtils) => any>
@@ -52,6 +53,7 @@ export interface UploaderProps extends BasicAttributes {
52
53
  onOversize?: ListenerProp<(file: VarFile) => any>
53
54
  onBeforeRemove?: ListenerProp<(file: VarFile) => any>
54
55
  onRemove?: ListenerProp<(file: VarFile) => any>
56
+ onPreview?: ListenerProp<(file: VarFile) => void>
55
57
  'onUpdate:modelValue'?: ListenerProp<(files: VarFile[]) => any>
56
58
  }
57
59