@kne/table-page 0.1.5 → 0.1.7

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