@tmagic/table 1.8.0-beta.2 → 1.8.0-beta.20
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/dist/es/ActionButton.js +5 -0
- package/dist/es/ActionButton.vue_vue_type_script_lang.js +51 -0
- package/dist/es/ActionPopconfirm.js +5 -0
- package/dist/es/ActionPopconfirm.vue_vue_type_script_setup_true_lang.js +50 -0
- package/dist/es/ActionsColumn.vue_vue_type_script_setup_true_lang.js +105 -45
- package/dist/es/ComponentColumn.vue_vue_type_script_setup_true_lang.js +4 -12
- package/dist/es/ExpandColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/PopoverColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/Table.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/TextColumn.vue_vue_type_script_setup_true_lang.js +3 -5
- package/dist/es/actionHelpers.js +17 -0
- package/dist/es/componentHelpers.js +11 -0
- package/dist/es/formHelpers.js +9 -0
- package/dist/es/style.css +16 -0
- package/dist/style.css +16 -0
- package/dist/tmagic-table.umd.cjs +328 -76
- package/package.json +8 -6
- package/src/ActionButton.vue +73 -0
- package/src/ActionPopconfirm.vue +44 -0
- package/src/ActionsColumn.vue +105 -46
- package/src/ComponentColumn.vue +4 -17
- package/src/TextColumn.vue +2 -8
- package/src/actionHelpers.ts +26 -0
- package/src/componentHelpers.ts +15 -0
- package/src/formHelpers.ts +12 -0
- package/src/schema.ts +49 -2
- package/src/theme/index.scss +19 -0
- package/types/index.d.ts +38 -5
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("@tmagic/design"), require("@tmagic/form"), require("@tmagic/utils")) : typeof define === "function" && define.amd ? define([
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("@tmagic/design"), require("@element-plus/icons-vue"), require("@tmagic/form"), require("@tmagic/utils")) : typeof define === "function" && define.amd ? define([
|
|
3
3
|
"exports",
|
|
4
4
|
"vue",
|
|
5
5
|
"@tmagic/design",
|
|
6
|
+
"@element-plus/icons-vue",
|
|
6
7
|
"@tmagic/form",
|
|
7
8
|
"@tmagic/utils"
|
|
8
|
-
], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.TMagicTable = {}, global.Vue, global._tmagic_design, global._tmagic_form, global._tmagic_utils));
|
|
9
|
-
})(this, function(exports, vue, _tmagic_design, _tmagic_form, _tmagic_utils) {
|
|
9
|
+
], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.TMagicTable = {}, global.Vue, global._tmagic_design, global._element_plus_icons_vue, global._tmagic_form, global._tmagic_utils));
|
|
10
|
+
})(this, function(exports, vue, _tmagic_design, _element_plus_icons_vue, _tmagic_form, _tmagic_utils) {
|
|
10
11
|
Object.defineProperties(exports, {
|
|
11
12
|
__esModule: { value: true },
|
|
12
13
|
[Symbol.toStringTag]: { value: "Module" }
|
|
@@ -23,7 +24,7 @@
|
|
|
23
24
|
//#endregion
|
|
24
25
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js
|
|
25
26
|
/** Built-in value references. */
|
|
26
|
-
var Symbol = root.Symbol;
|
|
27
|
+
var Symbol$1 = root.Symbol;
|
|
27
28
|
//#endregion
|
|
28
29
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js
|
|
29
30
|
/** Used for built-in method references. */
|
|
@@ -37,7 +38,7 @@
|
|
|
37
38
|
*/
|
|
38
39
|
var nativeObjectToString$1 = objectProto$3.toString;
|
|
39
40
|
/** Built-in value references. */
|
|
40
|
-
var symToStringTag$1 = Symbol ? Symbol.toStringTag : void 0;
|
|
41
|
+
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
41
42
|
/**
|
|
42
43
|
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
43
44
|
*
|
|
@@ -77,9 +78,10 @@
|
|
|
77
78
|
//#endregion
|
|
78
79
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js
|
|
79
80
|
/** `Object#toString` result references. */
|
|
80
|
-
var nullTag = "[object Null]"
|
|
81
|
+
var nullTag = "[object Null]";
|
|
82
|
+
var undefinedTag = "[object Undefined]";
|
|
81
83
|
/** Built-in value references. */
|
|
82
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
|
|
84
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
|
|
83
85
|
/**
|
|
84
86
|
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
85
87
|
*
|
|
@@ -180,7 +182,10 @@
|
|
|
180
182
|
//#endregion
|
|
181
183
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js
|
|
182
184
|
/** `Object#toString` result references. */
|
|
183
|
-
var asyncTag = "[object AsyncFunction]"
|
|
185
|
+
var asyncTag = "[object AsyncFunction]";
|
|
186
|
+
var funcTag$2 = "[object Function]";
|
|
187
|
+
var genTag$1 = "[object GeneratorFunction]";
|
|
188
|
+
var proxyTag = "[object Proxy]";
|
|
184
189
|
/**
|
|
185
190
|
* Checks if `value` is classified as a `Function` object.
|
|
186
191
|
*
|
|
@@ -256,7 +261,8 @@
|
|
|
256
261
|
/** Used to detect host constructors (Safari). */
|
|
257
262
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
258
263
|
/** Used for built-in method references. */
|
|
259
|
-
var funcProto = Function.prototype
|
|
264
|
+
var funcProto = Function.prototype;
|
|
265
|
+
var objectProto$2 = Object.prototype;
|
|
260
266
|
/** Used to resolve the decompiled source of functions. */
|
|
261
267
|
var funcToString = funcProto.toString;
|
|
262
268
|
/** Used to check objects for own properties. */
|
|
@@ -674,8 +680,30 @@
|
|
|
674
680
|
//#endregion
|
|
675
681
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsTypedArray.js
|
|
676
682
|
/** `Object#toString` result references. */
|
|
677
|
-
var argsTag$1 = "[object Arguments]"
|
|
678
|
-
var
|
|
683
|
+
var argsTag$1 = "[object Arguments]";
|
|
684
|
+
var arrayTag$1 = "[object Array]";
|
|
685
|
+
var boolTag$2 = "[object Boolean]";
|
|
686
|
+
var dateTag$2 = "[object Date]";
|
|
687
|
+
var errorTag$1 = "[object Error]";
|
|
688
|
+
var funcTag$1 = "[object Function]";
|
|
689
|
+
var mapTag$4 = "[object Map]";
|
|
690
|
+
var numberTag$2 = "[object Number]";
|
|
691
|
+
var objectTag$2 = "[object Object]";
|
|
692
|
+
var regexpTag$2 = "[object RegExp]";
|
|
693
|
+
var setTag$4 = "[object Set]";
|
|
694
|
+
var stringTag$2 = "[object String]";
|
|
695
|
+
var weakMapTag$2 = "[object WeakMap]";
|
|
696
|
+
var arrayBufferTag$2 = "[object ArrayBuffer]";
|
|
697
|
+
var dataViewTag$3 = "[object DataView]";
|
|
698
|
+
var float32Tag$2 = "[object Float32Array]";
|
|
699
|
+
var float64Tag$2 = "[object Float64Array]";
|
|
700
|
+
var int8Tag$2 = "[object Int8Array]";
|
|
701
|
+
var int16Tag$2 = "[object Int16Array]";
|
|
702
|
+
var int32Tag$2 = "[object Int32Array]";
|
|
703
|
+
var uint8Tag$2 = "[object Uint8Array]";
|
|
704
|
+
var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
|
|
705
|
+
var uint16Tag$2 = "[object Uint16Array]";
|
|
706
|
+
var uint32Tag$2 = "[object Uint32Array]";
|
|
679
707
|
/** Used to identify `toStringTag` values of typed arrays. */
|
|
680
708
|
var typedArrayTags = {};
|
|
681
709
|
typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
|
|
@@ -1411,7 +1439,8 @@
|
|
|
1411
1439
|
/** Detect free variable `module`. */
|
|
1412
1440
|
var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
|
|
1413
1441
|
/** Built-in value references. */
|
|
1414
|
-
var Buffer = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0
|
|
1442
|
+
var Buffer = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0;
|
|
1443
|
+
var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
|
|
1415
1444
|
/**
|
|
1416
1445
|
* Creates a clone of `buffer`.
|
|
1417
1446
|
*
|
|
@@ -1584,10 +1613,18 @@
|
|
|
1584
1613
|
//#endregion
|
|
1585
1614
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getTag.js
|
|
1586
1615
|
/** `Object#toString` result references. */
|
|
1587
|
-
var mapTag$3 = "[object Map]"
|
|
1616
|
+
var mapTag$3 = "[object Map]";
|
|
1617
|
+
var objectTag$1 = "[object Object]";
|
|
1618
|
+
var promiseTag = "[object Promise]";
|
|
1619
|
+
var setTag$3 = "[object Set]";
|
|
1620
|
+
var weakMapTag$1 = "[object WeakMap]";
|
|
1588
1621
|
var dataViewTag$2 = "[object DataView]";
|
|
1589
1622
|
/** Used to detect maps, sets, and weakmaps. */
|
|
1590
|
-
var dataViewCtorString = toSource(DataView)
|
|
1623
|
+
var dataViewCtorString = toSource(DataView);
|
|
1624
|
+
var mapCtorString = toSource(Map);
|
|
1625
|
+
var promiseCtorString = toSource(Promise$1);
|
|
1626
|
+
var setCtorString = toSource(Set);
|
|
1627
|
+
var weakMapCtorString = toSource(WeakMap);
|
|
1591
1628
|
/**
|
|
1592
1629
|
* Gets the `toStringTag` of `value`.
|
|
1593
1630
|
*
|
|
@@ -1678,7 +1715,8 @@
|
|
|
1678
1715
|
//#endregion
|
|
1679
1716
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cloneSymbol.js
|
|
1680
1717
|
/** Used to convert symbols to primitives and strings. */
|
|
1681
|
-
var symbolProto = Symbol ? Symbol.prototype : void 0
|
|
1718
|
+
var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
|
|
1719
|
+
var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
1682
1720
|
/**
|
|
1683
1721
|
* Creates a clone of the `symbol` object.
|
|
1684
1722
|
*
|
|
@@ -1706,8 +1744,25 @@
|
|
|
1706
1744
|
//#endregion
|
|
1707
1745
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_initCloneByTag.js
|
|
1708
1746
|
/** `Object#toString` result references. */
|
|
1709
|
-
var boolTag$1 = "[object Boolean]"
|
|
1710
|
-
var
|
|
1747
|
+
var boolTag$1 = "[object Boolean]";
|
|
1748
|
+
var dateTag$1 = "[object Date]";
|
|
1749
|
+
var mapTag$2 = "[object Map]";
|
|
1750
|
+
var numberTag$1 = "[object Number]";
|
|
1751
|
+
var regexpTag$1 = "[object RegExp]";
|
|
1752
|
+
var setTag$2 = "[object Set]";
|
|
1753
|
+
var stringTag$1 = "[object String]";
|
|
1754
|
+
var symbolTag$1 = "[object Symbol]";
|
|
1755
|
+
var arrayBufferTag$1 = "[object ArrayBuffer]";
|
|
1756
|
+
var dataViewTag$1 = "[object DataView]";
|
|
1757
|
+
var float32Tag$1 = "[object Float32Array]";
|
|
1758
|
+
var float64Tag$1 = "[object Float64Array]";
|
|
1759
|
+
var int8Tag$1 = "[object Int8Array]";
|
|
1760
|
+
var int16Tag$1 = "[object Int16Array]";
|
|
1761
|
+
var int32Tag$1 = "[object Int32Array]";
|
|
1762
|
+
var uint8Tag$1 = "[object Uint8Array]";
|
|
1763
|
+
var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
|
|
1764
|
+
var uint16Tag$1 = "[object Uint16Array]";
|
|
1765
|
+
var uint32Tag$1 = "[object Uint32Array]";
|
|
1711
1766
|
/**
|
|
1712
1767
|
* Initializes an object clone based on its `toStringTag`.
|
|
1713
1768
|
*
|
|
@@ -1829,10 +1884,36 @@
|
|
|
1829
1884
|
//#endregion
|
|
1830
1885
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseClone.js
|
|
1831
1886
|
/** Used to compose bitmasks for cloning. */
|
|
1832
|
-
var CLONE_DEEP_FLAG$1 = 1
|
|
1887
|
+
var CLONE_DEEP_FLAG$1 = 1;
|
|
1888
|
+
var CLONE_FLAT_FLAG = 2;
|
|
1889
|
+
var CLONE_SYMBOLS_FLAG$1 = 4;
|
|
1833
1890
|
/** `Object#toString` result references. */
|
|
1834
|
-
var argsTag = "[object Arguments]"
|
|
1835
|
-
var
|
|
1891
|
+
var argsTag = "[object Arguments]";
|
|
1892
|
+
var arrayTag = "[object Array]";
|
|
1893
|
+
var boolTag = "[object Boolean]";
|
|
1894
|
+
var dateTag = "[object Date]";
|
|
1895
|
+
var errorTag = "[object Error]";
|
|
1896
|
+
var funcTag = "[object Function]";
|
|
1897
|
+
var genTag = "[object GeneratorFunction]";
|
|
1898
|
+
var mapTag = "[object Map]";
|
|
1899
|
+
var numberTag = "[object Number]";
|
|
1900
|
+
var objectTag = "[object Object]";
|
|
1901
|
+
var regexpTag = "[object RegExp]";
|
|
1902
|
+
var setTag = "[object Set]";
|
|
1903
|
+
var stringTag = "[object String]";
|
|
1904
|
+
var symbolTag = "[object Symbol]";
|
|
1905
|
+
var weakMapTag = "[object WeakMap]";
|
|
1906
|
+
var arrayBufferTag = "[object ArrayBuffer]";
|
|
1907
|
+
var dataViewTag = "[object DataView]";
|
|
1908
|
+
var float32Tag = "[object Float32Array]";
|
|
1909
|
+
var float64Tag = "[object Float64Array]";
|
|
1910
|
+
var int8Tag = "[object Int8Array]";
|
|
1911
|
+
var int16Tag = "[object Int16Array]";
|
|
1912
|
+
var int32Tag = "[object Int32Array]";
|
|
1913
|
+
var uint8Tag = "[object Uint8Array]";
|
|
1914
|
+
var uint8ClampedTag = "[object Uint8ClampedArray]";
|
|
1915
|
+
var uint16Tag = "[object Uint16Array]";
|
|
1916
|
+
var uint32Tag = "[object Uint32Array]";
|
|
1836
1917
|
/** Used to identify `toStringTag` values supported by `_.clone`. */
|
|
1837
1918
|
var cloneableTags = {};
|
|
1838
1919
|
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
|
|
@@ -1896,7 +1977,8 @@
|
|
|
1896
1977
|
//#endregion
|
|
1897
1978
|
//#region node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/cloneDeep.js
|
|
1898
1979
|
/** Used to compose bitmasks for cloning. */
|
|
1899
|
-
var CLONE_DEEP_FLAG = 1
|
|
1980
|
+
var CLONE_DEEP_FLAG = 1;
|
|
1981
|
+
var CLONE_SYMBOLS_FLAG = 4;
|
|
1900
1982
|
/**
|
|
1901
1983
|
* This method is like `_.clone` except that it recursively clones `value`.
|
|
1902
1984
|
*
|
|
@@ -1919,8 +2001,117 @@
|
|
|
1919
2001
|
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
|
|
1920
2002
|
}
|
|
1921
2003
|
//#endregion
|
|
2004
|
+
//#region packages/table/src/actionHelpers.ts
|
|
2005
|
+
var display = (fuc, row) => {
|
|
2006
|
+
if (typeof fuc === "function") return fuc(row);
|
|
2007
|
+
if (typeof fuc === "boolean") return fuc;
|
|
2008
|
+
return true;
|
|
2009
|
+
};
|
|
2010
|
+
var disabled = (fuc, row) => {
|
|
2011
|
+
if (typeof fuc === "function") return fuc(row);
|
|
2012
|
+
if (typeof fuc === "boolean") return fuc;
|
|
2013
|
+
return false;
|
|
2014
|
+
};
|
|
2015
|
+
var formatActionText = (fuc, row) => {
|
|
2016
|
+
if (typeof fuc === "function") return fuc(row);
|
|
2017
|
+
return fuc;
|
|
2018
|
+
};
|
|
2019
|
+
//#endregion
|
|
2020
|
+
//#region packages/table/src/ActionButton.vue
|
|
2021
|
+
var ActionButton_default = (0, vue.defineComponent)({
|
|
2022
|
+
name: "MTableActionButton",
|
|
2023
|
+
props: {
|
|
2024
|
+
action: {
|
|
2025
|
+
type: Object,
|
|
2026
|
+
required: true
|
|
2027
|
+
},
|
|
2028
|
+
row: {
|
|
2029
|
+
type: null,
|
|
2030
|
+
required: true
|
|
2031
|
+
},
|
|
2032
|
+
index: {
|
|
2033
|
+
type: Number,
|
|
2034
|
+
required: true
|
|
2035
|
+
},
|
|
2036
|
+
btnClass: {
|
|
2037
|
+
type: String,
|
|
2038
|
+
default: "action-btn"
|
|
2039
|
+
},
|
|
2040
|
+
visible: {
|
|
2041
|
+
type: Boolean,
|
|
2042
|
+
default: true
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
2045
|
+
emits: ["click"],
|
|
2046
|
+
setup(props, { emit }) {
|
|
2047
|
+
const onClick = () => emit("click", props.action, props.row, props.index);
|
|
2048
|
+
return () => {
|
|
2049
|
+
const button = (0, vue.withDirectives)((0, vue.h)(_tmagic_design.TMagicButton, {
|
|
2050
|
+
class: props.btnClass,
|
|
2051
|
+
link: true,
|
|
2052
|
+
size: "small",
|
|
2053
|
+
type: props.action.buttonType || "primary",
|
|
2054
|
+
icon: props.action.icon,
|
|
2055
|
+
disabled: disabled(props.action.disabled, props.row),
|
|
2056
|
+
onClick
|
|
2057
|
+
}, () => (0, vue.h)("span", { innerHTML: formatActionText(props.action.text, props.row) })), [[vue.vShow, props.visible]]);
|
|
2058
|
+
if (!props.action.tooltip) return button;
|
|
2059
|
+
return (0, vue.h)(_tmagic_design.TMagicTooltip, {
|
|
2060
|
+
placement: props.action.tooltipPlacement || "top",
|
|
2061
|
+
content: props.action.tooltip
|
|
2062
|
+
}, () => button);
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
});
|
|
2066
|
+
//#endregion
|
|
2067
|
+
//#region packages/table/src/ActionPopconfirm.vue
|
|
2068
|
+
var ActionPopconfirm_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2069
|
+
name: "MTableActionPopconfirm",
|
|
2070
|
+
__name: "ActionPopconfirm",
|
|
2071
|
+
props: {
|
|
2072
|
+
action: {},
|
|
2073
|
+
row: {},
|
|
2074
|
+
index: {},
|
|
2075
|
+
btnClass: { default: "action-btn" },
|
|
2076
|
+
visible: {
|
|
2077
|
+
type: Boolean,
|
|
2078
|
+
default: true
|
|
2079
|
+
}
|
|
2080
|
+
},
|
|
2081
|
+
emits: ["confirm"],
|
|
2082
|
+
setup(__props, { emit: __emit }) {
|
|
2083
|
+
const props = __props;
|
|
2084
|
+
const emit = __emit;
|
|
2085
|
+
const onConfirm = () => emit("confirm", props.action, props.row, props.index);
|
|
2086
|
+
return (_ctx, _cache) => {
|
|
2087
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicPopconfirm), {
|
|
2088
|
+
placement: "top",
|
|
2089
|
+
width: __props.action.popconfirmWidth,
|
|
2090
|
+
title: (0, vue.unref)(formatActionText)(__props.action.confirmText, __props.row) || "确定执行此操作?",
|
|
2091
|
+
onConfirm
|
|
2092
|
+
}, {
|
|
2093
|
+
reference: (0, vue.withCtx)(() => [(0, vue.createVNode)(ActionButton_default, {
|
|
2094
|
+
action: __props.action,
|
|
2095
|
+
row: __props.row,
|
|
2096
|
+
index: __props.index,
|
|
2097
|
+
"btn-class": __props.btnClass,
|
|
2098
|
+
visible: __props.visible
|
|
2099
|
+
}, null, 8, [
|
|
2100
|
+
"action",
|
|
2101
|
+
"row",
|
|
2102
|
+
"index",
|
|
2103
|
+
"btn-class",
|
|
2104
|
+
"visible"
|
|
2105
|
+
])]),
|
|
2106
|
+
_: 1
|
|
2107
|
+
}, 8, ["width", "title"]);
|
|
2108
|
+
};
|
|
2109
|
+
}
|
|
2110
|
+
});
|
|
2111
|
+
//#endregion
|
|
1922
2112
|
//#region packages/table/src/ActionsColumn.vue?vue&type=script&setup=true&lang.ts
|
|
1923
|
-
var _hoisted_1$2 =
|
|
2113
|
+
var _hoisted_1$2 = { class: "tmagic-table-sub-actions" };
|
|
2114
|
+
var activePopoverId = (0, vue.ref)(null);
|
|
1924
2115
|
//#endregion
|
|
1925
2116
|
//#region packages/table/src/ActionsColumn.vue
|
|
1926
2117
|
var ActionsColumn_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
@@ -1935,28 +2126,27 @@
|
|
|
1935
2126
|
index: {}
|
|
1936
2127
|
},
|
|
1937
2128
|
emits: ["after-action", "after-action-cancel"],
|
|
1938
|
-
setup(__props, { emit: __emit }) {
|
|
2129
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1939
2130
|
const props = __props;
|
|
1940
|
-
const
|
|
1941
|
-
const
|
|
1942
|
-
|
|
1943
|
-
if (
|
|
1944
|
-
|
|
1945
|
-
};
|
|
1946
|
-
|
|
1947
|
-
if (
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
const formatter = (fuc, row) => {
|
|
1952
|
-
if (typeof fuc === "function") return fuc(row);
|
|
1953
|
-
return fuc;
|
|
2131
|
+
const popoverId = Symbol("sub-actions-popover");
|
|
2132
|
+
const popoverVisible = (0, vue.ref)(false);
|
|
2133
|
+
(0, vue.watch)(popoverVisible, (visible) => {
|
|
2134
|
+
if (visible) activePopoverId.value = popoverId;
|
|
2135
|
+
else if (activePopoverId.value === popoverId) activePopoverId.value = null;
|
|
2136
|
+
});
|
|
2137
|
+
(0, vue.watch)(activePopoverId, (id) => {
|
|
2138
|
+
if (id !== popoverId && popoverVisible.value) popoverVisible.value = false;
|
|
2139
|
+
});
|
|
2140
|
+
const togglePopover = () => {
|
|
2141
|
+
popoverVisible.value = !popoverVisible.value;
|
|
1954
2142
|
};
|
|
2143
|
+
const emit = __emit;
|
|
1955
2144
|
const actionHandler = async (action, row, index) => {
|
|
1956
2145
|
await action.before?.(row, index);
|
|
1957
2146
|
if (action.type === "edit") props.editState[index] = cloneDeep(row);
|
|
1958
2147
|
else await action.handler?.(row, index);
|
|
1959
|
-
action.after?.(row, index);
|
|
2148
|
+
await action.after?.(row, index);
|
|
2149
|
+
popoverVisible.value = false;
|
|
1960
2150
|
};
|
|
1961
2151
|
const save = async (index, config) => {
|
|
1962
2152
|
const action = config.actions?.find((item) => item.type === "edit")?.action;
|
|
@@ -1981,47 +2171,103 @@
|
|
|
1981
2171
|
if (cancel) await cancel({ index });
|
|
1982
2172
|
emit("after-action-cancel", { index });
|
|
1983
2173
|
};
|
|
2174
|
+
__expose({
|
|
2175
|
+
actionHandler,
|
|
2176
|
+
save,
|
|
2177
|
+
cancel
|
|
2178
|
+
});
|
|
1984
2179
|
return (_ctx, _cache) => {
|
|
1985
2180
|
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [
|
|
1986
2181
|
((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.config.actions, (action, actionIndex) => {
|
|
1987
|
-
return (0, vue.openBlock)(), (0, vue.
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2182
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: actionIndex }, [action.popconfirm ? ((0, vue.openBlock)(), (0, vue.createBlock)(ActionPopconfirm_default, {
|
|
2183
|
+
key: 0,
|
|
2184
|
+
action,
|
|
2185
|
+
row: __props.row,
|
|
2186
|
+
index: __props.index,
|
|
2187
|
+
visible: (0, vue.unref)(display)(action.display, __props.row) && !__props.editState[__props.index],
|
|
2188
|
+
onConfirm: actionHandler
|
|
2189
|
+
}, null, 8, [
|
|
2190
|
+
"action",
|
|
2191
|
+
"row",
|
|
2192
|
+
"index",
|
|
2193
|
+
"visible"
|
|
2194
|
+
])) : action.type === "sub-actions" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicPopover), {
|
|
2195
|
+
key: 1,
|
|
2196
|
+
visible: popoverVisible.value,
|
|
2197
|
+
"onUpdate:visible": _cache[0] || (_cache[0] = ($event) => popoverVisible.value = $event),
|
|
2198
|
+
trigger: "click",
|
|
2199
|
+
placement: action.subActionConfig?.placement || "bottom",
|
|
2200
|
+
width: action.subActionConfig?.popoverWidth,
|
|
2201
|
+
"popper-class": action.subActionConfig?.popoverClass,
|
|
2202
|
+
"destroy-on-close": action.subActionConfig?.popoverDestroyOnClose ?? true,
|
|
2203
|
+
onClickoutside: _cache[1] || (_cache[1] = ($event) => popoverVisible.value = false)
|
|
1992
2204
|
}, {
|
|
1993
|
-
|
|
2205
|
+
reference: (0, vue.withCtx)(() => [(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
1994
2206
|
class: "action-btn",
|
|
1995
2207
|
link: "",
|
|
1996
2208
|
size: "small",
|
|
1997
2209
|
type: action.buttonType || "primary",
|
|
1998
|
-
icon:
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2210
|
+
icon: popoverVisible.value ? (0, vue.unref)(_element_plus_icons_vue.ArrowDown) : (0, vue.unref)(_element_plus_icons_vue.ArrowRight),
|
|
2211
|
+
onClick: (0, vue.withModifiers)(togglePopover, ["stop"])
|
|
2212
|
+
}, null, 8, ["type", "icon"]), [[vue.vShow, action.subActionConfig?.items?.length && (0, vue.unref)(display)(action.display, __props.row) && !__props.editState[__props.index]]])]),
|
|
2213
|
+
default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$2, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(action.subActionConfig?.items, (subAction, subIndex) => {
|
|
2214
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: subIndex }, [subAction.popconfirm ? ((0, vue.openBlock)(), (0, vue.createBlock)(ActionPopconfirm_default, {
|
|
2215
|
+
key: 0,
|
|
2216
|
+
action: subAction,
|
|
2217
|
+
row: __props.row,
|
|
2218
|
+
index: __props.index,
|
|
2219
|
+
"btn-class": "sub-action-btn",
|
|
2220
|
+
visible: (0, vue.unref)(display)(subAction.display, __props.row),
|
|
2221
|
+
onConfirm: actionHandler
|
|
2222
|
+
}, null, 8, [
|
|
2223
|
+
"action",
|
|
2224
|
+
"row",
|
|
2225
|
+
"index",
|
|
2226
|
+
"visible"
|
|
2227
|
+
])) : ((0, vue.openBlock)(), (0, vue.createBlock)(ActionButton_default, {
|
|
2228
|
+
key: 1,
|
|
2229
|
+
action: subAction,
|
|
2230
|
+
row: __props.row,
|
|
2231
|
+
index: __props.index,
|
|
2232
|
+
"btn-class": "sub-action-btn",
|
|
2233
|
+
visible: (0, vue.unref)(display)(subAction.display, __props.row),
|
|
2234
|
+
onClick: actionHandler
|
|
2235
|
+
}, null, 8, [
|
|
2236
|
+
"action",
|
|
2237
|
+
"row",
|
|
2238
|
+
"index",
|
|
2239
|
+
"visible"
|
|
2240
|
+
]))], 64);
|
|
2241
|
+
}), 128))])]),
|
|
2010
2242
|
_: 2
|
|
2011
2243
|
}, 1032, [
|
|
2244
|
+
"visible",
|
|
2012
2245
|
"placement",
|
|
2013
|
-
"
|
|
2014
|
-
"
|
|
2015
|
-
|
|
2246
|
+
"width",
|
|
2247
|
+
"popper-class",
|
|
2248
|
+
"destroy-on-close"
|
|
2249
|
+
])) : ((0, vue.openBlock)(), (0, vue.createBlock)(ActionButton_default, {
|
|
2250
|
+
key: 2,
|
|
2251
|
+
action,
|
|
2252
|
+
row: __props.row,
|
|
2253
|
+
index: __props.index,
|
|
2254
|
+
visible: (0, vue.unref)(display)(action.display, __props.row) && !__props.editState[__props.index],
|
|
2255
|
+
onClick: actionHandler
|
|
2256
|
+
}, null, 8, [
|
|
2257
|
+
"action",
|
|
2258
|
+
"row",
|
|
2259
|
+
"index",
|
|
2260
|
+
"visible"
|
|
2261
|
+
]))], 64);
|
|
2016
2262
|
}), 128)),
|
|
2017
2263
|
(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
2018
2264
|
class: "action-btn",
|
|
2019
2265
|
link: "",
|
|
2020
2266
|
type: "primary",
|
|
2021
2267
|
size: "small",
|
|
2022
|
-
onClick: _cache[
|
|
2268
|
+
onClick: _cache[2] || (_cache[2] = ($event) => save(__props.index, __props.config))
|
|
2023
2269
|
}, {
|
|
2024
|
-
default: (0, vue.withCtx)(() => [..._cache[
|
|
2270
|
+
default: (0, vue.withCtx)(() => [..._cache[4] || (_cache[4] = [(0, vue.createTextVNode)("保存", -1)])]),
|
|
2025
2271
|
_: 1
|
|
2026
2272
|
}, 512), [[vue.vShow, __props.editState[__props.index]]]),
|
|
2027
2273
|
(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
|
|
@@ -2029,9 +2275,9 @@
|
|
|
2029
2275
|
link: "",
|
|
2030
2276
|
type: "danger",
|
|
2031
2277
|
size: "small",
|
|
2032
|
-
onClick: _cache[
|
|
2278
|
+
onClick: _cache[3] || (_cache[3] = ($event) => cancel(__props.index, __props.config))
|
|
2033
2279
|
}, {
|
|
2034
|
-
default: (0, vue.withCtx)(() => [..._cache[
|
|
2280
|
+
default: (0, vue.withCtx)(() => [..._cache[5] || (_cache[5] = [(0, vue.createTextVNode)("取消", -1)])]),
|
|
2035
2281
|
_: 1
|
|
2036
2282
|
}, 512), [[vue.vShow, __props.editState[__props.index]]])
|
|
2037
2283
|
], 64);
|
|
@@ -2039,6 +2285,16 @@
|
|
|
2039
2285
|
}
|
|
2040
2286
|
});
|
|
2041
2287
|
//#endregion
|
|
2288
|
+
//#region packages/table/src/componentHelpers.ts
|
|
2289
|
+
var resolveComponentProps = (config, row, index) => {
|
|
2290
|
+
if (typeof config.props === "function") return config.props(row, index) || {};
|
|
2291
|
+
return config.props || {};
|
|
2292
|
+
};
|
|
2293
|
+
var resolveComponentListeners = (config, row, index) => {
|
|
2294
|
+
if (typeof config.listeners === "function") return config.listeners(row, index) || {};
|
|
2295
|
+
return config.listeners || {};
|
|
2296
|
+
};
|
|
2297
|
+
//#endregion
|
|
2042
2298
|
//#region packages/table/src/ComponentColumn.vue
|
|
2043
2299
|
var ComponentColumn_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
2044
2300
|
name: "MTableColumn",
|
|
@@ -2049,17 +2305,8 @@
|
|
|
2049
2305
|
index: {}
|
|
2050
2306
|
},
|
|
2051
2307
|
setup(__props) {
|
|
2052
|
-
const props = __props;
|
|
2053
|
-
const componentProps = (row, index) => {
|
|
2054
|
-
if (typeof props.config.props === "function") return props.config.props(row, index) || {};
|
|
2055
|
-
return props.config.props || {};
|
|
2056
|
-
};
|
|
2057
|
-
const componentListeners = (row, index) => {
|
|
2058
|
-
if (typeof props.config.listeners === "function") return props.config.listeners(row, index) || {};
|
|
2059
|
-
return props.config.listeners || {};
|
|
2060
|
-
};
|
|
2061
2308
|
return (_ctx, _cache) => {
|
|
2062
|
-
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.config.component), (0, vue.mergeProps)(
|
|
2309
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(__props.config.component), (0, vue.mergeProps)((0, vue.unref)(resolveComponentProps)(__props.config, __props.row, __props.index), (0, vue.toHandlers)((0, vue.unref)(resolveComponentListeners)(__props.config, __props.row, __props.index))), null, 16);
|
|
2063
2310
|
};
|
|
2064
2311
|
}
|
|
2065
2312
|
});
|
|
@@ -2165,6 +2412,13 @@
|
|
|
2165
2412
|
}
|
|
2166
2413
|
});
|
|
2167
2414
|
//#endregion
|
|
2415
|
+
//#region packages/table/src/formHelpers.ts
|
|
2416
|
+
var applyInlineEditChange = (target, eventData) => {
|
|
2417
|
+
if (eventData.changeRecords?.length) {
|
|
2418
|
+
for (const record of eventData.changeRecords) if (record.propPath) (0, _tmagic_utils.setValueByKeyPath)(record.propPath, record.value, target);
|
|
2419
|
+
}
|
|
2420
|
+
};
|
|
2421
|
+
//#endregion
|
|
2168
2422
|
//#region packages/table/src/TextColumn.vue?vue&type=script&setup=true&lang.ts
|
|
2169
2423
|
var _hoisted_1 = { key: 0 };
|
|
2170
2424
|
var _hoisted_2 = ["innerHTML"];
|
|
@@ -2186,9 +2440,7 @@
|
|
|
2186
2440
|
setup(__props) {
|
|
2187
2441
|
const props = __props;
|
|
2188
2442
|
const formChangeHandler = (v, eventData) => {
|
|
2189
|
-
|
|
2190
|
-
for (const record of eventData.changeRecords) if (record.propPath) (0, _tmagic_utils.setValueByKeyPath)(record.propPath, record.value, props.editState[props.index]);
|
|
2191
|
-
}
|
|
2443
|
+
applyInlineEditChange(props.editState[props.index], eventData);
|
|
2192
2444
|
};
|
|
2193
2445
|
return (_ctx, _cache) => {
|
|
2194
2446
|
return __props.config.type === "index" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1, (0, vue.toDisplayString)(__props.config.pageIndex && __props.config.pageSize ? __props.config.pageIndex * __props.config.pageSize + __props.index + 1 : __props.index + 1), 1)) : (__props.config.type || __props.config.editInlineFormConfig) && __props.editState[__props.index] ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_form.MForm), {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.8.0-beta.
|
|
2
|
+
"version": "1.8.0-beta.20",
|
|
3
3
|
"name": "@tmagic/table",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -37,17 +37,19 @@
|
|
|
37
37
|
"url": "https://github.com/Tencent/tmagic-editor.git"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"@element-plus/icons-vue": "^2.3.2",
|
|
40
41
|
"lodash-es": "^4.17.21"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
|
-
"@types/lodash-es": "^4.17.4"
|
|
44
|
+
"@types/lodash-es": "^4.17.4",
|
|
45
|
+
"@vue/test-utils": "^2.4.6"
|
|
44
46
|
},
|
|
45
47
|
"peerDependencies": {
|
|
46
|
-
"vue": "^3.5.
|
|
48
|
+
"vue": "^3.5.40",
|
|
47
49
|
"typescript": "^6.0.3",
|
|
48
|
-
"@tmagic/design": "1.8.0-beta.
|
|
49
|
-
"@tmagic/
|
|
50
|
-
"@tmagic/
|
|
50
|
+
"@tmagic/design": "1.8.0-beta.20",
|
|
51
|
+
"@tmagic/utils": "1.8.0-beta.20",
|
|
52
|
+
"@tmagic/form": "1.8.0-beta.20"
|
|
51
53
|
},
|
|
52
54
|
"peerDependenciesMeta": {
|
|
53
55
|
"typescript": {
|