yc-pro-components 0.0.20 → 0.0.21
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/index.mjs +3 -1
- package/es/components/yc-plus-page/index.d.ts +5 -1
- package/es/components/yc-plus-page/index.mjs +5 -1
- package/es/components/yc-plus-page/src/constants.d.ts +22 -0
- package/es/components/yc-plus-page/src/constants.mjs +41 -0
- package/es/components/yc-plus-page/src/header-filter-cell.vue.d.ts +85 -0
- package/es/components/yc-plus-page/src/header-filter-cell.vue.mjs +6 -0
- package/es/components/yc-plus-page/src/header-filter-cell.vue2.mjs +354 -0
- package/es/components/yc-plus-page/src/index.vue.d.ts +327 -23
- package/es/components/yc-plus-page/src/index.vue.mjs +1 -1
- package/es/components/yc-plus-page/src/index.vue2.mjs +126 -8
- package/es/components/yc-plus-page/src/type.d.ts +112 -0
- package/es/components/yc-plus-page/src/use-header-filter.d.ts +55 -0
- package/es/components/yc-plus-page/src/use-header-filter.mjs +172 -0
- package/es/index.css +2 -1
- package/es/index.mjs +3 -1
- package/index.css +10 -6
- package/index.js +844 -163
- package/index.min.css +2 -1
- package/index.min.js +7 -7
- package/index.min.mjs +7 -7
- package/index.mjs +839 -164
- package/lib/components/index.js +8 -0
- package/lib/components/yc-plus-page/index.d.ts +5 -1
- package/lib/components/yc-plus-page/index.js +10 -0
- package/lib/components/yc-plus-page/src/constants.d.ts +22 -0
- package/lib/components/yc-plus-page/src/constants.js +46 -0
- package/lib/components/yc-plus-page/src/header-filter-cell.vue.d.ts +85 -0
- package/lib/components/yc-plus-page/src/header-filter-cell.vue.js +10 -0
- package/lib/components/yc-plus-page/src/header-filter-cell.vue2.js +358 -0
- package/lib/components/yc-plus-page/src/index.vue.d.ts +327 -23
- package/lib/components/yc-plus-page/src/index.vue.js +1 -1
- package/lib/components/yc-plus-page/src/index.vue2.js +125 -7
- package/lib/components/yc-plus-page/src/type.d.ts +112 -0
- package/lib/components/yc-plus-page/src/use-header-filter.d.ts +55 -0
- package/lib/components/yc-plus-page/src/use-header-filter.js +174 -0
- package/lib/index.css +2 -1
- package/lib/index.js +8 -0
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/ja.js +1 -1
- package/locale/ja.min.js +1 -1
- package/locale/ja.min.mjs +1 -1
- package/locale/ja.mjs +1 -1
- package/locale/ko.js +1 -1
- package/locale/ko.min.js +1 -1
- package/locale/ko.min.mjs +1 -1
- package/locale/ko.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/locale/zh-tw.js +1 -1
- package/locale/zh-tw.min.js +1 -1
- package/locale/zh-tw.min.mjs +1 -1
- package/locale/zh-tw.mjs +1 -1
- package/package.json +1 -1
package/lib/components/index.js
CHANGED
|
@@ -43,6 +43,8 @@ var index$O = require('./yc-download-dialog/index.js');
|
|
|
43
43
|
var index$Q = require('./yc-tabs-with-filter/index.js');
|
|
44
44
|
var type = require('./yc-config-provider/src/type.js');
|
|
45
45
|
var useYcConfig = require('./yc-config-provider/src/useYcConfig.js');
|
|
46
|
+
var useHeaderFilter = require('./yc-plus-page/src/use-header-filter.js');
|
|
47
|
+
var constants = require('./yc-plus-page/src/constants.js');
|
|
46
48
|
var index$o = require('./yc-select-v2/src/index.vue.js');
|
|
47
49
|
var treeDataUtils = require('./yc-plus-tree/src/treeDataUtils.js');
|
|
48
50
|
var type$1 = require('./yc-dialog/src/type.js');
|
|
@@ -91,6 +93,7 @@ exports.ReConfigProvider = index$m.YcConfigProvider;
|
|
|
91
93
|
exports.YcConfigProvider = index$m.YcConfigProvider;
|
|
92
94
|
exports.RePlusPage = index$n.RePlusPage;
|
|
93
95
|
exports.YcPlusPage = index$n.YcPlusPage;
|
|
96
|
+
exports.YcTableHeaderFilterCell = index$n.YcTableHeaderFilterCell;
|
|
94
97
|
exports.RePlusTree = index$p.RePlusTree;
|
|
95
98
|
exports.YcPlusTree = index$p.YcPlusTree;
|
|
96
99
|
exports.ReDialog = index$q.ReDialog;
|
|
@@ -129,6 +132,11 @@ exports.useYcConfig = useYcConfig.useYcConfig;
|
|
|
129
132
|
exports.useYcPerms = useYcConfig.useYcPerms;
|
|
130
133
|
exports.useYcShowPageSearch = useYcConfig.useYcShowPageSearch;
|
|
131
134
|
exports.useYcTranslate = useYcConfig.useYcTranslate;
|
|
135
|
+
exports.useHeaderFilter = useHeaderFilter.useHeaderFilter;
|
|
136
|
+
exports.DEFAULT_OPERATORS = constants.DEFAULT_OPERATORS;
|
|
137
|
+
exports.NO_VALUE_OPERATORS = constants.NO_VALUE_OPERATORS;
|
|
138
|
+
exports.OPERATOR_CATALOG = constants.OPERATOR_CATALOG;
|
|
139
|
+
exports.OPERATOR_LABELS = constants.OPERATOR_LABELS;
|
|
132
140
|
exports.ReSelectV2 = index$o.default;
|
|
133
141
|
exports.YcSelectV2 = index$o.default;
|
|
134
142
|
exports.findNodeById = treeDataUtils.findNodeById;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { default as YcPlusPageComponent } from './src/index.vue';
|
|
2
2
|
import { DefineComponent } from 'vue';
|
|
3
3
|
|
|
4
|
-
export type { YcPlusPageProps } from './src/type';
|
|
4
|
+
export type { YcPlusPageProps, FieldCatalogItem, FieldCatalog, OperatorOption, HeaderFilterConfig, ColumnHeaderFilterConfig, HeaderFilterPayload, HeaderFilterResetPayload, FilterItem, HeaderFiltersState, OrderByItem, RequestResponse } from './src/type';
|
|
5
|
+
export { useHeaderFilter } from './src/use-header-filter';
|
|
6
|
+
export type { UseHeaderFilterOptions, UseHeaderFilterReturn } from './src/use-header-filter';
|
|
7
|
+
export { OPERATOR_CATALOG, OPERATOR_LABELS, NO_VALUE_OPERATORS, DEFAULT_OPERATORS } from './src/constants';
|
|
5
8
|
export type YcPlusPageInstance = InstanceType<typeof YcPlusPageComponent>;
|
|
6
9
|
export declare const YcPlusPage: DefineComponent;
|
|
10
|
+
export declare const YcTableHeaderFilterCell: DefineComponent;
|
|
7
11
|
export declare const RePlusPage: DefineComponent;
|
|
8
12
|
export type { YcPlusPageProps as RePlusPageProps } from './src/type';
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./src/index.vue.js');
|
|
4
|
+
var headerFilterCell = require('./src/header-filter-cell.vue.js');
|
|
5
|
+
var useHeaderFilter = require('./src/use-header-filter.js');
|
|
6
|
+
var constants = require('./src/constants.js');
|
|
4
7
|
|
|
5
8
|
const YcPlusPage = index.default;
|
|
9
|
+
const YcTableHeaderFilterCell = headerFilterCell.default;
|
|
6
10
|
const RePlusPage = index.default;
|
|
7
11
|
|
|
12
|
+
exports.useHeaderFilter = useHeaderFilter.useHeaderFilter;
|
|
13
|
+
exports.DEFAULT_OPERATORS = constants.DEFAULT_OPERATORS;
|
|
14
|
+
exports.NO_VALUE_OPERATORS = constants.NO_VALUE_OPERATORS;
|
|
15
|
+
exports.OPERATOR_CATALOG = constants.OPERATOR_CATALOG;
|
|
16
|
+
exports.OPERATOR_LABELS = constants.OPERATOR_LABELS;
|
|
8
17
|
exports.RePlusPage = RePlusPage;
|
|
9
18
|
exports.YcPlusPage = YcPlusPage;
|
|
19
|
+
exports.YcTableHeaderFilterCell = YcTableHeaderFilterCell;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 表头筛选相关常量
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 操作符目录 - 按字段类型分组
|
|
6
|
+
*/
|
|
7
|
+
export declare const OPERATOR_CATALOG: Record<string, string[]>;
|
|
8
|
+
/**
|
|
9
|
+
* 操作符中文映射
|
|
10
|
+
*/
|
|
11
|
+
export declare const OPERATOR_LABELS: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* 不需要输入值的操作符
|
|
14
|
+
*/
|
|
15
|
+
export declare const NO_VALUE_OPERATORS: string[];
|
|
16
|
+
/**
|
|
17
|
+
* 默认操作符
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_OPERATORS: {
|
|
20
|
+
label: string;
|
|
21
|
+
code: string;
|
|
22
|
+
}[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const OPERATOR_CATALOG = {
|
|
4
|
+
string: ["=", "!=", "like", "not like", "in", "not in"],
|
|
5
|
+
number: ["=", "!=", ">", ">=", "<", "<=", "in", "not in", "between"],
|
|
6
|
+
date: ["=", ">", ">=", "<", "<=", "between"],
|
|
7
|
+
boolean: ["is true", "is false", "is null", "is not null"],
|
|
8
|
+
nullable: ["is null", "is not null"],
|
|
9
|
+
json: ["contains", "not contains", "is null", "is not null"]
|
|
10
|
+
};
|
|
11
|
+
const OPERATOR_LABELS = {
|
|
12
|
+
// 通用
|
|
13
|
+
"=": "\u7B49\u4E8E",
|
|
14
|
+
"!=": "\u4E0D\u7B49\u4E8E",
|
|
15
|
+
">": "\u5927\u4E8E",
|
|
16
|
+
">=": "\u5927\u4E8E\u7B49\u4E8E",
|
|
17
|
+
"<": "\u5C0F\u4E8E",
|
|
18
|
+
"<=": "\u5C0F\u4E8E\u7B49\u4E8E",
|
|
19
|
+
like: "\u5305\u542B",
|
|
20
|
+
"not like": "\u4E0D\u5305\u542B",
|
|
21
|
+
in: "\u5C5E\u4E8E",
|
|
22
|
+
"not in": "\u4E0D\u5C5E\u4E8E",
|
|
23
|
+
between: "\u4ECB\u4E8E",
|
|
24
|
+
"is null": "\u4E3A\u7A7A",
|
|
25
|
+
"is not null": "\u4E0D\u4E3A\u7A7A",
|
|
26
|
+
// 布尔专用
|
|
27
|
+
"is true": "\u4E3A\u771F",
|
|
28
|
+
"is false": "\u4E3A\u5047",
|
|
29
|
+
// JSON 专用
|
|
30
|
+
contains: "\u5305\u542B\u952E\u503C",
|
|
31
|
+
"not contains": "\u4E0D\u5305\u542B\u952E\u503C"
|
|
32
|
+
};
|
|
33
|
+
const NO_VALUE_OPERATORS = [
|
|
34
|
+
"empty",
|
|
35
|
+
"not_empty",
|
|
36
|
+
"is null",
|
|
37
|
+
"is not null",
|
|
38
|
+
"is true",
|
|
39
|
+
"is false"
|
|
40
|
+
];
|
|
41
|
+
const DEFAULT_OPERATORS = [{ label: OPERATOR_LABELS["="] || "=", code: "=" }];
|
|
42
|
+
|
|
43
|
+
exports.DEFAULT_OPERATORS = DEFAULT_OPERATORS;
|
|
44
|
+
exports.NO_VALUE_OPERATORS = NO_VALUE_OPERATORS;
|
|
45
|
+
exports.OPERATOR_CATALOG = OPERATOR_CATALOG;
|
|
46
|
+
exports.OPERATOR_LABELS = OPERATOR_LABELS;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { OperatorOption, OrderByItem, FilterItem } from './type';
|
|
3
|
+
import { PlusColumn } from 'yc-pro-components/es/types/plus';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
/** 列标签 */
|
|
7
|
+
label: string;
|
|
8
|
+
/** 列配置 */
|
|
9
|
+
column: PlusColumn;
|
|
10
|
+
/** 操作符列表 */
|
|
11
|
+
operators?: OperatorOption[];
|
|
12
|
+
/** 当前筛选状态 */
|
|
13
|
+
filters?: FilterItem[];
|
|
14
|
+
/** 当前排序状态 */
|
|
15
|
+
orderBy?: OrderByItem[];
|
|
16
|
+
/** 是否禁用筛选(仅显示排序) */
|
|
17
|
+
disableFilter?: boolean;
|
|
18
|
+
/** 自定义渲染 reference */
|
|
19
|
+
referenceRenderer?: () => unknown;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
22
|
+
operators: () => never[];
|
|
23
|
+
filters: () => never[];
|
|
24
|
+
orderBy: () => never[];
|
|
25
|
+
disableFilter: boolean;
|
|
26
|
+
referenceRenderer: undefined;
|
|
27
|
+
}>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
|
|
28
|
+
reset: (payload: {
|
|
29
|
+
column: PlusColumn;
|
|
30
|
+
op: string;
|
|
31
|
+
}) => void;
|
|
32
|
+
confirm: (payload: {
|
|
33
|
+
column: PlusColumn;
|
|
34
|
+
op: string;
|
|
35
|
+
value?: string | undefined;
|
|
36
|
+
}) => void;
|
|
37
|
+
sortChange: (payload: {
|
|
38
|
+
field: string;
|
|
39
|
+
direction?: "desc" | "asc" | undefined;
|
|
40
|
+
}) => void;
|
|
41
|
+
}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
42
|
+
operators: () => never[];
|
|
43
|
+
filters: () => never[];
|
|
44
|
+
orderBy: () => never[];
|
|
45
|
+
disableFilter: boolean;
|
|
46
|
+
referenceRenderer: undefined;
|
|
47
|
+
}>>> & {
|
|
48
|
+
onReset?: ((payload: {
|
|
49
|
+
column: PlusColumn;
|
|
50
|
+
op: string;
|
|
51
|
+
}) => any) | undefined;
|
|
52
|
+
onConfirm?: ((payload: {
|
|
53
|
+
column: PlusColumn;
|
|
54
|
+
op: string;
|
|
55
|
+
value?: string | undefined;
|
|
56
|
+
}) => any) | undefined;
|
|
57
|
+
onSortChange?: ((payload: {
|
|
58
|
+
field: string;
|
|
59
|
+
direction?: "desc" | "asc" | undefined;
|
|
60
|
+
}) => any) | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
filters: FilterItem[];
|
|
63
|
+
orderBy: OrderByItem[];
|
|
64
|
+
operators: OperatorOption[];
|
|
65
|
+
disableFilter: boolean;
|
|
66
|
+
referenceRenderer: () => unknown;
|
|
67
|
+
}, {}>;
|
|
68
|
+
export default _default;
|
|
69
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
70
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
71
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
72
|
+
type: PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
73
|
+
} : {
|
|
74
|
+
type: PropType<T[K]>;
|
|
75
|
+
required: true;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
type __VLS_WithDefaults<P, D> = {
|
|
79
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
80
|
+
default: D[K];
|
|
81
|
+
}> : P[K];
|
|
82
|
+
};
|
|
83
|
+
type __VLS_Prettify<T> = {
|
|
84
|
+
[K in keyof T]: T[K];
|
|
85
|
+
} & {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var headerFilterCell_vue_vue_type_script_setup_true_lang = require('./header-filter-cell.vue2.js');
|
|
6
|
+
var _pluginVue_exportHelper = require('../../../_virtual/_plugin-vue_export-helper.js');
|
|
7
|
+
|
|
8
|
+
var YcTableHeaderFilterCellComponent = /* @__PURE__ */ _pluginVue_exportHelper.default(headerFilterCell_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-87ce6807"], ["__file", "header-filter-cell.vue"]]);
|
|
9
|
+
|
|
10
|
+
exports.default = YcTableHeaderFilterCellComponent;
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
var elementPlus = require('element-plus');
|
|
7
|
+
var ElementPlusIconsVue = require('@element-plus/icons-vue');
|
|
8
|
+
var constants = require('./constants.js');
|
|
9
|
+
|
|
10
|
+
const _hoisted_1 = {
|
|
11
|
+
class: "yc-header-filter-cell__sort",
|
|
12
|
+
style: {
|
|
13
|
+
display: "inline-flex",
|
|
14
|
+
flexDirection: "column",
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
lineHeight: 1
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const _hoisted_2 = {
|
|
20
|
+
class: "yc-header-filter-cell__content",
|
|
21
|
+
style: {
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "column",
|
|
24
|
+
padding: "8px",
|
|
25
|
+
minWidth: "180px",
|
|
26
|
+
gap: "6px"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const _hoisted_3 = { class: "yc-header-filter-cell__operators" };
|
|
30
|
+
const _hoisted_4 = ["onClick"];
|
|
31
|
+
const _hoisted_5 = { key: 0 };
|
|
32
|
+
const _hoisted_6 = {
|
|
33
|
+
class: "yc-header-filter-cell__actions",
|
|
34
|
+
style: {
|
|
35
|
+
display: "flex",
|
|
36
|
+
justifyContent: "space-between",
|
|
37
|
+
marginTop: "6px"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
41
|
+
...{
|
|
42
|
+
name: "YcTableHeaderFilterCell"
|
|
43
|
+
},
|
|
44
|
+
__name: "header-filter-cell",
|
|
45
|
+
props: {
|
|
46
|
+
label: {},
|
|
47
|
+
column: {},
|
|
48
|
+
operators: { default: () => [] },
|
|
49
|
+
filters: { default: () => [] },
|
|
50
|
+
orderBy: { default: () => [] },
|
|
51
|
+
disableFilter: { type: Boolean, default: false },
|
|
52
|
+
referenceRenderer: { type: Function, default: void 0 }
|
|
53
|
+
},
|
|
54
|
+
emits: ["confirm", "reset", "sortChange"],
|
|
55
|
+
setup(__props, { emit: __emit }) {
|
|
56
|
+
const props = __props;
|
|
57
|
+
const emit = __emit;
|
|
58
|
+
const state = vue.reactive({
|
|
59
|
+
selectedOp: "=",
|
|
60
|
+
inputVal: ""
|
|
61
|
+
});
|
|
62
|
+
const popVisible = vue.ref(false);
|
|
63
|
+
const wrapperElRef = vue.ref(null);
|
|
64
|
+
const operatorsList = vue.computed(() => props.operators);
|
|
65
|
+
vue.watch(
|
|
66
|
+
operatorsList,
|
|
67
|
+
(list) => {
|
|
68
|
+
var _a;
|
|
69
|
+
const firstCode = (_a = list == null ? void 0 : list[0]) == null ? void 0 : _a.code;
|
|
70
|
+
if (!Array.isArray(list)) return;
|
|
71
|
+
if (!list.some((op) => op.code === state.selectedOp)) {
|
|
72
|
+
state.selectedOp = firstCode != null ? firstCode : "=";
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{ immediate: true }
|
|
76
|
+
);
|
|
77
|
+
const fieldRef = vue.computed(() => {
|
|
78
|
+
var _a;
|
|
79
|
+
return String(((_a = props.column) == null ? void 0 : _a.prop) || "");
|
|
80
|
+
});
|
|
81
|
+
const isActive = vue.computed(() => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const field = fieldRef.value;
|
|
84
|
+
return (_b = (_a = props.filters) == null ? void 0 : _a.some((i) => String(i.field) === field)) != null ? _b : false;
|
|
85
|
+
});
|
|
86
|
+
const isAscActive = vue.computed(
|
|
87
|
+
() => {
|
|
88
|
+
var _a;
|
|
89
|
+
return (_a = props.orderBy) == null ? void 0 : _a.some((i) => i.field === fieldRef.value && i.direction === "asc");
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
const isDescActive = vue.computed(
|
|
93
|
+
() => {
|
|
94
|
+
var _a;
|
|
95
|
+
return (_a = props.orderBy) == null ? void 0 : _a.some((i) => i.field === fieldRef.value && i.direction === "desc");
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
const onDocPointerOrClick = (e) => {
|
|
99
|
+
if (!popVisible.value) return;
|
|
100
|
+
const target = e.target;
|
|
101
|
+
const wrapper = wrapperElRef.value;
|
|
102
|
+
if (target && ((wrapper == null ? void 0 : wrapper.contains(target)) || target.closest(".yc-header-filter-pop"))) return;
|
|
103
|
+
popVisible.value = false;
|
|
104
|
+
};
|
|
105
|
+
vue.onMounted(() => {
|
|
106
|
+
window.addEventListener("pointerdown", onDocPointerOrClick, true);
|
|
107
|
+
window.addEventListener("click", onDocPointerOrClick, true);
|
|
108
|
+
});
|
|
109
|
+
vue.onBeforeUnmount(() => {
|
|
110
|
+
window.removeEventListener("pointerdown", onDocPointerOrClick, true);
|
|
111
|
+
window.removeEventListener("click", onDocPointerOrClick, true);
|
|
112
|
+
});
|
|
113
|
+
const handleSelect = (op) => {
|
|
114
|
+
state.selectedOp = op.code;
|
|
115
|
+
};
|
|
116
|
+
const handleReset = () => {
|
|
117
|
+
state.inputVal = "";
|
|
118
|
+
emit("reset", { column: props.column, op: state.selectedOp });
|
|
119
|
+
popVisible.value = false;
|
|
120
|
+
};
|
|
121
|
+
const handleConfirm = () => {
|
|
122
|
+
emit("confirm", {
|
|
123
|
+
column: props.column,
|
|
124
|
+
op: state.selectedOp,
|
|
125
|
+
value: state.inputVal
|
|
126
|
+
});
|
|
127
|
+
popVisible.value = false;
|
|
128
|
+
};
|
|
129
|
+
const toggleAsc = () => {
|
|
130
|
+
const field = fieldRef.value;
|
|
131
|
+
emit("sortChange", { field, direction: isAscActive.value ? void 0 : "asc" });
|
|
132
|
+
};
|
|
133
|
+
const toggleDesc = () => {
|
|
134
|
+
const field = fieldRef.value;
|
|
135
|
+
emit("sortChange", { field, direction: isDescActive.value ? void 0 : "desc" });
|
|
136
|
+
};
|
|
137
|
+
const cycleSort = () => {
|
|
138
|
+
const field = fieldRef.value;
|
|
139
|
+
if (!field) return;
|
|
140
|
+
if (isDescActive.value) {
|
|
141
|
+
emit("sortChange", { field, direction: "asc" });
|
|
142
|
+
} else if (isAscActive.value) {
|
|
143
|
+
emit("sortChange", { field, direction: void 0 });
|
|
144
|
+
} else {
|
|
145
|
+
emit("sortChange", { field, direction: "desc" });
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const needValueInput = vue.computed(() => {
|
|
149
|
+
return !constants.NO_VALUE_OPERATORS.includes(state.selectedOp);
|
|
150
|
+
});
|
|
151
|
+
const renderValueField = () => {
|
|
152
|
+
var _a, _b, _c, _d, _e;
|
|
153
|
+
if (!needValueInput.value) return null;
|
|
154
|
+
const vt = String(((_a = props.column) == null ? void 0 : _a.valueType) || "").toLowerCase();
|
|
155
|
+
const fp = ((_b = props.column) == null ? void 0 : _b.fieldProps) || {};
|
|
156
|
+
if (vt === "time-picker") {
|
|
157
|
+
return vue.h(elementPlus.ElTimePicker, {
|
|
158
|
+
...fp,
|
|
159
|
+
format: (_c = fp == null ? void 0 : fp.format) != null ? _c : "HH:mm:ss",
|
|
160
|
+
valueFormat: (_d = fp == null ? void 0 : fp.valueFormat) != null ? _d : "HH:mm:ss",
|
|
161
|
+
modelValue: state.inputVal,
|
|
162
|
+
"onUpdate:modelValue": (v) => state.inputVal = String(v != null ? v : ""),
|
|
163
|
+
style: "margin-top: 4px; width: 100%"
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (vt === "time-select") {
|
|
167
|
+
return vue.h(elementPlus.ElTimeSelect, {
|
|
168
|
+
...fp,
|
|
169
|
+
modelValue: state.inputVal,
|
|
170
|
+
"onUpdate:modelValue": (v) => {
|
|
171
|
+
const raw = String(v != null ? v : "");
|
|
172
|
+
const nv = raw && /^\d{2}:\d{2}$/.test(raw) ? `${raw}:00` : raw;
|
|
173
|
+
state.inputVal = nv;
|
|
174
|
+
},
|
|
175
|
+
style: "margin-top: 4px; width: 100%"
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
if (vt === "date-picker") {
|
|
179
|
+
return vue.h(elementPlus.ElDatePicker, {
|
|
180
|
+
...fp,
|
|
181
|
+
valueFormat: (_e = fp == null ? void 0 : fp.valueFormat) != null ? _e : "YYYY-MM-DD HH:mm:ss",
|
|
182
|
+
modelValue: state.inputVal,
|
|
183
|
+
"onUpdate:modelValue": (v) => {
|
|
184
|
+
const nv = Array.isArray(v) ? v.join(",") : String(v != null ? v : "");
|
|
185
|
+
state.inputVal = nv;
|
|
186
|
+
},
|
|
187
|
+
style: "margin-top: 4px; width: 100%"
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return vue.h(elementPlus.ElInput, {
|
|
191
|
+
modelValue: state.inputVal,
|
|
192
|
+
"onUpdate:modelValue": (v) => state.inputVal = v,
|
|
193
|
+
placeholder: "",
|
|
194
|
+
style: "margin-top: 4px; width: 100%"
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
return (_ctx, _cache) => {
|
|
198
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
199
|
+
"div",
|
|
200
|
+
{
|
|
201
|
+
ref_key: "wrapperElRef",
|
|
202
|
+
ref: wrapperElRef,
|
|
203
|
+
class: "yc-header-filter-cell",
|
|
204
|
+
style: {
|
|
205
|
+
display: "inline-flex",
|
|
206
|
+
alignItems: "center",
|
|
207
|
+
gap: "6px",
|
|
208
|
+
cursor: "default"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
[
|
|
212
|
+
vue.createCommentVNode(" \u6807\u7B7E\u5185\u5BB9 "),
|
|
213
|
+
vue.createElementVNode("span", {
|
|
214
|
+
class: "yc-header-filter-cell__label",
|
|
215
|
+
style: {
|
|
216
|
+
userSelect: "none",
|
|
217
|
+
cursor: "pointer"
|
|
218
|
+
},
|
|
219
|
+
onClick: vue.withModifiers(cycleSort, ["stop"])
|
|
220
|
+
}, [
|
|
221
|
+
_ctx.referenceRenderer ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.referenceRenderer), { key: 0 })) : (vue.openBlock(), vue.createElementBlock(
|
|
222
|
+
vue.Fragment,
|
|
223
|
+
{ key: 1 },
|
|
224
|
+
[
|
|
225
|
+
vue.createTextVNode(
|
|
226
|
+
vue.toDisplayString(_ctx.label),
|
|
227
|
+
1
|
|
228
|
+
/* TEXT */
|
|
229
|
+
)
|
|
230
|
+
],
|
|
231
|
+
64
|
|
232
|
+
/* STABLE_FRAGMENT */
|
|
233
|
+
))
|
|
234
|
+
]),
|
|
235
|
+
vue.createCommentVNode(" \u6392\u5E8F\u56FE\u6807 "),
|
|
236
|
+
vue.createElementVNode("span", _hoisted_1, [
|
|
237
|
+
vue.createVNode(vue.unref(elementPlus.ElIcon), {
|
|
238
|
+
size: 12,
|
|
239
|
+
color: isAscActive.value ? "var(--el-color-primary)" : "var(--el-text-color-secondary)",
|
|
240
|
+
style: { cursor: "pointer" },
|
|
241
|
+
onClick: vue.withModifiers(toggleAsc, ["stop"])
|
|
242
|
+
}, {
|
|
243
|
+
default: vue.withCtx(() => [
|
|
244
|
+
vue.createVNode(vue.unref(ElementPlusIconsVue.CaretTop))
|
|
245
|
+
]),
|
|
246
|
+
_: 1
|
|
247
|
+
/* STABLE */
|
|
248
|
+
}, 8, ["color"]),
|
|
249
|
+
vue.createVNode(vue.unref(elementPlus.ElIcon), {
|
|
250
|
+
size: 12,
|
|
251
|
+
color: isDescActive.value ? "var(--el-color-primary)" : "var(--el-text-color-secondary)",
|
|
252
|
+
style: { cursor: "pointer", marginTop: "-5px" },
|
|
253
|
+
onClick: vue.withModifiers(toggleDesc, ["stop"])
|
|
254
|
+
}, {
|
|
255
|
+
default: vue.withCtx(() => [
|
|
256
|
+
vue.createVNode(vue.unref(ElementPlusIconsVue.CaretBottom))
|
|
257
|
+
]),
|
|
258
|
+
_: 1
|
|
259
|
+
/* STABLE */
|
|
260
|
+
}, 8, ["color"])
|
|
261
|
+
]),
|
|
262
|
+
vue.createCommentVNode(" \u7B5B\u9009\u56FE\u6807\u548C\u5F39\u7A97 "),
|
|
263
|
+
!_ctx.disableFilter ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElPopover), {
|
|
264
|
+
key: 0,
|
|
265
|
+
trigger: "click",
|
|
266
|
+
placement: "bottom-start",
|
|
267
|
+
width: 220,
|
|
268
|
+
visible: popVisible.value,
|
|
269
|
+
"popper-class": "yc-header-filter-pop",
|
|
270
|
+
"popper-style": { zIndex: 4e3 }
|
|
271
|
+
}, {
|
|
272
|
+
reference: vue.withCtx(() => [
|
|
273
|
+
vue.createVNode(vue.unref(elementPlus.ElIcon), {
|
|
274
|
+
size: 16,
|
|
275
|
+
color: isActive.value ? "var(--el-color-primary)" : "var(--el-text-color-secondary)",
|
|
276
|
+
style: { cursor: "pointer" },
|
|
277
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => popVisible.value = !popVisible.value, ["stop"]))
|
|
278
|
+
}, {
|
|
279
|
+
default: vue.withCtx(() => [
|
|
280
|
+
vue.createVNode(vue.unref(ElementPlusIconsVue.Filter))
|
|
281
|
+
]),
|
|
282
|
+
_: 1
|
|
283
|
+
/* STABLE */
|
|
284
|
+
}, 8, ["color"])
|
|
285
|
+
]),
|
|
286
|
+
default: vue.withCtx(() => [
|
|
287
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
288
|
+
vue.createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868 "),
|
|
289
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
290
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
291
|
+
vue.Fragment,
|
|
292
|
+
null,
|
|
293
|
+
vue.renderList(operatorsList.value, (op) => {
|
|
294
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
295
|
+
key: op.code,
|
|
296
|
+
class: "yc-header-filter-cell__operator-item",
|
|
297
|
+
style: vue.normalizeStyle({
|
|
298
|
+
display: "flex",
|
|
299
|
+
justifyContent: "space-between",
|
|
300
|
+
alignItems: "center",
|
|
301
|
+
padding: "6px 8px",
|
|
302
|
+
borderRadius: "4px",
|
|
303
|
+
background: state.selectedOp === op.code ? "var(--el-color-primary-light-9)" : "transparent",
|
|
304
|
+
color: state.selectedOp === op.code ? "var(--el-color-primary)" : "inherit",
|
|
305
|
+
cursor: "pointer"
|
|
306
|
+
}),
|
|
307
|
+
onClick: ($event) => handleSelect(op)
|
|
308
|
+
}, [
|
|
309
|
+
vue.createElementVNode(
|
|
310
|
+
"span",
|
|
311
|
+
null,
|
|
312
|
+
vue.toDisplayString(op.label),
|
|
313
|
+
1
|
|
314
|
+
/* TEXT */
|
|
315
|
+
),
|
|
316
|
+
state.selectedOp === op.code ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5, "\u2713")) : vue.createCommentVNode("v-if", true)
|
|
317
|
+
], 12, _hoisted_4);
|
|
318
|
+
}),
|
|
319
|
+
128
|
|
320
|
+
/* KEYED_FRAGMENT */
|
|
321
|
+
))
|
|
322
|
+
]),
|
|
323
|
+
vue.createCommentVNode(" \u503C\u8F93\u5165 "),
|
|
324
|
+
needValueInput.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderValueField), { key: 0 })) : vue.createCommentVNode("v-if", true),
|
|
325
|
+
vue.createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
|
|
326
|
+
vue.createElementVNode("div", _hoisted_6, [
|
|
327
|
+
vue.createVNode(vue.unref(elementPlus.ElButton), { onClick: handleReset }, {
|
|
328
|
+
default: vue.withCtx(() => [
|
|
329
|
+
vue.createTextVNode("\u91CD\u7F6E")
|
|
330
|
+
]),
|
|
331
|
+
_: 1
|
|
332
|
+
/* STABLE */
|
|
333
|
+
}),
|
|
334
|
+
vue.createVNode(vue.unref(elementPlus.ElButton), {
|
|
335
|
+
type: "primary",
|
|
336
|
+
onClick: handleConfirm
|
|
337
|
+
}, {
|
|
338
|
+
default: vue.withCtx(() => [
|
|
339
|
+
vue.createTextVNode("\u786E\u5B9A")
|
|
340
|
+
]),
|
|
341
|
+
_: 1
|
|
342
|
+
/* STABLE */
|
|
343
|
+
})
|
|
344
|
+
])
|
|
345
|
+
])
|
|
346
|
+
]),
|
|
347
|
+
_: 1
|
|
348
|
+
/* STABLE */
|
|
349
|
+
}, 8, ["visible"])) : vue.createCommentVNode("v-if", true)
|
|
350
|
+
],
|
|
351
|
+
512
|
|
352
|
+
/* NEED_PATCH */
|
|
353
|
+
);
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
exports.default = _sfc_main;
|