fit2cloud-ui-plus 0.0.1-beta.15 → 0.0.1-beta.16

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 (36) hide show
  1. package/lib/fit2cloud-ui-plus.es.js +31 -33
  2. package/lib/fit2cloud-ui-plus.umd.js +1 -1
  3. package/package.json +2 -2
  4. package/src/components/filter-bar/FuFilter.vue +37 -29
  5. package/src/components/filter-bar/FuFilterBar.vue +25 -16
  6. package/src/components/filter-bar/FuFilterInput.vue +45 -0
  7. package/src/components/filter-bar/index.ts +4 -4
  8. package/src/components/read-write-switch/index.d.ts +2 -0
  9. package/src/components/read-write-switch/types.d.ts +4 -0
  10. package/src/components/search-bar/FuComplexSearch.vue +170 -0
  11. package/src/components/search-bar/FuQuickSearch.vue +94 -0
  12. package/src/components/search-bar/FuSearchBar.vue +158 -0
  13. package/src/components/search-bar/FuSearchBarButton.vue +22 -0
  14. package/src/components/search-bar/FuSearchContions.vue +29 -0
  15. package/src/components/search-bar/complex-components/FuComplexDate.vue +69 -0
  16. package/src/components/search-bar/complex-components/FuComplexDateTime.vue +68 -0
  17. package/src/components/search-bar/complex-components/FuComplexInput.vue +50 -0
  18. package/src/components/search-bar/complex-components/FuComplexSelect.vue +86 -0
  19. package/src/components/search-bar/complex-components/index.js +16 -0
  20. package/src/components/search-bar/complex-components/mixins.js +26 -0
  21. package/src/components/search-bar/index.js +16 -0
  22. package/src/components/search-bar/types.ts +23 -0
  23. package/src/components/table/index.d.ts +2 -0
  24. package/src/components/table/table-column-select/utils.d.ts +8 -0
  25. package/src/components/table/types.d.ts +2 -0
  26. package/src/hooks/use-global-config/index.d.ts +1 -0
  27. package/src/hooks/use-locale/index.d.ts +14 -0
  28. package/src/hooks/use-size/index.d.ts +5 -0
  29. package/src/styles/common/variables.scss +5 -0
  30. package/src/styles/components/filter-bar.scss +6 -3
  31. package/src/styles/components/search-bar.scss +285 -0
  32. package/src/styles/components/table.scss +2 -1
  33. package/types/examples/pages/table/demo/TablePagination.vue.d.ts +1 -1
  34. package/src/.DS_Store +0 -0
  35. package/src/components/.DS_Store +0 -0
  36. package/src/components/filter-bar/FuSearchInput.vue +0 -37
@@ -0,0 +1,86 @@
1
+ <template>
2
+ <el-select class="fu-complex-select"
3
+ :placeholder="t('fu.search_bar.please_select')"
4
+ v-model="selection"
5
+ :size="size"
6
+ v-bind="$attrs"
7
+ clearable>
8
+ <el-option v-for="o in options" :key="o.value" :label="o.label" :value="o.value"></el-option>
9
+ </el-select>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import {ref, computed, PropType, inject} from "vue";
14
+ import {ComplexCondition, OptionProps, ReferenceContext, referenceKey} from "../types";
15
+ import {validateSize} from "@/tools/size";
16
+ import {useLocale} from "@/hooks"
17
+
18
+ defineOptions({name: "FuFilterSelect"});
19
+
20
+ const props = defineProps({
21
+ size: {
22
+ type: String,
23
+ validator: validateSize
24
+ },
25
+ multiple: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ label: String,
30
+ field: {
31
+ type: String,
32
+ required: true
33
+ },
34
+ options: {
35
+ type: Array as PropType<OptionProps[]>,
36
+ default: []
37
+ }
38
+ })
39
+
40
+ const selection = ref<Array<string | number> | string | number>(props.multiple ? [] : '')
41
+
42
+ const valueLabel = computed(() => {
43
+ if (Array.isArray(selection.value)) {
44
+ let values: any = []
45
+ selection.value.forEach((v: any) => {
46
+ values.push(getValueLabel(v))
47
+ })
48
+ return values.join(", ");
49
+ }
50
+ return getValueLabel(selection.value);
51
+ })
52
+
53
+ const emit = defineEmits<{ (e: 'init'): void }>()
54
+
55
+ const {t} = useLocale()
56
+
57
+ function getValueLabel(value: string | number) {
58
+ for (let o of props.options) {
59
+ if (o.value === value) {
60
+ return o.label
61
+ }
62
+ }
63
+ return value
64
+ }
65
+
66
+ function getCondition(): ComplexCondition | undefined {
67
+ if (!selection.value || (Array.isArray(selection.value) && selection.value.length === 0)) return;
68
+ let {field, label} = props
69
+ return {field, label, value: selection.value, valueLabel: valueLabel.value}
70
+ }
71
+
72
+ function init(v: any) {
73
+ selection.value = v !== undefined ? v : props.multiple ? [] : ''
74
+ emit("init")
75
+ }
76
+
77
+ const references = inject(referenceKey)
78
+ const field = props.field
79
+ const reference: ReferenceContext = {field, init, getCondition}
80
+ references?.value.push(reference)
81
+
82
+ defineExpose({
83
+ getCondition,
84
+ init,
85
+ })
86
+ </script>
@@ -0,0 +1,16 @@
1
+ import locale from "@/locale";
2
+
3
+ const components = require.context('./', true, /\.vue$/)
4
+
5
+ const FuComplexComponents = {
6
+ install: function (Vue, opts = {}) {
7
+ locale.use(opts.locale);
8
+ locale.i18n(opts.i18n);
9
+ components.keys().map(key => {
10
+ const component = components(key).default
11
+ Vue.component(component.name, component);
12
+ })
13
+ }
14
+ }
15
+
16
+ export default FuComplexComponents;
@@ -0,0 +1,26 @@
1
+ import Locale from "@/mixins/locale";
2
+ import ConfigSize from "@/mixins/config-size";
3
+ import {ComplexCondition} from "@/components/search-bar/model";
4
+
5
+ export default {
6
+ props: ConfigSize.props,
7
+ methods: {
8
+ ...Locale.methods,
9
+ createCondition(value, operator) {
10
+ this.value = value
11
+ this.operator = operator
12
+ return this.getCondition()
13
+ }
14
+ },
15
+ computed: {
16
+ ...ConfigSize.computed,
17
+ operatorLabel() {
18
+ for (let operator of this.operators) {
19
+ if (operator.value === this.operator) {
20
+ return this.t(operator.label)
21
+ }
22
+ }
23
+ return this.operator
24
+ },
25
+ }
26
+ };
@@ -0,0 +1,16 @@
1
+ import FuSearchBar from "./FuSearchBar"
2
+ import FuQuickSearch from "./FuQuickSearch"
3
+ import FuSearchBarButton from "./FuSearchBarButton"
4
+ import FuComplexComponents from "./complex-components"
5
+ import locale from "@/locale"
6
+
7
+ FuSearchBar.install = function (Vue, opts = {}) {
8
+ locale.use(opts.locale)
9
+ locale.i18n(opts.i18n)
10
+ Vue.component(FuSearchBar.name, FuSearchBar)
11
+ Vue.component(FuSearchBarButton.name, FuSearchBarButton)
12
+ Vue.component(FuQuickSearch.name, FuQuickSearch)
13
+ Vue.use(FuComplexComponents)
14
+ }
15
+
16
+ export default FuSearchBar
@@ -0,0 +1,23 @@
1
+ import {InjectionKey, Ref} from "vue";
2
+
3
+ export const referenceKey = Symbol('ReferenceKey') as unknown as InjectionKey<Ref<ReferenceContext[]>>
4
+
5
+ export interface ReferenceContext {
6
+ field: string,
7
+
8
+ init(v: any): void
9
+
10
+ getCondition(): ComplexCondition | undefined
11
+ }
12
+
13
+ export interface OptionProps {
14
+ label: string
15
+ value: string | number
16
+ }
17
+
18
+ export interface ComplexCondition {
19
+ field: string
20
+ label?: string
21
+ value: any
22
+ valueLabel?: string
23
+ }
@@ -0,0 +1,2 @@
1
+ import FuTable from "./FuTable.vue";
2
+ export default FuTable;
@@ -0,0 +1,8 @@
1
+ export declare const tableColumnSelect: (localKey: any) => {
2
+ columnsKey: import("vue").ComputedRef<string>;
3
+ dragstart: (event: DragEvent, index: any) => void;
4
+ dragenter: (event: DragEvent) => void;
5
+ dragleave: (event: DragEvent) => void;
6
+ dragend: (event: DragEvent) => void;
7
+ drop: (event: DragEvent, list: any, index: number) => void;
8
+ };
@@ -0,0 +1,2 @@
1
+ import { InjectionKey } from "vue";
2
+ export declare const LocalKey: InjectionKey<string | undefined>;
@@ -0,0 +1 @@
1
+ export declare function useGlobalConfig(key?: keyof any, defaultValue?: undefined): import("vue").Ref<any>;
@@ -0,0 +1,14 @@
1
+ import type { MaybeRef } from '@vueuse/core';
2
+ import type { Ref } from 'vue';
3
+ import type { Language } from '@/locale';
4
+ export declare type TranslatorOption = Record<string, string | number>;
5
+ export declare type Translator = (path: string, option?: TranslatorOption) => string;
6
+ export declare type LocaleContext = {
7
+ locale: Ref<Language>;
8
+ lang: Ref<string>;
9
+ t: Translator;
10
+ };
11
+ export declare const buildTranslator: (locale: MaybeRef<Language>) => Translator;
12
+ export declare const translate: (path: string, option: undefined | TranslatorOption, locale: Language) => string;
13
+ export declare const buildLocaleContext: (locale: MaybeRef<Language>) => LocaleContext;
14
+ export declare const useLocale: () => LocaleContext;
@@ -0,0 +1,5 @@
1
+ import type { ComputedRef } from 'vue';
2
+ import type { ComponentSize } from '@/tools/size';
3
+ import type { MaybeRef } from '@vueuse/core';
4
+ export declare const useProp: <T>(name: string) => ComputedRef<T | undefined>;
5
+ export declare const useSize: (fallback?: MaybeRef<ComponentSize | undefined>, ignore?: Partial<Record<'prop' | 'global', boolean>>) => ComputedRef<string>;
@@ -16,6 +16,11 @@
16
16
  // fit2cloud ui variables
17
17
  $table-header-bgColor: #F5F6F7 !default;
18
18
 
19
+ $fu-search-bar-width: 100% !default;
20
+ $fu-search-bar-height: 48px !default;
21
+ $fu-search-bar-condition-color: #424242 !default;
22
+ $fu-search-bar-condition-bgColor: #E6E6E6 !default;
23
+
19
24
  $filter-color: #646A73 !default;
20
25
  $filter-drawer-color: #646A73 !default;
21
26
  $filter-condition-color: #0C296E !default;
@@ -19,9 +19,8 @@
19
19
  }
20
20
  }
21
21
 
22
- @include b(search-input) {
22
+ @include b(filter-input) {
23
23
  width: 240px;
24
- margin-right: 10px;
25
24
  .el-input__prefix, .el-input__suffix {
26
25
  .el-input__icon {
27
26
  color: $filter-color;
@@ -34,6 +33,10 @@
34
33
  // }
35
34
  }
36
35
 
36
+ @include b(filter-button) {
37
+ margin-left: 12px;
38
+ }
39
+
37
40
  @include b(filter) {
38
41
  display: flex;
39
42
  align-items: center;
@@ -111,7 +114,7 @@
111
114
  bottom: 0;
112
115
  width: 100%;
113
116
  height: 72px;
114
- padding: 0 24px;
117
+ right: 20px;
115
118
  display: flex;
116
119
  justify-content: flex-end;
117
120
  align-items: center;
@@ -0,0 +1,285 @@
1
+ @use "../common/mixins.scss" as *;
2
+ @use "../common/variables.scss" as *;
3
+
4
+ @include b(search-bar) {
5
+ @include flex-row(flex-start, center);
6
+ position: relative;
7
+ width: $fu-search-bar-width;
8
+ height: $fu-search-bar-height;
9
+
10
+ &:after {
11
+ content: "";
12
+ position: absolute;
13
+ bottom: 0;
14
+ left: 0;
15
+ height: 1px;
16
+ width: 100%;
17
+ background-color: #D5D5D5;
18
+ }
19
+
20
+ @include e(content) {
21
+ @include flex-row(flex-start, center);
22
+ margin-right: 10px;
23
+ height: 100%;
24
+ }
25
+
26
+ @include e(buttons) {
27
+ @include flex-row(flex-end, center);
28
+ flex: auto;
29
+ height: 100%;
30
+ }
31
+
32
+ @include b(quick-search) {
33
+ &:after {
34
+ content: none;
35
+ }
36
+ }
37
+ }
38
+
39
+ @include b(search-bar-button) {
40
+ &.el-button {
41
+ @include active-scale(0.9);
42
+ }
43
+ }
44
+
45
+ @include b(search-conditions) {
46
+ @include flex-row(flex-start, center);
47
+ overflow-x: auto;
48
+ overflow-y: hidden;
49
+ height: calc(100% - 2px);
50
+
51
+ &::-webkit-scrollbar {
52
+ height: 6px;
53
+ }
54
+
55
+ &::-webkit-scrollbar-thumb {
56
+ border-radius: 5px;
57
+ }
58
+
59
+ &::-webkit-scrollbar-track {
60
+ border-radius: 5px;
61
+ }
62
+
63
+ @include m(medium) {
64
+ font-size: 14px;
65
+
66
+ @include e(item) {
67
+ height: 28px;
68
+ }
69
+ }
70
+
71
+ @include m(small) {
72
+ font-size: 13px;
73
+
74
+ @include e(item) {
75
+ height: 26px;
76
+ }
77
+ }
78
+
79
+ @include m(mini) {
80
+ font-size: 12px;
81
+
82
+ @include e(item) {
83
+ height: 24px;
84
+ }
85
+ }
86
+
87
+ @include e(item) {
88
+ @include flex-row(flex-start, center);
89
+ flex-shrink: 0;
90
+ position: relative;
91
+ box-sizing: border-box;
92
+ padding: 0 10px;
93
+ border-radius: 50px;
94
+ color: $fu-search-bar-condition-color;
95
+ background-color: $fu-search-bar-condition-bgColor;
96
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .2), 0 1px 1px 0 rgba(0, 0, 0, .14), 0 2px 1px -1px rgba(0, 0, 0, .12);
97
+ margin-left: 10px;
98
+ font-size: inherit;
99
+
100
+ &:last-child {
101
+ margin-right: 10px;
102
+ }
103
+
104
+ div + div {
105
+ margin-left: 4px;
106
+ }
107
+
108
+ .condition-value {
109
+ font-style: italic;
110
+ }
111
+
112
+ .condition-remove {
113
+ @include active-scale(0.9);
114
+ margin-left: 6px;
115
+ margin-right: -6px;
116
+ cursor: pointer;
117
+
118
+ &:hover {
119
+ color: var(--el-color-primary);
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ @include b(quick-search) {
126
+ @include flex-row(flex-start, center);
127
+ min-width: 200px;
128
+ position: relative;
129
+
130
+ @include m(medium) {
131
+ font-size: 14px;
132
+ }
133
+
134
+ @include m(small) {
135
+ font-size: 13px;
136
+ }
137
+
138
+ @include m(mini) {
139
+ font-size: 12px;
140
+ }
141
+
142
+ &:after {
143
+ content: "";
144
+ position: absolute;
145
+ bottom: 0;
146
+ left: 0;
147
+ height: 1px;
148
+ width: 100%;
149
+ background-color: #D5D5D5;
150
+ }
151
+
152
+ input {
153
+ border: none;
154
+ position: relative;
155
+ font-size: inherit;
156
+ padding: 10px;
157
+ width: 200px;
158
+ box-sizing: border-box;
159
+ color: var(--el-input-text-color);
160
+ background-color: var(--el-input-bg-color);
161
+
162
+ &:focus {
163
+ outline: none;
164
+ }
165
+
166
+ &::placeholder {
167
+ color: var(--el-input-placeholder-color);
168
+ }
169
+ }
170
+
171
+ .clean-button {
172
+ @include active-scale;
173
+ cursor: pointer;
174
+
175
+ &:hover {
176
+ color: var(--el-color-primary);
177
+ }
178
+ }
179
+ }
180
+
181
+ @include b(complex-search) {
182
+ @include e(trigger) {
183
+ i {
184
+ transition: transform 0.2s;
185
+ }
186
+
187
+ @include when(active) {
188
+ i {
189
+ transform: rotate(90deg);
190
+ }
191
+ }
192
+ }
193
+ }
194
+
195
+ @include b(complex-components) {
196
+ @include e(body) {
197
+ width: 100%;
198
+ margin: 5px;
199
+ min-width: 200px;
200
+ }
201
+
202
+ @include e(footer) {
203
+ width: 100%;
204
+ text-align: center;
205
+ margin: 5px 0;
206
+ }
207
+ }
208
+
209
+ @include b(operator-component) {
210
+ @include flex-row(flex-start, center);
211
+ padding: 5px;
212
+
213
+ @include e(label) {
214
+ text-align: left;
215
+ width: 120px;
216
+ padding: 0 5px;
217
+ flex-grow: 0;
218
+ flex-shrink: 0;
219
+ font-size: inherit;
220
+
221
+ @include m(small) {
222
+ width: 100px;
223
+ font-size: 13px;
224
+ }
225
+
226
+ @include m(mini) {
227
+ width: 100px;
228
+ font-size: 12px;
229
+ }
230
+ }
231
+
232
+ @include e(operator) {
233
+ padding: 0 5px;
234
+ width: 120px;
235
+ flex-grow: 0;
236
+ flex-shrink: 0;
237
+ }
238
+
239
+ @include e(value) {
240
+ padding: 0 5px;
241
+ flex-grow: 1;
242
+ min-width: 240px;
243
+ }
244
+ }
245
+
246
+ @include b(complex-select) {
247
+ &.el-select {
248
+ width: 100% !important;
249
+ }
250
+ }
251
+
252
+ @include b(complex-data) {
253
+ &.el-date-editor {
254
+ width: 100% !important;
255
+ }
256
+ }
257
+
258
+ @include b(complex-data-time) {
259
+ &.el-date-editor {
260
+ width: 100% !important;
261
+ }
262
+ }
263
+
264
+ @include b(complex-input-number) {
265
+ margin-right: -10px;
266
+ display: flex;
267
+ align-items: center;
268
+
269
+ @include e(input) {
270
+ .is-hide {
271
+ .el-input-number__decrease {
272
+ visibility: hidden;
273
+ }
274
+
275
+ .el-input-number__increase {
276
+ visibility: hidden;
277
+ }
278
+ }
279
+
280
+ }
281
+
282
+ .range-separator {
283
+ margin: 0 8px
284
+ }
285
+ }
@@ -67,7 +67,8 @@
67
67
 
68
68
  @include b(table-more-button) {
69
69
  button+& {
70
- margin-left: 10px;
70
+ margin-left: 12px;
71
+ vertical-align: middle;
71
72
  }
72
73
  }
73
74
 
@@ -1,2 +1,2 @@
1
- declare var _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
2
  export default _default;
package/src/.DS_Store DELETED
Binary file
Binary file
@@ -1,37 +0,0 @@
1
- <template>
2
- <el-input class="fu-search-input" prefix-icon="Search" v-model="quick" @input="input" @blur="blur" @keydown="keydown"
3
- v-bind="$attrs" clearable :size="size"/>
4
- </template>
5
-
6
- <script setup lang="ts">
7
- import { ref, watch } from "vue";
8
- import { validateSize } from "@/tools/size";
9
- defineOptions({ name: "FuSearchInput" });
10
-
11
- const props = defineProps({
12
- size: {
13
- type: String,
14
- validator: validateSize
15
- },
16
- value: String,
17
- })
18
- const emit = defineEmits(["input", "change"])
19
- const quick = ref("")
20
-
21
- watch(() => props.value, (val: any) => {
22
- quick.value = val
23
- })
24
-
25
- function input(e: Event) {
26
- emit("input", quick.value, e)
27
- }
28
- function blur(e: Event) {
29
- emit("change", quick.value, e)
30
- }
31
- function keydown(e: Event) {
32
- const event = e as KeyboardEvent
33
- if (event.key === "Enter") {
34
- emit("change", quick.value, e)
35
- }
36
- }
37
- </script>