@react-fabric/data 1.0.0-beta.0
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/LICENSE +21 -0
- package/README.md +10 -0
- package/dist/cjs/histogram/Histogram.js +89 -0
- package/dist/cjs/histogram/Histogram.module.css +1 -0
- package/dist/cjs/hooks/useFilteredList.js +56 -0
- package/dist/cjs/hooks/usePagination.js +85 -0
- package/dist/cjs/i18n/ar.json.js +56 -0
- package/dist/cjs/i18n/en.json.js +56 -0
- package/dist/cjs/i18n/index.js +33 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/json/JsonViewer.js +246 -0
- package/dist/cjs/pagination/Pagination.js +100 -0
- package/dist/cjs/table/BodyCell.js +47 -0
- package/dist/cjs/table/HeaderCell.js +79 -0
- package/dist/cjs/table/Table.js +133 -0
- package/dist/cjs/table/useTableColumns.js +26 -0
- package/dist/cjs/table/useVirtualTable.js +56 -0
- package/dist/cjs/tree/TreeNode.js +107 -0
- package/dist/cjs/tree/TreePanel.js +136 -0
- package/dist/cjs/tree/types.js +30 -0
- package/dist/cjs/tree/useTree.js +181 -0
- package/dist/cjs/tree/utils.js +145 -0
- package/dist/cjs/virtual/Gallery.js +229 -0
- package/dist/cjs/virtual/List.js +218 -0
- package/dist/cjs/virtual/Scroller.js +77 -0
- package/dist/esm/histogram/Histogram.js +89 -0
- package/dist/esm/histogram/Histogram.module.css +1 -0
- package/dist/esm/hooks/useFilteredList.js +56 -0
- package/dist/esm/hooks/usePagination.js +85 -0
- package/dist/esm/i18n/ar.json.js +47 -0
- package/dist/esm/i18n/en.json.js +47 -0
- package/dist/esm/i18n/index.js +33 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/json/JsonViewer.js +246 -0
- package/dist/esm/pagination/Pagination.js +100 -0
- package/dist/esm/table/BodyCell.js +47 -0
- package/dist/esm/table/HeaderCell.js +79 -0
- package/dist/esm/table/Table.js +133 -0
- package/dist/esm/table/useTableColumns.js +26 -0
- package/dist/esm/table/useVirtualTable.js +56 -0
- package/dist/esm/tree/TreeNode.js +107 -0
- package/dist/esm/tree/TreePanel.js +136 -0
- package/dist/esm/tree/types.js +29 -0
- package/dist/esm/tree/useTree.js +181 -0
- package/dist/esm/tree/utils.js +140 -0
- package/dist/esm/virtual/Gallery.js +229 -0
- package/dist/esm/virtual/List.js +218 -0
- package/dist/esm/virtual/Scroller.js +77 -0
- package/dist/types/histogram/Histogram.d.ts +41 -0
- package/dist/types/hooks/useFilteredList.d.ts +7 -0
- package/dist/types/hooks/usePagination.d.ts +25 -0
- package/dist/types/i18n/index.d.ts +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/json/JsonViewer.d.ts +59 -0
- package/dist/types/pagination/Pagination.d.ts +24 -0
- package/dist/types/table/BodyCell.d.ts +5 -0
- package/dist/types/table/HeaderCell.d.ts +2 -0
- package/dist/types/table/Table.d.ts +2 -0
- package/dist/types/table/types.d.ts +26 -0
- package/dist/types/table/useTableColumns.d.ts +8 -0
- package/dist/types/table/useVirtualTable.d.ts +8 -0
- package/dist/types/tree/TreeNode.d.ts +2 -0
- package/dist/types/tree/TreePanel.d.ts +2 -0
- package/dist/types/tree/types.d.ts +138 -0
- package/dist/types/tree/useTree.d.ts +20 -0
- package/dist/types/tree/utils.d.ts +10 -0
- package/dist/types/virtual/Gallery.d.ts +55 -0
- package/dist/types/virtual/List.d.ts +59 -0
- package/dist/types/virtual/Scroller.d.ts +8 -0
- package/package.json +55 -0
- package/src/histogram/Histogram.module.css +57 -0
- package/src/histogram/Histogram.tsx +176 -0
- package/src/hooks/useFilteredList.tsx +78 -0
- package/src/hooks/usePagination.tsx +135 -0
- package/src/i18n/ar.json +36 -0
- package/src/i18n/en.json +36 -0
- package/src/i18n/index.ts +28 -0
- package/src/index.ts +35 -0
- package/src/json/JsonViewer.tsx +381 -0
- package/src/pagination/Pagination.tsx +157 -0
- package/src/table/BodyCell.tsx +54 -0
- package/src/table/HeaderCell.tsx +70 -0
- package/src/table/Table.tsx +143 -0
- package/src/table/types.ts +65 -0
- package/src/table/useTableColumns.ts +52 -0
- package/src/table/useVirtualTable.ts +54 -0
- package/src/tree/TreeNode.tsx +163 -0
- package/src/tree/TreePanel.tsx +157 -0
- package/src/tree/types.ts +181 -0
- package/src/tree/useTree.ts +227 -0
- package/src/tree/utils.ts +185 -0
- package/src/virtual/Gallery.tsx +349 -0
- package/src/virtual/List.tsx +351 -0
- package/src/virtual/Scroller.tsx +81 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
4
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
|
+
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
7
|
+
var core = require('@react-fabric/core');
|
|
8
|
+
var utilities = require('@react-fabric/utilities');
|
|
9
|
+
var classNames = require('classnames');
|
|
10
|
+
var react = require('react');
|
|
11
|
+
var reactI18next = require('react-i18next');
|
|
12
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
+
|
|
14
|
+
var _excluded = ["className", "json", "copy", "propertyScheme", "filters", "inline", "labelWidth", "formatter", "labeler", "onFilter", "emptyMessage", "showPropertyTree"];
|
|
15
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
var reduceObject = function reduceObject(json) {
|
|
18
|
+
var keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
19
|
+
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
|
|
20
|
+
var ret = [];
|
|
21
|
+
Object.entries(json).forEach(function (_ref) {
|
|
22
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
23
|
+
key = _ref2[0],
|
|
24
|
+
value = _ref2[1];
|
|
25
|
+
if (utilities.isArray(value) && utilities.isObject(value[0])) {
|
|
26
|
+
ret.push.apply(ret, _toConsumableArray(reduceObject(value, [].concat(_toConsumableArray(keys), [key]), key)));
|
|
27
|
+
} else {
|
|
28
|
+
var obj = {
|
|
29
|
+
field: prefix ? "".concat(prefix, ".").concat(key) : key,
|
|
30
|
+
value: value,
|
|
31
|
+
path: [].concat(_toConsumableArray(keys), [key]).join(".")
|
|
32
|
+
};
|
|
33
|
+
if (utilities.isObject(value) && !utilities.isEmpty(value) && !("_score_" in value)) {
|
|
34
|
+
obj.children = reduceObject(value, [].concat(_toConsumableArray(keys), [key]));
|
|
35
|
+
}
|
|
36
|
+
ret.push(obj);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return ret.flat(99);
|
|
40
|
+
};
|
|
41
|
+
var JsonEntry = function JsonEntry(_ref3) {
|
|
42
|
+
var value = _ref3.value,
|
|
43
|
+
path = _ref3.path,
|
|
44
|
+
field = _ref3.field,
|
|
45
|
+
children = _ref3.children,
|
|
46
|
+
copy = _ref3.copy,
|
|
47
|
+
filters = _ref3.filters,
|
|
48
|
+
labeler = _ref3.labeler,
|
|
49
|
+
formatter = _ref3.formatter,
|
|
50
|
+
propertyScheme = _ref3.propertyScheme,
|
|
51
|
+
showPropertyTree = _ref3.showPropertyTree,
|
|
52
|
+
onFilter = _ref3.onFilter,
|
|
53
|
+
inline = _ref3.inline,
|
|
54
|
+
_ref3$labelWidth = _ref3.labelWidth,
|
|
55
|
+
labelWidth = _ref3$labelWidth === void 0 ? "30%" : _ref3$labelWidth,
|
|
56
|
+
_ref3$level = _ref3.level,
|
|
57
|
+
level = _ref3$level === void 0 ? 0 : _ref3$level;
|
|
58
|
+
var _useTranslation = reactI18next.useTranslation("data"),
|
|
59
|
+
t = _useTranslation.t;
|
|
60
|
+
var _useState = react.useState(true),
|
|
61
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
62
|
+
expanded = _useState2[0],
|
|
63
|
+
setExpanded = _useState2[1];
|
|
64
|
+
var canExpand = react.useMemo(function () {
|
|
65
|
+
return !!children;
|
|
66
|
+
}, [children]);
|
|
67
|
+
var actualValue = react.useMemo(function () {
|
|
68
|
+
var _ref4, _value$_label_;
|
|
69
|
+
return (_ref4 = (_value$_label_ = value === null || value === void 0 ? void 0 : value._label_) !== null && _value$_label_ !== void 0 ? _value$_label_ : value) !== null && _ref4 !== void 0 ? _ref4 : "";
|
|
70
|
+
}, [value]);
|
|
71
|
+
var display = react.useMemo(function () {
|
|
72
|
+
var _propertyScheme$date, _propertyScheme$time, _propertyScheme$numbe, _propertyScheme$bytes, _propertyScheme$perce, _propertyScheme$numbe2, _propertyScheme$boole, _ret;
|
|
73
|
+
if (children) return null;
|
|
74
|
+
if (utilities.isNil(value)) return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
75
|
+
className: "text-muted",
|
|
76
|
+
children: "null"
|
|
77
|
+
});
|
|
78
|
+
if (utilities.isEmpty(value)) return /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
79
|
+
className: "text-muted",
|
|
80
|
+
children: "empty"
|
|
81
|
+
});
|
|
82
|
+
var ret = actualValue;
|
|
83
|
+
if (formatter) {
|
|
84
|
+
var formatted = formatter === null || formatter === void 0 ? void 0 : formatter(path, actualValue);
|
|
85
|
+
if (!utilities.isNil(formatted)) ret = formatted;
|
|
86
|
+
}
|
|
87
|
+
if (utilities.isArray(actualValue)) {
|
|
88
|
+
ret = "[".concat(actualValue.join(", "), "]");
|
|
89
|
+
}
|
|
90
|
+
if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$date = propertyScheme.date) !== null && _propertyScheme$date !== void 0 && _propertyScheme$date.includes(path)) ;
|
|
91
|
+
if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$time = propertyScheme.time) !== null && _propertyScheme$time !== void 0 && _propertyScheme$time.includes(path)) ret = utilities.Format.date(actualValue, "pp");
|
|
92
|
+
if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$numbe = propertyScheme.number) !== null && _propertyScheme$numbe !== void 0 && _propertyScheme$numbe.phone(path)) ret = utilities.Format.phone(actualValue);
|
|
93
|
+
if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$bytes = propertyScheme.bytes) !== null && _propertyScheme$bytes !== void 0 && _propertyScheme$bytes.includes(path)) ret = utilities.Format.bytes(actualValue);
|
|
94
|
+
if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$perce = propertyScheme.percent) !== null && _propertyScheme$perce !== void 0 && _propertyScheme$perce.includes(path)) ret = utilities.Format.percent(actualValue);
|
|
95
|
+
if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$numbe2 = propertyScheme.number) !== null && _propertyScheme$numbe2 !== void 0 && _propertyScheme$numbe2.includes(path)) ret = utilities.Format.number(actualValue);
|
|
96
|
+
if (propertyScheme !== null && propertyScheme !== void 0 && (_propertyScheme$boole = propertyScheme["boolean"]) !== null && _propertyScheme$boole !== void 0 && _propertyScheme$boole.includes(path) || utilities.isBoolean(actualValue)) ret = actualValue ? t("json.true") : t("json.false");
|
|
97
|
+
if (((_ret = ret) === null || _ret === void 0 ? void 0 : _ret.length) > 128) {
|
|
98
|
+
ret = /*#__PURE__*/jsxRuntime.jsx(core.Text, {
|
|
99
|
+
clamp: 3,
|
|
100
|
+
children: ret
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
|
|
104
|
+
children: [ret, utilities.isObject(value) && value._score_ > 0 && /*#__PURE__*/jsxRuntime.jsx(core.Meter, {
|
|
105
|
+
className: "text-xs",
|
|
106
|
+
value: value._score_
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}, [value, path, formatter, propertyScheme, actualValue]);
|
|
110
|
+
var pathWithoutOrdinal = react.useMemo(function () {
|
|
111
|
+
return path.replace(/\.\d*\./, ".");
|
|
112
|
+
}, [path]);
|
|
113
|
+
var canCopy = react.useMemo(function () {
|
|
114
|
+
var _copy$includes, _copy$includes2;
|
|
115
|
+
return !utilities.isEmpty(value) && (utilities.isTrue(copy) || (copy === null || copy === void 0 || (_copy$includes = copy.includes) === null || _copy$includes === void 0 ? void 0 : _copy$includes.call(copy, path)) || (copy === null || copy === void 0 || (_copy$includes2 = copy.includes) === null || _copy$includes2 === void 0 ? void 0 : _copy$includes2.call(copy, pathWithoutOrdinal)));
|
|
116
|
+
}, [copy, value, path, pathWithoutOrdinal]);
|
|
117
|
+
var canFilter = react.useMemo(function () {
|
|
118
|
+
var _filters$includes, _filters$includes2;
|
|
119
|
+
return utilities.isTrue(filters) || (filters === null || filters === void 0 || (_filters$includes = filters.includes) === null || _filters$includes === void 0 ? void 0 : _filters$includes.call(filters, path)) || (filters === null || filters === void 0 || (_filters$includes2 = filters.includes) === null || _filters$includes2 === void 0 ? void 0 : _filters$includes2.call(filters, pathWithoutOrdinal));
|
|
120
|
+
}, [filters, path, pathWithoutOrdinal]);
|
|
121
|
+
var labelDisplay = react.useMemo(function () {
|
|
122
|
+
var _labeler;
|
|
123
|
+
return /*#__PURE__*/jsxRuntime.jsx(core.ActionLabel, {
|
|
124
|
+
className: "text-dimmed text-sm px-2 flex-1 truncate",
|
|
125
|
+
actions: !canExpand && canFilter ? [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
|
|
126
|
+
color: "danger",
|
|
127
|
+
size: "sm",
|
|
128
|
+
variant: "link",
|
|
129
|
+
icon: core.CoreIcons.funnelMinus,
|
|
130
|
+
"aria-label": "Filter Negative",
|
|
131
|
+
onClick: function onClick() {
|
|
132
|
+
return onFilter === null || onFilter === void 0 ? void 0 : onFilter(pathWithoutOrdinal, actualValue, true);
|
|
133
|
+
}
|
|
134
|
+
}, "negative"), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
|
|
135
|
+
color: "primary",
|
|
136
|
+
size: "sm",
|
|
137
|
+
variant: "link",
|
|
138
|
+
icon: core.CoreIcons.funnelPlus,
|
|
139
|
+
"aria-label": "Filter",
|
|
140
|
+
onClick: function onClick() {
|
|
141
|
+
return onFilter === null || onFilter === void 0 ? void 0 : onFilter(pathWithoutOrdinal, actualValue);
|
|
142
|
+
}
|
|
143
|
+
}, "positive")] : [],
|
|
144
|
+
children: (_labeler = labeler === null || labeler === void 0 ? void 0 : labeler(path)) !== null && _labeler !== void 0 ? _labeler : field
|
|
145
|
+
});
|
|
146
|
+
}, [field, labeler, pathWithoutOrdinal, actualValue, canExpand, canFilter]);
|
|
147
|
+
return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
|
|
148
|
+
children: [showPropertyTree && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
149
|
+
className: classNames("py-2", inline && "flex flex-nowrap items-center"),
|
|
150
|
+
style: {
|
|
151
|
+
paddingInlineStart: level * 8
|
|
152
|
+
},
|
|
153
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
154
|
+
role: "none",
|
|
155
|
+
className: classNames("flex overflow-hidden items-center", inline && "flex-content"),
|
|
156
|
+
style: {
|
|
157
|
+
flexBasis: labelWidth
|
|
158
|
+
},
|
|
159
|
+
onClick: function onClick() {
|
|
160
|
+
return canExpand && setExpanded(!expanded);
|
|
161
|
+
},
|
|
162
|
+
children: [canExpand && /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
163
|
+
rtlFlip: true,
|
|
164
|
+
icon: expanded ? core.CoreIcons.chevronDown : core.CoreIcons.chevronRight
|
|
165
|
+
}), labelDisplay]
|
|
166
|
+
}), display && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
167
|
+
className: classNames("px-2", inline && "flex-1"),
|
|
168
|
+
children: [canCopy && /*#__PURE__*/jsxRuntime.jsx(core.Copy, {
|
|
169
|
+
size: "xs",
|
|
170
|
+
text: actualValue
|
|
171
|
+
}), display]
|
|
172
|
+
})]
|
|
173
|
+
}), !showPropertyTree && !children && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
174
|
+
className: classNames("py-2", inline && "flex flex-nowrap items-center"),
|
|
175
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
176
|
+
role: "none",
|
|
177
|
+
className: classNames("flex overflow-hidden items-center", inline && "flex-content"),
|
|
178
|
+
style: {
|
|
179
|
+
flexBasis: labelWidth
|
|
180
|
+
},
|
|
181
|
+
children: labelDisplay
|
|
182
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
183
|
+
className: classNames("px-2", inline && "flex-1"),
|
|
184
|
+
children: [canCopy && /*#__PURE__*/jsxRuntime.jsx(core.Copy, {
|
|
185
|
+
size: "xs",
|
|
186
|
+
text: value
|
|
187
|
+
}), display]
|
|
188
|
+
})]
|
|
189
|
+
}), expanded && (children === null || children === void 0 ? void 0 : children.map(function (item) {
|
|
190
|
+
return /*#__PURE__*/jsxRuntime.jsx(JsonEntry, _objectSpread(_objectSpread({}, item), {}, {
|
|
191
|
+
level: level + 1,
|
|
192
|
+
copy: copy,
|
|
193
|
+
inline: inline,
|
|
194
|
+
showPropertyTree: showPropertyTree,
|
|
195
|
+
propertyScheme: propertyScheme,
|
|
196
|
+
filters: filters,
|
|
197
|
+
labelWidth: labelWidth,
|
|
198
|
+
formatter: formatter,
|
|
199
|
+
labeler: labeler,
|
|
200
|
+
onFilter: onFilter
|
|
201
|
+
}), item.path);
|
|
202
|
+
}))]
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
var JsonViewer = function JsonViewer(_ref5) {
|
|
206
|
+
var className = _ref5.className,
|
|
207
|
+
json = _ref5.json,
|
|
208
|
+
copy = _ref5.copy,
|
|
209
|
+
propertyScheme = _ref5.propertyScheme,
|
|
210
|
+
filters = _ref5.filters,
|
|
211
|
+
inline = _ref5.inline,
|
|
212
|
+
labelWidth = _ref5.labelWidth,
|
|
213
|
+
formatter = _ref5.formatter,
|
|
214
|
+
labeler = _ref5.labeler,
|
|
215
|
+
onFilter = _ref5.onFilter,
|
|
216
|
+
emptyMessage = _ref5.emptyMessage,
|
|
217
|
+
_ref5$showPropertyTre = _ref5.showPropertyTree,
|
|
218
|
+
showPropertyTree = _ref5$showPropertyTre === void 0 ? true : _ref5$showPropertyTre,
|
|
219
|
+
rest = _objectWithoutProperties(_ref5, _excluded);
|
|
220
|
+
var _useTranslation2 = reactI18next.useTranslation("data"),
|
|
221
|
+
t = _useTranslation2.t;
|
|
222
|
+
var list = react.useMemo(function () {
|
|
223
|
+
return reduceObject(json);
|
|
224
|
+
}, [json]);
|
|
225
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
226
|
+
className: classNames(className, "p-4 bg-alternate"),
|
|
227
|
+
children: !utilities.isEmpty(json) ? list.map(function (item) {
|
|
228
|
+
return /*#__PURE__*/jsxRuntime.jsx(JsonEntry, _objectSpread(_objectSpread({}, item), {}, {
|
|
229
|
+
copy: copy,
|
|
230
|
+
inline: inline,
|
|
231
|
+
showPropertyTree: showPropertyTree,
|
|
232
|
+
propertyScheme: propertyScheme,
|
|
233
|
+
filters: filters,
|
|
234
|
+
labelWidth: labelWidth,
|
|
235
|
+
formatter: formatter,
|
|
236
|
+
labeler: labeler,
|
|
237
|
+
onFilter: onFilter
|
|
238
|
+
}), item.path);
|
|
239
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(core.EmptyContent, {
|
|
240
|
+
size: "sm",
|
|
241
|
+
message: emptyMessage !== null && emptyMessage !== void 0 ? emptyMessage : t("json.empty")
|
|
242
|
+
})
|
|
243
|
+
}));
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
exports.JsonViewer = JsonViewer;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var core = require('@react-fabric/core');
|
|
5
|
+
var classNames = require('classnames');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
|
|
9
|
+
var Pagination = /*#__PURE__*/react.memo(function (_ref) {
|
|
10
|
+
var page = _ref.page,
|
|
11
|
+
ranges = _ref.ranges,
|
|
12
|
+
totalPages = _ref.totalPages,
|
|
13
|
+
minimal = _ref.minimal,
|
|
14
|
+
onPageChange = _ref.onPageChange;
|
|
15
|
+
var _ranges = _slicedToArray(ranges, 3),
|
|
16
|
+
start = _ranges[0],
|
|
17
|
+
mid = _ranges[1],
|
|
18
|
+
last = _ranges[2];
|
|
19
|
+
var pageBody = react.useMemo(function () {
|
|
20
|
+
return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
|
|
21
|
+
children: [start === null || start === void 0 ? void 0 : start.map(function (pg) {
|
|
22
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
23
|
+
onClick: function onClick() {
|
|
24
|
+
return onPageChange(pg);
|
|
25
|
+
},
|
|
26
|
+
className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === pg && "bg-primary-500 text-white pointer-events-none"),
|
|
27
|
+
children: pg + 1
|
|
28
|
+
}, pg);
|
|
29
|
+
}), mid && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
30
|
+
className: "leading-none inline-block w-8 text-center text-dimmed",
|
|
31
|
+
children: "..."
|
|
32
|
+
}), mid === null || mid === void 0 ? void 0 : mid.map(function (pg) {
|
|
33
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
34
|
+
onClick: function onClick() {
|
|
35
|
+
return onPageChange(pg);
|
|
36
|
+
},
|
|
37
|
+
className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === pg && "bg-primary-500 text-white pointer-events-none"),
|
|
38
|
+
children: pg + 1
|
|
39
|
+
}, pg);
|
|
40
|
+
}), last && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
41
|
+
className: "leading-none inline-block w-8 text-center text-dimmed",
|
|
42
|
+
children: "..."
|
|
43
|
+
}), last === null || last === void 0 ? void 0 : last.map(function (pg) {
|
|
44
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
45
|
+
onClick: function onClick() {
|
|
46
|
+
return onPageChange(pg);
|
|
47
|
+
},
|
|
48
|
+
className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === pg && "bg-primary-500 text-white pointer-events-none"),
|
|
49
|
+
children: pg + 1
|
|
50
|
+
}, pg);
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}, [start, mid, last, page]);
|
|
54
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
55
|
+
className: "inline-flex items-center",
|
|
56
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("button", {
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return onPageChange(0);
|
|
59
|
+
},
|
|
60
|
+
className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === 0 && "pointer-events-none text-tint-300"),
|
|
61
|
+
children: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
62
|
+
icon: core.CoreIcons.chevronsLeft,
|
|
63
|
+
rtlFlip: true
|
|
64
|
+
})
|
|
65
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
66
|
+
onClick: function onClick() {
|
|
67
|
+
return onPageChange(page - 1);
|
|
68
|
+
},
|
|
69
|
+
className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page === 0 && "pointer-events-none text-tint-300"),
|
|
70
|
+
children: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
71
|
+
icon: core.CoreIcons.chevronLeft,
|
|
72
|
+
rtlFlip: true
|
|
73
|
+
})
|
|
74
|
+
}), !minimal && pageBody, minimal && /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
75
|
+
className: "leading-none inline-block px-1 text-center text-sm select-none fixed-numbers",
|
|
76
|
+
children: [page + 1, "/", totalPages]
|
|
77
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
78
|
+
onClick: function onClick() {
|
|
79
|
+
return onPageChange(page + 1);
|
|
80
|
+
},
|
|
81
|
+
className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page + 1 >= totalPages && "pointer-events-none text-tint-300"),
|
|
82
|
+
children: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
83
|
+
icon: core.CoreIcons.chevronRight,
|
|
84
|
+
rtlFlip: true
|
|
85
|
+
})
|
|
86
|
+
}), /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
87
|
+
onClick: function onClick() {
|
|
88
|
+
return onPageChange(totalPages - 1);
|
|
89
|
+
},
|
|
90
|
+
className: classNames("leading-none text-sm hover:bg-primary-200 w-8 h-6 rounded-full", page + 1 >= totalPages && "pointer-events-none text-tint-300"),
|
|
91
|
+
children: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
92
|
+
icon: core.CoreIcons.chevronsRight,
|
|
93
|
+
rtlFlip: true
|
|
94
|
+
})
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
Pagination.displayName = "Pagination";
|
|
99
|
+
|
|
100
|
+
exports.Pagination = Pagination;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var classNames = require('classnames');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* React Fabric
|
|
8
|
+
* @version: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* The MIT License (MIT)
|
|
12
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
15
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
16
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
17
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
+
* subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
21
|
+
* portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
24
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
25
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
var BodyCell = function BodyCell(_ref) {
|
|
30
|
+
var _column$width, _column$minWidth, _column$maxWidth, _column$renderer, _column$renderer2;
|
|
31
|
+
var column = _ref.column,
|
|
32
|
+
item = _ref.item;
|
|
33
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
34
|
+
className: "overflow-hidden bg-inherit start-0",
|
|
35
|
+
style: {
|
|
36
|
+
width: (_column$width = column.width) !== null && _column$width !== void 0 ? _column$width : "12rem",
|
|
37
|
+
minWidth: (_column$minWidth = column.minWidth) !== null && _column$minWidth !== void 0 ? _column$minWidth : "2rem",
|
|
38
|
+
maxWidth: (_column$maxWidth = column.maxWidth) !== null && _column$maxWidth !== void 0 ? _column$maxWidth : "32rem"
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41
|
+
className: classNames("px-2 py-1 border-e truncate", column.align === "center" && "text-center", column.align === "end" && "text-end"),
|
|
42
|
+
children: (_column$renderer = (_column$renderer2 = column.renderer) === null || _column$renderer2 === void 0 ? void 0 : _column$renderer2.call(column, item[column.id], item)) !== null && _column$renderer !== void 0 ? _column$renderer : item[column.id]
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.BodyCell = BodyCell;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@react-fabric/core');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* React Fabric
|
|
8
|
+
* @version: 1.0.0
|
|
9
|
+
*
|
|
10
|
+
*
|
|
11
|
+
* The MIT License (MIT)
|
|
12
|
+
* Copyright (c) 2024 Adarsh Pastakia
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
15
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
16
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
17
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
18
|
+
* subject to the following conditions:
|
|
19
|
+
*
|
|
20
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
21
|
+
* portions of the Software.
|
|
22
|
+
*
|
|
23
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
24
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
25
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
26
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
var HeaderCell = function HeaderCell(_ref) {
|
|
30
|
+
var label = _ref.label,
|
|
31
|
+
icon = _ref.icon,
|
|
32
|
+
iconBg = _ref.iconBg,
|
|
33
|
+
iconColor = _ref.iconColor,
|
|
34
|
+
rtlFlip = _ref.rtlFlip;
|
|
35
|
+
_ref.actions;
|
|
36
|
+
_ref.locked;
|
|
37
|
+
var resizable = _ref.resizable,
|
|
38
|
+
width = _ref.width,
|
|
39
|
+
maxWidth = _ref.maxWidth,
|
|
40
|
+
minWidth = _ref.minWidth;
|
|
41
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
42
|
+
className: "group font-medium border-e flex flex-nowrap text-start items-center",
|
|
43
|
+
style: {
|
|
44
|
+
width: width !== null && width !== void 0 ? width : "12rem",
|
|
45
|
+
minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : "2rem",
|
|
46
|
+
maxWidth: maxWidth !== null && maxWidth !== void 0 ? maxWidth : "32rem"
|
|
47
|
+
},
|
|
48
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
49
|
+
className: "flex-1 px-2 py-1 text-sm truncate sticky start-0",
|
|
50
|
+
children: [icon && /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
51
|
+
icon: icon,
|
|
52
|
+
bg: iconBg,
|
|
53
|
+
color: iconColor,
|
|
54
|
+
rtlFlip: rtlFlip
|
|
55
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
56
|
+
children: label !== null && label !== void 0 ? label : " "
|
|
57
|
+
})]
|
|
58
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(core.Dropdown, {
|
|
59
|
+
placement: "bottom-start",
|
|
60
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
61
|
+
icon: core.CoreIcons.caretDown,
|
|
62
|
+
className: "outline bg-base me-0.5 flex-content hidden group-hover:inline-block data-[dropdown-open]:inline-block"
|
|
63
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(core.Menu, {
|
|
64
|
+
className: "text-sm",
|
|
65
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
66
|
+
label: "Sort ascending",
|
|
67
|
+
icon: core.CoreIcons.sortAsc
|
|
68
|
+
}), /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
69
|
+
label: "Sort descending",
|
|
70
|
+
icon: core.CoreIcons.sortDesc
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
}), resizable && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
74
|
+
className: "cursor-col-resize border-e bg-transparent border-tint-200 w-[5px] self-stretch"
|
|
75
|
+
})]
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
exports.HeaderCell = HeaderCell;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var BodyCell = require('./BodyCell.js');
|
|
6
|
+
var HeaderCell = require('./HeaderCell.js');
|
|
7
|
+
var useTableColumns = require('./useTableColumns.js');
|
|
8
|
+
var useVirtualTable = require('./useVirtualTable.js');
|
|
9
|
+
var classNames = require('classnames');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
var Table = function Table(_ref) {
|
|
15
|
+
var _columnMap$start, _columnMap$cols, _columnMap$end, _items$, _columnMap$start3, _columnMap$cols3, _columnMap$end3, _columnMap$start4, _columnMap$cols4, _columnMap$end4;
|
|
16
|
+
var data = _ref.data,
|
|
17
|
+
columns = _ref.columns;
|
|
18
|
+
var _useTableColumns = useTableColumns.useTableColumns(columns),
|
|
19
|
+
columnMap = _useTableColumns.columnMap;
|
|
20
|
+
var _useVirtualTable = useVirtualTable.useVirtualTable(data),
|
|
21
|
+
scrollerRef = _useVirtualTable.scrollerRef,
|
|
22
|
+
items = _useVirtualTable.items,
|
|
23
|
+
getData = _useVirtualTable.getData,
|
|
24
|
+
totalSize = _useVirtualTable.totalSize,
|
|
25
|
+
measureElement = _useVirtualTable.measureElement;
|
|
26
|
+
var wrapperStart = react.useMemo(function () {
|
|
27
|
+
return "bg-inherit sticky start-0 flex flex-nowrap z-1";
|
|
28
|
+
}, []);
|
|
29
|
+
var wrapperEnd = react.useMemo(function () {
|
|
30
|
+
return "bg-inherit sticky end-0 flex flex-nowrap z-1 border-s -ms-px";
|
|
31
|
+
}, []);
|
|
32
|
+
var emptyCol = react.useCallback(function (col, idc) {
|
|
33
|
+
var _col$width, _col$minWidth, _col$maxWidth;
|
|
34
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
35
|
+
className: "overflow-hidden border-e",
|
|
36
|
+
style: {
|
|
37
|
+
width: (_col$width = col.width) !== null && _col$width !== void 0 ? _col$width : "12rem",
|
|
38
|
+
minWidth: (_col$minWidth = col.minWidth) !== null && _col$minWidth !== void 0 ? _col$minWidth : "2rem",
|
|
39
|
+
maxWidth: (_col$maxWidth = col.maxWidth) !== null && _col$maxWidth !== void 0 ? _col$maxWidth : "32rem"
|
|
40
|
+
}
|
|
41
|
+
}, "blank:".concat(idc));
|
|
42
|
+
}, []);
|
|
43
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
44
|
+
className: "grid area-content overflow-auto relative",
|
|
45
|
+
style: {
|
|
46
|
+
gridTemplate: "\"head\" auto \"content\" 1fr \"foot\" auto/1fr"
|
|
47
|
+
},
|
|
48
|
+
ref: scrollerRef,
|
|
49
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
50
|
+
className: "bg-base font-medium sticky top-0 area-head border-b select-none flex flex-nowrap z-2",
|
|
51
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
52
|
+
className: wrapperStart,
|
|
53
|
+
children: (_columnMap$start = columnMap.start) === null || _columnMap$start === void 0 ? void 0 : _columnMap$start.map(function (col, idx) {
|
|
54
|
+
return /*#__PURE__*/jsxRuntime.jsx(HeaderCell.HeaderCell, _objectSpread({}, col), idx);
|
|
55
|
+
})
|
|
56
|
+
}), (_columnMap$cols = columnMap.cols) === null || _columnMap$cols === void 0 ? void 0 : _columnMap$cols.map(function (col, idx) {
|
|
57
|
+
return /*#__PURE__*/jsxRuntime.jsx(HeaderCell.HeaderCell, _objectSpread({}, col), idx);
|
|
58
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
59
|
+
className: wrapperEnd,
|
|
60
|
+
children: (_columnMap$end = columnMap.end) === null || _columnMap$end === void 0 ? void 0 : _columnMap$end.map(function (col, idx) {
|
|
61
|
+
return /*#__PURE__*/jsxRuntime.jsx(HeaderCell.HeaderCell, _objectSpread({}, col), idx);
|
|
62
|
+
})
|
|
63
|
+
})]
|
|
64
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
65
|
+
className: "area-content flex flex-col flex-nowrap",
|
|
66
|
+
style: {
|
|
67
|
+
height: totalSize()
|
|
68
|
+
},
|
|
69
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
70
|
+
style: {
|
|
71
|
+
height: (_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.start
|
|
72
|
+
}
|
|
73
|
+
}), items.map(function (_ref2) {
|
|
74
|
+
var _columnMap$start2, _columnMap$cols2, _columnMap$end2;
|
|
75
|
+
var index = _ref2.index,
|
|
76
|
+
key = _ref2.key;
|
|
77
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
78
|
+
className: classNames("flex flex-nowrap", index % 2 ? "bg-even" : "bg-odd"),
|
|
79
|
+
"data-index": index,
|
|
80
|
+
ref: measureElement,
|
|
81
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
82
|
+
className: wrapperStart,
|
|
83
|
+
children: (_columnMap$start2 = columnMap.start) === null || _columnMap$start2 === void 0 ? void 0 : _columnMap$start2.map(function (col, ids) {
|
|
84
|
+
return /*#__PURE__*/jsxRuntime.jsx(BodyCell.BodyCell, {
|
|
85
|
+
column: col,
|
|
86
|
+
item: getData(index)
|
|
87
|
+
}, "".concat(key, ":").concat(ids));
|
|
88
|
+
})
|
|
89
|
+
}), (_columnMap$cols2 = columnMap.cols) === null || _columnMap$cols2 === void 0 ? void 0 : _columnMap$cols2.map(function (col, idc) {
|
|
90
|
+
return /*#__PURE__*/jsxRuntime.jsx(BodyCell.BodyCell, {
|
|
91
|
+
column: col,
|
|
92
|
+
item: getData(index)
|
|
93
|
+
}, "".concat(key, ":").concat(idc));
|
|
94
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
95
|
+
className: wrapperEnd,
|
|
96
|
+
children: (_columnMap$end2 = columnMap.end) === null || _columnMap$end2 === void 0 ? void 0 : _columnMap$end2.map(function (col, ide) {
|
|
97
|
+
return /*#__PURE__*/jsxRuntime.jsx(BodyCell.BodyCell, {
|
|
98
|
+
column: col,
|
|
99
|
+
item: getData(index)
|
|
100
|
+
}, "".concat(key, ":").concat(ide));
|
|
101
|
+
})
|
|
102
|
+
})]
|
|
103
|
+
}, key);
|
|
104
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
105
|
+
className: "flex-1 flex flex-nowrap",
|
|
106
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
107
|
+
className: wrapperStart,
|
|
108
|
+
children: (_columnMap$start3 = columnMap.start) === null || _columnMap$start3 === void 0 ? void 0 : _columnMap$start3.map(emptyCol)
|
|
109
|
+
}), (_columnMap$cols3 = columnMap.cols) === null || _columnMap$cols3 === void 0 ? void 0 : _columnMap$cols3.map(emptyCol), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
110
|
+
className: wrapperEnd,
|
|
111
|
+
children: (_columnMap$end3 = columnMap.end) === null || _columnMap$end3 === void 0 ? void 0 : _columnMap$end3.map(emptyCol)
|
|
112
|
+
})]
|
|
113
|
+
})]
|
|
114
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
115
|
+
className: "area-foot bg-dimmed border-t sticky bottom-0 flex flex-nowrap z-2",
|
|
116
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
117
|
+
className: wrapperStart,
|
|
118
|
+
children: (_columnMap$start4 = columnMap.start) === null || _columnMap$start4 === void 0 ? void 0 : _columnMap$start4.map(function (col, idx) {
|
|
119
|
+
return /*#__PURE__*/jsxRuntime.jsx(HeaderCell.HeaderCell, _objectSpread({}, col), idx);
|
|
120
|
+
})
|
|
121
|
+
}), (_columnMap$cols4 = columnMap.cols) === null || _columnMap$cols4 === void 0 ? void 0 : _columnMap$cols4.map(function (col, idx) {
|
|
122
|
+
return /*#__PURE__*/jsxRuntime.jsx(HeaderCell.HeaderCell, _objectSpread({}, col), idx);
|
|
123
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
124
|
+
className: wrapperEnd,
|
|
125
|
+
children: (_columnMap$end4 = columnMap.end) === null || _columnMap$end4 === void 0 ? void 0 : _columnMap$end4.map(function (col, idx) {
|
|
126
|
+
return /*#__PURE__*/jsxRuntime.jsx(HeaderCell.HeaderCell, _objectSpread({}, col), idx);
|
|
127
|
+
})
|
|
128
|
+
})]
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
exports.Table = Table;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
4
|
+
var utilities = require('@react-fabric/utilities');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
|
|
7
|
+
var useTableColumns = function useTableColumns(columns) {
|
|
8
|
+
var _useState = react.useState({
|
|
9
|
+
start: [],
|
|
10
|
+
end: [],
|
|
11
|
+
cols: []
|
|
12
|
+
}),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
columnMap = _useState2[0],
|
|
15
|
+
setColumnMap = _useState2[1];
|
|
16
|
+
react.useEffect(function () {
|
|
17
|
+
setColumnMap(utilities.groupBy(columns.filter(function (col) {
|
|
18
|
+
return !(col.hideable && col.hidden);
|
|
19
|
+
}), "locked", "cols"));
|
|
20
|
+
}, [columns]);
|
|
21
|
+
return {
|
|
22
|
+
columnMap: columnMap
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.useTableColumns = useTableColumns;
|