@ditari/bsui 1.0.0 → 1.0.2

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 (158) hide show
  1. package/dist/cjs/components/components.cjs.js +1 -1
  2. package/dist/cjs/components/components.d.ts +2 -1
  3. package/dist/cjs/components/form/grid-form/GridForm.cjs.js +1 -0
  4. package/dist/cjs/components/form/grid-form/GridForm.d.ts +2 -0
  5. package/dist/cjs/components/form/index.cjs.js +1 -1
  6. package/dist/cjs/components/form/index.d.ts +8 -1
  7. package/dist/cjs/components/grid/Grid.cjs.js +1 -0
  8. package/dist/cjs/components/grid/Grid.d.ts +23 -0
  9. package/dist/cjs/components/grid/GridItem.cjs.js +1 -0
  10. package/dist/cjs/components/grid/GridItem.d.ts +2 -0
  11. package/dist/cjs/components/grid/index.cjs.js +1 -0
  12. package/dist/cjs/components/grid/index.d.ts +23 -0
  13. package/dist/cjs/components/index.cjs.js +1 -1
  14. package/dist/cjs/components/layout/Breadcrumb.vue.cjs.js +1 -1
  15. package/dist/cjs/components/layout/List.vue.cjs.js +1 -1
  16. package/dist/cjs/components/layout/Main.vue.cjs.js +1 -1
  17. package/dist/cjs/components/layout/Menu.cjs.js +1 -1
  18. package/dist/cjs/components/layout/NavTabs.vue.cjs.js +1 -1
  19. package/dist/cjs/components/layout/Show.vue.cjs.js +1 -1
  20. package/dist/cjs/components/layout/Show.vue.d.ts +11 -0
  21. package/dist/cjs/components/layout/index.d.ts +11 -25
  22. package/dist/cjs/components/table/Table.vue.cjs.js +1 -1
  23. package/dist/cjs/components/table/Table.vue.d.ts +1 -1
  24. package/dist/cjs/components/table/index.d.ts +1 -1
  25. package/dist/cjs/components/theme/index.cjs.js +1 -0
  26. package/dist/cjs/components/theme/index.d.ts +1 -0
  27. package/dist/cjs/hooks/http/index.cjs.js +1 -0
  28. package/dist/cjs/hooks/http/index.d.ts +29 -0
  29. package/dist/cjs/hooks/index.cjs.js +1 -0
  30. package/dist/cjs/hooks/index.d.ts +2 -0
  31. package/dist/cjs/hooks/route/index.cjs.js +1 -0
  32. package/dist/cjs/hooks/route/index.d.ts +9 -0
  33. package/dist/cjs/store/index.cjs.js +1 -0
  34. package/dist/cjs/store/index.d.ts +7 -7
  35. package/dist/cjs/store/modules/Breadcrumb.cjs.js +1 -1
  36. package/dist/cjs/store/modules/Breadcrumb.d.ts +6 -16
  37. package/dist/cjs/store/modules/DataDictionary.cjs.js +1 -1
  38. package/dist/cjs/store/modules/DataDictionary.d.ts +28 -3
  39. package/dist/cjs/store/modules/KeepAlive.cjs.js +1 -1
  40. package/dist/cjs/store/modules/KeepAlive.d.ts +3 -4
  41. package/dist/cjs/store/modules/Menu.cjs.js +1 -1
  42. package/dist/cjs/store/modules/Menu.d.ts +1 -2
  43. package/dist/cjs/store/modules/NavTab.cjs.js +1 -1
  44. package/dist/cjs/store/modules/NavTab.d.ts +3 -4
  45. package/dist/cjs/store/modules/Settings.cjs.js +1 -1
  46. package/dist/cjs/store/modules/Settings.d.ts +23 -9
  47. package/dist/cjs/store/modules/User.cjs.js +1 -1
  48. package/dist/cjs/store/modules/User.d.ts +1 -2
  49. package/dist/cjs/store/types.cjs.js +1 -1
  50. package/dist/cjs/utils/get.cjs.js +1 -0
  51. package/dist/css/grid/style/index.css +1 -0
  52. package/dist/css/index.css +1 -0
  53. package/dist/css/menu/style/index.css +1 -0
  54. package/dist/esm/components/components.d.ts +2 -1
  55. package/dist/esm/components/components.esm.js +10 -7
  56. package/dist/esm/components/form/grid-form/GridForm.d.ts +2 -0
  57. package/dist/esm/components/form/grid-form/GridForm.esm.js +9 -0
  58. package/dist/esm/components/form/index.d.ts +8 -1
  59. package/dist/esm/components/form/index.esm.js +5 -3
  60. package/dist/esm/components/grid/Grid.d.ts +23 -0
  61. package/dist/esm/components/grid/Grid.esm.js +55 -0
  62. package/dist/esm/components/grid/GridItem.d.ts +2 -0
  63. package/dist/esm/components/grid/GridItem.esm.js +15 -0
  64. package/dist/esm/components/grid/index.d.ts +23 -0
  65. package/dist/esm/components/grid/index.esm.js +8 -0
  66. package/dist/esm/components/index.esm.js +16 -13
  67. package/dist/esm/components/layout/Breadcrumb.vue.esm.js +13 -19
  68. package/dist/esm/components/layout/List.vue.esm.js +29 -35
  69. package/dist/esm/components/layout/Main.vue.esm.js +53 -50
  70. package/dist/esm/components/layout/Menu.esm.js +45 -19
  71. package/dist/esm/components/layout/NavTabs.vue.esm.js +27 -27
  72. package/dist/esm/components/layout/Show.vue.d.ts +11 -0
  73. package/dist/esm/components/layout/Show.vue.esm.js +70 -48
  74. package/dist/esm/components/layout/index.d.ts +11 -25
  75. package/dist/esm/components/table/Table.vue.d.ts +1 -1
  76. package/dist/esm/components/table/Table.vue.esm.js +2 -2
  77. package/dist/esm/components/table/index.d.ts +1 -1
  78. package/dist/esm/components/theme/index.d.ts +1 -0
  79. package/dist/esm/components/theme/index.esm.js +4 -0
  80. package/dist/esm/hooks/http/index.d.ts +29 -0
  81. package/dist/esm/hooks/http/index.esm.js +52 -0
  82. package/dist/esm/hooks/index.d.ts +2 -0
  83. package/dist/esm/hooks/index.esm.js +6 -0
  84. package/dist/esm/hooks/route/index.d.ts +9 -0
  85. package/dist/esm/hooks/route/index.esm.js +42 -0
  86. package/dist/esm/store/index.d.ts +7 -7
  87. package/dist/esm/store/index.esm.js +16 -0
  88. package/dist/esm/store/modules/Breadcrumb.d.ts +6 -16
  89. package/dist/esm/store/modules/Breadcrumb.esm.js +4 -12
  90. package/dist/esm/store/modules/DataDictionary.d.ts +28 -3
  91. package/dist/esm/store/modules/DataDictionary.esm.js +30 -6
  92. package/dist/esm/store/modules/KeepAlive.d.ts +3 -4
  93. package/dist/esm/store/modules/KeepAlive.esm.js +4 -4
  94. package/dist/esm/store/modules/Menu.d.ts +1 -2
  95. package/dist/esm/store/modules/Menu.esm.js +1 -1
  96. package/dist/esm/store/modules/NavTab.d.ts +3 -4
  97. package/dist/esm/store/modules/NavTab.esm.js +2 -2
  98. package/dist/esm/store/modules/Settings.d.ts +23 -9
  99. package/dist/esm/store/modules/Settings.esm.js +81 -6
  100. package/dist/esm/store/modules/User.d.ts +1 -2
  101. package/dist/esm/store/modules/User.esm.js +4 -1
  102. package/dist/esm/store/types.esm.js +4 -4
  103. package/dist/esm/style.css +1 -274
  104. package/dist/esm/utils/get.esm.js +11 -0
  105. package/dist/style/grid/style/index.scss +61 -0
  106. package/dist/style/index.scss +15 -0
  107. package/dist/style/menu/style/index.scss +18 -0
  108. package/dist/style/theme/theme.scss +1 -0
  109. package/dist/style/theme/variable.scss +21 -0
  110. package/package.json +10 -7
  111. package/src/components/components.ts +4 -0
  112. package/src/components/config/Config.vue +8 -0
  113. package/src/components/form/Form.vue +10 -0
  114. package/src/components/form/grid-form/GridForm.jsx +10 -0
  115. package/src/components/form/index.ts +8 -0
  116. package/src/components/form/style/index.less +0 -0
  117. package/src/components/grid/Grid.tsx +73 -0
  118. package/src/components/grid/GridItem.tsx +15 -0
  119. package/src/components/grid/index.md +4 -0
  120. package/src/components/grid/index.ts +7 -0
  121. package/src/components/grid/style/index.scss +61 -0
  122. package/src/components/index.scss +15 -0
  123. package/src/components/index.ts +31 -0
  124. package/src/components/layout/Breadcrumb.vue +119 -0
  125. package/src/components/layout/Header.vue +0 -0
  126. package/src/components/layout/Layout.jsx +24 -0
  127. package/src/components/layout/List.vue +159 -0
  128. package/src/components/layout/Main.vue +187 -0
  129. package/src/components/layout/Menu.jsx +96 -0
  130. package/src/components/layout/NavTabs.vue +192 -0
  131. package/src/components/layout/Show.vue +157 -0
  132. package/src/components/layout/index.ts +19 -0
  133. package/src/components/menu/Menu.jsx +94 -0
  134. package/src/components/menu/style/index.scss +18 -0
  135. package/src/components/select/Select.vue +85 -0
  136. package/src/components/table/Field.vue +49 -0
  137. package/src/components/table/Table.vue +391 -0
  138. package/src/components/table/index.md +1 -0
  139. package/src/components/table/index.ts +5 -0
  140. package/src/components/theme/index.ts +1 -0
  141. package/src/components/theme/theme.scss +1 -0
  142. package/src/components/theme/variable.scss +21 -0
  143. package/src/hooks/http/index.ts +107 -0
  144. package/src/hooks/index.ts +2 -0
  145. package/src/hooks/route/index.ts +84 -0
  146. package/src/store/index.ts +7 -0
  147. package/src/store/modules/Breadcrumb.ts +25 -0
  148. package/src/store/modules/DataDictionary.ts +49 -0
  149. package/src/store/modules/KeepAlive.ts +47 -0
  150. package/src/store/modules/Menu.ts +24 -0
  151. package/src/store/modules/NavTab.ts +81 -0
  152. package/src/store/modules/Settings.ts +120 -0
  153. package/src/store/modules/User.ts +23 -0
  154. package/src/store/types.ts +15 -0
  155. package/src/tsconfig.json +16 -0
  156. package/src/utils/get.ts +15 -0
  157. package/src/utils/index.ts +2 -0
  158. package/src/utils/install.ts +12 -0
@@ -0,0 +1,47 @@
1
+ /**
2
+ * 缓存组件name数据
3
+ */
4
+ import { defineStore } from "pinia";
5
+ import { RouteLocationNormalized } from "vue-router";
6
+
7
+ import { KEEP_ALIVE_ID } from "../types";
8
+
9
+ export const useKeepAliveStore = defineStore(KEEP_ALIVE_ID, {
10
+ state: () => {
11
+ return {
12
+ list: [] as string[]
13
+ };
14
+ },
15
+ getters: {
16
+ get: (state): string[] => {
17
+ return state.list;
18
+ }
19
+ },
20
+ actions: {
21
+ /**
22
+ * 删除已经缓存的组件
23
+ * @param name 组件名称(必须唯一)
24
+ */
25
+ deleteKeepAlive(name: string) {
26
+ this.list.splice(
27
+ this.list.findIndex((key: string) => key === name),
28
+ 1
29
+ );
30
+ },
31
+ /**
32
+ * 保存要缓存的组件名称
33
+ * @param route
34
+ */
35
+ save(route: RouteLocationNormalized) {
36
+ const name = <string>route.name;
37
+ if (!name) {
38
+ return;
39
+ }
40
+ const flag = this.list.some((key: string) => key === name);
41
+ if (!flag) {
42
+ this.list.push(name);
43
+ }
44
+ }
45
+ },
46
+ persist: true
47
+ });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 菜单数据
3
+ */
4
+ import { defineStore } from "pinia";
5
+ import { MENU_ID } from "../types";
6
+
7
+ export const useMenuStore = defineStore(MENU_ID, {
8
+ state: () => {
9
+ return {
10
+ list: []
11
+ };
12
+ },
13
+ getters: {
14
+ getMenu: (state) => {
15
+ return state.list;
16
+ }
17
+ },
18
+ actions: {
19
+ save(data: any) {
20
+ this.list = data;
21
+ }
22
+ },
23
+ persist: true
24
+ });
@@ -0,0 +1,81 @@
1
+ /**
2
+ * 多标签数据
3
+ */
4
+ import { defineStore } from "pinia";
5
+ import {
6
+ LocationQuery,
7
+ RouteLocationNormalized,
8
+ RouteMeta,
9
+ RouteParams
10
+ } from "vue-router";
11
+
12
+ import { NAV_TAB_ID } from "../types";
13
+
14
+ export interface INavTab {
15
+ path: string;
16
+ fullPath: string;
17
+ query: LocationQuery;
18
+ params: RouteParams;
19
+ meta: RouteMeta | any;
20
+ name: string;
21
+ }
22
+
23
+ export const useNavTabsStore = defineStore(NAV_TAB_ID, {
24
+ state: () => {
25
+ return {
26
+ // 多标签列表
27
+ list: [] as INavTab[],
28
+ // 当前激活的地址
29
+ activeKey: "" as string
30
+ };
31
+ },
32
+ getters: {
33
+ getList: (state): INavTab[] => {
34
+ return state.list;
35
+ },
36
+ getActiveKey: (state): string => {
37
+ return state.activeKey;
38
+ }
39
+ },
40
+ actions: {
41
+ /**
42
+ * 设置激活的标签
43
+ * @param key
44
+ */
45
+ setActiveKey(key: string) {
46
+ this.activeKey = key;
47
+ },
48
+ /**
49
+ * 保存标签信息
50
+ * @param route
51
+ */
52
+ save(route: RouteLocationNormalized) {
53
+ const flag = this.list.some(
54
+ (item: INavTab) => item.fullPath === route.fullPath
55
+ );
56
+ if (flag) {
57
+ return;
58
+ }
59
+ const data: INavTab = {
60
+ path: route.path,
61
+ fullPath: route.fullPath,
62
+ query: route.query,
63
+ params: route.params,
64
+ meta: route.meta,
65
+ name: <string>route.name || ""
66
+ };
67
+ this.list.push(data);
68
+ },
69
+ /**
70
+ * 删除标签
71
+ * @param key url路径
72
+ */
73
+ deleteTabs(key: string) {
74
+ this.list.splice(
75
+ this.list.findIndex((v) => v.fullPath === key),
76
+ 1
77
+ );
78
+ }
79
+ },
80
+ persist: true
81
+ });
@@ -0,0 +1,120 @@
1
+ import { defineStore } from "pinia";
2
+ import { useMediaQuery } from "@vueuse/core";
3
+ import { SETTINGS_ID } from "../types";
4
+
5
+ const mediaMap = [
6
+ {
7
+ key: "700",
8
+ value: "(max-width: 700px)",
9
+ description: "小于700设备"
10
+ },
11
+ {
12
+ key: "700-960",
13
+ value: "(min-width:700px) and (max-width: 960px)",
14
+ description: "大于700小于960设备"
15
+ },
16
+ {
17
+ key: "960-1200",
18
+ value: "(min-width:960px) and (max-width: 1200px)",
19
+ description: "大于960小于1024设备"
20
+ },
21
+ {
22
+ key: "1200-1680",
23
+ value: "(min-width:1200px) and (max-width: 1680px)",
24
+ description: " 大于1200小于1680设备"
25
+ },
26
+ {
27
+ key: "1680",
28
+ value: "(min-width:1680px)",
29
+ description: " 大于1680设备"
30
+ }
31
+ ];
32
+
33
+ const gridConfig = [
34
+ {
35
+ key: "700",
36
+ value: "repeat(1, 100%)",
37
+ col: 1,
38
+ description: "显示一列占100%"
39
+ },
40
+ {
41
+ key: "700-960",
42
+ value: "repeat(2, 50%)",
43
+ col: 2,
44
+ description: "显示两列每列占50%宽"
45
+ },
46
+ {
47
+ key: "960-1200",
48
+ value: "repeat(3, 33.33%)",
49
+ col: 3,
50
+ description: "显示三列每列占33.33%宽"
51
+ },
52
+ {
53
+ key: "1200-1680",
54
+ value: "repeat(4, 25%)",
55
+ col: 4,
56
+ description: "显示4列每列占25%宽"
57
+ },
58
+ {
59
+ key: "1680",
60
+ value: "repeat(5, 20%)",
61
+ col: 5,
62
+ description: " 显示5列每列占20%宽"
63
+ }
64
+ ];
65
+
66
+ export interface State {
67
+ refresh: boolean;
68
+ collapsed: boolean;
69
+ mediaRuleMap: any;
70
+ gridConfig: any;
71
+ gridValue: any;
72
+ }
73
+
74
+ export const useSettingsStore = defineStore(SETTINGS_ID, {
75
+ state: (): State => ({
76
+ // 刷新状态
77
+ refresh: false as boolean,
78
+ // 菜单收缩
79
+ collapsed: false as boolean,
80
+ // 屏幕设备匹配规则
81
+ mediaRuleMap: mediaMap,
82
+ // 网格配置 根据匹配匹配规则
83
+ gridConfig: gridConfig,
84
+ gridValue: {} as any
85
+ }),
86
+ getters: {
87
+ getRefresh: (state) => state.refresh,
88
+ getCollapsed: (state) => state.collapsed,
89
+ getGrid: (state) => {
90
+ return state.gridValue;
91
+ }
92
+ },
93
+ actions: {
94
+ /**
95
+ * 切换刷新
96
+ */
97
+ switchRefreshStatus() {
98
+ this.refresh = !this.refresh;
99
+ },
100
+ /**
101
+ * 切换菜单收缩状态
102
+ */
103
+ switchCollapsed() {
104
+ this.collapsed = !this.collapsed;
105
+ },
106
+ /**
107
+ * 网格匹配
108
+ */
109
+ gridMatching() {
110
+ const mediaResult = this.mediaRuleMap.filter(
111
+ (item: any) => useMediaQuery(item.value).value
112
+ )[0];
113
+ const gridRs = this.gridConfig.filter(
114
+ (item: any) => item.key === mediaResult.key
115
+ )[0];
116
+ this.gridValue = gridRs;
117
+ }
118
+ },
119
+ persist: true
120
+ });
@@ -0,0 +1,23 @@
1
+ import { defineStore } from "pinia";
2
+ import { USER_ID } from "../types";
3
+
4
+ export const useUserStore = defineStore(USER_ID, {
5
+ state: () => {
6
+ return {
7
+ // token
8
+ token: undefined
9
+ };
10
+ },
11
+ getters: {
12
+ getToken: (state) => state.token
13
+ },
14
+ actions: {
15
+ /**
16
+ * 保存token
17
+ * @param token
18
+ */
19
+ saveToken(token: any) {
20
+ this.token = token;
21
+ }
22
+ }
23
+ });
@@ -0,0 +1,15 @@
1
+ const id_prefix = "DITARI_STORE_";
2
+ //面包屑
3
+ export const BREADCRUMB_ID = `${id_prefix}BREADCRUMB_ID`;
4
+ //字典ID
5
+ export const DATA_DICTIONARY_ID = `${id_prefix}DATA_DICTIONARY_ID`;
6
+ //缓存组件ID
7
+ export const KEEP_ALIVE_ID = `${id_prefix}KEEP_ALIVE_ID`;
8
+ //菜单ID
9
+ export const MENU_ID = `${id_prefix}MENU_ID`;
10
+ //多标签ID
11
+ export const NAV_TAB_ID = `${id_prefix}NAV_TABS_ID`;
12
+ //用户信息ID
13
+ export const SETTINGS_ID = `${id_prefix}SETTINGS_ID`;
14
+ //用户信息ID
15
+ export const USER_ID = `${id_prefix}USER_ID`;
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "..",
4
+ "jsx": "preserve",
5
+ "strict": true,
6
+ "target": "ES2015",
7
+ "module": "ESNext",
8
+ "skipLibCheck": true,
9
+ "esModuleInterop": true,
10
+ "moduleResolution": "Node",
11
+ "allowJs": true,
12
+ "lib": ["esnext", "dom"],
13
+ "types": ["pinia-plugin-persistedstate"],
14
+ "paths": {}
15
+ }
16
+ }
@@ -0,0 +1,15 @@
1
+ export const get = (
2
+ source: Record<string, any>,
3
+ path: string,
4
+ defaultValue: any = undefined
5
+ ) => {
6
+ const paths = path.replace(/\[(\d+)\]/g, ".$1").split(".");
7
+ let result = source;
8
+ for (const p of paths) {
9
+ result = Object(result)[p];
10
+ if (result === undefined) {
11
+ return defaultValue;
12
+ }
13
+ }
14
+ return result;
15
+ };
@@ -0,0 +1,2 @@
1
+ export { default as withInstall } from "./install";
2
+ export { get } from "./get";
@@ -0,0 +1,12 @@
1
+ import type { App, Plugin } from "vue";
2
+ export type SFCWithInstall<T> = T & Plugin;
3
+ export default <T>(comp: T) => {
4
+ (comp as SFCWithInstall<T>).install = (app: App) => {
5
+ // 当组件是 script setup 的形式时,会自动以为文件名注册,会挂载到组件的__name 属性上
6
+ // 所以要加上这个条件
7
+ const name = (comp as any).name || (comp as any).__name;
8
+ //注册组件
9
+ app.component(name, comp as SFCWithInstall<T>);
10
+ };
11
+ return comp as SFCWithInstall<T>;
12
+ };