@wx-design/components 0.1.5 → 0.1.7
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/core/Table/components/CellEditors/Boolean.d.ts +1 -1
- package/es/core/Table/components/CellEditors/Color.d.ts +1 -1
- package/es/core/Table/components/CellEditors/DatePicker.d.ts +1 -1
- package/es/core/Table/components/CellEditors/Image.d.ts +1 -1
- package/es/core/Table/components/CellEditors/Input.d.ts +1 -1
- package/es/core/Table/components/CellEditors/InputNumber.d.ts +1 -1
- package/es/core/Table/components/CellEditors/PopOver.d.ts +1 -0
- package/es/core/Table/components/CellEditors/Select.d.ts +1 -1
- package/es/core/Table/components/CellRender.d.ts +1 -1
- package/es/core/Table/components/Toolbar/index.vue.d.ts +1 -1
- package/es/core/Table/configs/column.d.ts +1 -1
- package/es/core/Table/configs/table.d.ts +1 -1
- package/es/core/Table/constants.d.ts +9 -0
- package/es/core/Table/index.d.ts +1 -1
- package/es/core/Table/index.vue.d.ts +2 -2
- package/es/index.mjs +30 -29
- package/lib/core/Table/components/CellEditors/Boolean.d.ts +1 -1
- package/lib/core/Table/components/CellEditors/Color.d.ts +1 -1
- package/lib/core/Table/components/CellEditors/DatePicker.d.ts +1 -1
- package/lib/core/Table/components/CellEditors/Image.d.ts +1 -1
- package/lib/core/Table/components/CellEditors/Input.d.ts +1 -1
- package/lib/core/Table/components/CellEditors/InputNumber.d.ts +1 -1
- package/lib/core/Table/components/CellEditors/PopOver.d.ts +1 -0
- package/lib/core/Table/components/CellEditors/Select.d.ts +1 -1
- package/lib/core/Table/components/CellRender.d.ts +1 -1
- package/lib/core/Table/components/Toolbar/index.vue.d.ts +1 -1
- package/lib/core/Table/configs/column.d.ts +1 -1
- package/lib/core/Table/configs/table.d.ts +1 -1
- package/lib/core/Table/constants.d.ts +9 -0
- package/lib/core/Table/index.d.ts +1 -1
- package/lib/core/Table/index.vue.d.ts +2 -2
- package/lib/index.js +1 -1
- package/package.json +3 -3
- package/types/index.d.ts +8 -0
- package/types/table/column.d.ts +98 -0
- package/types/table/index.d.ts +10 -0
- package/types/table/table.d.ts +19 -0
- package/types/table/toolbar.d.ts +22 -0
- package/es/core/Table/types/column.d.ts +0 -74
- package/es/core/Table/types/index.d.ts +0 -3
- package/es/core/Table/types/table.d.ts +0 -11
- package/es/core/Table/types/toolbar.d.ts +0 -11
- package/index.d.ts +0 -1
- package/lib/core/Table/types/column.d.ts +0 -74
- package/lib/core/Table/types/index.d.ts +0 -3
- package/lib/core/Table/types/table.d.ts +0 -11
- package/lib/core/Table/types/toolbar.d.ts +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格-Boolean
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellBoolean: import("vue").DefineComponent<{
|
|
6
6
|
modelValue: StringConstructor;
|
|
7
7
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格-颜色
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellColor: import("vue").DefineComponent<{
|
|
6
6
|
color: StringConstructor;
|
|
7
7
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 单元格编辑-日期输入
|
|
3
3
|
*/
|
|
4
4
|
import { DatePickerProps } from "element-plus";
|
|
5
|
-
import { SabColumnProps } from "
|
|
5
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
6
6
|
declare const SabCellEditDatePicker: import("vue").DefineComponent<DatePickerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<DatePickerProps>, {
|
|
7
7
|
readonly popperOptions: any;
|
|
8
8
|
}, {}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格编辑-输入框
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellEditInput: import("vue").DefineComponent<{
|
|
6
6
|
modelValue?: string | undefined;
|
|
7
7
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格编辑-数值输入框
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellEditInputNumber: import("vue").DefineComponent<{
|
|
6
6
|
modelValue?: number | undefined;
|
|
7
7
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -8,6 +8,7 @@ type SabCellEditPopoverProps = PopoverProps & {
|
|
|
8
8
|
};
|
|
9
9
|
declare const SabCellEditPopover: import("vue").DefineComponent<Partial<SabCellEditPopoverProps>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<Partial<SabCellEditPopoverProps>>, {
|
|
10
10
|
readonly popperOptions?: any;
|
|
11
|
+
column?: any;
|
|
11
12
|
readonly placement?: any;
|
|
12
13
|
}, {}>;
|
|
13
14
|
export default SabCellEditPopover;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SabColumnProps } from "
|
|
1
|
+
import type { SabColumnProps } from "../../../types/table";
|
|
2
2
|
declare const CellRender: import("vue").DefineComponent<SabColumnProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<SabColumnProps>, {
|
|
3
3
|
params?: any;
|
|
4
4
|
}, {}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolbarProps } from "
|
|
1
|
+
import type { ToolbarProps } from "../../../../types/table";
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<ToolbarProps<import("vxe-table").VxeTableDataRow>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ToolbarProps<import("vxe-table").VxeTableDataRow>>>>, {}, {}>, {
|
|
3
3
|
default?(_: {}): any;
|
|
4
4
|
}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SabColumnProps } from "
|
|
1
|
+
import type { SabColumnProps } from "../../../types/table";
|
|
2
2
|
export declare const defaultColumnConfig: (column: SabColumnProps) => SabColumnProps;
|
|
3
3
|
export declare const setDefaultColumnConfigs: (columns: SabColumnProps[]) => SabColumnProps[];
|
package/es/core/Table/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VxeTableInstance } from "vxe-table";
|
|
2
|
-
import { SabTableProps } from "
|
|
2
|
+
import type { SabTableProps } from "../../types/table";
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SabTableProps>, Partial<SabTableProps>>, {
|
|
4
4
|
$?: import("vue").ComponentInternalInstance | undefined;
|
|
5
5
|
$data?: {} | undefined;
|
|
@@ -503,11 +503,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
503
503
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SabTableProps>, Partial<SabTableProps>>>>, {
|
|
504
504
|
data: import("vxe-table").VxeTablePropTypes.Data<import("vxe-table").VxeTableDataRow>;
|
|
505
505
|
class: any;
|
|
506
|
+
columns: Partial<import("../../types/table").SabColumnProps<import("vxe-table").VxeTableDataRow>>[];
|
|
506
507
|
id: string;
|
|
507
508
|
size: import("vxe-table").SizeType;
|
|
508
509
|
cellClassName: import("vxe-table").VxeTablePropTypes.CellClassName<import("vxe-table").VxeTableDataRow>;
|
|
509
510
|
editable: boolean;
|
|
510
|
-
columns: Partial<import("./types").SabColumnProps<import("vxe-table").VxeTableDataRow>>[];
|
|
511
511
|
loading: boolean;
|
|
512
512
|
round: boolean;
|
|
513
513
|
height: import("vxe-table").VxeTablePropTypes.Height;
|
package/es/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ee, { Column as te, Table as le } from "vxe-table";
|
|
2
|
-
import { defineComponent as d, computed as _, ref as q, openBlock as b, createElementBlock as y, mergeProps as g, Fragment as k, renderList as $, createBlock as T, unref as h, withCtx as w, createTextVNode as B, createCommentVNode as G, renderSlot as R, createVNode as i, createElementVNode as
|
|
3
|
-
import { ElButton as
|
|
2
|
+
import { defineComponent as d, computed as _, ref as q, openBlock as b, createElementBlock as y, mergeProps as g, Fragment as k, renderList as $, createBlock as T, unref as h, withCtx as w, createTextVNode as B, createCommentVNode as G, renderSlot as R, createVNode as i, createElementVNode as I, mergeDefaults as re, toHandlers as ne, normalizeProps as oe, guardReactiveProps as ae, createSlots as ie } from "vue";
|
|
3
|
+
import { ElButton as A, ElInput as se, ElInputNumber as ce, ElDatePicker as ue, ElSelect as fe, ElOption as de, ElIcon as F, ElImage as M, ElPopover as be, ElCheckbox as ge } from "element-plus";
|
|
4
4
|
var j = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
5
5
|
function L(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -25,9 +25,9 @@ var xe = Te, Ee = Object.prototype, $e = Ee.toString;
|
|
|
25
25
|
function Re(e) {
|
|
26
26
|
return $e.call(e);
|
|
27
27
|
}
|
|
28
|
-
var Ve = Re, N = V, Be = xe,
|
|
28
|
+
var Ve = Re, N = V, Be = xe, Ie = Ve, Ae = "[object Null]", Fe = "[object Undefined]", z = N ? N.toStringTag : void 0;
|
|
29
29
|
function Me(e) {
|
|
30
|
-
return e == null ? e === void 0 ? Fe :
|
|
30
|
+
return e == null ? e === void 0 ? Fe : Ae : z && z in Object(e) ? Be(e) : Ie(e);
|
|
31
31
|
}
|
|
32
32
|
var Pe = Me;
|
|
33
33
|
function Ne(e) {
|
|
@@ -94,8 +94,8 @@ const st = /* @__PURE__ */ L(it), ct = (e) => {
|
|
|
94
94
|
var a;
|
|
95
95
|
o.value = !0;
|
|
96
96
|
try {
|
|
97
|
-
const
|
|
98
|
-
await ((a = t.saveSelectRecords) == null ? void 0 : a.call(t,
|
|
97
|
+
const f = r();
|
|
98
|
+
await ((a = t.saveSelectRecords) == null ? void 0 : a.call(t, f)), f.forEach((s) => {
|
|
99
99
|
var m;
|
|
100
100
|
return (m = l.value) == null ? void 0 : m.reloadRow(s, {});
|
|
101
101
|
}), n();
|
|
@@ -103,15 +103,15 @@ const st = /* @__PURE__ */ L(it), ct = (e) => {
|
|
|
103
103
|
o.value = !1;
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
return (a,
|
|
106
|
+
return (a, f) => (b(), y("div", g({
|
|
107
107
|
class: ["sab-table-toolbar", t.class]
|
|
108
|
-
}, a.$attrs), [(b(!0), y(k, null, $(a.features, (s) => (b(), y(k, null, [s === "clearSelect" ? (b(), T(h(
|
|
108
|
+
}, a.$attrs), [(b(!0), y(k, null, $(a.features, (s) => (b(), y(k, null, [s === "clearSelect" ? (b(), T(h(A), {
|
|
109
109
|
key: 0,
|
|
110
110
|
onClick: h(n)
|
|
111
111
|
}, {
|
|
112
112
|
default: w(() => [B("清空选择")]),
|
|
113
113
|
_: 1
|
|
114
|
-
}, 8, ["onClick"])) : s === "saveSelect" ? (b(), T(h(
|
|
114
|
+
}, 8, ["onClick"])) : s === "saveSelect" ? (b(), T(h(A), {
|
|
115
115
|
key: 1,
|
|
116
116
|
onClick: c,
|
|
117
117
|
loading: o.value
|
|
@@ -131,8 +131,8 @@ const st = /* @__PURE__ */ L(it), ct = (e) => {
|
|
|
131
131
|
...o
|
|
132
132
|
} = t, c = _(() => {
|
|
133
133
|
const a = {};
|
|
134
|
-
return Object.keys(n || {}).forEach((
|
|
135
|
-
a[
|
|
134
|
+
return Object.keys(n || {}).forEach((f) => {
|
|
135
|
+
a[f] = (s) => typeof n[f] == "string" ? l[n[f]](s) : typeof n[f] == "function" ? n[f](s, r) : null;
|
|
136
136
|
}), a;
|
|
137
137
|
});
|
|
138
138
|
return () => i(te, o, {
|
|
@@ -313,8 +313,8 @@ const p = /* @__PURE__ */ L(jt), kt = {
|
|
|
313
313
|
}, xt = (e, t, l) => {
|
|
314
314
|
const n = {
|
|
315
315
|
"cell-click": ({ row: o, column: c }) => {
|
|
316
|
-
var a,
|
|
317
|
-
t.value.autoClearSelected && ((a = l.value) != null && a.isCheckedByCheckboxRow(o) || (
|
|
316
|
+
var a, f, s;
|
|
317
|
+
t.value.autoClearSelected && ((a = l.value) != null && a.isCheckedByCheckboxRow(o) || (f = l.value) == null || f.clearCheckboxRow()), c.type === "checkbox" && c.field === "sab-table-seq" && ((s = l.value) == null || s.toggleCheckboxRow(o));
|
|
318
318
|
}
|
|
319
319
|
}, r = {};
|
|
320
320
|
return [
|
|
@@ -362,7 +362,7 @@ const p = /* @__PURE__ */ L(jt), kt = {
|
|
|
362
362
|
};
|
|
363
363
|
}), r;
|
|
364
364
|
};
|
|
365
|
-
var
|
|
365
|
+
var u = /* @__PURE__ */ ((e) => (e.Input = "input", e.InputNumber = "input-number", e.Select = "select", e.DatePciker = "date-picker", e.Image = "image", e.Color = "color", e.Boolean = "boolean", e))(u || {});
|
|
366
366
|
const Et = /* @__PURE__ */ d({
|
|
367
367
|
name: "SabCellEditInput",
|
|
368
368
|
emits: ["update:modelValue"],
|
|
@@ -380,7 +380,7 @@ const Et = /* @__PURE__ */ d({
|
|
|
380
380
|
}, t), null);
|
|
381
381
|
}
|
|
382
382
|
}), $t = {
|
|
383
|
-
sabCellType:
|
|
383
|
+
sabCellType: u.Input,
|
|
384
384
|
editRender: {
|
|
385
385
|
autofocus: ".el-input__inner"
|
|
386
386
|
},
|
|
@@ -412,6 +412,7 @@ const Et = /* @__PURE__ */ d({
|
|
|
412
412
|
}
|
|
413
413
|
}), Vt = {
|
|
414
414
|
cellType: "number",
|
|
415
|
+
sabCellType: u.InputNumber,
|
|
415
416
|
editRender: {
|
|
416
417
|
autofocus: ".el-input__inner"
|
|
417
418
|
},
|
|
@@ -442,8 +443,8 @@ const Et = /* @__PURE__ */ d({
|
|
|
442
443
|
"onUpdate:modelValue": n
|
|
443
444
|
}, t), null);
|
|
444
445
|
}
|
|
445
|
-
}),
|
|
446
|
-
sabCellType:
|
|
446
|
+
}), It = {
|
|
447
|
+
sabCellType: u.DatePciker,
|
|
447
448
|
editRender: {
|
|
448
449
|
autofocus: ".el-input__inner"
|
|
449
450
|
},
|
|
@@ -456,7 +457,7 @@ const Et = /* @__PURE__ */ d({
|
|
|
456
457
|
"onUpdate:modelValue": (n) => e[t.field] = n
|
|
457
458
|
}, l), null)
|
|
458
459
|
}
|
|
459
|
-
},
|
|
460
|
+
}, At = /* @__PURE__ */ d({
|
|
460
461
|
props: {
|
|
461
462
|
options: Array,
|
|
462
463
|
modelValue: {
|
|
@@ -503,7 +504,7 @@ const Et = /* @__PURE__ */ d({
|
|
|
503
504
|
});
|
|
504
505
|
}
|
|
505
506
|
}), Ft = {
|
|
506
|
-
sabCellType:
|
|
507
|
+
sabCellType: u.Input,
|
|
507
508
|
editRender: {
|
|
508
509
|
autofocus: ".el-input__inner"
|
|
509
510
|
},
|
|
@@ -513,7 +514,7 @@ const Et = /* @__PURE__ */ d({
|
|
|
513
514
|
column: t
|
|
514
515
|
}, l) => (
|
|
515
516
|
// @ts-ignore
|
|
516
|
-
i(
|
|
517
|
+
i(At, g({
|
|
517
518
|
automaticDropdown: !0,
|
|
518
519
|
modelValue: e[t.field],
|
|
519
520
|
"onUpdate:modelValue": (n) => e[t.field] = n
|
|
@@ -530,11 +531,11 @@ var Mt = /* @__PURE__ */ d({
|
|
|
530
531
|
xmlns: "http://www.w3.org/2000/svg",
|
|
531
532
|
viewBox: "0 0 1024 1024"
|
|
532
533
|
}, [
|
|
533
|
-
|
|
534
|
+
I("path", {
|
|
534
535
|
fill: "currentColor",
|
|
535
536
|
d: "M160 160v704h704V160zm-32-64h768a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H128a32 32 0 0 1-32-32V128a32 32 0 0 1 32-32"
|
|
536
537
|
}),
|
|
537
|
-
|
|
538
|
+
I("path", {
|
|
538
539
|
fill: "currentColor",
|
|
539
540
|
d: "M384 288q64 0 64 64t-64 64q-64 0-64-64t64-64M185.408 876.992l-50.816-38.912L350.72 556.032a96 96 0 0 1 134.592-17.856l1.856 1.472 122.88 99.136a32 32 0 0 0 44.992-4.864l216-269.888 49.92 39.936-215.808 269.824-.256.32a96 96 0 0 1-135.04 14.464l-122.88-99.072-.64-.512a32 32 0 0 0-44.8 5.952z"
|
|
540
541
|
})
|
|
@@ -595,7 +596,7 @@ const Pt = /* @__PURE__ */ d({
|
|
|
595
596
|
});
|
|
596
597
|
}
|
|
597
598
|
}), Nt = {
|
|
598
|
-
sabCellType:
|
|
599
|
+
sabCellType: u.Image,
|
|
599
600
|
showOverflow: !1,
|
|
600
601
|
align: "center",
|
|
601
602
|
slots: {
|
|
@@ -624,7 +625,7 @@ const Pt = /* @__PURE__ */ d({
|
|
|
624
625
|
}, null);
|
|
625
626
|
}
|
|
626
627
|
}), Dt = {
|
|
627
|
-
sabCellType:
|
|
628
|
+
sabCellType: u.Color,
|
|
628
629
|
className: "sab-cell-color",
|
|
629
630
|
slots: {
|
|
630
631
|
default: ({
|
|
@@ -655,7 +656,7 @@ const Pt = /* @__PURE__ */ d({
|
|
|
655
656
|
}, null);
|
|
656
657
|
}
|
|
657
658
|
}), Kt = {
|
|
658
|
-
sabCellType:
|
|
659
|
+
sabCellType: u.Color,
|
|
659
660
|
className: "sab-cell-boolean",
|
|
660
661
|
align: "center",
|
|
661
662
|
showOverflow: !1,
|
|
@@ -668,7 +669,7 @@ const Pt = /* @__PURE__ */ d({
|
|
|
668
669
|
"onUpdate:modelValue": (l) => e[t.field] = l
|
|
669
670
|
}, null)
|
|
670
671
|
}
|
|
671
|
-
}, Ut = (e) => (e.editable === !1 && delete e.editRender, e.sabCellType ===
|
|
672
|
+
}, Ut = (e) => (e.editable === !1 && delete e.editRender, e.sabCellType === u.Input ? p($t, e) : e.sabCellType === u.InputNumber ? p(Vt, e) : e.sabCellType === u.DatePciker ? p(It, e) : e.sabCellType === u.Select ? p(Ft, e) : e.sabCellType === u.Image ? p(Nt, e) : e.sabCellType === u.Color ? p(Dt, e) : e.sabCellType === u.Boolean ? p(Kt, e) : e), Yt = (e) => e.map((t) => Ut(t)).filter((t) => !t.hidden), E = /* @__PURE__ */ d({
|
|
672
673
|
name: "SabTable",
|
|
673
674
|
__name: "index",
|
|
674
675
|
props: re({
|
|
@@ -786,7 +787,7 @@ const Pt = /* @__PURE__ */ d({
|
|
|
786
787
|
xTable: o.value,
|
|
787
788
|
...o.value
|
|
788
789
|
});
|
|
789
|
-
const
|
|
790
|
+
const f = xt(r, c, o);
|
|
790
791
|
return (s, m) => (b(), y(k, null, [
|
|
791
792
|
s.showToolbar ? (b(), T(ut, {
|
|
792
793
|
key: 0,
|
|
@@ -801,7 +802,7 @@ const Pt = /* @__PURE__ */ d({
|
|
|
801
802
|
i(h(le), g({
|
|
802
803
|
ref_key: "xTable",
|
|
803
804
|
ref: o
|
|
804
|
-
}, c.value, ne(h(
|
|
805
|
+
}, c.value, ne(h(f)), {
|
|
805
806
|
class: ["sab-table", c.value.class]
|
|
806
807
|
}), {
|
|
807
808
|
default: w(() => [
|
|
@@ -823,6 +824,6 @@ E.install = (e) => {
|
|
|
823
824
|
e.component(E.name, E), e.use(ee);
|
|
824
825
|
};
|
|
825
826
|
export {
|
|
826
|
-
|
|
827
|
+
u as SabCellType,
|
|
827
828
|
E as SabTable
|
|
828
829
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格-Boolean
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellBoolean: import("vue").DefineComponent<{
|
|
6
6
|
modelValue: StringConstructor;
|
|
7
7
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格-颜色
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellColor: import("vue").DefineComponent<{
|
|
6
6
|
color: StringConstructor;
|
|
7
7
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 单元格编辑-日期输入
|
|
3
3
|
*/
|
|
4
4
|
import { DatePickerProps } from "element-plus";
|
|
5
|
-
import { SabColumnProps } from "
|
|
5
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
6
6
|
declare const SabCellEditDatePicker: import("vue").DefineComponent<DatePickerProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<DatePickerProps>, {
|
|
7
7
|
readonly popperOptions: any;
|
|
8
8
|
}, {}>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格编辑-输入框
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellEditInput: import("vue").DefineComponent<{
|
|
6
6
|
modelValue?: string | undefined;
|
|
7
7
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 单元格编辑-数值输入框
|
|
3
3
|
*/
|
|
4
|
-
import { SabColumnProps } from "
|
|
4
|
+
import type { SabColumnProps } from "../../../../types/table";
|
|
5
5
|
declare const SabCellEditInputNumber: import("vue").DefineComponent<{
|
|
6
6
|
modelValue?: number | undefined;
|
|
7
7
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
@@ -8,6 +8,7 @@ type SabCellEditPopoverProps = PopoverProps & {
|
|
|
8
8
|
};
|
|
9
9
|
declare const SabCellEditPopover: import("vue").DefineComponent<Partial<SabCellEditPopoverProps>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<Partial<SabCellEditPopoverProps>>, {
|
|
10
10
|
readonly popperOptions?: any;
|
|
11
|
+
column?: any;
|
|
11
12
|
readonly placement?: any;
|
|
12
13
|
}, {}>;
|
|
13
14
|
export default SabCellEditPopover;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SabColumnProps } from "
|
|
1
|
+
import type { SabColumnProps } from "../../../types/table";
|
|
2
2
|
declare const CellRender: import("vue").DefineComponent<SabColumnProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<SabColumnProps>, {
|
|
3
3
|
params?: any;
|
|
4
4
|
}, {}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolbarProps } from "
|
|
1
|
+
import type { ToolbarProps } from "../../../../types/table";
|
|
2
2
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<ToolbarProps<import("vxe-table").VxeTableDataRow>>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<ToolbarProps<import("vxe-table").VxeTableDataRow>>>>, {}, {}>, {
|
|
3
3
|
default?(_: {}): any;
|
|
4
4
|
}>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { SabColumnProps } from "
|
|
1
|
+
import type { SabColumnProps } from "../../../types/table";
|
|
2
2
|
export declare const defaultColumnConfig: (column: SabColumnProps) => SabColumnProps;
|
|
3
3
|
export declare const setDefaultColumnConfigs: (columns: SabColumnProps[]) => SabColumnProps[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VxeTableInstance } from "vxe-table";
|
|
2
|
-
import { SabTableProps } from "
|
|
2
|
+
import type { SabTableProps } from "../../types/table";
|
|
3
3
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SabTableProps>, Partial<SabTableProps>>, {
|
|
4
4
|
$?: import("vue").ComponentInternalInstance | undefined;
|
|
5
5
|
$data?: {} | undefined;
|
|
@@ -503,11 +503,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
503
503
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SabTableProps>, Partial<SabTableProps>>>>, {
|
|
504
504
|
data: import("vxe-table").VxeTablePropTypes.Data<import("vxe-table").VxeTableDataRow>;
|
|
505
505
|
class: any;
|
|
506
|
+
columns: Partial<import("../../types/table").SabColumnProps<import("vxe-table").VxeTableDataRow>>[];
|
|
506
507
|
id: string;
|
|
507
508
|
size: import("vxe-table").SizeType;
|
|
508
509
|
cellClassName: import("vxe-table").VxeTablePropTypes.CellClassName<import("vxe-table").VxeTableDataRow>;
|
|
509
510
|
editable: boolean;
|
|
510
|
-
columns: Partial<import("./types").SabColumnProps<import("vxe-table").VxeTableDataRow>>[];
|
|
511
511
|
loading: boolean;
|
|
512
512
|
round: boolean;
|
|
513
513
|
height: import("vxe-table").VxeTablePropTypes.Height;
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("vxe-table"),t=require("vue"),f=require("element-plus");var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function F(e,l){for(var r=-1,n=l.length,o=e.length;++r<n;)e[o+r]=l[r];return e}var M=F,z=typeof C=="object"&&C&&C.Object===Object&&C,D=z,q=D,H=typeof self=="object"&&self&&self.Object===Object&&self,K=q||H||Function("return this")(),U=K,Y=U,L=Y.Symbol,k=L,_=k,$=Object.prototype,G=$.hasOwnProperty,X=$.toString,y=_?_.toStringTag:void 0;function J(e){var l=G.call(e,y),r=e[y];try{e[y]=void 0;var n=!0}catch{}var o=X.call(e);return n&&(l?e[y]=r:delete e[y]),o}var Q=J,W=Object.prototype,Z=W.toString;function ee(e){return Z.call(e)}var te=ee,V=k,le=Q,re=te,oe="[object Null]",ne="[object Undefined]",O=V?V.toStringTag:void 0;function ae(e){return e==null?e===void 0?ne:oe:O&&O in Object(e)?le(e):re(e)}var ce=ae;function ie(e){return e!=null&&typeof e=="object"}var R=ie,se=ce,ue=R,de="[object Arguments]";function fe(e){return ue(e)&&se(e)==de}var be=fe,j=be,ge=R,P=Object.prototype,me=P.hasOwnProperty,pe=P.propertyIsEnumerable,ye=j(function(){return arguments}())?j:function(e){return ge(e)&&me.call(e,"callee")&&!pe.call(e,"callee")},he=ye,Ce=Array.isArray,ve=Ce,B=k,Se=he,we=ve,T=B?B.isConcatSpreadable:void 0;function ke(e){return we(e)||Se(e)||!!(T&&e&&e[T])}var _e=ke,Ve=M,Oe=_e;function I(e,l,r,n,o){var a=-1,s=e.length;for(r||(r=Oe),o||(o=[]);++a<s;){var c=e[a];l>0&&r(c)?l>1?I(c,l-1,r,n,o):Ve(o,c):n||(o[o.length]=c)}return o}var je=I,Be=je;function Te(e){var l=e==null?0:e.length;return l?Be(e,1):[]}var Ee=Te;const xe=N(Ee),Ne=e=>{const l=e.tableRef;return{clearCheckboxRow:()=>{var o;(o=l.value)==null||o.clearCheckboxRow()},getCheckboxRecords:()=>{var o;return(o=l.value)==null?void 0:o.getCheckboxRecords()}}},$e=t.defineComponent({name:"SabTableToolbar",__name:"index",props:{class:{},tableRef:{},features:{},columns:{},saveSelectRecords:{type:Function}},setup(e){const l=e,r=t.computed(()=>l.tableRef),{clearCheckboxRow:n,getCheckboxRecords:o}=Ne({tableRef:r}),a=t.ref(!1),s=async()=>{var c;a.value=!0;try{const d=o();await((c=l.saveSelectRecords)==null?void 0:c.call(l,d)),d.forEach(i=>{var b;return(b=r.value)==null?void 0:b.reloadRow(i,{})}),n()}finally{a.value=!1}};return(c,d)=>(t.openBlock(),t.createElementBlock("div",t.mergeProps({class:["sab-table-toolbar",l.class]},c.$attrs),[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.features,i=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[i==="clearSelect"?(t.openBlock(),t.createBlock(t.unref(f.ElButton),{key:0,onClick:t.unref(n)},{default:t.withCtx(()=>[t.createTextVNode("清空选择")]),_:1},8,["onClick"])):i==="saveSelect"?(t.openBlock(),t.createBlock(t.unref(f.ElButton),{key:1,onClick:s,loading:a.value},{default:t.withCtx(()=>[t.createTextVNode("保存")]),_:1},8,["loading"])):t.createCommentVNode("",!0)],64))),256)),t.renderSlot(c.$slots,"default")],16))}}),Re=t.defineComponent({setup(e,{attrs:l,slots:r}){const{slots:n,editorProps:o,...a}=l,s=t.computed(()=>{const c={};return Object.keys(n||{}).forEach(d=>{c[d]=i=>typeof n[d]=="string"?r[n[d]](i):typeof n[d]=="function"?n[d](i,o):null}),c});return()=>t.createVNode(w.Column,a,{...s.value})}});var Pe=function(l){return Ie(l)&&!Ae(l)};function Ie(e){return!!e&&typeof e=="object"}function Ae(e){var l=Object.prototype.toString.call(e);return l==="[object RegExp]"||l==="[object Date]"||ze(e)}var Fe=typeof Symbol=="function"&&Symbol.for,Me=Fe?Symbol.for("react.element"):60103;function ze(e){return e.$$typeof===Me}function De(e){return Array.isArray(e)?[]:{}}function h(e,l){return l.clone!==!1&&l.isMergeableObject(e)?m(De(e),e,l):e}function qe(e,l,r){return e.concat(l).map(function(n){return h(n,r)})}function He(e,l){if(!l.customMerge)return m;var r=l.customMerge(e);return typeof r=="function"?r:m}function Ke(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(l){return Object.propertyIsEnumerable.call(e,l)}):[]}function E(e){return Object.keys(e).concat(Ke(e))}function A(e,l){try{return l in e}catch{return!1}}function Ue(e,l){return A(e,l)&&!(Object.hasOwnProperty.call(e,l)&&Object.propertyIsEnumerable.call(e,l))}function Ye(e,l,r){var n={};return r.isMergeableObject(e)&&E(e).forEach(function(o){n[o]=h(e[o],r)}),E(l).forEach(function(o){Ue(e,o)||(A(e,o)&&r.isMergeableObject(l[o])?n[o]=He(o,r)(e[o],l[o],r):n[o]=h(l[o],r))}),n}function m(e,l,r){r=r||{},r.arrayMerge=r.arrayMerge||qe,r.isMergeableObject=r.isMergeableObject||Pe,r.cloneUnlessOtherwiseSpecified=h;var n=Array.isArray(l),o=Array.isArray(e),a=n===o;return a?n?r.arrayMerge(e,l,r):Ye(e,l,r):h(l,r)}m.all=function(l,r){if(!Array.isArray(l))throw new Error("first argument should be an array");return l.reduce(function(n,o){return m(n,o,r)},{})};var Le=m,Ge=Le;const g=N(Ge),Xe={border:!0,showHeader:!0,size:"mini",showOverflow:!0,height:"auto",withSeq:!0,mouseConfig:{selected:!0},autoClearSelected:!0,keepSource:!1,checkboxConfig:{range:!0,highlight:!0},editable:!0,editConfig:{trigger:"click",mode:"cell",autoClear:!1,showStatus:!0,showIcon:!1},rowConfig:{useKey:!0,isCurrent:!0,isHover:!0},keyboardConfig:{isArrow:!0,isEsc:!0,isTab:!0,isEnter:!0,isEdit:!0},columnConfig:{resizable:!0},sortConfig:{trigger:"cell",orders:["desc","asc",null]},scrollY:{enabled:!0,gt:100}},Je=(e,l={})=>{var n,o,a,s;const r=g(e,l);return r.editable===!1?delete r.editConfig:r.editable===!0&&(r.editConfig=g({},r.editConfig||{})),r.withCheckbox===!0&&!((n=r.columns)!=null&&n.some(c=>c.field==="sab-table-checkbox"))&&((o=r.columns)==null||o.unshift({type:"checkbox",fixed:"left",field:"sab-table-checkbox"})),r.withSeq===!0&&!((a=r.columns)!=null&&a.some(c=>c.field==="sab-table-seq"))&&((s=r.columns)==null||s.unshift({type:"checkbox",fixed:"left",field:"sab-table-seq",slots:{header:()=>null,checkbox:({rowIndex:c})=>c+1}})),r},Qe=(e,l,r)=>{const n={"cell-click":({row:a,column:s})=>{var c,d,i;l.value.autoClearSelected&&((c=r.value)!=null&&c.isCheckedByCheckboxRow(a)||(d=r.value)==null||d.clearCheckboxRow()),s.type==="checkbox"&&s.field==="sab-table-seq"&&((i=r.value)==null||i.toggleCheckboxRow(a))}},o={};return["keydown-start","keydown","keydown-end","current-change","radio-change","checkbox-change","checkbox-all","checkbox-range-start","checkbox-range-change","checkbox-range-end","cell-click","cell-dblclick","cell-menu","cell-mouseenter","cell-mouseleave","header-cell-click","header-cell-dblclick","header-cell-menu","footer-cell-click","footer-cell-dblclick","footer-cell-menu","clear-merge","sort-change","clear-sort","filter-change","filter-visible","clear-filter","resizable-change","toggle-row-expand","toggle-tree-expand","menu-click","cell-selected","edit-closed","edit-actived","edit-disabled","valid-error","scroll","custom"].map(a=>{o[a]=(...s)=>{e("event",...s),typeof n[a]=="function"&&n[a](...s)}}),o};var u=(e=>(e.Input="input",e.InputNumber="input-number",e.Select="select",e.DatePciker="date-picker",e.Image="image",e.Color="color",e.Boolean="boolean",e))(u||{});const We=t.defineComponent({name:"SabCellEditInput",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=o=>{r("update:modelValue",o)};return()=>t.createVNode(f.ElInput,t.mergeProps({size:"small",modelValue:e.modelValue,onInput:n},l),null)}}),Ze={sabCellType:u.Input,editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l})=>t.createVNode(We,{modelValue:e[l.field],"onUpdate:modelValue":r=>e[l.field]=r},null)}},et=t.defineComponent({name:"SabCellEditInput",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=(o,a)=>{r("update:modelValue",o,a)};return()=>t.createVNode(f.ElInputNumber,t.mergeProps({size:"small",modelValue:e.modelValue,controlsPosition:"right",onChange:n},l),null)}}),tt={cellType:"number",editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l})=>t.createVNode(et,{modelValue:e[l.field],"onUpdate:modelValue":r=>e[l.field]=r},null)}},lt=t.defineComponent({name:"SabCellEditInput",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=o=>{r("update:modelValue",o)};return()=>t.createVNode(f.ElDatePicker,t.mergeProps({size:"small",format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD",modelValue:e.modelValue,"onUpdate:modelValue":n},l),null)}}),rt={sabCellType:u.DatePciker,editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l},r)=>t.createVNode(lt,t.mergeProps({modelValue:e[l.field],"onUpdate:modelValue":n=>e[l.field]=n},r),null)}},ot=t.defineComponent({props:{options:Array,modelValue:{type:String||Number||Array,default:""},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},disabledKey:{type:String,default:"disabled"}},name:"SabCellEditSelect",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=o=>{r("update:modelValue",o)};return()=>t.createVNode(f.ElSelect,t.mergeProps({size:"small",filterable:!0,modelValue:e.modelValue,onChange:n},l),{default:()=>{var o;return[(o=e.options)==null?void 0:o.map(a=>t.createVNode(f.ElOption,{key:a[e.valueKey],value:a[e.valueKey],label:a[e.labelKey],disabled:a[e.disabledKey]},null))]}})}}),nt={sabCellType:u.Input,editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l},r)=>t.createVNode(ot,t.mergeProps({automaticDropdown:!0,modelValue:e[l.field],"onUpdate:modelValue":n=>e[l.field]=n},r),null)}};/*! Element Plus Icons Vue v2.3.1 */var at=t.defineComponent({name:"Picture",__name:"picture",setup(e){return(l,r)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M160 160v704h704V160zm-32-64h768a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H128a32 32 0 0 1-32-32V128a32 32 0 0 1 32-32"}),t.createElementVNode("path",{fill:"currentColor",d:"M384 288q64 0 64 64t-64 64q-64 0-64-64t64-64M185.408 876.992l-50.816-38.912L350.72 556.032a96 96 0 0 1 134.592-17.856l1.856 1.472 122.88 99.136a32 32 0 0 0 44.992-4.864l216-269.888 49.92 39.936-215.808 269.824-.256.32a96 96 0 0 1-135.04 14.464l-122.88-99.072-.64-.512a32 32 0 0 0-44.8 5.952z"})]))}}),x=at;const ct=t.defineComponent({name:"SabCellImage",props:{src:String,preview:Boolean},setup(e,{attrs:l}){return e.src?e.preview?()=>t.createVNode(f.ElImage,t.mergeProps({lazy:!0,fit:"contain",src:e.src,style:{verticalAlign:"middle",height:"40px",width:"40px"},"preview-src-list":[e.src]},l),null):()=>t.createVNode(f.ElPopover,{transition:"el-zoom-in-top",trigger:"click",persistent:!1},{reference:()=>t.createVNode(f.ElIcon,{size:17,style:{cursor:"pointer",verticalAlign:"middle"}},{default:()=>[t.createVNode(x,null,null)]}),default:()=>t.createVNode(f.ElImage,t.mergeProps({lazy:!0,src:e.src,style:{verticalAlign:"middle"},"preview-src-list":[e.src]},l),null)}):()=>t.createVNode(f.ElIcon,{size:17,style:{cursor:"not-allowed",verticalAlign:"middle",opacity:"0.5"}},{default:()=>[t.createVNode(x,null,null)]})}}),it={sabCellType:u.Image,showOverflow:!1,align:"center",slots:{default:({row:e,column:l})=>t.createVNode(ct,{src:e[l.field]},null)}},st=t.defineComponent({props:{color:String},name:"SabCellColor",setup(e){const l=t.computed(()=>{var r,n;return((r=e.color)==null?void 0:r.length)===6?`#${e.color}`:((n=e.color)==null?void 0:n.length)===9?`rgb(${e.color.substring(0,3)},${e.color.substring(3,6)},${e.color.substring(6,9)})`:e.color});return()=>t.createVNode("div",{class:"sab-cell-color__inner",style:{background:l.value}},null)}}),ut={sabCellType:u.Color,className:"sab-cell-color",slots:{default:({row:e,column:l})=>t.createVNode(st,{color:e[l.field]},null)}},dt=t.defineComponent({props:{modelValue:String||Number||Boolean},name:"SabCellBoolean",emits:["update:modelValue"],setup(e,{emit:l}){const r=n=>{l("update:modelValue",n)};return()=>t.createVNode(f.ElCheckbox,{style:{lineHieght:1},modelValue:e.modelValue,onChange:r},null)}}),ft={sabCellType:u.Color,className:"sab-cell-boolean",align:"center",showOverflow:!1,slots:{default:({row:e,column:l})=>t.createVNode(dt,{modelValue:e[l.field],"onUpdate:modelValue":r=>e[l.field]=r},null)}},bt=e=>(e.editable===!1&&delete e.editRender,e.sabCellType===u.Input?g(Ze,e):e.sabCellType===u.InputNumber?g(tt,e):e.sabCellType===u.DatePciker?g(rt,e):e.sabCellType===u.Select?g(nt,e):e.sabCellType===u.Image?g(it,e):e.sabCellType===u.Color?g(ut,e):e.sabCellType===u.Boolean?g(ft,e):e),gt=e=>e.map(l=>bt(l)).filter(l=>!l.hidden),v=t.defineComponent({name:"SabTable",__name:"index",props:t.mergeDefaults({size:{},id:{},data:{},height:{},minHeight:{},maxHeight:{},stripe:{type:Boolean},round:{type:Boolean},border:{type:[Boolean,String]},loading:{type:Boolean},align:{},headerAlign:{},footerAlign:{},showHeader:{type:Boolean},showFooter:{type:Boolean},footerMethod:{type:Function},rowClassName:{type:[String,Function]},cellClassName:{type:[String,Function]},headerRowClassName:{type:[String,Function]},headerCellClassName:{type:[String,Function]},footerRowClassName:{type:[String,Function]},footerCellClassName:{type:[String,Function]},cellStyle:{type:[Object,Function]},rowStyle:{type:[Object,Function]},headerCellStyle:{type:[Object,Function]},headerRowStyle:{type:[Object,Function]},footerRowStyle:{type:[Object,Function]},footerCellStyle:{type:[Object,Function]},mergeCells:{},mergeFooterItems:{},spanMethod:{type:Function},footerSpanMethod:{type:Function},showOverflow:{type:[Boolean,String,null]},showHeaderOverflow:{type:[Boolean,String,null]},showFooterOverflow:{type:[Boolean,String,null]},keepSource:{type:Boolean},autoResize:{type:Boolean},syncResize:{type:[Boolean,String,Number]},columnConfig:{},rowConfig:{},customConfig:{},resizeConfig:{},resizableConfig:{},seqConfig:{},sortConfig:{},filterConfig:{},radioConfig:{},checkboxConfig:{},tooltipConfig:{},exportConfig:{},importConfig:{},printConfig:{},expandConfig:{},treeConfig:{},menuConfig:{},mouseConfig:{},areaConfig:{},fnrConfig:{},keyboardConfig:{},clipConfig:{},editConfig:{},validConfig:{},editRules:{},emptyText:{},emptyRender:{},loadingConfig:{},scrollX:{},scrollY:{},params:{},resizable:{type:Boolean},highlightCurrentRow:{type:Boolean},highlightHoverRow:{type:Boolean},highlightCurrentColumn:{type:Boolean},highlightHoverColumn:{type:Boolean},highlightCell:{type:Boolean},columnKey:{type:Boolean},rowKey:{type:Boolean},rowId:{},fit:{type:Boolean},animat:{type:Boolean},delayHover:{},class:{},columns:{},editable:{type:Boolean},withSeq:{type:Boolean},withCheckbox:{type:Boolean},showToolbar:{type:Boolean},autoClearSelected:{type:Boolean}},Xe),setup(e,{expose:l,emit:r}){const n=e,o=r,a=t.ref(),s=t.computed(()=>{const i=Je({keyboardConfig:{editMethod({row:b,column:p}){return a.value.setEditCell(b,p),!0}}},n);return i.columns=gt(i.columns||[]),i}),c=t.computed(()=>{var i;return xe((i=s.value.columns)==null?void 0:i.map(b=>b.slots?Object.values(b.slots).filter(p=>typeof p=="string"):[]))});l({xTable:a.value,...a.value});const d=Qe(o,s,a);return(i,b)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[i.showToolbar?(t.openBlock(),t.createBlock($e,{key:0,style:{"margin-bottom":"10px"},"table-ref":a.value},{default:t.withCtx(()=>[t.renderSlot(i.$slots,"sab-toolbar")]),_:3},8,["table-ref"])):t.createCommentVNode("",!0),t.createVNode(t.unref(w.Table),t.mergeProps({ref_key:"xTable",ref:a},s.value,t.toHandlers(t.unref(d)),{class:["sab-table",s.value.class]}),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value.columns,p=>(t.openBlock(),t.createBlock(t.unref(Re),t.normalizeProps(t.guardReactiveProps(p)),t.createSlots({_:2},[t.renderList(c.value,S=>({name:S,fn:t.withCtx(()=>[t.renderSlot(i.$slots,S)])}))]),1040))),256))]),_:3},16,["class"])],64))}});v.install=e=>{e.component(v.name,v),e.use(w)};exports.SabCellType=u;exports.SabTable=v;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("vxe-table"),t=require("vue"),f=require("element-plus");var C=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function F(e,l){for(var r=-1,n=l.length,o=e.length;++r<n;)e[o+r]=l[r];return e}var M=F,z=typeof C=="object"&&C&&C.Object===Object&&C,D=z,q=D,H=typeof self=="object"&&self&&self.Object===Object&&self,K=q||H||Function("return this")(),U=K,Y=U,L=Y.Symbol,k=L,_=k,$=Object.prototype,G=$.hasOwnProperty,X=$.toString,y=_?_.toStringTag:void 0;function J(e){var l=G.call(e,y),r=e[y];try{e[y]=void 0;var n=!0}catch{}var o=X.call(e);return n&&(l?e[y]=r:delete e[y]),o}var Q=J,W=Object.prototype,Z=W.toString;function ee(e){return Z.call(e)}var te=ee,V=k,le=Q,re=te,oe="[object Null]",ne="[object Undefined]",O=V?V.toStringTag:void 0;function ae(e){return e==null?e===void 0?ne:oe:O&&O in Object(e)?le(e):re(e)}var ce=ae;function ie(e){return e!=null&&typeof e=="object"}var R=ie,se=ce,ue=R,de="[object Arguments]";function fe(e){return ue(e)&&se(e)==de}var be=fe,j=be,ge=R,P=Object.prototype,me=P.hasOwnProperty,pe=P.propertyIsEnumerable,ye=j(function(){return arguments}())?j:function(e){return ge(e)&&me.call(e,"callee")&&!pe.call(e,"callee")},he=ye,Ce=Array.isArray,ve=Ce,B=k,Se=he,we=ve,T=B?B.isConcatSpreadable:void 0;function ke(e){return we(e)||Se(e)||!!(T&&e&&e[T])}var _e=ke,Ve=M,Oe=_e;function I(e,l,r,n,o){var a=-1,s=e.length;for(r||(r=Oe),o||(o=[]);++a<s;){var c=e[a];l>0&&r(c)?l>1?I(c,l-1,r,n,o):Ve(o,c):n||(o[o.length]=c)}return o}var je=I,Be=je;function Te(e){var l=e==null?0:e.length;return l?Be(e,1):[]}var Ee=Te;const xe=N(Ee),Ne=e=>{const l=e.tableRef;return{clearCheckboxRow:()=>{var o;(o=l.value)==null||o.clearCheckboxRow()},getCheckboxRecords:()=>{var o;return(o=l.value)==null?void 0:o.getCheckboxRecords()}}},$e=t.defineComponent({name:"SabTableToolbar",__name:"index",props:{class:{},tableRef:{},features:{},columns:{},saveSelectRecords:{type:Function}},setup(e){const l=e,r=t.computed(()=>l.tableRef),{clearCheckboxRow:n,getCheckboxRecords:o}=Ne({tableRef:r}),a=t.ref(!1),s=async()=>{var c;a.value=!0;try{const d=o();await((c=l.saveSelectRecords)==null?void 0:c.call(l,d)),d.forEach(i=>{var b;return(b=r.value)==null?void 0:b.reloadRow(i,{})}),n()}finally{a.value=!1}};return(c,d)=>(t.openBlock(),t.createElementBlock("div",t.mergeProps({class:["sab-table-toolbar",l.class]},c.$attrs),[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.features,i=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[i==="clearSelect"?(t.openBlock(),t.createBlock(t.unref(f.ElButton),{key:0,onClick:t.unref(n)},{default:t.withCtx(()=>[t.createTextVNode("清空选择")]),_:1},8,["onClick"])):i==="saveSelect"?(t.openBlock(),t.createBlock(t.unref(f.ElButton),{key:1,onClick:s,loading:a.value},{default:t.withCtx(()=>[t.createTextVNode("保存")]),_:1},8,["loading"])):t.createCommentVNode("",!0)],64))),256)),t.renderSlot(c.$slots,"default")],16))}}),Re=t.defineComponent({setup(e,{attrs:l,slots:r}){const{slots:n,editorProps:o,...a}=l,s=t.computed(()=>{const c={};return Object.keys(n||{}).forEach(d=>{c[d]=i=>typeof n[d]=="string"?r[n[d]](i):typeof n[d]=="function"?n[d](i,o):null}),c});return()=>t.createVNode(w.Column,a,{...s.value})}});var Pe=function(l){return Ie(l)&&!Ae(l)};function Ie(e){return!!e&&typeof e=="object"}function Ae(e){var l=Object.prototype.toString.call(e);return l==="[object RegExp]"||l==="[object Date]"||ze(e)}var Fe=typeof Symbol=="function"&&Symbol.for,Me=Fe?Symbol.for("react.element"):60103;function ze(e){return e.$$typeof===Me}function De(e){return Array.isArray(e)?[]:{}}function h(e,l){return l.clone!==!1&&l.isMergeableObject(e)?m(De(e),e,l):e}function qe(e,l,r){return e.concat(l).map(function(n){return h(n,r)})}function He(e,l){if(!l.customMerge)return m;var r=l.customMerge(e);return typeof r=="function"?r:m}function Ke(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(l){return Object.propertyIsEnumerable.call(e,l)}):[]}function E(e){return Object.keys(e).concat(Ke(e))}function A(e,l){try{return l in e}catch{return!1}}function Ue(e,l){return A(e,l)&&!(Object.hasOwnProperty.call(e,l)&&Object.propertyIsEnumerable.call(e,l))}function Ye(e,l,r){var n={};return r.isMergeableObject(e)&&E(e).forEach(function(o){n[o]=h(e[o],r)}),E(l).forEach(function(o){Ue(e,o)||(A(e,o)&&r.isMergeableObject(l[o])?n[o]=He(o,r)(e[o],l[o],r):n[o]=h(l[o],r))}),n}function m(e,l,r){r=r||{},r.arrayMerge=r.arrayMerge||qe,r.isMergeableObject=r.isMergeableObject||Pe,r.cloneUnlessOtherwiseSpecified=h;var n=Array.isArray(l),o=Array.isArray(e),a=n===o;return a?n?r.arrayMerge(e,l,r):Ye(e,l,r):h(l,r)}m.all=function(l,r){if(!Array.isArray(l))throw new Error("first argument should be an array");return l.reduce(function(n,o){return m(n,o,r)},{})};var Le=m,Ge=Le;const g=N(Ge),Xe={border:!0,showHeader:!0,size:"mini",showOverflow:!0,height:"auto",withSeq:!0,mouseConfig:{selected:!0},autoClearSelected:!0,keepSource:!1,checkboxConfig:{range:!0,highlight:!0},editable:!0,editConfig:{trigger:"click",mode:"cell",autoClear:!1,showStatus:!0,showIcon:!1},rowConfig:{useKey:!0,isCurrent:!0,isHover:!0},keyboardConfig:{isArrow:!0,isEsc:!0,isTab:!0,isEnter:!0,isEdit:!0},columnConfig:{resizable:!0},sortConfig:{trigger:"cell",orders:["desc","asc",null]},scrollY:{enabled:!0,gt:100}},Je=(e,l={})=>{var n,o,a,s;const r=g(e,l);return r.editable===!1?delete r.editConfig:r.editable===!0&&(r.editConfig=g({},r.editConfig||{})),r.withCheckbox===!0&&!((n=r.columns)!=null&&n.some(c=>c.field==="sab-table-checkbox"))&&((o=r.columns)==null||o.unshift({type:"checkbox",fixed:"left",field:"sab-table-checkbox"})),r.withSeq===!0&&!((a=r.columns)!=null&&a.some(c=>c.field==="sab-table-seq"))&&((s=r.columns)==null||s.unshift({type:"checkbox",fixed:"left",field:"sab-table-seq",slots:{header:()=>null,checkbox:({rowIndex:c})=>c+1}})),r},Qe=(e,l,r)=>{const n={"cell-click":({row:a,column:s})=>{var c,d,i;l.value.autoClearSelected&&((c=r.value)!=null&&c.isCheckedByCheckboxRow(a)||(d=r.value)==null||d.clearCheckboxRow()),s.type==="checkbox"&&s.field==="sab-table-seq"&&((i=r.value)==null||i.toggleCheckboxRow(a))}},o={};return["keydown-start","keydown","keydown-end","current-change","radio-change","checkbox-change","checkbox-all","checkbox-range-start","checkbox-range-change","checkbox-range-end","cell-click","cell-dblclick","cell-menu","cell-mouseenter","cell-mouseleave","header-cell-click","header-cell-dblclick","header-cell-menu","footer-cell-click","footer-cell-dblclick","footer-cell-menu","clear-merge","sort-change","clear-sort","filter-change","filter-visible","clear-filter","resizable-change","toggle-row-expand","toggle-tree-expand","menu-click","cell-selected","edit-closed","edit-actived","edit-disabled","valid-error","scroll","custom"].map(a=>{o[a]=(...s)=>{e("event",...s),typeof n[a]=="function"&&n[a](...s)}}),o};var u=(e=>(e.Input="input",e.InputNumber="input-number",e.Select="select",e.DatePciker="date-picker",e.Image="image",e.Color="color",e.Boolean="boolean",e))(u||{});const We=t.defineComponent({name:"SabCellEditInput",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=o=>{r("update:modelValue",o)};return()=>t.createVNode(f.ElInput,t.mergeProps({size:"small",modelValue:e.modelValue,onInput:n},l),null)}}),Ze={sabCellType:u.Input,editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l})=>t.createVNode(We,{modelValue:e[l.field],"onUpdate:modelValue":r=>e[l.field]=r},null)}},et=t.defineComponent({name:"SabCellEditInput",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=(o,a)=>{r("update:modelValue",o,a)};return()=>t.createVNode(f.ElInputNumber,t.mergeProps({size:"small",modelValue:e.modelValue,controlsPosition:"right",onChange:n},l),null)}}),tt={cellType:"number",sabCellType:u.InputNumber,editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l})=>t.createVNode(et,{modelValue:e[l.field],"onUpdate:modelValue":r=>e[l.field]=r},null)}},lt=t.defineComponent({name:"SabCellEditInput",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=o=>{r("update:modelValue",o)};return()=>t.createVNode(f.ElDatePicker,t.mergeProps({size:"small",format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD",modelValue:e.modelValue,"onUpdate:modelValue":n},l),null)}}),rt={sabCellType:u.DatePciker,editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l},r)=>t.createVNode(lt,t.mergeProps({modelValue:e[l.field],"onUpdate:modelValue":n=>e[l.field]=n},r),null)}},ot=t.defineComponent({props:{options:Array,modelValue:{type:String||Number||Array,default:""},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},disabledKey:{type:String,default:"disabled"}},name:"SabCellEditSelect",emits:["update:modelValue"],setup(e,{attrs:l,emit:r}){const n=o=>{r("update:modelValue",o)};return()=>t.createVNode(f.ElSelect,t.mergeProps({size:"small",filterable:!0,modelValue:e.modelValue,onChange:n},l),{default:()=>{var o;return[(o=e.options)==null?void 0:o.map(a=>t.createVNode(f.ElOption,{key:a[e.valueKey],value:a[e.valueKey],label:a[e.labelKey],disabled:a[e.disabledKey]},null))]}})}}),nt={sabCellType:u.Input,editRender:{autofocus:".el-input__inner"},slots:{edit:({row:e,column:l},r)=>t.createVNode(ot,t.mergeProps({automaticDropdown:!0,modelValue:e[l.field],"onUpdate:modelValue":n=>e[l.field]=n},r),null)}};/*! Element Plus Icons Vue v2.3.1 */var at=t.defineComponent({name:"Picture",__name:"picture",setup(e){return(l,r)=>(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[t.createElementVNode("path",{fill:"currentColor",d:"M160 160v704h704V160zm-32-64h768a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H128a32 32 0 0 1-32-32V128a32 32 0 0 1 32-32"}),t.createElementVNode("path",{fill:"currentColor",d:"M384 288q64 0 64 64t-64 64q-64 0-64-64t64-64M185.408 876.992l-50.816-38.912L350.72 556.032a96 96 0 0 1 134.592-17.856l1.856 1.472 122.88 99.136a32 32 0 0 0 44.992-4.864l216-269.888 49.92 39.936-215.808 269.824-.256.32a96 96 0 0 1-135.04 14.464l-122.88-99.072-.64-.512a32 32 0 0 0-44.8 5.952z"})]))}}),x=at;const ct=t.defineComponent({name:"SabCellImage",props:{src:String,preview:Boolean},setup(e,{attrs:l}){return e.src?e.preview?()=>t.createVNode(f.ElImage,t.mergeProps({lazy:!0,fit:"contain",src:e.src,style:{verticalAlign:"middle",height:"40px",width:"40px"},"preview-src-list":[e.src]},l),null):()=>t.createVNode(f.ElPopover,{transition:"el-zoom-in-top",trigger:"click",persistent:!1},{reference:()=>t.createVNode(f.ElIcon,{size:17,style:{cursor:"pointer",verticalAlign:"middle"}},{default:()=>[t.createVNode(x,null,null)]}),default:()=>t.createVNode(f.ElImage,t.mergeProps({lazy:!0,src:e.src,style:{verticalAlign:"middle"},"preview-src-list":[e.src]},l),null)}):()=>t.createVNode(f.ElIcon,{size:17,style:{cursor:"not-allowed",verticalAlign:"middle",opacity:"0.5"}},{default:()=>[t.createVNode(x,null,null)]})}}),it={sabCellType:u.Image,showOverflow:!1,align:"center",slots:{default:({row:e,column:l})=>t.createVNode(ct,{src:e[l.field]},null)}},st=t.defineComponent({props:{color:String},name:"SabCellColor",setup(e){const l=t.computed(()=>{var r,n;return((r=e.color)==null?void 0:r.length)===6?`#${e.color}`:((n=e.color)==null?void 0:n.length)===9?`rgb(${e.color.substring(0,3)},${e.color.substring(3,6)},${e.color.substring(6,9)})`:e.color});return()=>t.createVNode("div",{class:"sab-cell-color__inner",style:{background:l.value}},null)}}),ut={sabCellType:u.Color,className:"sab-cell-color",slots:{default:({row:e,column:l})=>t.createVNode(st,{color:e[l.field]},null)}},dt=t.defineComponent({props:{modelValue:String||Number||Boolean},name:"SabCellBoolean",emits:["update:modelValue"],setup(e,{emit:l}){const r=n=>{l("update:modelValue",n)};return()=>t.createVNode(f.ElCheckbox,{style:{lineHieght:1},modelValue:e.modelValue,onChange:r},null)}}),ft={sabCellType:u.Color,className:"sab-cell-boolean",align:"center",showOverflow:!1,slots:{default:({row:e,column:l})=>t.createVNode(dt,{modelValue:e[l.field],"onUpdate:modelValue":r=>e[l.field]=r},null)}},bt=e=>(e.editable===!1&&delete e.editRender,e.sabCellType===u.Input?g(Ze,e):e.sabCellType===u.InputNumber?g(tt,e):e.sabCellType===u.DatePciker?g(rt,e):e.sabCellType===u.Select?g(nt,e):e.sabCellType===u.Image?g(it,e):e.sabCellType===u.Color?g(ut,e):e.sabCellType===u.Boolean?g(ft,e):e),gt=e=>e.map(l=>bt(l)).filter(l=>!l.hidden),v=t.defineComponent({name:"SabTable",__name:"index",props:t.mergeDefaults({size:{},id:{},data:{},height:{},minHeight:{},maxHeight:{},stripe:{type:Boolean},round:{type:Boolean},border:{type:[Boolean,String]},loading:{type:Boolean},align:{},headerAlign:{},footerAlign:{},showHeader:{type:Boolean},showFooter:{type:Boolean},footerMethod:{type:Function},rowClassName:{type:[String,Function]},cellClassName:{type:[String,Function]},headerRowClassName:{type:[String,Function]},headerCellClassName:{type:[String,Function]},footerRowClassName:{type:[String,Function]},footerCellClassName:{type:[String,Function]},cellStyle:{type:[Object,Function]},rowStyle:{type:[Object,Function]},headerCellStyle:{type:[Object,Function]},headerRowStyle:{type:[Object,Function]},footerRowStyle:{type:[Object,Function]},footerCellStyle:{type:[Object,Function]},mergeCells:{},mergeFooterItems:{},spanMethod:{type:Function},footerSpanMethod:{type:Function},showOverflow:{type:[Boolean,String,null]},showHeaderOverflow:{type:[Boolean,String,null]},showFooterOverflow:{type:[Boolean,String,null]},keepSource:{type:Boolean},autoResize:{type:Boolean},syncResize:{type:[Boolean,String,Number]},columnConfig:{},rowConfig:{},customConfig:{},resizeConfig:{},resizableConfig:{},seqConfig:{},sortConfig:{},filterConfig:{},radioConfig:{},checkboxConfig:{},tooltipConfig:{},exportConfig:{},importConfig:{},printConfig:{},expandConfig:{},treeConfig:{},menuConfig:{},mouseConfig:{},areaConfig:{},fnrConfig:{},keyboardConfig:{},clipConfig:{},editConfig:{},validConfig:{},editRules:{},emptyText:{},emptyRender:{},loadingConfig:{},scrollX:{},scrollY:{},params:{},resizable:{type:Boolean},highlightCurrentRow:{type:Boolean},highlightHoverRow:{type:Boolean},highlightCurrentColumn:{type:Boolean},highlightHoverColumn:{type:Boolean},highlightCell:{type:Boolean},columnKey:{type:Boolean},rowKey:{type:Boolean},rowId:{},fit:{type:Boolean},animat:{type:Boolean},delayHover:{},class:{},columns:{},editable:{type:Boolean},withSeq:{type:Boolean},withCheckbox:{type:Boolean},showToolbar:{type:Boolean},autoClearSelected:{type:Boolean}},Xe),setup(e,{expose:l,emit:r}){const n=e,o=r,a=t.ref(),s=t.computed(()=>{const i=Je({keyboardConfig:{editMethod({row:b,column:p}){return a.value.setEditCell(b,p),!0}}},n);return i.columns=gt(i.columns||[]),i}),c=t.computed(()=>{var i;return xe((i=s.value.columns)==null?void 0:i.map(b=>b.slots?Object.values(b.slots).filter(p=>typeof p=="string"):[]))});l({xTable:a.value,...a.value});const d=Qe(o,s,a);return(i,b)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[i.showToolbar?(t.openBlock(),t.createBlock($e,{key:0,style:{"margin-bottom":"10px"},"table-ref":a.value},{default:t.withCtx(()=>[t.renderSlot(i.$slots,"sab-toolbar")]),_:3},8,["table-ref"])):t.createCommentVNode("",!0),t.createVNode(t.unref(w.Table),t.mergeProps({ref_key:"xTable",ref:a},s.value,t.toHandlers(t.unref(d)),{class:["sab-table",s.value.class]}),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value.columns,p=>(t.openBlock(),t.createBlock(t.unref(Re),t.normalizeProps(t.guardReactiveProps(p)),t.createSlots({_:2},[t.renderList(c.value,S=>({name:S,fn:t.withCtx(()=>[t.renderSlot(i.$slots,S)])}))]),1040))),256))]),_:3},16,["class"])],64))}});v.install=e=>{e.component(v.name,v),e.use(w)};exports.SabCellType=u;exports.SabTable=v;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wx-design/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"es",
|
|
10
10
|
"lib",
|
|
11
|
-
"
|
|
11
|
+
"types"
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build:lib": "vite build",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"keywords": [],
|
|
20
20
|
"author": "",
|
|
21
|
-
"typings": "index.d.ts",
|
|
21
|
+
"typings": "types/index.d.ts",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/lodash": "^4.14.196",
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { VxeTableDataRow, VxeColumnProps, VxeColumnSlotTypes } from "vxe-table";
|
|
2
|
+
import type {
|
|
3
|
+
InputProps,
|
|
4
|
+
InputNumberProps,
|
|
5
|
+
DatePickerProps,
|
|
6
|
+
} from "element-plus";
|
|
7
|
+
|
|
8
|
+
export interface SabColumnSlots<D = VxeTableDataRow> {
|
|
9
|
+
/**
|
|
10
|
+
* 自定义显示内容模板
|
|
11
|
+
*/
|
|
12
|
+
default: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
13
|
+
/**
|
|
14
|
+
* 自定义表头内容的模板
|
|
15
|
+
*/
|
|
16
|
+
header: ((params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any) | string;
|
|
17
|
+
/**
|
|
18
|
+
* 自定义表尾内容的模板
|
|
19
|
+
*/
|
|
20
|
+
footer: ((params: VxeColumnSlotTypes.FooterSlotParams<D>) => any) | string;
|
|
21
|
+
/**
|
|
22
|
+
* 只对 type=checkbox,radio 有效,自定义标题模板
|
|
23
|
+
*/
|
|
24
|
+
title: ((params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any) | string;
|
|
25
|
+
/**
|
|
26
|
+
* 只对 type=checkbox 有效,自定义复选框模板
|
|
27
|
+
*/
|
|
28
|
+
checkbox: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
29
|
+
/**
|
|
30
|
+
* 只对 type=radio 有效,自定义单选框模板
|
|
31
|
+
*/
|
|
32
|
+
radio: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
33
|
+
/**
|
|
34
|
+
* 只对 type=expand 有效,自定义展开后的内容模板
|
|
35
|
+
*/
|
|
36
|
+
content: ((params: VxeColumnSlotTypes.ContentSlotParams<D>) => any) | string;
|
|
37
|
+
/**
|
|
38
|
+
* 只对 filter-render 启用时有效,自定义筛选模板
|
|
39
|
+
*/
|
|
40
|
+
filter: ((params: VxeColumnSlotTypes.FilterSlotParams<D>) => any) | string;
|
|
41
|
+
/**
|
|
42
|
+
* 只对 edit-render 启用时有效,自定义可编辑组件模板
|
|
43
|
+
*/
|
|
44
|
+
edit:
|
|
45
|
+
| ((
|
|
46
|
+
params: VxeColumnSlotTypes.EditSlotParams<D>,
|
|
47
|
+
editorProps: SabCellEditorParams
|
|
48
|
+
) => any)
|
|
49
|
+
| string;
|
|
50
|
+
/**
|
|
51
|
+
* 已废弃
|
|
52
|
+
* @deprecated
|
|
53
|
+
*/
|
|
54
|
+
icon: (params: VxeColumnSlotTypes.IconSlotParams<D>) => any;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 单选框属性
|
|
58
|
+
export type SabCellSelectProps = {
|
|
59
|
+
// 禁用状态
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
// 只读模式
|
|
62
|
+
readonly?: boolean;
|
|
63
|
+
// 是否多选
|
|
64
|
+
multiple?: boolean;
|
|
65
|
+
// 选项列表
|
|
66
|
+
options: any[];
|
|
67
|
+
// 用于展示的字段名,默认 label
|
|
68
|
+
labelKey?: string;
|
|
69
|
+
// 用于取值的字段名,默认 value
|
|
70
|
+
valueKey?: string;
|
|
71
|
+
// 用于禁用状态的字段名,默认 disabled
|
|
72
|
+
disabledKey?: string;
|
|
73
|
+
};
|
|
74
|
+
// 单元格编辑器参数
|
|
75
|
+
export type SabCellEditorParams =
|
|
76
|
+
| Partial<InputProps>
|
|
77
|
+
| Partial<InputNumberProps>
|
|
78
|
+
| Partial<DatePickerProps>
|
|
79
|
+
| Partial<SabCellSelectProps>
|
|
80
|
+
|
|
81
|
+
// 表格列设置
|
|
82
|
+
export type SabColumnProps<D = VxeTableDataRow> = VxeColumnProps<D> & {
|
|
83
|
+
// 单元格类型
|
|
84
|
+
sabCellType?: 'input' | 'input-number' | 'select' | 'date-picker' | 'image' | 'color' | 'boolean';
|
|
85
|
+
// 附加的单元格编辑器参数
|
|
86
|
+
editorProps?: Partial<SabCellEditorParams>;
|
|
87
|
+
// 单元格是否可编辑
|
|
88
|
+
editable?: boolean;
|
|
89
|
+
// 自定义插槽
|
|
90
|
+
slots?: Partial<SabColumnSlots<D>>;
|
|
91
|
+
// 是否隐藏列
|
|
92
|
+
hidden?: boolean;
|
|
93
|
+
// 筛选控制
|
|
94
|
+
sabFilter?: {
|
|
95
|
+
// 是否自动收集筛选条件
|
|
96
|
+
autoCollectFilterOptions?: boolean;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { VXEComponent, VxeTableEventProps } from 'vxe-table'
|
|
3
|
+
import { SabTableProps } from './table'
|
|
4
|
+
import { SabColumnSlots } from './column'
|
|
5
|
+
|
|
6
|
+
export const SabTable: VXEComponent<SabTableProps<any>, VxeTableEventProps<any>, SabColumnSlots<any>>
|
|
7
|
+
|
|
8
|
+
export * from './column'
|
|
9
|
+
export * from './table'
|
|
10
|
+
export * from './toolbar'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VxeTableProps, VxeTableDataRow } from "vxe-table";
|
|
2
|
+
import { SabColumnProps } from "./";
|
|
3
|
+
|
|
4
|
+
export type SabTableProps<D = VxeTableDataRow> = VxeTableProps<D> & {
|
|
5
|
+
// 表格 css 类名
|
|
6
|
+
class?: any;
|
|
7
|
+
// 列配置
|
|
8
|
+
columns?: Partial<SabColumnProps<D>>[];
|
|
9
|
+
// 表格可编辑
|
|
10
|
+
editable?: boolean;
|
|
11
|
+
// 默认带上序号列
|
|
12
|
+
withSeq?: boolean;
|
|
13
|
+
// 带上选项框
|
|
14
|
+
withCheckbox?: boolean;
|
|
15
|
+
// 展示工具栏
|
|
16
|
+
showToolbar?: boolean;
|
|
17
|
+
// 点击未选中行的单元格自动取消选择选中行
|
|
18
|
+
autoClearSelected?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VxeTableInstance, VxeTableDataRow } from "vxe-table";
|
|
2
|
+
|
|
3
|
+
import { SabColumnProps } from "./";
|
|
4
|
+
|
|
5
|
+
// 支持的能力
|
|
6
|
+
// clearSelect - 清空选择行
|
|
7
|
+
// saveSelect - 保存选择行
|
|
8
|
+
type ToolbarFeatures = 'clearSelect' | 'saveSelect'
|
|
9
|
+
|
|
10
|
+
export interface ToolbarProps<D = VxeTableDataRow> {
|
|
11
|
+
// css 类名
|
|
12
|
+
class?: any;
|
|
13
|
+
// vxe-table 实例
|
|
14
|
+
tableRef?: VxeTableInstance;
|
|
15
|
+
// 功能列表
|
|
16
|
+
features?: ToolbarFeatures[];
|
|
17
|
+
// 列配置项
|
|
18
|
+
columns?: SabColumnProps[];
|
|
19
|
+
|
|
20
|
+
// 保存选择行回调
|
|
21
|
+
saveSelectRecords?: (rows: D[]) => void;
|
|
22
|
+
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { VxeTableDataRow, VxeColumnProps, VxeColumnSlotTypes } from "vxe-table";
|
|
2
|
-
import type { InputNumberProps, DatePickerProps } from "element-plus";
|
|
3
|
-
export interface SabColumnSlots<D = VxeTableDataRow> {
|
|
4
|
-
/**
|
|
5
|
-
* 自定义显示内容模板
|
|
6
|
-
*/
|
|
7
|
-
default: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
8
|
-
/**
|
|
9
|
-
* 自定义表头内容的模板
|
|
10
|
-
*/
|
|
11
|
-
header: ((params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any) | string;
|
|
12
|
-
/**
|
|
13
|
-
* 自定义表尾内容的模板
|
|
14
|
-
*/
|
|
15
|
-
footer: ((params: VxeColumnSlotTypes.FooterSlotParams<D>) => any) | string;
|
|
16
|
-
/**
|
|
17
|
-
* 只对 type=checkbox,radio 有效,自定义标题模板
|
|
18
|
-
*/
|
|
19
|
-
title: ((params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any) | string;
|
|
20
|
-
/**
|
|
21
|
-
* 只对 type=checkbox 有效,自定义复选框模板
|
|
22
|
-
*/
|
|
23
|
-
checkbox: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
24
|
-
/**
|
|
25
|
-
* 只对 type=radio 有效,自定义单选框模板
|
|
26
|
-
*/
|
|
27
|
-
radio: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
28
|
-
/**
|
|
29
|
-
* 只对 type=expand 有效,自定义展开后的内容模板
|
|
30
|
-
*/
|
|
31
|
-
content: ((params: VxeColumnSlotTypes.ContentSlotParams<D>) => any) | string;
|
|
32
|
-
/**
|
|
33
|
-
* 只对 filter-render 启用时有效,自定义筛选模板
|
|
34
|
-
*/
|
|
35
|
-
filter: ((params: VxeColumnSlotTypes.FilterSlotParams<D>) => any) | string;
|
|
36
|
-
/**
|
|
37
|
-
* 只对 edit-render 启用时有效,自定义可编辑组件模板
|
|
38
|
-
*/
|
|
39
|
-
edit: ((params: VxeColumnSlotTypes.EditSlotParams<D>, editorProps: SabCellEditorParams) => any) | string;
|
|
40
|
-
/**
|
|
41
|
-
* 已废弃
|
|
42
|
-
* @deprecated
|
|
43
|
-
*/
|
|
44
|
-
icon: (params: VxeColumnSlotTypes.IconSlotParams<D>) => any;
|
|
45
|
-
}
|
|
46
|
-
export declare enum SabCellType {
|
|
47
|
-
Input = "input",
|
|
48
|
-
InputNumber = "input-number",
|
|
49
|
-
Select = "select",
|
|
50
|
-
DatePciker = "date-picker",
|
|
51
|
-
Image = "image",
|
|
52
|
-
Color = "color",
|
|
53
|
-
Boolean = "boolean"
|
|
54
|
-
}
|
|
55
|
-
export type SabCellSelectProps = {
|
|
56
|
-
disabled?: boolean;
|
|
57
|
-
readonly?: boolean;
|
|
58
|
-
multiple?: boolean;
|
|
59
|
-
options: any[];
|
|
60
|
-
labelKey?: string;
|
|
61
|
-
valueKey?: string;
|
|
62
|
-
disabledKey?: string;
|
|
63
|
-
};
|
|
64
|
-
export type SabCellEditorParams = Partial<InputNumberProps> | Partial<DatePickerProps> | Partial<SabCellSelectProps>;
|
|
65
|
-
export type SabColumnProps<D = VxeTableDataRow> = VxeColumnProps<D> & {
|
|
66
|
-
sabCellType?: SabCellType;
|
|
67
|
-
editorProps?: Partial<SabCellEditorParams>;
|
|
68
|
-
editable?: boolean;
|
|
69
|
-
slots?: Partial<SabColumnSlots<D>>;
|
|
70
|
-
hidden?: boolean;
|
|
71
|
-
sabFilter?: {
|
|
72
|
-
autoCollectFilterOptions?: boolean;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VxeTableProps, VxeTableDataRow } from "vxe-table";
|
|
2
|
-
import { SabColumnProps } from "./";
|
|
3
|
-
export type SabTableProps<D = VxeTableDataRow> = VxeTableProps<D> & {
|
|
4
|
-
class?: any;
|
|
5
|
-
columns?: Partial<SabColumnProps<D>>[];
|
|
6
|
-
editable?: boolean;
|
|
7
|
-
withSeq?: boolean;
|
|
8
|
-
withCheckbox?: boolean;
|
|
9
|
-
showToolbar?: boolean;
|
|
10
|
-
autoClearSelected?: boolean;
|
|
11
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VxeTableInstance, VxeTableDataRow } from "vxe-table";
|
|
2
|
-
import { SabColumnProps } from "./";
|
|
3
|
-
type ToolbarFeatures = 'clearSelect' | 'saveSelect';
|
|
4
|
-
export interface ToolbarProps<D = VxeTableDataRow> {
|
|
5
|
-
class?: any;
|
|
6
|
-
tableRef?: VxeTableInstance;
|
|
7
|
-
features?: ToolbarFeatures[];
|
|
8
|
-
columns?: SabColumnProps[];
|
|
9
|
-
saveSelectRecords?: (rows: D[]) => void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
package/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './core/Table/types/index.d'
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { VxeTableDataRow, VxeColumnProps, VxeColumnSlotTypes } from "vxe-table";
|
|
2
|
-
import type { InputNumberProps, DatePickerProps } from "element-plus";
|
|
3
|
-
export interface SabColumnSlots<D = VxeTableDataRow> {
|
|
4
|
-
/**
|
|
5
|
-
* 自定义显示内容模板
|
|
6
|
-
*/
|
|
7
|
-
default: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
8
|
-
/**
|
|
9
|
-
* 自定义表头内容的模板
|
|
10
|
-
*/
|
|
11
|
-
header: ((params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any) | string;
|
|
12
|
-
/**
|
|
13
|
-
* 自定义表尾内容的模板
|
|
14
|
-
*/
|
|
15
|
-
footer: ((params: VxeColumnSlotTypes.FooterSlotParams<D>) => any) | string;
|
|
16
|
-
/**
|
|
17
|
-
* 只对 type=checkbox,radio 有效,自定义标题模板
|
|
18
|
-
*/
|
|
19
|
-
title: ((params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any) | string;
|
|
20
|
-
/**
|
|
21
|
-
* 只对 type=checkbox 有效,自定义复选框模板
|
|
22
|
-
*/
|
|
23
|
-
checkbox: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
24
|
-
/**
|
|
25
|
-
* 只对 type=radio 有效,自定义单选框模板
|
|
26
|
-
*/
|
|
27
|
-
radio: ((params: VxeColumnSlotTypes.DefaultSlotParams<D>) => any) | string;
|
|
28
|
-
/**
|
|
29
|
-
* 只对 type=expand 有效,自定义展开后的内容模板
|
|
30
|
-
*/
|
|
31
|
-
content: ((params: VxeColumnSlotTypes.ContentSlotParams<D>) => any) | string;
|
|
32
|
-
/**
|
|
33
|
-
* 只对 filter-render 启用时有效,自定义筛选模板
|
|
34
|
-
*/
|
|
35
|
-
filter: ((params: VxeColumnSlotTypes.FilterSlotParams<D>) => any) | string;
|
|
36
|
-
/**
|
|
37
|
-
* 只对 edit-render 启用时有效,自定义可编辑组件模板
|
|
38
|
-
*/
|
|
39
|
-
edit: ((params: VxeColumnSlotTypes.EditSlotParams<D>, editorProps: SabCellEditorParams) => any) | string;
|
|
40
|
-
/**
|
|
41
|
-
* 已废弃
|
|
42
|
-
* @deprecated
|
|
43
|
-
*/
|
|
44
|
-
icon: (params: VxeColumnSlotTypes.IconSlotParams<D>) => any;
|
|
45
|
-
}
|
|
46
|
-
export declare enum SabCellType {
|
|
47
|
-
Input = "input",
|
|
48
|
-
InputNumber = "input-number",
|
|
49
|
-
Select = "select",
|
|
50
|
-
DatePciker = "date-picker",
|
|
51
|
-
Image = "image",
|
|
52
|
-
Color = "color",
|
|
53
|
-
Boolean = "boolean"
|
|
54
|
-
}
|
|
55
|
-
export type SabCellSelectProps = {
|
|
56
|
-
disabled?: boolean;
|
|
57
|
-
readonly?: boolean;
|
|
58
|
-
multiple?: boolean;
|
|
59
|
-
options: any[];
|
|
60
|
-
labelKey?: string;
|
|
61
|
-
valueKey?: string;
|
|
62
|
-
disabledKey?: string;
|
|
63
|
-
};
|
|
64
|
-
export type SabCellEditorParams = Partial<InputNumberProps> | Partial<DatePickerProps> | Partial<SabCellSelectProps>;
|
|
65
|
-
export type SabColumnProps<D = VxeTableDataRow> = VxeColumnProps<D> & {
|
|
66
|
-
sabCellType?: SabCellType;
|
|
67
|
-
editorProps?: Partial<SabCellEditorParams>;
|
|
68
|
-
editable?: boolean;
|
|
69
|
-
slots?: Partial<SabColumnSlots<D>>;
|
|
70
|
-
hidden?: boolean;
|
|
71
|
-
sabFilter?: {
|
|
72
|
-
autoCollectFilterOptions?: boolean;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VxeTableProps, VxeTableDataRow } from "vxe-table";
|
|
2
|
-
import { SabColumnProps } from "./";
|
|
3
|
-
export type SabTableProps<D = VxeTableDataRow> = VxeTableProps<D> & {
|
|
4
|
-
class?: any;
|
|
5
|
-
columns?: Partial<SabColumnProps<D>>[];
|
|
6
|
-
editable?: boolean;
|
|
7
|
-
withSeq?: boolean;
|
|
8
|
-
withCheckbox?: boolean;
|
|
9
|
-
showToolbar?: boolean;
|
|
10
|
-
autoClearSelected?: boolean;
|
|
11
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { VxeTableInstance, VxeTableDataRow } from "vxe-table";
|
|
2
|
-
import { SabColumnProps } from "./";
|
|
3
|
-
type ToolbarFeatures = 'clearSelect' | 'saveSelect';
|
|
4
|
-
export interface ToolbarProps<D = VxeTableDataRow> {
|
|
5
|
-
class?: any;
|
|
6
|
-
tableRef?: VxeTableInstance;
|
|
7
|
-
features?: ToolbarFeatures[];
|
|
8
|
-
columns?: SabColumnProps[];
|
|
9
|
-
saveSelectRecords?: (rows: D[]) => void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|