@94ai/nf-search-form 3.1.13

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.
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <div class="nf-time-range">
3
+ <el-time-select
4
+ v-model="startTime"
5
+ v-bind="inputAttrStart"
6
+ :placeholder="startPlaceholder"
7
+ class="nf-time-range-el-time-select"
8
+ v-on="inputlistens"
9
+ />
10
+ <span class="symbol">~</span>
11
+ <el-time-select
12
+ v-model="endTime"
13
+ v-bind="inputAttrEnd"
14
+ :placeholder="endPlaceholder"
15
+ class="nf-time-range-el-time-select"
16
+ v-on="inputlistens"
17
+ />
18
+ </div>
19
+ </template>
20
+
21
+
22
+ <script lang="ts">
23
+ import { defineComponent } from 'vue-demi'
24
+
25
+ export default defineComponent({
26
+ name: "NfTimeRange",
27
+ })
28
+ </script>
29
+
30
+
31
+ <script lang="ts" setup>
32
+ import {
33
+ computed,
34
+ getCurrentInstance,
35
+ ref,
36
+ watch
37
+ } from 'vue-demi'
38
+
39
+ const props = withDefaults(defineProps<{
40
+ value?: string[],
41
+ endPlaceholder: string
42
+ startPlaceholder: string
43
+ }>(), {
44
+ value: () => [],
45
+ endPlaceholder: '结束时间',
46
+ startPlaceholder: '开始时间'
47
+ })
48
+
49
+ const emit = defineEmits<{
50
+ (e: 'input', event: [string | undefined, string | undefined]): void
51
+ (e: 'change', event: [string | undefined, string | undefined]): void
52
+ }>()
53
+
54
+ const startTime = ref<string>()
55
+ const endTime = ref<string>()
56
+
57
+ const instace = getCurrentInstance()?.proxy
58
+
59
+ const inputlistens = computed(() => {
60
+ const list = Object.assign({},
61
+ instace?.$listeners,
62
+ {
63
+ change: function() {
64
+ emit('change', [startTime.value, endTime.value])
65
+ }
66
+ }
67
+ )
68
+ delete list.input
69
+ return list
70
+ })
71
+ const inputAttrStart = computed(() => {
72
+ const attrs = instace?.$attrs
73
+ delete attrs?.type
74
+ const pickerOptions = attrs?.['picker-options'] || {}
75
+ return {
76
+ ...(attrs || {}),
77
+ 'picker-options': {
78
+ ...pickerOptions
79
+ }
80
+ }
81
+ })
82
+ const inputAttrEnd = computed(() =>{
83
+ const attrs = instace?.$attrs
84
+ delete attrs?.type
85
+ const pickerOptions = attrs?.['picker-options'] || {}
86
+
87
+ return {
88
+ ...attrs,
89
+ 'picker-options': {
90
+ ...pickerOptions,
91
+ minTime: startTime.value
92
+ }
93
+ }
94
+ })
95
+
96
+
97
+ watch(() => {
98
+ return props.value
99
+ }, () => {
100
+ startTime.value = props.value?.[0]
101
+ endTime.value = props.value?.[1]
102
+ }, {
103
+ deep: true,
104
+ immediate: true
105
+ })
106
+
107
+ watch(() => {
108
+ return startTime.value
109
+ }, () => {
110
+ if (startTime.value && endTime.value) {
111
+ const [h1, m1] = String(startTime.value).split(":");
112
+ const [h2, m2] = String(endTime.value).split(":");
113
+ const t1 = new Date();
114
+ t1.setHours(Number(h1), Number(m1));
115
+ const t2 = new Date();
116
+ t2.setHours(Number(h2), Number(m2));
117
+ if (t1.getTime() > t2.getTime()) {
118
+ endTime.value = undefined
119
+ }
120
+ }
121
+ emit('input', [startTime.value, endTime.value])
122
+ })
123
+ watch(() => {
124
+ return endTime.value
125
+ }, () => {
126
+ emit('input', [startTime.value, endTime.value])
127
+ })
128
+ </script>
@@ -0,0 +1 @@
1
+ import '@94ai/nf-theme-chalk/lib/css/nf-search-form.css'
@@ -0,0 +1 @@
1
+ import '@94ai/nf-theme-chalk/lib/nf-search-form.scss'
@@ -0,0 +1,97 @@
1
+ export type NfSearchFormItemOption = {
2
+ /**
3
+ * 当columns为computed时,由于computed内部副作用的更改会引起computed逻辑重新执行返回columns新值,手动传入key可以在columns地址变更时增量渲染变更部分,不传会引起全量重新渲染
4
+ */
5
+ key?: string
6
+ _index?: number
7
+ __index?: number
8
+ initHidden?: boolean
9
+ destory?: boolean
10
+ /**
11
+ * nf-form-item配置
12
+ */
13
+ label?: string,
14
+ addLabel?: string,
15
+ prop?: string,
16
+ width?: string,
17
+ isShowColon?: boolean,
18
+ hidden?: boolean,
19
+ required?: boolean,
20
+ rules?: Record<string, any>,
21
+ size?: 'medium' | 'small' | 'mini'
22
+ labelWidth?: string
23
+ 'is-range'?: boolean,
24
+ showMessage?: boolean,
25
+ inlineMessage?: boolean,
26
+ /**
27
+ * 设置SearchItem显示所属分类
28
+ */
29
+ category?: string,
30
+ /**
31
+ * 设置SearchFormModel初始值
32
+ */
33
+ initValue?: any,
34
+ /**
35
+ * 定制化SearchItem插槽
36
+ */
37
+ slot?: string,
38
+ /**
39
+ * 定制化labelSlot
40
+ */
41
+ labelSlot?: string,
42
+ /**
43
+ * 定制化SearchItem类名
44
+ */
45
+ class?: string,
46
+ /**
47
+ * 定制化SearchItem?提示
48
+ */
49
+ tooltip?: {
50
+ slot: string,
51
+ },
52
+ /**
53
+ * 时间类范围类型
54
+ */
55
+ type?: 'monthrange' | 'datetimerange' |
56
+ 'daterange' | 'yearrange' |
57
+ 'halfyearrange' | 'quarterrange' |
58
+ 'date' | 'month' | 'week' | 'dates',
59
+ /**
60
+ * 所有支持的element类型
61
+ */
62
+ element?: 'el-input' | 'el-select' | 'custom-select' | 'ai-select' | 'ai-custom-select' | 'nf-lazy-select' |
63
+ 'el-input-number' | 'el-date-picker' |
64
+ 'el-cascader' | 'el-time-select' |
65
+ 'el-time-picker' | 'number-range' |
66
+ 'nf-date-picker' |
67
+ 'nf-quarter-picker' | 'nf-half-year-picker' |
68
+ 'nf-double-year' | 'nf-double-week' |
69
+ 'nf-double-half-year' | 'nf-double-quarter' | 'nf-transfer-select',
70
+ /**
71
+ * 支持所有element类型的element组件的配置时间
72
+ */
73
+ events?: Record<string, Function>,
74
+ /**
75
+ * 支持所有element类型的element组件的配置属性,如以下
76
+ */
77
+ placeholder?: string,
78
+ virtualList?: boolean,
79
+ 'controls-position'?: 'right' | 'left',
80
+ clearable?: boolean
81
+ startPlaceholder?: string
82
+ rangeSeparator?: string
83
+ endPlaceholder?: string
84
+ defaultTime?: string[]
85
+ options?: {
86
+ label: string,
87
+ value: string | number
88
+ }[],
89
+ 'picker-options'?: {
90
+ start: string,
91
+ step: string,
92
+ end: string
93
+ },
94
+ valueFormat?: string
95
+ min?: 0,
96
+ // ...
97
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@94ai/nf-search-form",
3
+ "version": "3.1.13",
4
+ "description": "> TODO: description",
5
+ "keywords": [],
6
+ "author": "zoujiahe <zoujiahe@94ai.com>",
7
+ "homepage": "https://oss.xccjh.top/common-ui/#/ai-index",
8
+ "license": "ISC",
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
+ },
16
+ "dependencies": {
17
+ "@94ai/common-utils": "^3.1.13",
18
+ "@94ai/nf-button": "^3.1.13",
19
+ "@94ai/nf-double-half-year": "^3.1.13",
20
+ "@94ai/nf-double-quarter": "^3.1.13",
21
+ "@94ai/nf-double-week": "^3.1.13",
22
+ "@94ai/nf-double-year": "^3.1.13",
23
+ "@94ai/nf-drawer": "^3.1.13",
24
+ "@94ai/nf-form": "^3.1.13",
25
+ "@94ai/nf-form-item": "^3.1.13",
26
+ "@94ai/nf-half-year-picker": "^3.1.13",
27
+ "@94ai/nf-lazy-select": "^3.1.13",
28
+ "@94ai/nf-message": "^3.1.13",
29
+ "@94ai/nf-quarter-picker": "^3.1.13",
30
+ "@94ai/nf-theme-chalk": "^3.1.13",
31
+ "@94ai/nf-transfer-select": "^3.1.13",
32
+ "@94ai/nf-virtual-select": "^3.1.13",
33
+ "idb-keyval": "^6.2.1",
34
+ "resize-observer-polyfill": "^1.5.1",
35
+ "vue-demi": "^0.14.5",
36
+ "vuedraggable": "^2.24.3"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "@vue/composition-api": {
40
+ "optional": true
41
+ }
42
+ },
43
+ "peerDependencies": {
44
+ "@vue/composition-api": "^1.0.0-rc.1",
45
+ "element-ui": ">=2.13.2",
46
+ "vue": "^2.0.0 || >=3.0.0"
47
+ },
48
+ "types": "lib/index.d.ts",
49
+ "main": "lib/nf-search-form.cjs.js",
50
+ "module": "lib/nf-search-form.esm-bundler.js",
51
+ "gitHead": "a8c56183ccc8e979008e2d38bfde2d7d1448654c"
52
+ }
@@ -0,0 +1,8 @@
1
+ export default {
2
+ plugins: {
3
+ // 这个工具可以实现自动添加CSS3前缀
4
+ autoprefixer: {
5
+ overrideBrowserslist: ['last 5 version', '>1%', 'ie >=8']
6
+ },
7
+ },
8
+ }