@kne/table-page 0.1.6 → 0.1.8
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/index.css +19 -308
- package/dist/index.css.map +1 -1
- package/dist/index.js +231 -1800
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +64 -1747
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1,1362 +1,63 @@
|
|
|
1
|
+
require('@kne/table-view/dist/index.css');
|
|
1
2
|
var reactFetch = require('@kne/react-fetch');
|
|
2
3
|
var antd = require('antd');
|
|
3
4
|
var reactFilter = require('@kne/react-filter');
|
|
4
5
|
var react = require('react');
|
|
5
6
|
var classnames = require('classnames');
|
|
6
7
|
var get = require('lodash/get');
|
|
8
|
+
var tableView = require('@kne/table-view');
|
|
7
9
|
var isEmpty = require('@kne/is-empty');
|
|
8
|
-
var
|
|
9
|
-
var transform = require('lodash/transform');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
require('
|
|
13
|
-
var icons = require('@ant-design/icons');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
var filterEnUS = require('@kne/react-filter/dist/locale/en-US');
|
|
25
|
-
var reactDom = require('react-dom');
|
|
26
|
-
require('@kne/react-filter/dist/index.css');
|
|
27
|
-
var merge = require('lodash/merge');
|
|
28
|
-
|
|
29
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
30
|
-
|
|
31
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
32
|
-
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
33
|
-
var groupBy__default = /*#__PURE__*/_interopDefaultLegacy(groupBy);
|
|
34
|
-
var transform__default = /*#__PURE__*/_interopDefaultLegacy(transform);
|
|
35
|
-
var ButtonGroup__default = /*#__PURE__*/_interopDefaultLegacy(ButtonGroup);
|
|
36
|
-
var clone__default = /*#__PURE__*/_interopDefaultLegacy(clone);
|
|
37
|
-
var useRefCallback__default = /*#__PURE__*/_interopDefaultLegacy(useRefCallback);
|
|
38
|
-
var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
|
|
39
|
-
var findLastIndex__default = /*#__PURE__*/_interopDefaultLegacy(findLastIndex);
|
|
40
|
-
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
41
|
-
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
42
|
-
var filterZhCN__default = /*#__PURE__*/_interopDefaultLegacy(filterZhCN);
|
|
43
|
-
var filterEnUS__default = /*#__PURE__*/_interopDefaultLegacy(filterEnUS);
|
|
44
|
-
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
45
|
-
|
|
46
|
-
function _extends() {
|
|
47
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
48
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
49
|
-
var t = arguments[e];
|
|
50
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
51
|
-
}
|
|
52
|
-
return n;
|
|
53
|
-
}, _extends.apply(null, arguments);
|
|
54
|
-
}
|
|
55
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
56
|
-
if (null == r) return {};
|
|
57
|
-
var t = {};
|
|
58
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
59
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
60
|
-
t[n] = r[n];
|
|
61
|
-
}
|
|
62
|
-
return t;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
66
|
-
|
|
67
|
-
function createCommonjsModule(fn) {
|
|
68
|
-
var module = { exports: {} };
|
|
69
|
-
return fn(module, module.exports), module.exports;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
var dayjs_min = createCommonjsModule(function (module, exports) {
|
|
73
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),Y=_.prototype;return O.prototype=Y,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){Y[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const calcArgs = (args, template) => {
|
|
77
|
-
const {
|
|
78
|
-
attr,
|
|
79
|
-
normal
|
|
80
|
-
} = groupBy__default["default"](args, item => /^.+:.+$/.test(item) ? 'attr' : 'normal');
|
|
81
|
-
const output = {};
|
|
82
|
-
const typeTransform = (value, type) => {
|
|
83
|
-
if (type === 'string') {
|
|
84
|
-
return String(value);
|
|
85
|
-
}
|
|
86
|
-
if (type === 'number') {
|
|
87
|
-
return Number(value);
|
|
88
|
-
}
|
|
89
|
-
if (type === 'boolean') {
|
|
90
|
-
return value === 'true';
|
|
91
|
-
}
|
|
92
|
-
return value;
|
|
93
|
-
};
|
|
94
|
-
(normal || []).forEach((target, index) => {
|
|
95
|
-
const currentTemplate = Object.assign({}, {
|
|
96
|
-
type: 'string',
|
|
97
|
-
defaultValue: ''
|
|
98
|
-
}, get__default["default"](template, index));
|
|
99
|
-
if (currentTemplate.name && target) {
|
|
100
|
-
output[currentTemplate.name] = typeTransform(target, currentTemplate.type);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
(attr || []).forEach(target => {
|
|
104
|
-
const [key, value] = target.split(':');
|
|
105
|
-
const currentTemplate = template.find(item => item.name === key);
|
|
106
|
-
if (!currentTemplate) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const {
|
|
110
|
-
name,
|
|
111
|
-
type
|
|
112
|
-
} = Object.assign({}, {
|
|
113
|
-
type: 'string',
|
|
114
|
-
defaultValue: ''
|
|
115
|
-
}, currentTemplate);
|
|
116
|
-
output[name] = typeTransform(value, type);
|
|
117
|
-
});
|
|
118
|
-
return Object.assign({}, transform__default["default"](template, (result, value) => {
|
|
119
|
-
if (value.name && value.hasOwnProperty('defaultValue')) {
|
|
120
|
-
result[value.name] = value.defaultValue;
|
|
121
|
-
}
|
|
122
|
-
}, {}), output);
|
|
123
|
-
};
|
|
124
|
-
const defaultFormat = {
|
|
125
|
-
date: (value, {
|
|
126
|
-
args
|
|
127
|
-
}) => {
|
|
128
|
-
const template = args[0] || 'YYYY-MM-DD';
|
|
129
|
-
return dayjs_min(value).format(template);
|
|
130
|
-
},
|
|
131
|
-
datetime: (value, {
|
|
132
|
-
args
|
|
133
|
-
}) => {
|
|
134
|
-
const template = args[0] || 'YYYY-MM-DD HH:mm:ss';
|
|
135
|
-
return dayjs_min(value).format(template);
|
|
136
|
-
},
|
|
137
|
-
dateRange: (value, {
|
|
138
|
-
args
|
|
139
|
-
}) => {
|
|
140
|
-
const template = args[0] || 'YYYY-MM-DD',
|
|
141
|
-
allowNull = args[1];
|
|
142
|
-
if (!isEmpty.isEmpty(value[0]) && !isEmpty.isEmpty(value[1])) {
|
|
143
|
-
return `${dayjs_min(value[0]).format(template)}~${dayjs_min(value[1]).format(template)}`;
|
|
144
|
-
}
|
|
145
|
-
if (allowNull === 'allow' && !isEmpty.isEmpty(value[0])) {
|
|
146
|
-
return `${dayjs_min(value[0]).format(template)}以后`;
|
|
147
|
-
}
|
|
148
|
-
if (allowNull === 'allow' && !isEmpty.isEmpty(value[1])) {
|
|
149
|
-
return `${dayjs_min(value[1]).format(template)}以前`;
|
|
150
|
-
}
|
|
151
|
-
return '';
|
|
152
|
-
},
|
|
153
|
-
boolean: (value, {
|
|
154
|
-
args
|
|
155
|
-
}) => {
|
|
156
|
-
const trueValue = args[0] || 'true';
|
|
157
|
-
if ((value || '').toString() === trueValue) {
|
|
158
|
-
return '是';
|
|
159
|
-
}
|
|
160
|
-
return '否';
|
|
161
|
-
},
|
|
162
|
-
number: (value, {
|
|
163
|
-
args
|
|
164
|
-
}) => {
|
|
165
|
-
const {
|
|
166
|
-
style,
|
|
167
|
-
unit,
|
|
168
|
-
maximumFractionDigits,
|
|
169
|
-
useGrouping,
|
|
170
|
-
roundingMode,
|
|
171
|
-
suffix
|
|
172
|
-
} = calcArgs(args, [{
|
|
173
|
-
name: 'style',
|
|
174
|
-
type: 'string',
|
|
175
|
-
defaultValue: 'decimal'
|
|
176
|
-
}, {
|
|
177
|
-
name: 'unit',
|
|
178
|
-
type: 'number',
|
|
179
|
-
defaultValue: 1
|
|
180
|
-
}, {
|
|
181
|
-
name: 'maximumFractionDigits',
|
|
182
|
-
type: 'number',
|
|
183
|
-
defaultValue: 2
|
|
184
|
-
}, {
|
|
185
|
-
name: 'useGrouping',
|
|
186
|
-
type: 'boolean',
|
|
187
|
-
defaultValue: true
|
|
188
|
-
}, {
|
|
189
|
-
name: 'roundingMode',
|
|
190
|
-
type: 'string',
|
|
191
|
-
defaultValue: 'halfExpand'
|
|
192
|
-
}, {
|
|
193
|
-
name: 'suffix',
|
|
194
|
-
type: 'string',
|
|
195
|
-
defaultValue: ''
|
|
196
|
-
}]);
|
|
197
|
-
return new Intl.NumberFormat({}, {
|
|
198
|
-
style,
|
|
199
|
-
maximumFractionDigits,
|
|
200
|
-
roundingMode,
|
|
201
|
-
useGrouping
|
|
202
|
-
}).format(value / unit) + suffix;
|
|
203
|
-
},
|
|
204
|
-
money: (value, {
|
|
205
|
-
args
|
|
206
|
-
}) => {
|
|
207
|
-
const unit = args[0] || '元';
|
|
208
|
-
return `${value}${unit}`;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const formatView = (value, format, context) => {
|
|
212
|
-
if (!format) {
|
|
213
|
-
return value;
|
|
214
|
-
}
|
|
215
|
-
const formatList = format.split(' ').filter(item => !!item);
|
|
216
|
-
if (formatList.length > 0) {
|
|
217
|
-
return formatList.reduce((value, format) => {
|
|
218
|
-
const [name, ...args] = format.split('-');
|
|
219
|
-
if (typeof defaultFormat[name] === 'function') {
|
|
220
|
-
return defaultFormat[name](value, Object.assign({}, context, {
|
|
221
|
-
args: args.map(item => {
|
|
222
|
-
return item && item.replace(/\(\)/g, ' ').replace(/\(_\)/g, '-');
|
|
223
|
-
})
|
|
224
|
-
}));
|
|
225
|
-
}
|
|
226
|
-
return value;
|
|
227
|
-
}, value);
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
const globalParams = {
|
|
232
|
-
renderType: null,
|
|
233
|
-
renderTypeSize: {},
|
|
234
|
-
tagTypeColors: {},
|
|
235
|
-
statusTypeColors: {}
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
const defaultRender = value => value;
|
|
239
|
-
|
|
240
|
-
var ellipsisStyle = {"ellipsis":"kne-table-page_mMMw1","tooltip":"kne-table-page_CkWQu","cell-content":"kne-table-page_OXmYu","cell-full-width":"kne-table-page_jN-vq"};
|
|
241
|
-
|
|
242
|
-
const Ellipsis = ({
|
|
243
|
-
children,
|
|
244
|
-
ellipsis
|
|
245
|
-
}) => {
|
|
246
|
-
if (!ellipsis) {
|
|
247
|
-
return children;
|
|
248
|
-
}
|
|
249
|
-
const userConfig = typeof ellipsis === 'object' ? ellipsis : {};
|
|
250
|
-
const {
|
|
251
|
-
showTitle,
|
|
252
|
-
...rest
|
|
253
|
-
} = userConfig;
|
|
254
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Typography.Text, {
|
|
255
|
-
className: ellipsisStyle['ellipsis'],
|
|
256
|
-
ellipsis: Object.assign({}, {
|
|
257
|
-
tooltip: showTitle === false ? false : {
|
|
258
|
-
rootClassName: ellipsisStyle['tooltip']
|
|
259
|
-
}
|
|
260
|
-
}, rest),
|
|
261
|
-
children: children
|
|
262
|
-
});
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
var style$8 = {"text":"kne-table-page_5N2-a","ellipsis":"kne-table-page_Lkl3D","hover":"kne-table-page_RnF6d","primary":"kne-table-page_g-Sky","clickable":"kne-table-page_vPcDo","loading":"kne-table-page_FeQ09"};
|
|
266
|
-
|
|
267
|
-
const MainCell = ({
|
|
268
|
-
value,
|
|
269
|
-
column,
|
|
270
|
-
dataSource
|
|
271
|
-
}) => {
|
|
272
|
-
const {
|
|
273
|
-
ellipsis = true,
|
|
274
|
-
hover = true,
|
|
275
|
-
primary = true,
|
|
276
|
-
onClick
|
|
277
|
-
} = column || {};
|
|
278
|
-
const [loading, setLoading] = react.useState(false);
|
|
279
|
-
const isClickable = Boolean(hover || primary || onClick);
|
|
280
|
-
if (!isClickable) {
|
|
281
|
-
return /*#__PURE__*/jsxRuntime.jsx(Ellipsis, {
|
|
282
|
-
ellipsis: ellipsis,
|
|
283
|
-
children: value
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
const ellipsisConfig = typeof ellipsis === 'object' ? ellipsis : {};
|
|
287
|
-
const showTooltip = ellipsis && ellipsisConfig.showTitle !== false;
|
|
288
|
-
const handleClick = onClick ? e => {
|
|
289
|
-
if (loading) {
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
setLoading(true);
|
|
293
|
-
Promise.resolve(onClick({
|
|
294
|
-
item: value,
|
|
295
|
-
colItem: dataSource,
|
|
296
|
-
event: e
|
|
297
|
-
})).finally(() => {
|
|
298
|
-
setLoading(false);
|
|
299
|
-
});
|
|
300
|
-
} : undefined;
|
|
301
|
-
const text = /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
302
|
-
className: classnames__default["default"](style$8['text'], ellipsis && style$8['ellipsis'], {
|
|
303
|
-
[style$8['hover']]: hover,
|
|
304
|
-
[style$8['primary']]: primary,
|
|
305
|
-
[style$8['clickable']]: Boolean(onClick),
|
|
306
|
-
[style$8['loading']]: loading
|
|
307
|
-
}),
|
|
308
|
-
onClick: handleClick,
|
|
309
|
-
children: value
|
|
310
|
-
});
|
|
311
|
-
if (!showTooltip) {
|
|
312
|
-
return text;
|
|
313
|
-
}
|
|
314
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
315
|
-
title: value,
|
|
316
|
-
rootClassName: ellipsisStyle['tooltip'],
|
|
317
|
-
children: text
|
|
318
|
-
});
|
|
319
|
-
};
|
|
320
|
-
const main = (value, {
|
|
321
|
-
column,
|
|
322
|
-
dataSource
|
|
323
|
-
} = {}) => /*#__PURE__*/jsxRuntime.jsx(MainCell, {
|
|
324
|
-
value: value,
|
|
325
|
-
column: column,
|
|
326
|
-
dataSource: dataSource
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
var style$7 = {"amount":"kne-table-page_AH-3R"};
|
|
330
|
-
|
|
331
|
-
const amount = (value, {
|
|
332
|
-
column
|
|
333
|
-
} = {}) => {
|
|
334
|
-
const {
|
|
335
|
-
ellipsis = true
|
|
336
|
-
} = column || {};
|
|
337
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
338
|
-
className: style$7['amount'],
|
|
339
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Ellipsis, {
|
|
340
|
-
ellipsis: ellipsis,
|
|
341
|
-
children: value
|
|
342
|
-
})
|
|
343
|
-
});
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
const DEFAULT_TAG_TYPE_COLORS = {
|
|
347
|
-
default: 'default',
|
|
348
|
-
success: 'success',
|
|
349
|
-
progress: 'processing',
|
|
350
|
-
processing: 'processing',
|
|
351
|
-
danger: 'error',
|
|
352
|
-
error: 'error',
|
|
353
|
-
warning: 'warning',
|
|
354
|
-
info: 'blue',
|
|
355
|
-
other: 'purple',
|
|
356
|
-
skill: 'default',
|
|
357
|
-
result: 'default',
|
|
358
|
-
filterResult: 'cyan',
|
|
359
|
-
completed: 'success',
|
|
360
|
-
pending: 'warning',
|
|
361
|
-
high: 'error',
|
|
362
|
-
medium: 'warning',
|
|
363
|
-
low: 'default'
|
|
364
|
-
};
|
|
365
|
-
const getTagColor = type => {
|
|
366
|
-
if (!type) {
|
|
367
|
-
return 'default';
|
|
368
|
-
}
|
|
369
|
-
const customColors = globalParams.tagTypeColors || {};
|
|
370
|
-
return customColors[type] || DEFAULT_TAG_TYPE_COLORS[type] || type;
|
|
371
|
-
};
|
|
372
|
-
const normalizeTagItem = item => {
|
|
373
|
-
if (item == null) {
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
|
-
if (typeof item === 'string' || typeof item === 'number') {
|
|
377
|
-
return {
|
|
378
|
-
text: String(item)
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
if (typeof item === 'object') {
|
|
382
|
-
return Object.assign({}, item, {
|
|
383
|
-
text: item.text ?? item.children ?? item.label
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
return null;
|
|
387
|
-
};
|
|
388
|
-
const renderTagItem = (item, key) => {
|
|
389
|
-
const tag = normalizeTagItem(item);
|
|
390
|
-
if (!tag || tag.text == null && tag.children == null) {
|
|
391
|
-
return null;
|
|
392
|
-
}
|
|
393
|
-
const {
|
|
394
|
-
text,
|
|
395
|
-
type,
|
|
396
|
-
color,
|
|
397
|
-
children,
|
|
398
|
-
...rest
|
|
399
|
-
} = tag;
|
|
400
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
401
|
-
color: color ?? getTagColor(type),
|
|
402
|
-
...rest,
|
|
403
|
-
children: children ?? text
|
|
404
|
-
}, key);
|
|
405
|
-
};
|
|
406
|
-
const renderTagList = value => {
|
|
407
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Space, {
|
|
411
|
-
size: [4, 4],
|
|
412
|
-
wrap: true,
|
|
413
|
-
children: value.map((item, index) => renderTagItem(item, index))
|
|
414
|
-
});
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
const tag = value => renderTagItem(value);
|
|
418
|
-
|
|
419
|
-
const tagList = value => renderTagList(value);
|
|
420
|
-
|
|
421
|
-
const DEFAULT_STATUS_TYPE_MAP = {
|
|
422
|
-
default: 'default',
|
|
423
|
-
success: 'success',
|
|
424
|
-
progress: 'processing',
|
|
425
|
-
processing: 'processing',
|
|
426
|
-
danger: 'error',
|
|
427
|
-
error: 'error',
|
|
428
|
-
warning: 'warning',
|
|
429
|
-
info: 'processing',
|
|
430
|
-
other: 'default',
|
|
431
|
-
active: 'success',
|
|
432
|
-
vacation: 'warning',
|
|
433
|
-
resigned: 'default',
|
|
434
|
-
probation: 'processing',
|
|
435
|
-
completed: 'success',
|
|
436
|
-
pending: 'warning',
|
|
437
|
-
shipped: 'processing',
|
|
438
|
-
paid: 'success',
|
|
439
|
-
cancelled: 'error'
|
|
440
|
-
};
|
|
441
|
-
const getStatusType = type => {
|
|
442
|
-
if (!type) {
|
|
443
|
-
return 'default';
|
|
444
|
-
}
|
|
445
|
-
const customTypes = globalParams.statusTypeColors || {};
|
|
446
|
-
return customTypes[type] || DEFAULT_STATUS_TYPE_MAP[type] || type;
|
|
447
|
-
};
|
|
448
|
-
const normalizeStatusItem = item => {
|
|
449
|
-
if (item == null) {
|
|
450
|
-
return null;
|
|
451
|
-
}
|
|
452
|
-
if (typeof item === 'string' || typeof item === 'number') {
|
|
453
|
-
return {
|
|
454
|
-
text: String(item)
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
if (typeof item === 'object') {
|
|
458
|
-
return Object.assign({}, item, {
|
|
459
|
-
text: item.text ?? item.children ?? item.label
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
return null;
|
|
463
|
-
};
|
|
464
|
-
const renderStatusItem = item => {
|
|
465
|
-
const statusItem = normalizeStatusItem(item);
|
|
466
|
-
if (!statusItem || statusItem.text == null) {
|
|
467
|
-
return null;
|
|
468
|
-
}
|
|
469
|
-
const {
|
|
470
|
-
text,
|
|
471
|
-
type,
|
|
472
|
-
status,
|
|
473
|
-
color,
|
|
474
|
-
children,
|
|
475
|
-
...rest
|
|
476
|
-
} = statusItem;
|
|
477
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Badge, {
|
|
478
|
-
status: status ?? color ?? getStatusType(type),
|
|
479
|
-
text: children ?? text,
|
|
480
|
-
...rest
|
|
481
|
-
});
|
|
482
|
-
};
|
|
483
|
-
|
|
484
|
-
const status = value => renderStatusItem(value);
|
|
485
|
-
|
|
486
|
-
const DEFAULT_SPLIT = ',';
|
|
487
|
-
const normalizeListValue = value => {
|
|
488
|
-
if (Array.isArray(value)) {
|
|
489
|
-
return {
|
|
490
|
-
items: value,
|
|
491
|
-
split: undefined
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
if (value && typeof value === 'object') {
|
|
495
|
-
const items = value.items ?? value.list ?? value.value;
|
|
496
|
-
if (Array.isArray(items)) {
|
|
497
|
-
return {
|
|
498
|
-
items,
|
|
499
|
-
split: value.split
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
return null;
|
|
504
|
-
};
|
|
505
|
-
const getListItemText = item => {
|
|
506
|
-
if (item == null) {
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
if (typeof item === 'object') {
|
|
510
|
-
return item.text ?? item.label ?? item.children ?? item.value;
|
|
511
|
-
}
|
|
512
|
-
return item;
|
|
513
|
-
};
|
|
514
|
-
const list = (value, {
|
|
515
|
-
column
|
|
516
|
-
} = {}) => {
|
|
517
|
-
const normalized = normalizeListValue(value);
|
|
518
|
-
if (!normalized) {
|
|
519
|
-
return value == null ? null : value;
|
|
520
|
-
}
|
|
521
|
-
const split = normalized.split ?? column?.split ?? DEFAULT_SPLIT;
|
|
522
|
-
const text = normalized.items.map(getListItemText).filter(item => item != null && item !== '').join(split);
|
|
523
|
-
return text || null;
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
const SELECTION_CHECKBOX_WIDTH = 48;
|
|
527
|
-
const SELECTION_RADIO_WIDTH = 30;
|
|
528
|
-
const DEFAULT_COLUMN_WIDTH = 300;
|
|
529
|
-
const parseColumnWidth = width => {
|
|
530
|
-
if (width == null) {
|
|
531
|
-
return 0;
|
|
532
|
-
}
|
|
533
|
-
if (typeof width === 'number' && !Number.isNaN(width)) {
|
|
534
|
-
return width;
|
|
535
|
-
}
|
|
536
|
-
if (typeof width === 'string') {
|
|
537
|
-
const trimmed = width.trim();
|
|
538
|
-
const pxMatch = trimmed.match(/^([\d.]+)px$/i);
|
|
539
|
-
if (pxMatch) {
|
|
540
|
-
return parseFloat(pxMatch[1]);
|
|
541
|
-
}
|
|
542
|
-
const num = parseFloat(trimmed);
|
|
543
|
-
if (!Number.isNaN(num)) {
|
|
544
|
-
return num;
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return 0;
|
|
548
|
-
};
|
|
549
|
-
const getResolvedColumnWidth = column => resolveColumnDimensions(column).width;
|
|
550
|
-
const hasColumnSpan = column => column.span != null;
|
|
551
|
-
const getConfiguredColumnWidthPx = column => parseColumnWidth(column.width != null ? column.width : getResolvedColumnWidth(column));
|
|
552
|
-
const usesDefaultColumnWidth = (column, columns) => {
|
|
553
|
-
if (hasColumnSpan(column)) {
|
|
554
|
-
return false;
|
|
555
|
-
}
|
|
556
|
-
if (column.width != null) {
|
|
557
|
-
return false;
|
|
558
|
-
}
|
|
559
|
-
if (getConfiguredColumnWidthPx(column) > 0) {
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
return !columns.some(hasColumnSpan);
|
|
563
|
-
};
|
|
564
|
-
const hasColumnWidth = (column, columns) => {
|
|
565
|
-
if (hasColumnSpan(column)) {
|
|
566
|
-
return false;
|
|
567
|
-
}
|
|
568
|
-
if (getConfiguredColumnWidthPx(column) > 0) {
|
|
569
|
-
return true;
|
|
570
|
-
}
|
|
571
|
-
return usesDefaultColumnWidth(column, columns);
|
|
572
|
-
};
|
|
573
|
-
const shouldLastColumnFillRemaining = columns => !columns.some(hasColumnSpan);
|
|
574
|
-
const getColumnWidthPx = (column, colsSize = {}, columns = []) => {
|
|
575
|
-
if (hasColumnSpan(column)) {
|
|
576
|
-
return colsSize[column.name] || 0;
|
|
577
|
-
}
|
|
578
|
-
const configured = getConfiguredColumnWidthPx(column);
|
|
579
|
-
if (configured > 0) {
|
|
580
|
-
return configured;
|
|
581
|
-
}
|
|
582
|
-
if (usesDefaultColumnWidth(column, columns)) {
|
|
583
|
-
const measured = colsSize[column.name] || 0;
|
|
584
|
-
return Math.max(DEFAULT_COLUMN_WIDTH, measured);
|
|
585
|
-
}
|
|
586
|
-
return colsSize[column.name] || 0;
|
|
587
|
-
};
|
|
588
|
-
const formatColumnWidthPx = px => `${px}px`;
|
|
589
|
-
const getColumnTrackSize = (column, {
|
|
590
|
-
defaultSpan,
|
|
591
|
-
colsSize,
|
|
592
|
-
isLastColumn,
|
|
593
|
-
columns
|
|
594
|
-
} = {}) => {
|
|
595
|
-
const widthPx = getColumnWidthPx(column, colsSize, columns);
|
|
596
|
-
if (hasColumnWidth(column, columns)) {
|
|
597
|
-
if (isLastColumn && shouldLastColumnFillRemaining(columns)) {
|
|
598
|
-
return `minmax(${widthPx}px, 1fr)`;
|
|
599
|
-
}
|
|
600
|
-
return `${widthPx}px`;
|
|
601
|
-
}
|
|
602
|
-
if (widthPx > 0) {
|
|
603
|
-
return `minmax(${widthPx}px, 1fr)`;
|
|
604
|
-
}
|
|
605
|
-
const span = column.span ?? defaultSpan ?? 1;
|
|
606
|
-
return `minmax(0, ${span}fr)`;
|
|
607
|
-
};
|
|
608
|
-
const getGridTemplateColumns = (columns, {
|
|
609
|
-
defaultSpan,
|
|
610
|
-
colsSize,
|
|
611
|
-
rowSelection
|
|
612
|
-
} = {}) => {
|
|
613
|
-
const tracks = [];
|
|
614
|
-
const lastColumnIndex = columns.length - 1;
|
|
615
|
-
if (rowSelection?.type === 'checkbox') {
|
|
616
|
-
tracks.push(`${SELECTION_CHECKBOX_WIDTH}px`);
|
|
617
|
-
}
|
|
618
|
-
columns.forEach((column, index) => {
|
|
619
|
-
tracks.push(getColumnTrackSize(column, {
|
|
620
|
-
defaultSpan,
|
|
621
|
-
colsSize,
|
|
622
|
-
isLastColumn: index === lastColumnIndex,
|
|
623
|
-
columns
|
|
624
|
-
}));
|
|
625
|
-
});
|
|
626
|
-
if (rowSelection?.type === 'radio') {
|
|
627
|
-
tracks.push(`${SELECTION_RADIO_WIDTH}px`);
|
|
628
|
-
}
|
|
629
|
-
return tracks.join(' ');
|
|
630
|
-
};
|
|
631
|
-
const getColumnLayout = (column, {
|
|
632
|
-
defaultSpan,
|
|
633
|
-
colsSize,
|
|
634
|
-
isLastColumn,
|
|
635
|
-
columns
|
|
636
|
-
} = {}) => {
|
|
637
|
-
const widthBased = hasColumnWidth(column, columns);
|
|
638
|
-
const widthPx = getColumnWidthPx(column, colsSize, columns);
|
|
639
|
-
const fillRemaining = isLastColumn && widthBased && shouldLastColumnFillRemaining(columns);
|
|
640
|
-
return {
|
|
641
|
-
widthBased,
|
|
642
|
-
fillRemaining,
|
|
643
|
-
style: {
|
|
644
|
-
'--col-width': formatColumnWidthPx(widthPx),
|
|
645
|
-
'--col-align': column.align || 'top',
|
|
646
|
-
'--col-justify': column.justify || 'flex-start'
|
|
647
|
-
}
|
|
648
|
-
};
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
var style$6 = {"col-item":"kne-table-page_nL1tj","options":"kne-table-page_EwzO-","options-column":"kne-table-page_im2Lc","options-btn":"kne-table-page_SJxZl"};
|
|
652
|
-
|
|
653
|
-
const normalizeOptionItem = (item, buttonClassName) => {
|
|
654
|
-
if (item == null) {
|
|
655
|
-
return null;
|
|
656
|
-
}
|
|
657
|
-
if (typeof item === 'function') {
|
|
658
|
-
return item;
|
|
659
|
-
}
|
|
660
|
-
if (typeof item === 'string') {
|
|
661
|
-
return {
|
|
662
|
-
children: item,
|
|
663
|
-
type: 'link',
|
|
664
|
-
className: buttonClassName
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
const {
|
|
668
|
-
children,
|
|
669
|
-
label,
|
|
670
|
-
text,
|
|
671
|
-
className,
|
|
672
|
-
...rest
|
|
673
|
-
} = item;
|
|
674
|
-
return {
|
|
675
|
-
type: 'link',
|
|
676
|
-
...rest,
|
|
677
|
-
className: classnames__default["default"](buttonClassName, className),
|
|
678
|
-
children: children ?? label ?? text
|
|
679
|
-
};
|
|
680
|
-
};
|
|
681
|
-
const options = (value, {
|
|
682
|
-
column
|
|
683
|
-
} = {}) => {
|
|
684
|
-
let list = value;
|
|
685
|
-
let buttonGroupProps = column?.buttonGroup || {};
|
|
686
|
-
if (value && typeof value === 'object' && !Array.isArray(value) && Array.isArray(value.list)) {
|
|
687
|
-
const {
|
|
688
|
-
list: valueList,
|
|
689
|
-
...rest
|
|
690
|
-
} = value;
|
|
691
|
-
list = valueList;
|
|
692
|
-
buttonGroupProps = {
|
|
693
|
-
...buttonGroupProps,
|
|
694
|
-
...rest
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
if (!Array.isArray(list) || list.length === 0) {
|
|
698
|
-
return null;
|
|
699
|
-
}
|
|
700
|
-
const wrapperClassName = classnames__default["default"](style$6['col-item'], style$6['options']);
|
|
701
|
-
const buttonClassName = classnames__default["default"](wrapperClassName, style$6['options-btn']);
|
|
702
|
-
const normalizedList = list.map(item => normalizeOptionItem(item, buttonClassName)).filter(item => item != null && !item.hidden);
|
|
703
|
-
if (normalizedList.length === 0) {
|
|
704
|
-
return null;
|
|
705
|
-
}
|
|
706
|
-
const width = parseColumnWidth(column?.width);
|
|
707
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
708
|
-
className: classnames__default["default"](wrapperClassName, style$6['options-column']),
|
|
709
|
-
style: width > 0 ? {
|
|
710
|
-
'--max-width': `${width}px`
|
|
711
|
-
} : undefined,
|
|
712
|
-
children: /*#__PURE__*/jsxRuntime.jsx(ButtonGroup__default["default"], {
|
|
713
|
-
moreType: "link",
|
|
714
|
-
itemClassName: "btn-no-padding",
|
|
715
|
-
list: normalizedList,
|
|
716
|
-
...buttonGroupProps
|
|
717
|
-
})
|
|
718
|
-
});
|
|
719
|
-
};
|
|
720
|
-
|
|
721
|
-
const enumRender = value => tag(value);
|
|
722
|
-
|
|
723
|
-
const description = value => value;
|
|
724
|
-
|
|
725
|
-
const renderType = {
|
|
726
|
-
default: defaultRender,
|
|
727
|
-
main,
|
|
728
|
-
amount,
|
|
729
|
-
tag,
|
|
730
|
-
tagList,
|
|
731
|
-
status,
|
|
732
|
-
list,
|
|
733
|
-
options,
|
|
734
|
-
enum: enumRender,
|
|
735
|
-
description
|
|
736
|
-
};
|
|
737
|
-
globalParams.renderType = renderType;
|
|
738
|
-
|
|
739
|
-
const _excluded$3 = ["default"];
|
|
740
|
-
const SIZE_NAMES = ['short', 'small', 'large'];
|
|
741
|
-
const typeSize = {
|
|
742
|
-
main: {
|
|
743
|
-
width: 300,
|
|
744
|
-
min: 160,
|
|
745
|
-
max: 500,
|
|
746
|
-
ellipsis: true
|
|
747
|
-
},
|
|
748
|
-
amount: {
|
|
749
|
-
width: 140,
|
|
750
|
-
min: 100,
|
|
751
|
-
max: 300,
|
|
752
|
-
ellipsis: true
|
|
753
|
-
},
|
|
754
|
-
options: {
|
|
755
|
-
width: 180,
|
|
756
|
-
min: 120,
|
|
757
|
-
max: 400
|
|
758
|
-
},
|
|
759
|
-
enum: {
|
|
760
|
-
width: 140,
|
|
761
|
-
min: 100,
|
|
762
|
-
max: 400
|
|
763
|
-
},
|
|
764
|
-
tag: {
|
|
765
|
-
width: 140,
|
|
766
|
-
min: 100,
|
|
767
|
-
max: 400
|
|
768
|
-
},
|
|
769
|
-
status: {
|
|
770
|
-
width: 100,
|
|
771
|
-
min: 80,
|
|
772
|
-
max: 140
|
|
773
|
-
},
|
|
774
|
-
tagList: {
|
|
775
|
-
width: 300,
|
|
776
|
-
min: 160,
|
|
777
|
-
max: 500
|
|
778
|
-
},
|
|
779
|
-
list: {
|
|
780
|
-
width: 200,
|
|
781
|
-
min: 120,
|
|
782
|
-
max: 400,
|
|
783
|
-
ellipsis: true
|
|
784
|
-
},
|
|
785
|
-
description: {
|
|
786
|
-
width: 400,
|
|
787
|
-
min: 160,
|
|
788
|
-
max: 600,
|
|
789
|
-
ellipsis: true
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
const SIZE_CONFIG = {
|
|
793
|
-
short: {
|
|
794
|
-
width: 120,
|
|
795
|
-
min: 100,
|
|
796
|
-
max: 400
|
|
797
|
-
},
|
|
798
|
-
small: {
|
|
799
|
-
width: 100,
|
|
800
|
-
min: 70,
|
|
801
|
-
max: 400
|
|
802
|
-
},
|
|
803
|
-
default: {
|
|
804
|
-
width: 300,
|
|
805
|
-
min: 160,
|
|
806
|
-
max: 500
|
|
807
|
-
},
|
|
808
|
-
large: {
|
|
809
|
-
width: 300,
|
|
810
|
-
min: 120,
|
|
811
|
-
max: 500
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
const getRenderTypeRegistry = () => {
|
|
815
|
-
const _ref = globalParams.renderType || {},
|
|
816
|
-
defaultRender = _ref.default,
|
|
817
|
-
renderers = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
818
|
-
return {
|
|
819
|
-
defaultRender,
|
|
820
|
-
renderers
|
|
821
|
-
};
|
|
822
|
-
};
|
|
823
|
-
const getRenderTypeNames = () => Object.keys(getRenderTypeRegistry().renderers);
|
|
824
|
-
const RENDER_TYPE_NAMES = getRenderTypeNames();
|
|
825
|
-
const getRender = type => {
|
|
826
|
-
const _getRenderTypeRegistr = getRenderTypeRegistry(),
|
|
827
|
-
defaultRender = _getRenderTypeRegistr.defaultRender,
|
|
828
|
-
renderers = _getRenderTypeRegistr.renderers;
|
|
829
|
-
return renderers[type] || defaultRender;
|
|
830
|
-
};
|
|
831
|
-
const getColumnRender = column => {
|
|
832
|
-
if (typeof (column == null ? void 0 : column.render) === 'function') {
|
|
833
|
-
return column.render;
|
|
834
|
-
}
|
|
835
|
-
const _parseRenderType = parseRenderType(column == null ? void 0 : column.renderType),
|
|
836
|
-
type = _parseRenderType.type;
|
|
837
|
-
if (!type) {
|
|
838
|
-
return null;
|
|
839
|
-
}
|
|
840
|
-
return getRender(type);
|
|
841
|
-
};
|
|
842
|
-
const getTypeConfigMap = () => {
|
|
843
|
-
const extraTypeSize = globalParams.renderTypeSize || {};
|
|
844
|
-
return getRenderTypeNames().reduce((result, key) => {
|
|
845
|
-
result[key] = Object.assign({}, typeSize[key], extraTypeSize[key], {
|
|
846
|
-
render: getRender(key)
|
|
847
|
-
});
|
|
848
|
-
return result;
|
|
849
|
-
}, {});
|
|
850
|
-
};
|
|
851
|
-
const pickDimension = (columnValue, typeValue, sizeValue) => {
|
|
852
|
-
if (columnValue != null) {
|
|
853
|
-
return columnValue;
|
|
854
|
-
}
|
|
855
|
-
if (sizeValue != null) {
|
|
856
|
-
return sizeValue;
|
|
857
|
-
}
|
|
858
|
-
if (typeValue != null) {
|
|
859
|
-
return typeValue;
|
|
860
|
-
}
|
|
861
|
-
return undefined;
|
|
862
|
-
};
|
|
863
|
-
const parseRenderType = renderTypeValue => {
|
|
864
|
-
if (!renderTypeValue || typeof renderTypeValue !== 'string') {
|
|
865
|
-
return {
|
|
866
|
-
type: null,
|
|
867
|
-
size: null
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
const renderTypeNames = getRenderTypeNames();
|
|
871
|
-
let type = null;
|
|
872
|
-
let size = null;
|
|
873
|
-
renderTypeValue.split('-').forEach(part => {
|
|
874
|
-
if (!part) {
|
|
875
|
-
return;
|
|
876
|
-
}
|
|
877
|
-
if (renderTypeNames.includes(part)) {
|
|
878
|
-
type = part;
|
|
879
|
-
return;
|
|
880
|
-
}
|
|
881
|
-
if (SIZE_NAMES.includes(part)) {
|
|
882
|
-
size = part;
|
|
883
|
-
}
|
|
884
|
-
});
|
|
885
|
-
return {
|
|
886
|
-
type,
|
|
887
|
-
size
|
|
888
|
-
};
|
|
889
|
-
};
|
|
890
|
-
const getRenderTypeDimensions = renderTypeValue => {
|
|
891
|
-
const _parseRenderType2 = parseRenderType(renderTypeValue),
|
|
892
|
-
type = _parseRenderType2.type,
|
|
893
|
-
size = _parseRenderType2.size;
|
|
894
|
-
const typeConfigMap = getTypeConfigMap();
|
|
895
|
-
const typeConfig = type ? typeConfigMap[type] : null;
|
|
896
|
-
const sizeConfig = size ? SIZE_CONFIG[size] : null;
|
|
897
|
-
if (!typeConfig && !sizeConfig) {
|
|
898
|
-
return null;
|
|
899
|
-
}
|
|
900
|
-
return {
|
|
901
|
-
type,
|
|
902
|
-
size,
|
|
903
|
-
typeConfig,
|
|
904
|
-
sizeConfig,
|
|
905
|
-
render: typeConfig == null ? void 0 : typeConfig.render,
|
|
906
|
-
ellipsis: typeConfig == null ? void 0 : typeConfig.ellipsis
|
|
907
|
-
};
|
|
908
|
-
};
|
|
909
|
-
const resolveColumnDimensions = column => {
|
|
910
|
-
const renderTypeDimensions = column != null && column.renderType ? getRenderTypeDimensions(column.renderType) : null;
|
|
911
|
-
const typeConfig = renderTypeDimensions == null ? void 0 : renderTypeDimensions.typeConfig;
|
|
912
|
-
const sizeConfig = renderTypeDimensions == null ? void 0 : renderTypeDimensions.sizeConfig;
|
|
913
|
-
return {
|
|
914
|
-
width: pickDimension(column == null ? void 0 : column.width, typeConfig == null ? void 0 : typeConfig.width, sizeConfig == null ? void 0 : sizeConfig.width),
|
|
915
|
-
min: pickDimension(column == null ? void 0 : column.min, typeConfig == null ? void 0 : typeConfig.min, sizeConfig == null ? void 0 : sizeConfig.min),
|
|
916
|
-
max: pickDimension(column == null ? void 0 : column.max, typeConfig == null ? void 0 : typeConfig.max, sizeConfig == null ? void 0 : sizeConfig.max)
|
|
917
|
-
};
|
|
918
|
-
};
|
|
919
|
-
const resolveRenderType = renderTypeValue => {
|
|
920
|
-
var _sizeConfig$width, _sizeConfig$min, _sizeConfig$max;
|
|
921
|
-
const renderTypeDimensions = getRenderTypeDimensions(renderTypeValue);
|
|
922
|
-
if (!renderTypeDimensions) {
|
|
923
|
-
return null;
|
|
924
|
-
}
|
|
925
|
-
const type = renderTypeDimensions.type,
|
|
926
|
-
size = renderTypeDimensions.size,
|
|
927
|
-
render = renderTypeDimensions.render,
|
|
928
|
-
ellipsis = renderTypeDimensions.ellipsis,
|
|
929
|
-
typeConfig = renderTypeDimensions.typeConfig,
|
|
930
|
-
sizeConfig = renderTypeDimensions.sizeConfig;
|
|
931
|
-
return {
|
|
932
|
-
type,
|
|
933
|
-
size,
|
|
934
|
-
render,
|
|
935
|
-
ellipsis,
|
|
936
|
-
width: (_sizeConfig$width = sizeConfig == null ? void 0 : sizeConfig.width) != null ? _sizeConfig$width : typeConfig == null ? void 0 : typeConfig.width,
|
|
937
|
-
min: (_sizeConfig$min = sizeConfig == null ? void 0 : sizeConfig.min) != null ? _sizeConfig$min : typeConfig == null ? void 0 : typeConfig.min,
|
|
938
|
-
max: (_sizeConfig$max = sizeConfig == null ? void 0 : sizeConfig.max) != null ? _sizeConfig$max : typeConfig == null ? void 0 : typeConfig.max
|
|
939
|
-
};
|
|
940
|
-
};
|
|
941
|
-
const ELLIPSIS_HANDLED_TYPES = ['main', 'amount'];
|
|
942
|
-
const FULL_WIDTH_CELL_TYPES = ['options'];
|
|
943
|
-
const resolveColumn = column => {
|
|
944
|
-
if (!column) {
|
|
945
|
-
return column;
|
|
946
|
-
}
|
|
947
|
-
const renderTypeDimensions = column.renderType ? getRenderTypeDimensions(column.renderType) : null;
|
|
948
|
-
const _resolveColumnDimensi = resolveColumnDimensions(column),
|
|
949
|
-
width = _resolveColumnDimensi.width,
|
|
950
|
-
min = _resolveColumnDimensi.min,
|
|
951
|
-
max = _resolveColumnDimensi.max;
|
|
952
|
-
const _ref2 = renderTypeDimensions || {},
|
|
953
|
-
ellipsis = _ref2.ellipsis,
|
|
954
|
-
type = _ref2.type;
|
|
955
|
-
const renderFn = getColumnRender(column);
|
|
956
|
-
return Object.assign({}, column, _extends({}, renderFn && typeof column.render !== 'function' ? {
|
|
957
|
-
render: renderFn
|
|
958
|
-
} : {}, column.width == null && width != null ? {
|
|
959
|
-
width
|
|
960
|
-
} : {}, column.min == null && min != null ? {
|
|
961
|
-
min
|
|
962
|
-
} : {}, column.max == null && max != null ? {
|
|
963
|
-
max
|
|
964
|
-
} : {}, column.ellipsis == null && ellipsis != null ? {
|
|
965
|
-
ellipsis
|
|
966
|
-
} : {}, type && ELLIPSIS_HANDLED_TYPES.includes(type) ? {
|
|
967
|
-
ellipsisHandledByRender: true
|
|
968
|
-
} : {}, type && FULL_WIDTH_CELL_TYPES.includes(type) ? {
|
|
969
|
-
cellFullWidth: true
|
|
970
|
-
} : {}, column.type === 'options' && !type ? {
|
|
971
|
-
cellFullWidth: true
|
|
972
|
-
} : {}, type === 'options' && column.type !== 'options' ? {
|
|
973
|
-
type: 'options'
|
|
974
|
-
} : {}));
|
|
975
|
-
};
|
|
976
|
-
const resolveColumns = columns => (columns || []).map(resolveColumn);
|
|
977
|
-
const isOptionsColumn = column => {
|
|
978
|
-
if ((column == null ? void 0 : column.type) === 'options') {
|
|
979
|
-
return true;
|
|
980
|
-
}
|
|
981
|
-
return parseRenderType(column == null ? void 0 : column.renderType).type === 'options';
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
const computeColumnsValue = ({
|
|
985
|
-
columns,
|
|
986
|
-
emptyIsPlaceholder,
|
|
987
|
-
valueIsEmpty,
|
|
988
|
-
removeEmpty = true,
|
|
989
|
-
dataSource,
|
|
990
|
-
context
|
|
991
|
-
}) => {
|
|
992
|
-
return (output => removeEmpty ? output.filter(item => !!item) : output)(columns.map(item => {
|
|
993
|
-
const itemValue = typeof item.getValueOf === 'function' ? item.getValueOf(dataSource, {
|
|
994
|
-
column: item,
|
|
995
|
-
context
|
|
996
|
-
}) : get__default["default"](dataSource, item.name);
|
|
997
|
-
const displayValue = (value => {
|
|
998
|
-
if (typeof item.format === 'function') {
|
|
999
|
-
return item.format(value, {
|
|
1000
|
-
dataSource,
|
|
1001
|
-
column: item,
|
|
1002
|
-
context
|
|
1003
|
-
});
|
|
1004
|
-
}
|
|
1005
|
-
if (typeof item.format === 'string') {
|
|
1006
|
-
const formatValue = formatView(value, item.format, {
|
|
1007
|
-
dataSource,
|
|
1008
|
-
column: item,
|
|
1009
|
-
context
|
|
1010
|
-
});
|
|
1011
|
-
if (formatValue) {
|
|
1012
|
-
return formatValue;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
return value;
|
|
1016
|
-
})(itemValue);
|
|
1017
|
-
const itemIsEmpty = (item.valueIsEmpty || valueIsEmpty)(itemValue);
|
|
1018
|
-
if (item.display === false || typeof item.display === 'function' && item.display(itemValue, {
|
|
1019
|
-
dataSource,
|
|
1020
|
-
column: item,
|
|
1021
|
-
context
|
|
1022
|
-
}) === false) {
|
|
1023
|
-
return null;
|
|
1024
|
-
}
|
|
1025
|
-
if (!(item.hasOwnProperty('emptyIsPlaceholder') ? item.emptyIsPlaceholder : emptyIsPlaceholder) && itemIsEmpty) {
|
|
1026
|
-
return null;
|
|
1027
|
-
}
|
|
1028
|
-
return Object.assign({}, item, {
|
|
1029
|
-
isEmpty: itemIsEmpty,
|
|
1030
|
-
value: displayValue
|
|
1031
|
-
});
|
|
1032
|
-
}));
|
|
1033
|
-
};
|
|
1034
|
-
const computeDisplay = ({
|
|
1035
|
-
column,
|
|
1036
|
-
dataSource,
|
|
1037
|
-
placeholder,
|
|
1038
|
-
context
|
|
1039
|
-
}) => {
|
|
1040
|
-
if (column.isEmpty) {
|
|
1041
|
-
return typeof column.renderPlaceholder === 'function' ? column.renderPlaceholder({
|
|
1042
|
-
column: column,
|
|
1043
|
-
dataSource,
|
|
1044
|
-
placeholder,
|
|
1045
|
-
context
|
|
1046
|
-
}) : column.placeholder || placeholder;
|
|
1047
|
-
}
|
|
1048
|
-
const render = getColumnRender(column);
|
|
1049
|
-
return typeof render === 'function' ? render(column.value, {
|
|
1050
|
-
column,
|
|
1051
|
-
dataSource,
|
|
1052
|
-
context
|
|
1053
|
-
}) : column.value;
|
|
1054
|
-
};
|
|
1055
|
-
const computeColumnsDisplay = ({
|
|
1056
|
-
columns,
|
|
1057
|
-
emptyIsPlaceholder,
|
|
1058
|
-
valueIsEmpty,
|
|
1059
|
-
removeEmpty,
|
|
1060
|
-
dataSource,
|
|
1061
|
-
placeholder,
|
|
1062
|
-
context
|
|
1063
|
-
}) => {
|
|
1064
|
-
return computeColumnsValue({
|
|
1065
|
-
columns,
|
|
1066
|
-
emptyIsPlaceholder,
|
|
1067
|
-
valueIsEmpty,
|
|
1068
|
-
removeEmpty,
|
|
1069
|
-
dataSource,
|
|
1070
|
-
context
|
|
1071
|
-
}).map(column => {
|
|
1072
|
-
return computeDisplay({
|
|
1073
|
-
column,
|
|
1074
|
-
placeholder,
|
|
1075
|
-
dataSource,
|
|
1076
|
-
context
|
|
1077
|
-
});
|
|
1078
|
-
});
|
|
1079
|
-
};
|
|
1080
|
-
computeColumnsValue.computeDisplay = computeDisplay;
|
|
1081
|
-
computeColumnsValue.computeColumnsDisplay = computeColumnsDisplay;
|
|
1082
|
-
|
|
1083
|
-
var style$5 = {"table":"kne-table-page_lZgIW","header":"kne-table-page_d1qN5","col":"kne-table-page_KNy4z","tableView":"kne-table-page_fUw6j","grid":"kne-table-page_JlDmf","header-cell":"kne-table-page_P-ebv","col-content":"kne-table-page_HT5Rr","body-row":"kne-table-page_Z6mVv","body-cell":"kne-table-page_BSOzz","body":"kne-table-page_9qon1","is-selected-all":"kne-table-page_f2i1e","is-selected":"kne-table-page_n3V6m","is-disabled":"kne-table-page_AfmkR","col-width-based":"kne-table-page_ZvnDi","col-width-fill":"kne-table-page_cV7PE","single-checked":"kne-table-page_9UAoL","col-fixed":"kne-table-page_aB-1c","empty":"kne-table-page_SRI8Q"};
|
|
1084
|
-
|
|
1085
|
-
var style$4 = {"table":"kne-table-page_awa1L","is-selected-all":"kne-table-page_692q3","is-selected":"kne-table-page_IWgjl","is-disabled":"kne-table-page_YUG4k","has-summary":"kne-table-page_Cb-du","has-group-header":"kne-table-page_7qTC5","is-sticky":"kne-table-page_jGzIR","is-sticky-scroll-y":"kne-table-page_P6lxG","is-sticky-viewport":"kne-table-page_Kr-p6","table-cell":"kne-table-page_HPmr3","selection-col":"kne-table-page_D7YhS","radio-col":"kne-table-page_df9z3","is-computed":"kne-table-page_ZA1Je","is-resize":"kne-table-page_CA0uL","column-resize-guide":"kne-table-page_JARA2"};
|
|
1086
|
-
|
|
1087
|
-
const useSelectedRow = options => {
|
|
1088
|
-
const _Object$assign = Object.assign({}, {
|
|
1089
|
-
rowKey: 'id'
|
|
1090
|
-
}, options),
|
|
1091
|
-
rowKey = _Object$assign.rowKey,
|
|
1092
|
-
_Object$assign$type = _Object$assign.type,
|
|
1093
|
-
type = _Object$assign$type === void 0 ? 'checkbox' : _Object$assign$type;
|
|
1094
|
-
const _useState = react.useState([]),
|
|
1095
|
-
selectedRows = _useState[0],
|
|
1096
|
-
setSelectedRows = _useState[1];
|
|
1097
|
-
const getRowId = react.useCallback(item => get__default["default"](item, typeof rowKey === 'function' ? rowKey(item) : rowKey), [rowKey]);
|
|
1098
|
-
const selectedRowKeys = react.useMemo(() => selectedRows.map(getRowId), [getRowId, selectedRows]);
|
|
1099
|
-
const setSelectedRowKeys = react.useCallback(function (keys, dataSource) {
|
|
1100
|
-
if (dataSource === void 0) {
|
|
1101
|
-
dataSource = [];
|
|
1102
|
-
}
|
|
1103
|
-
const keySet = new Set(keys || []);
|
|
1104
|
-
setSelectedRows((dataSource || []).filter(item => keySet.has(getRowId(item))));
|
|
1105
|
-
}, [getRowId]);
|
|
1106
|
-
const clearSelectedRows = react.useCallback(() => {
|
|
1107
|
-
setSelectedRows([]);
|
|
1108
|
-
}, []);
|
|
1109
|
-
const onSelectAll = react.useCallback((checked, _selected, items) => {
|
|
1110
|
-
const ids = (items || []).map(getRowId);
|
|
1111
|
-
if (checked) {
|
|
1112
|
-
setSelectedRows(value => {
|
|
1113
|
-
const existingKeys = value.map(getRowId);
|
|
1114
|
-
return [...value, ...(items || []).filter(item => existingKeys.indexOf(getRowId(item)) === -1)];
|
|
1115
|
-
});
|
|
1116
|
-
} else {
|
|
1117
|
-
setSelectedRows(value => {
|
|
1118
|
-
return value.filter(item => ids.indexOf(getRowId(item)) === -1);
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
}, [getRowId]);
|
|
1122
|
-
const onSelect = react.useCallback((item, checked) => {
|
|
1123
|
-
if (checked) {
|
|
1124
|
-
if (type === 'radio') {
|
|
1125
|
-
setSelectedRows([item]);
|
|
1126
|
-
return;
|
|
1127
|
-
}
|
|
1128
|
-
setSelectedRows(value => {
|
|
1129
|
-
const newValue = value.slice(0);
|
|
1130
|
-
newValue.push(item);
|
|
1131
|
-
return newValue;
|
|
1132
|
-
});
|
|
1133
|
-
} else {
|
|
1134
|
-
setSelectedRows(value => {
|
|
1135
|
-
const newValue = value.slice(0);
|
|
1136
|
-
const index = newValue.findIndex(row => getRowId(row) === getRowId(item));
|
|
1137
|
-
if (index > -1) {
|
|
1138
|
-
newValue.splice(index, 1);
|
|
1139
|
-
}
|
|
1140
|
-
return newValue;
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
}, [getRowId, type]);
|
|
1144
|
-
const getRowSelection = react.useCallback(function (dataSource, extra) {
|
|
1145
|
-
if (extra === void 0) {
|
|
1146
|
-
extra = {};
|
|
1147
|
-
}
|
|
1148
|
-
const onChange = (keys, id, meta) => {
|
|
1149
|
-
setSelectedRowKeys(keys, dataSource);
|
|
1150
|
-
extra.onChange && extra.onChange(keys, id, meta);
|
|
1151
|
-
};
|
|
1152
|
-
return Object.assign({
|
|
1153
|
-
type,
|
|
1154
|
-
selectedRowKeys,
|
|
1155
|
-
allowSelectedAll: type === 'checkbox',
|
|
1156
|
-
onChange
|
|
1157
|
-
}, extra);
|
|
1158
|
-
}, [selectedRowKeys, setSelectedRowKeys, type]);
|
|
1159
|
-
return {
|
|
1160
|
-
type,
|
|
1161
|
-
selectedRowKeys,
|
|
1162
|
-
selectedRows,
|
|
1163
|
-
onSelectAll,
|
|
1164
|
-
onSelect,
|
|
1165
|
-
setSelectedRows,
|
|
1166
|
-
setSelectedRowKeys,
|
|
1167
|
-
clearSelectedRows,
|
|
1168
|
-
getRowSelection
|
|
1169
|
-
};
|
|
1170
|
-
};
|
|
1171
|
-
|
|
1172
|
-
var style$3 = {"title":"kne-table-page_Yn7Wc","title-text":"kne-table-page_QhSty","has-sort":"kne-table-page_YaVIX","sort-btn":"kne-table-page_XkYCi","sort-icon":"kne-table-page_SSGYi","active":"kne-table-page_VT0uN","sort-up":"kne-table-page_CIokw","sort-down":"kne-table-page_5xrlc"};
|
|
10
|
+
var useRefCallback = require('@kne/use-ref-callback');
|
|
11
|
+
var transform = require('lodash/transform');
|
|
12
|
+
var pick = require('lodash/pick');
|
|
13
|
+
var findLastIndex = require('lodash/findLastIndex');
|
|
14
|
+
var isEqual = require('lodash/isEqual');
|
|
15
|
+
var icons = require('@ant-design/icons');
|
|
16
|
+
var useDebounce = require('use-debounce');
|
|
17
|
+
var groupBy = require('lodash/groupBy');
|
|
18
|
+
var reactSortablejs = require('react-sortablejs');
|
|
19
|
+
var cloneDeep = require('lodash/cloneDeep');
|
|
20
|
+
var reactIntl = require('@kne/react-intl');
|
|
21
|
+
var filterZhCN = require('@kne/react-filter/dist/locale/zh-CN');
|
|
22
|
+
var filterEnUS = require('@kne/react-filter/dist/locale/en-US');
|
|
23
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
24
|
+
var reactDom = require('react-dom');
|
|
25
|
+
require('@kne/react-filter/dist/index.css');
|
|
1173
26
|
|
|
1174
|
-
|
|
27
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
1175
28
|
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
1188
|
-
className: style$2['ellipsis'],
|
|
1189
|
-
children: title
|
|
1190
|
-
});
|
|
1191
|
-
};
|
|
29
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
30
|
+
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
31
|
+
var useRefCallback__default = /*#__PURE__*/_interopDefaultLegacy(useRefCallback);
|
|
32
|
+
var transform__default = /*#__PURE__*/_interopDefaultLegacy(transform);
|
|
33
|
+
var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
|
|
34
|
+
var findLastIndex__default = /*#__PURE__*/_interopDefaultLegacy(findLastIndex);
|
|
35
|
+
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
36
|
+
var groupBy__default = /*#__PURE__*/_interopDefaultLegacy(groupBy);
|
|
37
|
+
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
38
|
+
var filterZhCN__default = /*#__PURE__*/_interopDefaultLegacy(filterZhCN);
|
|
39
|
+
var filterEnUS__default = /*#__PURE__*/_interopDefaultLegacy(filterEnUS);
|
|
1192
40
|
|
|
1193
|
-
|
|
1194
|
-
return
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
defaultValue = _ref.defaultValue,
|
|
1199
|
-
onChange = _ref.onChange;
|
|
1200
|
-
const _useState = react.useState(defaultValue),
|
|
1201
|
-
internalValue = _useState[0],
|
|
1202
|
-
setInternalValue = _useState[1];
|
|
1203
|
-
const isControlled = value !== undefined;
|
|
1204
|
-
const currentValue = isControlled ? value : internalValue;
|
|
1205
|
-
const setValue = react.useCallback(updater => {
|
|
1206
|
-
const nextValue = typeof updater === 'function' ? updater(currentValue) : updater;
|
|
1207
|
-
if (!isControlled) {
|
|
1208
|
-
setInternalValue(nextValue);
|
|
1209
|
-
}
|
|
1210
|
-
onChange && onChange(nextValue);
|
|
1211
|
-
}, [currentValue, isControlled, onChange]);
|
|
1212
|
-
return [currentValue, setValue];
|
|
1213
|
-
};
|
|
1214
|
-
const compareValues = (a, b, direction) => {
|
|
1215
|
-
const emptyA = a == null || a === '';
|
|
1216
|
-
const emptyB = b == null || b === '';
|
|
1217
|
-
if (emptyA && emptyB) {
|
|
1218
|
-
return 0;
|
|
1219
|
-
}
|
|
1220
|
-
if (emptyA) {
|
|
1221
|
-
return 1;
|
|
1222
|
-
}
|
|
1223
|
-
if (emptyB) {
|
|
1224
|
-
return -1;
|
|
1225
|
-
}
|
|
1226
|
-
if (typeof a === 'number' && typeof b === 'number') {
|
|
1227
|
-
return direction === 'ASC' ? a - b : b - a;
|
|
1228
|
-
}
|
|
1229
|
-
const strA = String(a);
|
|
1230
|
-
const strB = String(b);
|
|
1231
|
-
return direction === 'ASC' ? strA.localeCompare(strB, 'zh-CN') : strB.localeCompare(strA, 'zh-CN');
|
|
1232
|
-
};
|
|
1233
|
-
const sortDataSource = function (dataSource, sort, columns) {
|
|
1234
|
-
var _sort;
|
|
1235
|
-
if (sort === void 0) {
|
|
1236
|
-
sort = [];
|
|
1237
|
-
}
|
|
1238
|
-
if (columns === void 0) {
|
|
1239
|
-
columns = [];
|
|
1240
|
-
}
|
|
1241
|
-
if (!((_sort = sort) != null && _sort.length) || !(dataSource != null && dataSource.length)) {
|
|
1242
|
-
return dataSource;
|
|
1243
|
-
}
|
|
1244
|
-
const columnMap = new Map(columns.map(column => [column.name, column]));
|
|
1245
|
-
return [...dataSource].sort((a, b) => {
|
|
1246
|
-
for (const _ref2 of sort) {
|
|
1247
|
-
const name = _ref2.name;
|
|
1248
|
-
const direction = _ref2.sort;
|
|
1249
|
-
const column = columnMap.get(name) || {
|
|
1250
|
-
name
|
|
1251
|
-
};
|
|
1252
|
-
const aVal = typeof column.getValueOf === 'function' ? column.getValueOf(a, {
|
|
1253
|
-
column
|
|
1254
|
-
}) : get__default["default"](a, name);
|
|
1255
|
-
const bVal = typeof column.getValueOf === 'function' ? column.getValueOf(b, {
|
|
1256
|
-
column
|
|
1257
|
-
}) : get__default["default"](b, name);
|
|
1258
|
-
const result = compareValues(aVal, bVal, direction);
|
|
1259
|
-
if (result !== 0) {
|
|
1260
|
-
return result;
|
|
1261
|
-
}
|
|
41
|
+
function _extends() {
|
|
42
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
43
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
44
|
+
var t = arguments[e];
|
|
45
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1262
46
|
}
|
|
1263
|
-
return
|
|
1264
|
-
});
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
if (
|
|
1268
|
-
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
const renderColumnTitle = (title, column, sortRender) => {
|
|
1273
|
-
const titleContent = wrapColumnHeaderTitle(title);
|
|
1274
|
-
if (!column.sort || typeof sortRender !== 'function') {
|
|
1275
|
-
return titleContent;
|
|
1276
|
-
}
|
|
1277
|
-
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
1278
|
-
className: classnames__default["default"](style$3['title'], style$3['has-sort']),
|
|
1279
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
1280
|
-
className: style$3['title-text'],
|
|
1281
|
-
children: titleContent
|
|
1282
|
-
}), sortRender({
|
|
1283
|
-
name: column.name,
|
|
1284
|
-
single: getSortSingle(column.sort)
|
|
1285
|
-
})]
|
|
1286
|
-
});
|
|
1287
|
-
};
|
|
1288
|
-
const useSort = function (props) {
|
|
1289
|
-
if (props === void 0) {
|
|
1290
|
-
props = {};
|
|
47
|
+
return n;
|
|
48
|
+
}, _extends.apply(null, arguments);
|
|
49
|
+
}
|
|
50
|
+
function _objectWithoutPropertiesLoose(r, e) {
|
|
51
|
+
if (null == r) return {};
|
|
52
|
+
var t = {};
|
|
53
|
+
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
54
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
55
|
+
t[n] = r[n];
|
|
1291
56
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
}),
|
|
1297
|
-
sort = _useControlValue[0],
|
|
1298
|
-
setSort = _useControlValue[1];
|
|
1299
|
-
const mapSort = react.useMemo(() => {
|
|
1300
|
-
return sortArrayToMap(sort);
|
|
1301
|
-
}, [sort]);
|
|
1302
|
-
const setMapSort = react.useCallback(callback => {
|
|
1303
|
-
return setSort(currentSort => {
|
|
1304
|
-
const newSort = callback(sortArrayToMap(currentSort));
|
|
1305
|
-
return Array.from(newSort).map(_ref3 => {
|
|
1306
|
-
let name = _ref3[0],
|
|
1307
|
-
sortValue = _ref3[1];
|
|
1308
|
-
return {
|
|
1309
|
-
name,
|
|
1310
|
-
sort: sortValue
|
|
1311
|
-
};
|
|
1312
|
-
});
|
|
1313
|
-
});
|
|
1314
|
-
}, [setSort]);
|
|
1315
|
-
const sortRender = react.useCallback(_ref4 => {
|
|
1316
|
-
let single = _ref4.single,
|
|
1317
|
-
name = _ref4.name;
|
|
1318
|
-
const direction = mapSort.get(name);
|
|
1319
|
-
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
1320
|
-
className: style$3['sort-btn'],
|
|
1321
|
-
onClick: e => {
|
|
1322
|
-
e.stopPropagation();
|
|
1323
|
-
setMapSort(sortMap => {
|
|
1324
|
-
const current = sortMap.get(name);
|
|
1325
|
-
const targetValue = (() => {
|
|
1326
|
-
if (current === 'DESC') {
|
|
1327
|
-
return 'ASC';
|
|
1328
|
-
}
|
|
1329
|
-
if (current === 'ASC') {
|
|
1330
|
-
return null;
|
|
1331
|
-
}
|
|
1332
|
-
return 'DESC';
|
|
1333
|
-
})();
|
|
1334
|
-
if (single) {
|
|
1335
|
-
return new Map(targetValue ? [[name, targetValue]] : []);
|
|
1336
|
-
}
|
|
1337
|
-
const newSort = clone__default["default"](sortMap);
|
|
1338
|
-
targetValue ? newSort.set(name, targetValue) : newSort.delete(name);
|
|
1339
|
-
return newSort;
|
|
1340
|
-
});
|
|
1341
|
-
},
|
|
1342
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(icons.CaretUpOutlined, {
|
|
1343
|
-
className: classnames__default["default"](style$3['sort-icon'], style$3['sort-up'], {
|
|
1344
|
-
[style$3['active']]: direction === 'ASC'
|
|
1345
|
-
})
|
|
1346
|
-
}), /*#__PURE__*/jsxRuntime.jsx(icons.CaretDownOutlined, {
|
|
1347
|
-
className: classnames__default["default"](style$3['sort-icon'], style$3['sort-down'], {
|
|
1348
|
-
[style$3['active']]: direction === 'DESC'
|
|
1349
|
-
})
|
|
1350
|
-
})]
|
|
1351
|
-
});
|
|
1352
|
-
}, [mapSort, setMapSort]);
|
|
1353
|
-
return {
|
|
1354
|
-
sort,
|
|
1355
|
-
setSort,
|
|
1356
|
-
sortRender
|
|
1357
|
-
};
|
|
1358
|
-
};
|
|
1359
|
-
useSort.sortDataSource = sortDataSource;
|
|
57
|
+
return t;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var style$2 = {"table":"kne-table-page_awa1L","is-selected-all":"kne-table-page_692q3","is-selected":"kne-table-page_IWgjl","is-disabled":"kne-table-page_YUG4k","has-summary":"kne-table-page_Cb-du","has-group-header":"kne-table-page_7qTC5","is-sticky":"kne-table-page_jGzIR","is-sticky-scroll-y":"kne-table-page_P6lxG","is-sticky-viewport":"kne-table-page_Kr-p6","col-content":"kne-table-page_CWr3V","empty":"kne-table-page_BoatL","table-cell":"kne-table-page_HPmr3","selection-col":"kne-table-page_D7YhS","radio-col":"kne-table-page_df9z3","is-computed":"kne-table-page_ZA1Je","is-resize":"kne-table-page_CA0uL","column-resize-guide":"kne-table-page_JARA2"};
|
|
1360
61
|
|
|
1361
62
|
const getColumnConfig = (config, columnName, field, defaultValue) => {
|
|
1362
63
|
const columnConfig = config?.[columnName];
|
|
@@ -1746,7 +447,7 @@ const DEFAULT_MIN = 80;
|
|
|
1746
447
|
const DEFAULT_MAX = 600;
|
|
1747
448
|
const getColumnSize = column => {
|
|
1748
449
|
var _column$min, _column$max;
|
|
1749
|
-
const width = parseColumnWidth(column.width) || DEFAULT_WIDTH;
|
|
450
|
+
const width = tableView.parseColumnWidth(column.width) || DEFAULT_WIDTH;
|
|
1750
451
|
return {
|
|
1751
452
|
width,
|
|
1752
453
|
min: (_column$min = column.min) != null ? _column$min : DEFAULT_MIN,
|
|
@@ -1857,7 +558,7 @@ const useTableConfig = _ref2 => {
|
|
|
1857
558
|
const columnCount = visibleColumns.length;
|
|
1858
559
|
const hasFixedColumn = react.useMemo(() => visibleColumns.some(col => col.fixed === 'right' || col.fixed === 'left' || col.fixed === true), [visibleColumns]);
|
|
1859
560
|
const lastNotFixedColumnIndex = react.useMemo(() => {
|
|
1860
|
-
return findLastIndex__default["default"](visibleColumns, col => col.fixed !== 'right' && !isOptionsColumn(col));
|
|
561
|
+
return findLastIndex__default["default"](visibleColumns, col => col.fixed !== 'right' && !tableView.isOptionsColumn(col));
|
|
1861
562
|
}, [visibleColumns]);
|
|
1862
563
|
const totalWidth = react.useMemo(() => {
|
|
1863
564
|
return visibleColumns.reduce((sum, col, index) => {
|
|
@@ -2088,28 +789,6 @@ const useElementWidth = ref => {
|
|
|
2088
789
|
return width;
|
|
2089
790
|
};
|
|
2090
791
|
|
|
2091
|
-
const renderCellContent = (content, column, contentClassName) => {
|
|
2092
|
-
const wrapEllipsis = column.ellipsis && !column.ellipsisHandledByRender;
|
|
2093
|
-
const needsWidthConstraint = Boolean(column.ellipsis || column.cellFullWidth);
|
|
2094
|
-
const inner = wrapEllipsis ? /*#__PURE__*/jsxRuntime.jsx(Ellipsis, {
|
|
2095
|
-
ellipsis: column.ellipsis,
|
|
2096
|
-
children: content
|
|
2097
|
-
}) : content;
|
|
2098
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2099
|
-
className: contentClassName,
|
|
2100
|
-
children: needsWidthConstraint ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2101
|
-
className: classnames__default["default"](ellipsisStyle['cell-content'], column.cellFullWidth && ellipsisStyle['cell-full-width']),
|
|
2102
|
-
children: inner
|
|
2103
|
-
}) : inner
|
|
2104
|
-
});
|
|
2105
|
-
};
|
|
2106
|
-
const getColumnEllipsis = column => {
|
|
2107
|
-
if (!column.ellipsis) {
|
|
2108
|
-
return undefined;
|
|
2109
|
-
}
|
|
2110
|
-
return typeof column.ellipsis === 'object' ? column.ellipsis : true;
|
|
2111
|
-
};
|
|
2112
|
-
|
|
2113
792
|
const parsePixelValue = value => {
|
|
2114
793
|
const num = parseFloat(value);
|
|
2115
794
|
return Number.isNaN(num) ? 0 : num;
|
|
@@ -2354,7 +1033,7 @@ const observeViewportIntersection = (element, onChange) => {
|
|
|
2354
1033
|
};
|
|
2355
1034
|
};
|
|
2356
1035
|
|
|
2357
|
-
const _excluded$
|
|
1036
|
+
const _excluded$1 = ["className", "dataSource", "columns", "rowKey", "rowSelection", "valueIsEmpty", "emptyIsPlaceholder", "placeholder", "empty", "onRowSelect", "render", "context", "sticky", "scrollTopInset", "stickyOffset", "getStickyContainer", "headerStyle", "pagination", "sortRender", "name", "controllerOpen", "tableServerApis", "scroll", "summary"],
|
|
2358
1037
|
_excluded2$1 = ["getContainer"];
|
|
2359
1038
|
const mapJustifyToAlign = justify => {
|
|
2360
1039
|
if (justify === 'center') {
|
|
@@ -2373,7 +1052,7 @@ const toAntdWidth = width => {
|
|
|
2373
1052
|
if (typeof width === 'number') {
|
|
2374
1053
|
return width;
|
|
2375
1054
|
}
|
|
2376
|
-
const parsed = parseColumnWidth(width);
|
|
1055
|
+
const parsed = tableView.parseColumnWidth(width);
|
|
2377
1056
|
return parsed || width;
|
|
2378
1057
|
};
|
|
2379
1058
|
const toAntdFixed = fixed => {
|
|
@@ -2390,10 +1069,10 @@ const getColCellStyle = column => ({
|
|
|
2390
1069
|
verticalAlign: column.align === 'middle' ? 'middle' : column.align === 'bottom' ? 'bottom' : 'top'
|
|
2391
1070
|
});
|
|
2392
1071
|
const getAntCellClassName = function () {
|
|
2393
|
-
return classnames__default["default"](style$
|
|
1072
|
+
return classnames__default["default"](style$2['table-cell'], 'info-page-table-col', ...[].slice.call(arguments));
|
|
2394
1073
|
};
|
|
2395
1074
|
const wrapColContent = node => /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2396
|
-
className: style$
|
|
1075
|
+
className: style$2['col-content'],
|
|
2397
1076
|
children: node
|
|
2398
1077
|
});
|
|
2399
1078
|
const Table = p => {
|
|
@@ -2435,8 +1114,8 @@ const Table = p => {
|
|
|
2435
1114
|
tableServerApis = props.tableServerApis,
|
|
2436
1115
|
scroll = props.scroll,
|
|
2437
1116
|
summary = props.summary,
|
|
2438
|
-
others = _objectWithoutPropertiesLoose(props, _excluded$
|
|
2439
|
-
const columns = react.useMemo(() => resolveColumns(columnsProp), [columnsProp]);
|
|
1117
|
+
others = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
1118
|
+
const columns = react.useMemo(() => tableView.resolveColumns(columnsProp), [columnsProp]);
|
|
2440
1119
|
react.useEffect(() => {
|
|
2441
1120
|
if (tableWidth) {
|
|
2442
1121
|
setTimeout(() => setIsLayout(false), 0);
|
|
@@ -2521,13 +1200,13 @@ const Table = p => {
|
|
|
2521
1200
|
key: colName,
|
|
2522
1201
|
dataIndex: colName,
|
|
2523
1202
|
title: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2524
|
-
className: style$
|
|
2525
|
-
children: renderColumnTitle(title, column, sortRender)
|
|
1203
|
+
className: style$2['col-content'],
|
|
1204
|
+
children: tableView.renderColumnTitle(title, column, sortRender)
|
|
2526
1205
|
}),
|
|
2527
1206
|
width: toAntdWidth(width),
|
|
2528
1207
|
fixed: toAntdFixed(fixed),
|
|
2529
1208
|
align: mapJustifyToAlign(justify),
|
|
2530
|
-
ellipsis: getColumnEllipsis(column),
|
|
1209
|
+
ellipsis: tableView.getColumnEllipsis(column),
|
|
2531
1210
|
onHeaderCell: () => ({
|
|
2532
1211
|
className: getAntCellClassName(),
|
|
2533
1212
|
style: getColCellStyle(column)
|
|
@@ -2537,7 +1216,7 @@ const Table = p => {
|
|
|
2537
1216
|
style: getColCellStyle(column)
|
|
2538
1217
|
}),
|
|
2539
1218
|
render: (_, record) => {
|
|
2540
|
-
const _computeColumnsValue = computeColumnsValue({
|
|
1219
|
+
const _computeColumnsValue = tableView.computeColumnsValue({
|
|
2541
1220
|
columns: [column],
|
|
2542
1221
|
emptyIsPlaceholder,
|
|
2543
1222
|
valueIsEmpty,
|
|
@@ -2550,12 +1229,12 @@ const Table = p => {
|
|
|
2550
1229
|
if (!computedColumn) {
|
|
2551
1230
|
return null;
|
|
2552
1231
|
}
|
|
2553
|
-
return renderCellContent(computeDisplay({
|
|
1232
|
+
return tableView.renderCellContent(tableView.computeDisplay({
|
|
2554
1233
|
column: computedColumn,
|
|
2555
1234
|
placeholder,
|
|
2556
1235
|
dataSource: record,
|
|
2557
1236
|
context
|
|
2558
|
-
}), computedColumn, style$
|
|
1237
|
+
}), computedColumn, style$2['col-content']);
|
|
2559
1238
|
}
|
|
2560
1239
|
};
|
|
2561
1240
|
if (!controllerOpen) {
|
|
@@ -2563,8 +1242,8 @@ const Table = p => {
|
|
|
2563
1242
|
}
|
|
2564
1243
|
const configProps = computedColumnProps(column, index, {
|
|
2565
1244
|
title: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2566
|
-
className: style$
|
|
2567
|
-
children: renderColumnTitle(title, column, sortRender)
|
|
1245
|
+
className: style$2['col-content'],
|
|
1246
|
+
children: tableView.renderColumnTitle(title, column, sortRender)
|
|
2568
1247
|
})
|
|
2569
1248
|
});
|
|
2570
1249
|
const antdFixed = toAntdFixed(fixed);
|
|
@@ -2586,8 +1265,8 @@ const Table = p => {
|
|
|
2586
1265
|
return {
|
|
2587
1266
|
key: column.name,
|
|
2588
1267
|
title: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2589
|
-
className: style$
|
|
2590
|
-
children: wrapColumnHeaderTitle(column.title)
|
|
1268
|
+
className: style$2['col-content'],
|
|
1269
|
+
children: tableView.wrapColumnHeaderTitle(column.title)
|
|
2591
1270
|
}),
|
|
2592
1271
|
onHeaderCell: () => ({
|
|
2593
1272
|
className: getAntCellClassName(),
|
|
@@ -2652,13 +1331,13 @@ const Table = p => {
|
|
|
2652
1331
|
})),
|
|
2653
1332
|
renderCell: (checked, record, index, originNode) => wrapColContent(originNode),
|
|
2654
1333
|
onCell: () => ({
|
|
2655
|
-
className: getAntCellClassName(style$
|
|
1334
|
+
className: getAntCellClassName(style$2['selection-col'])
|
|
2656
1335
|
})
|
|
2657
1336
|
} : {
|
|
2658
1337
|
columnWidth: 30,
|
|
2659
1338
|
renderCell: (checked, record, index, originNode) => wrapColContent(originNode),
|
|
2660
1339
|
onCell: () => ({
|
|
2661
|
-
className: getAntCellClassName(style$
|
|
1340
|
+
className: getAntCellClassName(style$2['radio-col'])
|
|
2662
1341
|
})
|
|
2663
1342
|
});
|
|
2664
1343
|
}, [context, dataSource, rowKey, rowSelection, hasFixedColumn]);
|
|
@@ -2728,22 +1407,22 @@ const Table = p => {
|
|
|
2728
1407
|
tableLayout: controllerOpen || hasFixedColumn ? 'fixed' : undefined,
|
|
2729
1408
|
scroll: tableScroll,
|
|
2730
1409
|
onHeaderRow: () => ({
|
|
2731
|
-
className:
|
|
1410
|
+
className: 'info-page-table-header',
|
|
2732
1411
|
style: headerStyle
|
|
2733
1412
|
}),
|
|
2734
1413
|
locale: {
|
|
2735
1414
|
emptyText: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2736
|
-
className: style$
|
|
1415
|
+
className: style$2['empty'],
|
|
2737
1416
|
children: empty
|
|
2738
1417
|
})
|
|
2739
1418
|
},
|
|
2740
1419
|
rowClassName: record => {
|
|
2741
1420
|
const id = resolveRowKey(rowKey, record);
|
|
2742
1421
|
const isChecked = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) && rowSelection.selectedRowKeys.indexOf(id) > -1;
|
|
2743
|
-
return classnames__default["default"](
|
|
2744
|
-
[style$
|
|
2745
|
-
[style$
|
|
2746
|
-
[style$
|
|
1422
|
+
return classnames__default["default"]('info-page-table-row', {
|
|
1423
|
+
[style$2['is-selected-all']]: rowSelection == null ? void 0 : rowSelection.isSelectedAll,
|
|
1424
|
+
[style$2['is-selected']]: isChecked,
|
|
1425
|
+
[style$2['is-disabled']]: record.disabled
|
|
2747
1426
|
});
|
|
2748
1427
|
},
|
|
2749
1428
|
onRow: onRowSelect ? record => ({
|
|
@@ -2760,21 +1439,21 @@ const Table = p => {
|
|
|
2760
1439
|
}));
|
|
2761
1440
|
const wrappedTable = /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2762
1441
|
ref: tableRef,
|
|
2763
|
-
className: classnames__default["default"](style$
|
|
2764
|
-
[style$
|
|
2765
|
-
[style$
|
|
2766
|
-
[style$
|
|
2767
|
-
[style$
|
|
2768
|
-
[style$
|
|
2769
|
-
[style$
|
|
2770
|
-
[style$
|
|
1442
|
+
className: classnames__default["default"](style$2['table'], 'info-page-table', className, {
|
|
1443
|
+
[style$2['is-resize']]: currentMoveColumnIndex !== null,
|
|
1444
|
+
[style$2['is-computed']]: isLayout,
|
|
1445
|
+
[style$2['has-group-header']]: hasGroupHeader,
|
|
1446
|
+
[style$2['has-summary']]: typeof summary === 'function',
|
|
1447
|
+
[style$2['is-sticky']]: !!sticky,
|
|
1448
|
+
[style$2['is-sticky-scroll-y']]: !!sticky && hasScrollY,
|
|
1449
|
+
[style$2['is-sticky-viewport']]: isStickyViewport
|
|
2771
1450
|
}),
|
|
2772
1451
|
style: tableWrapperStyle,
|
|
2773
1452
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2774
1453
|
className: "info-page-table-body",
|
|
2775
1454
|
children: !isLayout && tableElement
|
|
2776
1455
|
}), currentMoveColumnIndex !== null && resizeGuideStyle && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2777
|
-
className: style$
|
|
1456
|
+
className: style$2['column-resize-guide'],
|
|
2778
1457
|
style: resizeGuideStyle,
|
|
2779
1458
|
"aria-hidden": true
|
|
2780
1459
|
})]
|
|
@@ -2787,373 +1466,9 @@ const Table = p => {
|
|
|
2787
1466
|
}
|
|
2788
1467
|
return wrappedTable;
|
|
2789
1468
|
};
|
|
2790
|
-
Table.useSelectedRow = useSelectedRow;
|
|
2791
|
-
Table.useSort = useSort;
|
|
2792
|
-
Table.sortDataSource = useSort.sortDataSource;
|
|
2793
|
-
|
|
2794
|
-
const Label = ({
|
|
2795
|
-
className,
|
|
2796
|
-
children,
|
|
2797
|
-
onChange
|
|
2798
|
-
}) => {
|
|
2799
|
-
const ref = react.useRef(null);
|
|
2800
|
-
const handlerChange = useRefCallback__default["default"](onChange);
|
|
2801
|
-
react.useLayoutEffect(() => {
|
|
2802
|
-
const computed = () => {
|
|
2803
|
-
if (!ref.current) {
|
|
2804
|
-
return;
|
|
2805
|
-
}
|
|
2806
|
-
handlerChange(ref.current.getBoundingClientRect());
|
|
2807
|
-
};
|
|
2808
|
-
const resizeObserver = new ResizeObserver(computed);
|
|
2809
|
-
resizeObserver.observe(ref.current);
|
|
2810
|
-
computed();
|
|
2811
|
-
return () => {
|
|
2812
|
-
resizeObserver.disconnect();
|
|
2813
|
-
};
|
|
2814
|
-
}, [handlerChange]);
|
|
2815
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2816
|
-
ref: ref,
|
|
2817
|
-
className: className,
|
|
2818
|
-
children: children
|
|
2819
|
-
});
|
|
2820
|
-
};
|
|
2821
|
-
|
|
2822
|
-
const renderHeaderCellContent = (column, {
|
|
2823
|
-
sortRender,
|
|
2824
|
-
widthBased,
|
|
2825
|
-
setColsSize,
|
|
2826
|
-
defaultSpan,
|
|
2827
|
-
colsSize
|
|
2828
|
-
}) => {
|
|
2829
|
-
const titleNode = renderColumnTitle(column.title, column, sortRender);
|
|
2830
|
-
const contentClassName = style$5['col-content'];
|
|
2831
|
-
if (widthBased) {
|
|
2832
|
-
return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2833
|
-
className: contentClassName,
|
|
2834
|
-
children: titleNode
|
|
2835
|
-
});
|
|
2836
|
-
}
|
|
2837
|
-
return /*#__PURE__*/jsxRuntime.jsx(Label, {
|
|
2838
|
-
className: contentClassName,
|
|
2839
|
-
onChange: size => {
|
|
2840
|
-
setColsSize(value => Object.assign({}, value, {
|
|
2841
|
-
[column.name]: Math.max(size.width, parseColumnWidth(resolveColumnDimensions(column).width))
|
|
2842
|
-
}));
|
|
2843
|
-
},
|
|
2844
|
-
children: titleNode
|
|
2845
|
-
});
|
|
2846
|
-
};
|
|
2847
|
-
const renderHeaderGridCells = ({
|
|
2848
|
-
dataSource,
|
|
2849
|
-
columns,
|
|
2850
|
-
rowKey,
|
|
2851
|
-
rowSelection,
|
|
2852
|
-
colsSize,
|
|
2853
|
-
setColsSize,
|
|
2854
|
-
sortRender,
|
|
2855
|
-
defaultSpan
|
|
2856
|
-
}) => {
|
|
2857
|
-
const cells = [];
|
|
2858
|
-
if (rowSelection?.type === 'checkbox') {
|
|
2859
|
-
cells.push(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2860
|
-
className: classnames__default["default"](style$5['col'], style$5['col-fixed'], style$5['header-cell'], 'info-page-table-col'),
|
|
2861
|
-
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2862
|
-
className: classnames__default["default"](style$5['col-content'], 'info-page-table-col-content'),
|
|
2863
|
-
children: rowSelection.allowSelectedAll ? (() => {
|
|
2864
|
-
const checkedAll = rowSelection.isSelectedAll || dataSource && dataSource.every(item => rowSelection.selectedRowKeys && rowSelection.selectedRowKeys.indexOf(get__default["default"](item, typeof rowKey === 'function' ? rowKey(item) : rowKey)) > -1);
|
|
2865
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
|
|
2866
|
-
checked: checkedAll,
|
|
2867
|
-
indeterminate: rowSelection.selectedRowKeys && rowSelection.selectedRowKeys.length > 0 && !checkedAll,
|
|
2868
|
-
onChange: e => {
|
|
2869
|
-
const checked = e.target.checked;
|
|
2870
|
-
if (!checked) {
|
|
2871
|
-
typeof rowSelection.onIsSelectAllChange === 'function' ? rowSelection.onIsSelectAllChange(false) : rowSelection.onChange([]);
|
|
2872
|
-
} else {
|
|
2873
|
-
typeof rowSelection.onIsSelectAllChange === 'function' ? rowSelection.onIsSelectAllChange(true) : dataSource && dataSource.length > 0 && rowSelection.onChange(dataSource.map(item => {
|
|
2874
|
-
return get__default["default"](item, typeof rowKey === 'function' ? rowKey(item) : rowKey);
|
|
2875
|
-
}));
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
|
-
});
|
|
2879
|
-
})() : /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
|
|
2880
|
-
style: {
|
|
2881
|
-
visibility: 'hidden'
|
|
2882
|
-
}
|
|
2883
|
-
})
|
|
2884
|
-
})
|
|
2885
|
-
}, "__selection__"));
|
|
2886
|
-
}
|
|
2887
|
-
columns.forEach((column, index) => {
|
|
2888
|
-
const {
|
|
2889
|
-
widthBased,
|
|
2890
|
-
fillRemaining,
|
|
2891
|
-
style: columnStyle
|
|
2892
|
-
} = getColumnLayout(column, {
|
|
2893
|
-
defaultSpan,
|
|
2894
|
-
colsSize,
|
|
2895
|
-
isLastColumn: index === columns.length - 1,
|
|
2896
|
-
columns
|
|
2897
|
-
});
|
|
2898
|
-
cells.push(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2899
|
-
style: columnStyle,
|
|
2900
|
-
className: classnames__default["default"](style$5['col'], fillRemaining ? style$5['col-width-fill'] : widthBased && style$5['col-width-based'], style$5['header-cell'], 'info-page-table-col'),
|
|
2901
|
-
children: renderHeaderCellContent(column, {
|
|
2902
|
-
sortRender,
|
|
2903
|
-
widthBased,
|
|
2904
|
-
setColsSize,
|
|
2905
|
-
defaultSpan,
|
|
2906
|
-
colsSize
|
|
2907
|
-
})
|
|
2908
|
-
}, column.name));
|
|
2909
|
-
});
|
|
2910
|
-
if (rowSelection?.type === 'radio') {
|
|
2911
|
-
cells.push(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2912
|
-
className: classnames__default["default"](style$5['col'], style$5['single-checked'], style$5['header-cell'], 'info-page-table-col')
|
|
2913
|
-
}, "__radio__"));
|
|
2914
|
-
}
|
|
2915
|
-
return cells;
|
|
2916
|
-
};
|
|
2917
|
-
const Header = p => {
|
|
2918
|
-
const {
|
|
2919
|
-
dataSource,
|
|
2920
|
-
columns,
|
|
2921
|
-
rowKey,
|
|
2922
|
-
rowSelection,
|
|
2923
|
-
colsSize,
|
|
2924
|
-
setColsSize,
|
|
2925
|
-
headerStyle,
|
|
2926
|
-
sortRender,
|
|
2927
|
-
defaultSpan
|
|
2928
|
-
} = Object.assign({}, {
|
|
2929
|
-
rowKey: 'id'
|
|
2930
|
-
}, p);
|
|
2931
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2932
|
-
style: headerStyle,
|
|
2933
|
-
className: classnames__default["default"](style$5['header'], 'info-page-table-header'),
|
|
2934
|
-
children: renderHeaderGridCells({
|
|
2935
|
-
dataSource,
|
|
2936
|
-
columns,
|
|
2937
|
-
rowKey,
|
|
2938
|
-
rowSelection,
|
|
2939
|
-
colsSize,
|
|
2940
|
-
setColsSize,
|
|
2941
|
-
sortRender,
|
|
2942
|
-
defaultSpan
|
|
2943
|
-
})
|
|
2944
|
-
});
|
|
2945
|
-
};
|
|
2946
|
-
|
|
2947
|
-
const _excluded$1 = ["className", "dataSource", "columns", "rowKey", "rowSelection", "valueIsEmpty", "emptyIsPlaceholder", "placeholder", "empty", "onRowSelect", "render", "context", "sticky", "headerStyle", "sortRender"];
|
|
2948
|
-
const getLayoutColumns = columns => columns.filter(column => column.display !== false);
|
|
2949
|
-
const TableView = p => {
|
|
2950
|
-
const _useState = react.useState({}),
|
|
2951
|
-
colsSize = _useState[0],
|
|
2952
|
-
setColsSize = _useState[1];
|
|
2953
|
-
const props = Object.assign({}, {
|
|
2954
|
-
rowKey: 'id',
|
|
2955
|
-
valueIsEmpty: isEmpty.isEmpty,
|
|
2956
|
-
placeholder: '-',
|
|
2957
|
-
emptyIsPlaceholder: true,
|
|
2958
|
-
empty: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {})
|
|
2959
|
-
}, p);
|
|
2960
|
-
const className = props.className,
|
|
2961
|
-
dataSource = props.dataSource,
|
|
2962
|
-
columnsProp = props.columns,
|
|
2963
|
-
rowKey = props.rowKey,
|
|
2964
|
-
rowSelection = props.rowSelection,
|
|
2965
|
-
valueIsEmpty = props.valueIsEmpty,
|
|
2966
|
-
emptyIsPlaceholder = props.emptyIsPlaceholder,
|
|
2967
|
-
placeholder = props.placeholder,
|
|
2968
|
-
empty = props.empty,
|
|
2969
|
-
onRowSelect = props.onRowSelect,
|
|
2970
|
-
render = props.render,
|
|
2971
|
-
context = props.context,
|
|
2972
|
-
headerStyle = props.headerStyle,
|
|
2973
|
-
sortRender = props.sortRender,
|
|
2974
|
-
others = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
2975
|
-
const columns = react.useMemo(() => resolveColumns(columnsProp), [columnsProp]);
|
|
2976
|
-
const layoutColumns = react.useMemo(() => getLayoutColumns(columns), [columns]);
|
|
2977
|
-
const defaultSpan = react.useMemo(() => {
|
|
2978
|
-
const assignedSpan = layoutColumns.reduce((a, b) => a + (b.span || 0), 0);
|
|
2979
|
-
const undistributedColCount = layoutColumns.filter(item => !hasColumnSpan(item) && !hasColumnWidth(item, layoutColumns)).length;
|
|
2980
|
-
return undistributedColCount > 0 ? Math.round(Math.max(24 - assignedSpan, 0) / undistributedColCount) : 1;
|
|
2981
|
-
}, [layoutColumns]);
|
|
2982
|
-
const gridTemplateColumns = react.useMemo(() => getGridTemplateColumns(layoutColumns, {
|
|
2983
|
-
defaultSpan,
|
|
2984
|
-
colsSize,
|
|
2985
|
-
rowSelection
|
|
2986
|
-
}), [layoutColumns, defaultSpan, colsSize, rowSelection]);
|
|
2987
|
-
const headerCellProps = {
|
|
2988
|
-
dataSource,
|
|
2989
|
-
columns: layoutColumns,
|
|
2990
|
-
rowKey,
|
|
2991
|
-
rowSelection,
|
|
2992
|
-
colsSize,
|
|
2993
|
-
setColsSize,
|
|
2994
|
-
sortRender,
|
|
2995
|
-
defaultSpan
|
|
2996
|
-
};
|
|
2997
|
-
const header = /*#__PURE__*/jsxRuntime.jsx(Header, _extends({}, headerCellProps, {
|
|
2998
|
-
headerStyle: headerStyle
|
|
2999
|
-
}));
|
|
3000
|
-
const handleRowClick = (item, _ref) => {
|
|
3001
|
-
let dataSource = _ref.dataSource,
|
|
3002
|
-
context = _ref.context,
|
|
3003
|
-
id = _ref.id,
|
|
3004
|
-
isChecked = _ref.isChecked;
|
|
3005
|
-
if (item.disabled) {
|
|
3006
|
-
return;
|
|
3007
|
-
}
|
|
3008
|
-
onRowSelect && onRowSelect(item, {
|
|
3009
|
-
columns: layoutColumns,
|
|
3010
|
-
dataSource
|
|
3011
|
-
});
|
|
3012
|
-
if (!rowSelection || rowSelection.isSelectedAll) {
|
|
3013
|
-
return;
|
|
3014
|
-
}
|
|
3015
|
-
if (rowSelection.type === 'checkbox') {
|
|
3016
|
-
const selectedRowKeys = (rowSelection.selectedRowKeys || []).slice(0);
|
|
3017
|
-
isChecked ? selectedRowKeys.splice(rowSelection.selectedRowKeys.indexOf(id), 1) : selectedRowKeys.push(id);
|
|
3018
|
-
rowSelection.onChange(selectedRowKeys, id, {
|
|
3019
|
-
context,
|
|
3020
|
-
checked: !isChecked
|
|
3021
|
-
});
|
|
3022
|
-
return;
|
|
3023
|
-
}
|
|
3024
|
-
const selectedRowKeys = rowSelection.selectedRowKeys.length && rowSelection.selectedRowKeys[0] === id ? [] : [id];
|
|
3025
|
-
rowSelection.onChange(selectedRowKeys, id, {
|
|
3026
|
-
context,
|
|
3027
|
-
checked: !isChecked
|
|
3028
|
-
});
|
|
3029
|
-
};
|
|
3030
|
-
const renderBodyGridCells = (dataSource, context) => {
|
|
3031
|
-
const getId = item => get__default["default"](item, typeof rowKey === 'function' ? rowKey(item) : rowKey);
|
|
3032
|
-
if (!dataSource || dataSource.length === 0) {
|
|
3033
|
-
return null;
|
|
3034
|
-
}
|
|
3035
|
-
return dataSource.map(item => {
|
|
3036
|
-
const id = getId(item);
|
|
3037
|
-
const isChecked = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) && rowSelection.selectedRowKeys.indexOf(id) > -1;
|
|
3038
|
-
const columnsValue = computeColumnsValue({
|
|
3039
|
-
columns: layoutColumns,
|
|
3040
|
-
emptyIsPlaceholder,
|
|
3041
|
-
valueIsEmpty,
|
|
3042
|
-
removeEmpty: true,
|
|
3043
|
-
dataSource: item,
|
|
3044
|
-
placeholder,
|
|
3045
|
-
context
|
|
3046
|
-
});
|
|
3047
|
-
const columnMap = columnsValue.reduce((result, column) => Object.assign(result, {
|
|
3048
|
-
[column.name]: column
|
|
3049
|
-
}), {});
|
|
3050
|
-
const rowClassName = classnames__default["default"](style$5['body'], style$5['body-cell'], style$5['body-row'], 'info-page-table-row', {
|
|
3051
|
-
[style$5['is-selected-all']]: rowSelection == null ? void 0 : rowSelection.isSelectedAll,
|
|
3052
|
-
[style$5['is-selected']]: isChecked,
|
|
3053
|
-
[style$5['is-disabled']]: item.disabled
|
|
3054
|
-
});
|
|
3055
|
-
const onSelectionChange = () => handleRowClick(item, {
|
|
3056
|
-
dataSource,
|
|
3057
|
-
context,
|
|
3058
|
-
id,
|
|
3059
|
-
isChecked
|
|
3060
|
-
});
|
|
3061
|
-
const cells = [];
|
|
3062
|
-
if ((rowSelection == null ? void 0 : rowSelection.type) === 'checkbox') {
|
|
3063
|
-
cells.push(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3064
|
-
className: classnames__default["default"](style$5['col'], style$5['col-fixed'], 'info-page-table-col'),
|
|
3065
|
-
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3066
|
-
className: classnames__default["default"](style$5['col-content'], 'info-page-table-col-content'),
|
|
3067
|
-
children: /*#__PURE__*/jsxRuntime.jsx(antd.Checkbox, {
|
|
3068
|
-
disabled: item.disabled || rowSelection.isSelectedAll,
|
|
3069
|
-
checked: rowSelection.isSelectedAll && !item.disabled || isChecked,
|
|
3070
|
-
onChange: onSelectionChange
|
|
3071
|
-
})
|
|
3072
|
-
})
|
|
3073
|
-
}, id + "__selection__"));
|
|
3074
|
-
}
|
|
3075
|
-
layoutColumns.forEach((column, index) => {
|
|
3076
|
-
const columnValue = columnMap[column.name];
|
|
3077
|
-
const _getColumnLayout = getColumnLayout(column, {
|
|
3078
|
-
defaultSpan,
|
|
3079
|
-
colsSize,
|
|
3080
|
-
isLastColumn: index === layoutColumns.length - 1,
|
|
3081
|
-
columns: layoutColumns
|
|
3082
|
-
}),
|
|
3083
|
-
widthBased = _getColumnLayout.widthBased,
|
|
3084
|
-
fillRemaining = _getColumnLayout.fillRemaining,
|
|
3085
|
-
columnStyle = _getColumnLayout.style;
|
|
3086
|
-
cells.push(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3087
|
-
style: columnStyle,
|
|
3088
|
-
className: classnames__default["default"](style$5['col'], fillRemaining ? style$5['col-width-fill'] : widthBased && style$5['col-width-based'], 'info-page-table-col'),
|
|
3089
|
-
children: columnValue ? renderCellContent(computeDisplay({
|
|
3090
|
-
column: columnValue,
|
|
3091
|
-
placeholder,
|
|
3092
|
-
dataSource: item,
|
|
3093
|
-
context
|
|
3094
|
-
}), columnValue, style$5['col-content']) : /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
3095
|
-
className: style$5['col-content']
|
|
3096
|
-
})
|
|
3097
|
-
}, id + "-" + column.name));
|
|
3098
|
-
});
|
|
3099
|
-
if ((rowSelection == null ? void 0 : rowSelection.type) === 'radio') {
|
|
3100
|
-
cells.push(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3101
|
-
className: classnames__default["default"](style$5['col'], style$5['single-checked'], 'info-page-table-col'),
|
|
3102
|
-
onClick: onSelectionChange,
|
|
3103
|
-
children: isChecked && /*#__PURE__*/jsxRuntime.jsx(icons.CheckOutlined, {})
|
|
3104
|
-
}, id + "__radio__"));
|
|
3105
|
-
}
|
|
3106
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3107
|
-
className: rowClassName,
|
|
3108
|
-
children: cells
|
|
3109
|
-
}, id);
|
|
3110
|
-
});
|
|
3111
|
-
};
|
|
3112
|
-
const renderGrid = (dataSource, context) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3113
|
-
className: style$5['grid'],
|
|
3114
|
-
style: {
|
|
3115
|
-
gridTemplateColumns
|
|
3116
|
-
},
|
|
3117
|
-
children: [renderHeaderGridCells(headerCellProps), renderBodyGridCells(dataSource, context)]
|
|
3118
|
-
});
|
|
3119
|
-
const renderBody = (dataSource, context) => {
|
|
3120
|
-
if (!dataSource || dataSource.length === 0) {
|
|
3121
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3122
|
-
className: style$5['empty'],
|
|
3123
|
-
children: empty
|
|
3124
|
-
});
|
|
3125
|
-
}
|
|
3126
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3127
|
-
className: classnames__default["default"]('info-page-table-body'),
|
|
3128
|
-
children: renderGrid(dataSource, context)
|
|
3129
|
-
});
|
|
3130
|
-
};
|
|
3131
|
-
if (typeof render === 'function') {
|
|
3132
|
-
return render(_extends({}, others, {
|
|
3133
|
-
header,
|
|
3134
|
-
renderBody
|
|
3135
|
-
}));
|
|
3136
|
-
}
|
|
3137
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", _extends({}, others, {
|
|
3138
|
-
className: classnames__default["default"](style$5['table'], style$5['tableView'], 'info-page-table', className),
|
|
3139
|
-
children: dataSource && dataSource.length > 0 ? renderGrid(dataSource, context) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3140
|
-
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3141
|
-
className: style$5['grid'],
|
|
3142
|
-
style: {
|
|
3143
|
-
gridTemplateColumns
|
|
3144
|
-
},
|
|
3145
|
-
children: renderHeaderGridCells(headerCellProps)
|
|
3146
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3147
|
-
className: style$5['empty'],
|
|
3148
|
-
children: empty
|
|
3149
|
-
})]
|
|
3150
|
-
})
|
|
3151
|
-
}));
|
|
3152
|
-
};
|
|
3153
|
-
TableView.Header = Header;
|
|
3154
|
-
TableView.useSelectedRow = useSelectedRow;
|
|
3155
|
-
TableView.useSort = useSort;
|
|
3156
|
-
TableView.sortDataSource = useSort.sortDataSource;
|
|
1469
|
+
Table.useSelectedRow = tableView.useSelectedRow;
|
|
1470
|
+
Table.useSort = tableView.useSort;
|
|
1471
|
+
Table.sortDataSource = tableView.useSort.sortDataSource;
|
|
3157
1472
|
|
|
3158
1473
|
var style$1 = {"table-page":"kne-table-page_ut9rJ","table-content":"kne-table-page_dxN6N","table-with-toolbar":"kne-table-page_sf06r","has-summary":"kne-table-page_IRdzb","table-in-toolbar":"kne-table-page_sawIT","pagination":"kne-table-page_DSTEf","total_text":"kne-table-page_pJhKr","floating-scrollbar":"kne-table-page_iu8E1","floating-scrollbar-embedded":"kne-table-page_PIv-C","floating-scrollbar-thumb":"kne-table-page_RjZsu","is-moving":"kne-table-page_y-4Ou"};
|
|
3159
1474
|
|
|
@@ -3582,7 +1897,7 @@ const writePageSize = (key, size) => {
|
|
|
3582
1897
|
};
|
|
3583
1898
|
const TABLE_COMPONENTS = {
|
|
3584
1899
|
Table,
|
|
3585
|
-
TableView
|
|
1900
|
+
TableView: tableView.TableView
|
|
3586
1901
|
};
|
|
3587
1902
|
const collectFilterFieldNames = (filter, search) => {
|
|
3588
1903
|
const names = new Set();
|
|
@@ -3890,36 +2205,152 @@ const TablePage = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
|
|
|
3890
2205
|
}));
|
|
3891
2206
|
});
|
|
3892
2207
|
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
2208
|
+
Object.defineProperty(exports, 'RENDER_TYPE_NAMES', {
|
|
2209
|
+
enumerable: true,
|
|
2210
|
+
get: function () { return tableView.RENDER_TYPE_NAMES; }
|
|
2211
|
+
});
|
|
2212
|
+
Object.defineProperty(exports, 'SIZE_NAMES', {
|
|
2213
|
+
enumerable: true,
|
|
2214
|
+
get: function () { return tableView.SIZE_NAMES; }
|
|
2215
|
+
});
|
|
2216
|
+
Object.defineProperty(exports, 'TableView', {
|
|
2217
|
+
enumerable: true,
|
|
2218
|
+
get: function () { return tableView.TableView; }
|
|
2219
|
+
});
|
|
2220
|
+
Object.defineProperty(exports, 'calcArgs', {
|
|
2221
|
+
enumerable: true,
|
|
2222
|
+
get: function () { return tableView.calcArgs; }
|
|
2223
|
+
});
|
|
2224
|
+
Object.defineProperty(exports, 'computeColumnsDisplay', {
|
|
2225
|
+
enumerable: true,
|
|
2226
|
+
get: function () { return tableView.computeColumnsDisplay; }
|
|
2227
|
+
});
|
|
2228
|
+
Object.defineProperty(exports, 'computeColumnsValue', {
|
|
2229
|
+
enumerable: true,
|
|
2230
|
+
get: function () { return tableView.computeColumnsValue; }
|
|
2231
|
+
});
|
|
2232
|
+
Object.defineProperty(exports, 'computeDisplay', {
|
|
2233
|
+
enumerable: true,
|
|
2234
|
+
get: function () { return tableView.computeDisplay; }
|
|
2235
|
+
});
|
|
2236
|
+
Object.defineProperty(exports, 'defaultFormat', {
|
|
2237
|
+
enumerable: true,
|
|
2238
|
+
get: function () { return tableView.defaultFormat; }
|
|
2239
|
+
});
|
|
2240
|
+
Object.defineProperty(exports, 'formatView', {
|
|
2241
|
+
enumerable: true,
|
|
2242
|
+
get: function () { return tableView.formatView; }
|
|
2243
|
+
});
|
|
2244
|
+
Object.defineProperty(exports, 'getColumnEllipsis', {
|
|
2245
|
+
enumerable: true,
|
|
2246
|
+
get: function () { return tableView.getColumnEllipsis; }
|
|
2247
|
+
});
|
|
2248
|
+
Object.defineProperty(exports, 'getColumnLayout', {
|
|
2249
|
+
enumerable: true,
|
|
2250
|
+
get: function () { return tableView.getColumnLayout; }
|
|
2251
|
+
});
|
|
2252
|
+
Object.defineProperty(exports, 'getColumnRender', {
|
|
2253
|
+
enumerable: true,
|
|
2254
|
+
get: function () { return tableView.getColumnRender; }
|
|
2255
|
+
});
|
|
2256
|
+
Object.defineProperty(exports, 'getGridTemplateColumns', {
|
|
2257
|
+
enumerable: true,
|
|
2258
|
+
get: function () { return tableView.getGridTemplateColumns; }
|
|
2259
|
+
});
|
|
2260
|
+
Object.defineProperty(exports, 'getRenderTypeDimensions', {
|
|
2261
|
+
enumerable: true,
|
|
2262
|
+
get: function () { return tableView.getRenderTypeDimensions; }
|
|
2263
|
+
});
|
|
2264
|
+
Object.defineProperty(exports, 'getRenderTypeNames', {
|
|
2265
|
+
enumerable: true,
|
|
2266
|
+
get: function () { return tableView.getRenderTypeNames; }
|
|
2267
|
+
});
|
|
2268
|
+
Object.defineProperty(exports, 'getStatusType', {
|
|
2269
|
+
enumerable: true,
|
|
2270
|
+
get: function () { return tableView.getStatusType; }
|
|
2271
|
+
});
|
|
2272
|
+
Object.defineProperty(exports, 'getTagColor', {
|
|
2273
|
+
enumerable: true,
|
|
2274
|
+
get: function () { return tableView.getTagColor; }
|
|
2275
|
+
});
|
|
2276
|
+
Object.defineProperty(exports, 'globalParams', {
|
|
2277
|
+
enumerable: true,
|
|
2278
|
+
get: function () { return tableView.globalParams; }
|
|
2279
|
+
});
|
|
2280
|
+
Object.defineProperty(exports, 'hasColumnSpan', {
|
|
2281
|
+
enumerable: true,
|
|
2282
|
+
get: function () { return tableView.hasColumnSpan; }
|
|
2283
|
+
});
|
|
2284
|
+
Object.defineProperty(exports, 'hasColumnWidth', {
|
|
2285
|
+
enumerable: true,
|
|
2286
|
+
get: function () { return tableView.hasColumnWidth; }
|
|
2287
|
+
});
|
|
2288
|
+
Object.defineProperty(exports, 'isOptionsColumn', {
|
|
2289
|
+
enumerable: true,
|
|
2290
|
+
get: function () { return tableView.isOptionsColumn; }
|
|
2291
|
+
});
|
|
2292
|
+
Object.defineProperty(exports, 'parseColumnWidth', {
|
|
2293
|
+
enumerable: true,
|
|
2294
|
+
get: function () { return tableView.parseColumnWidth; }
|
|
2295
|
+
});
|
|
2296
|
+
Object.defineProperty(exports, 'parseRenderType', {
|
|
2297
|
+
enumerable: true,
|
|
2298
|
+
get: function () { return tableView.parseRenderType; }
|
|
2299
|
+
});
|
|
2300
|
+
Object.defineProperty(exports, 'preset', {
|
|
2301
|
+
enumerable: true,
|
|
2302
|
+
get: function () { return tableView.preset; }
|
|
2303
|
+
});
|
|
2304
|
+
Object.defineProperty(exports, 'renderCellContent', {
|
|
2305
|
+
enumerable: true,
|
|
2306
|
+
get: function () { return tableView.renderCellContent; }
|
|
2307
|
+
});
|
|
2308
|
+
Object.defineProperty(exports, 'renderStatusItem', {
|
|
2309
|
+
enumerable: true,
|
|
2310
|
+
get: function () { return tableView.renderStatusItem; }
|
|
2311
|
+
});
|
|
2312
|
+
Object.defineProperty(exports, 'renderTagItem', {
|
|
2313
|
+
enumerable: true,
|
|
2314
|
+
get: function () { return tableView.renderTagItem; }
|
|
2315
|
+
});
|
|
2316
|
+
Object.defineProperty(exports, 'renderTagList', {
|
|
2317
|
+
enumerable: true,
|
|
2318
|
+
get: function () { return tableView.renderTagList; }
|
|
2319
|
+
});
|
|
2320
|
+
Object.defineProperty(exports, 'resolveColumn', {
|
|
2321
|
+
enumerable: true,
|
|
2322
|
+
get: function () { return tableView.resolveColumn; }
|
|
2323
|
+
});
|
|
2324
|
+
Object.defineProperty(exports, 'resolveColumnDimensions', {
|
|
2325
|
+
enumerable: true,
|
|
2326
|
+
get: function () { return tableView.resolveColumnDimensions; }
|
|
2327
|
+
});
|
|
2328
|
+
Object.defineProperty(exports, 'resolveColumns', {
|
|
2329
|
+
enumerable: true,
|
|
2330
|
+
get: function () { return tableView.resolveColumns; }
|
|
2331
|
+
});
|
|
2332
|
+
Object.defineProperty(exports, 'resolveRenderType', {
|
|
2333
|
+
enumerable: true,
|
|
2334
|
+
get: function () { return tableView.resolveRenderType; }
|
|
2335
|
+
});
|
|
2336
|
+
Object.defineProperty(exports, 'sortDataSource', {
|
|
2337
|
+
enumerable: true,
|
|
2338
|
+
get: function () { return tableView.sortDataSource; }
|
|
2339
|
+
});
|
|
2340
|
+
Object.defineProperty(exports, 'useSelectedRow', {
|
|
2341
|
+
enumerable: true,
|
|
2342
|
+
get: function () { return tableView.useSelectedRow; }
|
|
2343
|
+
});
|
|
2344
|
+
Object.defineProperty(exports, 'useSort', {
|
|
2345
|
+
enumerable: true,
|
|
2346
|
+
get: function () { return tableView.useSort; }
|
|
2347
|
+
});
|
|
2348
|
+
Object.defineProperty(exports, 'wrapColumnHeaderTitle', {
|
|
2349
|
+
enumerable: true,
|
|
2350
|
+
get: function () { return tableView.wrapColumnHeaderTitle; }
|
|
2351
|
+
});
|
|
3901
2352
|
exports.Table = Table;
|
|
3902
|
-
exports.TableView = TableView;
|
|
3903
2353
|
exports["default"] = TablePage;
|
|
3904
|
-
exports.getColumnRender = getColumnRender;
|
|
3905
|
-
exports.getRenderTypeDimensions = getRenderTypeDimensions;
|
|
3906
|
-
exports.getRenderTypeNames = getRenderTypeNames;
|
|
3907
|
-
exports.getStatusType = getStatusType;
|
|
3908
|
-
exports.getTagColor = getTagColor;
|
|
3909
|
-
exports.globalParams = globalParams;
|
|
3910
|
-
exports.isOptionsColumn = isOptionsColumn;
|
|
3911
|
-
exports.parseRenderType = parseRenderType;
|
|
3912
|
-
exports.preset = preset;
|
|
3913
|
-
exports.renderStatusItem = renderStatusItem;
|
|
3914
|
-
exports.renderTagItem = renderTagItem;
|
|
3915
|
-
exports.renderTagList = renderTagList;
|
|
3916
|
-
exports.resolveColumn = resolveColumn;
|
|
3917
|
-
exports.resolveColumnDimensions = resolveColumnDimensions;
|
|
3918
|
-
exports.resolveColumns = resolveColumns;
|
|
3919
|
-
exports.resolveRenderType = resolveRenderType;
|
|
3920
|
-
exports.sortDataSource = sortDataSource;
|
|
3921
2354
|
exports.tableLocalApis = tableLocalApis;
|
|
3922
|
-
exports.useSelectedRow = useSelectedRow;
|
|
3923
|
-
exports.useSort = useSort;
|
|
3924
2355
|
exports.useTableConfig = useTableConfig;
|
|
3925
2356
|
//# sourceMappingURL=index.js.map
|