ソースを参照

fix: 完善组件依赖关系 (#1968)

peixinyu 3 年 前
コミット
cc1aa01c41

+ 1 - 1
jd/generate-style-deps.cjs

@@ -13,7 +13,7 @@ config.nav.forEach((item) => {
   });
   });
 });
 });
 styleMap.forEach((value) => {
 styleMap.forEach((value) => {
-  if (value.chilren?.length !== 0) {
+  if (value.children && value.children.length > 0) {
     value.children.forEach((item, index) => {
     value.children.forEach((item, index) => {
       value.children[index] = styleMap.get(item);
       value.children[index] = styleMap.get(item);
     });
     });

+ 3 - 2
package.json

@@ -49,8 +49,8 @@
     "build:site": "npm run checked && vite build",
     "build:site": "npm run checked && vite build",
     "build:site-jdt": "npm run checked && vite build --config vite.config.jdt.ts ",
     "build:site-jdt": "npm run checked && vite build --config vite.config.jdt.ts ",
     "build:site:oss": "npm run checked && vite build --base=/nutui/4x/",
     "build:site:oss": "npm run checked && vite build --base=/nutui/4x/",
-    "build": "npm run checked && vite build --config vite.config.build.ts && vite build --config vite.config.build.disperse.ts && npm run generate:themes && vite build --config vite.config.build.css.ts && vite build --config vite.config.build.locale.ts && npm run dts && npm run attrs",
-    "build:taro:vue": "npm run checked:taro:vue && vite build --config vite.config.build.taro.vue.ts && vite build --config vite.config.build.taro.vue.disperse.ts && npm run generate:themes && vite build --config vite.config.build.css.ts && vite build --config vite.config.build.locale.ts && npm run dts:taro && npm run attrs",
+    "build": "npm run checked && vite build --config vite.config.build.ts && vite build --config vite.config.build.disperse.ts && npm run generate:themes && vite build --config vite.config.build.css.ts && vite build --config vite.config.build.locale.ts && npm run dts && npm run attrs && npm run generate:style:deps",
+    "build:taro:vue": "npm run checked:taro:vue && vite build --config vite.config.build.taro.vue.ts && vite build --config vite.config.build.taro.vue.disperse.ts && npm run generate:themes && vite build --config vite.config.build.css.ts && vite build --config vite.config.build.locale.ts && npm run dts:taro && npm run attrs&& npm run generate:style:deps",
     "serve": "vite preview",
     "serve": "vite preview",
     "upload": "yarn build:site:oss && node ./jd/upload.js",
     "upload": "yarn build:site:oss && node ./jd/upload.js",
     "add": "node jd/createComponentMode.js",
     "add": "node jd/createComponentMode.js",
@@ -61,6 +61,7 @@
     "generate:types": "node jd/generate-types.cjs",
     "generate:types": "node jd/generate-types.cjs",
     "generate:types:taro": "node jd/generate-types-taro.cjs",
     "generate:types:taro": "node jd/generate-types-taro.cjs",
     "generate:themes": "node jd/generate-themes.cjs",
     "generate:themes": "node jd/generate-themes.cjs",
+    "generate:style:deps": "node jd/generate-style-deps.cjs",
     "prepare": "husky install",
     "prepare": "husky install",
     "test": "jest",
     "test": "jest",
     "release": "standard-version -a",
     "release": "standard-version -a",

+ 4 - 3
src/config.json

@@ -341,7 +341,7 @@
           "exportEmptyTaro": true,
           "exportEmptyTaro": true,
           "desc": "标签栏子组件",
           "desc": "标签栏子组件",
           "author": "Drjingfubo",
           "author": "Drjingfubo",
-          "styleDeps": []
+          "styleDeps": ["Badge"]
         },
         },
         {
         {
           "version": "3.0.0",
           "version": "3.0.0",
@@ -1202,7 +1202,8 @@
           "show": true,
           "show": true,
           "tarodoc": false,
           "tarodoc": false,
           "type": "component",
           "type": "component",
-          "author": "yangxiaolu"
+          "author": "yangxiaolu",
+          "styleDeps": ["Popover"]
         }
         }
       ]
       ]
     },
     },
@@ -1364,7 +1365,7 @@
           "tarodoc": false,
           "tarodoc": false,
           "type": "component",
           "type": "component",
           "author": "yangxiaolu",
           "author": "yangxiaolu",
-          "styleDeps": []
+          "styleDeps": ["Rate"]
         },
         },
         {
         {
           "version": "3.0.0",
           "version": "3.0.0",

+ 11 - 1
src/packages/__VUE/address/index.vue

@@ -123,11 +123,21 @@ import { reactive, ref, toRefs, watch, nextTick, computed, Ref, h, PropType } fr
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
 import { RegionData, CustomRegionData, existRegionData } from './type';
 import { RegionData, CustomRegionData, existRegionData } from './type';
 import { popupProps } from '../popup/props';
 import { popupProps } from '../popup/props';
+import Popup from '../popup/index.vue';
+import Elevator from '../elevator/index.vue';
 const { componentName, create, translate } = createComponent('address');
 const { componentName, create, translate } = createComponent('address');
 import { Location, Location2, Check, Close, Left } from '@nutui/icons-vue';
 import { Location, Location2, Check, Close, Left } from '@nutui/icons-vue';
 
 
 export default create({
 export default create({
-  components: { Location, Location2, Check, Close, Left },
+  components: {
+    Location,
+    Location2,
+    Check,
+    Close,
+    Left,
+    [Popup.name]: Popup,
+    [Elevator.name]: Elevator
+  },
   inheritAttrs: false,
   inheritAttrs: false,
   props: {
   props: {
     ...popupProps,
     ...popupProps,

+ 3 - 1
src/packages/__VUE/audio/index.vue

@@ -63,6 +63,7 @@
 import { toRefs, ref, onMounted, reactive, watch, provide } from 'vue';
 import { toRefs, ref, onMounted, reactive, watch, provide } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
 import { Service } from '@nutui/icons-vue';
 import { Service } from '@nutui/icons-vue';
+import Range from '../range/index.vue';
 const { componentName, create } = createComponent('audio');
 const { componentName, create } = createComponent('audio');
 
 
 export default create({
 export default create({
@@ -106,7 +107,8 @@ export default create({
     }
     }
   },
   },
   components: {
   components: {
-    Service
+    Service,
+    [Range.name]: Range
   },
   },
   emits: ['fastBack', 'play', 'forward', 'ended', 'changeProgress', 'mute', 'can-play'],
   emits: ['fastBack', 'play', 'forward', 'ended', 'changeProgress', 'mute', 'can-play'],
 
 

+ 0 - 1
src/packages/__VUE/comment/components/CmtHeader.vue

@@ -52,7 +52,6 @@ export default create({
       default: () => ''
       default: () => ''
     }
     }
   },
   },
-  components: {},
   emits: ['handleClick'],
   emits: ['handleClick'],
 
 
   setup(props, { emit }) {
   setup(props, { emit }) {

+ 2 - 0
src/packages/__VUE/comment/index.taro.vue

@@ -48,6 +48,7 @@ import { Right } from '@nutui/icons-vue-taro';
 import CommentHeader from './components/CmtHeader.vue';
 import CommentHeader from './components/CmtHeader.vue';
 import CommentImages from './components/CmtImages.vue';
 import CommentImages from './components/CmtImages.vue';
 import CommentBottom from './components/CmtBottom.vue';
 import CommentBottom from './components/CmtBottom.vue';
+import { Rate } from '@/packages/nutui.vue';
 
 
 interface VideosType {
 interface VideosType {
   id: number | string;
   id: number | string;
@@ -107,6 +108,7 @@ export default create({
     }
     }
   },
   },
   components: {
   components: {
+    [Rate.name]: Rate,
     CommentHeader,
     CommentHeader,
     CommentImages,
     CommentImages,
     CommentBottom,
     CommentBottom,

+ 2 - 0
src/packages/__VUE/comment/index.vue

@@ -42,6 +42,7 @@ import { ref, onMounted, computed, PropType } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
 const { componentName, create, translate } = createComponent('comment');
 const { componentName, create, translate } = createComponent('comment');
 import { JoySmile, Right } from '@nutui/icons-vue';
 import { JoySmile, Right } from '@nutui/icons-vue';
+import Rate from '../rate/index.vue';
 
 
 import CommentHeader from './components/CmtHeader.vue';
 import CommentHeader from './components/CmtHeader.vue';
 import CommentImages from './components/CmtImages.vue';
 import CommentImages from './components/CmtImages.vue';
@@ -105,6 +106,7 @@ export default create({
     }
     }
   },
   },
   components: {
   components: {
+    [Rate.name]: Rate,
     CommentHeader,
     CommentHeader,
     CommentImages,
     CommentImages,
     CommentBottom,
     CommentBottom,

+ 2 - 2
src/packages/__VUE/datepicker/index.taro.vue

@@ -23,7 +23,7 @@
 <script lang="ts">
 <script lang="ts">
 import { toRefs, watch, computed, reactive, onBeforeMount } from 'vue';
 import { toRefs, watch, computed, reactive, onBeforeMount } from 'vue';
 import type { PropType } from 'vue';
 import type { PropType } from 'vue';
-import nutPicker from '../picker/index.taro.vue';
+import Picker from '../picker/index.taro.vue';
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
 import { padZero, isDate as isDateU } from '@/packages/utils/util';
 import { padZero, isDate as isDateU } from '@/packages/utils/util';
 const { componentName, create } = createComponent('date-picker');
 const { componentName, create } = createComponent('date-picker');
@@ -45,7 +45,7 @@ const zhCNType: {
 };
 };
 export default create({
 export default create({
   components: {
   components: {
-    nutPicker
+    [Picker.name]: Picker
   },
   },
   props: {
   props: {
     modelValue: null,
     modelValue: null,

+ 4 - 1
src/packages/__VUE/imagepreview/imagePreviewItem.vue

@@ -20,6 +20,7 @@ import { useTouch } from '@/packages/utils/useTouch';
 import { preventDefault, clamp } from '@/packages/utils/util';
 import { preventDefault, clamp } from '@/packages/utils/util';
 import { ImageInterface } from './types';
 import { ImageInterface } from './types';
 import { baseProps } from './types';
 import { baseProps } from './types';
+import Video from '../video/index.vue';
 const { create } = createComponent('image-preview-item');
 const { create } = createComponent('image-preview-item');
 
 
 export default create({
 export default create({
@@ -43,7 +44,9 @@ export default create({
     }
     }
   },
   },
   emits: ['close', 'scale'],
   emits: ['close', 'scale'],
-  components: {},
+  components: {
+    [Video.name]: Video
+  },
 
 
   setup(props, { emit }) {
   setup(props, { emit }) {
     const state = reactive({
     const state = reactive({

+ 7 - 1
src/packages/__VUE/imagepreview/index.vue

@@ -54,6 +54,9 @@ import ImagePreviewItem from './imagePreviewItem.vue';
 import { ImageInterface, baseProps } from './types';
 import { ImageInterface, baseProps } from './types';
 const { create } = createComponent('image-preview');
 const { create } = createComponent('image-preview');
 import { CircleClose } from '@nutui/icons-vue';
 import { CircleClose } from '@nutui/icons-vue';
+import Popup from '../popup/index.vue';
+import Swiper from '../swiper/index.vue';
+import SwiperItem from '../swiperitem/index.vue';
 
 
 export default create({
 export default create({
   props: {
   props: {
@@ -87,7 +90,10 @@ export default create({
   emits: ['close', 'change'],
   emits: ['close', 'change'],
   components: {
   components: {
     ImagePreviewItem: ImagePreviewItem,
     ImagePreviewItem: ImagePreviewItem,
-    CircleClose
+    CircleClose,
+    [Popup.name]: Popup,
+    [Swiper.name]: Swiper,
+    [SwiperItem.name]: SwiperItem
   },
   },
 
 
   setup(props, { emit }) {
   setup(props, { emit }) {

+ 4 - 1
src/packages/__VUE/popover/index.taro.vue

@@ -71,10 +71,13 @@ import { useTaroRect } from '@/packages/utils/useTaroRect';
 import { rect } from '@/packages/utils/useRect';
 import { rect } from '@/packages/utils/useRect';
 import { isArray } from '@/packages/utils/util';
 import { isArray } from '@/packages/utils/util';
 import Taro from '@tarojs/taro';
 import Taro from '@tarojs/taro';
+import Popup from '../popup/index.taro.vue';
 
 
 export default create({
 export default create({
   inheritAttrs: false,
   inheritAttrs: false,
-  components: {},
+  components: {
+    [Popup.name]: Popup
+  },
   props: {
   props: {
     visible: { type: Boolean, default: false },
     visible: { type: Boolean, default: false },
     list: { type: Array as PropType<import('./type').PopoverList[]>, default: [] },
     list: { type: Array as PropType<import('./type').PopoverList[]>, default: [] },

+ 4 - 0
src/packages/__VUE/popover/index.vue

@@ -37,8 +37,12 @@ import { computed, watch, ref, PropType, CSSProperties, onMounted, h } from 'vue
 import { createComponent, renderIcon } from '@/packages/utils/create';
 import { createComponent, renderIcon } from '@/packages/utils/create';
 import { isArray } from '@/packages/utils/util';
 import { isArray } from '@/packages/utils/util';
 import { useRect, rect } from '@/packages/utils/useRect';
 import { useRect, rect } from '@/packages/utils/useRect';
+import Popup from '../popup/index.vue';
 const { create } = createComponent('popover');
 const { create } = createComponent('popover');
 export default create({
 export default create({
+  components: {
+    [Popup.name]: Popup
+  },
   props: {
   props: {
     visible: { type: Boolean, default: false },
     visible: { type: Boolean, default: false },
     list: { type: Array as PropType<import('./type').PopoverList[]>, default: [] },
     list: { type: Array as PropType<import('./type').PopoverList[]>, default: [] },

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

@@ -30,8 +30,12 @@
 <script lang="ts">
 <script lang="ts">
 import { computed, provide } from 'vue';
 import { computed, provide } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
+import Popup from '../popup/index.taro.vue';
 const { componentName, create, translate } = createComponent('time-select');
 const { componentName, create, translate } = createComponent('time-select');
 export default create({
 export default create({
+  components: {
+    [Popup.name]: Popup
+  },
   props: {
   props: {
     visible: {
     visible: {
       type: Boolean,
       type: Boolean,

+ 4 - 0
src/packages/__VUE/timeselect/index.vue

@@ -31,8 +31,12 @@
 <script lang="ts">
 <script lang="ts">
 import { computed, provide } from 'vue';
 import { computed, provide } from 'vue';
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
+import Popup from '../popup/index.vue';
 const { componentName, create, translate } = createComponent('time-select');
 const { componentName, create, translate } = createComponent('time-select');
 export default create({
 export default create({
+  components: {
+    [Popup.name]: Popup
+  },
   props: {
   props: {
     visible: {
     visible: {
       type: Boolean,
       type: Boolean,

+ 2 - 0
src/packages/__VUE/tour/index.taro.vue

@@ -70,6 +70,7 @@ import { createComponent } from '@/packages/utils/create';
 import { useTaroRect } from '@/packages/utils/useTaroRect';
 import { useTaroRect } from '@/packages/utils/useTaroRect';
 import { Close } from '@nutui/icons-vue-taro';
 import { Close } from '@nutui/icons-vue-taro';
 import Taro from '@tarojs/taro';
 import Taro from '@tarojs/taro';
+import Popover from '../popover/index.taro.vue';
 
 
 interface StepOptions {
 interface StepOptions {
   target: Element;
   target: Element;
@@ -81,6 +82,7 @@ interface StepOptions {
 const { create } = createComponent('tour');
 const { create } = createComponent('tour');
 export default create({
 export default create({
   components: {
   components: {
+    [Popover.name]: Popover,
     Close
     Close
   },
   },
   props: {
   props: {

+ 2 - 0
src/packages/__VUE/tour/index.vue

@@ -69,6 +69,7 @@ import { PopoverLocation } from '../popover/type';
 import { createComponent } from '@/packages/utils/create';
 import { createComponent } from '@/packages/utils/create';
 import { useRect } from '@/packages/utils/useRect';
 import { useRect } from '@/packages/utils/useRect';
 import { Close } from '@nutui/icons-vue';
 import { Close } from '@nutui/icons-vue';
+import Popover from '../popover/index.vue';
 
 
 interface StepOptions {
 interface StepOptions {
   target: Element;
   target: Element;
@@ -80,6 +81,7 @@ interface StepOptions {
 const { create } = createComponent('tour');
 const { create } = createComponent('tour');
 export default create({
 export default create({
   components: {
   components: {
+    [Popover.name]: Popover,
     Close
     Close
   },
   },
   props: {
   props: {