@varlet/ui 1.27.18 → 1.27.20

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.
@@ -31,8 +31,8 @@ export function render(_ctx, _cache) {
31
31
  class: _normalizeClass(_ctx.classes(_ctx.n('title-year'), [_ctx.isYearPanel, _ctx.n('title-year--active')])),
32
32
  onClick: _cache[0] || (_cache[0] = $event => _ctx.clickEl('year'))
33
33
  }, [_renderSlot(_ctx.$slots, "year", {
34
- year: _ctx.previewYear
35
- }, () => [_createTextVNode(_toDisplayString(_ctx.previewYear), 1
34
+ year: _ctx.chooseYear
35
+ }, () => [_createTextVNode(_toDisplayString(_ctx.chooseYear), 1
36
36
  /* TEXT */
37
37
  )])], 2
38
38
  /* CLASS */
@@ -375,6 +375,7 @@ export default defineComponent({
375
375
  range,
376
376
  multiple,
377
377
  onChange,
378
+ onPreview,
378
379
  'onUpdate:modelValue': updateModelValue
379
380
  } = props;
380
381
  reverse.value = getReverse('month', month);
@@ -387,6 +388,7 @@ export default defineComponent({
387
388
  }
388
389
  } else {
389
390
  previewMonth.value = month;
391
+ call(onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
390
392
  }
391
393
 
392
394
  isMonthPanel.value = false;
@@ -396,6 +398,7 @@ export default defineComponent({
396
398
  previewYear.value = "" + year;
397
399
  isYearPanel.value = false;
398
400
  isMonthPanel.value = true;
401
+ call(props.onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
399
402
  };
400
403
 
401
404
  var checkPreview = (type, checkType) => {
@@ -418,6 +421,8 @@ export default defineComponent({
418
421
 
419
422
  previewMonth.value = MONTH_LIST.find(month => toNumber(month.index) === checkIndex);
420
423
  }
424
+
425
+ call(props.onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
421
426
  };
422
427
 
423
428
  var checkValue = () => {
@@ -94,6 +94,9 @@ export var props = {
94
94
  type: Boolean,
95
95
  default: true
96
96
  },
97
+ onPreview: {
98
+ type: Function
99
+ },
97
100
  onChange: {
98
101
  type: Function
99
102
  },
@@ -323,7 +323,7 @@ export default defineComponent({
323
323
  }
324
324
 
325
325
  pageList.value = list;
326
- if (oldCurrent !== undefined) onChange == null ? void 0 : onChange(newCurrent, newSize);
326
+ if (oldCurrent !== undefined && pageCount.value > 0) onChange == null ? void 0 : onChange(newCurrent, newSize);
327
327
  (_props$onUpdateCurre = props['onUpdate:current']) == null ? void 0 : _props$onUpdateCurre.call(props, newCurrent);
328
328
  (_props$onUpdateSize = props['onUpdate:size']) == null ? void 0 : _props$onUpdateSize.call(props, newSize);
329
329
  }, {
@@ -4,7 +4,7 @@ export var isHTMLSupportImage = val => {
4
4
  return false;
5
5
  }
6
6
 
7
- return val.startsWith('data:image') || /\.(png|jpg|gif|jpeg|svg)$/.test(val);
7
+ return val.startsWith('data:image') || /\.(png|jpg|gif|jpeg|svg|webp)$/.test(val);
8
8
  };
9
9
  export var isHTMLSupportVideo = val => {
10
10
  if (val == null) {
package/es/varlet.esm.js CHANGED
@@ -1188,7 +1188,7 @@ var isHTMLSupportImage = (val) => {
1188
1188
  if (val == null) {
1189
1189
  return false;
1190
1190
  }
1191
- return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg)$/.test(val);
1191
+ return val.startsWith("data:image") || /\.(png|jpg|gif|jpeg|svg|webp)$/.test(val);
1192
1192
  };
1193
1193
  var isHTMLSupportVideo = (val) => {
1194
1194
  if (val == null) {
@@ -7278,6 +7278,9 @@ var props$z = {
7278
7278
  type: Boolean,
7279
7279
  default: true
7280
7280
  },
7281
+ onPreview: {
7282
+ type: Function
7283
+ },
7281
7284
  onChange: {
7282
7285
  type: Function
7283
7286
  },
@@ -8070,8 +8073,8 @@ function render$B(_ctx, _cache) {
8070
8073
  class: normalizeClass(_ctx.classes(_ctx.n("title-year"), [_ctx.isYearPanel, _ctx.n("title-year--active")])),
8071
8074
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.clickEl("year"))
8072
8075
  }, [renderSlot(_ctx.$slots, "year", {
8073
- year: _ctx.previewYear
8074
- }, () => [createTextVNode(toDisplayString(_ctx.previewYear), 1)])], 2), createElementVNode("div", {
8076
+ year: _ctx.chooseYear
8077
+ }, () => [createTextVNode(toDisplayString(_ctx.chooseYear), 1)])], 2), createElementVNode("div", {
8075
8078
  class: normalizeClass(_ctx.classes(_ctx.n("title-date"), [!_ctx.isYearPanel, _ctx.n("title-date--active")], [_ctx.range, _ctx.n("title-date--range")])),
8076
8079
  onClick: _cache[1] || (_cache[1] = ($event) => _ctx.clickEl("date"))
8077
8080
  }, [createVNode(Transition, {
@@ -8375,6 +8378,7 @@ var DatePicker = defineComponent({
8375
8378
  range,
8376
8379
  multiple,
8377
8380
  onChange,
8381
+ onPreview,
8378
8382
  "onUpdate:modelValue": updateModelValue
8379
8383
  } = props2;
8380
8384
  reverse.value = getReverse("month", month);
@@ -8390,6 +8394,7 @@ var DatePicker = defineComponent({
8390
8394
  }
8391
8395
  } else {
8392
8396
  previewMonth.value = month;
8397
+ call(onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
8393
8398
  }
8394
8399
  isMonthPanel.value = false;
8395
8400
  };
@@ -8397,6 +8402,7 @@ var DatePicker = defineComponent({
8397
8402
  previewYear.value = "" + year;
8398
8403
  isYearPanel.value = false;
8399
8404
  isMonthPanel.value = true;
8405
+ call(props2.onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
8400
8406
  };
8401
8407
  var checkPreview = (type, checkType2) => {
8402
8408
  var changeValue = checkType2 === "prev" ? -1 : 1;
@@ -8414,6 +8420,7 @@ var DatePicker = defineComponent({
8414
8420
  }
8415
8421
  previewMonth.value = MONTH_LIST.find((month) => toNumber(month.index) === checkIndex);
8416
8422
  }
8423
+ call(props2.onPreview, toNumber(previewYear.value), toNumber(previewMonth.value.index));
8417
8424
  };
8418
8425
  var checkValue = () => {
8419
8426
  if ((props2.multiple || props2.range) && !isArray(props2.modelValue)) {
@@ -11958,7 +11965,7 @@ var Pagination = defineComponent({
11958
11965
  }
11959
11966
  }
11960
11967
  pageList.value = list2;
11961
- if (oldCurrent !== void 0)
11968
+ if (oldCurrent !== void 0 && pageCount.value > 0)
11962
11969
  onChange == null ? void 0 : onChange(newCurrent, newSize);
11963
11970
  (_props$onUpdateCurre = props2["onUpdate:current"]) == null ? void 0 : _props$onUpdateCurre.call(props2, newCurrent);
11964
11971
  (_props$onUpdateSize = props2["onUpdate:size"]) == null ? void 0 : _props$onUpdateSize.call(props2, newSize);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "1.27.17",
4
+ "version": "1.27.19",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -1761,9 +1761,13 @@
1761
1761
  }
1762
1762
  ],
1763
1763
  "events": [
1764
+ {
1765
+ "name": "preview",
1766
+ "description": "日期切换时触发"
1767
+ },
1764
1768
  {
1765
1769
  "name": "change",
1766
- "description": "日期变化时触发"
1770
+ "description": "日期改变时触发"
1767
1771
  }
1768
1772
  ],
1769
1773
  "slots": [
@@ -49,8 +49,8 @@ function render(_ctx, _cache) {
49
49
  class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n('title-year'), [_ctx.isYearPanel, _ctx.n('title-year--active')])),
50
50
  onClick: _cache[0] || (_cache[0] = $event => _ctx.clickEl('year'))
51
51
  }, [(0, _vue.renderSlot)(_ctx.$slots, "year", {
52
- year: _ctx.previewYear
53
- }, () => [(0, _vue.createTextVNode)((0, _vue.toDisplayString)(_ctx.previewYear), 1
52
+ year: _ctx.chooseYear
53
+ }, () => [(0, _vue.createTextVNode)((0, _vue.toDisplayString)(_ctx.chooseYear), 1
54
54
  /* TEXT */
55
55
  )])], 2
56
56
  /* CLASS */
@@ -398,6 +398,7 @@ var _default = (0, _vue.defineComponent)({
398
398
  range,
399
399
  multiple,
400
400
  onChange,
401
+ onPreview,
401
402
  'onUpdate:modelValue': updateModelValue
402
403
  } = props;
403
404
  reverse.value = getReverse('month', month);
@@ -410,6 +411,7 @@ var _default = (0, _vue.defineComponent)({
410
411
  }
411
412
  } else {
412
413
  previewMonth.value = month;
414
+ (0, _components.call)(onPreview, (0, _shared.toNumber)(previewYear.value), (0, _shared.toNumber)(previewMonth.value.index));
413
415
  }
414
416
 
415
417
  isMonthPanel.value = false;
@@ -419,6 +421,7 @@ var _default = (0, _vue.defineComponent)({
419
421
  previewYear.value = "" + year;
420
422
  isYearPanel.value = false;
421
423
  isMonthPanel.value = true;
424
+ (0, _components.call)(props.onPreview, (0, _shared.toNumber)(previewYear.value), (0, _shared.toNumber)(previewMonth.value.index));
422
425
  };
423
426
 
424
427
  var checkPreview = (type, checkType) => {
@@ -441,6 +444,8 @@ var _default = (0, _vue.defineComponent)({
441
444
 
442
445
  previewMonth.value = _props.MONTH_LIST.find(month => (0, _shared.toNumber)(month.index) === checkIndex);
443
446
  }
447
+
448
+ (0, _components.call)(props.onPreview, (0, _shared.toNumber)(previewYear.value), (0, _shared.toNumber)(previewMonth.value.index));
444
449
  };
445
450
 
446
451
  var checkValue = () => {
@@ -101,6 +101,9 @@ var props = {
101
101
  type: Boolean,
102
102
  default: true
103
103
  },
104
+ onPreview: {
105
+ type: Function
106
+ },
104
107
  onChange: {
105
108
  type: Function
106
109
  },
@@ -342,7 +342,7 @@ var _default = (0, _vue.defineComponent)({
342
342
  }
343
343
 
344
344
  pageList.value = list;
345
- if (oldCurrent !== undefined) onChange == null ? void 0 : onChange(newCurrent, newSize);
345
+ if (oldCurrent !== undefined && pageCount.value > 0) onChange == null ? void 0 : onChange(newCurrent, newSize);
346
346
  (_props$onUpdateCurre = props['onUpdate:current']) == null ? void 0 : _props$onUpdateCurre.call(props, newCurrent);
347
347
  (_props$onUpdateSize = props['onUpdate:size']) == null ? void 0 : _props$onUpdateSize.call(props, newSize);
348
348
  }, {
@@ -10,7 +10,7 @@ var isHTMLSupportImage = val => {
10
10
  return false;
11
11
  }
12
12
 
13
- return val.startsWith('data:image') || /\.(png|jpg|gif|jpeg|svg)$/.test(val);
13
+ return val.startsWith('data:image') || /\.(png|jpg|gif|jpeg|svg|webp)$/.test(val);
14
14
  };
15
15
 
16
16
  exports.isHTMLSupportImage = isHTMLSupportImage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "1.27.18",
3
+ "version": "1.27.20",
4
4
  "description": "A material like components library",
5
5
  "module": "es/index.js",
6
6
  "main": "lib/index.js",
@@ -37,6 +37,10 @@
37
37
  "sideEffects": [
38
38
  "es/**/style/*",
39
39
  "lib/**/style/*",
40
+ "es/style.js",
41
+ "es/less.js",
42
+ "lib/style.js",
43
+ "lib/less.js",
40
44
  "*.css",
41
45
  "*.less"
42
46
  ],
@@ -44,14 +48,14 @@
44
48
  "vue": "^3.2.0"
45
49
  },
46
50
  "dependencies": {
47
- "@varlet/icons": "1.27.18",
48
- "@varlet/shared": "1.27.18",
51
+ "@varlet/icons": "1.27.20",
52
+ "@varlet/shared": "1.27.20",
49
53
  "dayjs": "^1.10.4",
50
54
  "decimal.js": "^10.2.1"
51
55
  },
52
56
  "devDependencies": {
53
- "@varlet/cli": "1.27.18",
54
- "@varlet/touch-emulator": "1.27.18",
57
+ "@varlet/cli": "1.27.20",
58
+ "@varlet/touch-emulator": "1.27.20",
55
59
  "@vue/runtime-core": "3.2.25",
56
60
  "@vue/test-utils": "2.0.0-rc.6",
57
61
  "clipboard": "^2.0.6",
@@ -75,6 +79,5 @@
75
79
  "test": "varlet-cli jest",
76
80
  "test:watch": "varlet-cli jest -w",
77
81
  "test:watchAll": "varlet-cli jest -wa"
78
- },
79
- "readme": "<div align=\"center\">\n <a href=\"https://varlet-varletjs.vercel.app\">\n <img src=\"https://varlet-varletjs.vercel.app/logo.svg\" width=\"150\" >\n </a>\n <h1>VARLET</h1>\n <p>基于 Vue3 的 Material design 风格移动端组件库</p>\n <p>\n <a href=\"https://varlet-varletjs.vercel.app\">文档(Vercel)</a> | \n <a href=\"https://varlet.gitee.io/varlet-ui\">文档(Gitee)</a> | \n<a href=\"https://github.com/varletjs/varlet/blob/dev/README.en-US.md\">English Readme</a>\n </p>\n <p>\n <img src=\"https://img.shields.io/npm/v/@varlet/ui?style=flat-square\" alt=\"version\">\n <img src=\"https://img.shields.io/github/stars/varletjs/varlet\" alt=\"stars\">\n <img src=\"https://img.shields.io/badge/vue-v3.2.0%2B-%23407fbc\" alt=\"vue\">\n <img src=\"https://img.shields.io/npm/l/@varlet/ui.svg\" alt=\"licence\">\n <img src=\"https://img.shields.io/codecov/c/github/varletjs/varlet\" alt=\"coverage\">\n <img src=\"https://img.badgesize.io/https://unpkg.com/@varlet/ui/umd/varlet.js?compression=gzip&label=gzip\" alt=\"gzip\" />\n <img src=\"https://github.com/varletjs/varlet/workflows/CI/badge.svg\" alt=\"ci\">\n </p>\n</div>\n\n---\n\n### 介绍\n\nVarlet 是一个基于 `Vue3` 开发的 Material 风格移动端组件库,全面拥抱 `Vue3` 生态,由社区建立起来的组件库团队进行维护。\n\n### 特性\n- 🚀 提供50+个高质量通用组件 \n- 🚀 组件十分轻量\n- 💪 由国人开发,完善的中英文文档和后勤保障\n- 🛠️ 支持按需引入\n- 🛠️ 支持主题定制\n- 🌍 支持国际化\n- 💡 支持 webstorm,vscode 组件属性高亮\n- 💪 支持 SSR\n- 💡 支持 Typescript \n- 💪 确保90%以上单元测试覆盖率,提供稳定性保证\n- 🛠️ 支持暗黑模式\n\n### 安装\n\n### CDN\n`varlet.js` 包含组件库的所有样式和逻辑,引入即可。\n\n```html\n<div id=\"app\"></div>\n<script src=\"https://cdn.jsdelivr.net/npm/vue@next\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/@varlet/ui/umd/varlet.js\"></script>\n<script>\n const app = Vue.createApp({\n template: '<var-button>按钮</var-button>'\n })\n app.use(Varlet).mount('#app')\n</script>\n```\n\n### Webpack / Vite\n```shell\n# 通过 npm 或 yarn 或 pnpm 安装\n\n# npm\nnpm i @varlet/ui -S\n\n# yarn\nyarn add @varlet/ui\n\n# pnpm\npnpm add @varlet/ui\n```\n\n```js\nimport App from './App.vue'\nimport Varlet from '@varlet/ui'\nimport { createApp } from 'vue'\nimport '@varlet/ui/es/style.js'\n\ncreateApp(App).use(Varlet).mount('#app')\n```\n\n### 捐赠我们\n\n我们将用捐赠所得去鼓励参与开源的贡献者们,给他们买一杯咖啡奶茶,购置对于项目有帮助基础设施,推动项目变得更好。\n\n<img style=\"width: 25%\" src=\"https://github.com/varletjs/varlet/blob/dev/sponsor/wechat.png?raw=true\" />\n\n### Contributors\n\n<a href=\"https://github.com/varletjs/varlet/graphs/contributors\">\n <img src=\"https://contrib.rocks/image?repo=varletjs/varlet\" />\n</a>\n\n"
82
+ }
80
83
  }
@@ -16,6 +16,7 @@ export interface DatePickerProps extends BasicAttributes {
16
16
  multiple?: boolean
17
17
  range?: boolean
18
18
  touchable?: boolean
19
+ onPreview?: (year: number, month: number) => void
19
20
  onChange?: (value: string | string[]) => void
20
21
  'onUpdate:modelValue'?: (value: string | string[]) => void
21
22
  }
@@ -10,7 +10,7 @@ export interface PullRefreshProps extends BasicAttributes {
10
10
  successBgColor?: string
11
11
  color?: string
12
12
  successColor?: string
13
- onRefresh: () => void
13
+ onRefresh?: () => void
14
14
  'onUpdate:modelValue'?: (value: boolean) => void
15
15
  }
16
16