@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
@@ -1,58 +1,393 @@
1
1
  <script setup lang="ts">
2
- import { onActivated, onUnmounted, ref } from "vue";
3
- import { useRoute } from "vue-router";
2
+ import { ref, onDeactivated, onBeforeUnmount } from "vue";
3
+ import { useTable } from "./hooks";
4
4
 
5
- const columns = [
5
+ const { data, loading, config, selectedRowKeys } = useTable();
6
+
7
+ const formState = ref({
8
+ name: "",
9
+ to: "",
10
+ from: ""
11
+ });
12
+
13
+ onBeforeUnmount(() => {
14
+ console.log("onBeforeUnmount");
15
+ });
16
+
17
+ onDeactivated(() => {
18
+ console.log("222");
19
+ });
20
+
21
+ const scheme = [
22
+ {
23
+ type: "a-col",
24
+ props: {
25
+ span: 6
26
+ },
27
+ body: {
28
+ type: "a-form-item",
29
+ props: {
30
+ label: "姓名",
31
+ name: "name"
32
+ },
33
+ body: {
34
+ type: "a-input",
35
+ props: {
36
+ name: "name",
37
+ placeholder: "请输入姓名"
38
+ }
39
+ }
40
+ }
41
+ },
42
+ {
43
+ type: "a-col",
44
+ props: {
45
+ span: 6
46
+ },
47
+ body: {
48
+ type: "a-form-item",
49
+ props: {
50
+ label: "姓名",
51
+ name: "name"
52
+ },
53
+ body: {
54
+ type: "a-input",
55
+ props: {
56
+ name: "name",
57
+ placeholder: "请输入姓名"
58
+ }
59
+ }
60
+ }
61
+ },
62
+ {
63
+ type: "a-col",
64
+ props: {
65
+ span: 6
66
+ },
67
+ body: {
68
+ type: "a-form-item",
69
+ props: {
70
+ label: "姓名",
71
+ name: "name"
72
+ },
73
+ body: {
74
+ type: "a-input",
75
+ props: {
76
+ name: "name",
77
+ placeholder: "请输入姓名"
78
+ }
79
+ }
80
+ }
81
+ },
82
+ {
83
+ type: "a-col",
84
+ props: {
85
+ span: 6
86
+ },
87
+ body: {
88
+ type: "a-form-item",
89
+ props: {
90
+ label: "姓名",
91
+ name: "name"
92
+ },
93
+ body: {
94
+ type: "a-input",
95
+ props: {
96
+ name: "name",
97
+ placeholder: "请输入姓名"
98
+ }
99
+ }
100
+ }
101
+ },
102
+ {
103
+ type: "a-col",
104
+ props: {
105
+ span: 6
106
+ },
107
+ body: {
108
+ type: "a-form-item",
109
+ props: {
110
+ label: "姓名",
111
+ name: "name"
112
+ },
113
+ body: {
114
+ type: "a-input",
115
+ props: {
116
+ name: "name",
117
+ placeholder: "请输入姓名"
118
+ }
119
+ }
120
+ }
121
+ },
122
+ {
123
+ type: "a-col",
124
+ props: {
125
+ span: 6
126
+ },
127
+ body: {
128
+ type: "a-form-item",
129
+ props: {
130
+ label: "姓名",
131
+ name: "name"
132
+ },
133
+ body: {
134
+ type: "a-input",
135
+ props: {
136
+ name: "name",
137
+ placeholder: "请输入姓名"
138
+ }
139
+ }
140
+ }
141
+ },
6
142
  {
7
- title: "商品编码"
143
+ type: "a-col",
144
+ props: {
145
+ span: 6
146
+ },
147
+ body: {
148
+ type: "a-form-item",
149
+ props: {
150
+ label: "姓名",
151
+ name: "name"
152
+ },
153
+ body: {
154
+ type: "a-input",
155
+ props: {
156
+ name: "name",
157
+ placeholder: "请输入姓名"
158
+ }
159
+ }
160
+ }
8
161
  },
9
162
  {
10
- title: "商品名称"
163
+ type: "a-col",
164
+ props: {
165
+ span: 6
166
+ },
167
+ body: {
168
+ type: "a-form-item",
169
+ props: {
170
+ label: "姓名",
171
+ name: "name"
172
+ },
173
+ body: {
174
+ type: "a-input",
175
+ props: {
176
+ name: "name",
177
+ placeholder: "请输入姓名"
178
+ }
179
+ }
180
+ }
11
181
  },
12
182
  {
13
- title: "第一计量单位"
183
+ type: "a-col",
184
+ props: {
185
+ span: 6
186
+ },
187
+ body: {
188
+ type: "a-form-item",
189
+ props: {
190
+ label: "姓名",
191
+ name: "name"
192
+ },
193
+ body: {
194
+ type: "a-input",
195
+ props: {
196
+ name: "name",
197
+ placeholder: "请输入姓名"
198
+ }
199
+ }
200
+ }
14
201
  },
15
202
  {
16
- title: "申报总价"
203
+ type: "a-col",
204
+ props: {
205
+ span: 6
206
+ },
207
+ body: {
208
+ type: "a-form-item",
209
+ props: {
210
+ label: "姓名",
211
+ name: "name"
212
+ },
213
+ body: {
214
+ type: "a-input",
215
+ props: {
216
+ name: "name",
217
+ placeholder: "请输入姓名"
218
+ }
219
+ }
220
+ }
17
221
  },
18
222
  {
19
- title: "毛重"
223
+ type: "a-col",
224
+ props: {
225
+ span: 6
226
+ },
227
+ body: {
228
+ type: "a-form-item",
229
+ props: {
230
+ label: "姓名",
231
+ name: "name"
232
+ },
233
+ body: {
234
+ type: "a-input",
235
+ props: {
236
+ name: "name",
237
+ placeholder: "请输入姓名"
238
+ }
239
+ }
240
+ }
241
+ },
242
+ {
243
+ type: "a-col",
244
+ props: {
245
+ span: 6
246
+ },
247
+ body: {
248
+ type: "a-form-item",
249
+ props: {
250
+ label: "申报日期",
251
+ name: "date"
252
+ },
253
+ body: {
254
+ type: "d-range-picker",
255
+ props: {
256
+ value: formState,
257
+ field: ["to", "from"]
258
+ }
259
+ }
260
+ }
20
261
  }
21
262
  ];
22
- const route = useRoute();
23
- const loading = ref(false);
24
263
 
25
- const formState = ref({
26
- originCountry: ""
27
- });
264
+ const onQuery = () => {
265
+ console.log("22");
266
+ };
28
267
 
29
- onUnmounted(() => {
30
- console.log("onUnmounted");
31
- });
32
- onActivated(() => {
33
- console.log("onActivated");
34
- });
268
+ const queryParams = ref({ from: "", to: "" });
269
+
270
+ setTimeout(() => {
271
+ queryParams.value.from = "2023-02-04";
272
+ queryParams.value.to = "2023-05-06";
273
+ }, 3000);
35
274
  </script>
36
275
  <script lang="ts">
37
276
  export default {
38
- name: "Add"
277
+ name: "TableList"
39
278
  };
40
279
  </script>
41
280
  <template>
42
- <d-show-layout :loading="loading">
43
- <template #footer>
44
- <a-space>
45
- <a-button type="primary" @click="loading = true">暂存</a-button>
46
- {{ loading }}
47
- <a-button type="primary">申报</a-button>
48
- </a-space>
281
+ <d-list-layout>
282
+ <template #form>
283
+ <d-query-form :value="formState" :scheme="scheme" @query="onQuery">
284
+ </d-query-form>
285
+ {{ queryParams }}
286
+ <d-range-picker v-model:value="queryParams" :field="['from', 'to']" />
49
287
  </template>
50
- </d-show-layout>
288
+ <template #table="{ height }">
289
+ <d-table
290
+ v-model:keys="selectedRowKeys"
291
+ row-key="id"
292
+ :loading="loading"
293
+ :expanded-row-keys="['1', '2']"
294
+ :data="data"
295
+ :config="config"
296
+ :height="height"
297
+ @change="
298
+ () => {
299
+ console.log('change');
300
+ }
301
+ "
302
+ >
303
+ <template #action>
304
+ <a-button>ok</a-button>
305
+ </template>
306
+ </d-table>
307
+ </template>
308
+ </d-list-layout>
51
309
  </template>
52
- <style scoped>
53
- .title {
54
- font-size: 18px;
55
- font-weight: bold;
56
- color: #2589ff;
310
+ <style lang="scss">
311
+ @mixin rowEdit {
312
+ //content: "";
313
+ //display: block;
314
+ //position: absolute;
315
+ //top: 0;
316
+ //left: 0;
317
+ //z-index: 1993;
318
+ //transition: all 0.3s ease-in-out; /* 或者使用动画实现 */
319
+ content: "";
320
+ position: absolute;
321
+ //top: 0;
322
+ //left: 0;
323
+ //right: 0;
324
+ //bottom: 0;
325
+ z-index: 1993;
326
+
327
+ // border: 1px solid red;
328
+ //transform: scaleY(0);
329
+ transition: transform 0.3s ease-in-out;
330
+ }
331
+ .row-edit-class {
332
+ position: relative;
333
+
334
+ &:after {
335
+ @include rowEdit;
336
+ //box-shadow: 0 0 0 2px red;
337
+ }
338
+
339
+ //&::before {
340
+ // border-top: 1px solid #ccc;
341
+ // border-bottom: 1px solid #ccc;
342
+ // transform: scaleY(0);
343
+ //}
344
+ //
345
+ //&::after {
346
+ // border-left: 1px solid #ccc;
347
+ // border-right: 1px solid #ccc;
348
+ //}
349
+ }
350
+
351
+ //tr:hover::before,
352
+ //tr:hover::after {
353
+ // transform: scaleY(1) scaleX(1);
354
+ //}
355
+
356
+ .row-class {
357
+ position: relative;
358
+ z-index: 1993;
359
+ //box-shadow: 2px 1px 8px 2px #162157;
360
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
361
+ transform: translate(0px, 1px);
362
+ transition: box-shadow 0.3s, transform 0.3s, font-weight 0.9s;
363
+ td {
364
+ font-weight: bold;
365
+
366
+ &:first-child {
367
+ &::before {
368
+ position: absolute;
369
+ left: 0px;
370
+ top: -2px;
371
+ bottom: -2px;
372
+ content: "";
373
+ width: 4px;
374
+ background: #017ffe;
375
+ transition: width 0.3s, background 0.3s;
376
+ }
377
+ }
378
+ }
379
+ }
380
+ //
381
+ //tr {
382
+ // &:hover {
383
+ // position: relative;
384
+ // z-index: 1993;
385
+ // box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
386
+ // transform: translateZ(10px);
387
+ // transition: box-shadow 0.3s, transform 0.3s;
388
+ // }
389
+ //}
390
+ tr {
391
+ cursor: pointer;
57
392
  }
58
393
  </style>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { ref, onDeactivated } from "vue";
2
+ import { ref, onDeactivated, onBeforeUnmount } from "vue";
3
3
  import { useTable } from "./hooks";
4
4
 
5
5
  const { data, loading, config, selectedRowKeys } = useTable();
@@ -10,6 +10,10 @@ const formState = ref({
10
10
  from: ""
11
11
  });
12
12
 
13
+ onBeforeUnmount(() => {
14
+ console.log("onBeforeUnmount");
15
+ });
16
+
13
17
  onDeactivated(() => {
14
18
  console.log("222");
15
19
  });
@@ -266,7 +270,7 @@ const queryParams = ref({ from: "", to: "" });
266
270
  setTimeout(() => {
267
271
  queryParams.value.from = "2023-02-04";
268
272
  queryParams.value.to = "2023-05-06";
269
- }, 3000);
273
+ }, 200);
270
274
  </script>
271
275
  <script lang="ts">
272
276
  export default {
@@ -300,26 +304,7 @@ export default {
300
304
  <a-button>ok</a-button>
301
305
  </template>
302
306
  </d-table>
303
- <!-- <d-table-->
304
- <!-- v-model:keys="selectedRowKeys"-->
305
- <!-- row-key="id"-->
306
- <!-- :loading="loading"-->
307
- <!-- :expanded-row-keys="['1', '2']"-->
308
- <!-- :data="data"-->
309
- <!-- :config="config"-->
310
- <!-- :height="200"-->
311
- <!-- @change="-->
312
- <!-- () => {-->
313
- <!-- console.log('change');-->
314
- <!-- }-->
315
- <!-- "-->
316
- <!-- >-->
317
- <!-- <template #action>-->
318
- <!-- <a-button>ok</a-button>-->
319
- <!-- </template>-->
320
- <!-- </d-table>-->
321
307
  </template>
322
- <!-- <TestModal v-model:visible="visible" />-->
323
308
  </d-list-layout>
324
309
  </template>
325
310
  <style lang="scss">
@@ -20,7 +20,7 @@ export const useTable = () => {
20
20
  columns,
21
21
  // bordered: true,
22
22
  pagination,
23
-
23
+ selection: "M",
24
24
  clickSelectedClassName: "ant-table-row-selected",
25
25
  onPageChange,
26
26
  dbClick: (record: any) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditari/bsui",
3
- "version": "1.1.39",
3
+ "version": "1.1.41",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, watchEffect } from "vue";
1
+ import { defineComponent, ref, watch } from "vue";
2
2
  import type { PropType } from "vue";
3
3
  import { RangePicker } from "ant-design-vue";
4
4
 
@@ -43,27 +43,27 @@ export default defineComponent({
43
43
  emit("update:value", internalModel.value);
44
44
  };
45
45
 
46
- watchEffect(() => {
47
- const value: any = props.value;
48
- props.field.forEach((key, index) => {
49
- if (value[key] === "") {
50
- dates.value && (dates.value[index] = "");
51
- } else {
52
- dates.value && (dates.value[index] = value[key]);
53
- }
54
- });
46
+ //循环字段
47
+ // eslint-disable-next-line vue/no-setup-props-destructure
48
+ const watchExpressions = props.field.map((key) => () => {
49
+ return props.value?.[key];
55
50
  });
56
51
 
57
- watchEffect(() => {
58
- const value: any = props.value;
59
- props.field.forEach((key, index) => {
60
- if (value[key] === "") {
61
- dates.value && (dates.value[index] = "");
62
- } else {
63
- dates.value && (dates.value[index] = value[key]);
64
- }
52
+ const watchHandler = (newValues: any) => {
53
+ // 判断是否被置空只有这两个字段同时为空,才是表明被置空
54
+ const isClear = props.field.every((key, index) => {
55
+ return newValues[index] === "" || newValues[index] === undefined;
65
56
  });
66
- });
57
+ if (isClear) {
58
+ dates.value = [];
59
+ } else {
60
+ props.field.forEach((key, index) => {
61
+ dates.value && (dates.value[index] = newValues[index]);
62
+ });
63
+ }
64
+ };
65
+ //监听多个字段变化
66
+ watch(watchExpressions, watchHandler);
67
67
 
68
68
  return () => (
69
69
  <div>
@@ -3,7 +3,7 @@
3
3
  * 根据字典名字及对应的value替换成中文或者人能看懂的文字
4
4
  * @author 余春林
5
5
  */
6
- import { defineComponent, ref, watchEffect } from "vue";
6
+ import { defineComponent, ref, watch } from "vue";
7
7
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8
8
  // @ts-ignore
9
9
  // import DicWorker from "./replace.worker?worker&inline";
@@ -45,12 +45,18 @@ export default defineComponent({
45
45
  // // 赋值给下拉选择数据变量
46
46
  // dicValueTxt.value = e.data;
47
47
  // };
48
- watchEffect(() => {
49
- const value = props.value;
50
- const name = props.name;
51
- dicValueTxt.value = getDicTextByValue(name, value);
52
- // workerInstance.postMessage({ list: JSON.stringify(list), name, value });
53
- });
48
+
49
+ watch(
50
+ () => props.value,
51
+ (val: any) => {
52
+ const value = val;
53
+ const name = props.name;
54
+ dicValueTxt.value = getDicTextByValue(name, value);
55
+ },
56
+ {
57
+ immediate: true
58
+ }
59
+ );
54
60
 
55
61
  return () => <>{dicValueTxt.value}</>;
56
62
  }
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * FUCK MAIN 入口文件
4
4
  */
5
- import { computed, getCurrentInstance, nextTick, ref } from "vue";
5
+ import { computed, provide } from "vue";
6
6
  import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons-vue";
7
7
  import { useKeepAliveStore, useSettingsStore } from "@ditari/store";
8
8
 
@@ -11,6 +11,20 @@ import DNavTabs from "./NavTabs.vue";
11
11
  // 菜单组件
12
12
  import Menu from "../menu/Menu";
13
13
 
14
+ const props = withDefaults(
15
+ defineProps<{
16
+ showConfig?: any;
17
+ breadcrumbStatus?: boolean;
18
+ }>(),
19
+ {
20
+ showConfig: { backBtn: "LeftOutlined" } as any
21
+ }
22
+ );
23
+
24
+ // 注入show组件的配置文件
25
+ // eslint-disable-next-line vue/no-setup-props-destructure
26
+ provide("showConfig", props.showConfig);
27
+
14
28
  // 缓存store
15
29
  const store = useKeepAliveStore();
16
30
  // 缓存的names
@@ -19,13 +33,6 @@ const keepAliveNames = computed(() => store.get);
19
33
  const settingsStore = useSettingsStore();
20
34
  const { switchCollapsed } = settingsStore;
21
35
  const collapsedStatus = computed(() => settingsStore.getCollapsed);
22
-
23
- const keepAliveRef = ref();
24
-
25
- nextTick(() => {
26
- const instance: any = getCurrentInstance();
27
- console.log(instance);
28
- });
29
36
  </script>
30
37
  <template>
31
38
  <a-layout class="ditari-layout">
@@ -68,12 +75,13 @@ nextTick(() => {
68
75
  class="ditari-layout-content"
69
76
  :style="{ marginLeft: collapsedStatus ? '80px' : '200px' }"
70
77
  >
71
- <router-view />
72
- <!-- <transition name="main" mode="out-in" appear>-->
73
- <!-- <keep-alive ref="keepAliveRef" :include="keepAliveNames">-->
74
- <!-- <component :is="Component" :key="$route.path" />-->
75
- <!-- </keep-alive>-->
76
- <!-- </transition>-->
78
+ <router-view v-slot="{ Component }">
79
+ <transition name="main" mode="out-in" appear>
80
+ <keep-alive ref="keepAliveRef" :include="keepAliveNames">
81
+ <component :is="Component" :key="$route.path" />
82
+ </keep-alive>
83
+ </transition>
84
+ </router-view>
77
85
  <slot name="micro"></slot>
78
86
  </a-layout-content>
79
87
  </a-layout>
@@ -8,8 +8,7 @@ import {
8
8
  onUnmounted,
9
9
  WatchStopHandle,
10
10
  inject,
11
- nextTick,
12
- watchEffect
11
+ nextTick
13
12
  } from "vue";
14
13
  import { useElementSize, useResizeObserver } from "@vueuse/core";
15
14
  import { useSettingsStore } from "@ditari/store";
@@ -81,22 +80,24 @@ function useWatch() {
81
80
 
82
81
  // 监听表单高度变化
83
82
  // 然后再获取表格高度
83
+ // 在表格高度动态变化的时候会被监听到
84
84
  const formRef = ref(null);
85
85
  const { height: formHeight } = useElementSize(formRef);
86
86
  watch(
87
87
  () => formHeight.value,
88
88
  () => {
89
- calcHeight();
90
- },
91
- { immediate: true }
89
+ nextTick(() => {
90
+ calcHeight();
91
+ });
92
+ }
92
93
  );
93
94
 
94
- watchEffect(() => {
95
+ const { stop } = useResizeObserver(document.body, () => {
95
96
  calcHeight();
96
97
  });
97
98
 
98
- useResizeObserver(document.body, () => {
99
- calcHeight();
99
+ onUnmounted(() => {
100
+ stop();
100
101
  });
101
102
 
102
103
  // 动态计算高度