fit2cloud-ui-plus 0.0.1-beta.8 → 1.0.0-beta.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 (226) hide show
  1. package/README.md +61 -9
  2. package/lib/fit2cloud-ui-plus.es.js +1438 -533
  3. package/lib/fit2cloud-ui-plus.umd.js +1 -1
  4. package/package.json +10 -5
  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 +104 -0
  16. package/src/components/search-bar/FuQuickSearch.vue +64 -0
  17. package/src/components/search-bar/FuSearchBar.vue +153 -0
  18. package/src/components/search-bar/FuSearchBarButton.vue +23 -0
  19. package/src/components/search-bar/FuSearchContions.vue +40 -0
  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 +20 -0
  25. package/src/components/search-bar/types.ts +23 -0
  26. package/src/components/speed-dial/FuSpeedDial.vue +71 -60
  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 +12 -13
  33. package/src/components/table/{table-column-dropdown/FuTableColumnDropdown.vue → FuTableColumnDropdown.vue} +0 -0
  34. package/src/components/table/index.ts +11 -7
  35. package/src/components/table/table-column-select/FuTableColumnSelectDialog.vue +3 -9
  36. package/src/components/table/table-column-select/FuTableColumnSelectPopover.vue +4 -3
  37. package/src/components/table/table-operations/FuTableButton.vue +1 -4
  38. package/src/components/table/table-operations/FuTableMoreButton.vue +1 -1
  39. package/src/components/table/table-operations/FuTableOperations.vue +1 -2
  40. package/src/components/table/types.ts +3 -0
  41. package/src/components/tabs/FuTabs.vue +4 -3
  42. package/src/hooks/index.ts +2 -1
  43. package/src/hooks/use-global-config/index.ts +25 -22
  44. package/src/hooks/use-locale/index.ts +1 -1
  45. package/src/hooks/use-size/index.ts +35 -0
  46. package/src/index.ts +5 -2
  47. package/src/styles/common/function.scss +14 -4
  48. package/src/styles/common/mixins.scss +9 -4
  49. package/src/styles/common/variables.scss +55 -18
  50. package/src/styles/components/filter-bar.scss +16 -16
  51. package/src/styles/components/icon-button.scss +66 -0
  52. package/src/styles/components/search-bar.scss +240 -0
  53. package/src/styles/components/speed-dial.scss +1 -51
  54. package/src/styles/components/table.scss +7 -9
  55. package/src/styles/index.scss +2 -0
  56. package/src/styles/themes/default.scss +91 -0
  57. package/src/tools/size.ts +6 -0
  58. package/src/tools/theme.ts +0 -12
  59. package/types/examples/App.vue.d.ts +2 -0
  60. package/types/examples/components/CodeExample.vue.d.ts +29 -0
  61. package/types/examples/components/DocumentTable.vue.d.ts +14 -0
  62. package/types/examples/components/Markdown.vue.d.ts +12 -0
  63. package/types/examples/layout/components/AppHeader.vue.d.ts +2 -0
  64. package/types/examples/layout/components/Sidebar.vue.d.ts +2 -0
  65. package/types/examples/layout/index.vue.d.ts +2 -0
  66. package/types/examples/main.d.ts +2 -0
  67. package/types/examples/pages/filter-bar/attributes.d.ts +63 -0
  68. package/types/examples/pages/filter-bar/demo/BaseFilterBar.vue.d.ts +2 -0
  69. package/types/examples/pages/filter-bar/demo/SetConditionsDemo.vue.d.ts +2 -0
  70. package/types/examples/pages/filter-bar/demo/SlotDemo.vue.d.ts +2 -0
  71. package/types/examples/pages/filter-bar/index.vue.d.ts +2 -0
  72. package/types/examples/pages/icon-button/attributes.d.ts +45 -0
  73. package/types/examples/pages/icon-button/demo/BaseIconButton.vue.d.ts +2 -0
  74. package/types/examples/pages/icon-button/demo/SlotDemo.vue.d.ts +2 -0
  75. package/types/examples/pages/icon-button/index.vue.d.ts +2 -0
  76. package/types/examples/pages/index.d.ts +3 -0
  77. package/types/examples/pages/read-write-switch/attributes.d.ts +63 -0
  78. package/types/examples/pages/read-write-switch/demo/BaseDemo.vue.d.ts +2 -0
  79. package/types/examples/pages/read-write-switch/demo/CustomContentDemo.vue.d.ts +2 -0
  80. package/types/examples/pages/read-write-switch/demo/InputRwSwitchDemo.vue.d.ts +2 -0
  81. package/types/examples/pages/read-write-switch/demo/ReadSwitchDemo.vue.d.ts +2 -0
  82. package/types/examples/pages/read-write-switch/demo/SelectRwSwitchDemo.vue.d.ts +2 -0
  83. package/types/examples/pages/read-write-switch/demo/TableInnerEditDemo.vue.d.ts +2 -0
  84. package/types/examples/pages/read-write-switch/demo/WriteSwitchDemo.vue.d.ts +2 -0
  85. package/types/examples/pages/read-write-switch/index.vue.d.ts +2 -0
  86. package/types/examples/pages/search/attributes.d.ts +57 -0
  87. package/types/examples/pages/search/demo/BaseSearchbar.vue.d.ts +66 -0
  88. package/types/examples/pages/search/demo/ComplexComponentsDemo.vue.d.ts +60 -0
  89. package/types/examples/pages/search/demo/ComplexSearchDemo.vue.d.ts +84 -0
  90. package/types/examples/pages/search/demo/CustomComponentsDemo.vue.d.ts +50 -0
  91. package/types/examples/pages/search/demo/EchoConditionsDemo.vue.d.ts +52 -0
  92. package/types/examples/pages/search/demo/QuickSearchDemo.vue.d.ts +18 -0
  93. package/types/examples/pages/search/demo/SearchBarButtonDemo.vue.d.ts +54 -0
  94. package/types/examples/pages/search/index.vue.d.ts +150 -0
  95. package/types/examples/pages/search-bar/attributes.d.ts +63 -0
  96. package/types/examples/pages/search-bar/demo/BaseSearchbar.vue.d.ts +31 -0
  97. package/types/examples/pages/search-bar/demo/ComplexSearchDemo.vue.d.ts +40 -0
  98. package/types/examples/pages/search-bar/demo/EchoConditionsDemo.vue.d.ts +32 -0
  99. package/types/examples/pages/search-bar/demo/QuickSearchDemo.vue.d.ts +7 -0
  100. package/types/examples/pages/search-bar/demo/SearchBarButtonDemo.vue.d.ts +32 -0
  101. package/types/examples/pages/search-bar/index.vue.d.ts +2 -0
  102. package/types/examples/pages/speed-dial/attributes.d.ts +63 -0
  103. package/types/examples/pages/speed-dial/demo/BaseSpeedDial.vue.d.ts +2 -0
  104. package/types/examples/pages/speed-dial/demo/SpeedDialCustom.vue.d.ts +2 -0
  105. package/types/examples/pages/speed-dial/demo/SpeedDialPosition.vue.d.ts +2 -0
  106. package/types/examples/pages/speed-dial/demo/SpeedDialTrigger.vue.d.ts +2 -0
  107. package/types/examples/pages/speed-dial/index.vue.d.ts +2 -0
  108. package/types/examples/pages/split-pane/attributes.d.ts +63 -0
  109. package/types/examples/pages/split-pane/demo/BaseSplit.vue.d.ts +2 -0
  110. package/types/examples/pages/split-pane/demo/CustomResizer.vue.d.ts +2 -0
  111. package/types/examples/pages/split-pane/demo/NestSplit.vue.d.ts +2 -0
  112. package/types/examples/pages/split-pane/demo/ResizerType.vue.d.ts +2 -0
  113. package/types/examples/pages/split-pane/index.vue.d.ts +2 -0
  114. package/types/examples/pages/table/attributes.d.ts +121 -0
  115. package/types/examples/pages/table/demo/BaseTable.vue.d.ts +2 -0
  116. package/types/examples/pages/table/demo/DropdownColumn.vue.d.ts +2 -0
  117. package/types/examples/pages/table/demo/DropdownColumnSlot.vue.d.ts +2 -0
  118. package/types/examples/pages/table/demo/SaveSelectColumn.vue.d.ts +2 -0
  119. package/types/examples/pages/table/demo/SelectColumn.vue.d.ts +2 -0
  120. package/types/examples/pages/table/demo/TableOperations.vue.d.ts +2 -0
  121. package/types/examples/pages/table/demo/TablePagination.vue.d.ts +2 -0
  122. package/types/examples/pages/table/index.vue.d.ts +2 -0
  123. package/types/examples/pages/tabs/attributes.d.ts +63 -0
  124. package/types/examples/pages/tabs/demo/AddCloseTab.vue.d.ts +2 -0
  125. package/types/examples/pages/tabs/index.vue.d.ts +2 -0
  126. package/types/examples/router/doc-routes.d.ts +12 -0
  127. package/types/examples/router/index.d.ts +4 -0
  128. package/types/examples/router/styles-routes.d.ts +12 -0
  129. package/types/examples/style-guide/button/BaseButton.vue.d.ts +2 -0
  130. package/types/examples/style-guide/button/IconButton.vue.d.ts +2 -0
  131. package/types/examples/style-guide/button/PlainButton.vue.d.ts +2 -0
  132. package/types/examples/style-guide/button/TextButton.vue.d.ts +2 -0
  133. package/types/examples/style-guide/button/index.vue.d.ts +2 -0
  134. package/types/examples/style-guide/input/BaseInput.vue.d.ts +2 -0
  135. package/types/examples/style-guide/input/SearchInput.vue.d.ts +2 -0
  136. package/types/examples/style-guide/input/Textarea.vue.d.ts +2 -0
  137. package/types/examples/style-guide/input/index.vue.d.ts +2 -0
  138. package/types/examples/style-guide/select/BaseSelect.vue.d.ts +2 -0
  139. package/types/examples/style-guide/select/index.vue.d.ts +2 -0
  140. package/types/plugins/example-transform.d.ts +5 -0
  141. package/types/src/components/filter-bar/FuFilter.vue.d.ts +42 -0
  142. package/types/src/components/filter-bar/FuFilterBar.vue.d.ts +33 -0
  143. package/types/src/components/filter-bar/FuFilterConditions.vue.d.ts +8 -0
  144. package/types/src/components/filter-bar/FuFilterInput.vue.d.ts +17 -0
  145. package/types/src/components/filter-bar/FuSearchInput.vue.d.ts +17 -0
  146. package/types/src/components/filter-bar/filter-components/FuFilterDate.vue.d.ts +36 -0
  147. package/types/src/components/filter-bar/filter-components/FuFilterDateTime.vue.d.ts +36 -0
  148. package/types/src/components/filter-bar/filter-components/FuFilterOption.vue.d.ts +24 -0
  149. package/types/src/components/filter-bar/filter-components/FuFilterSelect.vue.d.ts +66 -0
  150. package/types/src/components/filter-bar/index.d.ts +2 -0
  151. package/types/src/components/filter-bar/types.d.ts +22 -0
  152. package/types/src/components/icon-button/FuIconButton.vue.d.ts +43 -0
  153. package/types/src/components/icon-button/index.d.ts +2 -0
  154. package/types/src/components/read-write-switch/FuInputRwSwitch.vue.d.ts +21 -0
  155. package/types/src/components/read-write-switch/FuReadWriteSwitch.vue.d.ts +23 -0
  156. package/types/src/components/read-write-switch/FuSelectRwSwitch.vue.d.ts +43 -0
  157. package/types/src/components/read-write-switch/index.d.ts +2 -0
  158. package/types/src/components/read-write-switch/types.d.ts +4 -0
  159. package/types/src/components/search-bar/FuComplexSearch.vue.d.ts +22 -0
  160. package/types/src/components/search-bar/FuQuickSearch.vue.d.ts +29 -0
  161. package/types/src/components/search-bar/FuSearchBar.vue.d.ts +58 -0
  162. package/types/src/components/search-bar/FuSearchBarButton.vue.d.ts +14 -0
  163. package/types/src/components/search-bar/FuSearchContions.vue.d.ts +26 -0
  164. package/types/src/components/search-bar/complex-components/FuComplexDate.vue.d.ts +36 -0
  165. package/types/src/components/search-bar/complex-components/FuComplexDateTime.vue.d.ts +36 -0
  166. package/types/src/components/search-bar/complex-components/FuComplexInput.vue.d.ts +26 -0
  167. package/types/src/components/search-bar/complex-components/FuComplexSelect.vue.d.ts +50 -0
  168. package/types/src/components/search-bar/complex-components/index.d.ts +0 -0
  169. package/types/src/components/search-bar/complex-components/mixins.d.ts +6 -0
  170. package/types/src/components/search-bar/index.d.ts +2 -0
  171. package/types/src/components/search-bar/types.d.ts +17 -0
  172. package/types/src/components/speed-dial/FuSpeedDial.vue.d.ts +218 -0
  173. package/types/src/components/speed-dial/FuSpeedDialActionButton.vue.d.ts +32 -0
  174. package/types/src/components/speed-dial/FuSpeedDialButton.vue.d.ts +42 -0
  175. package/types/src/components/speed-dial/FuSpeedDialItem.vue.d.ts +12 -0
  176. package/types/src/components/speed-dial/index.d.ts +2 -0
  177. package/types/src/components/speed-dial/types.d.ts +8 -0
  178. package/types/src/components/split-pane/FuSplitPane.vue.d.ts +59 -0
  179. package/types/src/components/split-pane/index.d.ts +2 -0
  180. package/types/src/components/table/FuTable.vue.d.ts +18 -0
  181. package/types/src/components/table/FuTableBody.d.ts +3 -0
  182. package/types/src/components/table/FuTableColumnDropdown.vue.d.ts +50 -0
  183. package/types/src/components/table/FuTablePagination.vue.d.ts +47 -0
  184. package/types/src/components/table/index.d.ts +2 -0
  185. package/types/src/components/table/table-column-select/FuTableColumnSelect.vue.d.ts +10 -0
  186. package/types/src/components/table/table-column-select/FuTableColumnSelectDialog.vue.d.ts +23 -0
  187. package/types/src/components/table/table-column-select/FuTableColumnSelectPopover.vue.d.ts +34 -0
  188. package/types/src/components/table/table-column-select/utils.d.ts +8 -0
  189. package/types/src/components/table/table-operations/FuTableButton.vue.d.ts +13 -0
  190. package/types/src/components/table/table-operations/FuTableMoreButton.vue.d.ts +37 -0
  191. package/types/src/components/table/table-operations/FuTableOperations.vue.d.ts +46 -0
  192. package/types/src/components/table/types.d.ts +2 -0
  193. package/types/src/components/tabs/FuTabs.vue.d.ts +54 -0
  194. package/types/src/components/tabs/index.d.ts +2 -0
  195. package/types/src/hooks/index.d.ts +3 -0
  196. package/types/src/hooks/use-global-config/index.d.ts +9 -0
  197. package/types/src/hooks/use-locale/index.d.ts +14 -0
  198. package/types/src/hooks/use-size/index.d.ts +9 -0
  199. package/types/src/index.d.ts +8 -0
  200. package/types/src/locale/index.d.ts +10 -0
  201. package/types/src/locale/lang/en.d.ts +59 -0
  202. package/types/src/locale/lang/zh-cn.d.ts +59 -0
  203. package/types/src/locale/lang/zh-tw.d.ts +59 -0
  204. package/types/src/tools/size.d.ts +4 -0
  205. package/types/src/tools/theme.d.ts +1 -0
  206. package/types/src/tools/time.d.ts +2 -0
  207. package/types/src/tools/types.d.ts +8 -0
  208. package/types/src/tools/utils.d.ts +2 -0
  209. package/types/src/tools/vnode.d.ts +9 -0
  210. package/src/components/filter-bar/FuSearchInput.vue +0 -31
  211. package/src/components/steps/FuHorizontalNavigation.vue +0 -18
  212. package/src/components/steps/FuHorizontalSteps.vue +0 -94
  213. package/src/components/steps/FuStep.vue +0 -13
  214. package/src/components/steps/FuSteps.vue +0 -22
  215. package/src/components/steps/FuStepsFooter.ts +0 -79
  216. package/src/components/steps/FuVerticalNavigation.vue +0 -35
  217. package/src/components/steps/FuVerticalSteps.vue +0 -79
  218. package/src/components/steps/Stepper.ts +0 -188
  219. package/src/components/steps/index.ts +0 -11
  220. package/src/components/table/table-column-dropdown/index.ts +0 -7
  221. package/src/components/table/table-column-select/index.ts +0 -8
  222. package/src/components/table/table-operations/index.ts +0 -12
  223. package/src/components/virtual-scroller/FuVirtualHorizontalScroll.js +0 -96
  224. package/src/components/virtual-scroller/FuVirtualScroll.js +0 -15
  225. package/src/components/virtual-scroller/FuVirtualVerticalScroll.js +0 -95
  226. package/src/components/virtual-scroller/index.js +0 -10
@@ -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
+
@@ -1,7 +1,7 @@
1
1
  import { computed, isRef, ref, unref } from 'vue'
2
2
  import { get } from 'lodash-unified'
3
3
  import Chinese from '@/locale/lang/zh-cn'
4
- import { useGlobalConfig } from '../use-global-config'
4
+ import { useGlobalConfig } from '@/hooks'
5
5
  import type { MaybeRef } from '@vueuse/core'
6
6
  import type { Ref } from 'vue'
7
7
  import type { Language } from '@/locale'
@@ -0,0 +1,35 @@
1
+ import {computed, getCurrentInstance, ref, unref} from 'vue'
2
+ import {useGlobalConfig} from '@/hooks'
3
+ import type {ComputedRef} from 'vue'
4
+ import type {ComponentSize} from '@/tools/size'
5
+ import {validateSize} from "@/tools/size";
6
+ import {MaybeRef} from "@vueuse/core";
7
+
8
+ export const useProp = <T>(name: string): ComputedRef<T | undefined> => {
9
+ const vm = getCurrentInstance()!
10
+ return computed(() => (vm.proxy?.$props as any)[name] ?? undefined)
11
+ }
12
+
13
+ export const useSize = (
14
+ fallback?: MaybeRef<ComponentSize | undefined>,
15
+ ignore: Partial<Record<'prop' | 'global', boolean>> = {}
16
+ ) => {
17
+ const emptyRef = ref(undefined)
18
+
19
+ const size = ignore.prop ? emptyRef : useProp<ComponentSize>('size')
20
+ const globalConfig = ignore.global ? emptyRef : useGlobalConfig('size')
21
+
22
+ return computed(
23
+ (): ComponentSize =>
24
+ size.value ||
25
+ unref(fallback) ||
26
+ globalConfig.value ||
27
+ ''
28
+ )
29
+ }
30
+
31
+ export const useSizeProp = {
32
+ type: String,
33
+ validator: validateSize,
34
+ }
35
+
package/src/index.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  import PackageJSON from "../package.json"
2
2
 
3
- import type { App } from 'vue'
3
+ import type {App} from 'vue'
4
+ import {GlobalConfig, provideGlobalConfig} from "@/hooks";
5
+
4
6
  const components = import.meta.globEager('@/components/*/index.ts');
5
7
 
6
- const install = (app: App): void => {
8
+ const install = (app: App, config: GlobalConfig): void => {
7
9
  Object.keys(components).forEach(key => {
8
10
  let component = components[key].default;
9
11
  app.use(component)
10
12
  })
13
+ provideGlobalConfig(config)
11
14
  }
12
15
 
13
16
  const plugin = {
@@ -43,7 +43,7 @@
43
43
  }
44
44
 
45
45
  // join var name
46
- // joinVarName(('button', 'text-color')) => '--el-button-text-color'
46
+ // joinVarName(('button', 'text-color')) => '--fu-button-text-color'
47
47
  @function joinVarName($list) {
48
48
  $name: '--' + config.$namespace;
49
49
  @each $item in $list {
@@ -54,17 +54,17 @@
54
54
  @return $name;
55
55
  }
56
56
 
57
- // getCssVarName('button', 'text-color') => '--el-button-text-color'
57
+ // getCssVarName('button', 'text-color') => '--fu-button-text-color'
58
58
  @function getCssVarName($args...) {
59
59
  @return joinVarName($args);
60
60
  }
61
61
 
62
- // getCssVar('button', 'text-color') => var(--el-button-text-color)
62
+ // getCssVar('button', 'text-color') => var(--fu-button-text-color)
63
63
  @function getCssVar($args...) {
64
64
  @return var(#{joinVarName($args)});
65
65
  }
66
66
 
67
- // bem('block', 'element', 'modifier') => 'el-block__element--modifier'
67
+ // bem('block', 'element', 'modifier') => 'fu-block__element--modifier'
68
68
  @function bem($block, $element: '', $modifier: '') {
69
69
  $name: config.$namespace + config.$common-separator + $block;
70
70
 
@@ -79,3 +79,13 @@
79
79
  // @debug $name;
80
80
  @return $name;
81
81
  }
82
+
83
+ @function str-replace($string, $search, $replace: '') {
84
+ $index: str-index($string, $search);
85
+
86
+ @if $index {
87
+ @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
88
+ }
89
+
90
+ @return $string;
91
+ }
@@ -1,8 +1,4 @@
1
1
  @use 'function' as *;
2
- @use 'variables' as *;
3
- // forward mixins
4
- @forward 'config';
5
- @forward 'function';
6
2
  @use 'config' as *;
7
3
 
8
4
  // BEM
@@ -83,3 +79,12 @@
83
79
  }
84
80
  }
85
81
 
82
+ @mixin set-css-var($name, $value) {
83
+ #{joinVarName($name)}: #{$value};
84
+ }
85
+
86
+ @mixin set-component-css-var($name, $variables) {
87
+ @each $attribute, $value in $variables {
88
+ #{getCssVarName($name, $attribute)}: #{$value};
89
+ }
90
+ }
@@ -1,24 +1,61 @@
1
+ @use 'sass:map';
2
+ @use "./mixins" as *;
3
+ @use 'element-plus/theme-chalk/src/common/var.scss' as *;
1
4
 
2
- @forward 'element-plus/theme-chalk/src/common/var.scss' with (
3
- $colors: (
4
- 'primary': (
5
- 'base': #004A71,
5
+ // fit2cloud ui variables
6
+ $condition: () !default;
7
+ $condition: map.deep-merge(
8
+ (
9
+ 'color': #646A73,
10
+ 'bgColor': #F5F6F7,
6
11
  ),
7
- ),
8
- $table: (
9
- 'border-color' : rgba(31, 35, 41, 0.15),
10
- 'header-text-color': '#646A73',
11
- 'text-color': '#1F2329',
12
+ $condition
13
+ );
12
14
 
13
- )
15
+ $fu-search-bar: () !default;
16
+ $fu-search-bar: map.deep-merge(
17
+ (
18
+ 'width': 100%,
19
+ 'height': 48px,
20
+ 'condition-color': map-get($condition, "color"),
21
+ 'condition-bgColor': map-get($condition, "bgColor"),
22
+ ),
23
+ $fu-search-bar
14
24
  );
15
25
 
16
- // fit2cloud ui variables
17
- $table-header-bgColor: #F5F6F7 !default;
26
+ $fu-filter-bar: () !default;
27
+ $fu-filter-bar: map.deep-merge(
28
+ (
29
+ 'color': map-get($condition, "color"),
30
+ 'drawer-color': map-get($condition, "color"),
31
+ 'condition-color': map-get($condition, "color"),
32
+ 'condition-bgColor': map-get($condition, "bgColor"),
33
+ 'option-bgColor': map-get($condition, "bgColor"),
34
+ 'option-hover-bgColor': rgba($color-primary, 10%),
35
+ 'scroll-bgColor': mix(#000, map-get($condition, "bgColor"), 15%),
36
+ ),
37
+ $fu-filter-bar
38
+ );
39
+
40
+ $fu-icon-button: () !default;
41
+ $fu-icon-button: map.deep-merge(
42
+ (
43
+ 'color': map-get($text-color, "primary"),
44
+ 'bgColor': transparent,
45
+ 'hover-color': map-get($fu-icon-button, "color"),
46
+ 'hover-bgColor': rgba(map-get($fu-icon-button, "color"), 0.1),
47
+ 'active-color': map-get($fu-icon-button, "color"),
48
+ 'active-bgColor': rgba(map-get($fu-icon-button, "color"), 0.2),
49
+ 'disabled-color': #BBBFC4,
50
+ 'disabled-bgColor': transparent,
51
+ 'gap': 12px,
52
+ ),
53
+ $fu-icon-button
54
+ );
18
55
 
19
- $filter-color: #646A73 !default;
20
- $filter-drawer-color: #646A73 !default;
21
- $filter-condition-color: #0C296E !default;
22
- $filter-condition-bgColor: rgba(51, 112, 255, 0.1) !default;
23
- $filter-option-bgColor: #F5F6F7 !default;
24
- $filter-scroll-bgColor: rgba(31, 35, 41, 0.1) !default;
56
+ :root {
57
+ // 遍历组件变量,例如: --fu-search-bar-{key}: {value}
58
+ @include set-component-css-var('search-bar', $fu-search-bar);
59
+ @include set-component-css-var('filter-bar', $fu-filter-bar);
60
+ @include set-component-css-var('icon-button', $fu-icon-button);
61
+ }
@@ -1,5 +1,4 @@
1
1
  @use "../common/mixins.scss" as *;
2
- @use "../common/variables.scss" as *;
3
2
 
4
3
  @include b(filter-bar) {
5
4
  border-radius: 4px;
@@ -19,19 +18,18 @@
19
18
  }
20
19
  }
21
20
 
22
- @include b(search-input) {
21
+ @include b(filter-input) {
23
22
  width: 240px;
24
- margin-right: 10px;
25
23
  .el-input__prefix, .el-input__suffix {
26
24
  .el-input__icon {
27
- color: $filter-color;
25
+ color: var(--fu-filter-bar-color);
28
26
  font-size: 14px
29
27
  }
30
28
  }
29
+ }
31
30
 
32
- .el-icon-circle-close:before {
33
- content: "\e79d"
34
- }
31
+ @include b(filter-button) {
32
+ margin-left: 12px;
35
33
  }
36
34
 
37
35
  @include b(filter) {
@@ -48,7 +46,7 @@
48
46
  }
49
47
 
50
48
  @include e(split) {
51
- background-color: $filter-color;
49
+ background-color: var(--fu-filter-bar-color);
52
50
  height: 16px;
53
51
  width: 1px;
54
52
  margin: 2px 8px;
@@ -63,7 +61,7 @@
63
61
  margin: 0 2px;
64
62
 
65
63
  &:hover {
66
- background: $filter-scroll-bgColor;
64
+ background: var(--fu-filter-bar-scroll-bgColor);
67
65
  border-radius: 4px;
68
66
  }
69
67
 
@@ -80,7 +78,7 @@
80
78
  height: 22px;
81
79
  min-width: 76px;
82
80
  max-width: 76px;
83
- color: $filter-color;
81
+ color: var(--fu-filter-bar-color);
84
82
  cursor: pointer;
85
83
  margin-left: 6px;
86
84
  }
@@ -111,7 +109,7 @@
111
109
  bottom: 0;
112
110
  width: 100%;
113
111
  height: 72px;
114
- padding: 0 24px;
112
+ right: 20px;
115
113
  display: flex;
116
114
  justify-content: flex-end;
117
115
  align-items: center;
@@ -136,9 +134,9 @@
136
134
  padding: 1px 6px;
137
135
  box-sizing: border-box;
138
136
  height: 24px;
139
- background-color: $filter-condition-bgColor;
137
+ background-color: var(--fu-filter-bar-condition-bgColor);
140
138
  border-radius: 2px;
141
- color: $filter-condition-color;
139
+ color: var(--fu-filter-bar-condition-color);
142
140
 
143
141
  & + & {
144
142
  margin-left: 8px;
@@ -197,14 +195,13 @@
197
195
  padding: 1px 6px;
198
196
  font-size: 14px;
199
197
  line-height: 22px;
200
- background-color: $filter-option-bgColor;
198
+ background-color: var(--fu-filter-bar-option-bgColor);
201
199
  border-radius: 2px;
202
200
  cursor: pointer;
203
201
  margin: 6px;
204
202
 
205
203
  &.is-selected, &:hover {
206
- background: $filter-condition-bgColor;
207
- color: $filter-condition-color;
204
+ background-color: var(--fu-filter-bar-option-hover-bgColor);
208
205
  }
209
206
 
210
207
  &:active {
@@ -221,6 +218,9 @@
221
218
 
222
219
  @include b(scale-click) {
223
220
  cursor: pointer;
221
+ &:hover, &:focus {
222
+ opacity: 0.8;
223
+ }
224
224
  &:active {
225
225
  transform: scale(0.9)
226
226
  }
@@ -0,0 +1,66 @@
1
+ @use "../common/mixins.scss" as *;
2
+ @use 'element-plus/theme-chalk/src/common/var.scss' as *;
3
+
4
+ @mixin set-type-css-var($color) {
5
+ @include set-component-css-var('icon-button', (
6
+ 'color': $color,
7
+ 'bgColor': transparent,
8
+ 'hover-color': $color,
9
+ 'hover-bgColor': rgba($color, 0.1),
10
+ 'active-color': $color,
11
+ 'active-bgColor': rgba($color, 0.2),
12
+ ));
13
+ }
14
+
15
+ @include b(icon-button) {
16
+ @include flex-row(center, center);
17
+ cursor: pointer;
18
+ width: 32px;
19
+ height: 32px;
20
+ border-radius: 4px;
21
+ color: var(--fu-icon-button-color);
22
+ background-color: var(--fu-icon-button-bgColor);
23
+
24
+ &:not(.is-disabled) {
25
+ &:hover, &:focus {
26
+ color: var(--fu-icon-button-hover-color);
27
+ background-color: var(--fu-icon-button-hover-bgColor);
28
+ }
29
+
30
+ &:active {
31
+ color: var(--fu-icon-button-active-color);
32
+ background-color: var(--fu-icon-button-active-bgColor);
33
+ }
34
+ }
35
+
36
+ &.is-disabled {
37
+ color: var(--fu-icon-button-disabled-color);
38
+ background-color: var(--fu-icon-button-disabled-bgColor);
39
+ cursor: not-allowed;
40
+ pointer-events: none;
41
+
42
+ .el-icon {
43
+ color: var(--fu-icon-button-disabled-color);
44
+ }
45
+ }
46
+
47
+ @include m(primary) {
48
+ @include set-type-css-var($color-primary);
49
+ }
50
+ @include m(success) {
51
+ @include set-type-css-var($color-success);
52
+ }
53
+ @include m(warning) {
54
+ @include set-type-css-var($color-warning);
55
+ }
56
+ @include m(danger) {
57
+ @include set-type-css-var($color-danger);
58
+ }
59
+ @include m(info) {
60
+ @include set-type-css-var($color-info);
61
+ }
62
+
63
+ & + & {
64
+ margin-left: var(--fu-icon-button-gap);
65
+ }
66
+ }