fit2cloud-ui-plus 0.0.1-beta.7 → 1.0.0-beta.1

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 (231) hide show
  1. package/README.md +61 -9
  2. package/lib/fit2cloud-ui-plus.es.js +1428 -867
  3. package/lib/fit2cloud-ui-plus.umd.js +1 -1
  4. package/package.json +11 -6
  5. package/src/components/filter-bar/FuFilter.vue +36 -22
  6. package/src/components/filter-bar/FuFilterBar.vue +31 -17
  7. package/src/components/filter-bar/FuFilterInput.vue +48 -0
  8. package/src/components/filter-bar/filter-components/FuFilterDate.vue +13 -5
  9. package/src/components/filter-bar/filter-components/FuFilterDateTime.vue +17 -14
  10. package/src/components/filter-bar/filter-components/FuFilterSelect.vue +19 -13
  11. package/src/components/filter-bar/index.ts +11 -12
  12. package/src/components/icon-button/FuIconButton.vue +54 -0
  13. package/src/components/icon-button/index.ts +9 -0
  14. package/src/components/read-write-switch/FuSelectRwSwitch.vue +23 -10
  15. package/src/components/search-bar/FuComplexSearch.vue +60 -64
  16. package/src/components/search-bar/FuQuickSearch.vue +39 -18
  17. package/src/components/search-bar/FuSearchBar.vue +85 -97
  18. package/src/components/search-bar/FuSearchBarButton.vue +16 -7
  19. package/src/components/search-bar/FuSearchContions.vue +24 -8
  20. package/src/components/search-bar/complex-components/FuComplexDate.vue +70 -0
  21. package/src/components/search-bar/complex-components/FuComplexDateTime.vue +74 -0
  22. package/src/components/search-bar/complex-components/FuComplexInput.vue +57 -0
  23. package/src/components/search-bar/complex-components/FuComplexSelect.vue +93 -0
  24. package/src/components/search-bar/index.ts +17 -10
  25. package/src/components/search-bar/types.ts +23 -0
  26. package/src/components/speed-dial/FuSpeedDial.vue +78 -69
  27. package/src/components/speed-dial/FuSpeedDialActionButton.vue +55 -55
  28. package/src/components/speed-dial/FuSpeedDialButton.vue +14 -11
  29. package/src/components/speed-dial/FuSpeedDialItem.vue +9 -15
  30. package/src/components/speed-dial/types.ts +12 -0
  31. package/src/components/split-pane/FuSplitPane.vue +2 -2
  32. package/src/components/table/FuTable.vue +18 -27
  33. package/src/components/table/FuTableBody.ts +17 -19
  34. package/src/components/table/{table-column-dropdown/FuTableColumnDropdown.vue → FuTableColumnDropdown.vue} +0 -0
  35. package/src/components/table/index.ts +11 -7
  36. package/src/components/table/table-column-select/FuTableColumnSelectDialog.vue +3 -9
  37. package/src/components/table/table-column-select/FuTableColumnSelectPopover.vue +4 -3
  38. package/src/components/table/table-operations/FuTableButton.vue +1 -4
  39. package/src/components/table/table-operations/FuTableMoreButton.vue +1 -1
  40. package/src/components/table/table-operations/FuTableOperations.vue +1 -2
  41. package/src/components/table/types.ts +3 -0
  42. package/src/components/tabs/FuTabs.vue +4 -3
  43. package/src/hooks/index.ts +2 -1
  44. package/src/hooks/use-global-config/index.ts +25 -22
  45. package/src/hooks/use-locale/index.ts +1 -1
  46. package/src/hooks/use-size/index.ts +35 -0
  47. package/src/index.ts +5 -2
  48. package/src/styles/common/function.scss +14 -4
  49. package/src/styles/common/mixins.scss +9 -4
  50. package/src/styles/common/variables.scss +56 -17
  51. package/src/styles/components/filter-bar.scss +16 -16
  52. package/src/styles/components/icon-button.scss +66 -0
  53. package/src/styles/components/search-bar.scss +45 -90
  54. package/src/styles/components/speed-dial.scss +1 -51
  55. package/src/styles/components/split-pane.scss +1 -1
  56. package/src/styles/components/steps.scss +2 -2
  57. package/src/styles/components/table.scss +9 -13
  58. package/src/styles/index.scss +2 -1
  59. package/src/styles/themes/default.scss +91 -0
  60. package/src/tools/size.ts +6 -0
  61. package/src/tools/theme.ts +0 -12
  62. package/src/tools/vnode.ts +47 -0
  63. package/types/examples/App.vue.d.ts +2 -0
  64. package/types/examples/components/CodeExample.vue.d.ts +29 -0
  65. package/types/examples/components/DocumentTable.vue.d.ts +14 -0
  66. package/types/examples/components/Markdown.vue.d.ts +12 -0
  67. package/types/examples/layout/components/AppHeader.vue.d.ts +2 -0
  68. package/types/examples/layout/components/Sidebar.vue.d.ts +2 -0
  69. package/types/examples/layout/index.vue.d.ts +2 -0
  70. package/types/examples/main.d.ts +2 -0
  71. package/types/examples/pages/filter-bar/attributes.d.ts +63 -0
  72. package/types/examples/pages/filter-bar/demo/BaseFilterBar.vue.d.ts +2 -0
  73. package/types/examples/pages/filter-bar/demo/SetConditionsDemo.vue.d.ts +2 -0
  74. package/types/examples/pages/filter-bar/demo/SlotDemo.vue.d.ts +2 -0
  75. package/types/examples/pages/filter-bar/index.vue.d.ts +2 -0
  76. package/types/examples/pages/icon-button/attributes.d.ts +45 -0
  77. package/types/examples/pages/icon-button/demo/BaseIconButton.vue.d.ts +2 -0
  78. package/types/examples/pages/icon-button/demo/SlotDemo.vue.d.ts +2 -0
  79. package/types/examples/pages/icon-button/index.vue.d.ts +2 -0
  80. package/types/examples/pages/index.d.ts +3 -0
  81. package/types/examples/pages/read-write-switch/attributes.d.ts +63 -0
  82. package/types/examples/pages/read-write-switch/demo/BaseDemo.vue.d.ts +2 -0
  83. package/types/examples/pages/read-write-switch/demo/CustomContentDemo.vue.d.ts +2 -0
  84. package/types/examples/pages/read-write-switch/demo/InputRwSwitchDemo.vue.d.ts +2 -0
  85. package/types/examples/pages/read-write-switch/demo/ReadSwitchDemo.vue.d.ts +2 -0
  86. package/types/examples/pages/read-write-switch/demo/SelectRwSwitchDemo.vue.d.ts +2 -0
  87. package/types/examples/pages/read-write-switch/demo/TableInnerEditDemo.vue.d.ts +2 -0
  88. package/types/examples/pages/read-write-switch/demo/WriteSwitchDemo.vue.d.ts +2 -0
  89. package/types/examples/pages/read-write-switch/index.vue.d.ts +2 -0
  90. package/types/examples/pages/search/attributes.d.ts +57 -0
  91. package/types/examples/pages/search/demo/BaseSearchbar.vue.d.ts +66 -0
  92. package/types/examples/pages/search/demo/ComplexComponentsDemo.vue.d.ts +60 -0
  93. package/types/examples/pages/search/demo/ComplexSearchDemo.vue.d.ts +84 -0
  94. package/types/examples/pages/search/demo/CustomComponentsDemo.vue.d.ts +50 -0
  95. package/types/examples/pages/search/demo/EchoConditionsDemo.vue.d.ts +52 -0
  96. package/types/examples/pages/search/demo/QuickSearchDemo.vue.d.ts +18 -0
  97. package/types/examples/pages/search/demo/SearchBarButtonDemo.vue.d.ts +54 -0
  98. package/types/examples/pages/search/index.vue.d.ts +150 -0
  99. package/types/examples/pages/search-bar/attributes.d.ts +63 -0
  100. package/types/examples/pages/search-bar/demo/BaseSearchbar.vue.d.ts +31 -0
  101. package/types/examples/pages/search-bar/demo/ComplexSearchDemo.vue.d.ts +40 -0
  102. package/types/examples/pages/search-bar/demo/EchoConditionsDemo.vue.d.ts +32 -0
  103. package/types/examples/pages/search-bar/demo/QuickSearchDemo.vue.d.ts +7 -0
  104. package/types/examples/pages/search-bar/demo/SearchBarButtonDemo.vue.d.ts +32 -0
  105. package/types/examples/pages/search-bar/index.vue.d.ts +2 -0
  106. package/types/examples/pages/speed-dial/attributes.d.ts +63 -0
  107. package/types/examples/pages/speed-dial/demo/BaseSpeedDial.vue.d.ts +2 -0
  108. package/types/examples/pages/speed-dial/demo/SpeedDialCustom.vue.d.ts +2 -0
  109. package/types/examples/pages/speed-dial/demo/SpeedDialPosition.vue.d.ts +2 -0
  110. package/types/examples/pages/speed-dial/demo/SpeedDialTrigger.vue.d.ts +2 -0
  111. package/types/examples/pages/speed-dial/index.vue.d.ts +2 -0
  112. package/types/examples/pages/split-pane/attributes.d.ts +63 -0
  113. package/types/examples/pages/split-pane/demo/BaseSplit.vue.d.ts +2 -0
  114. package/types/examples/pages/split-pane/demo/CustomResizer.vue.d.ts +2 -0
  115. package/types/examples/pages/split-pane/demo/NestSplit.vue.d.ts +2 -0
  116. package/types/examples/pages/split-pane/demo/ResizerType.vue.d.ts +2 -0
  117. package/types/examples/pages/split-pane/index.vue.d.ts +2 -0
  118. package/types/examples/pages/table/attributes.d.ts +121 -0
  119. package/types/examples/pages/table/demo/BaseTable.vue.d.ts +2 -0
  120. package/types/examples/pages/table/demo/DropdownColumn.vue.d.ts +2 -0
  121. package/types/examples/pages/table/demo/DropdownColumnSlot.vue.d.ts +2 -0
  122. package/types/examples/pages/table/demo/SaveSelectColumn.vue.d.ts +2 -0
  123. package/types/examples/pages/table/demo/SelectColumn.vue.d.ts +2 -0
  124. package/types/examples/pages/table/demo/TableOperations.vue.d.ts +2 -0
  125. package/types/examples/pages/table/demo/TablePagination.vue.d.ts +2 -0
  126. package/types/examples/pages/table/index.vue.d.ts +2 -0
  127. package/types/examples/pages/tabs/attributes.d.ts +63 -0
  128. package/types/examples/pages/tabs/demo/AddCloseTab.vue.d.ts +2 -0
  129. package/types/examples/pages/tabs/index.vue.d.ts +2 -0
  130. package/types/examples/router/doc-routes.d.ts +12 -0
  131. package/types/examples/router/index.d.ts +4 -0
  132. package/types/examples/router/styles-routes.d.ts +12 -0
  133. package/types/examples/style-guide/button/BaseButton.vue.d.ts +2 -0
  134. package/types/examples/style-guide/button/IconButton.vue.d.ts +2 -0
  135. package/types/examples/style-guide/button/PlainButton.vue.d.ts +2 -0
  136. package/types/examples/style-guide/button/TextButton.vue.d.ts +2 -0
  137. package/types/examples/style-guide/button/index.vue.d.ts +2 -0
  138. package/types/examples/style-guide/input/BaseInput.vue.d.ts +2 -0
  139. package/types/examples/style-guide/input/SearchInput.vue.d.ts +2 -0
  140. package/types/examples/style-guide/input/Textarea.vue.d.ts +2 -0
  141. package/types/examples/style-guide/input/index.vue.d.ts +2 -0
  142. package/types/examples/style-guide/select/BaseSelect.vue.d.ts +2 -0
  143. package/types/examples/style-guide/select/index.vue.d.ts +2 -0
  144. package/types/plugins/example-transform.d.ts +5 -0
  145. package/types/src/components/filter-bar/FuFilter.vue.d.ts +42 -0
  146. package/types/src/components/filter-bar/FuFilterBar.vue.d.ts +33 -0
  147. package/types/src/components/filter-bar/FuFilterConditions.vue.d.ts +8 -0
  148. package/types/src/components/filter-bar/FuFilterInput.vue.d.ts +17 -0
  149. package/types/src/components/filter-bar/FuSearchInput.vue.d.ts +17 -0
  150. package/types/src/components/filter-bar/filter-components/FuFilterDate.vue.d.ts +36 -0
  151. package/types/src/components/filter-bar/filter-components/FuFilterDateTime.vue.d.ts +36 -0
  152. package/types/src/components/filter-bar/filter-components/FuFilterOption.vue.d.ts +24 -0
  153. package/types/src/components/filter-bar/filter-components/FuFilterSelect.vue.d.ts +66 -0
  154. package/types/src/components/filter-bar/index.d.ts +2 -0
  155. package/types/src/components/filter-bar/types.d.ts +22 -0
  156. package/types/src/components/icon-button/FuIconButton.vue.d.ts +43 -0
  157. package/types/src/components/icon-button/index.d.ts +2 -0
  158. package/types/src/components/read-write-switch/FuInputRwSwitch.vue.d.ts +21 -0
  159. package/types/src/components/read-write-switch/FuReadWriteSwitch.vue.d.ts +23 -0
  160. package/types/src/components/read-write-switch/FuSelectRwSwitch.vue.d.ts +43 -0
  161. package/types/src/components/read-write-switch/index.d.ts +2 -0
  162. package/types/src/components/read-write-switch/types.d.ts +4 -0
  163. package/types/src/components/search-bar/FuComplexSearch.vue.d.ts +22 -0
  164. package/types/src/components/search-bar/FuQuickSearch.vue.d.ts +29 -0
  165. package/types/src/components/search-bar/FuSearchBar.vue.d.ts +58 -0
  166. package/types/src/components/search-bar/FuSearchBarButton.vue.d.ts +14 -0
  167. package/types/src/components/search-bar/FuSearchContions.vue.d.ts +26 -0
  168. package/types/src/components/search-bar/complex-components/FuComplexDate.vue.d.ts +36 -0
  169. package/types/src/components/search-bar/complex-components/FuComplexDateTime.vue.d.ts +36 -0
  170. package/types/src/components/search-bar/complex-components/FuComplexInput.vue.d.ts +26 -0
  171. package/types/src/components/search-bar/complex-components/FuComplexSelect.vue.d.ts +50 -0
  172. package/types/src/components/search-bar/complex-components/index.d.ts +0 -0
  173. package/types/src/components/search-bar/complex-components/mixins.d.ts +6 -0
  174. package/types/src/components/search-bar/index.d.ts +2 -0
  175. package/types/src/components/search-bar/types.d.ts +17 -0
  176. package/types/src/components/speed-dial/FuSpeedDial.vue.d.ts +218 -0
  177. package/types/src/components/speed-dial/FuSpeedDialActionButton.vue.d.ts +32 -0
  178. package/types/src/components/speed-dial/FuSpeedDialButton.vue.d.ts +42 -0
  179. package/types/src/components/speed-dial/FuSpeedDialItem.vue.d.ts +12 -0
  180. package/types/src/components/speed-dial/index.d.ts +2 -0
  181. package/types/src/components/speed-dial/types.d.ts +8 -0
  182. package/types/src/components/split-pane/FuSplitPane.vue.d.ts +59 -0
  183. package/types/src/components/split-pane/index.d.ts +2 -0
  184. package/types/src/components/table/FuTable.vue.d.ts +18 -0
  185. package/types/src/components/table/FuTableBody.d.ts +3 -0
  186. package/types/src/components/table/FuTableColumnDropdown.vue.d.ts +50 -0
  187. package/types/src/components/table/FuTablePagination.vue.d.ts +47 -0
  188. package/types/src/components/table/index.d.ts +2 -0
  189. package/types/src/components/table/table-column-select/FuTableColumnSelect.vue.d.ts +10 -0
  190. package/types/src/components/table/table-column-select/FuTableColumnSelectDialog.vue.d.ts +23 -0
  191. package/types/src/components/table/table-column-select/FuTableColumnSelectPopover.vue.d.ts +34 -0
  192. package/types/src/components/table/table-column-select/utils.d.ts +8 -0
  193. package/types/src/components/table/table-operations/FuTableButton.vue.d.ts +13 -0
  194. package/types/src/components/table/table-operations/FuTableMoreButton.vue.d.ts +37 -0
  195. package/types/src/components/table/table-operations/FuTableOperations.vue.d.ts +46 -0
  196. package/types/src/components/table/types.d.ts +2 -0
  197. package/types/src/components/tabs/FuTabs.vue.d.ts +54 -0
  198. package/types/src/components/tabs/index.d.ts +2 -0
  199. package/types/src/hooks/index.d.ts +3 -0
  200. package/types/src/hooks/use-global-config/index.d.ts +9 -0
  201. package/types/src/hooks/use-locale/index.d.ts +14 -0
  202. package/types/src/hooks/use-size/index.d.ts +9 -0
  203. package/types/src/index.d.ts +8 -0
  204. package/types/src/locale/index.d.ts +10 -0
  205. package/types/src/locale/lang/en.d.ts +59 -0
  206. package/types/src/locale/lang/zh-cn.d.ts +59 -0
  207. package/types/src/locale/lang/zh-tw.d.ts +59 -0
  208. package/types/src/tools/size.d.ts +4 -0
  209. package/types/src/tools/theme.d.ts +1 -0
  210. package/types/src/tools/time.d.ts +2 -0
  211. package/types/src/tools/types.d.ts +8 -0
  212. package/types/src/tools/utils.d.ts +2 -0
  213. package/types/src/tools/vnode.d.ts +9 -0
  214. package/src/components/filter-bar/FuSearchInput.vue +0 -31
  215. package/src/components/search-bar/store.ts +0 -25
  216. package/src/components/steps/FuHorizontalNavigation.vue +0 -18
  217. package/src/components/steps/FuHorizontalSteps.vue +0 -94
  218. package/src/components/steps/FuStep.vue +0 -13
  219. package/src/components/steps/FuSteps.vue +0 -22
  220. package/src/components/steps/FuStepsFooter.ts +0 -79
  221. package/src/components/steps/FuVerticalNavigation.vue +0 -35
  222. package/src/components/steps/FuVerticalSteps.vue +0 -79
  223. package/src/components/steps/Stepper.ts +0 -188
  224. package/src/components/steps/index.ts +0 -11
  225. package/src/components/table/table-column-dropdown/index.ts +0 -7
  226. package/src/components/table/table-column-select/index.ts +0 -8
  227. package/src/components/table/table-operations/index.ts +0 -12
  228. package/src/components/virtual-scroller/FuVirtualHorizontalScroll.js +0 -96
  229. package/src/components/virtual-scroller/FuVirtualScroll.js +0 -15
  230. package/src/components/virtual-scroller/FuVirtualVerticalScroll.js +0 -95
  231. package/src/components/virtual-scroller/index.js +0 -10
@@ -2,13 +2,13 @@
2
2
  <div class="fu-speed-dial-action-button">
3
3
  <div v-if="title" class="fu-speed-dial-action-button__title" :style="titleSize">
4
4
  <slot name="title">
5
- <div class="fu-speed-dial-action-button__text" :class="titleClass" :style="titleStyle" @click="click">{{
6
- title }}
5
+ <div class="fu-speed-dial-action-button__text" :class="titleClass" :style="titleStyle" @click="click">{{ title
6
+ }}
7
7
  </div>
8
8
  </slot>
9
9
  </div>
10
10
  <slot>
11
- <fu-speed-dial-button :class="buttonClass" v-bind="buttonProps" :icon="icon" @click="click"/>
11
+ <fu-speed-dial-button :class="buttonClass" v-bind="buttonProps" :icon="icon" @click="click" />
12
12
  </slot>
13
13
  </div>
14
14
  </template>
@@ -17,72 +17,72 @@
17
17
  import { inject, computed } from 'vue'
18
18
  import type { CSSProperties } from 'vue'
19
19
  import FuSpeedDialButton from "@/components/speed-dial/FuSpeedDialButton.vue";
20
+ import { SpeedDialKey } from "./types";
20
21
 
21
22
  const props = defineProps({
22
- index: Number,
23
- icon: {
24
- type: String,
25
- default: "el-icon-plus"
26
- },
27
- titleClass: String,
28
- titleBgColor: String,
29
- titleColor: String,
30
- buttonClass: String,
31
- bgColor: String,
32
- color: String,
33
- title: [String, Number]
23
+ index: Number,
24
+ icon: {
25
+ type: String,
26
+ default: "Plus"
27
+ },
28
+ titleClass: String,
29
+ titleBgColor: String,
30
+ titleColor: String,
31
+ buttonClass: String,
32
+ bgColor: String,
33
+ color: String,
34
+ title: [String, Number]
34
35
  })
35
36
 
36
37
  const emit = defineEmits(["click"])
37
- const FuSpeedDial = inject('FuSpeedDial')
38
+ const speedDialKey = inject(SpeedDialKey)
38
39
 
39
- const config =computed(()=>{
40
- return FuSpeedDial.config;
40
+ const config = computed(() => {
41
+ return speedDialKey?.config;
41
42
  })
42
43
 
43
- const direction =computed(()=>{
44
- return FuSpeedDial.direction;
45
- })
46
- const clickClose =computed(()=>{
47
- return FuSpeedDial.clickClose;
44
+ const direction = computed(() => {
45
+ return speedDialKey?.direction.value || "";
48
46
  })
47
+ // const clickClose =computed(()=>{
48
+ // return FuSpeedDial.clickClose;
49
+ // })
49
50
 
50
- const titleSize =computed(()=>{
51
- let size = config.value.fab.size + "px";
52
- let style: CSSProperties = {position: "absolute", height: size};
53
- if (["top", "bottom"].includes(direction.value)) {
54
- style['text-align'] = "right"
55
- style['right'] = size
56
- } else {
57
- style['text-align'] = "center"
58
- style['min-width'] = size
59
- if (props.index % 2 === 0) {
60
- style.top = size
61
- } else {
62
- style.top = "-" + size
63
- }
64
- }
65
- return style;
51
+ const titleSize = computed(() => {
52
+ let size = config.value?.fab.size + "px";
53
+ let style: CSSProperties = { position: "absolute", height: size };
54
+ if (["top", "bottom"].includes(direction.value)) {
55
+ style['text-align'] = "right"
56
+ style['right'] = size
57
+ } else {
58
+ style['text-align'] = "center"
59
+ style['min-width'] = size
60
+ if (props.index || 0 % 2 === 0) {
61
+ style.top = size
62
+ } else {
63
+ style.top = "-" + size
64
+ }
65
+ }
66
+ return style;
66
67
  })
67
68
 
68
- const titleStyle =computed(()=>{
69
- let backgroundColor = props.titleBgColor;
70
- let color = props.titleColor
71
- let fontSize = config.value.item.titleFontSize
72
- return {backgroundColor, color, fontSize}
69
+ const titleStyle = computed(() => {
70
+ let backgroundColor = props.titleBgColor;
71
+ let color = props.titleColor
72
+ let fontSize = config.value?.item.titleFontSize
73
+ return { backgroundColor, color, fontSize }
73
74
  })
74
75
 
75
- const buttonProps =computed(()=>{
76
- let backgroundColor = props.bgColor;
77
- let color = props.color
78
- let fontSize = config.value.item.buttonFontSize
79
- let size = config.value.item.size + "px";
80
- return {backgroundColor, color, fontSize, size}
76
+ const buttonProps = computed(() => {
77
+ let backgroundColor = props.bgColor;
78
+ let color = props.color
79
+ let fontSize = config.value?.item.buttonFontSize
80
+ let size = config.value?.item.size + "px";
81
+ return { backgroundColor, color, fontSize, size }
81
82
  })
82
-
83
83
  function click(e: Event) {
84
- const {index, title} = props
85
- emit("click", {index, title}, e);
86
- FuSpeedDial.close();
87
- }
84
+ const { index, title } = props
85
+ emit("click", { index, title }, e);
86
+ speedDialKey?.close();
87
+ }
88
88
  </script>
@@ -1,27 +1,30 @@
1
1
  <template>
2
2
  <div :class="[
3
- 'fu-speed-dial-button',
4
- 'fu-speed-dial-button--' + type,
5
- {
6
- 'fu-speed-dial-button--rotate': rotate,
7
- 'is-disabled': disabled,
8
- 'is-active': active,
9
- }, ]"
10
- :style="{
3
+ 'fu-speed-dial-button',
4
+ 'el-button',
5
+ 'el-button--' + type,
6
+ {
7
+ 'fu-speed-dial-button--rotate': rotate,
8
+ 'is-disabled': disabled,
9
+ 'is-active': active,
10
+ },]" :style="{
11
11
  width: size,
12
12
  height: size,
13
13
  backgroundColor: backgroundColor,
14
14
  color: color,
15
- fontSize: fontSize }">
15
+ fontSize: fontSize
16
+ }">
16
17
  <slot>
17
- <i :class="icon" />
18
+ <el-icon>
19
+ <component :is="icon" />
20
+ </el-icon>
18
21
  </slot>
19
22
  </div>
20
23
  </template>
21
24
 
22
25
  <script setup lang="ts">
23
26
  import { validateType } from "@/tools/theme"
24
- const props = defineProps({
27
+ defineProps({
25
28
  type: {
26
29
  type: String,
27
30
  default: "default",
@@ -9,11 +9,9 @@
9
9
  </template>
10
10
 
11
11
  <script setup lang="ts">
12
- import {
13
- inject,
14
- computed
15
- } from 'vue'
12
+ import { inject, computed } from 'vue'
16
13
  import FuSpeedDialActionButton from "@/components/speed-dial/FuSpeedDialActionButton.vue";
14
+ import { SpeedDialKey } from "./types";
17
15
  defineOptions({ name: "FuSpeedDialItem" });
18
16
  const props = defineProps({
19
17
  index: {
@@ -21,21 +19,17 @@ const props = defineProps({
21
19
  required: true
22
20
  },
23
21
  })
24
- const FuSpeedDial = inject('FuSpeedDial')
22
+ const speedDialKey = inject(SpeedDialKey)
25
23
 
26
24
  const config = computed(() => {
27
- return FuSpeedDial.config;
25
+ return speedDialKey?.config;
28
26
  })
29
27
 
30
28
  const direction = computed(() => {
31
- return FuSpeedDial.direction;
29
+ return speedDialKey?.direction.value || "";
32
30
  })
33
31
  const isActive = computed(() => {
34
- return FuSpeedDial.active;
35
- })
36
-
37
- const size = computed(() => {
38
- return FuSpeedDial.size;
32
+ return speedDialKey?.active?.value;
39
33
  })
40
34
 
41
35
  const spacing = computed(() => {
@@ -44,13 +38,13 @@ const spacing = computed(() => {
44
38
 
45
39
  const directionPosition = computed(() => {
46
40
  if (["top", "left"].includes(direction.value)) {
47
- return -config.value.fab.size - spacing.value
41
+ return -config.value?.fab?.size - spacing.value
48
42
  }
49
- return config.value.fab.size + spacing.value
43
+ return config.value?.fab?.size + spacing.value
50
44
  })
51
45
 
52
46
  const itemSize = computed(() => {
53
- let size = config.value.fab.size + "px";
47
+ let size = config.value?.fab?.size + "px";
54
48
  return {
55
49
  width: size,
56
50
  height: size,
@@ -0,0 +1,12 @@
1
+ import {InjectionKey, ComputedRef, Ref} from "vue";
2
+
3
+ export interface SpeedDialContext {
4
+ config?: any,
5
+ direction: ComputedRef<string>,
6
+ active?: Ref<boolean>,
7
+ close(): void
8
+ }
9
+
10
+
11
+ export const SpeedDialKey: InjectionKey<SpeedDialContext> = Symbol('SpeedDialKey')
12
+
@@ -51,7 +51,7 @@ const props = defineProps({
51
51
  });
52
52
  const emit = defineEmits(["changeSplit"])
53
53
 
54
- const instance = getCurrentInstance()
54
+ const instance: any = getCurrentInstance()
55
55
 
56
56
  const active = ref(false)
57
57
  const usedValue = ref(0)
@@ -133,7 +133,7 @@ const resizerAttr = computed(() => {
133
133
  : isReverse.value
134
134
  ? "bottom"
135
135
  : "top" ;
136
- })
136
+ }) as any
137
137
  const saveKey = computed(() => {
138
138
  return "Fu-SP-" + props.localKey;
139
139
  })
@@ -7,8 +7,11 @@
7
7
  </template>
8
8
 
9
9
  <script lang="ts" setup>
10
- import { onMounted, useSlots, ref, watch, computed, onUpdated, provide } from "vue";
11
- import FuTableBody from "@/components/table/FuTableBody";
10
+ import { onMounted, useSlots, ref, watch, computed, onUpdated, provide, VNodeNormalizedChildren, VNode } from "vue";
11
+ import { isFix, getLabel, FuTableBody } from "@/components/table/FuTableBody";
12
+ import { isValidElementNode, getChildren, isValidChildren } from "@/tools/vnode";
13
+ import { LocalKey } from "@/components/table/types";
14
+
12
15
  defineOptions({ name: "FuTable" });
13
16
  const props = defineProps({
14
17
  columns: Array,
@@ -20,38 +23,20 @@ const props = defineProps({
20
23
 
21
24
  });
22
25
 
23
- const slots = useSlots()
26
+ const slots = useSlots().default?.()
24
27
 
25
28
  const key = ref(0);
26
29
 
27
-
28
30
  const prefix = "FU-T-"
29
31
 
30
- const isFix = (node: any) => {
31
- const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0
32
- const { fix } = node.props
33
- let { type } = node.props
34
- return (fix !== undefined && fix !== false) || ["selection", "index", "expand"].includes(type) || includeTag
35
- }
36
-
37
- const getLabel = (node: any) => {
38
- if (node.props.label) return node.props.label
39
- const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0
40
- let { label, type } = node.props
41
- if (includeTag) label = prefix + "dropdown"
42
- label ??= node.props.label
43
- label ??= prefix + type
44
- return label;
45
- }
46
-
47
32
  const cleanColumns = (columns: any) => {
48
33
  columns.splice(0, columns.length)
49
34
  }
50
35
 
51
36
  const updateNodes = (nodes: any) => {
52
37
  nodes.forEach((node: any) => {
53
- if (!node.type.key) {
54
- node.type.key = getLabel(node)
38
+ if (isValidElementNode(node) && !(node.type as any).key) {
39
+ (node.type as any).key = getLabel(node)
55
40
  }
56
41
  })
57
42
  }
@@ -92,8 +77,16 @@ const updateColumns = (nodes: any, columns: any) => {
92
77
  const columnsKey = computed(() => {
93
78
  return prefix + props.localKey
94
79
  })
80
+
95
81
  // 去掉v-if=false的node
96
- const children = slots.default?.().filter((c: any) => c.type.name !== undefined)
82
+ let children: VNodeNormalizedChildren | VNode[]
83
+ if (slots) {
84
+ if (isValidChildren(slots)) {
85
+ children = slots
86
+ }
87
+ children = getChildren(slots)
88
+ }
89
+
97
90
  watch(() => props.columns,
98
91
  () => {
99
92
  // 设置refresh,可以避免抖动或闪烁,但是table会更新一次
@@ -134,9 +127,7 @@ onMounted(() => {
134
127
  }
135
128
  })
136
129
 
137
-
138
- provide("localKey", props.localKey)
139
-
130
+ provide(LocalKey, props.localKey)
140
131
  onUpdated(() => {
141
132
  updateNodes(children)
142
133
  updateColumns(children, props.columns)
@@ -1,9 +1,10 @@
1
- import { h } from "vue";
1
+ import {getChildren} from "@/tools/vnode";
2
+ import {isArray} from "@vue/shared";
2
3
 
3
- const isFix = (node: any) => {
4
+ export const isFix = (node: any) => {
4
5
  const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0;
5
- const { fix } = node.props;
6
- let { type } = node.props;
6
+ const {fix} = node.props;
7
+ let {type} = node.props;
7
8
  return (
8
9
  (fix !== undefined && fix !== false) ||
9
10
  ["selection", "index", "expand"].includes(type) ||
@@ -11,36 +12,33 @@ const isFix = (node: any) => {
11
12
  );
12
13
  };
13
14
 
14
- const getLabel = (node: any) => {
15
+ export const getLabel = (node: any) => {
15
16
  if (node.props.label) return node.props.label;
16
17
  const prefix = "FU-T-";
17
18
  const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0;
18
- let { label, type } = node.props;
19
+ let {label, type} = node.props;
19
20
  if (includeTag) label = prefix + "dropdown";
20
21
  label ??= node.props.label;
21
22
  label ??= prefix + type;
22
23
  return label;
23
24
  };
24
25
 
25
- const FuTableBody = (props: any, context: any) => {
26
+ export const FuTableBody = (props: any, context: any) => {
26
27
  let slots = context.slots.default();
27
28
  const nodes: any = [];
28
- let { columns } = props;
29
- if (typeof slots[0].children[0].type === "symbol") {
30
- slots = slots[0].children;
31
- }
32
- const children = slots[0].children.filter((c: any) => c.type.name !== undefined);
29
+ let {columns} = props;
30
+ let children = getChildren(slots);
33
31
  if (!children) return nodes;
34
32
  if (!columns || columns?.length === 0) return children;
35
33
  columns.forEach((col: any) => {
36
- let node = children.find((child: any) => {
37
- return col.label === getLabel(child);
38
- });
39
- if (node && (isFix(node) || col.show !== false)) {
40
- nodes.push(node);
34
+ if (isArray(children)) {
35
+ let node = children.find((child: any) => {
36
+ return col.label === getLabel(child) && child.type.name !== undefined;
37
+ });
38
+ if (node && (isFix(node) || col.show !== false)) {
39
+ nodes.push(node);
40
+ }
41
41
  }
42
42
  });
43
43
  return nodes;
44
44
  };
45
-
46
- export default FuTableBody;
@@ -1,15 +1,19 @@
1
1
  import FuTable from "./FuTable.vue"
2
- import FuTableColumnSelect from "./table-column-select"
2
+ import FuTableColumnSelect from "./table-column-select/FuTableColumnSelect.vue"
3
3
  import FuTablePagination from "./FuTablePagination.vue"
4
- import FuTableOperations from "./table-operations"
5
- import FuTableColumnDropdown from "./table-column-dropdown"
4
+ import FuTableOperations from "./table-operations/FuTableOperations.vue";
5
+ import FuTableButton from "./table-operations/FuTableButton.vue";
6
+ import FuTableMoreButton from "./table-operations/FuTableMoreButton.vue";
7
+ import FuTableColumnDropdown from "./FuTableColumnDropdown.vue"
6
8
 
7
9
  import type { App } from 'vue'
8
10
  FuTable.install = (app: App): void => {
9
11
  app.component(FuTable.name, FuTable);
10
12
  app.component(FuTablePagination.name, FuTablePagination)
11
- app.use(FuTableOperations.install)
12
- app.use(FuTableColumnSelect.install)
13
- app.use(FuTableColumnDropdown.install)
13
+ app.component(FuTableColumnSelect.name, FuTableColumnSelect);
14
+ app.component(FuTableColumnDropdown.name, FuTableColumnDropdown)
15
+ app.component(FuTableOperations.name, FuTableOperations);
16
+ app.component(FuTableButton.name, FuTableButton);
17
+ app.component(FuTableMoreButton.name, FuTableMoreButton);
14
18
  };
15
- export default FuTable;
19
+ export default FuTable;
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <div style="display: inline-block">
3
- <!-- :size="configSize" -->
4
3
  <el-button class="fu-search-bar-button" :icon="icon" @click="visible = true">{{ t('fu.table.custom_table_rows') }}
5
4
  </el-button>
6
5
  <el-dialog custom-class="fu-table-column-select-dialog" v-model="visible" @open="open" append-to-body>
@@ -34,17 +33,12 @@
34
33
  import { ref, inject } from "vue";
35
34
  import { tableColumnSelect } from "./utils"
36
35
  import { useLocale } from "@/hooks"
37
-
36
+ import { LocalKey } from "../types";
38
37
  const props = defineProps({
39
38
  icon: {
40
39
  type: String,
41
40
  default: "Setting"
42
41
  },
43
- trigger: {
44
- type: String,
45
- default: "hover",
46
- validator: (value: string) => ['click', 'hover'].includes(value)
47
- },
48
42
  columns: {
49
43
  type: Array,
50
44
  default: () => []
@@ -52,7 +46,7 @@ const props = defineProps({
52
46
 
53
47
  })
54
48
 
55
- const localKey = inject("localKey")
49
+ const localKey = inject(LocalKey, undefined)
56
50
 
57
51
  const { t } = useLocale()
58
52
 
@@ -90,7 +84,7 @@ function ok() {
90
84
  }
91
85
 
92
86
  function reset() {
93
- if (columnsKey) {
87
+ if (columnsKey.value) {
94
88
  localStorage.removeItem(columnsKey.value)
95
89
  }
96
90
  props.columns.splice(0, props.columns.length)
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <el-popover class="fu-table-column-select" popper-class="fu-table-column-select-popper" :trigger="trigger"
3
- :show-arrow="false" v-show="hasSelect">
3
+ :show-arrow="false" :style="{'visibility': hasSelect ? 'visible': 'hidden'}">
4
4
  <h3>
5
5
  {{ t('fu.table.custom_table_fields') }}
6
6
  </h3>
@@ -22,7 +22,6 @@
22
22
  <template #reference>
23
23
  <el-button class="fu-search-bar-button" :icon="icon">{{ t('fu.table.custom_table_rows') }}</el-button>
24
24
  </template>
25
- <!-- :size="configSize" -->
26
25
  </el-popover>
27
26
  </template>
28
27
 
@@ -30,6 +29,7 @@
30
29
  import { computed, inject } from "vue";
31
30
  import { tableColumnSelect } from "./utils"
32
31
  import { useLocale } from "@/hooks"
32
+ import { LocalKey } from "../types";
33
33
 
34
34
  const props = defineProps({
35
35
  icon: {
@@ -50,7 +50,8 @@ const props = defineProps({
50
50
 
51
51
  const { t } = useLocale()
52
52
 
53
- const localKey = inject("localKey")
53
+ const localKey = inject(LocalKey, undefined)
54
+
54
55
 
55
56
  const {
56
57
  columnsKey,
@@ -6,11 +6,8 @@
6
6
  </el-tooltip>
7
7
  </template>
8
8
  <script lang="ts" setup>
9
+ defineOptions({ name: "FuTableButton" });
9
10
  defineProps({
10
- size: {
11
- type: String,
12
- default: "default"
13
- },
14
11
  label: String,
15
12
  disabled: Boolean,
16
13
  icon: Boolean,
@@ -23,7 +23,7 @@ import { computed } from "vue";
23
23
  import { useLocale } from "@/hooks"
24
24
  import { PropType } from "vue";
25
25
  import { DropdownProps } from "@/tools/types";
26
-
26
+ defineOptions({ name: "FuTableMoreButton" });
27
27
  const { t } = useLocale()
28
28
  const props = defineProps({
29
29
  row: Object,
@@ -26,7 +26,6 @@ import FuTableMoreButton from "./FuTableMoreButton.vue";
26
26
 
27
27
  defineOptions({ name: "FuTableOperations" });
28
28
  const props = defineProps({
29
- // columns: Array,
30
29
  align: {
31
30
  type: String,
32
31
  default: "center"
@@ -35,7 +34,7 @@ const props = defineProps({
35
34
  minWidth: [String, Number],
36
35
  ellipsis: { // 超过几个按钮时显示省略号,如果只超过一个也不显示省略号
37
36
  type: Number,
38
- default: 3
37
+ default: 2
39
38
  },
40
39
  buttons: {
41
40
  type: Array,
@@ -0,0 +1,3 @@
1
+ import {InjectionKey} from "vue";
2
+
3
+ export const LocalKey: InjectionKey<string | undefined> = Symbol('LocalKey')
@@ -1,13 +1,12 @@
1
1
  <template>
2
2
  <el-tabs class="fu-tabs" :before-leave="beforeLeave" :editable="false" :addable="false" v-bind="$attrs">
3
- <slot></slot>
4
- <el-tab-pane name="add" key="add" v-if="addable">
3
+ <el-tab-pane name="add" key="add" v-if="addable" :lazy="true">
5
4
  <template #label>
6
5
  <slot name="add">
7
6
  <!-- 下拉方式 -->
8
7
  <el-dropdown @command="handleCommand" v-if="addType === 'dropdown'" :trigger="addTrigger">
9
8
  <slot name="dropdownButton">
10
- <el-button type="primary" plain>
9
+ <el-button type="primary" plain >
11
10
  <el-icon>
12
11
  <component :is="addIcon" />
13
12
  </el-icon>
@@ -34,6 +33,8 @@
34
33
  </slot>
35
34
  </template>
36
35
  </el-tab-pane>
36
+ <slot />
37
+
37
38
  </el-tabs>
38
39
  </template>
39
40
 
@@ -1,3 +1,4 @@
1
-
2
1
  export * from './use-global-config'
3
2
  export * from './use-locale'
3
+ export * from './use-size'
4
+
@@ -1,28 +1,17 @@
1
- import { computed, getCurrentInstance, inject, ref } from 'vue'
2
- // import { configProviderContextKey } from '@element-plus/tokens'
3
- // import type { Ref } from 'vue'
4
- // import type { ConfigProviderContext } from '@element-plus/tokens'
1
+ import {computed, getCurrentInstance, inject, provide, InjectionKey, Ref, ref, App, unref} from 'vue'
2
+ import {MaybeRef} from "@vueuse/core";
5
3
 
6
- // this is meant to fix global methods like `ElMessage(opts)`, this way we can inject current locale
7
- // into the component as default injection value.
8
- // refer to: https://github.com/element-plus/element-plus/issues/2610#issuecomment-887965266
9
4
  const globalConfig = ref()
10
5
 
11
- // export function useGlobalConfig<
12
- // K extends keyof ConfigProviderContext,
13
- // D extends ConfigProviderContext[K]
14
- // >(
15
- // key: K,
16
- // defaultValue?: D
17
- // ): Ref<Exclude<ConfigProviderContext[K], undefined> | D>
18
- // export function useGlobalConfig(): Ref<ConfigProviderContext>
19
- export function useGlobalConfig(
20
- key?: keyof any,
21
- defaultValue = undefined
22
- ) {
23
- const config = getCurrentInstance()
24
- ? inject( Symbol(), globalConfig)
25
- : globalConfig
6
+ export const globalConfigKey: InjectionKey<Ref<GlobalConfig>> = Symbol('GlobalConfigKey')
7
+
8
+ export interface GlobalConfig {
9
+ size?: string,
10
+ locale?: any
11
+ }
12
+
13
+ export function useGlobalConfig(key?: keyof any, defaultValue = undefined) {
14
+ const config = getCurrentInstance() ? inject(globalConfigKey, globalConfig) : globalConfig
26
15
  if (key) {
27
16
  return computed(() => config.value?.[key] ?? defaultValue)
28
17
  } else {
@@ -30,3 +19,17 @@ export function useGlobalConfig(
30
19
  }
31
20
  }
32
21
 
22
+ export const provideGlobalConfig = (config: MaybeRef<GlobalConfig>, app?: App) => {
23
+ const inSetup = !!getCurrentInstance()
24
+ const provideFn = app?.provide ?? (inSetup ? provide : undefined)
25
+ const context = computed(() => {
26
+ return unref(config)
27
+ })
28
+ provideFn?.(globalConfigKey, context)
29
+ if (!globalConfig.value) {
30
+ globalConfig.value = context.value
31
+ }
32
+
33
+ return context
34
+ }
35
+