@opentiny/vue-search-box 0.1.1-alpha.1 → 0.1.1-alpha.3
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 +28 -0
- package/README.zh-CN.md +28 -0
- package/dist/es/index.es.js +11 -3
- package/dist/es/index.vue.es2.js +11 -42
- package/dist/es/utils/en_US.es.js +37 -37
- package/dist/es/utils/zh_CN.es.js +1 -1
- package/dist/lib/index.cjs.js +10 -2
- package/dist/lib/index.vue.cjs2.js +83 -114
- package/dist/lib/utils/en_US.cjs.js +38 -38
- package/dist/lib/utils/zh_CN.cjs.js +2 -2
- package/dist/types/utils/en_US.d.ts +2 -1
- package/dist/types/utils/zh_CN.d.ts +2 -1
- package/package.json +24 -20
- package/__tests__/search-box.spec.ts +0 -0
- package/scripts/pre-release.cjs +0 -8
- package/src/composables/use-checkbox.ts +0 -90
- package/src/composables/use-custom.ts +0 -53
- package/src/composables/use-datepicker.ts +0 -90
- package/src/composables/use-dropdown.ts +0 -251
- package/src/composables/use-edit.ts +0 -119
- package/src/composables/use-init.ts +0 -69
- package/src/composables/use-match.ts +0 -193
- package/src/composables/use-num-range.ts +0 -86
- package/src/composables/use-placeholder.ts +0 -43
- package/src/composables/use-tag.ts +0 -54
- package/src/index.less +0 -376
- package/src/index.ts +0 -13
- package/src/index.type.ts +0 -192
- package/src/index.vue +0 -1138
- package/src/smb-theme.ts +0 -15
- package/src/theme.json +0 -135
- package/src/utils/clone.ts +0 -37
- package/src/utils/date.ts +0 -724
- package/src/utils/dropdown.ts +0 -27
- package/src/utils/en_US.ts +0 -41
- package/src/utils/index.ts +0 -11
- package/src/utils/tag.ts +0 -80
- package/src/utils/type.ts +0 -6
- package/src/utils/validate.ts +0 -234
- package/src/utils/zh_CN.ts +0 -41
- package/src/vars.less +0 -56
- package/vite.config.theme.ts +0 -20
- package/vite.config.ts +0 -60
package/src/utils/dropdown.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 下拉框显隐
|
|
3
|
-
* @param state 组件响应式数据
|
|
4
|
-
* @param isShow 是否展示下拉框, 默认展示
|
|
5
|
-
*/
|
|
6
|
-
export const showDropdown = (state, isShow = true) => {
|
|
7
|
-
const { dropdownRef } = state.instance.refs
|
|
8
|
-
clearTimeout(Number(dropdownRef.state.timeout))
|
|
9
|
-
dropdownRef.state.timeout = null
|
|
10
|
-
dropdownRef.state.visible = isShow
|
|
11
|
-
isShow && (state.popoverVisible = false)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 编辑下拉框显隐
|
|
16
|
-
* @param state 组件响应式数据
|
|
17
|
-
* @param isShow 是否展示编辑下拉框, 默认展示
|
|
18
|
-
*/
|
|
19
|
-
export const showPopover = (state, isShow = true) => {
|
|
20
|
-
state.popoverVisible = isShow
|
|
21
|
-
const { dropdownRef } = state.instance.refs
|
|
22
|
-
if (isShow && dropdownRef.state.visible) {
|
|
23
|
-
clearTimeout(Number(dropdownRef.state.timeout))
|
|
24
|
-
dropdownRef.state.timeout = null
|
|
25
|
-
dropdownRef.state.visible = false
|
|
26
|
-
}
|
|
27
|
-
}
|
package/src/utils/en_US.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const enUS = {
|
|
2
|
-
tvp: {
|
|
3
|
-
tvpSearchbox: {
|
|
4
|
-
defaultPlaceholder: '请选择属性筛选,或输入关键字',
|
|
5
|
-
addPlaceholder: '添加筛选条件',
|
|
6
|
-
tagPlaceholder: '请选择标签键/值搜索,或输入“键=值”搜索',
|
|
7
|
-
dynamicPlaceholder: '请选择{newValue}搜索',
|
|
8
|
-
attributeType: '属性类型',
|
|
9
|
-
propertyValue: '{0}的值',
|
|
10
|
-
matched: '潜在匹配项',
|
|
11
|
-
allValues: '所有值',
|
|
12
|
-
allProperty: '全部属性',
|
|
13
|
-
operator: '运算符',
|
|
14
|
-
clearAll: '清空',
|
|
15
|
-
emptyValue: '空 值',
|
|
16
|
-
help: '点击查看帮助',
|
|
17
|
-
switchText: '切换到默认搜索项',
|
|
18
|
-
tagKey: '键',
|
|
19
|
-
tagValue: '值',
|
|
20
|
-
minValueText: '最小值',
|
|
21
|
-
maxValueText: '最大值',
|
|
22
|
-
rangeMinErr: '输入值必须在{0}~{1}之间',
|
|
23
|
-
rangeMaxErr: '最大值必须大于等于最小值,或者为空',
|
|
24
|
-
rangeNumberTitle: '请至少输入一个值',
|
|
25
|
-
rangeDateTitle: '请至少输入一个日期',
|
|
26
|
-
timeLengthTitle: '可选时间跨度为{value}天内',
|
|
27
|
-
rangeBeginLabel: '开始日期',
|
|
28
|
-
rangeEndLabel: '结束日期',
|
|
29
|
-
rulekeyword1: '关键字',
|
|
30
|
-
notBeNull: '值不能为空',
|
|
31
|
-
noData: '暂无匹配数据...',
|
|
32
|
-
selectAll: '全选',
|
|
33
|
-
confirm: '确定',
|
|
34
|
-
cancel: '取消',
|
|
35
|
-
equal: '等于',
|
|
36
|
-
notEqual: '不等于',
|
|
37
|
-
contain: '包含',
|
|
38
|
-
notContain: '不包含'
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
package/src/utils/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const debounce = (func: Function, delay = 200) => {
|
|
2
|
-
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
3
|
-
|
|
4
|
-
return function (this: any, ...args: any) {
|
|
5
|
-
if (timer) clearTimeout(timer);
|
|
6
|
-
timer = setTimeout(() => {
|
|
7
|
-
func.apply(this, args);
|
|
8
|
-
timer = null;
|
|
9
|
-
}, delay);
|
|
10
|
-
};
|
|
11
|
-
}
|
package/src/utils/tag.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { ISearchBoxNewTag } from '../index.type'
|
|
2
|
-
import { deepClone } from './clone'
|
|
3
|
-
import { showDropdown, showPopover } from './dropdown'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 判断是否已选择此标签
|
|
7
|
-
* @param state searchbox的state变量
|
|
8
|
-
* @param itemValue 标签的value值
|
|
9
|
-
* @param itemLabel 标签的label值,可选参数,默认为空字符串,一般用于当prevItem.label为空时
|
|
10
|
-
* @return 已选择则返回true,未选择则相反
|
|
11
|
-
*/
|
|
12
|
-
export const hasTagItem = (state, itemValue, itemLabel = '') => {
|
|
13
|
-
const { valueMap, prevItem } = state
|
|
14
|
-
const value = (prevItem.label || itemLabel) + itemValue
|
|
15
|
-
return valueMap.has(value)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 清空输入框的值
|
|
20
|
-
* @param state searchbox的state变量
|
|
21
|
-
*/
|
|
22
|
-
export const resetInput = (state) => {
|
|
23
|
-
state.isResetFlag = false
|
|
24
|
-
state.propItem = {}
|
|
25
|
-
state.inputValue = ''
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* update:modelValue和change事件
|
|
30
|
-
* @param emits vue的api
|
|
31
|
-
* @param state searchbox的state变量
|
|
32
|
-
* @param args 其他可选参数:
|
|
33
|
-
* @param tagList 尾部添加的新标签数组
|
|
34
|
-
* @param index 替换某标签的索引
|
|
35
|
-
* @param newTag 表示替换的新标签,主要和索引共用
|
|
36
|
-
* @param newValue 表示替换全部的model-value值
|
|
37
|
-
* @param oldValue 表示旧的model-value值
|
|
38
|
-
*/
|
|
39
|
-
export const emitChangeModelEvent = ({ emits, state, ...args }) => {
|
|
40
|
-
const { tagList = null, index = -1, newTag = null, newValue = null, oldValue = null, isEdit } = args
|
|
41
|
-
if (!isEdit) {
|
|
42
|
-
resetInput(state)
|
|
43
|
-
}
|
|
44
|
-
if (!tagList && index === -1 && !newValue) {
|
|
45
|
-
return
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const oldVal = oldValue || deepClone(state.innerModelValue)
|
|
49
|
-
if (newValue) {
|
|
50
|
-
state.innerModelValue = newValue
|
|
51
|
-
} else if (index !== -1) {
|
|
52
|
-
newTag ? state.innerModelValue.splice(index, 1, newTag) : state.innerModelValue.splice(index, 1)
|
|
53
|
-
} else {
|
|
54
|
-
state.innerModelValue.push(...tagList)
|
|
55
|
-
}
|
|
56
|
-
const { innerModelValue } = state
|
|
57
|
-
showDropdown(state, false)
|
|
58
|
-
showPopover(state, false)
|
|
59
|
-
emits('update:modelValue', innerModelValue)
|
|
60
|
-
emits('change', deepClone(state.innerModelValue), oldVal)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 创建新标签,防止多个地方创建的标签不一致,缺少某些属性
|
|
65
|
-
* @param newTag 新标签对象
|
|
66
|
-
* @return 生成的新标签对象
|
|
67
|
-
*/
|
|
68
|
-
export const createNewTag = (newTag: ISearchBoxNewTag) => newTag
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 获取元素的唯一标识
|
|
72
|
-
* @param props 组件入参对象
|
|
73
|
-
* @param prevItem 当前标签父级对象
|
|
74
|
-
* @param item 要生成的新标签对象
|
|
75
|
-
* @return 此标签的唯一标识
|
|
76
|
-
*/
|
|
77
|
-
export const getTagId = (props, prevItem, item) => {
|
|
78
|
-
const idKey = prevItem.idMapKey || props.idMapKey
|
|
79
|
-
return item && item[idKey] !== undefined ? { [idKey]: item[idKey] } : null
|
|
80
|
-
}
|
package/src/utils/type.ts
DELETED
package/src/utils/validate.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { createNewTag, getTagId } from './tag'
|
|
2
|
-
import { isNumber } from './type'
|
|
3
|
-
import { omitObj } from './clone'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 校验正常标签的值,并返回相应的新标签
|
|
7
|
-
* @param instance searchbox 的 instance
|
|
8
|
-
* @param state searchbox 的 state
|
|
9
|
-
* @param props searchbox 的 props
|
|
10
|
-
* @return 验证通过则返回新标签对象,否则返回null
|
|
11
|
-
*/
|
|
12
|
-
export const getVerifyTag = async (instance, state, props) => {
|
|
13
|
-
const { prevItem, inputEditValue } = state
|
|
14
|
-
const { operators } = prevItem
|
|
15
|
-
const rest = omitObj(prevItem)
|
|
16
|
-
let newTag = null
|
|
17
|
-
let isPass = true
|
|
18
|
-
|
|
19
|
-
await instance.refs.formRef.validateField(['inputEditValue'], (errMsg) => {
|
|
20
|
-
if (errMsg) {
|
|
21
|
-
isPass = false
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
if (isPass) {
|
|
26
|
-
let id = null
|
|
27
|
-
const operator = state.operatorValue && operators ? { operator: state.operatorValue } : null
|
|
28
|
-
let value = inputEditValue
|
|
29
|
-
const otherAttr = {}
|
|
30
|
-
// 多选
|
|
31
|
-
if (Array.isArray(inputEditValue)) {
|
|
32
|
-
otherAttr.options = []
|
|
33
|
-
value = ''
|
|
34
|
-
inputEditValue.forEach((editValue) => {
|
|
35
|
-
const item = state.currentEditValue.find((item) => item.label === editValue)
|
|
36
|
-
const label = item?.label || editValue
|
|
37
|
-
value = !value ? label : `${value} | ${label}`
|
|
38
|
-
if (item) {
|
|
39
|
-
const itemId = getTagId(props, prevItem, item)
|
|
40
|
-
otherAttr.options.push({ label, ...itemId })
|
|
41
|
-
} else {
|
|
42
|
-
otherAttr.options.push({ label })
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
} else if (Array.isArray(state.currentEditValue)) {
|
|
46
|
-
// 单选
|
|
47
|
-
const item = state.currentEditValue.find((item) => item.label === value)
|
|
48
|
-
id = getTagId(props, prevItem, item)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
newTag = createNewTag({ ...rest, label: state.selectValue, ...operator, value, ...id, ...otherAttr })
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return newTag
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* 校验 numRange 的值,并返回相应的新标签
|
|
59
|
-
* @param instance searchbox 的 instance
|
|
60
|
-
* @param state searchbox 的 state
|
|
61
|
-
* @param props searchbox 的 props
|
|
62
|
-
* @return 验证通过则返回新标签对象,否则返回null
|
|
63
|
-
*/
|
|
64
|
-
export const getVerifyNumTag = async (instance, state, props) => {
|
|
65
|
-
const { prevItem } = state
|
|
66
|
-
const minNum = `min${prevItem.field}`
|
|
67
|
-
const maxNum = `max${prevItem.field}`
|
|
68
|
-
const start = state[minNum]
|
|
69
|
-
const end = state[maxNum]
|
|
70
|
-
const verifyProps = [minNum, maxNum]
|
|
71
|
-
let isPass = true
|
|
72
|
-
let newTag = null
|
|
73
|
-
await instance.refs.formRef.validateField(verifyProps, (errMsg) => {
|
|
74
|
-
if (errMsg) {
|
|
75
|
-
isPass = false
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
if (isPass) {
|
|
80
|
-
const { field, label: prevLabel, unit, type, operators } = prevItem
|
|
81
|
-
const label = unit ? `${prevLabel}(${unit})` : prevLabel
|
|
82
|
-
let value = ''
|
|
83
|
-
if (start && end) {
|
|
84
|
-
value = `${start}-${end}`
|
|
85
|
-
} else {
|
|
86
|
-
value = start ? `≥${start}` : `≤${end}`
|
|
87
|
-
}
|
|
88
|
-
const id = getTagId(props, prevItem, prevItem)
|
|
89
|
-
const operator = state.operatorValue && operators ? { operator: state.operatorValue } : null
|
|
90
|
-
newTag = createNewTag({ type, field, label, value, ...id, start, end, ...operator })
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return newTag
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* 校验 dateRange datetimeRange 的值,并返回相应的新标签
|
|
98
|
-
* @param instance searchbox 的 instance
|
|
99
|
-
* @param state searchbox 的 state
|
|
100
|
-
* @param props searchbox 的 props
|
|
101
|
-
* @param isDateTimeType 是否 datetimeRange
|
|
102
|
-
* @return 验证通过则返回新标签对象,否则返回null
|
|
103
|
-
*/
|
|
104
|
-
export const getVerifyDateTag = async (instance, state, props, isDateTimeType) => {
|
|
105
|
-
const { prevItem, startDate, endDate, startDateTime, endDateTime } = state
|
|
106
|
-
let start = null
|
|
107
|
-
let end = null
|
|
108
|
-
let isPass = true
|
|
109
|
-
let newTag = null
|
|
110
|
-
let verifyProps = null
|
|
111
|
-
if (isDateTimeType) {
|
|
112
|
-
start = startDateTime
|
|
113
|
-
end = endDateTime
|
|
114
|
-
verifyProps = ['startDateTime', 'endDateTime']
|
|
115
|
-
} else {
|
|
116
|
-
start = startDate
|
|
117
|
-
end = endDate
|
|
118
|
-
verifyProps = ['startDate', 'endDate']
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
await instance.refs.formRef.validateField(verifyProps, (errMsg) => {
|
|
122
|
-
if (errMsg) {
|
|
123
|
-
isPass = false
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
if (isPass) {
|
|
128
|
-
const { field, label, type, operators } = prevItem
|
|
129
|
-
let value = ''
|
|
130
|
-
if (start && end) {
|
|
131
|
-
if (start > end) {
|
|
132
|
-
return
|
|
133
|
-
} else if (start === end) {
|
|
134
|
-
value = start
|
|
135
|
-
} else {
|
|
136
|
-
value = `${start}-${end}`
|
|
137
|
-
}
|
|
138
|
-
} else {
|
|
139
|
-
value = start ? `≥${start}` : `≤${end}`
|
|
140
|
-
}
|
|
141
|
-
const id = getTagId(props, prevItem, prevItem)
|
|
142
|
-
const operator = state.operatorValue && operators ? { operator: state.operatorValue } : null
|
|
143
|
-
newTag = createNewTag({ type, field, label, value, start, end, ...id, ...operator })
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return newTag
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* 按需加载 state 里 numRange 类型的变量,按需加载校验规则
|
|
151
|
-
* @param state searchbox 的 state
|
|
152
|
-
* @param item 当前选择的 item 值
|
|
153
|
-
*/
|
|
154
|
-
export const setStateNumRange = (state, item, t) => {
|
|
155
|
-
const { prevItem } = state
|
|
156
|
-
const { field, start, end, min = prevItem.min, max = prevItem.max } = item
|
|
157
|
-
const nextMinNum = `min${field}`
|
|
158
|
-
const nextMaxNum = `max${field}`
|
|
159
|
-
if (state.curMinNumVar !== nextMinNum || state.curMaxNumVar !== nextMaxNum) {
|
|
160
|
-
delete state[state.curMinNumVar]
|
|
161
|
-
delete state[state.curMaxNumVar]
|
|
162
|
-
delete state.formRules[state.curMinNumVar]
|
|
163
|
-
delete state.formRules[state.curMaxNumVar]
|
|
164
|
-
state.curMinNumVar = nextMinNum
|
|
165
|
-
state.curMaxNumVar = nextMaxNum
|
|
166
|
-
}
|
|
167
|
-
state[state.curMinNumVar] = start
|
|
168
|
-
state[state.curMaxNumVar] = end
|
|
169
|
-
const { curMinNumVar, curMaxNumVar } = state
|
|
170
|
-
const minIsNumber = isNumber(min)
|
|
171
|
-
const maxIsNumber = isNumber(max)
|
|
172
|
-
if (minIsNumber || maxIsNumber) {
|
|
173
|
-
state.formRules[curMinNumVar] = {
|
|
174
|
-
validator: (rule, value, cb) => {
|
|
175
|
-
const valueIsNumber = isNumber(value)
|
|
176
|
-
|
|
177
|
-
if (
|
|
178
|
-
(!valueIsNumber && isNumber(state[curMaxNumVar])) ||
|
|
179
|
-
(valueIsNumber &&
|
|
180
|
-
((minIsNumber && !maxIsNumber && value >= min) ||
|
|
181
|
-
(!minIsNumber && maxIsNumber && value <= max) ||
|
|
182
|
-
(value >= min && value <= max)))
|
|
183
|
-
) {
|
|
184
|
-
cb()
|
|
185
|
-
} else {
|
|
186
|
-
state.numberShowMessage = Boolean(value || state[curMaxNumVar])
|
|
187
|
-
cb(new Error(t('tvp.tvpSearchbox.rangeMinErr', [min, max])))
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
state.formRules[curMaxNumVar] = {
|
|
192
|
-
validator: (rule, value, cb) => {
|
|
193
|
-
const MinValueIsNumber = isNumber(state[curMinNumVar])
|
|
194
|
-
const curMin = MinValueIsNumber && min < state[curMinNumVar] ? Number(state[curMinNumVar]) : min
|
|
195
|
-
const curMinIsNumber = isNumber(curMin)
|
|
196
|
-
const valueIsNumber = isNumber(value)
|
|
197
|
-
|
|
198
|
-
if (
|
|
199
|
-
(!valueIsNumber && MinValueIsNumber) ||
|
|
200
|
-
(valueIsNumber &&
|
|
201
|
-
((curMinIsNumber && !maxIsNumber && value >= curMin) ||
|
|
202
|
-
(!curMinIsNumber && maxIsNumber && value <= max) ||
|
|
203
|
-
(value >= curMin && value <= max)))
|
|
204
|
-
) {
|
|
205
|
-
cb()
|
|
206
|
-
} else if (!valueIsNumber && !MinValueIsNumber) {
|
|
207
|
-
cb(new Error(t('tvp.tvpSearchbox.rangeNumberTitle')))
|
|
208
|
-
} else {
|
|
209
|
-
cb(new Error(t('tvp.tvpSearchbox.rangeMaxErr')))
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
state.formRules[curMaxNumVar] = {
|
|
215
|
-
validator: (rule, value, cb) => {
|
|
216
|
-
const curMin = state[curMinNumVar]
|
|
217
|
-
const valueIsNumber = isNumber(value)
|
|
218
|
-
const curMinIsNumber = isNumber(curMin)
|
|
219
|
-
|
|
220
|
-
if (
|
|
221
|
-
(valueIsNumber && !curMinIsNumber) ||
|
|
222
|
-
(!valueIsNumber && curMinIsNumber) ||
|
|
223
|
-
(valueIsNumber && curMinIsNumber && value >= Number(curMin))
|
|
224
|
-
) {
|
|
225
|
-
cb()
|
|
226
|
-
} else if (!valueIsNumber && !curMinIsNumber) {
|
|
227
|
-
cb(new Error(t('tvp.tvpSearchbox.rangeNumberTitle')))
|
|
228
|
-
} else {
|
|
229
|
-
cb(new Error(t('tvp.tvpSearchbox.rangeMaxErr')))
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
package/src/utils/zh_CN.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export const zhCN = {
|
|
2
|
-
tvp: {
|
|
3
|
-
tvpSearchbox: {
|
|
4
|
-
defaultPlaceholder: '请选择属性筛选,或输入关键字',
|
|
5
|
-
addPlaceholder: '添加筛选条件',
|
|
6
|
-
tagPlaceholder: '请选择标签键/值搜索,或输入“键=值”搜索',
|
|
7
|
-
dynamicPlaceholder: '请选择{newValue}搜索',
|
|
8
|
-
attributeType: '属性类型',
|
|
9
|
-
propertyValue: '{0}的值',
|
|
10
|
-
matched: '潜在匹配项',
|
|
11
|
-
allValues: '所有值',
|
|
12
|
-
allProperty: '全部属性',
|
|
13
|
-
operator: '运算符',
|
|
14
|
-
clearAll: '清空',
|
|
15
|
-
emptyValue: '空 值',
|
|
16
|
-
help: '点击查看帮助',
|
|
17
|
-
switchText: '切换到默认搜索项',
|
|
18
|
-
tagKey: '键',
|
|
19
|
-
tagValue: '值',
|
|
20
|
-
minValueText: '最小值',
|
|
21
|
-
maxValueText: '最大值',
|
|
22
|
-
rangeMinErr: '输入值必须在{0}~{1}之间',
|
|
23
|
-
rangeMaxErr: '最大值必须大于等于最小值,或者为空',
|
|
24
|
-
rangeNumberTitle: '请至少输入一个值',
|
|
25
|
-
rangeDateTitle: '请至少输入一个日期',
|
|
26
|
-
timeLengthTitle: '可选时间跨度为{value}天内',
|
|
27
|
-
rangeBeginLabel: '开始日期',
|
|
28
|
-
rangeEndLabel: '结束日期',
|
|
29
|
-
rulekeyword1: '关键字',
|
|
30
|
-
notBeNull: '值不能为空',
|
|
31
|
-
noData: '暂无匹配数据...',
|
|
32
|
-
selectAll: '全选',
|
|
33
|
-
confirm: '确定',
|
|
34
|
-
cancel: '取消',
|
|
35
|
-
equal: '等于',
|
|
36
|
-
notEqual: '不等于',
|
|
37
|
-
contain: '包含',
|
|
38
|
-
notContain: '不包含'
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
package/src/vars.less
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
.inject-SearchBox-vars() {
|
|
2
|
-
// 输入框背景色
|
|
3
|
-
--tvp-SearchBox-bg-color: var(--tv-color-bg-secondary, #ffffff);
|
|
4
|
-
// 输入框边框色
|
|
5
|
-
--tvp-SearchBox-border-color: var(--tv-color-bg-control-unactive, #c2c2c2);
|
|
6
|
-
// 输入框聚焦输入时边框色
|
|
7
|
-
--tvp-SearchBox-focus-border-color: var(--tv-color-bg-active-primary, #191919);
|
|
8
|
-
// 输入框圆角
|
|
9
|
-
--tvp-SearchBox-border-radius: var(--tv-border-radius-md, 6px);
|
|
10
|
-
// 标签悬浮文本色
|
|
11
|
-
--tvp-SearchBox-tag-hover-text-color: var(--tv-color-icon-hover, #191919);
|
|
12
|
-
// 标签悬浮关闭图标填充色
|
|
13
|
-
--tvp-SearchBox-tag-hover-fill-color: var(--tvp-SearchBox-tag-hover-text-color);
|
|
14
|
-
// 下拉框头部文本色
|
|
15
|
-
--tvp-SearchBox-dropdown-header-text-color: var(--tv-color-text-weaken, #808080);
|
|
16
|
-
// 搜索过滤下拉框列表项文本色
|
|
17
|
-
--tvp-SearchBox-search-filter-text-color: var(--tv-color-info-text-primary, #191919);
|
|
18
|
-
// 输入框清空图标右外边距
|
|
19
|
-
--tvp-SearchBox-close-icon-margin-right: var(--tv-space-sm, 4px);
|
|
20
|
-
// 输入框图标分割线右外边距
|
|
21
|
-
--tvp-SearchBox-separator-icon-margin-right: var(--tv-space-sm, 4px);
|
|
22
|
-
// 输入框右侧图标色
|
|
23
|
-
--tvp-SearchBox-right-icon-color: var(--tv-color-icon, #808080);
|
|
24
|
-
// 输入框右侧图标悬浮色
|
|
25
|
-
--tvp-SearchBox-right-icon-color-hover: var(--tv-color-icon-hover, #191919);
|
|
26
|
-
// 输入框左侧图标尺寸
|
|
27
|
-
--tvp-SearchBox-left-icon-font-size: var(--tv-font-size-heading-xs, 16px);
|
|
28
|
-
// 输入框最小高度
|
|
29
|
-
--tvp-SearchBox-min-height: var(--tv-size-height-md, 32px);
|
|
30
|
-
// 输入框最小高度
|
|
31
|
-
--tvp-SearchBox-padding-left: var(--tv-size-height-md, 32px);
|
|
32
|
-
// 搜索下拉列表关键字高亮色
|
|
33
|
-
--tvp-SearchBox-dropdown-keyword-text-color: var(--tv-color-act-info-text-active, #1476ff);
|
|
34
|
-
// 下拉框多选按钮组上分割线色
|
|
35
|
-
--tvp-SearchBox-dropdown-btn-group-border-color: var(--tv-color-bg-header, #f0f0f0);
|
|
36
|
-
// 下拉框多选按钮组上外边距
|
|
37
|
-
--tvp-SearchBox-dropdown-btn-group-margin-top: var(--tv-space-md, 8px);
|
|
38
|
-
// 下拉框多选按钮组上内边距
|
|
39
|
-
--tvp-SearchBox-dropdown-btn-group-padding-top: var(--tv-space-xl, 16px);
|
|
40
|
-
// 下拉框多选按钮组下内边距
|
|
41
|
-
--tvp-SearchBox-dropdown-btn-group-padding-bottom: var(--tv-space-md, 8px);
|
|
42
|
-
// 下拉框为大小类型时标题文本色
|
|
43
|
-
--tvp-SearchBox-dropdown-num-title-text-color: var(--tv-color-text-weaken, #808080);
|
|
44
|
-
// 标签右外边距
|
|
45
|
-
--tvp-SearchBox-tag-margin-right: var(--tv-space-sm, 4px);
|
|
46
|
-
// 输入框内占位元素右内边距(hide)
|
|
47
|
-
--tvp-SearchBox-place-padding-right: var(--tv-space-sm, 4px);
|
|
48
|
-
// 可编辑标签文字下划线颜色
|
|
49
|
-
--tvp-SearchBox-tag-bottom-border-color: var(--tv-color-act-primary-text-active, #191919);
|
|
50
|
-
// 生成标签前的label字号
|
|
51
|
-
--tvp-SearchBox-tag-font-size: var(--tv-font-size-md, 14px);
|
|
52
|
-
// 下拉面板描述部分字号
|
|
53
|
-
--tvp-SearchBox-dropdown-desc-font-size: var(--tv-font-size-md, 14px);
|
|
54
|
-
// 下拉面板描述部分文本色
|
|
55
|
-
--tvp-SearchBox-dropdown-desc-text-color: var(--tv-color-info-text-primary, #191919);
|
|
56
|
-
}
|
package/vite.config.theme.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { defineConfig } from "vite";
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
build: {
|
|
6
|
-
sourcemap: false,
|
|
7
|
-
minify: false,
|
|
8
|
-
rollupOptions: {
|
|
9
|
-
input: "src/index.less",
|
|
10
|
-
treeshake: false,
|
|
11
|
-
preserveEntrySignatures: "strict",
|
|
12
|
-
output: {
|
|
13
|
-
dir: resolve(__dirname, "dist"),
|
|
14
|
-
assetFileNames: "index.css",
|
|
15
|
-
preserveModules: true,
|
|
16
|
-
preserveModulesRoot: resolve(__dirname, "src/assets"),
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
package/vite.config.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
import * as glob from 'glob';
|
|
4
|
-
import { defineConfig } from 'vite';
|
|
5
|
-
import vue from '@vitejs/plugin-vue';
|
|
6
|
-
import dts from 'vite-plugin-dts';
|
|
7
|
-
|
|
8
|
-
interface Manifest {
|
|
9
|
-
version: string;
|
|
10
|
-
dependencies?: Record<string, string>;
|
|
11
|
-
peerDependencies?: Record<string, string>;
|
|
12
|
-
}
|
|
13
|
-
export function getPackageManifest(pkgPath: string): Manifest {
|
|
14
|
-
return JSON.parse(readFileSync(pkgPath, 'utf8')) as Manifest;
|
|
15
|
-
}
|
|
16
|
-
export function rollupExternalFromPackage(pkgPath: string) {
|
|
17
|
-
const { dependencies, peerDependencies } = getPackageManifest(pkgPath);
|
|
18
|
-
const dependenciesKeys = Object.keys(dependencies ?? {});
|
|
19
|
-
const peerDependenciesKeys = Object.keys(peerDependencies ?? {});
|
|
20
|
-
|
|
21
|
-
return (id: string) => {
|
|
22
|
-
const packages = new Set([...peerDependenciesKeys, ...dependenciesKeys]);
|
|
23
|
-
return Array.from(packages).some(
|
|
24
|
-
(pkg) => id === pkg || id.startsWith(`${pkg}/`)
|
|
25
|
-
);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function rollupOutput(target: string, format: string): any {
|
|
30
|
-
return {
|
|
31
|
-
format: target,
|
|
32
|
-
entryFileNames: `[name].${target}.js`,
|
|
33
|
-
preserveModules: true,
|
|
34
|
-
dir: resolve(__dirname, 'dist', format),
|
|
35
|
-
preserveModulesRoot: resolve(__dirname, 'src'),
|
|
36
|
-
exports: 'named'
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const input = glob.sync('./src/**/*.ts', {
|
|
41
|
-
cwd: __dirname,
|
|
42
|
-
absolute: true
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export default defineConfig({
|
|
46
|
-
plugins: [dts({ outDir: './dist/types' }), vue()],
|
|
47
|
-
build: {
|
|
48
|
-
assetsDir: '',
|
|
49
|
-
sourcemap: false,
|
|
50
|
-
minify: false,
|
|
51
|
-
cssCodeSplit: true, // 分离 CSS 文件
|
|
52
|
-
rollupOptions: {
|
|
53
|
-
input,
|
|
54
|
-
treeshake: false,
|
|
55
|
-
preserveEntrySignatures: 'allow-extension',
|
|
56
|
-
external: rollupExternalFromPackage(resolve(__dirname, 'package.json')),
|
|
57
|
-
output: [rollupOutput('es', 'es'), rollupOutput('cjs', 'lib')]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|