hy-dispatch-ui-v3 0.1.6 → 0.2.0
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 +47 -0
- package/dist/tailwind.css +349 -4
- package/es/components/appAudioPlayer/appAudioPlayer.vue.mjs +462 -0
- package/es/components/appAudioPlayer/index.mjs +6 -0
- package/es/components/appAudioPlayer/js/index.mjs +327 -0
- package/es/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/es/components/appButton/style/appButton.scss +0 -1
- package/es/components/appConfigProvider/appConfigProvider.vue.mjs +22 -1
- package/es/components/appCutter/appCutter.vue.mjs +202 -129
- package/es/components/appDatePicker/appDatePicker.vue.mjs +1 -1
- package/es/components/appForm/appForm.vue.mjs +132 -209
- package/es/components/appForm/cpns/appFormItem.vue.mjs +312 -0
- package/es/components/appForm/cpns/arrayItem.vue.mjs +305 -0
- package/es/components/appForm/cpns/extraItem.vue.mjs +140 -0
- package/es/components/appForm/js/index.mjs +46 -24
- package/es/components/appForm/js/useAppForm.mjs +30 -6
- package/es/components/appForm/style/appForm.scss +53 -0
- package/es/components/appIcon/appIcon.vue.mjs +2 -1
- package/es/components/appIconBox/style/appIconBox.scss +0 -1
- package/es/components/appInput/appInput.vue.mjs +99 -0
- package/es/components/appInput/index.mjs +6 -0
- package/es/components/appMenu/appMenu.vue.mjs +129 -0
- package/es/components/appMenu/index.mjs +6 -0
- package/es/components/appMenu/style/appMenu.scss +145 -0
- package/es/components/appOrgCascader/appOrgCascader.vue.mjs +14 -10
- package/es/components/appSearch/appSearch.vue.mjs +55 -211
- package/es/components/appSearch/cpns/appSearchItem.vue.mjs +238 -0
- package/es/components/appSearch/js/index.mjs +20 -8
- package/es/components/appSearch/js/useAppSearch.mjs +10 -5
- package/es/components/appSearch/style/appSearch.scss +10 -0
- package/es/components/appTable/appTable.vue.mjs +312 -158
- package/es/components/appTable/cpns/columnSelect.vue.mjs +151 -156
- package/es/components/appTable/cpns/columnSelectItem.vue2.mjs +104 -110
- package/es/components/appTable/cpns/headerItem.vue.mjs +98 -0
- package/es/components/appTable/cpns/virtualTable.vue.mjs +560 -0
- package/es/components/appTable/js/index.mjs +46 -20
- package/es/components/appTable/js/search.mjs +1 -2
- package/es/components/appTable/js/useAppTable.mjs +58 -14
- package/es/components/appTable/style/appTable.scss +16 -0
- package/es/components/appTooltip/appTooltip.vue.mjs +24 -13
- package/es/components/appTree/appTree.vue.mjs +304 -0
- package/es/components/appTree/index.mjs +6 -0
- package/es/components/appTree/js/index.mjs +531 -0
- package/es/components/appUserAvatar/appUserAvatar.vue.mjs +9 -8
- package/es/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/es/components/appVideoPlayer/appVideoPlayer.vue.mjs +647 -0
- package/es/components/appVideoPlayer/cpns/mediaLoading.vue.mjs +35 -0
- package/es/components/appVideoPlayer/index.mjs +6 -0
- package/es/components/appVideoPlayer/js/index.mjs +426 -0
- package/es/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/es/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/es/components/index.mjs +5 -0
- package/es/hooks/index.mjs +3 -0
- package/es/hooks/useApi.mjs +4 -4
- package/es/hooks/useAudioPlayerConfig.mjs +12 -0
- package/es/hooks/useGlobalConfig.mjs +18 -7
- package/es/hooks/useLocale.mjs +3 -11
- package/es/hooks/useMixins.mjs +1 -1
- package/es/hooks/usePermissionMap.mjs +12 -0
- package/es/hooks/useUserAvatarMap.mjs +2 -3
- package/es/hooks/useVideoPlayerConfig.mjs +12 -0
- package/es/index.mjs +14 -4
- package/es/locale/en.mjs +52 -3
- package/es/locale/zh_CN.mjs +48 -3
- package/es/make-installer.mjs +2 -0
- package/es/static/hy-svg-icons.js +462 -0
- package/es/static/protocolcheck.js +247 -0
- package/es/style/element/element.scss +9 -0
- package/es/style/element/index.scss +6 -3
- package/es/style/index.scss +11 -0
- package/es/style/theme.scss +73 -0
- package/es/utils/date.mjs +25 -1
- package/es/utils/file.mjs +5 -4
- package/es/utils/form.mjs +52 -0
- package/es/utils/handler.mjs +22 -2
- package/es/utils/index.mjs +6 -4
- package/es/utils/is.mjs +23 -2
- package/es/utils/loadScript.mjs +33 -0
- package/es/version.mjs +1 -1
- package/lib/components/appAudioPlayer/appAudioPlayer.vue.js +466 -0
- package/lib/components/appAudioPlayer/index.js +11 -0
- package/lib/components/appAudioPlayer/js/index.js +329 -0
- package/lib/components/appAudioPlayer/style/appAudioPlayer.scss +319 -0
- package/lib/components/appButton/style/appButton.scss +0 -1
- package/lib/components/appConfigProvider/appConfigProvider.vue.js +22 -1
- package/lib/components/appCutter/appCutter.vue.js +201 -128
- package/lib/components/appDatePicker/appDatePicker.vue.js +1 -1
- package/lib/components/appForm/appForm.vue.js +129 -206
- package/lib/components/appForm/cpns/appFormItem.vue.js +316 -0
- package/lib/components/appForm/cpns/arrayItem.vue.js +309 -0
- package/lib/components/appForm/cpns/extraItem.vue.js +144 -0
- package/lib/components/appForm/js/index.js +48 -23
- package/lib/components/appForm/js/useAppForm.js +30 -6
- package/lib/components/appForm/style/appForm.scss +53 -0
- package/lib/components/appIcon/appIcon.vue.js +2 -1
- package/lib/components/appIconBox/style/appIconBox.scss +0 -1
- package/lib/components/appInput/appInput.vue.js +103 -0
- package/lib/components/appInput/index.js +11 -0
- package/lib/components/appMenu/appMenu.vue.js +133 -0
- package/lib/components/appMenu/index.js +11 -0
- package/lib/components/appMenu/style/appMenu.scss +145 -0
- package/lib/components/appOrgCascader/appOrgCascader.vue.js +14 -10
- package/lib/components/appSearch/appSearch.vue.js +51 -207
- package/lib/components/appSearch/cpns/appSearchItem.vue.js +242 -0
- package/lib/components/appSearch/js/index.js +20 -7
- package/lib/components/appSearch/js/useAppSearch.js +10 -5
- package/lib/components/appSearch/style/appSearch.scss +10 -0
- package/lib/components/appTable/appTable.vue.js +319 -165
- package/lib/components/appTable/cpns/columnSelect.vue.js +151 -156
- package/lib/components/appTable/cpns/columnSelectItem.vue2.js +105 -111
- package/lib/components/appTable/cpns/headerItem.vue.js +102 -0
- package/lib/components/appTable/cpns/virtualTable.vue.js +564 -0
- package/lib/components/appTable/js/index.js +47 -19
- package/lib/components/appTable/js/search.js +1 -2
- package/lib/components/appTable/js/useAppTable.js +57 -13
- package/lib/components/appTable/style/appTable.scss +16 -0
- package/lib/components/appTooltip/appTooltip.vue.js +23 -12
- package/lib/components/appTree/appTree.vue.js +308 -0
- package/lib/components/appTree/index.js +11 -0
- package/lib/components/appTree/js/index.js +533 -0
- package/lib/components/appUserAvatar/appUserAvatar.vue.js +9 -8
- package/lib/components/appUserAvatar/style/appUserAvatar.scss +0 -1
- package/lib/components/appVideoPlayer/appVideoPlayer.vue.js +651 -0
- package/lib/components/appVideoPlayer/cpns/mediaLoading.vue.js +39 -0
- package/lib/components/appVideoPlayer/index.js +11 -0
- package/lib/components/appVideoPlayer/js/index.js +429 -0
- package/lib/components/appVideoPlayer/style/appVideoPlayer.scss +275 -0
- package/lib/components/appVideoPlayer/style/mediaLoading.scss +62 -0
- package/lib/components/index.js +42 -32
- package/lib/hooks/index.js +9 -0
- package/lib/hooks/useApi.js +4 -4
- package/lib/hooks/useAudioPlayerConfig.js +15 -0
- package/lib/hooks/useGlobalConfig.js +18 -7
- package/lib/hooks/useLocale.js +3 -11
- package/lib/hooks/useMixins.js +1 -1
- package/lib/hooks/usePermissionMap.js +15 -0
- package/lib/hooks/useUserAvatarMap.js +1 -2
- package/lib/hooks/useVideoPlayerConfig.js +15 -0
- package/lib/index.js +62 -33
- package/lib/locale/en.js +52 -3
- package/lib/locale/zh_CN.js +48 -3
- package/lib/make-installer.js +2 -0
- package/lib/static/hy-svg-icons.js +459 -8
- package/lib/static/protocolcheck.js +249 -0
- package/lib/style/element/element.scss +9 -0
- package/lib/style/element/index.scss +6 -3
- package/lib/style/index.scss +11 -0
- package/lib/style/theme.scss +73 -0
- package/lib/utils/date.js +25 -0
- package/lib/utils/file.js +4 -4
- package/lib/utils/form.js +57 -0
- package/lib/utils/handler.js +22 -1
- package/lib/utils/index.js +11 -1
- package/lib/utils/is.js +23 -1
- package/lib/utils/loadScript.js +37 -0
- package/lib/version.js +1 -1
- package/package.json +12 -10
- package/es/config/index.mjs +0 -1
- package/es/static/hy-svg-icons.mjs +0 -11
- package/lib/config/index.js +0 -2
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { useTemplateRef, ref, computed, openBlock, createElementBlock, createElementVNode, normalizeClass, createVNode, unref, withCtx, toDisplayString, normalizeStyle, Fragment, renderList, createBlock, createSlots, renderSlot, mergeProps } from 'vue';
|
|
2
|
+
import { ElIcon } from 'element-plus';
|
|
3
|
+
import { DArrowRight } from '@element-plus/icons-vue';
|
|
4
|
+
import _sfc_main$1 from './appFormItem.vue.mjs';
|
|
5
|
+
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
6
|
+
import { isNumber } from '../../../utils/is.mjs';
|
|
7
|
+
|
|
8
|
+
const _sfc_main = {
|
|
9
|
+
__name: "extraItem",
|
|
10
|
+
props: {
|
|
11
|
+
model: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: () => ({})
|
|
14
|
+
},
|
|
15
|
+
column: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
},
|
|
19
|
+
columnNum: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 1
|
|
22
|
+
},
|
|
23
|
+
loading: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
readonly: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
setup(__props) {
|
|
33
|
+
const props = __props;
|
|
34
|
+
const { t } = useLocale();
|
|
35
|
+
const containerRef = useTemplateRef("containerRef");
|
|
36
|
+
const containerHeight = ref(0);
|
|
37
|
+
const isExpand = ref(false);
|
|
38
|
+
const isExpandHover = ref(null);
|
|
39
|
+
function onExpandHandler(column) {
|
|
40
|
+
containerHeight.value = containerRef.value.clientHeight;
|
|
41
|
+
isExpand.value = !isExpand.value;
|
|
42
|
+
}
|
|
43
|
+
function onExpandMouseenter(column) {
|
|
44
|
+
isExpandHover.value = true;
|
|
45
|
+
}
|
|
46
|
+
function onExpandMouseleave(column) {
|
|
47
|
+
isExpandHover.value = false;
|
|
48
|
+
}
|
|
49
|
+
const containerStyle = computed(() => {
|
|
50
|
+
const columnNum = isNumber(props.column.columnNum) && props.column.columnNum > 0 ? props.column.columnNum : isNumber(props.columnNum) && props.columnNum > 0 ? props.columnNum || 1 : 1;
|
|
51
|
+
return {
|
|
52
|
+
gridTemplateColumns: `repeat(${columnNum}, minmax(0, 1fr))`
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
return (_ctx, _cache) => {
|
|
56
|
+
return openBlock(), createElementBlock("div", { class: "pt-6" }, [
|
|
57
|
+
createElementVNode("div", { class: "flex items-center justify-center text-xs relative" }, [
|
|
58
|
+
createElementVNode("div", {
|
|
59
|
+
class: normalizeClass(["app-form-extra", { expand: isExpand.value }]),
|
|
60
|
+
onClick: ($event) => onExpandHandler(__props.column),
|
|
61
|
+
onMouseenter: ($event) => onExpandMouseenter(__props.column),
|
|
62
|
+
onMouseleave: ($event) => onExpandMouseleave(__props.column)
|
|
63
|
+
}, [
|
|
64
|
+
createVNode(unref(ElIcon), {
|
|
65
|
+
size: "8",
|
|
66
|
+
class: "app-form-extra-arrow"
|
|
67
|
+
}, {
|
|
68
|
+
default: withCtx(() => [
|
|
69
|
+
createVNode(unref(DArrowRight))
|
|
70
|
+
]),
|
|
71
|
+
_: 1
|
|
72
|
+
/* STABLE */
|
|
73
|
+
}),
|
|
74
|
+
createElementVNode(
|
|
75
|
+
"span",
|
|
76
|
+
{ class: "ml-1.5" },
|
|
77
|
+
toDisplayString(isExpandHover.value ? unref(t)("form.additionalInformationHoverTip") : unref(t)("form.additionalInformationTip")),
|
|
78
|
+
1
|
|
79
|
+
/* TEXT */
|
|
80
|
+
)
|
|
81
|
+
], 42, ["onClick", "onMouseenter", "onMouseleave"]),
|
|
82
|
+
createElementVNode("div", { class: "app-form-extra-line" })
|
|
83
|
+
]),
|
|
84
|
+
createElementVNode(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
class: "mt-3 overflow-hidden transition-all",
|
|
88
|
+
style: normalizeStyle({ height: isExpand.value ? `${containerHeight.value || 0}px` : "0px" })
|
|
89
|
+
},
|
|
90
|
+
[
|
|
91
|
+
createElementVNode(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
ref_key: "containerRef",
|
|
95
|
+
ref: containerRef,
|
|
96
|
+
class: "grid gap-x-6",
|
|
97
|
+
style: normalizeStyle(containerStyle.value)
|
|
98
|
+
},
|
|
99
|
+
[
|
|
100
|
+
(openBlock(true), createElementBlock(
|
|
101
|
+
Fragment,
|
|
102
|
+
null,
|
|
103
|
+
renderList(__props.column.children, (item, index) => {
|
|
104
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
105
|
+
key: index,
|
|
106
|
+
model: __props.model,
|
|
107
|
+
column: item,
|
|
108
|
+
loading: __props.loading,
|
|
109
|
+
readonly: __props.readonly
|
|
110
|
+
}, createSlots({
|
|
111
|
+
_: 2
|
|
112
|
+
/* DYNAMIC */
|
|
113
|
+
}, [
|
|
114
|
+
renderList(_ctx.$slots, (_, slotName) => {
|
|
115
|
+
return {
|
|
116
|
+
name: slotName,
|
|
117
|
+
fn: withCtx((scope) => [
|
|
118
|
+
renderSlot(_ctx.$slots, slotName, mergeProps({ ref_for: true }, scope))
|
|
119
|
+
])
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
]), 1032, ["model", "column", "loading", "readonly"]);
|
|
123
|
+
}),
|
|
124
|
+
128
|
|
125
|
+
/* KEYED_FRAGMENT */
|
|
126
|
+
))
|
|
127
|
+
],
|
|
128
|
+
4
|
|
129
|
+
/* STYLE */
|
|
130
|
+
)
|
|
131
|
+
],
|
|
132
|
+
4
|
|
133
|
+
/* STYLE */
|
|
134
|
+
)
|
|
135
|
+
]);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export { _sfc_main as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { unref } from 'vue';
|
|
2
|
-
import { isBoolean, isFunction, isNumber, isArray, isObject } from '../../../utils/is.mjs';
|
|
3
2
|
import { funRunHandler } from '../../../utils/handler.mjs';
|
|
3
|
+
import { isNumber, isBoolean, isFunction, isArray, isObject } from '../../../utils/is.mjs';
|
|
4
|
+
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
4
5
|
|
|
5
6
|
function columnItemStyle(props, column) {
|
|
6
7
|
const style = {};
|
|
@@ -8,6 +9,14 @@ function columnItemStyle(props, column) {
|
|
|
8
9
|
if (isNumber(span) && span > 1) {
|
|
9
10
|
span = span >= props.columnNum ? props.columnNum : span;
|
|
10
11
|
style["grid-column"] = `span ${span}`;
|
|
12
|
+
} else {
|
|
13
|
+
switch (column.type) {
|
|
14
|
+
case "title":
|
|
15
|
+
case "extra":
|
|
16
|
+
case "array":
|
|
17
|
+
style["grid-column"] = `span ${props.columnNum}`;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
11
20
|
}
|
|
12
21
|
return style;
|
|
13
22
|
}
|
|
@@ -18,7 +27,6 @@ function columnShowHandler(props, column) {
|
|
|
18
27
|
return true;
|
|
19
28
|
}
|
|
20
29
|
function isRequired(props, column) {
|
|
21
|
-
var _a;
|
|
22
30
|
let { readonly, field, rules } = column;
|
|
23
31
|
if (props.readonly || readonly) {
|
|
24
32
|
return false;
|
|
@@ -26,33 +34,35 @@ function isRequired(props, column) {
|
|
|
26
34
|
if (Array.isArray(field)) {
|
|
27
35
|
return field.find((key) => isRequired(props, { ...column, field: key }));
|
|
28
36
|
}
|
|
29
|
-
rules = isArray(rules) &&
|
|
37
|
+
rules = isArray(rules) && rules?.length || isObject(rules) ? rules : props.rules?.[field];
|
|
30
38
|
if (isArray(rules)) {
|
|
31
39
|
return rules.some((item) => item.required);
|
|
32
40
|
}
|
|
33
41
|
if (isObject(rules)) {
|
|
34
|
-
return rules
|
|
42
|
+
return rules?.required;
|
|
35
43
|
}
|
|
36
44
|
return false;
|
|
37
45
|
}
|
|
38
46
|
function isDisabled(props, column) {
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
if (props.loading) return true;
|
|
48
|
+
const disabled = unref(column.attrs?.disabled);
|
|
49
|
+
if (isBoolean(disabled)) return disabled;
|
|
50
|
+
if (isFunction(disabled)) return disabled(column, props.model);
|
|
51
|
+
return false;
|
|
41
52
|
}
|
|
42
|
-
function renderText(props, column = {}
|
|
43
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
53
|
+
function renderText(props, column = {}) {
|
|
44
54
|
const { type, field, customRender } = column;
|
|
45
|
-
const { fieldNames, options = [] } = column.attrs || {};
|
|
55
|
+
const { props: fieldNames, options = [] } = column.attrs || {};
|
|
46
56
|
if (customRender && typeof customRender === "function") {
|
|
47
57
|
return customRender({
|
|
48
|
-
column
|
|
58
|
+
column,
|
|
49
59
|
model: props.model,
|
|
50
60
|
value: props.model[field]
|
|
51
61
|
});
|
|
52
62
|
}
|
|
53
63
|
if (type === "range-picker") {
|
|
54
64
|
const [start, end] = field;
|
|
55
|
-
return
|
|
65
|
+
return props.model?.[start] ? `${props.model?.[start]} ~ ${props.model?.[end]}` : "";
|
|
56
66
|
}
|
|
57
67
|
if (type === "location") {
|
|
58
68
|
const [lon, lat] = field;
|
|
@@ -60,27 +70,39 @@ function renderText(props, column = {}, index) {
|
|
|
60
70
|
}
|
|
61
71
|
if (/^(select|radio|checkbox)$/.test(type)) {
|
|
62
72
|
const target = options.find(
|
|
63
|
-
(item) =>
|
|
64
|
-
var _a2;
|
|
65
|
-
return item[fieldNames.value] === ((_a2 = props.model) == null ? void 0 : _a2[field]);
|
|
66
|
-
}
|
|
73
|
+
(item) => item[fieldNames.value] === props.model?.[field]
|
|
67
74
|
);
|
|
68
|
-
return
|
|
75
|
+
return target?.[fieldNames.label] || props.model?.[field] || "";
|
|
69
76
|
}
|
|
70
77
|
if (/^dept-select(-all)?$/.test(type)) {
|
|
71
78
|
const dict = /^dept-select$/.test(type) ? deptTreeDict.value : deptTreeAllDict.value;
|
|
72
|
-
return dict[
|
|
79
|
+
return dict[props.model?.[field]] || props.model?.[field] || "";
|
|
73
80
|
}
|
|
74
81
|
if (type === "area-select") {
|
|
75
|
-
return areaTreeDict.value[
|
|
82
|
+
return areaTreeDict.value[props.model?.[field]] || props.model?.[field] || "";
|
|
76
83
|
}
|
|
77
84
|
if (Array.isArray(field)) {
|
|
78
|
-
return field.map((key) =>
|
|
79
|
-
var _a2;
|
|
80
|
-
return ((_a2 = props.model) == null ? void 0 : _a2[key]) || "";
|
|
81
|
-
}).filter(Boolean).join(" - ");
|
|
85
|
+
return field.map((key) => props.model?.[key] || "").filter(Boolean).join(" - ");
|
|
82
86
|
}
|
|
83
|
-
return
|
|
87
|
+
return props.model?.[field] || props.model?.[field] || "";
|
|
88
|
+
}
|
|
89
|
+
function renderArrayItemLabel(props, column, index) {
|
|
90
|
+
const { t } = useLocale();
|
|
91
|
+
const itemLabel = unref(column.itemLabel);
|
|
92
|
+
if (isFunction(itemLabel)) return itemLabel(column, index);
|
|
93
|
+
return (itemLabel || t("form.dynamicFormItem")) + ` ${index + 1}`;
|
|
94
|
+
}
|
|
95
|
+
function renderAddLabel(props, column) {
|
|
96
|
+
const { t } = useLocale();
|
|
97
|
+
let addLabel = unref(column.addLabel);
|
|
98
|
+
if (isFunction(addLabel)) return addLabel();
|
|
99
|
+
return addLabel || t("form.addFormItem");
|
|
100
|
+
}
|
|
101
|
+
function optionsHandler(props, column) {
|
|
102
|
+
const options = unref(column.attrs.options);
|
|
103
|
+
if (isArray(options)) return options;
|
|
104
|
+
if (isFunction(options)) return options(column, props.model);
|
|
105
|
+
return [];
|
|
84
106
|
}
|
|
85
107
|
|
|
86
|
-
export { columnItemStyle, columnShowHandler, isDisabled, isRequired, renderText };
|
|
108
|
+
export { columnItemStyle, columnShowHandler, isDisabled, isRequired, optionsHandler, renderAddLabel, renderArrayItemLabel, renderText };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { unref, toRef } from 'vue';
|
|
2
|
+
import { genValueByProp } from '../../../utils/form.mjs';
|
|
2
3
|
import { funRunHandler, mergeDeep } from '../../../utils/handler.mjs';
|
|
3
4
|
import { getDefaultValueFormatByType } from '../../../utils/date.mjs';
|
|
4
|
-
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
5
5
|
import { isArray } from '../../../utils/is.mjs';
|
|
6
|
+
import { useLocale } from '../../../hooks/useLocale.mjs';
|
|
6
7
|
|
|
7
8
|
const genDefaultLabel = (config) => {
|
|
8
9
|
if (config.label) return config.label;
|
|
@@ -26,7 +27,7 @@ const genPlaceholderHandler = (config) => {
|
|
|
26
27
|
break;
|
|
27
28
|
case "date-picker":
|
|
28
29
|
if (["datetimerange", "daterange", "monthrange", "yearrange"].includes(
|
|
29
|
-
attrs
|
|
30
|
+
attrs?.type
|
|
30
31
|
)) {
|
|
31
32
|
switch (attrs.type) {
|
|
32
33
|
case "yearrange":
|
|
@@ -58,7 +59,7 @@ const genPlaceholderHandler = (config) => {
|
|
|
58
59
|
const genRuleRequiredMsgHandler = (config) => {
|
|
59
60
|
const { t } = useLocale();
|
|
60
61
|
const { type, prop, label } = config || {};
|
|
61
|
-
if (!prop || !
|
|
62
|
+
if (!prop || !prop?.length) return "";
|
|
62
63
|
switch (type) {
|
|
63
64
|
case "input":
|
|
64
65
|
return t("hy.pleaseEnterPlaceholder", [label]);
|
|
@@ -130,18 +131,41 @@ function appFormItemHandler(column = {}) {
|
|
|
130
131
|
endPlaceholder
|
|
131
132
|
}
|
|
132
133
|
};
|
|
134
|
+
} else if (/^(extra)$/.test(column.type)) {
|
|
135
|
+
return {
|
|
136
|
+
...column,
|
|
137
|
+
children: (column.children || []).map((item) => appFormItemHandler(item))
|
|
138
|
+
};
|
|
139
|
+
} else if (/^(array)$/.test(column.type)) {
|
|
140
|
+
return {
|
|
141
|
+
height: 500,
|
|
142
|
+
emptyChildren: false,
|
|
143
|
+
...column,
|
|
144
|
+
children: (column.children || []).map((item) => appFormItemHandler(item))
|
|
145
|
+
};
|
|
133
146
|
}
|
|
134
147
|
return column;
|
|
135
148
|
}
|
|
136
149
|
const resetAppFormValue = (columns = [], obj = {}) => {
|
|
137
150
|
for (const item of columns) {
|
|
138
151
|
const value = funRunHandler(item.defaultValue);
|
|
139
|
-
if (
|
|
152
|
+
if (item.type === "array") {
|
|
153
|
+
if (isArray(value)) {
|
|
154
|
+
obj[item.prop] = value;
|
|
155
|
+
} else if (!item.emptyChildren) {
|
|
156
|
+
const childValue = resetAppFormValue(item.children);
|
|
157
|
+
obj[item.prop] = [childValue];
|
|
158
|
+
}
|
|
159
|
+
} else if (Array.isArray(item.prop)) {
|
|
140
160
|
for (let i = 0; i < item.prop.length; i++) {
|
|
141
|
-
|
|
161
|
+
genValueByProp(
|
|
162
|
+
obj,
|
|
163
|
+
item.prop[i],
|
|
164
|
+
Array.isArray(value) ? value[i] : void 0
|
|
165
|
+
);
|
|
142
166
|
}
|
|
143
167
|
} else {
|
|
144
|
-
obj
|
|
168
|
+
genValueByProp(obj, item.prop, value);
|
|
145
169
|
}
|
|
146
170
|
}
|
|
147
171
|
return obj;
|
|
@@ -14,3 +14,56 @@
|
|
|
14
14
|
color: rgba(var(--hy-danger-2));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
.app-form-extra {
|
|
19
|
+
height: 32px;
|
|
20
|
+
color: rgba(var(--hy-auxiliary));
|
|
21
|
+
position: relative;
|
|
22
|
+
padding: 0 40px;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
border-radius: 1000px;
|
|
27
|
+
border: 1px solid rgba(var(--hy-auxiliary));
|
|
28
|
+
background-color: rgba(var(--hy-background-2));
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
transition: all 0.1s linear;
|
|
31
|
+
user-select: none;
|
|
32
|
+
z-index: 2;
|
|
33
|
+
.app-form-extra-arrow {
|
|
34
|
+
transform: rotateZ(90deg) rotateY(0deg);
|
|
35
|
+
transition: all 0.3s linear;
|
|
36
|
+
}
|
|
37
|
+
&:hover {
|
|
38
|
+
color: rgba(var(--hy-theme));
|
|
39
|
+
border-color: rgba(var(--hy-theme));
|
|
40
|
+
box-shadow: 0px 0px 12px 1px rgba(var(--hy-theme), 0.5);
|
|
41
|
+
& + .app-form-extra-line {
|
|
42
|
+
background: radial-gradient(
|
|
43
|
+
circle,
|
|
44
|
+
rgba(var(--hy-theme), 1),
|
|
45
|
+
rgba(var(--hy-theme), 0)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
&.expand {
|
|
50
|
+
.app-form-extra-arrow {
|
|
51
|
+
transform: rotateZ(90deg) rotateY(-180deg);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.app-form-extra-line {
|
|
57
|
+
width: 100%;
|
|
58
|
+
height: 2px;
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: 0;
|
|
61
|
+
top: 50%;
|
|
62
|
+
transform: translateY(-50%);
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
background: radial-gradient(
|
|
65
|
+
circle,
|
|
66
|
+
rgba(var(--hy-auxiliary), 1),
|
|
67
|
+
rgba(var(--hy-auxiliary), 0)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode } from 'vue';
|
|
2
|
+
import { svgIconLoad } from '../../utils/loadScript.mjs';
|
|
2
3
|
|
|
3
4
|
import "./style/appIcon.scss";
|
|
4
5
|
|
|
@@ -31,10 +32,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
31
32
|
return "app-icon";
|
|
32
33
|
}
|
|
33
34
|
});
|
|
35
|
+
svgIconLoad();
|
|
34
36
|
return (_ctx, _cache) => {
|
|
35
37
|
return openBlock(), createElementBlock("svg", {
|
|
36
38
|
class: normalizeClass(svgClass.value),
|
|
37
|
-
"aria-hidden": "true",
|
|
38
39
|
svgName: __props.svgName
|
|
39
40
|
}, [
|
|
40
41
|
createElementVNode("use", { "xlink:href": iconName.value }, null, 8, ["xlink:href"])
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useModel, useTemplateRef, computed, openBlock, createBlock, unref, mergeProps, mergeModels, defineComponent } from 'vue';
|
|
2
|
+
import { ElInput } from 'element-plus';
|
|
3
|
+
import { clearSpace } from '../../utils/form.mjs';
|
|
4
|
+
|
|
5
|
+
const __default__ = defineComponent({
|
|
6
|
+
name: "AppInput"
|
|
7
|
+
});
|
|
8
|
+
const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
9
|
+
props: /* @__PURE__ */ mergeModels({
|
|
10
|
+
type: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "text"
|
|
13
|
+
},
|
|
14
|
+
clearSpaceType: {
|
|
15
|
+
type: String,
|
|
16
|
+
// between-清除两端空格 all-清除所有空格 before-清除前面的空格 after-清除后面的空格 none-不清除空格
|
|
17
|
+
default: "between"
|
|
18
|
+
}
|
|
19
|
+
}, {
|
|
20
|
+
"modelValue": { type: String, default: "" },
|
|
21
|
+
"modelModifiers": {}
|
|
22
|
+
}),
|
|
23
|
+
emits: /* @__PURE__ */ mergeModels([], ["update:modelValue"]),
|
|
24
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const modelValue = useModel(__props, "modelValue");
|
|
27
|
+
const inputRef = useTemplateRef("inputRef");
|
|
28
|
+
const bindValue = computed({
|
|
29
|
+
get() {
|
|
30
|
+
return modelValue.value;
|
|
31
|
+
},
|
|
32
|
+
set(val) {
|
|
33
|
+
if (val && props.type !== "password") {
|
|
34
|
+
if (["between", "before"].includes(props.clearSpaceType)) {
|
|
35
|
+
modelValue.value = clearSpace(val, "before");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (["all"].includes(props.clearSpaceType)) {
|
|
39
|
+
modelValue.value = clearSpace(val, props.clearSpaceType);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
modelValue.value = val;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
function onBlurHandler() {
|
|
47
|
+
if (modelValue.value && props.type !== "password") {
|
|
48
|
+
modelValue.value = clearSpace(modelValue.value, props.clearSpaceType);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
__expose({
|
|
52
|
+
blur() {
|
|
53
|
+
inputRef.value.blur();
|
|
54
|
+
},
|
|
55
|
+
clear() {
|
|
56
|
+
inputRef.value.clear();
|
|
57
|
+
},
|
|
58
|
+
focus() {
|
|
59
|
+
inputRef.value.focus();
|
|
60
|
+
},
|
|
61
|
+
input: computed(() => {
|
|
62
|
+
return inputRef.value.input;
|
|
63
|
+
}),
|
|
64
|
+
ref: computed(() => {
|
|
65
|
+
return inputRef.value.ref;
|
|
66
|
+
}),
|
|
67
|
+
resizeTextarea() {
|
|
68
|
+
inputRef.value.resizeTextarea();
|
|
69
|
+
},
|
|
70
|
+
select() {
|
|
71
|
+
inputRef.value.select();
|
|
72
|
+
},
|
|
73
|
+
textarea: computed(() => {
|
|
74
|
+
return inputRef.value.textarea;
|
|
75
|
+
}),
|
|
76
|
+
textareaStyle: computed(() => {
|
|
77
|
+
return inputRef.value.textareaStyle;
|
|
78
|
+
}),
|
|
79
|
+
isComposing: computed(() => {
|
|
80
|
+
return inputRef.value.isComposing;
|
|
81
|
+
}),
|
|
82
|
+
passwordVisible: computed(() => {
|
|
83
|
+
return inputRef.value.passwordVisible;
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
return (_ctx, _cache) => {
|
|
87
|
+
return openBlock(), createBlock(unref(ElInput), mergeProps({
|
|
88
|
+
ref_key: "inputRef",
|
|
89
|
+
ref: inputRef,
|
|
90
|
+
modelValue: bindValue.value,
|
|
91
|
+
"onUpdate:modelValue": ($event) => bindValue.value = $event
|
|
92
|
+
}, _ctx.$attrs, {
|
|
93
|
+
onBlur: ($event) => onBlurHandler(props, _ctx.column)
|
|
94
|
+
}), null, 16, ["modelValue", "onUpdate:modelValue", "onBlur"]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineComponent, useModel, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, unref, createBlock, withCtx, withModifiers, createVNode, toDisplayString, createCommentVNode, normalizeStyle, mergeModels } from 'vue';
|
|
2
|
+
import { ElIcon } from 'element-plus';
|
|
3
|
+
import { Download } from '@element-plus/icons-vue';
|
|
4
|
+
import { usePermissionMap } from '../../hooks/usePermissionMap.mjs';
|
|
5
|
+
import { AppTooltip } from '../appTooltip/index.mjs';
|
|
6
|
+
import { AppIcon } from '../appIcon/index.mjs';
|
|
7
|
+
|
|
8
|
+
import "./style/appMenu.scss";
|
|
9
|
+
|
|
10
|
+
const __default__ = defineComponent({
|
|
11
|
+
name: "AppMenu"
|
|
12
|
+
});
|
|
13
|
+
const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
14
|
+
props: /* @__PURE__ */ mergeModels({
|
|
15
|
+
menu: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
showShrink: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
"modelValue": { type: String, default: "" },
|
|
25
|
+
"modelModifiers": {},
|
|
26
|
+
"expand": { type: Boolean, default: true },
|
|
27
|
+
"expandModifiers": {}
|
|
28
|
+
}),
|
|
29
|
+
emits: /* @__PURE__ */ mergeModels(["select", "open", "close"], ["update:modelValue", "update:expand"]),
|
|
30
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
31
|
+
const emits = __emit;
|
|
32
|
+
const { permissionMap } = usePermissionMap();
|
|
33
|
+
const modelValue = useModel(__props, "modelValue");
|
|
34
|
+
const expand = useModel(__props, "expand");
|
|
35
|
+
function onClickHandler(item) {
|
|
36
|
+
modelValue.value = item.path;
|
|
37
|
+
emits("select", item);
|
|
38
|
+
}
|
|
39
|
+
function onExpandHandler() {
|
|
40
|
+
expand.value = !expand.value;
|
|
41
|
+
emits(expand.value ? "open" : "close");
|
|
42
|
+
}
|
|
43
|
+
__expose({});
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
return openBlock(), createElementBlock(
|
|
46
|
+
"div",
|
|
47
|
+
{
|
|
48
|
+
class: normalizeClass(["operator-menu-box user-select-none", { "operator-menu-box-expand": expand.value }])
|
|
49
|
+
},
|
|
50
|
+
[
|
|
51
|
+
createElementVNode("div", { class: "operator-menu-list scroll-body" }, [
|
|
52
|
+
(openBlock(true), createElementBlock(
|
|
53
|
+
Fragment,
|
|
54
|
+
null,
|
|
55
|
+
renderList(__props.menu, (item, index) => {
|
|
56
|
+
return openBlock(), createElementBlock(
|
|
57
|
+
Fragment,
|
|
58
|
+
{ key: index },
|
|
59
|
+
[
|
|
60
|
+
unref(permissionMap).has(item.permission) ? (openBlock(), createBlock(unref(AppTooltip), {
|
|
61
|
+
key: 0,
|
|
62
|
+
"is-always": "",
|
|
63
|
+
disabled: expand.value,
|
|
64
|
+
content: item.label,
|
|
65
|
+
placement: "right"
|
|
66
|
+
}, {
|
|
67
|
+
default: withCtx(() => [
|
|
68
|
+
createElementVNode("div", {
|
|
69
|
+
class: normalizeClass(["operator-menu-item", { "operator-menu-item-active": modelValue.value === item.path }]),
|
|
70
|
+
onClick: withModifiers(($event) => onClickHandler(item), ["stop"])
|
|
71
|
+
}, [
|
|
72
|
+
createElementVNode("div", { class: "operator-label clickBox over_one_line" }, [
|
|
73
|
+
createVNode(unref(AppIcon), {
|
|
74
|
+
"svg-name": `${item.iconName}`,
|
|
75
|
+
"class-name": "!w-5 !h-5 flex-shrink-0"
|
|
76
|
+
}, null, 8, ["svg-name"]),
|
|
77
|
+
createElementVNode(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
class: normalizeClass({ "ml-3": expand.value })
|
|
81
|
+
},
|
|
82
|
+
toDisplayString(expand.value ? item.label : item.tip || item.label),
|
|
83
|
+
3
|
|
84
|
+
/* TEXT, CLASS */
|
|
85
|
+
)
|
|
86
|
+
])
|
|
87
|
+
], 10, ["onClick"])
|
|
88
|
+
]),
|
|
89
|
+
_: 2
|
|
90
|
+
/* DYNAMIC */
|
|
91
|
+
}, 1032, ["disabled", "content"])) : createCommentVNode("v-if", true)
|
|
92
|
+
],
|
|
93
|
+
64
|
|
94
|
+
/* STABLE_FRAGMENT */
|
|
95
|
+
);
|
|
96
|
+
}),
|
|
97
|
+
128
|
|
98
|
+
/* KEYED_FRAGMENT */
|
|
99
|
+
))
|
|
100
|
+
]),
|
|
101
|
+
__props.showShrink ? (openBlock(), createElementBlock("div", {
|
|
102
|
+
key: 0,
|
|
103
|
+
class: normalizeClass(["w-full h-[44px] border-t border-border box-border cursor-pointer relative", { "justify-end pr-3": expand.value, "justify-center": !expand.value }]),
|
|
104
|
+
onClick: ($event) => onExpandHandler()
|
|
105
|
+
}, [
|
|
106
|
+
createVNode(unref(ElIcon), {
|
|
107
|
+
size: "20",
|
|
108
|
+
style: normalizeStyle({
|
|
109
|
+
transform: expand.value ? "translate(0px, -50%) rotateY(0deg) rotateZ(90deg)" : "translate(50%, -50%) rotateY(-180deg) rotateZ(90deg)",
|
|
110
|
+
transition: "all 0.3s linear"
|
|
111
|
+
}),
|
|
112
|
+
class: normalizeClass(["absolute top-1/2", { "right-3": expand.value, "right-1/2": !expand.value }])
|
|
113
|
+
}, {
|
|
114
|
+
default: withCtx(() => [
|
|
115
|
+
createVNode(unref(Download))
|
|
116
|
+
]),
|
|
117
|
+
_: 1
|
|
118
|
+
/* STABLE */
|
|
119
|
+
}, 8, ["style", "class"])
|
|
120
|
+
], 10, ["onClick"])) : createCommentVNode("v-if", true)
|
|
121
|
+
],
|
|
122
|
+
2
|
|
123
|
+
/* CLASS */
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
export { _sfc_main as default };
|