fit2cloud-ui-plus 0.0.1-beta.1 → 0.0.1-beta.10

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 (73) hide show
  1. package/lib/fit2cloud-ui-plus.es.js +349 -1264
  2. package/lib/fit2cloud-ui-plus.umd.js +1 -1
  3. package/package.json +5 -10
  4. package/src/.DS_Store +0 -0
  5. package/src/components/.DS_Store +0 -0
  6. package/src/components/filter-bar/FuFilter.vue +19 -14
  7. package/src/components/filter-bar/FuFilterBar.vue +16 -11
  8. package/src/components/filter-bar/FuSearchInput.vue +8 -2
  9. package/src/components/filter-bar/filter-components/FuFilterDate.vue +17 -13
  10. package/src/components/filter-bar/filter-components/FuFilterDateTime.vue +16 -13
  11. package/src/components/filter-bar/filter-components/FuFilterSelect.vue +17 -12
  12. package/src/components/filter-bar/index.ts +11 -12
  13. package/src/components/read-write-switch/FuInputRwSwitch.vue +9 -5
  14. package/src/components/read-write-switch/FuReadWriteSwitch.vue +38 -36
  15. package/src/components/read-write-switch/FuSelectRwSwitch.vue +11 -7
  16. package/src/components/read-write-switch/types.ts +4 -0
  17. package/src/components/split-pane/FuSplitPane.vue +3 -3
  18. package/src/components/table/FuTable.vue +16 -25
  19. package/src/components/table/FuTableBody.ts +38 -34
  20. package/src/components/table/{table-column-dropdown/FuTableColumnDropdown.vue → FuTableColumnDropdown.vue} +5 -2
  21. package/src/components/table/index.ts +11 -7
  22. package/src/components/table/table-column-select/FuTableColumnSelectDialog.vue +15 -20
  23. package/src/components/table/table-column-select/FuTableColumnSelectPopover.vue +12 -11
  24. package/src/components/table/table-column-select/utils.ts +10 -7
  25. package/src/components/table/table-operations/FuTableButton.vue +1 -4
  26. package/src/components/table/table-operations/FuTableMoreButton.vue +5 -3
  27. package/src/components/table/table-operations/FuTableOperations.vue +6 -7
  28. package/src/components/table/types.ts +3 -0
  29. package/src/components/tabs/FuTabs.vue +4 -2
  30. package/src/hooks/index.ts +2 -0
  31. package/src/hooks/use-global-config/index.ts +0 -15
  32. package/src/hooks/use-size/index.ts +29 -0
  33. package/src/styles/common/variables.scss +2 -6
  34. package/src/styles/components/filter-bar.scss +3 -3
  35. package/src/styles/components/split-pane.scss +1 -1
  36. package/src/styles/components/steps.scss +2 -2
  37. package/src/styles/components/table.scss +3 -5
  38. package/src/styles/components/tabs.scss +1 -1
  39. package/src/styles/index.scss +0 -1
  40. package/src/tools/size.ts +6 -0
  41. package/src/tools/theme.ts +0 -12
  42. package/src/tools/types.ts +9 -0
  43. package/src/tools/utils.ts +36 -36
  44. package/src/tools/vnode.ts +47 -0
  45. package/src/components/search-bar/FuComplexSearch.vue +0 -108
  46. package/src/components/search-bar/FuQuickSearch.vue +0 -43
  47. package/src/components/search-bar/FuSearchBar.vue +0 -165
  48. package/src/components/search-bar/FuSearchBarButton.vue +0 -14
  49. package/src/components/search-bar/FuSearchContions.vue +0 -24
  50. package/src/components/search-bar/index.ts +0 -13
  51. package/src/components/search-bar/store.ts +0 -25
  52. package/src/components/speed-dial/FuSpeedDial.vue +0 -280
  53. package/src/components/speed-dial/FuSpeedDialActionButton.vue +0 -88
  54. package/src/components/speed-dial/FuSpeedDialButton.vue +0 -42
  55. package/src/components/speed-dial/FuSpeedDialItem.vue +0 -88
  56. package/src/components/speed-dial/index.ts +0 -11
  57. package/src/components/steps/FuHorizontalNavigation.vue +0 -18
  58. package/src/components/steps/FuHorizontalSteps.vue +0 -94
  59. package/src/components/steps/FuStep.vue +0 -13
  60. package/src/components/steps/FuSteps.vue +0 -22
  61. package/src/components/steps/FuStepsFooter.ts +0 -79
  62. package/src/components/steps/FuVerticalNavigation.vue +0 -35
  63. package/src/components/steps/FuVerticalSteps.vue +0 -79
  64. package/src/components/steps/Stepper.ts +0 -188
  65. package/src/components/steps/index.ts +0 -11
  66. package/src/components/table/table-column-dropdown/index.ts +0 -7
  67. package/src/components/table/table-column-select/index.ts +0 -8
  68. package/src/components/table/table-operations/index.ts +0 -12
  69. package/src/components/virtual-scroller/FuVirtualHorizontalScroll.js +0 -96
  70. package/src/components/virtual-scroller/FuVirtualScroll.js +0 -15
  71. package/src/components/virtual-scroller/FuVirtualVerticalScroll.js +0 -95
  72. package/src/components/virtual-scroller/index.js +0 -10
  73. package/src/styles/components/search-bar.scss +0 -285
@@ -3,25 +3,28 @@
3
3
  <div class="fu-filter-component__label">{{ label }}</div>
4
4
  <div class="fu-filter-component__content">
5
5
  <!-- :size="configSize" -->
6
- <el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs"
7
- :placeholder="t('fu.search_bar.select_date_time')" type="datetimerange"
8
- :value-format="valueFormat"
9
- :start-placeholder="t('fu.search_bar.start_date_time')"
10
- :end-placeholder="t('fu.search_bar.end_date_time')">
6
+ <el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs" :size="size"
7
+ :placeholder="t('fu.search_bar.select_date_time')" type="datetimerange" :value-format="valueFormat"
8
+ :start-placeholder="t('fu.search_bar.start_date_time')" :end-placeholder="t('fu.search_bar.end_date_time')">
11
9
  </el-date-picker>
12
10
  </div>
13
11
  </div>
14
12
  </template>
15
13
 
16
14
  <script setup lang="ts">
17
- import {ref, computed, inject} from "vue";
18
- import {FilterCondition, ReferenceContext, referenceKey} from "../types";
19
- import {datetimeFormat} from "@/tools/time";
20
- import {useLocale} from "@/hooks"
15
+ import { ref, computed, inject } from "vue";
16
+ import { FilterCondition, ReferenceContext, referenceKey } from "../types";
17
+ import { datetimeFormat } from "@/tools/time";
18
+ import { useLocale } from "@/hooks"
19
+ import { validateSize } from "@/tools/size";
21
20
  defineOptions({ name: "FuFilterDateTime" });
22
- const {t} = useLocale()
21
+ const { t } = useLocale()
23
22
 
24
23
  const props = defineProps({
24
+ size: {
25
+ type: String,
26
+ validator: validateSize
27
+ },
25
28
  label: String,
26
29
  field: {
27
30
  type: String,
@@ -45,8 +48,8 @@ const valueLabel = computed(() => {
45
48
 
46
49
  function getCondition(): FilterCondition | undefined {
47
50
  if (!String(value.value)) return;
48
- let {field, label} = props
49
- return {field, label, value: value.value, valueLabel: valueLabel.value}
51
+ let { field, label } = props
52
+ return { field, label, value: value.value, valueLabel: valueLabel.value }
50
53
  }
51
54
 
52
55
  function init(v: any) {
@@ -55,7 +58,7 @@ function init(v: any) {
55
58
 
56
59
  const references = inject(referenceKey)
57
60
  const field = props.field
58
- const reference: ReferenceContext = {field, init, getCondition}
61
+ const reference: ReferenceContext = { field, init, getCondition }
59
62
  references?.value.push(reference)
60
63
 
61
64
  defineExpose({
@@ -2,20 +2,20 @@
2
2
  <div class="fu-filter-component">
3
3
  <div class="fu-filter-component__label">{{ label }}</div>
4
4
  <div class="fu-filter-component__content">
5
- <fu-filter-option :label="o.label" :value="o.value" v-for="o in showOptions" :key="o.value"/>
5
+ <fu-filter-option :label="o.label" :value="o.value" v-for="o in showOptions" :key="o.value" />
6
6
  <el-popover popper-class="fu-filter-component-popover" :show-arrow="false" placement="bottom-start"
7
- trigger="click" width="240">
7
+ trigger="click" width="240">
8
8
  <el-select v-model="selection" v-bind="$attrs" :multiple="multiple" @change="change" :teleported="false"
9
- :placeholder="t('fu.search_bar.please_select')">
9
+ :size="size" :placeholder="t('fu.search_bar.please_select')">
10
10
  <el-option value="" v-if="useSelectAll && multiple">
11
11
  <div @click="selectAll">{{ t('fu.filter_bar.select_all') }}</div>
12
12
  </el-option>
13
- <el-option :label="o.label" :value="o.value" v-for="o in options" :key="o.value"/>
13
+ <el-option :label="o.label" :value="o.value" v-for="o in options" :key="o.value" />
14
14
  </el-select>
15
15
  <template #reference>
16
16
  <div class="fu-filter-option">
17
17
  <el-icon>
18
- <Plus/>
18
+ <Plus />
19
19
  </el-icon>
20
20
  {{ t('fu.filter_bar.more') }}
21
21
  </div>
@@ -26,15 +26,20 @@
26
26
  </template>
27
27
 
28
28
  <script setup lang="ts">
29
- import {ref, provide, computed, PropType, Ref, inject} from "vue";
29
+ import { ref, provide, computed, PropType, Ref, inject } from "vue";
30
30
  import FuFilterOption from "./FuFilterOption.vue";
31
- import {FilterCondition, OptionProps, ReferenceContext, referenceKey, selectKey} from "../types";
31
+ import { FilterCondition, OptionProps, ReferenceContext, referenceKey, selectKey } from "../types";
32
32
 
33
- import {useLocale} from "@/hooks"
33
+ import { useLocale } from "@/hooks"
34
+ import { validateSize } from "@/tools/size";
34
35
  defineOptions({ name: "FuFilterSelect" });
35
- const {t} = useLocale()
36
+ const { t } = useLocale()
36
37
 
37
38
  const props = defineProps({
39
+ size: {
40
+ type: String,
41
+ validator: validateSize
42
+ },
38
43
  multiple: {
39
44
  type: Boolean,
40
45
  default: false
@@ -118,8 +123,8 @@ function getValueLabel(value: string | number) {
118
123
 
119
124
  function getCondition(): FilterCondition | undefined {
120
125
  if (!selection.value || (Array.isArray(selection.value) && selection.value.length === 0)) return;
121
- let {field, label} = props
122
- return {field, label, value: selection.value, valueLabel: valueLabel.value}
126
+ let { field, label } = props
127
+ return { field, label, value: selection.value, valueLabel: valueLabel.value }
123
128
  }
124
129
 
125
130
  function init(v: any) {
@@ -133,7 +138,7 @@ provide(selectKey, {
133
138
 
134
139
  const references = inject(referenceKey)
135
140
  const field = props.field
136
- const reference: ReferenceContext = {field, init, getCondition}
141
+ const reference: ReferenceContext = { field, init, getCondition }
137
142
  references?.value.push(reference)
138
143
 
139
144
  defineExpose({
@@ -1,19 +1,18 @@
1
- import FuSearchInput from "./FuSearchInput.vue"
1
+ import FuSearchInput from "./FuSearchInput.vue";
2
2
  import FuFilterBar from "./FuFilterBar.vue";
3
3
  import FuFilter from "./FuFilter.vue";
4
4
  import FuFilterSelect from "./filter-components/FuFilterSelect.vue";
5
5
  import FuFilterDate from "./filter-components/FuFilterDate.vue";
6
6
  import FuFilterDateTime from "./filter-components/FuFilterDateTime.vue";
7
+ import type { App } from "vue";
7
8
 
8
- import type {App} from 'vue'
9
+ FuSearchInput.install = (app: App): void => {
10
+ app.component(FuFilterBar.name, FuFilterBar);
11
+ app.component(FuFilter.name, FuFilter);
12
+ app.component(FuSearchInput.name, FuSearchInput);
13
+ app.component(FuFilterSelect.name, FuFilterSelect);
14
+ app.component(FuFilterDate.name, FuFilterDate);
15
+ app.component(FuFilterDateTime.name, FuFilterDateTime);
16
+ };
9
17
 
10
- export default {
11
- install: (app: App): void => {
12
- app.component(FuFilterBar.name, FuFilterBar)
13
- app.component(FuFilter.name, FuFilter)
14
- app.component(FuSearchInput.name, FuSearchInput)
15
- app.component(FuFilterSelect.name, FuFilterSelect)
16
- app.component(FuFilterDate.name, FuFilterDate)
17
- app.component(FuFilterDateTime.name, FuFilterDateTime)
18
- }
19
- }
18
+ export default FuSearchInput;
@@ -9,33 +9,37 @@
9
9
 
10
10
  <script setup lang="ts">
11
11
 
12
+ import FuReadWriteSwitch from "@/components/read-write-switch/FuReadWriteSwitch.vue";
12
13
  import { ref, watch } from "vue";
14
+
13
15
  defineOptions({ name: "FuInputRwSwitch" });
14
16
  const props = defineProps({
15
- value: [String, Number],
17
+ modelValue: [String, Number],
16
18
  writeTrigger: {
17
19
  type: String,
18
- default: "click",
20
+ default: "onClick",
19
21
  validator: (value: string) => {
20
- return ['click', 'dblclick'].includes(value)
22
+ return ['onClick', 'onDblclick'].includes(value)
21
23
  }
22
24
  }
23
25
  })
24
26
  const emit = defineEmits(["input", "blur"])
25
27
 
26
- const data = ref(props.value)
28
+ const data = ref(props.modelValue)
27
29
 
28
- watch(() => props.value, (v) => {
30
+ watch(() => props.modelValue, (v) => {
29
31
  data.value = v
30
32
  })
31
33
 
32
34
  function input(e: Event) {
33
35
  emit("input", data.value, e)
34
36
  }
37
+
35
38
  function blur(read: Function, e: Event) {
36
39
  emit("blur", data.value, e)
37
40
  read()
38
41
  }
42
+
39
43
  function keydown(read: Function, e: KeyboardEvent) {
40
44
  if (e.key === "Enter") {
41
45
  read()
@@ -1,28 +1,27 @@
1
1
  <script lang="ts">
2
- import { ref, watch, defineComponent, h, nextTick } from 'vue'
3
- import { uuid } from "@/tools/utils"
2
+ import {ref, watch, defineComponent, h, nextTick} from 'vue'
3
+ import {uuid} from "@/tools/utils"
4
4
 
5
- const TRIGGERS = ['manual', 'click', 'dblclick']
5
+ const TRIGGERS = ['manual', 'onClick', 'onDblclick']
6
6
 
7
7
  export default defineComponent({
8
8
  name: "FuReadWriteSwitch",
9
9
  props: {
10
- value: Boolean,
10
+ modelValue: Boolean,
11
11
  data: [String, Number, Boolean],
12
12
  writeTrigger: {
13
13
  type: String,
14
- default: "click",
14
+ default: "onClick",
15
15
  validator: (value: string) => {
16
16
  return TRIGGERS.includes(value)
17
17
  }
18
18
  }
19
19
  },
20
20
 
21
- setup(props, { slots, emit }) {
21
+ setup(props, {slots, emit}) {
22
22
  const id = ref(uuid())
23
- const write = ref(props.value === undefined ? false : props.value)
24
- watch(() => props.value, (v) => {
25
- console.log(v)
23
+ const write = ref(props.modelValue === undefined ? false : props.modelValue)
24
+ watch(() => props.modelValue, (v) => {
26
25
  if (v === write.value) return
27
26
 
28
27
  if (v) {
@@ -33,12 +32,13 @@ export default defineComponent({
33
32
  })
34
33
 
35
34
  function change() {
36
- emit("input", write.value)
35
+ emit("update:modelValue", write.value)
37
36
  emit("change", [props.data, write.value])
38
37
  }
38
+
39
39
  function switchWrite() {
40
40
  write.value = true
41
-
41
+
42
42
  nextTick(() => {
43
43
  // 目前只支持input和textarea自动获取焦点
44
44
  const nid = document.getElementById(id.value)
@@ -52,39 +52,41 @@ export default defineComponent({
52
52
  change()
53
53
  })
54
54
  }
55
+
55
56
  function switchRead() {
56
57
  write.value = false
57
58
  change()
58
59
  }
59
-
60
- const context: any = {
61
- class: "fu-read-write-switch",
62
- attrs: { id: id.value },
63
- on: {}
64
- }
65
60
 
66
- // 读状态添加触发写状态的事件
67
- if (!write.value && props.writeTrigger !== TRIGGERS[0]) {
68
- context.on[props.writeTrigger] = switchWrite
69
- }
70
- // 没有slot时显示文本数据
71
- let children: any = props.data
61
+ return () => {
62
+ const context: any = {
63
+ class: "fu-read-write-switch",
64
+ id: id.value,
65
+ }
72
66
 
73
- // 读状态内容,提供切换到写状态的方法
74
- if (!write.value && slots.read) {
75
- children = slots.read({
76
- write: switchWrite
77
- })
78
- }
67
+ // 读状态添加触发写状态的事件
68
+ if (!write.value && props.writeTrigger !== TRIGGERS[0]) {
69
+ context[props.writeTrigger] = switchWrite
70
+ }
71
+ // 没有slot时显示文本数据
72
+ let children: any = props.data
79
73
 
80
- // 写状态内容,提供切换到读状态的方法
81
- if (write.value && slots.default) {
82
- children = slots.default({
83
- read: switchRead
84
- })
85
- }
74
+ // 读状态内容,提供切换到写状态的方法
75
+ if (!write.value && slots.read) {
76
+ children = slots.read({
77
+ write: switchWrite
78
+ })
79
+ }
86
80
 
87
- return () => h("div", context, children)
81
+ // 写状态内容,提供切换到读状态的方法
82
+ if (write.value && slots.default) {
83
+ children = slots.default({
84
+ read: switchRead
85
+ })
86
+ }
87
+
88
+ return h("div", context, children)
89
+ }
88
90
  }
89
91
 
90
92
  })
@@ -17,23 +17,27 @@
17
17
  </template>
18
18
 
19
19
  <script setup lang="ts">
20
- import { ref, watch } from "vue";
20
+ import { ref, watch, PropType } from "vue";
21
+ import { OptionProps } from "./types";
21
22
  defineOptions({ name: "FuSelectRwSwitch" });
22
23
  const props = defineProps({
23
- value: [String, Number],
24
- options: Array,
24
+ modelValue: [String, Number],
25
+ options: {
26
+ type: Array as PropType<OptionProps[]>,
27
+ default: []
28
+ },
25
29
  writeTrigger: {
26
30
  type: String,
27
- default: "click",
31
+ default: "onClick",
28
32
  validator: (value: string) => {
29
- return ['click', 'dblclick'].includes(value)
33
+ return ['onClick', 'onDblclick'].includes(value)
30
34
  }
31
35
  }
32
36
  })
33
37
  const emit = defineEmits(["input", "blur", "change"])
34
- const data = ref(props.value)
38
+ const data = ref(props.modelValue)
35
39
 
36
- watch(() => props.value, (v) => {
40
+ watch(() => props.modelValue, (v) => {
37
41
  data.value = v
38
42
  })
39
43
  function input(e: Event) {
@@ -0,0 +1,4 @@
1
+ export interface OptionProps {
2
+ label: string
3
+ value: string | number
4
+ }
@@ -8,7 +8,7 @@
8
8
  @mouseover="hover = true" @mouseleave="hover = false">
9
9
  <div class="icon" v-if="resizerType === 'resizer'">
10
10
  <slot name="resizer">
11
- <i class="el-icon-more"></i>
11
+ <el-icon :size="10"><MoreFilled /></el-icon>
12
12
  </slot>
13
13
  </div>
14
14
  </div>
@@ -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 { 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,30 +23,12 @@ 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
  }
@@ -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,40 +1,44 @@
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
- const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0
5
- const { fix } = node.props
6
- let { type } = node.props
7
- return (fix !== undefined && fix !== false) || ["selection", "index", "expand"].includes(type) || includeTag
8
- }
4
+ export const isFix = (node: any) => {
5
+ const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0;
6
+ const {fix} = node.props;
7
+ let {type} = node.props;
8
+ return (
9
+ (fix !== undefined && fix !== false) ||
10
+ ["selection", "index", "expand"].includes(type) ||
11
+ includeTag
12
+ );
13
+ };
9
14
 
10
- const getLabel = (node: any) => {
11
- if (node.props.label) return node.props.label
12
- const prefix = "FU-T-"
13
- const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0
14
- let { label, type } = node.props
15
- if (includeTag) label = prefix + "dropdown"
16
- label ??= node.props.label
17
- label ??= prefix + type
15
+ export const getLabel = (node: any) => {
16
+ if (node.props.label) return node.props.label;
17
+ const prefix = "FU-T-";
18
+ const includeTag = node.type.name.indexOf("FuTableColumnDropdown") >= 0;
19
+ let {label, type} = node.props;
20
+ if (includeTag) label = prefix + "dropdown";
21
+ label ??= node.props.label;
22
+ label ??= prefix + type;
18
23
  return label;
19
- }
20
- const FuTableBody = (props: any, context: any) => {
21
- const slots = context.slots.default()
24
+ };
25
+
26
+ export const FuTableBody = (props: any, context: any) => {
27
+ let slots = context.slots.default();
22
28
  const nodes: any = [];
23
- let { columns } = props
24
- const children = slots[0].children.filter((c: any) => c.type.name !== undefined)
25
- if (!children) return nodes
26
- if (!columns || columns?.length === 0) return children
29
+ let {columns} = props;
30
+ let children = getChildren(slots);
31
+ if (!children) return nodes;
32
+ if (!columns || columns?.length === 0) return children;
27
33
  columns.forEach((col: any) => {
28
- let node = children.find((child: any) => {
29
- return col.label === getLabel(child)
30
- })
31
- if (node && (isFix(node) || col.show !== false)) {
32
- 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
+ }
33
41
  }
34
- })
35
- return nodes
36
- }
37
-
38
- export default FuTableBody;
39
-
40
-
42
+ });
43
+ return nodes;
44
+ };
@@ -33,6 +33,9 @@
33
33
  </template>
34
34
  <script lang="ts" setup>
35
35
  import { computed, getCurrentInstance } from "vue";
36
+ import { PropType } from "vue";
37
+ import { DropdownProps } from "@/tools/types";
38
+
36
39
  defineOptions({ name: "FuTableColumnDropdown" });
37
40
  const props = defineProps({
38
41
  showType: {
@@ -41,7 +44,7 @@ const props = defineProps({
41
44
  validator: (value: string) => ["always", "hover", "selected"].includes(value),
42
45
  },
43
46
  menus: {
44
- type: Array,
47
+ type: Array as PropType<DropdownProps[]>,
45
48
  default: () => [],
46
49
  },
47
50
  title: String,
@@ -56,7 +59,7 @@ const props = defineProps({
56
59
 
57
60
  });
58
61
 
59
- const instance = getCurrentInstance()
62
+ const instance = getCurrentInstance() as any
60
63
 
61
64
 
62
65
  const isShow = computed(() => {
@@ -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;