hy-dispatch-ui-v3 0.2.1 → 0.2.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/es/components/appConfigProvider/appConfigProvider.vue.mjs +3 -1
- package/es/components/appDatePicker/appDatePicker.vue.mjs +57 -3
- package/es/components/appDatePicker/index.mjs +2 -1
- package/es/components/appForm/cpns/appFormItem.vue.mjs +37 -7
- package/es/components/appForm/js/useAppForm.mjs +5 -40
- package/es/components/appIcon/appIcon.vue.mjs +5 -1
- package/es/components/appInput/appInput.vue.mjs +17 -15
- package/es/components/appInput/index.mjs +2 -1
- package/es/components/appSearch/cpns/appSearchItem.vue.mjs +33 -3
- package/es/components/appSearch/js/index.mjs +1 -1
- package/es/components/appSearch/js/useAppSearch.mjs +9 -39
- package/es/components/appTimePicker/appTimePicker.vue.mjs +154 -0
- package/es/components/appTimePicker/index.mjs +7 -0
- package/es/components/appTimePicker/style/appTimePicker.scss +0 -0
- package/es/components/appTree/appTree.vue.mjs +11 -8
- package/es/components/appTree/config/tree-config.mjs +33 -0
- package/es/components/appTree/js/index.mjs +10 -12
- package/es/components/appVideoPlayer/appVideoPlayer.vue.mjs +6 -6
- package/es/components/index.mjs +3 -2
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/useEnsureHyIcon.mjs +12 -0
- package/es/hooks/useGlobalConfig.mjs +5 -0
- package/es/index.mjs +4 -2
- package/es/locale/en.mjs +21 -11
- package/es/locale/zh_CN.mjs +21 -11
- package/es/static/_sprite.js +33 -0
- package/es/static/hy-svg-icons/ai.js +30 -0
- package/es/static/hy-svg-icons/batch.js +8 -0
- package/es/static/hy-svg-icons.js +10 -10
- package/es/static/index.js +2 -2
- package/es/static/protocolcheck.js +109 -85
- package/es/static/vite-plugin-hy-svg-icons.js +240 -0
- package/es/utils/date.mjs +1 -0
- package/es/utils/handler.mjs +2 -2
- package/es/version.mjs +1 -1
- package/lib/components/appConfigProvider/appConfigProvider.vue.js +3 -1
- package/lib/components/appDatePicker/appDatePicker.vue.js +56 -2
- package/lib/components/appDatePicker/index.js +2 -0
- package/lib/components/appForm/cpns/appFormItem.vue.js +38 -8
- package/lib/components/appForm/js/useAppForm.js +5 -40
- package/lib/components/appIcon/appIcon.vue.js +4 -0
- package/lib/components/appInput/appInput.vue.js +17 -15
- package/lib/components/appInput/index.js +2 -0
- package/lib/components/appSearch/cpns/appSearchItem.vue.js +34 -4
- package/lib/components/appSearch/js/index.js +1 -1
- package/lib/components/appSearch/js/useAppSearch.js +9 -39
- package/lib/components/appTimePicker/appTimePicker.vue.js +158 -0
- package/lib/components/appTimePicker/index.js +13 -0
- package/lib/components/appTimePicker/style/appTimePicker.scss +0 -0
- package/lib/components/appTree/appTree.vue.js +10 -7
- package/lib/components/appTree/config/tree-config.js +37 -0
- package/lib/components/appTree/js/index.js +10 -12
- package/lib/components/appVideoPlayer/appVideoPlayer.vue.js +6 -6
- package/lib/components/index.js +13 -8
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/useEnsureHyIcon.js +15 -0
- package/lib/hooks/useGlobalConfig.js +5 -0
- package/lib/index.js +16 -8
- package/lib/locale/en.js +21 -11
- package/lib/locale/zh_CN.js +21 -11
- package/lib/static/_sprite.js +33 -0
- package/lib/static/hy-svg-icons/ai.js +30 -0
- package/lib/static/hy-svg-icons/batch.js +8 -0
- package/lib/static/hy-svg-icons.js +10 -12
- package/lib/static/index.js +2 -5
- package/lib/static/protocolcheck.js +109 -87
- package/lib/static/vite-plugin-hy-svg-icons.js +240 -0
- package/lib/utils/date.js +1 -0
- package/lib/utils/handler.js +2 -2
- package/lib/version.js +1 -1
- package/package.json +3 -3
|
@@ -71,7 +71,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
71
71
|
videoPlayer: {
|
|
72
72
|
type: Object,
|
|
73
73
|
required: false
|
|
74
|
-
}
|
|
74
|
+
},
|
|
75
|
+
ensureHyIcon: Function
|
|
75
76
|
},
|
|
76
77
|
setup(__props) {
|
|
77
78
|
const props = __props;
|
|
@@ -84,6 +85,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
84
85
|
permissionMap,
|
|
85
86
|
audioPlayer,
|
|
86
87
|
videoPlayer,
|
|
88
|
+
ensureHyIcon,
|
|
87
89
|
...config2
|
|
88
90
|
} = globalConfig.value;
|
|
89
91
|
return {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { defineComponent, useTemplateRef, useModel, watch, unref, openBlock, createBlock, mergeProps, mergeModels } from 'vue';
|
|
1
|
+
import { defineComponent, useTemplateRef, useModel, computed, watch, unref, openBlock, createBlock, mergeProps, mergeModels } from 'vue';
|
|
2
2
|
import { ElDatePicker } from 'element-plus';
|
|
3
|
+
import { getDefaultValueFormatByType } from '../../utils/date.mjs';
|
|
3
4
|
import { isArray } from '../../utils/is.mjs';
|
|
5
|
+
import { useLocale } from '../../hooks/useLocale.mjs';
|
|
4
6
|
|
|
5
7
|
import "./style/appDatePicker.scss";
|
|
6
8
|
|
|
@@ -21,7 +23,15 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
21
23
|
type: String,
|
|
22
24
|
default: "date"
|
|
23
25
|
// 'year' | 'years' |'month' | 'months' | 'date' | 'dates' | 'datetime' | 'week' | 'datetimerange' | 'daterange' | 'monthrange' | 'yearrange'
|
|
24
|
-
}
|
|
26
|
+
},
|
|
27
|
+
format: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
valueFormat: {
|
|
31
|
+
type: String
|
|
32
|
+
},
|
|
33
|
+
startPlaceholder: String,
|
|
34
|
+
endPlaceholder: String
|
|
25
35
|
}, {
|
|
26
36
|
"modelValue": { type: [String, Date, Array] },
|
|
27
37
|
"modelModifiers": {},
|
|
@@ -34,10 +44,43 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
34
44
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
35
45
|
const props = __props;
|
|
36
46
|
const emits = __emit;
|
|
47
|
+
const { t } = useLocale();
|
|
37
48
|
const appDatePicker = useTemplateRef("appDatePicker");
|
|
38
49
|
const dateValue = useModel(__props, "modelValue");
|
|
39
50
|
const startValue = useModel(__props, "start");
|
|
40
51
|
const endValue = useModel(__props, "end");
|
|
52
|
+
const startPlaceholder = computed(() => {
|
|
53
|
+
if (props.startPlaceholder) {
|
|
54
|
+
return props.startPlaceholder;
|
|
55
|
+
}
|
|
56
|
+
switch (props.type) {
|
|
57
|
+
case "daterange":
|
|
58
|
+
return t("datePicker.startDate");
|
|
59
|
+
case "datetimerange":
|
|
60
|
+
return t("datePicker.startDateTime");
|
|
61
|
+
case "monthrange":
|
|
62
|
+
return t("datePicker.startMonth");
|
|
63
|
+
case "yearrange":
|
|
64
|
+
return t("datePicker.startYear");
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
});
|
|
68
|
+
const endPlaceholder = computed(() => {
|
|
69
|
+
if (props.endPlaceholder) {
|
|
70
|
+
return props.endPlaceholder;
|
|
71
|
+
}
|
|
72
|
+
switch (props.type) {
|
|
73
|
+
case "daterange":
|
|
74
|
+
return t("datePicker.endDate");
|
|
75
|
+
case "datetimerange":
|
|
76
|
+
return t("datePicker.endDateTime");
|
|
77
|
+
case "monthrange":
|
|
78
|
+
return t("datePicker.endMonth");
|
|
79
|
+
case "yearrange":
|
|
80
|
+
return t("datePicker.endYear");
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
});
|
|
41
84
|
watch(
|
|
42
85
|
() => [startValue.value, endValue.value],
|
|
43
86
|
([start, end]) => {
|
|
@@ -51,6 +94,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
51
94
|
},
|
|
52
95
|
{ immediate: true }
|
|
53
96
|
);
|
|
97
|
+
function dateFormHandler(format) {
|
|
98
|
+
if (format) return format;
|
|
99
|
+
return getDefaultValueFormatByType(props.type);
|
|
100
|
+
}
|
|
54
101
|
function onChangeHandler(value) {
|
|
55
102
|
const { timeRangeFill } = props;
|
|
56
103
|
const isFill = timeRangeFill && ["daterange"].includes(props.type);
|
|
@@ -90,7 +137,14 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
90
137
|
modelValue: dateValue.value,
|
|
91
138
|
"onUpdate:modelValue": ($event) => dateValue.value = $event,
|
|
92
139
|
type: __props.type
|
|
93
|
-
}, _ctx.$attrs, {
|
|
140
|
+
}, _ctx.$attrs, {
|
|
141
|
+
format: dateFormHandler(__props.format),
|
|
142
|
+
valueFormat: dateFormHandler(__props.valueFormat),
|
|
143
|
+
"start-placeholder": startPlaceholder.value,
|
|
144
|
+
"range-separator": unref(t)("datePicker.to"),
|
|
145
|
+
"end-placeholder": endPlaceholder.value,
|
|
146
|
+
onChange: onChangeHandler
|
|
147
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "type", "format", "valueFormat", "start-placeholder", "range-separator", "end-placeholder"]);
|
|
94
148
|
};
|
|
95
149
|
}
|
|
96
150
|
});
|
|
@@ -2,5 +2,6 @@ import _sfc_main from './appDatePicker.vue.mjs';
|
|
|
2
2
|
import { withInstall } from '../../utils/handler.mjs';
|
|
3
3
|
|
|
4
4
|
const AppDatePicker = withInstall(_sfc_main);
|
|
5
|
+
const ElDatePicker = withInstall(_sfc_main, "ElDatePicker");
|
|
5
6
|
|
|
6
|
-
export { AppDatePicker, AppDatePicker as default };
|
|
7
|
+
export { AppDatePicker, ElDatePicker, AppDatePicker as default };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { computed, unref, openBlock, createBlock, normalizeStyle, withCtx, createCommentVNode, createElementVNode, renderSlot, toDisplayString, createElementBlock, createVNode, Fragment, mergeProps } from 'vue';
|
|
2
2
|
import { ElFormItem, ElIcon, ElSelect, ElRadioGroup, ElCheckboxGroup, ElSwitch, ElInputNumber } from 'element-plus';
|
|
3
3
|
import { QuestionFilled } from '@element-plus/icons-vue';
|
|
4
|
-
import { AppDatePicker } from '../../appDatePicker/index.mjs';
|
|
5
|
-
import { AppOrgCascader } from '../../appOrgCascader/index.mjs';
|
|
6
4
|
import { columnShowHandler, columnItemStyle, isRequired, renderText, isDisabled, optionsHandler } from '../js/index.mjs';
|
|
7
5
|
import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
|
|
8
6
|
import { AppTooltip } from '../../appTooltip/index.mjs';
|
|
9
7
|
import { AppInput } from '../../appInput/index.mjs';
|
|
8
|
+
import { AppDatePicker } from '../../appDatePicker/index.mjs';
|
|
9
|
+
import { AppTimePicker } from '../../appTimePicker/index.mjs';
|
|
10
|
+
import { AppOrgCascader } from '../../appOrgCascader/index.mjs';
|
|
10
11
|
import { isArray } from '../../../utils/is.mjs';
|
|
11
12
|
import { funRunHandler } from '../../../utils/handler.mjs';
|
|
12
13
|
|
|
@@ -218,9 +219,38 @@ const _sfc_main = {
|
|
|
218
219
|
],
|
|
219
220
|
64
|
|
220
221
|
/* STABLE_FRAGMENT */
|
|
221
|
-
)) : __props.column.type === "
|
|
222
|
+
)) : __props.column.type === "time-picker" ? (openBlock(), createElementBlock(
|
|
222
223
|
Fragment,
|
|
223
224
|
{ key: 4 },
|
|
225
|
+
[
|
|
226
|
+
createCommentVNode(" \u65F6\u95F4\u9009\u62E9\u6846 "),
|
|
227
|
+
__props.column.attrs.isRange ? (openBlock(), createBlock(unref(AppTimePicker), mergeProps({
|
|
228
|
+
key: 0,
|
|
229
|
+
start: bindValue.value,
|
|
230
|
+
"onUpdate:start": ($event) => bindValue.value = $event,
|
|
231
|
+
end: bindValue2.value,
|
|
232
|
+
"onUpdate:end": ($event) => bindValue2.value = $event,
|
|
233
|
+
"is-range": true,
|
|
234
|
+
style: { "width": "100%" }
|
|
235
|
+
}, __props.column.attrs, {
|
|
236
|
+
disabled: unref(isDisabled)(props, __props.column),
|
|
237
|
+
onChange: onChangeHandler
|
|
238
|
+
}), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(AppTimePicker), mergeProps({
|
|
239
|
+
key: 1,
|
|
240
|
+
modelValue: bindValue.value,
|
|
241
|
+
"onUpdate:modelValue": ($event) => bindValue.value = $event,
|
|
242
|
+
"is-range": false,
|
|
243
|
+
style: { "width": "100%" }
|
|
244
|
+
}, __props.column.attrs, {
|
|
245
|
+
disabled: unref(isDisabled)(props, __props.column),
|
|
246
|
+
onChange: onChangeHandler
|
|
247
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
|
|
248
|
+
],
|
|
249
|
+
64
|
|
250
|
+
/* STABLE_FRAGMENT */
|
|
251
|
+
)) : __props.column.type === "radio" ? (openBlock(), createElementBlock(
|
|
252
|
+
Fragment,
|
|
253
|
+
{ key: 5 },
|
|
224
254
|
[
|
|
225
255
|
createCommentVNode(" \u5355\u9009 "),
|
|
226
256
|
createVNode(unref(ElRadioGroup), mergeProps({
|
|
@@ -236,7 +266,7 @@ const _sfc_main = {
|
|
|
236
266
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
237
267
|
)) : __props.column.type === "checkbox" ? (openBlock(), createElementBlock(
|
|
238
268
|
Fragment,
|
|
239
|
-
{ key:
|
|
269
|
+
{ key: 6 },
|
|
240
270
|
[
|
|
241
271
|
createCommentVNode(" \u591A\u9009 "),
|
|
242
272
|
createVNode(unref(ElCheckboxGroup), mergeProps({
|
|
@@ -252,7 +282,7 @@ const _sfc_main = {
|
|
|
252
282
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
253
283
|
)) : __props.column.type === "switch" ? (openBlock(), createElementBlock(
|
|
254
284
|
Fragment,
|
|
255
|
-
{ key:
|
|
285
|
+
{ key: 7 },
|
|
256
286
|
[
|
|
257
287
|
createCommentVNode(" \u5F00\u5173 "),
|
|
258
288
|
createVNode(unref(ElSwitch), mergeProps({
|
|
@@ -267,7 +297,7 @@ const _sfc_main = {
|
|
|
267
297
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
268
298
|
)) : __props.column.type === "input-number" ? (openBlock(), createElementBlock(
|
|
269
299
|
Fragment,
|
|
270
|
-
{ key:
|
|
300
|
+
{ key: 8 },
|
|
271
301
|
[
|
|
272
302
|
createCommentVNode(" \u6570\u5B57\u8F93\u5165\u6846 "),
|
|
273
303
|
createVNode(unref(ElInputNumber), mergeProps({
|
|
@@ -282,7 +312,7 @@ const _sfc_main = {
|
|
|
282
312
|
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
283
313
|
)) : __props.column.type === "org-cascader" ? (openBlock(), createElementBlock(
|
|
284
314
|
Fragment,
|
|
285
|
-
{ key:
|
|
315
|
+
{ key: 9 },
|
|
286
316
|
[
|
|
287
317
|
createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
|
|
288
318
|
createVNode(unref(AppOrgCascader), mergeProps({
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { unref, toRef } from 'vue';
|
|
2
2
|
import { genValueByProp } from '../../../utils/form.mjs';
|
|
3
3
|
import { funRunHandler, mergeDeep } from '../../../utils/handler.mjs';
|
|
4
|
-
import { getDefaultValueFormatByType } from '../../../utils/date.mjs';
|
|
5
4
|
import { isArray } from '../../../utils/is.mjs';
|
|
6
5
|
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
7
6
|
|
|
@@ -23,33 +22,9 @@ const genPlaceholderHandler = (config) => {
|
|
|
23
22
|
placeholder = placeholder || t("hy.pleaseEnterPlaceholder", [label]);
|
|
24
23
|
break;
|
|
25
24
|
case "select":
|
|
26
|
-
placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
|
|
27
|
-
break;
|
|
28
25
|
case "date-picker":
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)) {
|
|
32
|
-
switch (attrs.type) {
|
|
33
|
-
case "yearrange":
|
|
34
|
-
startPlaceholder = startPlaceholder || t("hy.startYear");
|
|
35
|
-
endPlaceholder = endPlaceholder || t("hy.endYear");
|
|
36
|
-
break;
|
|
37
|
-
case "monthrange":
|
|
38
|
-
startPlaceholder = startPlaceholder || t("hy.startMonth");
|
|
39
|
-
endPlaceholder = endPlaceholder || t("hy.endMonth");
|
|
40
|
-
break;
|
|
41
|
-
case "daterange":
|
|
42
|
-
startPlaceholder = startPlaceholder || t("hy.startDate");
|
|
43
|
-
endPlaceholder = endPlaceholder || t("hy.endDate");
|
|
44
|
-
break;
|
|
45
|
-
case "datetimerange":
|
|
46
|
-
startPlaceholder = startPlaceholder || t("hy.startDateTime");
|
|
47
|
-
endPlaceholder = endPlaceholder || t("hy.endDateTime");
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
|
|
52
|
-
}
|
|
26
|
+
case "time-picker":
|
|
27
|
+
placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
|
|
53
28
|
break;
|
|
54
29
|
default:
|
|
55
30
|
placeholder = placeholder || label;
|
|
@@ -86,7 +61,7 @@ const rulesHandler = (config) => {
|
|
|
86
61
|
};
|
|
87
62
|
function appFormItemHandler(column = {}) {
|
|
88
63
|
const label = genDefaultLabel(column);
|
|
89
|
-
const { placeholder
|
|
64
|
+
const { placeholder} = genPlaceholderHandler({ ...column, label });
|
|
90
65
|
const attrs = { ...column.attrs || {}, placeholder };
|
|
91
66
|
column = mergeDeep(
|
|
92
67
|
{ ...column },
|
|
@@ -95,7 +70,8 @@ function appFormItemHandler(column = {}) {
|
|
|
95
70
|
field: column.prop,
|
|
96
71
|
label,
|
|
97
72
|
readonly: column.readonly || false,
|
|
98
|
-
rules: rulesHandler(column)
|
|
73
|
+
rules: rulesHandler(column),
|
|
74
|
+
attrs
|
|
99
75
|
}
|
|
100
76
|
);
|
|
101
77
|
if (/^(input)$/.test(column.type)) {
|
|
@@ -120,17 +96,6 @@ function appFormItemHandler(column = {}) {
|
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
98
|
};
|
|
123
|
-
} else if (/^date-picker$/.test(column.type)) {
|
|
124
|
-
return {
|
|
125
|
-
...column,
|
|
126
|
-
attrs: {
|
|
127
|
-
format: attrs.format || getDefaultValueFormatByType(attrs.type),
|
|
128
|
-
valueFormat: attrs.valueFormat || getDefaultValueFormatByType(attrs.type),
|
|
129
|
-
...attrs,
|
|
130
|
-
startPlaceholder,
|
|
131
|
-
endPlaceholder
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
99
|
} else if (/^(extra)$/.test(column.type)) {
|
|
135
100
|
return {
|
|
136
101
|
...column,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode } from 'vue';
|
|
1
|
+
import { defineComponent, onMounted, watch, computed, openBlock, createElementBlock, normalizeClass, createElementVNode } from 'vue';
|
|
2
|
+
import { useEnsureHyIcon } from '../../hooks/useEnsureHyIcon.mjs';
|
|
2
3
|
|
|
3
4
|
import "./style/appIcon.scss";
|
|
4
5
|
|
|
@@ -23,6 +24,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
23
24
|
},
|
|
24
25
|
setup(__props) {
|
|
25
26
|
const props = __props;
|
|
27
|
+
const { ensureHyIcon } = useEnsureHyIcon();
|
|
28
|
+
onMounted(() => ensureHyIcon(props.svgName));
|
|
29
|
+
watch(() => props.svgName, ensureHyIcon);
|
|
26
30
|
const iconName = computed(() => `#${props.prefix}${props.svgName}`);
|
|
27
31
|
const svgClass = computed(() => {
|
|
28
32
|
if (props.className) {
|
|
@@ -12,9 +12,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
12
12
|
default: "text"
|
|
13
13
|
},
|
|
14
14
|
clearSpaceType: {
|
|
15
|
-
type: String
|
|
15
|
+
type: String
|
|
16
16
|
// between-清除两端空格 all-清除所有空格 before-清除前面的空格 after-清除后面的空格 none-不清除空格
|
|
17
|
-
default: "between"
|
|
18
17
|
}
|
|
19
18
|
}, {
|
|
20
19
|
"modelValue": { type: String, default: "" },
|
|
@@ -25,27 +24,31 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
25
24
|
const props = __props;
|
|
26
25
|
const modelValue = useModel(__props, "modelValue");
|
|
27
26
|
const inputRef = useTemplateRef("inputRef");
|
|
27
|
+
const clearSpaceType = computed(() => {
|
|
28
|
+
if (props.clearSpaceType) {
|
|
29
|
+
return props.clearSpaceType;
|
|
30
|
+
}
|
|
31
|
+
return ["textarea", "password", "number"].includes(props.type) ? null : "between";
|
|
32
|
+
});
|
|
28
33
|
const bindValue = computed({
|
|
29
34
|
get() {
|
|
30
35
|
return modelValue.value;
|
|
31
36
|
},
|
|
32
37
|
set(val) {
|
|
33
|
-
if (val &&
|
|
34
|
-
if (["between", "before"].includes(
|
|
38
|
+
if (val && clearSpaceType.value) {
|
|
39
|
+
if (["between", "before"].includes(clearSpaceType.value)) {
|
|
35
40
|
modelValue.value = clearSpace(val, "before");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (["all"].includes(props.clearSpaceType)) {
|
|
39
|
-
modelValue.value = clearSpace(val, props.clearSpaceType);
|
|
40
|
-
return;
|
|
41
|
+
} else {
|
|
42
|
+
modelValue.value = clearSpace(val, clearSpaceType.value);
|
|
41
43
|
}
|
|
44
|
+
return;
|
|
42
45
|
}
|
|
43
46
|
modelValue.value = val;
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
49
|
function onBlurHandler() {
|
|
47
|
-
if (modelValue.value
|
|
48
|
-
modelValue.value = clearSpace(modelValue.value,
|
|
50
|
+
if (modelValue.value) {
|
|
51
|
+
modelValue.value = clearSpace(modelValue.value, clearSpaceType.value);
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
__expose({
|
|
@@ -88,10 +91,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
88
91
|
ref_key: "inputRef",
|
|
89
92
|
ref: inputRef,
|
|
90
93
|
modelValue: bindValue.value,
|
|
91
|
-
"onUpdate:modelValue": ($event) => bindValue.value = $event
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "onBlur"]);
|
|
94
|
+
"onUpdate:modelValue": ($event) => bindValue.value = $event,
|
|
95
|
+
type: __props.type
|
|
96
|
+
}, _ctx.$attrs, { onBlur: onBlurHandler }), null, 16, ["modelValue", "onUpdate:modelValue", "type"]);
|
|
95
97
|
};
|
|
96
98
|
}
|
|
97
99
|
});
|
|
@@ -2,5 +2,6 @@ import _sfc_main from './appInput.vue.mjs';
|
|
|
2
2
|
import { withInstall } from '../../utils/handler.mjs';
|
|
3
3
|
|
|
4
4
|
const AppInput = withInstall(_sfc_main);
|
|
5
|
+
const ElInput = withInstall(_sfc_main, "ElInput");
|
|
5
6
|
|
|
6
|
-
export { AppInput, AppInput as default };
|
|
7
|
+
export { AppInput, ElInput, AppInput as default };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { computed, unref, openBlock, createBlock, withCtx, createElementVNode, normalizeStyle, createCommentVNode, renderSlot, createElementBlock, toDisplayString, normalizeClass, Fragment, createVNode, mergeProps, withKeys, renderList } from 'vue';
|
|
2
2
|
import { ElFormItem, ElSelect } from 'element-plus';
|
|
3
3
|
import { columnShowHandler, columnItemStyle, columnItemInputStyle, isDisabled, optionsHandler, isSelectedTimeRange, timeRangeHandler } from '../js/index.mjs';
|
|
4
|
-
import { AppDatePicker } from '../../appDatePicker/index.mjs';
|
|
5
|
-
import { AppOrgCascader } from '../../appOrgCascader/index.mjs';
|
|
6
4
|
import { isArray } from '../../../utils/is.mjs';
|
|
7
5
|
import { setValueByProp, getValueByProp } from '../../../utils/form.mjs';
|
|
8
6
|
import { AppInput } from '../../appInput/index.mjs';
|
|
7
|
+
import { AppDatePicker } from '../../appDatePicker/index.mjs';
|
|
8
|
+
import { AppTimePicker } from '../../appTimePicker/index.mjs';
|
|
9
|
+
import { AppOrgCascader } from '../../appOrgCascader/index.mjs';
|
|
9
10
|
|
|
10
11
|
const _sfc_main = {
|
|
11
12
|
__name: "appSearchItem",
|
|
@@ -175,9 +176,38 @@ const _sfc_main = {
|
|
|
175
176
|
],
|
|
176
177
|
64
|
|
177
178
|
/* STABLE_FRAGMENT */
|
|
178
|
-
)) : __props.column.type === "
|
|
179
|
+
)) : __props.column.type === "time-picker" ? (openBlock(), createElementBlock(
|
|
179
180
|
Fragment,
|
|
180
181
|
{ key: 4 },
|
|
182
|
+
[
|
|
183
|
+
createCommentVNode(" \u65F6\u95F4\u9009\u62E9\u6846 "),
|
|
184
|
+
__props.column.attrs.isRange ? (openBlock(), createBlock(unref(AppTimePicker), mergeProps({
|
|
185
|
+
key: 0,
|
|
186
|
+
start: bindValue.value,
|
|
187
|
+
"onUpdate:start": ($event) => bindValue.value = $event,
|
|
188
|
+
end: bindValue2.value,
|
|
189
|
+
"onUpdate:end": ($event) => bindValue2.value = $event,
|
|
190
|
+
"is-range": true,
|
|
191
|
+
style: { "width": "100%" }
|
|
192
|
+
}, __props.column.attrs, {
|
|
193
|
+
disabled: unref(isDisabled)(props, __props.column),
|
|
194
|
+
onChange: onChangeHandler
|
|
195
|
+
}), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(AppTimePicker), mergeProps({
|
|
196
|
+
key: 1,
|
|
197
|
+
modelValue: bindValue.value,
|
|
198
|
+
"onUpdate:modelValue": ($event) => bindValue.value = $event,
|
|
199
|
+
"is-range": false,
|
|
200
|
+
style: { "width": "100%" }
|
|
201
|
+
}, __props.column.attrs, {
|
|
202
|
+
disabled: unref(isDisabled)(props, __props.column),
|
|
203
|
+
onChange: onChangeHandler
|
|
204
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
|
|
205
|
+
],
|
|
206
|
+
64
|
|
207
|
+
/* STABLE_FRAGMENT */
|
|
208
|
+
)) : __props.column.type === "org-cascader" ? (openBlock(), createElementBlock(
|
|
209
|
+
Fragment,
|
|
210
|
+
{ key: 5 },
|
|
181
211
|
[
|
|
182
212
|
createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
|
|
183
213
|
createVNode(unref(AppOrgCascader), mergeProps({
|
|
@@ -9,7 +9,7 @@ function columnItemStyle(props, column) {
|
|
|
9
9
|
if (isNumber(width)) {
|
|
10
10
|
style.width = `${width}px`;
|
|
11
11
|
} else if (isString(width)) {
|
|
12
|
-
style.width =
|
|
12
|
+
style.width = /^\d+$/.test(width) ? `${width}px` : width;
|
|
13
13
|
}
|
|
14
14
|
return style;
|
|
15
15
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { unref, toRef } from 'vue';
|
|
2
2
|
import { funRunHandler, mergeDeep } from '../../../utils/handler.mjs';
|
|
3
3
|
import { genValueByProp } from '../../../utils/form.mjs';
|
|
4
|
-
import { getDefaultValueFormatByType } from '../../../utils/date.mjs';
|
|
5
4
|
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
6
5
|
import { isNumber } from '../../../utils/is.mjs';
|
|
7
6
|
|
|
@@ -21,33 +20,12 @@ const genPlaceholderHandler = (config) => {
|
|
|
21
20
|
switch (type) {
|
|
22
21
|
case "input":
|
|
23
22
|
placeholder = placeholder || t("hy.pleaseEnterPlaceholder", [label]);
|
|
23
|
+
break;
|
|
24
24
|
case "select":
|
|
25
|
-
placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
|
|
26
25
|
case "date-picker":
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
switch (attrs.type) {
|
|
31
|
-
case "yearrange":
|
|
32
|
-
startPlaceholder = startPlaceholder || t("hy.startYear");
|
|
33
|
-
endPlaceholder = endPlaceholder || t("hy.endYear");
|
|
34
|
-
break;
|
|
35
|
-
case "monthrange":
|
|
36
|
-
startPlaceholder = startPlaceholder || t("hy.startMonth");
|
|
37
|
-
endPlaceholder = endPlaceholder || t("hy.endMonth");
|
|
38
|
-
break;
|
|
39
|
-
case "daterange":
|
|
40
|
-
startPlaceholder = startPlaceholder || t("hy.startDate");
|
|
41
|
-
endPlaceholder = endPlaceholder || t("hy.endDate");
|
|
42
|
-
break;
|
|
43
|
-
case "datetimerange":
|
|
44
|
-
startPlaceholder = startPlaceholder || t("hy.startDateTime");
|
|
45
|
-
endPlaceholder = endPlaceholder || t("hy.endDateTime");
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
|
|
50
|
-
}
|
|
26
|
+
case "time-picker":
|
|
27
|
+
placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
|
|
28
|
+
break;
|
|
51
29
|
default:
|
|
52
30
|
placeholder = placeholder || label;
|
|
53
31
|
}
|
|
@@ -71,6 +49,8 @@ const genColumnWidth = (config) => {
|
|
|
71
49
|
default:
|
|
72
50
|
inputWidth = 145;
|
|
73
51
|
}
|
|
52
|
+
} else if (type === "time-picker" && attrs.isRange) {
|
|
53
|
+
width = 350;
|
|
74
54
|
} else {
|
|
75
55
|
width = 250;
|
|
76
56
|
}
|
|
@@ -105,7 +85,7 @@ const timeRangeOptionsHandler = (config) => {
|
|
|
105
85
|
};
|
|
106
86
|
function appSearchItemHandler(column = {}) {
|
|
107
87
|
const label = genDefaultLabel(column);
|
|
108
|
-
const { placeholder
|
|
88
|
+
const { placeholder} = genPlaceholderHandler({ ...column, label });
|
|
109
89
|
const attrs = {
|
|
110
90
|
clearable: true,
|
|
111
91
|
...column.attrs || {},
|
|
@@ -121,7 +101,8 @@ function appSearchItemHandler(column = {}) {
|
|
|
121
101
|
readonly: column.readonly || false,
|
|
122
102
|
width,
|
|
123
103
|
inputWidth,
|
|
124
|
-
timeRangeOptions: timeRangeOptionsHandler(column)
|
|
104
|
+
timeRangeOptions: timeRangeOptionsHandler(column),
|
|
105
|
+
attrs
|
|
125
106
|
}
|
|
126
107
|
);
|
|
127
108
|
if (/^(input)$/.test(column.type)) {
|
|
@@ -146,17 +127,6 @@ function appSearchItemHandler(column = {}) {
|
|
|
146
127
|
}
|
|
147
128
|
}
|
|
148
129
|
};
|
|
149
|
-
} else if (/^date-picker$/.test(column.type)) {
|
|
150
|
-
return {
|
|
151
|
-
...column,
|
|
152
|
-
attrs: {
|
|
153
|
-
format: attrs.format || getDefaultValueFormatByType(attrs.type),
|
|
154
|
-
valueFormat: attrs.valueFormat || getDefaultValueFormatByType(attrs.type),
|
|
155
|
-
...attrs,
|
|
156
|
-
startPlaceholder,
|
|
157
|
-
endPlaceholder
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
130
|
}
|
|
161
131
|
return column;
|
|
162
132
|
}
|