yc-pro-components 0.0.46 → 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 +10 -10
- package/es/index.mjs +1 -0
- package/index.css +5 -5
- package/index.js +169 -23
- package/index.min.css +1 -1
- package/index.min.js +11 -11
- package/index.min.mjs +11 -11
- package/index.mjs +169 -24
- 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 +10 -10
- 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/theme-chalk/index.css +1 -1
- package/theme-chalk/plus-yc-plus-page.css +1 -1
- package/theme-chalk/src/yc-plus-page.scss +17 -0
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
|
|
|
@@ -18334,7 +18334,7 @@ const _hoisted_7$6 = {
|
|
|
18334
18334
|
key: 0,
|
|
18335
18335
|
class: "plus-table-checkbox-handle"
|
|
18336
18336
|
};
|
|
18337
|
-
const _hoisted_8$
|
|
18337
|
+
const _hoisted_8$5 = { key: 1 };
|
|
18338
18338
|
const _hoisted_9$4 = { key: 1 };
|
|
18339
18339
|
var _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
18340
18340
|
...{
|
|
@@ -18717,7 +18717,7 @@ var _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
18717
18717
|
/* DYNAMIC */
|
|
18718
18718
|
}, 1032, ["content"])) : (openBlock(), createElementBlock(
|
|
18719
18719
|
"span",
|
|
18720
|
-
_hoisted_8$
|
|
18720
|
+
_hoisted_8$5,
|
|
18721
18721
|
toDisplayString(item.label ? getLabelValue(item.label) : ""),
|
|
18722
18722
|
1
|
|
18723
18723
|
/* TEXT */
|
|
@@ -22022,7 +22022,7 @@ const _hoisted_4$8 = /* @__PURE__ */ createElementVNode(
|
|
|
22022
22022
|
const _hoisted_5$8 = { class: "plus-header__right" };
|
|
22023
22023
|
const _hoisted_6$6 = { class: "plus-header__dropdown-area" };
|
|
22024
22024
|
const _hoisted_7$5 = ["src"];
|
|
22025
|
-
const _hoisted_8$
|
|
22025
|
+
const _hoisted_8$4 = { class: "plus-header__username" };
|
|
22026
22026
|
const _hoisted_9$3 = {
|
|
22027
22027
|
key: 0,
|
|
22028
22028
|
class: "plus-header-placeholder"
|
|
@@ -22177,7 +22177,7 @@ var _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
22177
22177
|
createCommentVNode(" username "),
|
|
22178
22178
|
createElementVNode(
|
|
22179
22179
|
"p",
|
|
22180
|
-
_hoisted_8$
|
|
22180
|
+
_hoisted_8$4,
|
|
22181
22181
|
toDisplayString(_ctx.userInfo.username || "admin"),
|
|
22182
22182
|
1
|
|
22183
22183
|
/* TEXT */
|
|
@@ -32350,7 +32350,8 @@ function useHeaderFilter(options = {}) {
|
|
|
32350
32350
|
|
|
32351
32351
|
const _hoisted_1$9 = { class: "yc-header-filter-cell__label-text" };
|
|
32352
32352
|
const _hoisted_2$8 = { class: "yc-header-filter-cell__label-text" };
|
|
32353
|
-
const _hoisted_3$8 = {
|
|
32353
|
+
const _hoisted_3$8 = { style: { cursor: "pointer", display: "inline-flex", alignItems: "center" } };
|
|
32354
|
+
const _hoisted_4$6 = {
|
|
32354
32355
|
class: "yc-header-filter-cell__content",
|
|
32355
32356
|
style: {
|
|
32356
32357
|
display: "flex",
|
|
@@ -32360,10 +32361,10 @@ const _hoisted_3$8 = {
|
|
|
32360
32361
|
gap: "4px"
|
|
32361
32362
|
}
|
|
32362
32363
|
};
|
|
32363
|
-
const
|
|
32364
|
-
const
|
|
32365
|
-
const
|
|
32366
|
-
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 = {
|
|
32367
32368
|
class: "yc-header-filter-cell__actions",
|
|
32368
32369
|
style: {
|
|
32369
32370
|
display: "flex",
|
|
@@ -32550,9 +32551,14 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32550
32551
|
alignItems: "center",
|
|
32551
32552
|
gap: "4px",
|
|
32552
32553
|
cursor: "default"
|
|
32553
|
-
}
|
|
32554
|
+
},
|
|
32555
|
+
onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
32556
|
+
}, ["stop"])),
|
|
32557
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
32558
|
+
}, ["stop"]))
|
|
32554
32559
|
},
|
|
32555
32560
|
[
|
|
32561
|
+
createCommentVNode(" @mousedown.stop / @click.stop \u963B\u6B62 el-table <th> \u7684 handleHeaderClick \u548C\u5217 resize \u4E8B\u4EF6\u7A7F\u900F "),
|
|
32556
32562
|
createCommentVNode(" \u6807\u7B7E\u5185\u5BB9 "),
|
|
32557
32563
|
createElementVNode(
|
|
32558
32564
|
"span",
|
|
@@ -32677,14 +32683,12 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32677
32683
|
placement: "bottom-start",
|
|
32678
32684
|
width: 220,
|
|
32679
32685
|
visible: popVisible.value,
|
|
32686
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => popVisible.value = $event),
|
|
32680
32687
|
"popper-class": "yc-header-filter-pop",
|
|
32681
32688
|
"popper-style": { zIndex: 4e3 }
|
|
32682
32689
|
}, {
|
|
32683
32690
|
reference: withCtx(() => [
|
|
32684
|
-
createElementVNode("span",
|
|
32685
|
-
style: { cursor: "pointer", display: "inline-flex", alignItems: "center" },
|
|
32686
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => popVisible.value = !popVisible.value, ["stop"]))
|
|
32687
|
-
}, [
|
|
32691
|
+
createElementVNode("span", _hoisted_3$8, [
|
|
32688
32692
|
createVNode(unref(YcSvgIcon), {
|
|
32689
32693
|
src: filterIconUrl.value,
|
|
32690
32694
|
size: 14,
|
|
@@ -32693,9 +32697,9 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32693
32697
|
])
|
|
32694
32698
|
]),
|
|
32695
32699
|
default: withCtx(() => [
|
|
32696
|
-
createElementVNode("div",
|
|
32700
|
+
createElementVNode("div", _hoisted_4$6, [
|
|
32697
32701
|
createCommentVNode(" \u64CD\u4F5C\u7B26\u5217\u8868 "),
|
|
32698
|
-
createElementVNode("div",
|
|
32702
|
+
createElementVNode("div", _hoisted_5$6, [
|
|
32699
32703
|
(openBlock(true), createElementBlock(
|
|
32700
32704
|
Fragment,
|
|
32701
32705
|
null,
|
|
@@ -32722,8 +32726,8 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32722
32726
|
1
|
|
32723
32727
|
/* TEXT */
|
|
32724
32728
|
),
|
|
32725
|
-
state.selectedOp === op.code ? (openBlock(), createElementBlock("span",
|
|
32726
|
-
], 12,
|
|
32729
|
+
state.selectedOp === op.code ? (openBlock(), createElementBlock("span", _hoisted_7$4, "\u2713")) : createCommentVNode("v-if", true)
|
|
32730
|
+
], 12, _hoisted_6$5);
|
|
32727
32731
|
}),
|
|
32728
32732
|
128
|
|
32729
32733
|
/* KEYED_FRAGMENT */
|
|
@@ -32732,7 +32736,7 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32732
32736
|
createCommentVNode(" \u503C\u8F93\u5165 "),
|
|
32733
32737
|
needValueInput.value ? (openBlock(), createBlock(resolveDynamicComponent(renderValueField), { key: 0 })) : createCommentVNode("v-if", true),
|
|
32734
32738
|
createCommentVNode(" \u64CD\u4F5C\u6309\u94AE "),
|
|
32735
|
-
createElementVNode("div",
|
|
32739
|
+
createElementVNode("div", _hoisted_8$3, [
|
|
32736
32740
|
createVNode(unref(ElButton), { onClick: handleReset }, {
|
|
32737
32741
|
default: withCtx(() => [
|
|
32738
32742
|
createTextVNode("\u91CD\u7F6E")
|
|
@@ -32757,14 +32761,14 @@ var _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
32757
32761
|
/* STABLE */
|
|
32758
32762
|
}, 8, ["visible"])) : createCommentVNode("v-if", true)
|
|
32759
32763
|
],
|
|
32760
|
-
|
|
32761
|
-
/* NEED_PATCH */
|
|
32764
|
+
544
|
|
32765
|
+
/* NEED_HYDRATION, NEED_PATCH */
|
|
32762
32766
|
);
|
|
32763
32767
|
};
|
|
32764
32768
|
}
|
|
32765
32769
|
});
|
|
32766
32770
|
|
|
32767
|
-
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"]]);
|
|
32768
32772
|
|
|
32769
32773
|
const DEFAULT_PAGE_SIZE = 20;
|
|
32770
32774
|
const COLUMN_CACHE_PREFIX = "yc-column-settings:";
|
|
@@ -33268,6 +33272,147 @@ var _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
33268
33272
|
|
|
33269
33273
|
var YcPlusPageComponent = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-c7557953"], ["__file", "index.vue"]]);
|
|
33270
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
|
+
|
|
33271
33416
|
const YcPlusPage = YcPlusPageComponent;
|
|
33272
33417
|
const YcTableHeaderFilterCell = YcTableHeaderFilterCellComponent;
|
|
33273
33418
|
const RePlusPage = YcPlusPageComponent;
|
|
@@ -63628,4 +63773,4 @@ const version = "0.0.13";
|
|
|
63628
63773
|
|
|
63629
63774
|
const install = installer.install;
|
|
63630
63775
|
|
|
63631
|
-
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>;
|