Browse Source

Merge branch 'next' of https://github.com/jdf2e/nutui into next

Drjnigfubo 3 years ago
parent
commit
0ce17c5123

+ 37 - 0
CHANGELOG.md

@@ -1,3 +1,40 @@
+## v3.1.17
+
+`2022-02-25` 此版本依赖 Taro 3.4.x
+
+NutUI 非常感谢您对开源事业做出的贡献!🌷🌷🌷
+本次社区贡献者 @odex21 @p3psi-boo @gp5251 @deity-wu
+
+* :zap: feat(sticky): 新增粘性布局组件(#627)   @szg2008
+* :zap: feat(audio): 新增音频组件   @yangxiaolu1993
+* :zap: feat(calendar): 日历组件功能扩展(#550 #842 #742 #806)   @lkjh3214
+* :zap: feat: 优化重构 add 命令   @szg2008
+* :zap: chore: support template type check (volar) (#985) @odex21
+* :zap: feat(input): 输入数字时拉起数字键盘 (#999) @odex21
+* :zap: feat(input): 在taro、doc增加无边框 (#995) @ailululu
+* :zap: feat(swiper): 适配小程序(#944 #551 #553) @szg2008
+* :zap: feat(elevator): 暴露 ScrollTo API @szg2008
+* :zap: feat(elevator): 点击之后增加高亮显示(#974) @szg2008
+* :zap: feat(button): add third-party icon support (#1018) @p3psi-boo
+* :zap: feat(layout, row): add support for space-evenly (#1020) @gp5251
+* :zap: feat(address): 新增默认选中功能 (#368) @yangxiaolu1993
+* :bug: docs(indicator): 描述文案修改  @richard1015
+* :bug: fix(cascader): 主题定制不生效bug(#998)   @richard1015
+* :bug: docs(circleprogress): 描述文案修改(#990) @Drjingfubo
+* :bug: fix(tabbar): 微信浏览器下安全适配不生效修改 (#997) @Drjingfubo
+* :bug: docs(drag): 文档样式错乱修复   @richard1015
+* :bug: fix(DatePicker): 修复Taro使用场景报错 (#1014)   @yangxiaolu1993
+* :bug: docs(popup): update destoryOnClose props instruction (#1010)   @szg2008
+* :bug: docs: 组件的文案修改 (#1021)  @yangxiaolu1993
+* :bug: docs(button): 添加对第三方图标支持的文档 (#1026)  @p3psi-boo
+* :bug: docs(tabbar): add import Icon (#1028)   @Drjingfubo
+* :bug: fix(progress): optimization,add new props isShowPercentage (#1016)  @Drjingfubo
+* :bug: fix: fix radio switch checkbox radio warning   @szg2008
+* :bug: fix(searchBar): 搜索栏的 search 事件 在H5中会刷新当前页面 #1025  @JackieScorpio
+* :bug: fix(imagepreview): 引用报错(#1024 #989)   @JackieScorpio
+* :bug: fix: 滚动加载组件,taro版,下拉刷新bug修改 (#1004)  @deity-wu
+* :bug: fix: input组件的readonly属性在taro小程序项目中不生效(#1017)  @ailululu
+
 ## v3.1.16
 
 `2022-01-30` 此版本依赖 Taro 3.4.x

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@nutui/nutui",
-  "version": "3.1.16",
+  "version": "3.1.17",
   "description": "京东风格的轻量级移动端 Vue2、Vue3 组件库(支持小程序开发)",
   "main": "dist/nutui.umd.js",
   "module": "dist/nutui.es.js",

+ 0 - 1
src/config.json

@@ -194,7 +194,6 @@
           "desc": "图片预览",
           "sort": 4,
           "show": true,
-          "taro": true,
           "author": "zongyue3"
         },
         {

+ 2 - 2
src/packages/__VUE/button/doc.md

@@ -200,8 +200,8 @@ app.use(Button);
 | disabled | 是否禁用按钮                                                 | Boolean | `false`   |
 | block    | 是否为块级元素                                               | Boolean | `false`   |
 | icon     | 按钮图标,同 Icon 组件 name 属性                             | String  | -         |
-| icon-font-class-name | 自定义 icon 字体基础类名                         | String | `nutui-iconfont` |
-| icon-class-prefix    | 自定义 icon 类名前缀,用于使用自定义图标           | String | `nut-icon`       |
+| icon-font-class-name`v3.1.17` | 自定义 icon 字体基础类名                         | String | `nutui-iconfont` |
+| icon-class-prefix `v3.1.17`   | 自定义 icon 类名前缀,用于使用自定义图标           | String | `nut-icon`       |
 | loading  | 按钮 loading 状态                                            | Boolean | `false`   |
 
 ### Events

+ 1 - 2
src/packages/__VUE/calendaritem/index.taro.vue

@@ -456,9 +456,8 @@ export default create({
       state.propEndDate = propEndDate;
       state.startData = splitDate(propStartDate);
       state.endData = splitDate(propEndDate);
-
       // 根据是否存在默认时间,初始化当前日期,
-      if (!props.defaultValue || !(Array.isArray(props.defaultValue) && props.defaultValue.length > 0)) {
+      if (!props.defaultValue || (Array.isArray(props.defaultValue) && props.defaultValue.length <= 0)) {
         state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
       } else {
         state.currDate = state.isRange ? [...props.defaultValue] : props.defaultValue;

+ 1 - 1
src/packages/__VUE/calendaritem/index.vue

@@ -437,7 +437,7 @@ export default create({
       state.endData = splitDate(propEndDate);
 
       // 根据是否存在默认时间,初始化当前日期,
-      if (!props.defaultValue || !(Array.isArray(props.defaultValue) && props.defaultValue.length > 0)) {
+      if (!props.defaultValue || (Array.isArray(props.defaultValue) && props.defaultValue.length <= 0)) {
         state.currDate = state.isRange ? [Utils.date2Str(new Date()), Utils.getDay(1)] : Utils.date2Str(new Date());
       } else {
         state.currDate = state.isRange ? [...props.defaultValue] : props.defaultValue;

+ 2 - 2
src/packages/__VUE/cell/__tests__/cell.spec.ts

@@ -1,11 +1,11 @@
 import { config, mount } from '@vue/test-utils';
 import Cell from '../index.vue';
-import NutIcon from '../../icon/index.vue';
+import Icon from '../../icon/index.vue';
 import { nextTick } from 'vue';
 
 beforeAll(() => {
   config.global.components = {
-    NutIcon
+    [Icon.name]: Icon
   };
 });
 

+ 52 - 0
src/packages/__VUE/dialog/__tests__/index.spec.ts

@@ -0,0 +1,52 @@
+import { config, mount } from '@vue/test-utils';
+import DialogTemplate from '../index.vue';
+import { Dialog } from '../index';
+import Icon from '../../icon/index.vue';
+import Popup from '../../popup/index.vue';
+import Button from '../../button/index.vue';
+import OverLay from '../../overLay/index.vue';
+import { nextTick } from 'vue';
+
+beforeAll(() => {
+  config.global.components = {
+    [Icon.name]: Icon,
+    [Popup.name]: Popup,
+    [Button.name]: Button,
+    [OverLay.name]: OverLay
+  };
+});
+
+beforeEach(() => {
+  // create teleport target
+  const el = document.createElement('div');
+  el.id = 'app';
+  document.body.appendChild(el);
+});
+
+afterEach(() => {
+  // clean up
+  document.body.outerHTML = '';
+});
+
+test('should render dialog template', async () => {
+  const wrapper = mount(DialogTemplate, {
+    props: {
+      title: 't1',
+      content: 'c1'
+    }
+  });
+
+  const overLay = wrapper.getComponent(OverLay);
+  expect(await overLay.find('.nut-dialog__content'));
+});
+
+test('should render dialog methods', async () => {
+  // Dialog({
+  //   title: '基础弹框',
+  //   content: '支持函数调用和组件调用两种方式。',
+  //   onCancel,
+  //   onOk
+  // });
+  // const overLay = wrapper.getComponent(OverLay);
+  // expect(await overLay.find('.nut-dialog__content'))
+});

+ 4 - 2
src/packages/__VUE/imagepreview/index.taro.vue

@@ -26,7 +26,7 @@
   </nut-popup>
 </template>
 <script lang="ts">
-import { toRefs, reactive, watch, onMounted, ref } from 'vue';
+import { toRefs, reactive, watch, onMounted } from 'vue';
 import { createComponent } from '../../utils/create';
 import Popup from '../popup/index.taro.vue';
 // import Video from '../video/index.vue';
@@ -127,7 +127,9 @@ export default create({
     };
 
     const scaleNow = () => {
-      (state.eleImg as any).style.transform = 'scale(' + state.store.scale + ')';
+      if (state.eleImg != null) {
+        (state.eleImg as any).style.transform = 'scale(' + state.store.scale + ')';
+      }
     };
 
     const onTouchStart = (event: any) => {

+ 4 - 0
src/packages/__VUE/swiper/index.taro.vue

@@ -392,6 +392,10 @@ export default create({
       if (Taro.getEnv() === 'WEB') {
         init();
       } else {
+        Taro.nextTick(async () => {
+          state.rect = await useTaroRect(container, Taro);
+          state.rect && init();
+        });
         eventCenter.once((getCurrentInstance() as any).router.onReady, () => {
           init();
         });

+ 1 - 1
src/packages/utils/useTaroRect/index.ts

@@ -47,7 +47,7 @@ export const useTaroRect = (elementRef: (Element | Window | any) | Ref<Element |
       });
     } else {
       const query = Taro.createSelectorQuery();
-      query.select(`#${(element as any).id}`).boundingClientRect();
+      query.select(`#${(element as any).id}`) && query.select(`#${(element as any).id}`).boundingClientRect();
       query.exec(function (res: any) {
         resolve(res[0]);
       });

+ 49 - 49
src/sites/mobile-taro/vue/project.config.json

@@ -1,51 +1,51 @@
 {
-    "miniprogramRoot": "dist/",
-    "projectname": "%40nutui%2Fnutui-taro-mobile",
-    "description": "nutui-taro-vue",
-    "appid": "wx7a1156d6d5c48a20",
-    "setting": {
-        "urlCheck": true,
-        "es6": false,
-        "enhance": true,
-        "postcss": true,
-        "preloadBackgroundData": false,
-        "minified": true,
-        "newFeature": false,
-        "coverView": true,
-        "nodeModules": false,
-        "autoAudits": false,
-        "showShadowRootInWxmlPanel": true,
-        "scopeDataCheck": false,
-        "uglifyFileName": false,
-        "checkInvalidKey": true,
-        "checkSiteMap": true,
-        "uploadWithSourceMap": true,
-        "compileHotReLoad": false,
-        "lazyloadPlaceholderEnable": false,
-        "useMultiFrameRuntime": true,
-        "useApiHook": true,
-        "useApiHostProcess": true,
-        "babelSetting": {
-            "ignore": [],
-            "disablePlugins": [],
-            "outputPath": ""
-        },
-        "enableEngineNative": false,
-        "useIsolateContext": false,
-        "userConfirmedBundleSwitch": false,
-        "packNpmManually": false,
-        "packNpmRelationList": [],
-        "minifyWXSS": true,
-        "disableUseStrict": false,
-        "minifyWXML": true,
-        "showES6CompileOption": false,
-        "useCompilerPlugins": false
+  "miniprogramRoot": "dist/",
+  "projectname": "%40nutui%2Fnutui-taro-mobile",
+  "description": "nutui-taro-vue",
+  "appid": "wxf2b976b67dab3882",
+  "setting": {
+    "urlCheck": true,
+    "es6": false,
+    "enhance": true,
+    "postcss": true,
+    "preloadBackgroundData": false,
+    "minified": true,
+    "newFeature": false,
+    "coverView": true,
+    "nodeModules": false,
+    "autoAudits": false,
+    "showShadowRootInWxmlPanel": true,
+    "scopeDataCheck": false,
+    "uglifyFileName": false,
+    "checkInvalidKey": true,
+    "checkSiteMap": true,
+    "uploadWithSourceMap": true,
+    "compileHotReLoad": false,
+    "lazyloadPlaceholderEnable": false,
+    "useMultiFrameRuntime": true,
+    "useApiHook": true,
+    "useApiHostProcess": true,
+    "babelSetting": {
+      "ignore": [],
+      "disablePlugins": [],
+      "outputPath": ""
     },
-    "compileType": "miniprogram",
-    "simulatorType": "wechat",
-    "simulatorPluginLibVersion": {},
-    "libVersion": "2.17.3",
-    "condition": {
-        "miniprogram": {}
-    }
-}
+    "enableEngineNative": false,
+    "useIsolateContext": false,
+    "userConfirmedBundleSwitch": false,
+    "packNpmManually": false,
+    "packNpmRelationList": [],
+    "minifyWXSS": true,
+    "disableUseStrict": false,
+    "minifyWXML": true,
+    "showES6CompileOption": false,
+    "useCompilerPlugins": false
+  },
+  "compileType": "miniprogram",
+  "simulatorType": "wechat",
+  "simulatorPluginLibVersion": {},
+  "libVersion": "2.17.3",
+  "condition": {
+    "miniprogram": {}
+  }
+}