yc-pro-components 0.0.47 → 0.0.48
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 +1 -0
- package/es/components/yc-plus-page/index.d.ts +2 -0
- package/es/components/yc-plus-page/index.mjs +1 -0
- package/es/components/yc-plus-page/src/header-filter-cell.vue.mjs +1 -1
- package/es/components/yc-plus-page/src/header-filter-cell.vue2.mjs +22 -18
- package/es/components/yc-plus-page/src/use-local-header-filter.d.ts +93 -0
- package/es/components/yc-plus-page/src/use-local-header-filter.mjs +145 -0
- package/es/index.css +11 -11
- package/es/index.mjs +1 -0
- package/index.css +5 -5
- package/index.js +180 -36
- package/index.min.css +1 -1
- package/index.min.js +11 -11
- package/index.min.mjs +11 -11
- package/index.mjs +180 -37
- package/lib/components/index.js +2 -0
- package/lib/components/yc-plus-page/index.d.ts +2 -0
- package/lib/components/yc-plus-page/index.js +2 -0
- package/lib/components/yc-plus-page/src/header-filter-cell.vue.js +1 -1
- package/lib/components/yc-plus-page/src/header-filter-cell.vue2.js +21 -17
- package/lib/components/yc-plus-page/src/use-local-header-filter.d.ts +93 -0
- package/lib/components/yc-plus-page/src/use-local-header-filter.js +147 -0
- package/lib/index.css +12 -12
- package/lib/index.js +2 -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/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! yc-pro-components v0.0.
|
|
1
|
+
/*! yc-pro-components v0.0.48 */
|
|
2
2
|
import { unref, isRef, ref, inject, isReactive, watch, computed, shallowRef, provide, onMounted, nextTick, onBeforeUnmount, defineComponent, useAttrs, watchEffect, openBlock, createBlock, mergeProps, createSlots, withCtx, createElementVNode, renderSlot, normalizeStyle, createVNode, createTextVNode, toDisplayString, createElementBlock, normalizeClass, createCommentVNode, reactive, Fragment, renderList, resolveDynamicComponent, normalizeProps, guardReactiveProps, h, withDirectives, isVNode, withKeys, withModifiers, TransitionGroup, toHandlers, getCurrentInstance, resolveComponent, toRefs, useSlots, onUnmounted, resolveDirective, pushScopeId, popScopeId, onBeforeMount, getCurrentScope, onScopeDispose, toRef, mergeModels, useModel, vShow, createStaticVNode, hasInjectionContext, markRaw, effectScope, toRaw } from 'vue';
|
|
3
3
|
import { dayjs, localeContextKey, ElDialog, ElButton, ElPagination, ElRadioGroup, ElRadio, ElTableColumn, ElDropdown, ElDropdownMenu, ElDropdownItem, ElIcon, ElTooltip, ElPopconfirm, ElLink, ElMessageBox, useFormDisabled, ElDatePicker, ClickOutside, ElTag, ElInput, ElAutocomplete, ElCascader, ElCheckboxGroup, ElCheckbox, ElColorPicker, ElInputNumber, ElRate, ElSelect, ElOption, ElSlider, ElSwitch, ElTimePicker, ElTimeSelect, ElTransfer, ElTreeSelect, ElSelectV2, ElText, ElDivider, ElFormItem, ElOptionGroup, ElRow, ElCol, ElForm, ElCard, ElMessage, ElImage, ElProgress, ElAvatar, ElPopover, ElTable, vLoading, ElDescriptions, ElDescriptionsItem, ElDrawer, TableV2FixedDir, ElAutoResizer, ElTableV2, ElSteps, ElStep, ElBreadcrumb, ElBreadcrumbItem, ElMenuItem, ElSubMenu, ElMenu, ElScrollbar, ElHeader, ElContainer, ElMain, ElBacktop, ElUpload } from 'element-plus';
|
|
4
4
|
|
|
@@ -20,10 +20,8 @@ var freeSelf = typeof self == 'object' && self && self.Object === Object && self
|
|
|
20
20
|
/** Used as a reference to the global object. */
|
|
21
21
|
var root = freeGlobal || freeSelf || Function('return this')();
|
|
22
22
|
|
|
23
|
-
var root$1 = root;
|
|
24
|
-
|
|
25
23
|
/** Built-in value references. */
|
|
26
|
-
var Symbol$1 = root
|
|
24
|
+
var Symbol$1 = root.Symbol;
|
|
27
25
|
|
|
28
26
|
/** Used for built-in method references. */
|
|
29
27
|
var objectProto$f = Object.prototype;
|
|
@@ -418,7 +416,7 @@ function isFunction$1(value) {
|
|
|
418
416
|
}
|
|
419
417
|
|
|
420
418
|
/** Used to detect overreaching core-js shims. */
|
|
421
|
-
var coreJsData = root
|
|
419
|
+
var coreJsData = root['__core-js_shared__'];
|
|
422
420
|
|
|
423
421
|
/** Used to detect methods masquerading as native. */
|
|
424
422
|
var maskSrcKey = (function() {
|
|
@@ -529,7 +527,7 @@ function getNative(object, key) {
|
|
|
529
527
|
}
|
|
530
528
|
|
|
531
529
|
/* Built-in method references that are verified to be native. */
|
|
532
|
-
var WeakMap$1 = getNative(root
|
|
530
|
+
var WeakMap$1 = getNative(root, 'WeakMap');
|
|
533
531
|
|
|
534
532
|
/** Built-in value references. */
|
|
535
533
|
var objectCreate = Object.create;
|
|
@@ -1130,7 +1128,7 @@ var freeModule$2 = freeExports$2 && typeof module == 'object' && module && !modu
|
|
|
1130
1128
|
var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
|
|
1131
1129
|
|
|
1132
1130
|
/** Built-in value references. */
|
|
1133
|
-
var Buffer$1 = moduleExports$2 ? root
|
|
1131
|
+
var Buffer$1 = moduleExports$2 ? root.Buffer : undefined;
|
|
1134
1132
|
|
|
1135
1133
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1136
1134
|
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : undefined;
|
|
@@ -1749,7 +1747,7 @@ ListCache.prototype.has = listCacheHas;
|
|
|
1749
1747
|
ListCache.prototype.set = listCacheSet;
|
|
1750
1748
|
|
|
1751
1749
|
/* Built-in method references that are verified to be native. */
|
|
1752
|
-
var Map$1 = getNative(root
|
|
1750
|
+
var Map$1 = getNative(root, 'Map');
|
|
1753
1751
|
|
|
1754
1752
|
/**
|
|
1755
1753
|
* Removes all key-value entries from the map.
|
|
@@ -2324,7 +2322,7 @@ var freeModule = freeExports && typeof module == 'object' && module && !module.n
|
|
|
2324
2322
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
2325
2323
|
|
|
2326
2324
|
/** Built-in value references. */
|
|
2327
|
-
var Buffer = moduleExports ? root
|
|
2325
|
+
var Buffer = moduleExports ? root.Buffer : undefined,
|
|
2328
2326
|
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
|
2329
2327
|
|
|
2330
2328
|
/**
|
|
@@ -2501,13 +2499,13 @@ function getAllKeysIn(object) {
|
|
|
2501
2499
|
}
|
|
2502
2500
|
|
|
2503
2501
|
/* Built-in method references that are verified to be native. */
|
|
2504
|
-
var DataView$1 = getNative(root
|
|
2502
|
+
var DataView$1 = getNative(root, 'DataView');
|
|
2505
2503
|
|
|
2506
2504
|
/* Built-in method references that are verified to be native. */
|
|
2507
|
-
var Promise$1 = getNative(root
|
|
2505
|
+
var Promise$1 = getNative(root, 'Promise');
|
|
2508
2506
|
|
|
2509
2507
|
/* Built-in method references that are verified to be native. */
|
|
2510
|
-
var Set$1 = getNative(root
|
|
2508
|
+
var Set$1 = getNative(root, 'Set');
|
|
2511
2509
|
|
|
2512
2510
|
/** `Object#toString` result references. */
|
|
2513
2511
|
var mapTag$4 = '[object Map]',
|
|
@@ -2586,7 +2584,7 @@ function initCloneArray(array) {
|
|
|
2586
2584
|
}
|
|
2587
2585
|
|
|
2588
2586
|
/** Built-in value references. */
|
|
2589
|
-
var Uint8Array$1 = root
|
|
2587
|
+
var Uint8Array$1 = root.Uint8Array;
|
|
2590
2588
|
|
|
2591
2589
|
/**
|
|
2592
2590
|
* Creates a clone of `arrayBuffer`.
|
|
@@ -3873,7 +3871,7 @@ var baseEach = createBaseEach(baseForOwn);
|
|
|
3873
3871
|
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
3874
3872
|
*/
|
|
3875
3873
|
var now = function() {
|
|
3876
|
-
return root
|
|
3874
|
+
return root.Date.now();
|
|
3877
3875
|
};
|
|
3878
3876
|
|
|
3879
3877
|
/** Error message constants. */
|
|
@@ -18336,7 +18334,7 @@ const _hoisted_7$6 = {
|
|
|
18336
18334
|
key: 0,
|
|
18337
18335
|
class: "plus-table-checkbox-handle"
|
|
18338
18336
|
};
|
|
18339
|
-
const _hoisted_8$
|
|
18337
|
+
const _hoisted_8$5 = { key: 1 };
|
|
18340
18338
|
const _hoisted_9$4 = { key: 1 };
|
|
18341
18339
|
var _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
18342
18340
|
...{
|
|
@@ -18719,7 +18717,7 @@ var _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
18719
18717
|
/* DYNAMIC */
|
|
18720
18718
|
}, 1032, ["content"])) : (openBlock(), createElementBlock(
|
|
18721
18719
|
"span",
|
|
18722
|
-
_hoisted_8$
|
|
18720
|
+
_hoisted_8$5,
|
|
18723
18721
|
toDisplayString(item.label ? getLabelValue(item.label) : ""),
|
|
18724
18722
|
1
|
|
18725
18723
|
/* TEXT */
|
|
@@ -22024,7 +22022,7 @@ const _hoisted_4$8 = /* @__PURE__ */ createElementVNode(
|
|
|
22024
22022
|
const _hoisted_5$8 = { class: "plus-header__right" };
|
|
22025
22023
|
const _hoisted_6$6 = { class: "plus-header__dropdown-area" };
|
|
22026
22024
|
const _hoisted_7$5 = ["src"];
|
|
22027
|
-
const _hoisted_8$
|
|
22025
|
+
const _hoisted_8$4 = { class: "plus-header__username" };
|
|
22028
22026
|
const _hoisted_9$3 = {
|
|
22029
22027
|
key: 0,
|
|
22030
22028
|
class: "plus-header-placeholder"
|
|
@@ -22179,7 +22177,7 @@ var _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
22179
22177
|
createCommentVNode(" username "),
|
|
22180
22178
|
createElementVNode(
|
|
22181
22179
|
"p",
|
|
22182
|
-
_hoisted_8$
|
|
22180
|
+
_hoisted_8$4,
|
|
22183
22181
|
toDisplayString(_ctx.userInfo.username || "admin"),
|
|
22184
22182
|
1
|
|
22185
22183
|
/* TEXT */
|
|
@@ -32352,7 +32350,8 @@ function useHeaderFilter(options = {}) {
|
|
|
32352
32350
|
|
|
32353
32351
|
const _hoisted_1$9 = { class: "yc-header-filter-cell__label-text" };
|
|
32354
32352
|
const _hoisted_2$8 = { class: "yc-header-filter-cell__label-text" };
|
|
32355
|
-
const _hoisted_3$8 = {
|
|
32353
|
+
const _hoisted_3$8 = { style: { cursor: "pointer", display: "inline-flex", alignItems: "center" } };
|
|
32354
|
+
const _hoisted_4$6 = {
|
|
32356
32355
|
class: "yc-header-filter-cell__content",
|
|
32357
32356
|
style: {
|
|
32358
32357
|
display: "flex",
|
|
@@ -32362,10 +32361,10 @@ const _hoisted_3$8 = {
|
|
|
32362
32361
|
gap: "4px"
|
|
32363
32362
|
}
|
|
32364
32363
|
};
|
|
32365
|
-
const
|
|
32366
|
-
const
|
|
32367
|
-
const
|
|
32368
|
-
const
|
|
32364
|
+
const _hoisted_5$6 = { class: "yc-header-filter-cell__operators" };
|
|
32365
|
+
const _hoisted_6$5 = ["onClick"];
|
|
32366
|
+
const _hoisted_7$4 = { key: 0 };
|
|
32367
|
+
const _hoisted_8$3 = {
|
|
32369
32368
|
class: "yc-header-filter-cell__actions",
|
|
32370
32369
|
style: {
|
|
32371
32370
|
display: "flex",
|
|
@@ -32552,9 +32551,14 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32552
32551
|
alignItems: "center",
|
|
32553
32552
|
gap: "4px",
|
|
32554
32553
|
cursor: "default"
|
|
32555
|
-
}
|
|
32554
|
+
},
|
|
32555
|
+
onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
32556
|
+
}, ["stop"])),
|
|
32557
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
32558
|
+
}, ["stop"]))
|
|
32556
32559
|
},
|
|
32557
32560
|
[
|
|
32561
|
+
createCommentVNode(" @mousedown.stop / @click.stop \u963B\u6B62 el-table <th> \u7684 handleHeaderClick \u548C\u5217 resize \u4E8B\u4EF6\u7A7F\u900F "),
|
|
32558
32562
|
createCommentVNode(" \u6807\u7B7E\u5185\u5BB9 "),
|
|
32559
32563
|
createElementVNode(
|
|
32560
32564
|
"span",
|
|
@@ -32679,14 +32683,12 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32679
32683
|
placement: "bottom-start",
|
|
32680
32684
|
width: 220,
|
|
32681
32685
|
visible: popVisible.value,
|
|
32686
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => popVisible.value = $event),
|
|
32682
32687
|
"popper-class": "yc-header-filter-pop",
|
|
32683
32688
|
"popper-style": { zIndex: 4e3 }
|
|
32684
32689
|
}, {
|
|
32685
32690
|
reference: withCtx(() => [
|
|
32686
|
-
createElementVNode("span",
|
|
32687
|
-
style: { cursor: "pointer", display: "inline-flex", alignItems: "center" },
|
|
32688
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => popVisible.value = !popVisible.value, ["stop"]))
|
|
32689
|
-
}, [
|
|
32691
|
+
createElementVNode("span", _hoisted_3$8, [
|
|
32690
32692
|
createVNode(unref(YcSvgIcon), {
|
|
32691
32693
|
src: filterIconUrl.value,
|
|
32692
32694
|
size: 14,
|
|
@@ -32695,9 +32697,9 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32695
32697
|
])
|
|
32696
32698
|
]),
|
|
32697
32699
|
default: withCtx(() => [
|
|
32698
|
-
createElementVNode("div",
|
|
32700
|
+
createElementVNode("div", _hoisted_4$6, [
|
|
32699
32701
|
createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868 "),
|
|
32700
|
-
createElementVNode("div",
|
|
32702
|
+
createElementVNode("div", _hoisted_5$6, [
|
|
32701
32703
|
(openBlock(true), createElementBlock(
|
|
32702
32704
|
Fragment,
|
|
32703
32705
|
null,
|
|
@@ -32724,8 +32726,8 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32724
32726
|
1
|
|
32725
32727
|
/* TEXT */
|
|
32726
32728
|
),
|
|
32727
|
-
state.selectedOp === op.code ? (openBlock(), createElementBlock("span",
|
|
32728
|
-
], 12,
|
|
32729
|
+
state.selectedOp === op.code ? (openBlock(), createElementBlock("span", _hoisted_7$4, "\u2713")) : createCommentVNode("v-if", true)
|
|
32730
|
+
], 12, _hoisted_6$5);
|
|
32729
32731
|
}),
|
|
32730
32732
|
128
|
|
32731
32733
|
/* KEYED_FRAGMENT */
|
|
@@ -32734,7 +32736,7 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32734
32736
|
createCommentVNode(" \u503C\u8F93\u5165 "),
|
|
32735
32737
|
needValueInput.value ? (openBlock(), createBlock(resolveDynamicComponent(renderValueField), { key: 0 })) : createCommentVNode("v-if", true),
|
|
32736
32738
|
createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
|
|
32737
|
-
createElementVNode("div",
|
|
32739
|
+
createElementVNode("div", _hoisted_8$3, [
|
|
32738
32740
|
createVNode(unref(ElButton), { onClick: handleReset }, {
|
|
32739
32741
|
default: withCtx(() => [
|
|
32740
32742
|
createTextVNode("\u91CD\u7F6E")
|
|
@@ -32759,14 +32761,14 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32759
32761
|
/* STABLE */
|
|
32760
32762
|
}, 8, ["visible"])) : createCommentVNode("v-if", true)
|
|
32761
32763
|
],
|
|
32762
|
-
|
|
32763
|
-
/* NEED_PATCH */
|
|
32764
|
+
544
|
|
32765
|
+
/* NEED_HYDRATION, NEED_PATCH */
|
|
32764
32766
|
);
|
|
32765
32767
|
};
|
|
32766
32768
|
}
|
|
32767
32769
|
});
|
|
32768
32770
|
|
|
32769
|
-
var YcTableHeaderFilterCellComponent = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-
|
|
32771
|
+
var YcTableHeaderFilterCellComponent = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-e0442d8a"], ["__file", "header-filter-cell.vue"]]);
|
|
32770
32772
|
|
|
32771
32773
|
const DEFAULT_PAGE_SIZE = 20;
|
|
32772
32774
|
const COLUMN_CACHE_PREFIX = "yc-column-settings:";
|
|
@@ -33270,6 +33272,147 @@ var _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
33270
33272
|
|
|
33271
33273
|
var YcPlusPageComponent = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-c7557953"], ["__file", "index.vue"]]);
|
|
33272
33274
|
|
|
33275
|
+
function compareValues(a, b) {
|
|
33276
|
+
if (a == null && b == null) return 0;
|
|
33277
|
+
if (a == null) return -1;
|
|
33278
|
+
if (b == null) return 1;
|
|
33279
|
+
const numA = Number(a);
|
|
33280
|
+
const numB = Number(b);
|
|
33281
|
+
if (!isNaN(numA) && !isNaN(numB)) return numA - numB;
|
|
33282
|
+
return String(a).localeCompare(String(b), "zh-CN");
|
|
33283
|
+
}
|
|
33284
|
+
function matchFilter(value, op, filterValue) {
|
|
33285
|
+
const strValue = String(value != null ? value : "").toLowerCase();
|
|
33286
|
+
const strFilter = String(filterValue != null ? filterValue : "").toLowerCase();
|
|
33287
|
+
switch (op) {
|
|
33288
|
+
case "=":
|
|
33289
|
+
return strValue === strFilter;
|
|
33290
|
+
case "!=":
|
|
33291
|
+
return strValue !== strFilter;
|
|
33292
|
+
case "like":
|
|
33293
|
+
return strValue.includes(strFilter);
|
|
33294
|
+
case "not like":
|
|
33295
|
+
return !strValue.includes(strFilter);
|
|
33296
|
+
case ">":
|
|
33297
|
+
return Number(value) > Number(filterValue);
|
|
33298
|
+
case ">=":
|
|
33299
|
+
return Number(value) >= Number(filterValue);
|
|
33300
|
+
case "<":
|
|
33301
|
+
return Number(value) < Number(filterValue);
|
|
33302
|
+
case "<=":
|
|
33303
|
+
return Number(value) <= Number(filterValue);
|
|
33304
|
+
case "is null":
|
|
33305
|
+
case "empty":
|
|
33306
|
+
return value == null || strValue === "";
|
|
33307
|
+
case "is not null":
|
|
33308
|
+
case "not_empty":
|
|
33309
|
+
return value != null && strValue !== "";
|
|
33310
|
+
case "in": {
|
|
33311
|
+
const set = strFilter.split(",").map((s) => s.trim().toLowerCase());
|
|
33312
|
+
return set.includes(strValue);
|
|
33313
|
+
}
|
|
33314
|
+
case "not in": {
|
|
33315
|
+
const set = strFilter.split(",").map((s) => s.trim().toLowerCase());
|
|
33316
|
+
return !set.includes(strValue);
|
|
33317
|
+
}
|
|
33318
|
+
case "between": {
|
|
33319
|
+
const parts = strFilter.split(",").map((s) => Number(s.trim()));
|
|
33320
|
+
const num = Number(value);
|
|
33321
|
+
return parts.length === 2 && !isNaN(num) && !isNaN(parts[0]) && !isNaN(parts[1]) && num >= parts[0] && num <= parts[1];
|
|
33322
|
+
}
|
|
33323
|
+
case "is true":
|
|
33324
|
+
return value === true || strValue === "true" || strValue === "1";
|
|
33325
|
+
case "is false":
|
|
33326
|
+
return value === false || strValue === "false" || strValue === "0";
|
|
33327
|
+
default:
|
|
33328
|
+
return true;
|
|
33329
|
+
}
|
|
33330
|
+
}
|
|
33331
|
+
function useLocalHeaderFilter(data, options) {
|
|
33332
|
+
const fieldCatalog = computed(() => {
|
|
33333
|
+
const cols = options == null ? void 0 : options.filterableColumns;
|
|
33334
|
+
if (!(cols == null ? void 0 : cols.length)) return {};
|
|
33335
|
+
const catalog = {};
|
|
33336
|
+
for (const col of cols) {
|
|
33337
|
+
catalog[col.prop] = {
|
|
33338
|
+
type: col.type || "string",
|
|
33339
|
+
filter: true,
|
|
33340
|
+
allowedField: col.prop
|
|
33341
|
+
};
|
|
33342
|
+
}
|
|
33343
|
+
return catalog;
|
|
33344
|
+
});
|
|
33345
|
+
const {
|
|
33346
|
+
headerFiltersState,
|
|
33347
|
+
orderByState,
|
|
33348
|
+
upsertHeaderFilter,
|
|
33349
|
+
removeHeaderFilter,
|
|
33350
|
+
setOrderBy,
|
|
33351
|
+
getOpsByProp,
|
|
33352
|
+
isEnabled: _isEnabled
|
|
33353
|
+
} = useHeaderFilter({
|
|
33354
|
+
headerFilterConfig: () => ({
|
|
33355
|
+
enabled: true,
|
|
33356
|
+
fieldCatalog: fieldCatalog.value
|
|
33357
|
+
}),
|
|
33358
|
+
hideHeaderFilter: () => false
|
|
33359
|
+
});
|
|
33360
|
+
const filteredData = computed(() => {
|
|
33361
|
+
let result = [...unref(data) || []];
|
|
33362
|
+
if (headerFiltersState.filters.length > 0) {
|
|
33363
|
+
result = result.filter((row) => {
|
|
33364
|
+
const record = row;
|
|
33365
|
+
return headerFiltersState.filters.every(
|
|
33366
|
+
(filter) => matchFilter(record[filter.field], filter.op, filter.value)
|
|
33367
|
+
);
|
|
33368
|
+
});
|
|
33369
|
+
}
|
|
33370
|
+
if (orderByState.length > 0) {
|
|
33371
|
+
result.sort((a, b) => {
|
|
33372
|
+
const recA = a;
|
|
33373
|
+
const recB = b;
|
|
33374
|
+
for (const order of orderByState) {
|
|
33375
|
+
const cmp = compareValues(recA[order.field], recB[order.field]);
|
|
33376
|
+
if (cmp !== 0) return order.direction === "asc" ? cmp : -cmp;
|
|
33377
|
+
}
|
|
33378
|
+
return 0;
|
|
33379
|
+
});
|
|
33380
|
+
}
|
|
33381
|
+
return result;
|
|
33382
|
+
});
|
|
33383
|
+
const handleFilterConfirm = (payload) => {
|
|
33384
|
+
var _a;
|
|
33385
|
+
const field = String(((_a = payload.column) == null ? void 0 : _a.prop) || "");
|
|
33386
|
+
upsertHeaderFilter(field, payload.op, payload.value);
|
|
33387
|
+
};
|
|
33388
|
+
const handleFilterReset = (payload) => {
|
|
33389
|
+
var _a;
|
|
33390
|
+
const field = String(((_a = payload.column) == null ? void 0 : _a.prop) || "");
|
|
33391
|
+
removeHeaderFilter(field);
|
|
33392
|
+
};
|
|
33393
|
+
const handleSortChange = (payload) => {
|
|
33394
|
+
setOrderBy(payload.field, payload.direction);
|
|
33395
|
+
};
|
|
33396
|
+
const resetAllFilters = () => {
|
|
33397
|
+
headerFiltersState.filters.splice(0);
|
|
33398
|
+
orderByState.splice(0);
|
|
33399
|
+
};
|
|
33400
|
+
const hasActiveFilters = computed(() => {
|
|
33401
|
+
return headerFiltersState.filters.length > 0 || orderByState.length > 0;
|
|
33402
|
+
});
|
|
33403
|
+
return {
|
|
33404
|
+
filteredData,
|
|
33405
|
+
headerFiltersState,
|
|
33406
|
+
orderByState,
|
|
33407
|
+
handleFilterConfirm,
|
|
33408
|
+
handleFilterReset,
|
|
33409
|
+
handleSortChange,
|
|
33410
|
+
getOpsByProp,
|
|
33411
|
+
resetAllFilters,
|
|
33412
|
+
hasActiveFilters
|
|
33413
|
+
};
|
|
33414
|
+
}
|
|
33415
|
+
|
|
33273
33416
|
const YcPlusPage = YcPlusPageComponent;
|
|
33274
33417
|
const YcTableHeaderFilterCell = YcTableHeaderFilterCellComponent;
|
|
33275
33418
|
const RePlusPage = YcPlusPageComponent;
|
|
@@ -63630,4 +63773,4 @@ const version = "0.0.13";
|
|
|
63630
63773
|
|
|
63631
63774
|
const install = installer.install;
|
|
63632
63775
|
|
|
63633
|
-
export { DEFAULT_CDN_CONFIG, DEFAULT_OPERATORS, DEFAULT_YC_CONFIG, DatePickerValueIsArrayList, DefaultPageInfo, DefaultPageSizeList, DictStoreInjectionKey, NO_VALUE_OPERATORS, OPERATOR_CATALOG, OPERATOR_LABELS, PlusBreadcrumb, PlusCheckCard, PlusCheckCardGroup, PlusDatePicker, PlusDescriptions, PlusDialog, PlusDialogForm, PlusDisplayItem, PlusDrawerForm, PlusForm, PlusFormItem, PlusHeader, PlusInputTag, PlusLayout, PlusPage, PlusPagination, PlusPopover, PlusRadio, PlusSearch, PlusSidebar, PlusSidebarItem, PlusStepsForm, PlusTable, PlusVirtualTable, YcAnimateSelector as ReAnimateSelector, YcAuth as ReAuth, YcBatchImportDialog as ReBatchImportDialog, YcCard as ReCard, YcCol as ReCol, YcConfigProvider as ReConfigProvider, ReDialog, YcDownloadDialog as ReDownloadDialog, ReDrawer, ReFormContainerHeader, YcLineTree as ReLineTree, ReMoreActions, YcCountTo as ReNormalCountTo, YcPerms as RePerms, RePlusPage, RePlusTree, YcSegmented as ReSegmented, YcSelectV2 as ReSelectV2, YcStatusDialog as ReStatusDialog, YcSvgIcon as ReSvgIcon, YcTabsWithFilter as ReTabsWithFilter, YcText as ReText, YcReboundCountTo as ReboundCountTo, SIZE_MAP, STATUS_CONFIG_MAP, TableColumnsEmptyTextInjectionKey, TableFormFieldRefInjectionKey, TableFormRefInjectionKey, TableFormRowInfoInjectionKey, ValueIsArrayList, ValueIsBooleanList, ValueIsNumberList, YC_CONFIG_KEY, YcAnimateSelector, YcAnimateSelectorWithInstall, YcAuth, YcAuthWithInstall, YcBatchImportDialog, YcBatchImportDialogWithInstall, YcCard, YcCardWithInstall, YcCol, YcConfigProvider, YcCountTo, YcDialog, YcDownloadDialog, YcDownloadDialogWithInstall, YcDrawer, YcFlicker, YcFormContainerHeader, YcLineTree, YcLineTreeWithInstall, YcMoreActions, YcPerms, YcPermsWithInstall, YcPlusPage, YcPlusTree, YcReboundCountTo, YcReboundCountToWithInstall, YcSegmented, YcSegmentedWithInstall, YcSelectV2, YcStatusDialog, YcSvgIcon, YcTableHeaderFilterCell, YcTabsWithFilter, YcTabsWithFilterWithInstall, YcText, YcTextWithInstall, addDrawer, animates, closeAllDrawer, closeDrawer, createDictStore, installer as default, drawerStore, findNodeById, findNodeByPath, findNodePosition, insertAsChild, insertAsSibling, insertNodeAtPosition, install, providePlusProConfig, removeNode, reorderNodeChildren, reorderSiblingNodes, selectValueTypeList, updateDrawer, useColumnAdapter, useDialogFormConfig, useDictInjection, useDrawerFormConfig, useGetOptions, useHeaderFilter, useLocale, usePlusFormReset, usePlusProConfig, useRenderFlicker, useRenderFlicker as useRenderReFlicker, useSelectWithMapping, useSelectWithPagination, useSortableDrag$1 as useSortableDrag, useTable, useVirtualScroll, useVirtualSelection, useYcAuth, useYcCdn, useYcCdnUrl, useYcComponentConfig, useYcConfig, useYcPerms, useYcShowPageSearch, useYcTranslate, version };
|
|
63776
|
+
export { DEFAULT_CDN_CONFIG, DEFAULT_OPERATORS, DEFAULT_YC_CONFIG, DatePickerValueIsArrayList, DefaultPageInfo, DefaultPageSizeList, DictStoreInjectionKey, NO_VALUE_OPERATORS, OPERATOR_CATALOG, OPERATOR_LABELS, PlusBreadcrumb, PlusCheckCard, PlusCheckCardGroup, PlusDatePicker, PlusDescriptions, PlusDialog, PlusDialogForm, PlusDisplayItem, PlusDrawerForm, PlusForm, PlusFormItem, PlusHeader, PlusInputTag, PlusLayout, PlusPage, PlusPagination, PlusPopover, PlusRadio, PlusSearch, PlusSidebar, PlusSidebarItem, PlusStepsForm, PlusTable, PlusVirtualTable, YcAnimateSelector as ReAnimateSelector, YcAuth as ReAuth, YcBatchImportDialog as ReBatchImportDialog, YcCard as ReCard, YcCol as ReCol, YcConfigProvider as ReConfigProvider, ReDialog, YcDownloadDialog as ReDownloadDialog, ReDrawer, ReFormContainerHeader, YcLineTree as ReLineTree, ReMoreActions, YcCountTo as ReNormalCountTo, YcPerms as RePerms, RePlusPage, RePlusTree, YcSegmented as ReSegmented, YcSelectV2 as ReSelectV2, YcStatusDialog as ReStatusDialog, YcSvgIcon as ReSvgIcon, YcTabsWithFilter as ReTabsWithFilter, YcText as ReText, YcReboundCountTo as ReboundCountTo, SIZE_MAP, STATUS_CONFIG_MAP, TableColumnsEmptyTextInjectionKey, TableFormFieldRefInjectionKey, TableFormRefInjectionKey, TableFormRowInfoInjectionKey, ValueIsArrayList, ValueIsBooleanList, ValueIsNumberList, YC_CONFIG_KEY, YcAnimateSelector, YcAnimateSelectorWithInstall, YcAuth, YcAuthWithInstall, YcBatchImportDialog, YcBatchImportDialogWithInstall, YcCard, YcCardWithInstall, YcCol, YcConfigProvider, YcCountTo, YcDialog, YcDownloadDialog, YcDownloadDialogWithInstall, YcDrawer, YcFlicker, YcFormContainerHeader, YcLineTree, YcLineTreeWithInstall, YcMoreActions, YcPerms, YcPermsWithInstall, YcPlusPage, YcPlusTree, YcReboundCountTo, YcReboundCountToWithInstall, YcSegmented, YcSegmentedWithInstall, YcSelectV2, YcStatusDialog, YcSvgIcon, YcTableHeaderFilterCell, YcTabsWithFilter, YcTabsWithFilterWithInstall, YcText, YcTextWithInstall, addDrawer, animates, closeAllDrawer, closeDrawer, createDictStore, installer as default, drawerStore, findNodeById, findNodeByPath, findNodePosition, insertAsChild, insertAsSibling, insertNodeAtPosition, install, providePlusProConfig, removeNode, reorderNodeChildren, reorderSiblingNodes, selectValueTypeList, updateDrawer, useColumnAdapter, useDialogFormConfig, useDictInjection, useDrawerFormConfig, useGetOptions, useHeaderFilter, useLocalHeaderFilter, useLocale, usePlusFormReset, usePlusProConfig, useRenderFlicker, useRenderFlicker as useRenderReFlicker, useSelectWithMapping, useSelectWithPagination, useSortableDrag$1 as useSortableDrag, useTable, useVirtualScroll, useVirtualSelection, useYcAuth, useYcCdn, useYcCdnUrl, useYcComponentConfig, useYcConfig, useYcPerms, useYcShowPageSearch, useYcTranslate, version };
|
package/lib/components/index.js
CHANGED
|
@@ -49,6 +49,7 @@ var useVirtualScroll = require('./virtual-table/src/use-virtual-scroll.js');
|
|
|
49
49
|
var type = require('./yc-config-provider/src/type.js');
|
|
50
50
|
var useYcConfig = require('./yc-config-provider/src/useYcConfig.js');
|
|
51
51
|
var useHeaderFilter = require('./yc-plus-page/src/use-header-filter.js');
|
|
52
|
+
var useLocalHeaderFilter = require('./yc-plus-page/src/use-local-header-filter.js');
|
|
52
53
|
var constants = require('./yc-plus-page/src/constants.js');
|
|
53
54
|
var index$p = require('./yc-select-v2/src/index.vue.js');
|
|
54
55
|
var treeDataUtils = require('./yc-plus-tree/src/treeDataUtils.js');
|
|
@@ -144,6 +145,7 @@ exports.useYcPerms = useYcConfig.useYcPerms;
|
|
|
144
145
|
exports.useYcShowPageSearch = useYcConfig.useYcShowPageSearch;
|
|
145
146
|
exports.useYcTranslate = useYcConfig.useYcTranslate;
|
|
146
147
|
exports.useHeaderFilter = useHeaderFilter.useHeaderFilter;
|
|
148
|
+
exports.useLocalHeaderFilter = useLocalHeaderFilter.useLocalHeaderFilter;
|
|
147
149
|
exports.DEFAULT_OPERATORS = constants.DEFAULT_OPERATORS;
|
|
148
150
|
exports.NO_VALUE_OPERATORS = constants.NO_VALUE_OPERATORS;
|
|
149
151
|
exports.OPERATOR_CATALOG = constants.OPERATOR_CATALOG;
|
|
@@ -4,6 +4,8 @@ import { DefineComponent } from 'vue';
|
|
|
4
4
|
export type { YcPlusPageProps, FieldCatalogItem, FieldCatalog, OperatorOption, HeaderFilterConfig, ColumnHeaderFilterConfig, HeaderFilterPayload, HeaderFilterResetPayload, FilterItem, HeaderFiltersState, OrderByItem, RequestResponse } from './src/type';
|
|
5
5
|
export { useHeaderFilter } from './src/use-header-filter';
|
|
6
6
|
export type { UseHeaderFilterOptions, UseHeaderFilterReturn } from './src/use-header-filter';
|
|
7
|
+
export { useLocalHeaderFilter } from './src/use-local-header-filter';
|
|
8
|
+
export type { LocalFilterColumnConfig, UseLocalHeaderFilterOptions, UseLocalHeaderFilterReturn } from './src/use-local-header-filter';
|
|
7
9
|
export { OPERATOR_CATALOG, OPERATOR_LABELS, NO_VALUE_OPERATORS, DEFAULT_OPERATORS } from './src/constants';
|
|
8
10
|
export type YcPlusPageInstance = InstanceType<typeof YcPlusPageComponent>;
|
|
9
11
|
export declare const YcPlusPage: DefineComponent;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var index = require('./src/index.vue.js');
|
|
4
4
|
var headerFilterCell = require('./src/header-filter-cell.vue.js');
|
|
5
5
|
var useHeaderFilter = require('./src/use-header-filter.js');
|
|
6
|
+
var useLocalHeaderFilter = require('./src/use-local-header-filter.js');
|
|
6
7
|
var constants = require('./src/constants.js');
|
|
7
8
|
|
|
8
9
|
const YcPlusPage = index.default;
|
|
@@ -10,6 +11,7 @@ const YcTableHeaderFilterCell = headerFilterCell.default;
|
|
|
10
11
|
const RePlusPage = index.default;
|
|
11
12
|
|
|
12
13
|
exports.useHeaderFilter = useHeaderFilter.useHeaderFilter;
|
|
14
|
+
exports.useLocalHeaderFilter = useLocalHeaderFilter.useLocalHeaderFilter;
|
|
13
15
|
exports.DEFAULT_OPERATORS = constants.DEFAULT_OPERATORS;
|
|
14
16
|
exports.NO_VALUE_OPERATORS = constants.NO_VALUE_OPERATORS;
|
|
15
17
|
exports.OPERATOR_CATALOG = constants.OPERATOR_CATALOG;
|
|
@@ -5,6 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var headerFilterCell_vue_vue_type_script_setup_true_lang = require('./header-filter-cell.vue2.js');
|
|
6
6
|
var _pluginVue_exportHelper = require('../../../_virtual/_plugin-vue_export-helper.js');
|
|
7
7
|
|
|
8
|
-
var YcTableHeaderFilterCellComponent = /* @__PURE__ */ _pluginVue_exportHelper.default(headerFilterCell_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-
|
|
8
|
+
var YcTableHeaderFilterCellComponent = /* @__PURE__ */ _pluginVue_exportHelper.default(headerFilterCell_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-e0442d8a"], ["__file", "header-filter-cell.vue"]]);
|
|
9
9
|
|
|
10
10
|
exports.default = YcTableHeaderFilterCellComponent;
|
|
@@ -12,7 +12,8 @@ var useYcConfig = require('../../yc-config-provider/src/useYcConfig.js');
|
|
|
12
12
|
|
|
13
13
|
const _hoisted_1 = { class: "yc-header-filter-cell__label-text" };
|
|
14
14
|
const _hoisted_2 = { class: "yc-header-filter-cell__label-text" };
|
|
15
|
-
const _hoisted_3 = {
|
|
15
|
+
const _hoisted_3 = { style: { cursor: "pointer", display: "inline-flex", alignItems: "center" } };
|
|
16
|
+
const _hoisted_4 = {
|
|
16
17
|
class: "yc-header-filter-cell__content",
|
|
17
18
|
style: {
|
|
18
19
|
display: "flex",
|
|
@@ -22,10 +23,10 @@ const _hoisted_3 = {
|
|
|
22
23
|
gap: "4px"
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
26
|
+
const _hoisted_5 = { class: "yc-header-filter-cell__operators" };
|
|
27
|
+
const _hoisted_6 = ["onClick"];
|
|
28
|
+
const _hoisted_7 = { key: 0 };
|
|
29
|
+
const _hoisted_8 = {
|
|
29
30
|
class: "yc-header-filter-cell__actions",
|
|
30
31
|
style: {
|
|
31
32
|
display: "flex",
|
|
@@ -212,9 +213,14 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
212
213
|
alignItems: "center",
|
|
213
214
|
gap: "4px",
|
|
214
215
|
cursor: "default"
|
|
215
|
-
}
|
|
216
|
+
},
|
|
217
|
+
onMousedown: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
218
|
+
}, ["stop"])),
|
|
219
|
+
onClick: _cache[2] || (_cache[2] = vue.withModifiers(() => {
|
|
220
|
+
}, ["stop"]))
|
|
216
221
|
},
|
|
217
222
|
[
|
|
223
|
+
vue.createCommentVNode(" @mousedown.stop / @click.stop \u963B\u6B62 el-table <th> \u7684 handleHeaderClick \u548C\u5217 resize \u4E8B\u4EF6\u7A7F\u900F "),
|
|
218
224
|
vue.createCommentVNode(" \u6807\u7B7E\u5185\u5BB9 "),
|
|
219
225
|
vue.createElementVNode(
|
|
220
226
|
"span",
|
|
@@ -339,14 +345,12 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
339
345
|
placement: "bottom-start",
|
|
340
346
|
width: 220,
|
|
341
347
|
visible: popVisible.value,
|
|
348
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => popVisible.value = $event),
|
|
342
349
|
"popper-class": "yc-header-filter-pop",
|
|
343
350
|
"popper-style": { zIndex: 4e3 }
|
|
344
351
|
}, {
|
|
345
352
|
reference: vue.withCtx(() => [
|
|
346
|
-
vue.createElementVNode("span",
|
|
347
|
-
style: { cursor: "pointer", display: "inline-flex", alignItems: "center" },
|
|
348
|
-
onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => popVisible.value = !popVisible.value, ["stop"]))
|
|
349
|
-
}, [
|
|
353
|
+
vue.createElementVNode("span", _hoisted_3, [
|
|
350
354
|
vue.createVNode(vue.unref(index$1.default), {
|
|
351
355
|
src: filterIconUrl.value,
|
|
352
356
|
size: 14,
|
|
@@ -355,9 +359,9 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
355
359
|
])
|
|
356
360
|
]),
|
|
357
361
|
default: vue.withCtx(() => [
|
|
358
|
-
vue.createElementVNode("div",
|
|
362
|
+
vue.createElementVNode("div", _hoisted_4, [
|
|
359
363
|
vue.createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868 "),
|
|
360
|
-
vue.createElementVNode("div",
|
|
364
|
+
vue.createElementVNode("div", _hoisted_5, [
|
|
361
365
|
(vue.openBlock(true), vue.createElementBlock(
|
|
362
366
|
vue.Fragment,
|
|
363
367
|
null,
|
|
@@ -384,8 +388,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
384
388
|
1
|
|
385
389
|
/* TEXT */
|
|
386
390
|
),
|
|
387
|
-
state.selectedOp === op.code ? (vue.openBlock(), vue.createElementBlock("span",
|
|
388
|
-
], 12,
|
|
391
|
+
state.selectedOp === op.code ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_7, "\u2713")) : vue.createCommentVNode("v-if", true)
|
|
392
|
+
], 12, _hoisted_6);
|
|
389
393
|
}),
|
|
390
394
|
128
|
|
391
395
|
/* KEYED_FRAGMENT */
|
|
@@ -394,7 +398,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
394
398
|
vue.createCommentVNode(" \u503C\u8F93\u5165 "),
|
|
395
399
|
needValueInput.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(renderValueField), { key: 0 })) : vue.createCommentVNode("v-if", true),
|
|
396
400
|
vue.createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
|
|
397
|
-
vue.createElementVNode("div",
|
|
401
|
+
vue.createElementVNode("div", _hoisted_8, [
|
|
398
402
|
vue.createVNode(vue.unref(elementPlus.ElButton), { onClick: handleReset }, {
|
|
399
403
|
default: vue.withCtx(() => [
|
|
400
404
|
vue.createTextVNode("\u91CD\u7F6E")
|
|
@@ -419,8 +423,8 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
419
423
|
/* STABLE */
|
|
420
424
|
}, 8, ["visible"])) : vue.createCommentVNode("v-if", true)
|
|
421
425
|
],
|
|
422
|
-
|
|
423
|
-
/* NEED_PATCH */
|
|
426
|
+
544
|
|
427
|
+
/* NEED_HYDRATION, NEED_PATCH */
|
|
424
428
|
);
|
|
425
429
|
};
|
|
426
430
|
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { HeaderFiltersState, OrderByItem, OperatorOption, HeaderFilterPayload, HeaderFilterResetPayload } from './type';
|
|
2
|
+
import { Ref, ComputedRef } from 'vue';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 可筛选列配置
|
|
6
|
+
*/
|
|
7
|
+
export interface LocalFilterColumnConfig {
|
|
8
|
+
/** 列字段名(对应 el-table-column 的 prop) */
|
|
9
|
+
prop: string;
|
|
10
|
+
/** 字段类型,决定可用的操作符集合,默认 'string' */
|
|
11
|
+
type?: 'string' | 'number' | 'date' | 'boolean';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* useLocalHeaderFilter 配置项
|
|
15
|
+
*/
|
|
16
|
+
export interface UseLocalHeaderFilterOptions {
|
|
17
|
+
/** 需要启用筛选的列配置,未配置的列不显示筛选 */
|
|
18
|
+
filterableColumns?: LocalFilterColumnConfig[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* useLocalHeaderFilter 返回值
|
|
22
|
+
*/
|
|
23
|
+
export interface UseLocalHeaderFilterReturn<T> {
|
|
24
|
+
/** 经过筛选和排序后的数据,绑定到表格的 :data */
|
|
25
|
+
filteredData: ComputedRef<T[]>;
|
|
26
|
+
/** 当前筛选状态,传给 YcTableHeaderFilterCell 的 :filters */
|
|
27
|
+
headerFiltersState: HeaderFiltersState;
|
|
28
|
+
/** 当前排序状态,传给 YcTableHeaderFilterCell 的 :order-by */
|
|
29
|
+
orderByState: OrderByItem[];
|
|
30
|
+
/** 筛选确认处理,传给 YcTableHeaderFilterCell 的 @confirm */
|
|
31
|
+
handleFilterConfirm: (payload: HeaderFilterPayload) => void;
|
|
32
|
+
/** 筛选重置处理,传给 YcTableHeaderFilterCell 的 @reset */
|
|
33
|
+
handleFilterReset: (payload: HeaderFilterResetPayload) => void;
|
|
34
|
+
/** 排序切换处理,传给 YcTableHeaderFilterCell 的 @sort-change */
|
|
35
|
+
handleSortChange: (payload: {
|
|
36
|
+
field: string;
|
|
37
|
+
direction?: 'asc' | 'desc';
|
|
38
|
+
}) => void;
|
|
39
|
+
/** 根据 prop 获取操作符列表,传给 YcTableHeaderFilterCell 的 :operators */
|
|
40
|
+
getOpsByProp: (prop: string) => OperatorOption[];
|
|
41
|
+
/** 重置所有筛选和排序 */
|
|
42
|
+
resetAllFilters: () => void;
|
|
43
|
+
/** 是否有激活的筛选条件 */
|
|
44
|
+
hasActiveFilters: ComputedRef<boolean>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 本地数据表头筛选组合式函数
|
|
48
|
+
*
|
|
49
|
+
* @param data - 响应式数据源
|
|
50
|
+
* @param options - 可筛选列配置
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* import { useLocalHeaderFilter, YcTableHeaderFilterCell } from 'yc-pro-components'
|
|
55
|
+
*
|
|
56
|
+
* const {
|
|
57
|
+
* filteredData,
|
|
58
|
+
* headerFiltersState,
|
|
59
|
+
* orderByState,
|
|
60
|
+
* handleFilterConfirm,
|
|
61
|
+
* handleFilterReset,
|
|
62
|
+
* handleSortChange,
|
|
63
|
+
* getOpsByProp
|
|
64
|
+
* } = useLocalHeaderFilter(tableData, {
|
|
65
|
+
* filterableColumns: [
|
|
66
|
+
* { prop: 'userName', type: 'string' },
|
|
67
|
+
* { prop: 'realShortName', type: 'string' },
|
|
68
|
+
* { prop: 'weight', type: 'number' }
|
|
69
|
+
* ]
|
|
70
|
+
* })
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* 模板中配合 el-table 使用:
|
|
74
|
+
* ```vue
|
|
75
|
+
* <el-table :data="filteredData">
|
|
76
|
+
* <el-table-column prop="userName">
|
|
77
|
+
* <template #header>
|
|
78
|
+
* <YcTableHeaderFilterCell
|
|
79
|
+
* label="客户名称"
|
|
80
|
+
* :column="{ prop: 'userName' }"
|
|
81
|
+
* :operators="getOpsByProp('userName')"
|
|
82
|
+
* :filters="headerFiltersState.filters"
|
|
83
|
+
* :order-by="orderByState"
|
|
84
|
+
* @confirm="handleFilterConfirm"
|
|
85
|
+
* @reset="handleFilterReset"
|
|
86
|
+
* @sort-change="handleSortChange"
|
|
87
|
+
* />
|
|
88
|
+
* </template>
|
|
89
|
+
* </el-table-column>
|
|
90
|
+
* </el-table>
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function useLocalHeaderFilter<T = Record<string, unknown>>(data: Ref<T[]> | ComputedRef<T[]>, options?: UseLocalHeaderFilterOptions): UseLocalHeaderFilterReturn<T>;
|