@ditari/bsui 1.1.47 → 1.1.49

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 (128) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/menu/Menu.cjs +6 -1
  4. package/dist/cjs/menu/Menu.cjs.map +1 -1
  5. package/dist/esm/index.mjs.map +1 -1
  6. package/dist/esm/menu/Menu.mjs +6 -1
  7. package/dist/esm/menu/Menu.mjs.map +1 -1
  8. package/package.json +7 -3
  9. package/example/index.html +0 -13
  10. package/example/node_modules/.vite/deps/@ant-design_icons-vue.js +0 -29406
  11. package/example/node_modules/.vite/deps/@ant-design_icons-vue.js.map +0 -7
  12. package/example/node_modules/.vite/deps/@vueuse_core.js +0 -8255
  13. package/example/node_modules/.vite/deps/@vueuse_core.js.map +0 -7
  14. package/example/node_modules/.vite/deps/_metadata.json +0 -80
  15. package/example/node_modules/.vite/deps/ant-design-vue.js +0 -62756
  16. package/example/node_modules/.vite/deps/ant-design-vue.js.map +0 -7
  17. package/example/node_modules/.vite/deps/axios.js +0 -2126
  18. package/example/node_modules/.vite/deps/axios.js.map +0 -7
  19. package/example/node_modules/.vite/deps/chunk-5WWUZCGV.js +0 -36
  20. package/example/node_modules/.vite/deps/chunk-5WWUZCGV.js.map +0 -7
  21. package/example/node_modules/.vite/deps/chunk-D36HXFYL.js +0 -25
  22. package/example/node_modules/.vite/deps/chunk-D36HXFYL.js.map +0 -7
  23. package/example/node_modules/.vite/deps/chunk-EBDM3ESC.js +0 -161
  24. package/example/node_modules/.vite/deps/chunk-EBDM3ESC.js.map +0 -7
  25. package/example/node_modules/.vite/deps/chunk-EKNPBJBG.js +0 -3600
  26. package/example/node_modules/.vite/deps/chunk-EKNPBJBG.js.map +0 -7
  27. package/example/node_modules/.vite/deps/chunk-GK7Q6YQN.js +0 -10796
  28. package/example/node_modules/.vite/deps/chunk-GK7Q6YQN.js.map +0 -7
  29. package/example/node_modules/.vite/deps/chunk-TDI2FIXO.js +0 -19
  30. package/example/node_modules/.vite/deps/chunk-TDI2FIXO.js.map +0 -7
  31. package/example/node_modules/.vite/deps/package.json +0 -3
  32. package/example/node_modules/.vite/deps/pinia-plugin-persistedstate.js +0 -125
  33. package/example/node_modules/.vite/deps/pinia-plugin-persistedstate.js.map +0 -7
  34. package/example/node_modules/.vite/deps/pinia.js +0 -1519
  35. package/example/node_modules/.vite/deps/pinia.js.map +0 -7
  36. package/example/node_modules/.vite/deps/vue-request.js +0 -1191
  37. package/example/node_modules/.vite/deps/vue-request.js.map +0 -7
  38. package/example/node_modules/.vite/deps/vue-router.js +0 -2667
  39. package/example/node_modules/.vite/deps/vue-router.js.map +0 -7
  40. package/example/node_modules/.vite/deps/vue.js +0 -314
  41. package/example/node_modules/.vite/deps/vue.js.map +0 -7
  42. package/example/package.json +0 -17
  43. package/example/src/App.vue +0 -7
  44. package/example/src/api/list.ts +0 -22
  45. package/example/src/api/user.ts +0 -13
  46. package/example/src/components/AppMain.vue +0 -113
  47. package/example/src/hooks.ts +0 -103
  48. package/example/src/main.ts +0 -22
  49. package/example/src/router/form/index.route.ts +0 -23
  50. package/example/src/router/index.ts +0 -61
  51. package/example/src/router/table/index.route.ts +0 -39
  52. package/example/src/views/Demo.vue +0 -49
  53. package/example/src/views/DemoBk.vue +0 -34
  54. package/example/src/views/Login.vue +0 -79
  55. package/example/src/views/form/List.vue +0 -16
  56. package/example/src/views/form/List2.vue +0 -74
  57. package/example/src/views/form/QueryFormDemo.vue +0 -49
  58. package/example/src/views/form/dyn/List.vue +0 -121
  59. package/example/src/views/table/Add.vue +0 -377
  60. package/example/src/views/table/Demo.vue +0 -15
  61. package/example/src/views/table/Demo2.vue +0 -12
  62. package/example/src/views/table/Edit.vue +0 -10
  63. package/example/src/views/table/List.vue +0 -415
  64. package/example/src/views/table/Test.tsx +0 -42
  65. package/example/src/views/table/TestModal.vue +0 -64
  66. package/example/src/views/table/WorkStatusRound.vue +0 -31
  67. package/example/src/views/table/components/AddForm.vue +0 -44
  68. package/example/src/views/table/hooks.ts +0 -106
  69. package/example/src/views/task/Todo.vue +0 -6
  70. package/example/tsconfig.json +0 -16
  71. package/example/utils/http.ts +0 -107
  72. package/example/vite-env.d.ts +0 -8
  73. package/example/vite.config.ts +0 -10
  74. package/src/_utils/html.ts +0 -17
  75. package/src/_utils/install.ts +0 -12
  76. package/src/components.ts +0 -10
  77. package/src/config/Config.vue +0 -8
  78. package/src/date/RangePicker.tsx +0 -93
  79. package/src/date/index.ts +0 -9
  80. package/src/desensitize/Desensitize.tsx +0 -97
  81. package/src/desensitize/index.ts +0 -9
  82. package/src/desensitize/style/index.scss +0 -8
  83. package/src/dic/DicReplace.tsx +0 -63
  84. package/src/dic/index.ts +0 -8
  85. package/src/dic/replace.worker.ts +0 -25
  86. package/src/form/DQueryForm.tsx +0 -258
  87. package/src/form/index.ts +0 -9
  88. package/src/form/style/index.less +0 -0
  89. package/src/grid/Grid.tsx +0 -83
  90. package/src/grid/GridItem.tsx +0 -15
  91. package/src/grid/index.md +0 -4
  92. package/src/grid/index.ts +0 -16
  93. package/src/grid/style/index.scss +0 -70
  94. package/src/index.scss +0 -19
  95. package/src/index.ts +0 -50
  96. package/src/json-scheme-render/JsonSchemeRender.tsx +0 -101
  97. package/src/json-scheme-render/index.ts +0 -9
  98. package/src/layout/Breadcrumb.vue +0 -39
  99. package/src/layout/FuckMain.vue +0 -90
  100. package/src/layout/List.vue +0 -145
  101. package/src/layout/Main.vue +0 -97
  102. package/src/layout/NavTabs.vue +0 -129
  103. package/src/layout/Show.vue +0 -135
  104. package/src/layout/index.ts +0 -24
  105. package/src/layout/style/breadcrumb.scss +0 -61
  106. package/src/layout/style/fuckmain.scss +0 -21
  107. package/src/layout/style/index.scss +0 -35
  108. package/src/layout/style/list.scss +0 -26
  109. package/src/layout/style/main.scss +0 -74
  110. package/src/layout/style/navtab.scss +0 -146
  111. package/src/layout/style/show.scss +0 -50
  112. package/src/menu/Menu.tsx +0 -181
  113. package/src/menu/style/index.scss +0 -26
  114. package/src/modal/Modal.tsx +0 -83
  115. package/src/modal/index.ts +0 -9
  116. package/src/modal/style/index.scss +0 -74
  117. package/src/select/Select.vue +0 -177
  118. package/src/select/dic.worker.ts +0 -32
  119. package/src/select/index.ts +0 -9
  120. package/src/table/Field.vue +0 -44
  121. package/src/table/Table.tsx +0 -515
  122. package/src/table/index.md +0 -1
  123. package/src/table/index.ts +0 -9
  124. package/src/table/interface/table.ts +0 -64
  125. package/src/table/style/index.scss +0 -10
  126. package/src/theme/index.ts +0 -1
  127. package/src/theme/theme.scss +0 -1
  128. package/src/theme/variable.scss +0 -67
@@ -1,258 +0,0 @@
1
- import { defineComponent, onMounted, ref, watch, watchEffect } from "vue";
2
- import { Form, FormItem, Row, Col, Button, Space } from "ant-design-vue";
3
- import {
4
- SearchOutlined,
5
- ReloadOutlined,
6
- DoubleRightOutlined
7
- } from "@ant-design/icons-vue";
8
- import DJsonSchemeRender from "../json-scheme-render/JsonSchemeRender";
9
-
10
- /**
11
- * 查询表单渲染
12
- * 展开,隐藏功能
13
- */
14
- export default defineComponent({
15
- name: "DQueryForm",
16
- props: {
17
- scheme: {
18
- type: [Array, Object] as unknown as () => any[] | Record<string, any>,
19
- default: () => []
20
- },
21
- model: {
22
- type: Object as () => Record<string, unknown>,
23
- default: () => ({})
24
- },
25
- labelWidth: {
26
- type: String,
27
- default: "90px"
28
- },
29
- loading: {
30
- type: Boolean,
31
- default: false
32
- }
33
- },
34
- emits: ["reset", "query"],
35
- setup(props, { slots, emit }) {
36
- // 表单
37
- const { loading, modelValue, formRef, onQuery, onReset, onKeyup } =
38
- useForm();
39
- // 展开
40
- const { rowRef, actionSpan, onExpend, expendBtnVisible, isExpend } =
41
- useExpand();
42
- //渲染操作列
43
- const { renderAction } = useRender();
44
-
45
- function useForm() {
46
- const loading = ref(false);
47
- const formRef = ref<any>(null);
48
- const modelValue = ref<any>({});
49
-
50
- watchEffect(() => {
51
- modelValue.value = props.model;
52
- });
53
-
54
- watch(
55
- () => props.loading,
56
- (val) => {
57
- loading.value = val;
58
- }
59
- );
60
-
61
- /// 监听回车事件
62
- // watch(enterKey, (v) => {
63
- // if (v) {
64
- // // 有路由名字会被keepalive进行缓存
65
- // // 用于判断当前页面是否被激活 因为页面被缓存的时候,页面切换后,回车事件依然会触发
66
- // const isActive = keepStore.list.some((name) => name === route.name);
67
- // console.log(route.name);
68
- // if (!loading.value && isActive) {
69
- // emit("query", modelValue.value);
70
- // }
71
- // //TODO 逻辑有问题
72
- // if (!route.name) {
73
- // // 没有路由名字,不会被缓存
74
- // if (!loading.value) {
75
- // emit("query", modelValue.value);
76
- // }
77
- // } else {
78
- //
79
- // }
80
- // }
81
- // });
82
-
83
- const onQuery = () => {
84
- emit("query", modelValue.value);
85
- };
86
-
87
- const onReset = () => {
88
- formRef.value?.resetFields();
89
- emit("reset");
90
- };
91
-
92
- const onKeyup = (event: any) => {
93
- if (event.keyCode === 13) {
94
- if (!loading.value) {
95
- emit("query", modelValue.value);
96
- }
97
- }
98
- };
99
- return {
100
- loading,
101
- modelValue,
102
- formRef,
103
- onQuery,
104
- onReset,
105
- onKeyup
106
- };
107
- }
108
-
109
- function useRender() {
110
- /**
111
- * 操作按钮渲染
112
- */
113
- function renderAction() {
114
- return (
115
- <Space>
116
- <Button
117
- loading={loading.value}
118
- type={"primary"}
119
- shape={"round"}
120
- onClick={onQuery}
121
- >
122
- {{
123
- default: () => "查询",
124
- icon: () => <SearchOutlined />
125
- }}
126
- </Button>
127
- <Button disabled={loading.value} shape={"round"} onClick={onReset}>
128
- {{
129
- default: () => "重置",
130
- icon: () => <ReloadOutlined />
131
- }}
132
- </Button>
133
- {expendBtnVisible.value ? (
134
- <Button onClick={onExpend} shape={"round"}>
135
- {{
136
- default: () => (isExpend.value ? "收起" : "展开"),
137
- icon: () => (
138
- <DoubleRightOutlined rotate={isExpend.value ? -90 : 90} />
139
- )
140
- }}
141
- </Button>
142
- ) : null}
143
- </Space>
144
- );
145
- }
146
-
147
- return {
148
- renderAction
149
- };
150
- }
151
-
152
- function useExpand() {
153
- // 为24网格布局
154
- const gridCount = 24;
155
- // 每列占6个格子
156
- const colSpan = 6;
157
- // 每行显示4列
158
- const colsPerRow = 4;
159
- // 操作按钮span
160
- const actionSpan = ref(6);
161
- // 控制展开或隐藏按钮文本
162
- const isExpend = ref(false);
163
- // 控制展开按按钮是否显示
164
- const expendBtnVisible = ref(false);
165
- // 行对象
166
- const rowRef = ref<any>(null);
167
-
168
- onMounted(() => {
169
- handleShowOrHidden();
170
- });
171
-
172
- function onExpend() {
173
- isExpend.value = !isExpend.value;
174
- handleShowOrHidden();
175
- }
176
-
177
- /**
178
- * 处理隐藏或显示
179
- */
180
- function handleShowOrHidden() {
181
- const colEl = Array.from(rowRef.value?.$el?.children);
182
- // col总条数 减掉操作栏按钮的div个数为1
183
- const colElLen = colEl.length - 1;
184
- // 已占用的网格数 = col总条数 * 每列占用的网格数
185
- const occupiedCols = colElLen * colSpan;
186
- // 总行数 = 总div数 / 每行显示的列数
187
- const fullRows = Math.ceil(colElLen / colsPerRow);
188
- // 最后一行的网格数 = 已占用的网格数 % 24
189
- const lastRowCols = occupiedCols % gridCount;
190
- // 最后一行剩余的网格数
191
- const remainingCols = gridCount - lastRowCols;
192
-
193
- // 网格行大于2才显示展开或隐藏按钮
194
- if (fullRows > 2) {
195
- expendBtnVisible.value = true;
196
- } else {
197
- // 如果没有大于两行,操作栏占用剩余的宽度
198
- actionSpan.value = remainingCols;
199
- }
200
- // 最后一行的起始索引
201
- const lastRowStartIndex = colsPerRow * (fullRows - 1) - 1;
202
- // 只有展开按钮显示时才处理
203
- if (expendBtnVisible.value) {
204
- colEl.forEach((col: any, index) => {
205
- if (index >= lastRowStartIndex) {
206
- // 最后一个元素不隐藏 是操作按钮的div
207
- index !== colElLen
208
- ? (col.style.display = !isExpend.value ? "none" : "block")
209
- : null; // 隐藏元素
210
- }
211
- });
212
- }
213
-
214
- if (expendBtnVisible.value) {
215
- // 如果是展开状态 则操作按钮占用剩余的网格数 否则占用6个网格
216
- isExpend.value
217
- ? (actionSpan.value = remainingCols)
218
- : (actionSpan.value = colSpan);
219
- }
220
- }
221
-
222
- return {
223
- rowRef,
224
- actionSpan,
225
- onExpend,
226
- expendBtnVisible,
227
- isExpend
228
- };
229
- }
230
-
231
- return () => (
232
- <div onKeyup={onKeyup}>
233
- <Form
234
- ref={formRef}
235
- colon={false}
236
- labelCol={{ style: { width: props.labelWidth } }}
237
- model={modelValue.value}
238
- >
239
- <Row ref={rowRef}>
240
- {slots.default ? (
241
- slots.default()
242
- ) : (
243
- <DJsonSchemeRender
244
- layout={props.scheme}
245
- value={modelValue.value}
246
- />
247
- )}
248
- <Col span={actionSpan.value} style={{ textAlign: "right" }}>
249
- <FormItem>
250
- {slots.action ? slots.action() : renderAction()}
251
- </FormItem>
252
- </Col>
253
- </Row>
254
- </Form>
255
- </div>
256
- );
257
- }
258
- });
package/src/form/index.ts DELETED
@@ -1,9 +0,0 @@
1
- import type { App } from "vue";
2
- import QueryForm from "./DQueryForm";
3
-
4
- QueryForm.install = function (app: App) {
5
- app.component(QueryForm.name, QueryForm);
6
- return app;
7
- };
8
-
9
- export default QueryForm;
File without changes
package/src/grid/Grid.tsx DELETED
@@ -1,83 +0,0 @@
1
- import { ref, defineComponent } from "vue";
2
- import { useResizeObserver } from "@vueuse/core";
3
- import { storeToRefs } from "pinia";
4
-
5
- import { useSettingsStore } from "@ditari/store";
6
- import { prefixName } from "../theme";
7
-
8
- import GridItem from "./GridItem";
9
-
10
- //class名称
11
- const baseClassName = `${prefixName}-grid`;
12
-
13
- export default defineComponent({
14
- name: "DGrid",
15
- props: {
16
- // css class
17
- className: {
18
- type: String,
19
- default: ""
20
- },
21
- // 是否补全空白单元格
22
- fill: {
23
- type: Boolean,
24
- default: true
25
- },
26
- grid: {
27
- type: String,
28
- default: ""
29
- }
30
- },
31
- setup(props, { slots }: any) {
32
- if (!slots.default) {
33
- return () => <>ok</>;
34
- }
35
- // 从store获取网格配置信息
36
- const store = useSettingsStore();
37
- // 转换成响应式对象 不使用storeToRefs的对象被解构后失去”响应式“
38
- const { gridValue } = storeToRefs(store);
39
-
40
- // 获取单元格个数
41
- const length =
42
- slots?.default()[0]?.children.length || slots?.default().length;
43
-
44
- // 要填充空白的网格数
45
- const fillGridItems = ref<number[]>([]);
46
-
47
- gridValue.value.value = props.grid || gridValue.value.value;
48
-
49
- // 网格列
50
- const baseStyle = ref<any>({
51
- "grid-template-columns": gridValue.value?.value ?? ""
52
- });
53
-
54
- //监听屏幕尺寸变化,一般只有人工拉大屏幕尺寸才会触发(默认执行一次)
55
- useResizeObserver(document.body, () => {
56
- //TODO 检测浏览器是否被缩放
57
- // TODO 使用store 会存在所有的配置均有一个对象bug
58
- if (props.grid === "") {
59
- store.gridMatching();
60
- }
61
- baseStyle.value["grid-template-columns"] = gridValue.value?.value ?? "";
62
- // 获取当前设备匹配到显示的列数配置
63
- const colCount = gridValue.value?.col;
64
- // 根据总单元格和显示的列数 计算出总行数
65
- const rowCount = Math.ceil(length / colCount);
66
- // 总行数乘以显示的列数减去传入的子标签个数 等于要填充的空白单元格数
67
- const number = props.fill ? rowCount * colCount - length : 0;
68
- // 生成一个要填充空白单元格的数组 用于循环空白的单元格
69
- fillGridItems.value = Array.from({ length: number }, (_, i) => i + 1);
70
- });
71
-
72
- return () => (
73
- <>
74
- <div class={[baseClassName, props.className]} style={baseStyle.value}>
75
- {slots.default && slots.default(fillGridItems.value)}
76
- {fillGridItems.value.map((number) => (
77
- <GridItem key={number}></GridItem>
78
- ))}
79
- </div>
80
- </>
81
- );
82
- }
83
- });
@@ -1,15 +0,0 @@
1
- import { defineComponent } from "vue";
2
- import { prefixName } from "../theme";
3
-
4
- //class名称
5
- const className = `${prefixName}-grid--item`;
6
- export default defineComponent({
7
- name: "DGridItem",
8
- setup(props, { slots }) {
9
- return () => (
10
- <>
11
- <div class={className}>{slots.default && slots.default()}</div>
12
- </>
13
- );
14
- }
15
- });
package/src/grid/index.md DELETED
@@ -1,4 +0,0 @@
1
- # Gird
2
-
3
-
4
- # GridItem
package/src/grid/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import type { App, Plugin } from "vue";
2
- import Grid from "./Grid";
3
- import GridItem from "./GridItem";
4
-
5
- Grid.install = function (app: App) {
6
- app.component(Grid.name, Grid);
7
- app.component(GridItem.name, GridItem);
8
- return app;
9
- };
10
-
11
- export { GridItem };
12
-
13
- export default Grid as typeof Grid &
14
- Plugin & {
15
- readonly Grid: typeof GridItem;
16
- };
@@ -1,70 +0,0 @@
1
- @import "../../theme/variable.scss";
2
-
3
- /*输入框获取焦点时候的影响边框*/
4
- @mixin input-focus {
5
- &:focus {
6
- box-shadow: 0 0 0 $grid-input-border-width $grid-input-focus-border-color;
7
- }
8
- }
9
- .#{$prefix-name}-grid {
10
- position: relative;
11
- display: grid;
12
-
13
- .#{$prefix-name}-grid--item {
14
- border: $gird-border-width solid $grid-border-color;
15
- margin-left: -$gird-border-width;
16
- margin-top: -$gird-border-width;
17
- }
18
- }
19
-
20
- // 网格表单样式
21
- .#{$prefix-name}-grid-form {
22
- .ant-form-item {
23
- margin-bottom: 0;
24
- height: 100%;
25
- .ant-form-item-label {
26
- border-right: $gird-border-width solid $grid-border-color;
27
- }
28
- .ant-input,
29
- .ant-select-selector,
30
- .ant-input-number {
31
- border: 0;
32
- border-radius: 0;
33
- @include input-focus;
34
- // 数字输入框要单独处理
35
- .ant-input-number-input {
36
- border: 0;
37
- border-radius: 0;
38
- @include input-focus;
39
- }
40
- }
41
- .ant-input[disabled] {
42
- color: #525252;
43
- }
44
- }
45
- .ant-form-item-has-error {
46
- .ant-input {
47
- &::placeholder {
48
- //color: red;
49
- }
50
- }
51
- .ant-form-item-explain {
52
- display: $gird-error-display;
53
- }
54
- }
55
- .ant-select-focused:not(.ant-select-disabled).ant-select:not(
56
- .ant-select-customize-input
57
- )
58
- .ant-select-selector {
59
- box-shadow: 0 0 0 $grid-input-border-width $grid-input-focus-border-color;
60
- }
61
- .ant-form-item-has-error
62
- :not(.ant-input-disabled):not(.ant-input-borderless).ant-input:focus {
63
- box-shadow: 0 0 0px $grid-input-border-width red;
64
- border-radius: 0;
65
- }
66
- .ant-form-item-has-error
67
- :not(.ant-input-disabled):not(.ant-input-borderless).ant-input {
68
- box-shadow: 0 0 0px $grid-input-border-width $grid-input-error-border-color;
69
- }
70
- }
package/src/index.scss DELETED
@@ -1,19 +0,0 @@
1
- @import "./theme/variable";
2
- @import "./grid/style";
3
- @import "./menu/style";
4
- @import "./layout/style";
5
- @import "./table/style";
6
- @import "./desensitize/style";
7
- @import "./modal/style";
8
- html,
9
- body,
10
- #app {
11
- height: 100%;
12
- background: $bg-color;
13
- &::-webkit-scrollbar {
14
- width: 0 !important;
15
- display: none;
16
- }
17
- }
18
-
19
-
package/src/index.ts DELETED
@@ -1,50 +0,0 @@
1
- import type { App } from "vue";
2
- import { createPinia } from "pinia";
3
- import { createPersistedState } from "pinia-plugin-persistedstate";
4
-
5
- import * as components from "./components";
6
- export * from "./components";
7
-
8
-
9
- export interface MenuIcon {
10
- componentName: string | "nativeHtml";
11
- type: string;
12
- }
13
- export interface Options {
14
- menuIcon: MenuIcon;
15
- prop?: string;
16
- }
17
- const c: any = components;
18
- export const install = function (app: App, opts: Options) {
19
- Object.keys(c).forEach((key) => {
20
- const component = c[key];
21
- if (component.install) {
22
- app.use(component);
23
- }
24
- });
25
- //注册pinia
26
- const pinia = createPinia();
27
- //pinia启用持久化
28
- pinia.use(
29
- createPersistedState({
30
- storage: sessionStorage
31
- })
32
- );
33
- app.use(pinia);
34
- app.provide("menuIcon", opts.menuIcon || {});
35
-
36
- // // 创建 Web Worker 连接池实例
37
- // const workerPool = new WorkerPool(DicWorker, 2); // 这里设置连接池的大小为 5
38
- // workerPool.initialize();
39
- // // 注入连接池实例
40
- // app.provide("dicWorkerPool", workerPool);
41
- // // 创建 Web Worker 连接池实例
42
- // const repWorkerPool = new WorkerPool(ReplaceWorker, 2); // 这里设置连接池的大小为 5
43
- // repWorkerPool.initialize();
44
- // // 注入连接池实例
45
- // app.provide("repWorkerPool", repWorkerPool);
46
- };
47
-
48
- export default {
49
- install
50
- };
@@ -1,101 +0,0 @@
1
- import {
2
- defineComponent,
3
- h,
4
- resolveComponent,
5
- Component,
6
- computed,
7
- ref
8
- } from "vue";
9
-
10
- // 表单元素 tag
11
- const FORM_TAG = ["a-input", "a-radio", "checkbox", "radio", "textarea"];
12
-
13
- export default defineComponent({
14
- name: "DJsonSchemeRender",
15
- props: {
16
- layout: {
17
- type: [Array, Object] as unknown as () => any[] | Record<string, any>,
18
- default: () => []
19
- },
20
- value: {
21
- type: Object as () => Record<string, unknown>,
22
- default: () => ({})
23
- }
24
- },
25
- setup(props, {}) {
26
- const modelValue = ref<Record<string, unknown>>(props.value);
27
- const { renderLayout } = useRender();
28
- // 通过computed计算出渲染的内容
29
- const render = computed(() => {
30
- const layout = props.layout;
31
- return renderLayout(layout);
32
- });
33
-
34
- /**
35
- * 渲染组件
36
- */
37
- function useRender() {
38
- /**
39
- * 渲染布局
40
- */
41
- const renderLayout = (
42
- layout: any[] | Record<string, any> | undefined
43
- ) => {
44
- return _renderComponent(layout);
45
- };
46
-
47
- /**
48
- * 渲染组件
49
- * @param layout
50
- */
51
- function _renderComponent(layout: any): any {
52
- if (Array.isArray(layout)) {
53
- return layout.map(_renderComponent);
54
- } else {
55
- const { type, props, body } = layout;
56
- // 子组件
57
- let children: any = null;
58
- if (Array.isArray(body)) {
59
- // 为数组时,遍历渲染
60
- children = body.map(_renderComponent);
61
- } else {
62
- // 为对象时,渲染
63
- children = body && _renderComponent(body);
64
- }
65
- let componentProps = { ...props };
66
- if (FORM_TAG.includes(type)) {
67
- componentProps = {
68
- ...componentProps,
69
- ...{
70
- //disabled: props?.disabled || false,
71
- value: modelValue.value[props.name],
72
- "onUpdate:value": (v: any) => {
73
- modelValue.value[props.name] = v;
74
- }
75
- }
76
- };
77
- }
78
- if (type === "a-form") {
79
- componentProps = {
80
- ...componentProps,
81
- ...{
82
- // model: model.value
83
- }
84
- };
85
- }
86
- const component =
87
- typeof type === "string" ? resolveComponent(type as string) : type;
88
-
89
- return h(component as Component, componentProps, {
90
- default: () => children
91
- });
92
- }
93
- }
94
- return {
95
- renderLayout
96
- };
97
- }
98
-
99
- return () => <>{render.value}</>;
100
- }
101
- });
@@ -1,9 +0,0 @@
1
- import type { App } from "vue";
2
- import JsonSchemeRender from "./JsonSchemeRender";
3
-
4
- JsonSchemeRender.install = (app: App) => {
5
- app.component(JsonSchemeRender.name, JsonSchemeRender);
6
- return app;
7
- };
8
-
9
- export default JsonSchemeRender;
@@ -1,39 +0,0 @@
1
- <script setup lang="ts">
2
- /**
3
- * 面包屑
4
- * @author 余老
5
- */
6
- import { computed } from "vue";
7
- import { useBreadcrumbStore } from "@ditari/store";
8
- import { prefixName } from "../theme";
9
-
10
- const store = useBreadcrumbStore();
11
- const breadCrumbs = computed(() => store.getBreadcrumb);
12
- //class名称
13
- const baseClassName = `${prefixName}-breadcrumb`;
14
- </script>
15
- <template>
16
- <div :class="baseClassName">
17
- <div class="breadcrumb">
18
- <transition-group name="breadcrumb">
19
- <div
20
- v-for="(item, index) in breadCrumbs"
21
- :key="item.path"
22
- class="breadcrumb-item"
23
- >
24
- <router-link
25
- v-if="index + 1 !== breadCrumbs.length"
26
- class="breadcrumb-link"
27
- :to="{ path: item.path }"
28
- >
29
- {{ item.title }}
30
- </router-link>
31
- <span v-else class="breadcrumb-link">
32
- {{ item.title }}
33
- </span>
34
- </div>
35
- </transition-group>
36
- </div>
37
- </div>
38
- </template>
39
- <style lang="scss"></style>