fit2cloud-ui-plus 0.0.1-beta.1 → 0.0.1-beta.12
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.
- package/README.md +61 -9
- package/lib/fit2cloud-ui-plus.es.js +553 -866
- package/lib/fit2cloud-ui-plus.umd.js +1 -1
- package/package.json +9 -12
- package/src/components/filter-bar/FuFilter.vue +19 -14
- package/src/components/filter-bar/FuFilterBar.vue +16 -11
- package/src/components/filter-bar/FuSearchInput.vue +8 -2
- package/src/components/filter-bar/filter-components/FuFilterDate.vue +17 -13
- package/src/components/filter-bar/filter-components/FuFilterDateTime.vue +16 -13
- package/src/components/filter-bar/filter-components/FuFilterSelect.vue +17 -12
- package/src/components/filter-bar/index.d.ts +2 -0
- package/src/components/filter-bar/index.ts +11 -12
- package/src/components/filter-bar/types.d.ts +22 -0
- package/src/components/read-write-switch/FuInputRwSwitch.vue +9 -5
- package/src/components/read-write-switch/FuReadWriteSwitch.vue +38 -36
- package/src/components/read-write-switch/FuSelectRwSwitch.vue +11 -7
- package/src/components/read-write-switch/index.d.ts +2 -0
- package/src/components/read-write-switch/types.d.ts +4 -0
- package/src/components/read-write-switch/types.ts +4 -0
- package/src/components/speed-dial/FuSpeedDial.vue +78 -69
- package/src/components/speed-dial/FuSpeedDial.vue.d.ts +218 -0
- package/src/components/speed-dial/FuSpeedDialActionButton.vue +55 -55
- package/src/components/speed-dial/FuSpeedDialActionButton.vue.d.ts +32 -0
- package/src/components/speed-dial/FuSpeedDialButton.vue +14 -11
- package/src/components/speed-dial/FuSpeedDialButton.vue.d.ts +42 -0
- package/src/components/speed-dial/FuSpeedDialItem.vue +9 -15
- package/src/components/speed-dial/FuSpeedDialItem.vue.d.ts +12 -0
- package/src/components/speed-dial/index.d.ts +2 -0
- package/src/components/speed-dial/types.d.ts +8 -0
- package/src/components/speed-dial/types.ts +12 -0
- package/src/components/split-pane/FuSplitPane.vue +3 -3
- package/src/components/split-pane/FuSplitPane.vue.d.ts +59 -0
- package/src/components/split-pane/index.d.ts +2 -0
- package/src/components/table/FuTable.vue +16 -25
- package/src/components/table/FuTableBody.ts +38 -34
- package/src/components/table/{table-column-dropdown/FuTableColumnDropdown.vue → FuTableColumnDropdown.vue} +5 -2
- package/src/components/table/index.d.ts +2 -0
- package/src/components/table/index.ts +11 -7
- package/src/components/table/table-column-select/FuTableColumnSelectDialog.vue +15 -20
- package/src/components/table/table-column-select/FuTableColumnSelectPopover.vue +12 -11
- package/src/components/table/table-column-select/utils.d.ts +8 -0
- package/src/components/table/table-column-select/utils.ts +10 -7
- package/src/components/table/table-operations/FuTableButton.vue +1 -4
- package/src/components/table/table-operations/FuTableMoreButton.vue +5 -3
- package/src/components/table/table-operations/FuTableOperations.vue +6 -7
- package/src/components/table/types.d.ts +2 -0
- package/src/components/table/types.ts +3 -0
- package/src/components/tabs/FuTabs.vue +4 -2
- package/src/components/tabs/FuTabs.vue.d.ts +54 -0
- package/src/components/tabs/index.d.ts +2 -0
- package/src/hooks/index.d.ts +3 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-global-config/index.d.ts +1 -0
- package/src/hooks/use-global-config/index.ts +0 -15
- package/src/hooks/use-locale/index.d.ts +14 -0
- package/src/hooks/use-size/index.d.ts +5 -0
- package/src/hooks/use-size/index.ts +29 -0
- package/src/index.d.ts +7 -0
- package/src/locale/index.d.ts +10 -0
- package/src/locale/lang/en.d.ts +59 -0
- package/src/locale/lang/zh-cn.d.ts +59 -0
- package/src/locale/lang/zh-tw.d.ts +59 -0
- package/src/styles/common/variables.scss +2 -6
- package/src/styles/components/filter-bar.scss +3 -3
- package/src/styles/components/speed-dial.scss +1 -51
- package/src/styles/components/split-pane.scss +1 -1
- package/src/styles/components/steps.scss +2 -2
- package/src/styles/components/table.scss +3 -5
- package/src/styles/components/tabs.scss +1 -1
- package/src/styles/index.scss +0 -1
- package/src/tools/size.d.ts +4 -0
- package/src/tools/size.ts +6 -0
- package/src/tools/theme.d.ts +1 -0
- package/src/tools/theme.ts +0 -12
- package/src/tools/time.d.ts +2 -0
- package/src/tools/types.d.ts +8 -0
- package/src/tools/types.ts +9 -0
- package/src/tools/utils.d.ts +2 -0
- package/src/tools/utils.ts +36 -36
- package/src/tools/vnode.d.ts +9 -0
- package/src/tools/vnode.ts +47 -0
- package/types/examples/App.vue.d.ts +2 -0
- package/types/examples/components/CodeExample.vue.d.ts +29 -0
- package/types/examples/components/DocumentTable.vue.d.ts +14 -0
- package/types/examples/components/Markdown.vue.d.ts +12 -0
- package/types/examples/layout/components/AppHeader.vue.d.ts +2 -0
- package/types/examples/layout/components/Sidebar.vue.d.ts +2 -0
- package/types/examples/layout/index.vue.d.ts +2 -0
- package/types/examples/main.d.ts +2 -0
- package/types/examples/pages/filter-bar/attributes.d.ts +63 -0
- package/types/examples/pages/filter-bar/demo/BaseFilterBar.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/demo/SetConditionsDemo.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/demo/SlotDemo.vue.d.ts +2 -0
- package/types/examples/pages/filter-bar/index.vue.d.ts +2 -0
- package/types/examples/pages/index.d.ts +3 -0
- package/types/examples/pages/read-write-switch/attributes.d.ts +63 -0
- package/types/examples/pages/read-write-switch/demo/BaseDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/CustomContentDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/InputRwSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/ReadSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/SelectRwSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/TableInnerEditDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/demo/WriteSwitchDemo.vue.d.ts +2 -0
- package/types/examples/pages/read-write-switch/index.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/attributes.d.ts +63 -0
- package/types/examples/pages/speed-dial/demo/BaseSpeedDial.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialCustom.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialPosition.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/demo/SpeedDialTrigger.vue.d.ts +2 -0
- package/types/examples/pages/speed-dial/index.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/attributes.d.ts +63 -0
- package/types/examples/pages/split-pane/demo/BaseSplit.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/CustomResizer.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/NestSplit.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/demo/ResizerType.vue.d.ts +2 -0
- package/types/examples/pages/split-pane/index.vue.d.ts +2 -0
- package/types/examples/pages/table/attributes.d.ts +121 -0
- package/types/examples/pages/table/demo/BaseTable.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/DropdownColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/DropdownColumnSlot.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/SaveSelectColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/SelectColumn.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/TableOperations.vue.d.ts +2 -0
- package/types/examples/pages/table/demo/TablePagination.vue.d.ts +2 -0
- package/types/examples/pages/table/index.vue.d.ts +2 -0
- package/types/examples/pages/tabs/attributes.d.ts +63 -0
- package/types/examples/pages/tabs/demo/AddCloseTab.vue.d.ts +2 -0
- package/types/examples/pages/tabs/index.vue.d.ts +2 -0
- package/types/examples/router/doc-routes.d.ts +12 -0
- package/types/examples/router/index.d.ts +4 -0
- package/types/plugins/example-transform.d.ts +5 -0
- package/types/src/components/filter-bar/FuFilter.vue.d.ts +39 -0
- package/types/src/components/filter-bar/FuFilterBar.vue.d.ts +22 -0
- package/types/src/components/filter-bar/FuFilterConditions.vue.d.ts +8 -0
- package/types/src/components/filter-bar/FuSearchInput.vue.d.ts +17 -0
- package/types/src/components/filter-bar/filter-components/FuFilterDate.vue.d.ts +36 -0
- package/types/src/components/filter-bar/filter-components/FuFilterDateTime.vue.d.ts +36 -0
- package/types/src/components/filter-bar/filter-components/FuFilterOption.vue.d.ts +24 -0
- package/types/src/components/filter-bar/filter-components/FuFilterSelect.vue.d.ts +66 -0
- package/types/src/components/filter-bar/index.d.ts +2 -0
- package/types/src/components/filter-bar/types.d.ts +22 -0
- package/types/src/components/read-write-switch/FuInputRwSwitch.vue.d.ts +21 -0
- package/types/src/components/read-write-switch/FuReadWriteSwitch.vue.d.ts +23 -0
- package/types/src/components/read-write-switch/FuSelectRwSwitch.vue.d.ts +33 -0
- package/types/src/components/read-write-switch/index.d.ts +2 -0
- package/types/src/components/read-write-switch/types.d.ts +4 -0
- package/types/src/components/speed-dial/FuSpeedDial.vue.d.ts +218 -0
- package/types/src/components/speed-dial/FuSpeedDialActionButton.vue.d.ts +32 -0
- package/types/src/components/speed-dial/FuSpeedDialButton.vue.d.ts +42 -0
- package/types/src/components/speed-dial/FuSpeedDialItem.vue.d.ts +12 -0
- package/types/src/components/speed-dial/index.d.ts +2 -0
- package/types/src/components/speed-dial/types.d.ts +8 -0
- package/types/src/components/split-pane/FuSplitPane.vue.d.ts +59 -0
- package/types/src/components/split-pane/index.d.ts +2 -0
- package/types/src/components/table/FuTable.vue.d.ts +18 -0
- package/types/src/components/table/FuTableBody.d.ts +3 -0
- package/types/src/components/table/FuTableColumnDropdown.vue.d.ts +50 -0
- package/types/src/components/table/FuTablePagination.vue.d.ts +47 -0
- package/types/src/components/table/index.d.ts +2 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelect.vue.d.ts +10 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelectDialog.vue.d.ts +23 -0
- package/types/src/components/table/table-column-select/FuTableColumnSelectPopover.vue.d.ts +34 -0
- package/types/src/components/table/table-column-select/utils.d.ts +8 -0
- package/types/src/components/table/table-operations/FuTableButton.vue.d.ts +13 -0
- package/types/src/components/table/table-operations/FuTableMoreButton.vue.d.ts +37 -0
- package/types/src/components/table/table-operations/FuTableOperations.vue.d.ts +46 -0
- package/types/src/components/table/types.d.ts +2 -0
- package/types/src/components/tabs/FuTabs.vue.d.ts +54 -0
- package/types/src/components/tabs/index.d.ts +2 -0
- package/types/src/hooks/index.d.ts +3 -0
- package/types/src/hooks/use-global-config/index.d.ts +1 -0
- package/types/src/hooks/use-locale/index.d.ts +14 -0
- package/types/src/hooks/use-size/index.d.ts +5 -0
- package/types/src/index.d.ts +7 -0
- package/types/src/locale/index.d.ts +10 -0
- package/types/src/locale/lang/en.d.ts +59 -0
- package/types/src/locale/lang/zh-cn.d.ts +59 -0
- package/types/src/locale/lang/zh-tw.d.ts +59 -0
- package/types/src/tools/size.d.ts +4 -0
- package/types/src/tools/theme.d.ts +1 -0
- package/types/src/tools/time.d.ts +2 -0
- package/types/src/tools/types.d.ts +8 -0
- package/types/src/tools/utils.d.ts +2 -0
- package/types/src/tools/vnode.d.ts +9 -0
- package/src/components/search-bar/FuComplexSearch.vue +0 -108
- package/src/components/search-bar/FuQuickSearch.vue +0 -43
- package/src/components/search-bar/FuSearchBar.vue +0 -165
- package/src/components/search-bar/FuSearchBarButton.vue +0 -14
- package/src/components/search-bar/FuSearchContions.vue +0 -24
- package/src/components/search-bar/index.ts +0 -13
- package/src/components/search-bar/store.ts +0 -25
- package/src/components/steps/FuHorizontalNavigation.vue +0 -18
- package/src/components/steps/FuHorizontalSteps.vue +0 -94
- package/src/components/steps/FuStep.vue +0 -13
- package/src/components/steps/FuSteps.vue +0 -22
- package/src/components/steps/FuStepsFooter.ts +0 -79
- package/src/components/steps/FuVerticalNavigation.vue +0 -35
- package/src/components/steps/FuVerticalSteps.vue +0 -79
- package/src/components/steps/Stepper.ts +0 -188
- package/src/components/steps/index.ts +0 -11
- package/src/components/table/table-column-dropdown/index.ts +0 -7
- package/src/components/table/table-column-select/index.ts +0 -8
- package/src/components/table/table-operations/index.ts +0 -12
- package/src/components/virtual-scroller/FuVirtualHorizontalScroll.js +0 -96
- package/src/components/virtual-scroller/FuVirtualScroll.js +0 -15
- package/src/components/virtual-scroller/FuVirtualVerticalScroll.js +0 -95
- package/src/components/virtual-scroller/index.js +0 -10
- package/src/styles/components/search-bar.scss +0 -285
|
@@ -2,24 +2,28 @@
|
|
|
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
|
-
<!--
|
|
6
|
-
<el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs"
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
<!--configSize-->
|
|
6
|
+
<el-date-picker class="fu-filter-date" v-model="value" v-bind="$attrs" :size="size"
|
|
7
|
+
:placeholder="t('fu.search_bar.select_date')" type="daterange" :value-format="valueFormat"
|
|
8
|
+
:start-placeholder="t('fu.search_bar.start_date')" :end-placeholder="t('fu.search_bar.end_date')">
|
|
9
9
|
</el-date-picker>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
|
-
import {ref, computed, inject} from "vue";
|
|
16
|
-
import {FilterCondition, ReferenceContext, referenceKey} from "../types";
|
|
17
|
-
import {dateFormat} from "@/tools/time";
|
|
18
|
-
import {useLocale} from "@/hooks"
|
|
15
|
+
import { ref, computed, inject } from "vue";
|
|
16
|
+
import { FilterCondition, ReferenceContext, referenceKey } from "../types";
|
|
17
|
+
import { dateFormat } from "@/tools/time";
|
|
18
|
+
import { useLocale } from "@/hooks"
|
|
19
|
+
import { validateSize } from "@/tools/size";
|
|
19
20
|
defineOptions({ name: "FuFilterDate" });
|
|
20
|
-
const {t} = useLocale()
|
|
21
|
-
|
|
21
|
+
const { t } = useLocale()
|
|
22
22
|
const props = defineProps({
|
|
23
|
+
size: {
|
|
24
|
+
type: String,
|
|
25
|
+
validator: validateSize
|
|
26
|
+
},
|
|
23
27
|
label: String,
|
|
24
28
|
field: {
|
|
25
29
|
type: String,
|
|
@@ -42,8 +46,8 @@ const valueLabel = computed(() => {
|
|
|
42
46
|
|
|
43
47
|
function getCondition(): FilterCondition | undefined {
|
|
44
48
|
if (!String(value.value)) return;
|
|
45
|
-
let {field, label} = props
|
|
46
|
-
return {field, label, value: value.value, valueLabel: valueLabel.value}
|
|
49
|
+
let { field, label } = props
|
|
50
|
+
return { field, label, value: value.value, valueLabel: valueLabel.value }
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
function init(v: any) {
|
|
@@ -52,7 +56,7 @@ function init(v: any) {
|
|
|
52
56
|
|
|
53
57
|
const references = inject(referenceKey)
|
|
54
58
|
const field = props.field
|
|
55
|
-
const reference: ReferenceContext = {field, init, getCondition}
|
|
59
|
+
const reference: ReferenceContext = { field, init, getCondition }
|
|
56
60
|
references?.value.push(reference)
|
|
57
61
|
|
|
58
62
|
defineExpose({
|
|
@@ -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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
7
|
+
trigger="click" width="240">
|
|
8
8
|
<el-select v-model="selection" v-bind="$attrs" :multiple="multiple" @change="change" :teleported="false"
|
|
9
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InjectionKey, Ref } from "vue";
|
|
2
|
+
export declare const selectKey: InjectionKey<SelectContext>;
|
|
3
|
+
export interface SelectContext {
|
|
4
|
+
selection: Ref<Array<string | number> | string | number>;
|
|
5
|
+
setSelected(value: string | number, selected: boolean): void;
|
|
6
|
+
}
|
|
7
|
+
export declare const referenceKey: InjectionKey<Ref<ReferenceContext[]>>;
|
|
8
|
+
export interface ReferenceContext {
|
|
9
|
+
field: string;
|
|
10
|
+
init(v: any): void;
|
|
11
|
+
getCondition(): FilterCondition | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface OptionProps {
|
|
14
|
+
label: string;
|
|
15
|
+
value: string | number;
|
|
16
|
+
}
|
|
17
|
+
export interface FilterCondition {
|
|
18
|
+
field: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
value: any;
|
|
21
|
+
valueLabel?: string;
|
|
22
|
+
}
|
|
@@ -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
|
-
|
|
17
|
+
modelValue: [String, Number],
|
|
16
18
|
writeTrigger: {
|
|
17
19
|
type: String,
|
|
18
|
-
default: "
|
|
20
|
+
default: "onClick",
|
|
19
21
|
validator: (value: string) => {
|
|
20
|
-
return ['
|
|
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.
|
|
28
|
+
const data = ref(props.modelValue)
|
|
27
29
|
|
|
28
|
-
watch(() => props.
|
|
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 {
|
|
3
|
-
import {
|
|
2
|
+
import {ref, watch, defineComponent, h, nextTick} from 'vue'
|
|
3
|
+
import {uuid} from "@/tools/utils"
|
|
4
4
|
|
|
5
|
-
const TRIGGERS = ['manual', '
|
|
5
|
+
const TRIGGERS = ['manual', 'onClick', 'onDblclick']
|
|
6
6
|
|
|
7
7
|
export default defineComponent({
|
|
8
8
|
name: "FuReadWriteSwitch",
|
|
9
9
|
props: {
|
|
10
|
-
|
|
10
|
+
modelValue: Boolean,
|
|
11
11
|
data: [String, Number, Boolean],
|
|
12
12
|
writeTrigger: {
|
|
13
13
|
type: String,
|
|
14
|
-
default: "
|
|
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, {
|
|
21
|
+
setup(props, {slots, emit}) {
|
|
22
22
|
const id = ref(uuid())
|
|
23
|
-
const write = ref(props.
|
|
24
|
-
watch(() => props.
|
|
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("
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
74
|
+
// 读状态内容,提供切换到写状态的方法
|
|
75
|
+
if (!write.value && slots.read) {
|
|
76
|
+
children = slots.read({
|
|
77
|
+
write: switchWrite
|
|
78
|
+
})
|
|
79
|
+
}
|
|
86
80
|
|
|
87
|
-
|
|
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
|
-
|
|
24
|
-
options:
|
|
24
|
+
modelValue: [String, Number],
|
|
25
|
+
options: {
|
|
26
|
+
type: Array as PropType<OptionProps[]>,
|
|
27
|
+
default: []
|
|
28
|
+
},
|
|
25
29
|
writeTrigger: {
|
|
26
30
|
type: String,
|
|
27
|
-
default: "
|
|
31
|
+
default: "onClick",
|
|
28
32
|
validator: (value: string) => {
|
|
29
|
-
return ['
|
|
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.
|
|
38
|
+
const data = ref(props.modelValue)
|
|
35
39
|
|
|
36
|
-
watch(() => props.
|
|
40
|
+
watch(() => props.modelValue, (v) => {
|
|
37
41
|
data.value = v
|
|
38
42
|
})
|
|
39
43
|
function input(e: Event) {
|