@ditari/bsui 1.1.39 → 1.1.41

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/date/RangePicker.cjs +15 -18
  3. package/dist/cjs/date/RangePicker.cjs.map +1 -1
  4. package/dist/cjs/dic/DicReplace.cjs +4 -2
  5. package/dist/cjs/dic/DicReplace.cjs.map +1 -1
  6. package/dist/cjs/layout/FuckMain.vue.d.ts +26 -3
  7. package/dist/cjs/layout/FuckMain.vue2.cjs +36 -11
  8. package/dist/cjs/layout/FuckMain.vue2.cjs.map +1 -1
  9. package/dist/cjs/layout/List.vue.d.ts +1 -0
  10. package/dist/cjs/layout/List.vue2.cjs +7 -6
  11. package/dist/cjs/layout/List.vue2.cjs.map +1 -1
  12. package/dist/cjs/layout/Main.vue2.cjs +31 -9
  13. package/dist/cjs/layout/Main.vue2.cjs.map +1 -1
  14. package/dist/cjs/menu/Menu.cjs +4 -2
  15. package/dist/cjs/menu/Menu.cjs.map +1 -1
  16. package/dist/cjs/table/Table.cjs +14 -14
  17. package/dist/cjs/table/Table.cjs.map +1 -1
  18. package/dist/esm/date/RangePicker.mjs +16 -19
  19. package/dist/esm/date/RangePicker.mjs.map +1 -1
  20. package/dist/esm/dic/DicReplace.mjs +5 -3
  21. package/dist/esm/dic/DicReplace.mjs.map +1 -1
  22. package/dist/esm/layout/FuckMain.vue.d.ts +26 -3
  23. package/dist/esm/layout/FuckMain.vue2.mjs +37 -12
  24. package/dist/esm/layout/FuckMain.vue2.mjs.map +1 -1
  25. package/dist/esm/layout/List.vue.d.ts +1 -0
  26. package/dist/esm/layout/List.vue2.mjs +8 -7
  27. package/dist/esm/layout/List.vue2.mjs.map +1 -1
  28. package/dist/esm/layout/Main.vue2.mjs +32 -10
  29. package/dist/esm/layout/Main.vue2.mjs.map +1 -1
  30. package/dist/esm/menu/Menu.mjs +5 -3
  31. package/dist/esm/menu/Menu.mjs.map +1 -1
  32. package/dist/esm/table/Table.mjs +15 -15
  33. package/dist/esm/table/Table.mjs.map +1 -1
  34. package/example/src/App.vue +3 -5
  35. package/example/src/components/AppMain.vue +6 -6
  36. package/example/src/views/table/Add.vue +368 -33
  37. package/example/src/views/table/List.vue +6 -21
  38. package/example/src/views/table/hooks.ts +1 -1
  39. package/package.json +1 -1
  40. package/src/date/RangePicker.tsx +19 -19
  41. package/src/dic/DicReplace.tsx +13 -7
  42. package/src/layout/FuckMain.vue +22 -14
  43. package/src/layout/List.vue +9 -8
  44. package/src/layout/Main.vue +10 -11
  45. package/src/menu/Menu.tsx +30 -13
  46. package/src/table/Table.tsx +87 -34
@@ -22,7 +22,9 @@ const props = withDefaults(
22
22
  showConfig: { backBtn: "LeftOutlined" } as any
23
23
  }
24
24
  );
25
-
25
+ // 注入show组件的配置文件
26
+ // eslint-disable-next-line vue/no-setup-props-destructure
27
+ provide("showConfig", props.showConfig);
26
28
  // 缓存store
27
29
  const store = useKeepAliveStore();
28
30
  // 缓存的names
@@ -31,8 +33,6 @@ const keepAliveNames = computed(() => store.get);
31
33
  const settingsStore = useSettingsStore();
32
34
  const { switchCollapsed } = settingsStore;
33
35
  const collapsedStatus = computed(() => settingsStore.getCollapsed);
34
- // 注入show组件的配置文件
35
- provide("showConfig", props.showConfig);
36
36
  </script>
37
37
  <template>
38
38
  <a-layout class="ditari-layout">
@@ -81,14 +81,13 @@ provide("showConfig", props.showConfig);
81
81
  class="ditari-layout-content"
82
82
  :style="{ marginLeft: collapsedStatus ? '80px' : '200px' }"
83
83
  >
84
- <router-view />
85
- <!-- <router-view v-slot="{ Component }">-->
86
- <!-- <transition name="main" mode="out-in" appear>-->
87
- <!-- <keep-alive ref="keepAliveRef" :include="keepAliveNames">-->
88
- <!-- <component :is="Component" :key="$route.path" />-->
89
- <!-- </keep-alive>-->
90
- <!-- </transition>-->
91
- <!-- </router-view>-->
84
+ <router-view v-slot="{ Component }">
85
+ <transition name="main" mode="out-in" appear>
86
+ <keep-alive ref="keepAliveRef" :include="keepAliveNames">
87
+ <component :is="Component" :key="$route.path" />
88
+ </keep-alive>
89
+ </transition>
90
+ </router-view>
92
91
  <slot name="micro"></slot>
93
92
  </a-layout-content>
94
93
  </a-layout>
package/src/menu/Menu.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, h, inject, resolveComponent, watchEffect } from "vue";
1
+ import { defineComponent, h, inject, resolveComponent, watch } from "vue";
2
2
  import { useRouter, useRoute } from "vue-router";
3
3
 
4
4
  import { storeToRefs } from "pinia";
@@ -18,19 +18,36 @@ export default defineComponent({
18
18
  const settingsStore = useSettingsStore();
19
19
  const { getCollapsed } = storeToRefs(settingsStore) as any;
20
20
 
21
- watchEffect(() => {
22
- if (getCollapsed.value) {
23
- // 如果菜单是收缩的状态,则不匹配激活的菜单
24
- // 否则 在切换标签的时候,收缩菜单会自动激活悬浮的动作
25
- return;
21
+ // watchEffect(() => {
22
+ // if (getCollapsed.value) {
23
+ // // 如果菜单是收缩的状态,则不匹配激活的菜单
24
+ // // 否则 在切换标签的时候,收缩菜单会自动激活悬浮的动作
25
+ // return;
26
+ // }
27
+ // // 会被触发两次
28
+ // // 当前激活的url
29
+ // const activatedUrl =
30
+ // selectedMenuKeys.value.length > 0 ? selectedMenuKeys.value[0] : "";
31
+ // const parentUrls = getParentUrls(list.value, activatedUrl);
32
+ // openMenusKeys.value = parentUrls || [];
33
+ // });
34
+
35
+ watch(
36
+ () => selectedMenuKeys.value,
37
+ (newValue: any) => {
38
+ if (getCollapsed.value) {
39
+ // 如果菜单是收缩的状态,则不匹配激活的菜单
40
+ // 否则 在切换标签的时候,收缩菜单会自动激活悬浮的动作
41
+ return;
42
+ }
43
+ const activatedUrl = newValue.length > 0 ? newValue[0] : "";
44
+ const parentUrls = getParentUrls(list.value, activatedUrl);
45
+ openMenusKeys.value = parentUrls || [];
46
+ },
47
+ {
48
+ deep: true
26
49
  }
27
- // 会被触发两次
28
- // 当前激活的url
29
- const activatedUrl =
30
- selectedMenuKeys.value.length > 0 ? selectedMenuKeys.value[0] : "";
31
- const parentUrls = getParentUrls(list.value, activatedUrl);
32
- openMenusKeys.value = parentUrls || [];
33
- });
50
+ );
34
51
 
35
52
  function getParentUrls(menus: any, url: any) {
36
53
  for (let i = 0; i < menus.length; i++) {
@@ -2,11 +2,13 @@ import {
2
2
  computed,
3
3
  defineComponent,
4
4
  nextTick,
5
+ onBeforeUnmount,
6
+ onDeactivated,
5
7
  PropType,
6
8
  reactive,
7
9
  ref,
8
- watch,
9
- watchEffect
10
+ watch
11
+ // watchEffect
10
12
  } from "vue";
11
13
  import { Pagination, Space, Table } from "ant-design-vue";
12
14
  import { useEleHeight } from "../_utils/html";
@@ -109,10 +111,11 @@ const DXTable = defineComponent({
109
111
  paginationConfig.defaultPageSize =
110
112
  props.config?.pageOption?.defaultSize ?? paginationConfig.defaultPageSize;
111
113
 
112
- watchEffect(() => {
113
- const { expandedRowKeys } = props;
114
- expandedKeys.value = expandedRowKeys;
115
- });
114
+ //TODO 后续改进
115
+ // watchEffect(() => {
116
+ // const { expandedRowKeys } = props;
117
+ // expandedKeys.value = expandedRowKeys;
118
+ // });
116
119
 
117
120
  // 初始化表格
118
121
  const {
@@ -168,21 +171,49 @@ const DXTable = defineComponent({
168
171
  }
169
172
  };
170
173
  //监听传入的height的变化 默认组件创建的时候会执行一次
171
- watchEffect(() => {
172
- if (props.height !== 0) {
173
- nextTick(() => {
174
- if (isInit.value) {
175
- playHeight(props.height);
176
- } else {
177
- // 必须在组件挂载成功后 执行计算高度 否则无法正确获取元素的高度
178
- setTimeout(() => {
174
+ // watchEffect(() => {
175
+ // if (props.height !== 0) {
176
+ // nextTick(() => {
177
+ // if (isInit.value) {
178
+ // playHeight(props.height);
179
+ // } else {
180
+ // // 必须在组件挂载成功后 执行计算高度 否则无法正确获取元素的高度
181
+ // setTimeout(() => {
182
+ // playHeight(props.height);
183
+ // // 如果表格头有很多列的情况下,获取到的头部高度不对,需要延迟执行获取高度方法
184
+ // }, 100);
185
+ // }
186
+ // });
187
+ // }
188
+ // });
189
+
190
+ let playTimeout: any = null;
191
+ watch(
192
+ () => props.height,
193
+ (val) => {
194
+ if (val !== 0) {
195
+ nextTick(() => {
196
+ if (isInit.value) {
179
197
  playHeight(props.height);
180
- // 如果表格头有很多列的情况下,获取到的头部高度不对,需要延迟执行获取高度方法
181
- }, 100);
182
- }
183
- });
198
+ } else {
199
+ // 必须在组件挂载成功后 执行计算高度 否则无法正确获取元素的高度
200
+ playTimeout = setTimeout(() => {
201
+ playHeight(props.height);
202
+ // 如果表格头有很多列的情况下,获取到的头部高度不对,需要延迟执行获取高度方法
203
+ }, 100);
204
+ }
205
+ });
206
+ }
184
207
  }
208
+ );
209
+
210
+ onBeforeUnmount(() => {
211
+ playTimeout && clearTimeout(playTimeout);
185
212
  });
213
+ onDeactivated(() => {
214
+ playTimeout && clearTimeout(playTimeout);
215
+ });
216
+
186
217
  // 监听分页组件
187
218
  const onPageChange = (page: number, size: number) => {
188
219
  onChange ? onChange({ page: page === 0 ? 1 : page, size }) : null;
@@ -258,23 +289,45 @@ const DXTable = defineComponent({
258
289
 
259
290
  const rowSelection = ref<any>(undefined);
260
291
 
261
- watchEffect(() => {
262
- const { selection } = props.config;
263
- localSelection = selection as any;
264
- if (localSelection !== "N") {
265
- rowSelection.value = {
266
- selectedRowKeys,
267
- onSelect,
268
- onSelectAll,
269
- fixed: true,
270
- columnTitle: localSelection === "S" ? "选择" : null,
271
- columnWidth: localSelection === "S" ? 60 : 40,
272
- getCheckboxProps: getCheckboxProps
273
- };
274
- } else {
275
- rowSelection.value = undefined;
292
+ // watchEffect(() => {
293
+ // const { selection } = props.config;
294
+ // localSelection = selection as any;
295
+ // if (localSelection !== "N") {
296
+ // rowSelection.value = {
297
+ // selectedRowKeys,
298
+ // onSelect,
299
+ // onSelectAll,
300
+ // fixed: true,
301
+ // columnTitle: localSelection === "S" ? "选择" : null,
302
+ // columnWidth: localSelection === "S" ? 60 : 40,
303
+ // getCheckboxProps: getCheckboxProps
304
+ // };
305
+ // } else {
306
+ // rowSelection.value = undefined;
307
+ // }
308
+ // });
309
+ watch(
310
+ () => props.config.selection,
311
+ (val) => {
312
+ localSelection = val as any;
313
+ if (localSelection !== "N") {
314
+ rowSelection.value = {
315
+ selectedRowKeys,
316
+ onSelect,
317
+ onSelectAll,
318
+ fixed: true,
319
+ columnTitle: localSelection === "S" ? "选择" : null,
320
+ columnWidth: localSelection === "S" ? 60 : 40,
321
+ getCheckboxProps: getCheckboxProps
322
+ };
323
+ } else {
324
+ rowSelection.value = undefined;
325
+ }
326
+ },
327
+ {
328
+ immediate: true
276
329
  }
277
- });
330
+ );
278
331
 
279
332
  // return {
280
333
  // selectedRowKeys,