@plasmicpkgs/plasmic-rich-components 1.0.98 → 1.0.101
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/.tsbuildinfo +1 -0
- package/dist/field-mappings.d.ts +1 -6
- package/dist/field-react-utils.d.ts +1 -1
- package/dist/index.js +2396 -2066
- package/dist/index.js.map +1 -1
- package/dist/plasmic-rich-components.esm.js +2397 -2067
- package/dist/plasmic-rich-components.esm.js.map +1 -1
- package/dist/rich-details/RichDetails.d.ts +0 -1
- package/package.json +11 -6
- package/dist/queries.d.ts +0 -10
|
@@ -2,7 +2,8 @@ import registerComponent from '@plasmicapp/host/registerComponent';
|
|
|
2
2
|
import '@plasmicapp/host/registerGlobalContext';
|
|
3
3
|
import 'lodash/get';
|
|
4
4
|
import React, { useState, useEffect, useRef } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { normalizeData, deriveFieldConfigs } from '@plasmicapp/data-sources';
|
|
6
|
+
import { Checkbox, Switch, Empty, Descriptions, theme, ConfigProvider, Dropdown, Button, Input, List, Tag, Card } from 'antd';
|
|
6
7
|
import { tinycolor } from '@ctrl/tinycolor';
|
|
7
8
|
import { LogoutOutlined, PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
|
|
8
9
|
import { ProLayout, ProConfigProvider, ProTable } from '@ant-design/pro-components';
|
|
@@ -12,2243 +13,2572 @@ import fastStringify from 'fast-stringify';
|
|
|
12
13
|
import classNames from 'classnames';
|
|
13
14
|
import groupBy from 'lodash/groupBy';
|
|
14
15
|
|
|
15
|
-
/*! *****************************************************************************
|
|
16
|
-
Copyright (c) Microsoft Corporation.
|
|
17
|
-
|
|
18
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
19
|
-
purpose with or without fee is hereby granted.
|
|
20
|
-
|
|
21
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
22
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
23
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
24
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
25
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
26
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
27
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
28
|
-
***************************************************************************** */
|
|
29
|
-
|
|
30
|
-
var __assign = function() {
|
|
31
|
-
__assign = Object.assign || function __assign(t) {
|
|
32
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
33
|
-
s = arguments[i];
|
|
34
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
35
|
-
}
|
|
36
|
-
return t;
|
|
37
|
-
};
|
|
38
|
-
return __assign.apply(this, arguments);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
function __rest(s, e) {
|
|
42
|
-
var t = {};
|
|
43
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
44
|
-
t[p] = s[p];
|
|
45
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
46
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
47
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
48
|
-
t[p[i]] = s[p[i]];
|
|
49
|
-
}
|
|
50
|
-
return t;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
54
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
55
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
56
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
57
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
58
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
59
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function __generator(thisArg, body) {
|
|
64
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
65
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
66
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
67
|
-
function step(op) {
|
|
68
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
69
|
-
while (_) try {
|
|
70
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
71
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
72
|
-
switch (op[0]) {
|
|
73
|
-
case 0: case 1: t = op; break;
|
|
74
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
75
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
76
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
77
|
-
default:
|
|
78
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
79
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
80
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
81
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
82
|
-
if (t[2]) _.ops.pop();
|
|
83
|
-
_.trys.pop(); continue;
|
|
84
|
-
}
|
|
85
|
-
op = body.call(thisArg, _);
|
|
86
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
87
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function __spreadArray(to, from, pack) {
|
|
92
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
93
|
-
if (ar || !(i in from)) {
|
|
94
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
95
|
-
ar[i] = from[i];
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
16
|
function registerComponentHelper(loader, component, meta) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
17
|
+
if (loader) {
|
|
18
|
+
loader.registerComponent(component, meta);
|
|
19
|
+
} else {
|
|
20
|
+
registerComponent(component, meta);
|
|
21
|
+
}
|
|
108
22
|
}
|
|
109
23
|
function ensure(x) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
24
|
+
if (x === null || x === void 0) {
|
|
25
|
+
throw new Error("Expected non-null or non-undefined value");
|
|
26
|
+
}
|
|
27
|
+
return x;
|
|
114
28
|
}
|
|
115
29
|
function isOneOf(elem, arr) {
|
|
116
|
-
|
|
30
|
+
return arr.includes(elem);
|
|
117
31
|
}
|
|
118
32
|
function maybe(x, f) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
33
|
+
if (x === void 0 || x === null)
|
|
34
|
+
return void 0;
|
|
35
|
+
return f(x);
|
|
122
36
|
}
|
|
123
37
|
function isLikeImage(value) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
: false;
|
|
127
|
-
}
|
|
128
|
-
// Some heuristics to avoid selecting a row when
|
|
129
|
-
// the object clicked is interactable -- like button, anchor,
|
|
130
|
-
// input, etc. This won't be bulletproof, so just some
|
|
131
|
-
// heuristics!
|
|
38
|
+
return typeof value === "string" ? value.match(/\.(png|jpg|jpeg|gif|svg|webp|avif|ico|bmp|tiff)$/i) : false;
|
|
39
|
+
}
|
|
132
40
|
function isInteractable(target) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
41
|
+
if (["A", "BUTTON", "INPUT", "TEXTAREA", "SELECT"].includes(target.tagName)) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
if (target.contentEditable === "true") {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
140
48
|
}
|
|
141
49
|
function ensureArray(xs) {
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
var tuple = function () {
|
|
145
|
-
var args = [];
|
|
146
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
147
|
-
args[_i] = arguments[_i];
|
|
148
|
-
}
|
|
149
|
-
return args;
|
|
150
|
-
};
|
|
151
|
-
function mkIdMap(xs) {
|
|
152
|
-
return new Map(xs.map(function (x) { return tuple(x.id, x); }));
|
|
153
|
-
}
|
|
154
|
-
var mkShortId = function () { return "".concat(Math.random()); };
|
|
155
|
-
function withoutNils(xs) {
|
|
156
|
-
return xs.filter(function (x) { return x != null; });
|
|
50
|
+
return Array.isArray(xs) ? xs : [xs];
|
|
157
51
|
}
|
|
52
|
+
const mkShortId = () => `${Math.random()}`;
|
|
158
53
|
function withoutFalsey(xs) {
|
|
159
|
-
|
|
54
|
+
return xs.filter((x) => !!x);
|
|
160
55
|
}
|
|
161
56
|
|
|
162
|
-
var
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
57
|
+
var __defProp$9 = Object.defineProperty;
|
|
58
|
+
var __defProps$7 = Object.defineProperties;
|
|
59
|
+
var __getOwnPropDescs$7 = Object.getOwnPropertyDescriptors;
|
|
60
|
+
var __getOwnPropSymbols$9 = Object.getOwnPropertySymbols;
|
|
61
|
+
var __hasOwnProp$9 = Object.prototype.hasOwnProperty;
|
|
62
|
+
var __propIsEnum$9 = Object.prototype.propertyIsEnumerable;
|
|
63
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
64
|
+
var __spreadValues$9 = (a, b) => {
|
|
65
|
+
for (var prop in b || (b = {}))
|
|
66
|
+
if (__hasOwnProp$9.call(b, prop))
|
|
67
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
68
|
+
if (__getOwnPropSymbols$9)
|
|
69
|
+
for (var prop of __getOwnPropSymbols$9(b)) {
|
|
70
|
+
if (__propIsEnum$9.call(b, prop))
|
|
71
|
+
__defNormalProp$9(a, prop, b[prop]);
|
|
72
|
+
}
|
|
73
|
+
return a;
|
|
166
74
|
};
|
|
167
|
-
var
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
75
|
+
var __spreadProps$7 = (a, b) => __defProps$7(a, __getOwnPropDescs$7(b));
|
|
76
|
+
var __objRest$2 = (source, exclude) => {
|
|
77
|
+
var target = {};
|
|
78
|
+
for (var prop in source)
|
|
79
|
+
if (__hasOwnProp$9.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
80
|
+
target[prop] = source[prop];
|
|
81
|
+
if (source != null && __getOwnPropSymbols$9)
|
|
82
|
+
for (var prop of __getOwnPropSymbols$9(source)) {
|
|
83
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$9.call(source, prop))
|
|
84
|
+
target[prop] = source[prop];
|
|
85
|
+
}
|
|
86
|
+
return target;
|
|
174
87
|
};
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
style: "long",
|
|
180
|
-
unit: "day",
|
|
88
|
+
const DEFAULT_CURRENCY_SETTINGS = {
|
|
89
|
+
dataType: "currency",
|
|
90
|
+
currency: "USD",
|
|
91
|
+
currencyDisplay: "narrowSymbol"
|
|
181
92
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
93
|
+
const NUMBER_TYPES = ["number", "percent", "currency"];
|
|
94
|
+
const DEFAULT_DATETIME_SETTINGS = {
|
|
95
|
+
dataType: "datetime",
|
|
96
|
+
locale: "en-US",
|
|
97
|
+
dateStyle: "short",
|
|
98
|
+
timeStyle: "short",
|
|
99
|
+
hour12: true
|
|
100
|
+
};
|
|
101
|
+
const DEFAULT_RELATIVE_DATETIME_SETTINGS = {
|
|
102
|
+
dataType: "relative-datetime",
|
|
103
|
+
locale: "en-US",
|
|
104
|
+
numeric: "always",
|
|
105
|
+
style: "long",
|
|
106
|
+
unit: "day"
|
|
107
|
+
};
|
|
108
|
+
const DATETIME_TYPES = ["datetime", "relative-datetime"];
|
|
109
|
+
const DEFAULT_BOOLEAN_SETTINGS = {
|
|
110
|
+
dataType: "boolean",
|
|
111
|
+
showAs: "checkbox"
|
|
186
112
|
};
|
|
187
|
-
function deriveFieldConfigs(specifiedFieldsPartial, schema, makeDefaultConfig) {
|
|
188
|
-
var _a;
|
|
189
|
-
var schemaFields = (_a = schema === null || schema === void 0 ? void 0 : schema.fields) !== null && _a !== void 0 ? _a : [];
|
|
190
|
-
var fieldById = mkIdMap(schemaFields);
|
|
191
|
-
var specifiedFieldIds = new Set(withoutNils(specifiedFieldsPartial.map(function (f) { return f.fieldId; })));
|
|
192
|
-
var keptSpecifiedFields = specifiedFieldsPartial.flatMap(function (f, index) {
|
|
193
|
-
var fieldId = f.fieldId;
|
|
194
|
-
if (!fieldId) {
|
|
195
|
-
return [
|
|
196
|
-
__assign(__assign(__assign({}, makeDefaultConfig(undefined)), { key: index }), f),
|
|
197
|
-
];
|
|
198
|
-
}
|
|
199
|
-
var field = fieldById.get(fieldId);
|
|
200
|
-
// Drop configs with fieldIds no longer in the data.
|
|
201
|
-
if (!field) {
|
|
202
|
-
return [];
|
|
203
|
-
}
|
|
204
|
-
return [
|
|
205
|
-
__assign(__assign({}, makeDefaultConfig(field)), f),
|
|
206
|
-
];
|
|
207
|
-
});
|
|
208
|
-
var newVirtualFields = schemaFields
|
|
209
|
-
.filter(function (f) { return !specifiedFieldIds.has(f.id); })
|
|
210
|
-
.map(function (f) { return (__assign({}, makeDefaultConfig(f))); });
|
|
211
|
-
var mergedFields = __spreadArray(__spreadArray([], keptSpecifiedFields, true), newVirtualFields, true);
|
|
212
|
-
var minimalFullLengthFields = __spreadArray(__spreadArray([], specifiedFieldsPartial, true), newVirtualFields.map(function (f) { return ({ key: f.key, fieldId: f.fieldId }); }), true);
|
|
213
|
-
return { mergedFields: mergedFields, minimalFullLengthFields: minimalFullLengthFields };
|
|
214
|
-
}
|
|
215
113
|
function deriveValueType(cconfig) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
: cconfig.dataType === "number"
|
|
221
|
-
? "digit"
|
|
222
|
-
: cconfig.dataType === "boolean"
|
|
223
|
-
? "switch"
|
|
224
|
-
: undefined;
|
|
225
|
-
}
|
|
226
|
-
// Hacky "unique" string values
|
|
227
|
-
var NoneField = "||NoneField||";
|
|
228
|
-
var CustomField = "";
|
|
114
|
+
return cconfig.dataType === "auto" ? void 0 : cconfig.dataType === "string" ? "text" : cconfig.dataType === "number" ? "digit" : cconfig.dataType === "boolean" ? "switch" : void 0;
|
|
115
|
+
}
|
|
116
|
+
const NoneField = "||NoneField||";
|
|
117
|
+
const CustomField = "";
|
|
229
118
|
function getFieldSubprops(opts) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
return true;
|
|
258
|
-
},
|
|
259
|
-
}, title: {
|
|
260
|
-
type: "string",
|
|
261
|
-
displayName: "Title",
|
|
262
|
-
defaultValueHint: getDefaultValueHint("title"),
|
|
263
|
-
hidden: function () { return !!opts.noTitle; },
|
|
264
|
-
}, expr: __assign(__assign({}, rowDataType("Custom value")), { hidden: function (ps, ctx, _a) {
|
|
265
|
-
_a.item; _a.path;
|
|
266
|
-
return false;
|
|
267
|
-
} }), isHidden: {
|
|
268
|
-
type: "boolean",
|
|
269
|
-
displayName: "Is hidden",
|
|
270
|
-
defaultValueHint: getDefaultValueHint("isHidden"),
|
|
271
|
-
} }, (!opts.noDataType
|
|
272
|
-
? {
|
|
273
|
-
dataType: {
|
|
274
|
-
type: "choice",
|
|
275
|
-
displayName: "Data type",
|
|
276
|
-
options: [
|
|
277
|
-
{
|
|
278
|
-
value: "auto",
|
|
279
|
-
label: "Auto",
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
value: "number",
|
|
283
|
-
label: "Number",
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
value: "percent",
|
|
287
|
-
label: "Percentage",
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
value: "currency",
|
|
291
|
-
label: "Currency",
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
value: "string",
|
|
295
|
-
label: "String",
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
value: "boolean",
|
|
299
|
-
label: "Boolean",
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
value: "datetime",
|
|
303
|
-
label: "Date / Time",
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
value: "relative-datetime",
|
|
307
|
-
label: "Date / Time relative to now",
|
|
308
|
-
},
|
|
309
|
-
],
|
|
310
|
-
defaultValueHint: getDefaultValueHint("dataType"),
|
|
311
|
-
},
|
|
312
|
-
currency: {
|
|
313
|
-
displayName: "Currency",
|
|
314
|
-
description: "Must be a valid currency code",
|
|
315
|
-
type: "string",
|
|
316
|
-
defaultValueHint: "USD",
|
|
317
|
-
hidden: function (ps, ctx, _a) {
|
|
318
|
-
var item = _a.item;
|
|
319
|
-
return item.dataType !== "currency";
|
|
320
|
-
},
|
|
321
|
-
},
|
|
322
|
-
locale: {
|
|
323
|
-
displayName: "Locale",
|
|
324
|
-
description: "Must be a valid locale code",
|
|
325
|
-
type: "string",
|
|
326
|
-
defaultValueHint: "en-US",
|
|
327
|
-
hidden: function (ps, ctx, _a) {
|
|
328
|
-
var item = _a.item;
|
|
329
|
-
return !isOneOf(item.dataType, NUMBER_TYPES) &&
|
|
330
|
-
!isOneOf(item.dataType, DATETIME_TYPES);
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
notation: {
|
|
334
|
-
displayName: "Notation",
|
|
335
|
-
type: "choice",
|
|
336
|
-
options: [
|
|
337
|
-
{
|
|
338
|
-
value: "standard",
|
|
339
|
-
label: "Standard",
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
value: "scientific",
|
|
343
|
-
label: "Scientific notation (like 1E3)",
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
value: "compact",
|
|
347
|
-
label: "Compact (like 10K)",
|
|
348
|
-
},
|
|
349
|
-
],
|
|
350
|
-
defaultValueHint: "standard",
|
|
351
|
-
hidden: function (ps, ctx, _a) {
|
|
352
|
-
var item = _a.item;
|
|
353
|
-
return !isOneOf(item.dataType, NUMBER_TYPES);
|
|
354
|
-
},
|
|
355
|
-
},
|
|
356
|
-
signDisplay: {
|
|
357
|
-
type: "choice",
|
|
358
|
-
displayName: "Number sign",
|
|
359
|
-
options: [
|
|
360
|
-
{
|
|
361
|
-
value: "auto",
|
|
362
|
-
label: "Only for negative numbers (10, -10)",
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
value: "exceptZero",
|
|
366
|
-
label: "Positive or negative (+10, -10)",
|
|
367
|
-
},
|
|
368
|
-
],
|
|
369
|
-
defaultValueHint: "auto",
|
|
370
|
-
hidden: function (ps, ctx, _a) {
|
|
371
|
-
var item = _a.item;
|
|
372
|
-
return !isOneOf(item.dataType, NUMBER_TYPES);
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
maximumFractionDigits: {
|
|
376
|
-
type: "number",
|
|
377
|
-
displayName: "Max decimal places",
|
|
378
|
-
defaultValueHint: 3,
|
|
379
|
-
min: 0,
|
|
380
|
-
max: 20,
|
|
381
|
-
hidden: function (ps, ctx, _a) {
|
|
382
|
-
var item = _a.item;
|
|
383
|
-
return !isOneOf(item.dataType, NUMBER_TYPES);
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
minimumFractionDigits: {
|
|
387
|
-
type: "number",
|
|
388
|
-
displayName: "Min decimal places",
|
|
389
|
-
defaultValueHint: 0,
|
|
390
|
-
min: 0,
|
|
391
|
-
max: 20,
|
|
392
|
-
hidden: function (ps, ctx, _a) {
|
|
393
|
-
var item = _a.item;
|
|
394
|
-
return !isOneOf(item.dataType, NUMBER_TYPES);
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
showAs: {
|
|
398
|
-
type: "choice",
|
|
399
|
-
options: [
|
|
400
|
-
{
|
|
401
|
-
value: "checkbox",
|
|
402
|
-
label: "Checkboxes",
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
value: "switch",
|
|
406
|
-
label: "Toggle switches",
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
value: "text",
|
|
410
|
-
label: "Text",
|
|
411
|
-
},
|
|
412
|
-
],
|
|
413
|
-
displayName: "Show as",
|
|
414
|
-
defaultValueHint: "checkbox",
|
|
415
|
-
hidden: function (ps, ctx, _a) {
|
|
416
|
-
var item = _a.item;
|
|
417
|
-
return item.dataType !== "boolean";
|
|
418
|
-
},
|
|
419
|
-
},
|
|
420
|
-
dateStyle: {
|
|
421
|
-
displayName: "Date style",
|
|
422
|
-
type: "choice",
|
|
423
|
-
options: [
|
|
424
|
-
{
|
|
425
|
-
value: "none",
|
|
426
|
-
label: "None (don't display date)",
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
value: "short",
|
|
430
|
-
label: "Short (like 12/25/2023)",
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
value: "medium",
|
|
434
|
-
label: "Medium (like Dec 25, 2023)",
|
|
435
|
-
},
|
|
436
|
-
{
|
|
437
|
-
value: "long",
|
|
438
|
-
label: "Long (like December 25, 2023)",
|
|
439
|
-
},
|
|
440
|
-
{
|
|
441
|
-
value: "full",
|
|
442
|
-
label: "Full (like Monday, December 25, 2023)",
|
|
443
|
-
},
|
|
444
|
-
],
|
|
445
|
-
defaultValueHint: DEFAULT_DATETIME_SETTINGS.dateStyle,
|
|
446
|
-
hidden: function (ps, ctx, _a) {
|
|
447
|
-
var item = _a.item;
|
|
448
|
-
return item.dataType !== "datetime";
|
|
449
|
-
},
|
|
450
|
-
},
|
|
451
|
-
timeStyle: {
|
|
452
|
-
displayName: "Time style",
|
|
453
|
-
type: "choice",
|
|
454
|
-
options: [
|
|
455
|
-
{
|
|
456
|
-
value: "none",
|
|
457
|
-
label: "None (don't display time)",
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
value: "short",
|
|
461
|
-
label: "Short (like 4:00 PM)",
|
|
462
|
-
},
|
|
463
|
-
{
|
|
464
|
-
value: "medium",
|
|
465
|
-
label: "Medium (like 4:00:00 PM)",
|
|
466
|
-
},
|
|
467
|
-
{
|
|
468
|
-
value: "long",
|
|
469
|
-
label: "Long (like 4:00:00 PM PST)",
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
value: "full",
|
|
473
|
-
label: "Full (like 4:00:00 PM Pacific Standard Time)",
|
|
474
|
-
},
|
|
475
|
-
],
|
|
476
|
-
defaultValueHint: DEFAULT_DATETIME_SETTINGS.timeStyle,
|
|
477
|
-
hidden: function (ps, ctx, _a) {
|
|
478
|
-
var item = _a.item;
|
|
479
|
-
return item.dataType !== "datetime";
|
|
480
|
-
},
|
|
481
|
-
},
|
|
482
|
-
hour12: {
|
|
483
|
-
displayName: "Use AM/PM?",
|
|
484
|
-
description: "Whether to use AM/PM or 24-hour clock",
|
|
485
|
-
type: "boolean",
|
|
486
|
-
defaultValueHint: DEFAULT_DATETIME_SETTINGS.hour12,
|
|
487
|
-
hidden: function (ps, ctx, _a) {
|
|
488
|
-
var item = _a.item;
|
|
489
|
-
return item.dataType !== "datetime";
|
|
490
|
-
},
|
|
491
|
-
},
|
|
492
|
-
numeric: {
|
|
493
|
-
type: "choice",
|
|
494
|
-
displayName: "Use numbers?",
|
|
495
|
-
options: [
|
|
496
|
-
{ value: "always", label: "Always use numbers" },
|
|
497
|
-
{
|
|
498
|
-
value: "auto",
|
|
499
|
-
label: "Use words like 'Yesterday' or 'Tomorrow'",
|
|
500
|
-
},
|
|
501
|
-
],
|
|
502
|
-
defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.numeric,
|
|
503
|
-
hidden: function (ps, ctx, _a) {
|
|
504
|
-
var item = _a.item;
|
|
505
|
-
return item.dataType !== "relative-datetime";
|
|
506
|
-
},
|
|
507
|
-
},
|
|
508
|
-
unit: {
|
|
509
|
-
type: "choice",
|
|
510
|
-
displayName: "Time unit",
|
|
511
|
-
options: [
|
|
512
|
-
{
|
|
513
|
-
value: "second",
|
|
514
|
-
label: "Seconds",
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
value: "minute",
|
|
518
|
-
label: "Minutes",
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
value: "hour",
|
|
522
|
-
label: "Hours",
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
value: "day",
|
|
526
|
-
label: "Days",
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
value: "week",
|
|
530
|
-
label: "Weeks",
|
|
531
|
-
},
|
|
532
|
-
{
|
|
533
|
-
value: "month",
|
|
534
|
-
label: "Months",
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
value: "year",
|
|
538
|
-
label: "Years",
|
|
539
|
-
},
|
|
540
|
-
],
|
|
541
|
-
defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.unit,
|
|
542
|
-
hidden: function (ps, ctx, _a) {
|
|
543
|
-
var item = _a.item;
|
|
544
|
-
return item.dataType !== "relative-datetime";
|
|
545
|
-
},
|
|
546
|
-
},
|
|
119
|
+
return __spreadValues$9(__spreadValues$9({
|
|
120
|
+
key: {
|
|
121
|
+
type: "string",
|
|
122
|
+
hidden: () => true
|
|
123
|
+
},
|
|
124
|
+
fieldId: {
|
|
125
|
+
type: "choice",
|
|
126
|
+
displayName: "Field name",
|
|
127
|
+
readOnly: !opts.canChangeField,
|
|
128
|
+
options: (_props, ctx) => {
|
|
129
|
+
var _a, _b;
|
|
130
|
+
return withoutFalsey([
|
|
131
|
+
opts.canPickNoneField && { value: NoneField, label: "None" },
|
|
132
|
+
...((_b = (_a = ctx == null ? void 0 : ctx.schema) == null ? void 0 : _a.fields) != null ? _b : []).map((f) => {
|
|
133
|
+
var _a2;
|
|
134
|
+
return {
|
|
135
|
+
value: f.id,
|
|
136
|
+
label: (_a2 = f.label) != null ? _a2 : f.id
|
|
137
|
+
};
|
|
138
|
+
}),
|
|
139
|
+
{ value: CustomField, label: "Custom value" }
|
|
140
|
+
]);
|
|
141
|
+
},
|
|
142
|
+
hidden: (ps, ctx, { path: _controlPath }) => {
|
|
143
|
+
if (opts.canChangeField) {
|
|
144
|
+
return false;
|
|
547
145
|
}
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
title: {
|
|
150
|
+
type: "string",
|
|
151
|
+
displayName: "Title",
|
|
152
|
+
defaultValueHint: getDefaultValueHint("title"),
|
|
153
|
+
hidden: () => !!opts.noTitle
|
|
154
|
+
},
|
|
155
|
+
expr: __spreadProps$7(__spreadValues$9({}, rowDataType("Custom value")), {
|
|
156
|
+
hidden: (ps, ctx, { item, path: _controlPath }) => {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
isHidden: {
|
|
161
|
+
type: "boolean",
|
|
162
|
+
displayName: "Is hidden",
|
|
163
|
+
defaultValueHint: getDefaultValueHint("isHidden")
|
|
164
|
+
}
|
|
165
|
+
}, !opts.noDataType ? {
|
|
166
|
+
dataType: {
|
|
167
|
+
type: "choice",
|
|
168
|
+
displayName: "Data type",
|
|
169
|
+
options: [
|
|
170
|
+
{
|
|
171
|
+
value: "auto",
|
|
172
|
+
label: "Auto"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: "number",
|
|
176
|
+
label: "Number"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
value: "percent",
|
|
180
|
+
label: "Percentage"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
value: "currency",
|
|
184
|
+
label: "Currency"
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
value: "string",
|
|
188
|
+
label: "String"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
value: "boolean",
|
|
192
|
+
label: "Boolean"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
value: "datetime",
|
|
196
|
+
label: "Date / Time"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
value: "relative-datetime",
|
|
200
|
+
label: "Date / Time relative to now"
|
|
556
201
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
202
|
+
],
|
|
203
|
+
defaultValueHint: getDefaultValueHint("dataType")
|
|
204
|
+
},
|
|
205
|
+
currency: {
|
|
206
|
+
displayName: "Currency",
|
|
207
|
+
description: "Must be a valid currency code",
|
|
208
|
+
type: "string",
|
|
209
|
+
defaultValueHint: "USD",
|
|
210
|
+
hidden: (ps, ctx, { item }) => item.dataType !== "currency"
|
|
211
|
+
},
|
|
212
|
+
locale: {
|
|
213
|
+
displayName: "Locale",
|
|
214
|
+
description: "Must be a valid locale code",
|
|
215
|
+
type: "string",
|
|
216
|
+
defaultValueHint: "en-US",
|
|
217
|
+
hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES) && !isOneOf(item.dataType, DATETIME_TYPES)
|
|
218
|
+
},
|
|
219
|
+
notation: {
|
|
220
|
+
displayName: "Notation",
|
|
221
|
+
type: "choice",
|
|
222
|
+
options: [
|
|
223
|
+
{
|
|
224
|
+
value: "standard",
|
|
225
|
+
label: "Standard"
|
|
572
226
|
},
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
var advanced = _a.advanced, displayName = _a.displayName, _b = _a.minimalValue, minimalValue = _b === void 0 ? function (_props, contextData) { return contextData === null || contextData === void 0 ? void 0 : contextData.minimalFullLengthFields; } : _b, opts = __rest(_a, ["advanced", "displayName", "minimalValue"]);
|
|
577
|
-
return {
|
|
578
|
-
type: "array",
|
|
579
|
-
advanced: advanced,
|
|
580
|
-
displayName: displayName,
|
|
581
|
-
hidden: function (ps) { return !ps.data; },
|
|
582
|
-
unstable__keyFunc: function (x) { return x.key; },
|
|
583
|
-
unstable__minimalValue: minimalValue,
|
|
584
|
-
unstable__canDelete: function (ps, _props, ctx, _a) {
|
|
585
|
-
var item = _a.item;
|
|
586
|
-
if (opts.canChangeField) {
|
|
587
|
-
return true;
|
|
588
|
-
}
|
|
589
|
-
if (!(ctx === null || ctx === void 0 ? void 0 : ctx.schema)) {
|
|
590
|
-
// still loading...
|
|
591
|
-
return false;
|
|
592
|
-
}
|
|
593
|
-
if (item.fieldId &&
|
|
594
|
-
ctx.schema.fields.some(function (f) { return f.id === item.fieldId; })) {
|
|
595
|
-
return false;
|
|
596
|
-
}
|
|
597
|
-
return true;
|
|
227
|
+
{
|
|
228
|
+
value: "scientific",
|
|
229
|
+
label: "Scientific notation (like 1E3)"
|
|
598
230
|
},
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
231
|
+
{
|
|
232
|
+
value: "compact",
|
|
233
|
+
label: "Compact (like 10K)"
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
defaultValueHint: "standard",
|
|
237
|
+
hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
|
|
238
|
+
},
|
|
239
|
+
signDisplay: {
|
|
240
|
+
type: "choice",
|
|
241
|
+
displayName: "Number sign",
|
|
242
|
+
options: [
|
|
243
|
+
{
|
|
244
|
+
value: "auto",
|
|
245
|
+
label: "Only for negative numbers (10, -10)"
|
|
606
246
|
},
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
function normalizeData(rawData) {
|
|
611
|
-
var _a;
|
|
612
|
-
if (!rawData) {
|
|
613
|
-
return undefined;
|
|
614
|
-
}
|
|
615
|
-
var dataArray = tryGetDataArray(rawData);
|
|
616
|
-
if (!dataArray) {
|
|
617
|
-
return undefined;
|
|
618
|
-
}
|
|
619
|
-
var schema = (_a = rawData.schema) !== null && _a !== void 0 ? _a : tryGetSchema(dataArray);
|
|
620
|
-
if (!schema) {
|
|
621
|
-
return undefined;
|
|
622
|
-
}
|
|
623
|
-
return { data: dataArray, schema: schema };
|
|
624
|
-
}
|
|
625
|
-
function tryGetDataArray(rawData) {
|
|
626
|
-
if (!rawData || typeof rawData !== "object") {
|
|
627
|
-
return undefined;
|
|
628
|
-
}
|
|
629
|
-
if (Array.isArray(rawData)) {
|
|
630
|
-
if (isArrayOfObjects(rawData)) {
|
|
631
|
-
return rawData;
|
|
247
|
+
{
|
|
248
|
+
value: "exceptZero",
|
|
249
|
+
label: "Positive or negative (+10, -10)"
|
|
632
250
|
}
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
251
|
+
],
|
|
252
|
+
defaultValueHint: "auto",
|
|
253
|
+
hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
|
|
254
|
+
},
|
|
255
|
+
maximumFractionDigits: {
|
|
256
|
+
type: "number",
|
|
257
|
+
displayName: "Max decimal places",
|
|
258
|
+
defaultValueHint: 3,
|
|
259
|
+
min: 0,
|
|
260
|
+
max: 20,
|
|
261
|
+
hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
|
|
262
|
+
},
|
|
263
|
+
minimumFractionDigits: {
|
|
264
|
+
type: "number",
|
|
265
|
+
displayName: "Min decimal places",
|
|
266
|
+
defaultValueHint: 0,
|
|
267
|
+
min: 0,
|
|
268
|
+
max: 20,
|
|
269
|
+
hidden: (ps, ctx, { item }) => !isOneOf(item.dataType, NUMBER_TYPES)
|
|
270
|
+
},
|
|
271
|
+
showAs: {
|
|
272
|
+
type: "choice",
|
|
273
|
+
options: [
|
|
274
|
+
{
|
|
275
|
+
value: "checkbox",
|
|
276
|
+
label: "Checkboxes"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
value: "switch",
|
|
280
|
+
label: "Toggle switches"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
value: "text",
|
|
284
|
+
label: "Text"
|
|
636
285
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
286
|
+
],
|
|
287
|
+
displayName: "Show as",
|
|
288
|
+
defaultValueHint: "checkbox",
|
|
289
|
+
hidden: (ps, ctx, { item }) => item.dataType !== "boolean"
|
|
290
|
+
},
|
|
291
|
+
dateStyle: {
|
|
292
|
+
displayName: "Date style",
|
|
293
|
+
type: "choice",
|
|
294
|
+
options: [
|
|
295
|
+
{
|
|
296
|
+
value: "none",
|
|
297
|
+
label: "None (don't display date)"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
value: "short",
|
|
301
|
+
label: "Short (like 12/25/2023)"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
value: "medium",
|
|
305
|
+
label: "Medium (like Dec 25, 2023)"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
value: "long",
|
|
309
|
+
label: "Long (like December 25, 2023)"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
value: "full",
|
|
313
|
+
label: "Full (like Monday, December 25, 2023)"
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
defaultValueHint: DEFAULT_DATETIME_SETTINGS.dateStyle,
|
|
317
|
+
hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
|
|
318
|
+
},
|
|
319
|
+
timeStyle: {
|
|
320
|
+
displayName: "Time style",
|
|
321
|
+
type: "choice",
|
|
322
|
+
options: [
|
|
323
|
+
{
|
|
324
|
+
value: "none",
|
|
325
|
+
label: "None (don't display time)"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
value: "short",
|
|
329
|
+
label: "Short (like 4:00 PM)"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
value: "medium",
|
|
333
|
+
label: "Medium (like 4:00:00 PM)"
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
value: "long",
|
|
337
|
+
label: "Long (like 4:00:00 PM PST)"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
value: "full",
|
|
341
|
+
label: "Full (like 4:00:00 PM Pacific Standard Time)"
|
|
641
342
|
}
|
|
642
|
-
|
|
643
|
-
|
|
343
|
+
],
|
|
344
|
+
defaultValueHint: DEFAULT_DATETIME_SETTINGS.timeStyle,
|
|
345
|
+
hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
|
|
346
|
+
},
|
|
347
|
+
hour12: {
|
|
348
|
+
displayName: "Use AM/PM?",
|
|
349
|
+
description: "Whether to use AM/PM or 24-hour clock",
|
|
350
|
+
type: "boolean",
|
|
351
|
+
defaultValueHint: DEFAULT_DATETIME_SETTINGS.hour12,
|
|
352
|
+
hidden: (ps, ctx, { item }) => item.dataType !== "datetime"
|
|
353
|
+
},
|
|
354
|
+
numeric: {
|
|
355
|
+
type: "choice",
|
|
356
|
+
displayName: "Use numbers?",
|
|
357
|
+
options: [
|
|
358
|
+
{ value: "always", label: "Always use numbers" },
|
|
359
|
+
{
|
|
360
|
+
value: "auto",
|
|
361
|
+
label: "Use words like 'Yesterday' or 'Tomorrow'"
|
|
362
|
+
}
|
|
363
|
+
],
|
|
364
|
+
defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.numeric,
|
|
365
|
+
hidden: (ps, ctx, { item }) => item.dataType !== "relative-datetime"
|
|
366
|
+
},
|
|
367
|
+
unit: {
|
|
368
|
+
type: "choice",
|
|
369
|
+
displayName: "Time unit",
|
|
370
|
+
options: [
|
|
371
|
+
{
|
|
372
|
+
value: "second",
|
|
373
|
+
label: "Seconds"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
value: "minute",
|
|
377
|
+
label: "Minutes"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
value: "hour",
|
|
381
|
+
label: "Hours"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
value: "day",
|
|
385
|
+
label: "Days"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
value: "week",
|
|
389
|
+
label: "Weeks"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
value: "month",
|
|
393
|
+
label: "Months"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
value: "year",
|
|
397
|
+
label: "Years"
|
|
644
398
|
}
|
|
399
|
+
],
|
|
400
|
+
defaultValueHint: DEFAULT_RELATIVE_DATETIME_SETTINGS.unit,
|
|
401
|
+
hidden: (ps, ctx, { item }) => item.dataType !== "relative-datetime"
|
|
645
402
|
}
|
|
646
|
-
|
|
647
|
-
|
|
403
|
+
} : {}), opts.fieldTypes);
|
|
404
|
+
}
|
|
405
|
+
function getDefaultValueHint(field) {
|
|
406
|
+
return (_props, contextData, { item }) => {
|
|
407
|
+
if (item == null ? void 0 : item.fieldId) {
|
|
408
|
+
const fieldSetting = contextData == null ? void 0 : contextData.mergedFields.find(
|
|
409
|
+
(f) => f.fieldId === item.fieldId
|
|
410
|
+
);
|
|
411
|
+
return fieldSetting == null ? void 0 : fieldSetting[field];
|
|
648
412
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
413
|
+
return void 0;
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
const rowDataType = (displayName, control) => ({
|
|
417
|
+
type: "function",
|
|
418
|
+
displayName,
|
|
419
|
+
control,
|
|
420
|
+
argNames: ["currentItem", "currentValue"],
|
|
421
|
+
argValues: (_props, ctx, { item }) => {
|
|
422
|
+
var _a;
|
|
423
|
+
const row = (_a = ctx == null ? void 0 : ctx.data) == null ? void 0 : _a[0];
|
|
424
|
+
const cell = item.fieldId ? row == null ? void 0 : row[item.fieldId] : void 0;
|
|
425
|
+
return [row, cell];
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
function buildFieldsPropType(_a) {
|
|
429
|
+
var _b = _a, {
|
|
430
|
+
advanced,
|
|
431
|
+
displayName,
|
|
432
|
+
minimalValue = (_props, contextData) => contextData == null ? void 0 : contextData.minimalFullLengthFields
|
|
433
|
+
} = _b, opts = __objRest$2(_b, [
|
|
434
|
+
"advanced",
|
|
435
|
+
"displayName",
|
|
436
|
+
"minimalValue"
|
|
437
|
+
]);
|
|
438
|
+
return {
|
|
439
|
+
type: "array",
|
|
440
|
+
advanced,
|
|
441
|
+
displayName,
|
|
442
|
+
hidden: (ps) => !ps.data,
|
|
443
|
+
unstable__keyFunc: (x) => x.key,
|
|
444
|
+
unstable__minimalValue: minimalValue,
|
|
445
|
+
unstable__canDelete: (ps, _props, ctx, { item }) => {
|
|
446
|
+
if (opts.canChangeField) {
|
|
447
|
+
return true;
|
|
448
|
+
}
|
|
449
|
+
if (!(ctx == null ? void 0 : ctx.schema)) {
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
if (item.fieldId && ctx.schema.fields.some((f) => f.id === item.fieldId)) {
|
|
453
|
+
return false;
|
|
454
|
+
}
|
|
455
|
+
return true;
|
|
456
|
+
},
|
|
457
|
+
itemType: {
|
|
458
|
+
type: "object",
|
|
459
|
+
nameFunc: (_item) => {
|
|
460
|
+
return _item.fieldId || _item.title || "Custom value";
|
|
461
|
+
},
|
|
462
|
+
fields: getFieldSubprops(opts)
|
|
463
|
+
}
|
|
464
|
+
};
|
|
688
465
|
}
|
|
689
466
|
|
|
467
|
+
var __defProp$8 = Object.defineProperty;
|
|
468
|
+
var __defProps$6 = Object.defineProperties;
|
|
469
|
+
var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
|
|
470
|
+
var __getOwnPropSymbols$8 = Object.getOwnPropertySymbols;
|
|
471
|
+
var __hasOwnProp$8 = Object.prototype.hasOwnProperty;
|
|
472
|
+
var __propIsEnum$8 = Object.prototype.propertyIsEnumerable;
|
|
473
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
474
|
+
var __spreadValues$8 = (a, b) => {
|
|
475
|
+
for (var prop in b || (b = {}))
|
|
476
|
+
if (__hasOwnProp$8.call(b, prop))
|
|
477
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
478
|
+
if (__getOwnPropSymbols$8)
|
|
479
|
+
for (var prop of __getOwnPropSymbols$8(b)) {
|
|
480
|
+
if (__propIsEnum$8.call(b, prop))
|
|
481
|
+
__defNormalProp$8(a, prop, b[prop]);
|
|
482
|
+
}
|
|
483
|
+
return a;
|
|
484
|
+
};
|
|
485
|
+
var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
|
|
690
486
|
function multiRenderValue(record, cconfigs) {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
487
|
+
return cconfigs == null ? void 0 : cconfigs.flatMap(
|
|
488
|
+
(cc) => cc.isHidden ? [] : [` \u2022 `, /* @__PURE__ */ React.createElement(React.Fragment, null, renderValue(record, cc))]
|
|
489
|
+
).slice(1);
|
|
694
490
|
}
|
|
695
491
|
function maybeRenderString(record, cconfig) {
|
|
696
|
-
|
|
697
|
-
? maybe(getFieldValue(record, cconfig), asString)
|
|
698
|
-
: undefined;
|
|
492
|
+
return cconfig && !cconfig.isHidden ? maybe(getFieldValue(record, cconfig), asString) : void 0;
|
|
699
493
|
}
|
|
700
494
|
function getFieldValue(record, cconfig) {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
495
|
+
let value = cconfig.fieldId ? record[cconfig.fieldId] : void 0;
|
|
496
|
+
if (cconfig.expr) {
|
|
497
|
+
value = cconfig.expr(record, value);
|
|
498
|
+
}
|
|
499
|
+
return value;
|
|
706
500
|
}
|
|
707
501
|
function renderValue(record, cconfig) {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
else if (cconfig.dataType === "datetime" && coerced instanceof Date) {
|
|
725
|
-
return renderDate(coerced, cconfig);
|
|
726
|
-
}
|
|
727
|
-
else if (cconfig.dataType === "relative-datetime" &&
|
|
728
|
-
coerced instanceof Date) {
|
|
729
|
-
return renderRelativeDate(coerced, cconfig);
|
|
730
|
-
}
|
|
731
|
-
return asString(value);
|
|
502
|
+
const value = getFieldValue(record, cconfig);
|
|
503
|
+
if (value == null) {
|
|
504
|
+
return "";
|
|
505
|
+
}
|
|
506
|
+
if (cconfig.dataType === "auto") {
|
|
507
|
+
return renderAuto(value);
|
|
508
|
+
} else {
|
|
509
|
+
const coerced = coerceValue(value, cconfig.dataType);
|
|
510
|
+
if (isOneOf(cconfig.dataType, NUMBER_TYPES) && typeof coerced === "number") {
|
|
511
|
+
return renderNumber(coerced, cconfig);
|
|
512
|
+
} else if (cconfig.dataType === "boolean" && typeof coerced === "boolean") {
|
|
513
|
+
return renderBoolean(coerced, cconfig);
|
|
514
|
+
} else if (cconfig.dataType === "datetime" && coerced instanceof Date) {
|
|
515
|
+
return renderDate(coerced, cconfig);
|
|
516
|
+
} else if (cconfig.dataType === "relative-datetime" && coerced instanceof Date) {
|
|
517
|
+
return renderRelativeDate(coerced, cconfig);
|
|
732
518
|
}
|
|
519
|
+
return asString(value);
|
|
520
|
+
}
|
|
733
521
|
}
|
|
734
522
|
function renderAuto(value) {
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
return asString(value);
|
|
748
|
-
}
|
|
749
|
-
else {
|
|
750
|
-
return renderAuto(coerced);
|
|
751
|
-
}
|
|
523
|
+
if (typeof value === "number") {
|
|
524
|
+
return renderNumber(value, { dataType: "number" });
|
|
525
|
+
} else if (typeof value === "boolean") {
|
|
526
|
+
return renderBoolean(value, DEFAULT_BOOLEAN_SETTINGS);
|
|
527
|
+
} else if (value instanceof Date) {
|
|
528
|
+
return renderDate(value, DEFAULT_DATETIME_SETTINGS);
|
|
529
|
+
} else {
|
|
530
|
+
const coerced = tryCoerceAuto(value);
|
|
531
|
+
if (coerced === CANNOT_COERCE) {
|
|
532
|
+
return asString(value);
|
|
533
|
+
} else {
|
|
534
|
+
return renderAuto(coerced);
|
|
752
535
|
}
|
|
536
|
+
}
|
|
753
537
|
}
|
|
754
538
|
function tryCoerceAuto(value) {
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
return coerced;
|
|
763
|
-
}
|
|
539
|
+
for (const dataType of [
|
|
540
|
+
"number",
|
|
541
|
+
"datetime"
|
|
542
|
+
]) {
|
|
543
|
+
const coerced = coerceValue(value, dataType);
|
|
544
|
+
if (coerced !== CANNOT_COERCE) {
|
|
545
|
+
return coerced;
|
|
764
546
|
}
|
|
765
|
-
|
|
547
|
+
}
|
|
548
|
+
return CANNOT_COERCE;
|
|
766
549
|
}
|
|
767
550
|
function renderNumber(value, cconfig) {
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}
|
|
551
|
+
if (cconfig.dataType === "number") {
|
|
552
|
+
return new Intl.NumberFormat(cconfig.locale, cconfig).format(value);
|
|
553
|
+
} else if (cconfig.dataType === "percent") {
|
|
554
|
+
return new Intl.NumberFormat(cconfig.locale, __spreadProps$6(__spreadValues$8({}, cconfig), {
|
|
555
|
+
style: "percent"
|
|
556
|
+
})).format(value);
|
|
557
|
+
} else if (cconfig.dataType === "currency") {
|
|
558
|
+
return new Intl.NumberFormat(cconfig.locale, __spreadProps$6(__spreadValues$8(__spreadValues$8({}, DEFAULT_CURRENCY_SETTINGS), cconfig), {
|
|
559
|
+
style: "currency"
|
|
560
|
+
})).format(value);
|
|
561
|
+
} else {
|
|
562
|
+
throw new Error(`Unexpected dataType ${cconfig.dataType}`);
|
|
563
|
+
}
|
|
780
564
|
}
|
|
781
565
|
function renderDate(value, cconfig) {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
566
|
+
const opts = __spreadValues$8(__spreadValues$8({}, DEFAULT_DATETIME_SETTINGS), cconfig);
|
|
567
|
+
if (opts.dateStyle === "none") {
|
|
568
|
+
delete opts["dateStyle"];
|
|
569
|
+
}
|
|
570
|
+
if (opts.timeStyle === "none") {
|
|
571
|
+
delete opts["timeStyle"];
|
|
572
|
+
}
|
|
573
|
+
return new Intl.DateTimeFormat(cconfig.locale, opts).format(value);
|
|
574
|
+
}
|
|
575
|
+
const SECOND_MS = 1e3;
|
|
576
|
+
const MINUTE_MS = 60 * SECOND_MS;
|
|
577
|
+
const HOUR_MS = 60 * MINUTE_MS;
|
|
578
|
+
const DAY_MS = 24 * HOUR_MS;
|
|
579
|
+
const WEEK_MS = 7 * DAY_MS;
|
|
580
|
+
const UNIT_TO_MS = {
|
|
581
|
+
second: SECOND_MS,
|
|
582
|
+
minute: MINUTE_MS,
|
|
583
|
+
hour: HOUR_MS,
|
|
584
|
+
day: DAY_MS,
|
|
585
|
+
week: WEEK_MS
|
|
802
586
|
};
|
|
803
|
-
|
|
587
|
+
const UNITS_BY_MS = Object.keys(UNIT_TO_MS);
|
|
804
588
|
function renderRelativeDate(value, cconfig) {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
var months = function (d) { return d.getFullYear() * 12 + d.getMonth() + 1; };
|
|
823
|
-
var diff = months(value) - months(new Date());
|
|
824
|
-
return formatter.format(diff, unit);
|
|
825
|
-
}
|
|
826
|
-
else {
|
|
827
|
-
throw new Error("Unexpected relative time unit ".concat(unit));
|
|
828
|
-
}
|
|
589
|
+
var _a;
|
|
590
|
+
const opts = __spreadValues$8(__spreadValues$8({}, DEFAULT_RELATIVE_DATETIME_SETTINGS), cconfig);
|
|
591
|
+
const unit = (_a = cconfig.unit) != null ? _a : "day";
|
|
592
|
+
const formatter = new Intl.RelativeTimeFormat(cconfig.locale, opts);
|
|
593
|
+
if (isOneOf(unit, UNITS_BY_MS)) {
|
|
594
|
+
const diff = value.getTime() - (/* @__PURE__ */ new Date()).getTime();
|
|
595
|
+
return formatter.format(Math.round(diff / UNIT_TO_MS[unit]), unit);
|
|
596
|
+
} else {
|
|
597
|
+
if (unit === "year") {
|
|
598
|
+
const diff = value.getFullYear() - (/* @__PURE__ */ new Date()).getFullYear();
|
|
599
|
+
return formatter.format(diff, unit);
|
|
600
|
+
} else if (unit === "month") {
|
|
601
|
+
const months = (d) => d.getFullYear() * 12 + d.getMonth() + 1;
|
|
602
|
+
const diff = months(value) - months(/* @__PURE__ */ new Date());
|
|
603
|
+
return formatter.format(diff, unit);
|
|
604
|
+
} else {
|
|
605
|
+
throw new Error(`Unexpected relative time unit ${unit}`);
|
|
829
606
|
}
|
|
607
|
+
}
|
|
830
608
|
}
|
|
831
609
|
function renderBoolean(value, cconfig) {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
return value ? "true" : "false";
|
|
842
|
-
}
|
|
610
|
+
var _a;
|
|
611
|
+
const showAs = (_a = cconfig.showAs) != null ? _a : DEFAULT_BOOLEAN_SETTINGS.showAs;
|
|
612
|
+
if (showAs === "checkbox") {
|
|
613
|
+
return /* @__PURE__ */ React.createElement(Checkbox, { checked: value });
|
|
614
|
+
} else if (showAs === "switch") {
|
|
615
|
+
return /* @__PURE__ */ React.createElement(Switch, { checked: value });
|
|
616
|
+
} else {
|
|
617
|
+
return value ? "true" : "false";
|
|
618
|
+
}
|
|
843
619
|
}
|
|
844
|
-
|
|
620
|
+
const CANNOT_COERCE = Symbol("plasmic-cannot-coerce");
|
|
845
621
|
function coerceValue(value, dataType) {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
return maybeNumber;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
else if (isOneOf(dataType, DATETIME_TYPES)) {
|
|
862
|
-
if (value instanceof Date) {
|
|
863
|
-
return value;
|
|
864
|
-
}
|
|
865
|
-
else if (typeof value === "number") {
|
|
866
|
-
return new Date(value);
|
|
867
|
-
}
|
|
868
|
-
else if (typeof value === "string") {
|
|
869
|
-
var maybeDate = new Date(value);
|
|
870
|
-
if (!isNaN(maybeDate.getTime())) {
|
|
871
|
-
return maybeDate;
|
|
872
|
-
}
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
else if (dataType === "boolean") {
|
|
876
|
-
if (value === true || value === false) {
|
|
877
|
-
return value;
|
|
878
|
-
}
|
|
879
|
-
else if (typeof value === "number") {
|
|
880
|
-
return value !== 0;
|
|
881
|
-
}
|
|
882
|
-
else if (typeof value === "string") {
|
|
883
|
-
return value.toLowerCase() === "true";
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
else if (dataType === "string") {
|
|
887
|
-
return asString(value);
|
|
622
|
+
if (value == null) {
|
|
623
|
+
return null;
|
|
624
|
+
}
|
|
625
|
+
try {
|
|
626
|
+
if (isOneOf(dataType, NUMBER_TYPES)) {
|
|
627
|
+
if (typeof value === "number") {
|
|
628
|
+
return value;
|
|
629
|
+
} else if (typeof value === "string") {
|
|
630
|
+
const maybeNumber = +value;
|
|
631
|
+
if (!isNaN(maybeNumber)) {
|
|
632
|
+
return maybeNumber;
|
|
888
633
|
}
|
|
889
|
-
|
|
890
|
-
|
|
634
|
+
}
|
|
635
|
+
} else if (isOneOf(dataType, DATETIME_TYPES)) {
|
|
636
|
+
if (value instanceof Date) {
|
|
637
|
+
return value;
|
|
638
|
+
} else if (typeof value === "number") {
|
|
639
|
+
return new Date(value);
|
|
640
|
+
} else if (typeof value === "string") {
|
|
641
|
+
const maybeDate = new Date(value);
|
|
642
|
+
if (!isNaN(maybeDate.getTime())) {
|
|
643
|
+
return maybeDate;
|
|
891
644
|
}
|
|
645
|
+
}
|
|
646
|
+
} else if (dataType === "boolean") {
|
|
647
|
+
if (value === true || value === false) {
|
|
648
|
+
return value;
|
|
649
|
+
} else if (typeof value === "number") {
|
|
650
|
+
return value !== 0;
|
|
651
|
+
} else if (typeof value === "string") {
|
|
652
|
+
return value.toLowerCase() === "true";
|
|
653
|
+
}
|
|
654
|
+
} else if (dataType === "string") {
|
|
655
|
+
return asString(value);
|
|
656
|
+
} else if (dataType === "auto") {
|
|
657
|
+
return value;
|
|
892
658
|
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
return CANNOT_COERCE;
|
|
659
|
+
} catch (err) {
|
|
660
|
+
}
|
|
661
|
+
return CANNOT_COERCE;
|
|
897
662
|
}
|
|
898
663
|
function asString(value) {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
}
|
|
909
|
-
else {
|
|
910
|
-
return JSON.stringify(value);
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
else {
|
|
914
|
-
return "".concat(value);
|
|
664
|
+
if (value == null) {
|
|
665
|
+
return "";
|
|
666
|
+
} else if (typeof value === "string") {
|
|
667
|
+
return value;
|
|
668
|
+
} else if (typeof value === "object") {
|
|
669
|
+
if ("toString" in value && typeof value.toString === "function") {
|
|
670
|
+
return value.toString();
|
|
671
|
+
} else {
|
|
672
|
+
return JSON.stringify(value);
|
|
915
673
|
}
|
|
674
|
+
} else {
|
|
675
|
+
return `${value}`;
|
|
676
|
+
}
|
|
916
677
|
}
|
|
917
678
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
679
|
+
var __defProp$7 = Object.defineProperty;
|
|
680
|
+
var __defProps$5 = Object.defineProperties;
|
|
681
|
+
var __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors;
|
|
682
|
+
var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
|
|
683
|
+
var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
|
|
684
|
+
var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
|
|
685
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
686
|
+
var __spreadValues$7 = (a, b) => {
|
|
687
|
+
for (var prop in b || (b = {}))
|
|
688
|
+
if (__hasOwnProp$7.call(b, prop))
|
|
689
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
690
|
+
if (__getOwnPropSymbols$7)
|
|
691
|
+
for (var prop of __getOwnPropSymbols$7(b)) {
|
|
692
|
+
if (__propIsEnum$7.call(b, prop))
|
|
693
|
+
__defNormalProp$7(a, prop, b[prop]);
|
|
925
694
|
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
695
|
+
return a;
|
|
696
|
+
};
|
|
697
|
+
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
698
|
+
function RichDetails(props) {
|
|
699
|
+
var _a;
|
|
700
|
+
const {
|
|
701
|
+
className,
|
|
702
|
+
data: rawData,
|
|
703
|
+
size,
|
|
704
|
+
bordered,
|
|
705
|
+
layout,
|
|
706
|
+
column = 2
|
|
707
|
+
} = props;
|
|
708
|
+
const data = normalizeData(rawData);
|
|
709
|
+
const { columnDefinitions } = useColumnDefinitions$1(data, props);
|
|
710
|
+
if (!data || !((_a = data.data) == null ? void 0 : _a[0])) {
|
|
711
|
+
return /* @__PURE__ */ React.createElement(Empty, { className, image: Empty.PRESENTED_IMAGE_SIMPLE });
|
|
712
|
+
}
|
|
713
|
+
const row = data.data[0];
|
|
714
|
+
return /* @__PURE__ */ React.createElement(
|
|
715
|
+
Descriptions,
|
|
716
|
+
{
|
|
717
|
+
className,
|
|
718
|
+
size,
|
|
719
|
+
bordered,
|
|
720
|
+
layout,
|
|
721
|
+
column: {
|
|
722
|
+
xs: 1,
|
|
723
|
+
sm: 1,
|
|
724
|
+
md: column
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
columnDefinitions.map((col) => /* @__PURE__ */ React.createElement(Descriptions.Item, { label: col.title, key: col.key, span: col.span }, col.render(row)))
|
|
728
|
+
);
|
|
932
729
|
}
|
|
933
730
|
function useColumnDefinitions$1(data, props) {
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
731
|
+
const { fields, setControlContextData } = props;
|
|
732
|
+
return React.useMemo(() => {
|
|
733
|
+
const schema = data == null ? void 0 : data.schema;
|
|
734
|
+
if (!data || !schema) {
|
|
735
|
+
return { normalized: [], columnDefinitions: [] };
|
|
736
|
+
}
|
|
737
|
+
const { mergedFields, minimalFullLengthFields } = deriveFieldConfigs(
|
|
738
|
+
fields != null ? fields : [],
|
|
739
|
+
schema,
|
|
740
|
+
(field) => __spreadValues$7({
|
|
741
|
+
key: mkShortId(),
|
|
742
|
+
isHidden: false,
|
|
743
|
+
dataType: "auto"
|
|
744
|
+
}, field && {
|
|
745
|
+
key: field.id,
|
|
746
|
+
fieldId: field.id,
|
|
747
|
+
title: field.label || field.id,
|
|
748
|
+
expr: (currentItem) => currentItem[field.id]
|
|
749
|
+
})
|
|
750
|
+
);
|
|
751
|
+
setControlContextData == null ? void 0 : setControlContextData(__spreadProps$5(__spreadValues$7({}, data), { mergedFields, minimalFullLengthFields }));
|
|
752
|
+
const normalized = mergedFields;
|
|
753
|
+
const columnDefinitions = normalized.filter((cconfig) => !cconfig.isHidden).map((cconfig, _columnIndex, _columnsArray) => {
|
|
754
|
+
const columnDefinition = {
|
|
755
|
+
dataIndex: cconfig.fieldId,
|
|
756
|
+
title: cconfig.title,
|
|
757
|
+
key: cconfig.key,
|
|
758
|
+
span: cconfig.span,
|
|
759
|
+
render: (record) => {
|
|
760
|
+
return renderValue(record, cconfig);
|
|
939
761
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
}))); }), mergedFields = _a.mergedFields, minimalFullLengthFields = _a.minimalFullLengthFields;
|
|
946
|
-
setControlContextData === null || setControlContextData === void 0 ? void 0 : setControlContextData(__assign(__assign({}, data), { mergedFields: mergedFields, minimalFullLengthFields: minimalFullLengthFields }));
|
|
947
|
-
var normalized = mergedFields;
|
|
948
|
-
var columnDefinitions = normalized
|
|
949
|
-
.filter(function (cconfig) { return !cconfig.isHidden; })
|
|
950
|
-
.map(function (cconfig, _columnIndex, _columnsArray) {
|
|
951
|
-
var columnDefinition = {
|
|
952
|
-
dataIndex: cconfig.fieldId,
|
|
953
|
-
title: cconfig.title,
|
|
954
|
-
key: cconfig.key,
|
|
955
|
-
span: cconfig.span,
|
|
956
|
-
render: function (record) {
|
|
957
|
-
return renderValue(record, cconfig);
|
|
958
|
-
},
|
|
959
|
-
};
|
|
960
|
-
return columnDefinition;
|
|
961
|
-
});
|
|
962
|
-
return { normalized: normalized, columnDefinitions: columnDefinitions };
|
|
963
|
-
}, [fields, data, setControlContextData]);
|
|
762
|
+
};
|
|
763
|
+
return columnDefinition;
|
|
764
|
+
});
|
|
765
|
+
return { normalized, columnDefinitions };
|
|
766
|
+
}, [fields, data, setControlContextData]);
|
|
964
767
|
}
|
|
965
768
|
|
|
966
769
|
function registerRichDetails(loader) {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
770
|
+
registerComponentHelper(loader, RichDetails, {
|
|
771
|
+
name: "hostless-rich-details",
|
|
772
|
+
displayName: "Data details",
|
|
773
|
+
defaultStyles: {
|
|
774
|
+
width: "stretch",
|
|
775
|
+
maxHeight: "100%"
|
|
776
|
+
},
|
|
777
|
+
props: {
|
|
778
|
+
data: {
|
|
779
|
+
type: "dataSourceOpData",
|
|
780
|
+
description: "The data to display"
|
|
781
|
+
},
|
|
782
|
+
fields: buildFieldsPropType({
|
|
783
|
+
fieldTypes: {
|
|
784
|
+
span: {
|
|
785
|
+
type: "number",
|
|
786
|
+
displayName: "Number of columns to span",
|
|
787
|
+
defaultValueHint: 1
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}),
|
|
791
|
+
layout: {
|
|
792
|
+
displayName: "Layout",
|
|
793
|
+
type: "choice",
|
|
794
|
+
options: [
|
|
795
|
+
{ value: "horizontal", label: "Horizontal" },
|
|
796
|
+
{ value: "vertical", label: "Vertical" }
|
|
797
|
+
],
|
|
798
|
+
defaultValueHint: "horizontal"
|
|
799
|
+
},
|
|
800
|
+
column: {
|
|
801
|
+
displayName: "Items per row",
|
|
802
|
+
type: "number",
|
|
803
|
+
description: "Number of items to display per row",
|
|
804
|
+
defaultValueHint: 2
|
|
805
|
+
},
|
|
806
|
+
size: {
|
|
807
|
+
displayName: "Spacing",
|
|
808
|
+
type: "choice",
|
|
809
|
+
options: [
|
|
810
|
+
{ value: "small", label: "Small" },
|
|
811
|
+
{ value: "middle", label: "Medium" },
|
|
812
|
+
{ value: "default", label: "Large" }
|
|
813
|
+
],
|
|
814
|
+
defaultValueHint: "default"
|
|
815
|
+
},
|
|
816
|
+
bordered: {
|
|
817
|
+
displayName: "Show borders?",
|
|
818
|
+
type: "boolean",
|
|
819
|
+
defaultValueHint: false
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
importPath: "@plasmicpkgs/plasmic-rich-components",
|
|
823
|
+
importName: "RichDetails"
|
|
824
|
+
});
|
|
1022
825
|
}
|
|
1023
826
|
|
|
1024
827
|
function useIsClient() {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
828
|
+
const [loaded, setLoaded] = React.useState(false);
|
|
829
|
+
useIsomorphicLayoutEffect(() => {
|
|
830
|
+
setLoaded(true);
|
|
831
|
+
});
|
|
832
|
+
return loaded;
|
|
1030
833
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
? React.useLayoutEffect
|
|
1034
|
-
: React.useEffect;
|
|
834
|
+
const isBrowser = typeof window !== "undefined";
|
|
835
|
+
const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
1035
836
|
function capitalize(text) {
|
|
1036
|
-
|
|
837
|
+
return text.slice(0, 1).toUpperCase() + text.slice(1);
|
|
1037
838
|
}
|
|
1038
839
|
function isLight(color) {
|
|
1039
|
-
|
|
1040
|
-
|
|
840
|
+
const { r, g, b } = tinycolor(color).toRgb();
|
|
841
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186;
|
|
1041
842
|
}
|
|
1042
843
|
|
|
1043
|
-
var
|
|
1044
|
-
|
|
844
|
+
var __defProp$6 = Object.defineProperty;
|
|
845
|
+
var __defProps$4 = Object.defineProperties;
|
|
846
|
+
var __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors;
|
|
847
|
+
var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
|
|
848
|
+
var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
|
|
849
|
+
var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
|
|
850
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
851
|
+
var __spreadValues$6 = (a, b) => {
|
|
852
|
+
for (var prop in b || (b = {}))
|
|
853
|
+
if (__hasOwnProp$6.call(b, prop))
|
|
854
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
855
|
+
if (__getOwnPropSymbols$6)
|
|
856
|
+
for (var prop of __getOwnPropSymbols$6(b)) {
|
|
857
|
+
if (__propIsEnum$6.call(b, prop))
|
|
858
|
+
__defNormalProp$6(a, prop, b[prop]);
|
|
859
|
+
}
|
|
860
|
+
return a;
|
|
861
|
+
};
|
|
862
|
+
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
863
|
+
const AnchorLink = React.forwardRef(function AnchorLink2(props, ref) {
|
|
864
|
+
return /* @__PURE__ */ React.createElement("a", __spreadProps$4(__spreadValues$6({}, props), { ref }));
|
|
1045
865
|
});
|
|
1046
866
|
|
|
867
|
+
var __defProp$5 = Object.defineProperty;
|
|
868
|
+
var __defProps$3 = Object.defineProperties;
|
|
869
|
+
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
870
|
+
var __getOwnPropSymbols$5 = Object.getOwnPropertySymbols;
|
|
871
|
+
var __hasOwnProp$5 = Object.prototype.hasOwnProperty;
|
|
872
|
+
var __propIsEnum$5 = Object.prototype.propertyIsEnumerable;
|
|
873
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
874
|
+
var __spreadValues$5 = (a, b) => {
|
|
875
|
+
for (var prop in b || (b = {}))
|
|
876
|
+
if (__hasOwnProp$5.call(b, prop))
|
|
877
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
878
|
+
if (__getOwnPropSymbols$5)
|
|
879
|
+
for (var prop of __getOwnPropSymbols$5(b)) {
|
|
880
|
+
if (__propIsEnum$5.call(b, prop))
|
|
881
|
+
__defNormalProp$5(a, prop, b[prop]);
|
|
882
|
+
}
|
|
883
|
+
return a;
|
|
884
|
+
};
|
|
885
|
+
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
886
|
+
var __objRest$1 = (source, exclude) => {
|
|
887
|
+
var target = {};
|
|
888
|
+
for (var prop in source)
|
|
889
|
+
if (__hasOwnProp$5.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
890
|
+
target[prop] = source[prop];
|
|
891
|
+
if (source != null && __getOwnPropSymbols$5)
|
|
892
|
+
for (var prop of __getOwnPropSymbols$5(source)) {
|
|
893
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$5.call(source, prop))
|
|
894
|
+
target[prop] = source[prop];
|
|
895
|
+
}
|
|
896
|
+
return target;
|
|
897
|
+
};
|
|
1047
898
|
function omitUndefined(x) {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
}));
|
|
899
|
+
return Object.fromEntries(
|
|
900
|
+
Object.entries(x).filter(([k, v]) => v !== void 0)
|
|
901
|
+
);
|
|
1052
902
|
}
|
|
1053
903
|
function filterNavMenuItemsByConditions(navMenuItems) {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
904
|
+
return navMenuItems.filter((item) => item.condition === void 0 || item.condition).map((item) => __spreadProps$3(__spreadValues$5({}, item), {
|
|
905
|
+
routes: item.routes ? filterNavMenuItemsByConditions(item.routes) : void 0
|
|
906
|
+
}));
|
|
907
|
+
}
|
|
908
|
+
const baseStyles = `
|
|
909
|
+
.ant-pro-layout-bg-list {
|
|
910
|
+
display: none;
|
|
911
|
+
}
|
|
912
|
+
.ant-pro-layout {
|
|
913
|
+
display: flex;
|
|
914
|
+
width: 100%;
|
|
915
|
+
}
|
|
916
|
+
.ant-pro-layout .ant-pro-layout-content {
|
|
917
|
+
padding: 0;
|
|
918
|
+
}
|
|
919
|
+
`;
|
|
1062
920
|
function RichLayout(_a) {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
921
|
+
var _b = _a, {
|
|
922
|
+
children,
|
|
923
|
+
navMenuItems,
|
|
924
|
+
rootUrl = "/",
|
|
925
|
+
actionsChildren,
|
|
926
|
+
footerChildren,
|
|
927
|
+
avatarLabel,
|
|
928
|
+
avatarImage,
|
|
929
|
+
showAvatarMenu,
|
|
930
|
+
className,
|
|
931
|
+
simpleNavTheme,
|
|
932
|
+
logo,
|
|
933
|
+
logoElement
|
|
934
|
+
} = _b, layoutProps = __objRest$1(_b, [
|
|
935
|
+
"children",
|
|
936
|
+
"navMenuItems",
|
|
937
|
+
"rootUrl",
|
|
938
|
+
"actionsChildren",
|
|
939
|
+
"footerChildren",
|
|
940
|
+
"avatarLabel",
|
|
941
|
+
"avatarImage",
|
|
942
|
+
"showAvatarMenu",
|
|
943
|
+
"className",
|
|
944
|
+
"simpleNavTheme",
|
|
945
|
+
"logo",
|
|
946
|
+
"logoElement"
|
|
947
|
+
]);
|
|
948
|
+
var _a2, _b2, _c, _d, _e;
|
|
949
|
+
const isClient = useIsClient();
|
|
950
|
+
const [pathname, setPathname] = useState(void 0);
|
|
951
|
+
useEffect(() => {
|
|
952
|
+
if (typeof location !== "undefined") {
|
|
953
|
+
setPathname(location.pathname);
|
|
1094
954
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
var
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
return
|
|
955
|
+
}, []);
|
|
956
|
+
const Link = (_b2 = (_a2 = usePlasmicLink) == null ? void 0 : _a2()) != null ? _b2 : AnchorLink;
|
|
957
|
+
const { token } = theme.useToken();
|
|
958
|
+
const origTextColor = token.colorTextBase;
|
|
959
|
+
function getNavBgColor() {
|
|
960
|
+
var _a3, _b3;
|
|
961
|
+
const scheme = (_a3 = simpleNavTheme == null ? void 0 : simpleNavTheme.scheme) != null ? _a3 : "default";
|
|
962
|
+
switch (scheme) {
|
|
963
|
+
case "primary":
|
|
964
|
+
return token.colorPrimary;
|
|
965
|
+
case "dark":
|
|
966
|
+
return "#011528";
|
|
967
|
+
case "custom":
|
|
968
|
+
return (_b3 = simpleNavTheme == null ? void 0 : simpleNavTheme.customBgColor) != null ? _b3 : token.colorBgBase;
|
|
969
|
+
case "light":
|
|
970
|
+
return "#fff";
|
|
971
|
+
case "default":
|
|
972
|
+
return token.colorBgBase || "#fff";
|
|
1105
973
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
},
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
974
|
+
}
|
|
975
|
+
const navBgColor = getNavBgColor();
|
|
976
|
+
const isNavBgLight = isLight(navBgColor);
|
|
977
|
+
const isOrigTextLight = isLight(origTextColor);
|
|
978
|
+
const navTextColor = isNavBgLight !== isOrigTextLight ? void 0 : "";
|
|
979
|
+
if (!isClient) {
|
|
980
|
+
return null;
|
|
981
|
+
}
|
|
982
|
+
const layoutColorOverrides = isNavBgLight ? void 0 : {
|
|
983
|
+
colorBgCollapsedButton: navBgColor,
|
|
984
|
+
colorTextCollapsedButtonHover: "rgba(255,255,255,0.85)",
|
|
985
|
+
colorTextCollapsedButton: "rgba(255,255,255,0.65)",
|
|
986
|
+
colorMenuBackground: navBgColor,
|
|
987
|
+
colorBgMenuItemCollapsedHover: "rgba(0,0,0,0.06)",
|
|
988
|
+
colorBgMenuItemCollapsedSelected: "rgba(0,0,0,0.15)",
|
|
989
|
+
colorBgMenuItemCollapsedElevated: "rgba(0,0,0,0.85)",
|
|
990
|
+
colorMenuItemDivider: "rgba(255,255,255,0.15)",
|
|
991
|
+
colorBgMenuItemHover: "rgba(0,0,0,0.06)",
|
|
992
|
+
colorBgMenuItemSelected: "rgba(0,0,0,0.15)",
|
|
993
|
+
colorTextMenuSelected: "#fff",
|
|
994
|
+
colorTextMenuItemHover: "rgba(255,255,255,0.75)",
|
|
995
|
+
colorTextMenu: "rgba(255,255,255,0.75)",
|
|
996
|
+
colorTextMenuSecondary: "rgba(255,255,255,0.65)",
|
|
997
|
+
colorTextMenuTitle: "rgba(255,255,255,0.95)",
|
|
998
|
+
colorTextMenuActive: "rgba(255,255,255,0.95)",
|
|
999
|
+
colorTextSubMenuSelected: "#fff"
|
|
1000
|
+
};
|
|
1001
|
+
return /* @__PURE__ */ React.createElement("div", { className, style: { display: "flex" } }, /* @__PURE__ */ React.createElement("style", null, baseStyles), /* @__PURE__ */ React.createElement(
|
|
1002
|
+
ProLayout,
|
|
1003
|
+
__spreadProps$3(__spreadValues$5({}, layoutProps), {
|
|
1004
|
+
logo: logo != null ? logo : logoElement,
|
|
1005
|
+
headerRender: (_props, defaultDom) => /* @__PURE__ */ React.createElement(
|
|
1006
|
+
ConfigProvider,
|
|
1007
|
+
{
|
|
1008
|
+
theme: { token: omitUndefined({ colorTextBase: navTextColor }) }
|
|
1009
|
+
},
|
|
1010
|
+
/* @__PURE__ */ React.createElement(ProConfigProvider, { dark: !isNavBgLight }, defaultDom)
|
|
1011
|
+
),
|
|
1012
|
+
token: {
|
|
1013
|
+
header: omitUndefined(__spreadValues$5({
|
|
1014
|
+
colorBgHeader: navBgColor
|
|
1015
|
+
}, layoutColorOverrides)),
|
|
1016
|
+
// Ideally, we'd do something similar to headerRender above, and just specify general dark mode to specify
|
|
1017
|
+
// whether all components/text should be light.
|
|
1018
|
+
// But for some reason it doesn't work, causing the bg color to be ignored (just the default dark Menu color),
|
|
1019
|
+
// *and* the text is just dark as well.
|
|
1020
|
+
// Haven't yet been able to unravel the pro components code to figure out the proper way to do this, so just
|
|
1021
|
+
// bluntly specifying tokens here, as recommended in some GitHub issue.
|
|
1022
|
+
sider: layoutColorOverrides
|
|
1023
|
+
},
|
|
1024
|
+
layout: (_c = layoutProps.layout) != null ? _c : "top",
|
|
1025
|
+
fixedHeader: (_d = layoutProps.fixedHeader) != null ? _d : false,
|
|
1026
|
+
fixSiderbar: (
|
|
1027
|
+
// Doesn't stretch full height if you set this to false and you're in mix mode.
|
|
1028
|
+
layoutProps.layout === "mix" ? void 0 : (_e = layoutProps.fixSiderbar) != null ? _e : false
|
|
1029
|
+
),
|
|
1030
|
+
splitMenus: layoutProps.layout === "mix",
|
|
1031
|
+
route: {
|
|
1032
|
+
path: rootUrl,
|
|
1033
|
+
routes: navMenuItems ? filterNavMenuItemsByConditions(navMenuItems) : void 0
|
|
1034
|
+
},
|
|
1035
|
+
location: {
|
|
1036
|
+
pathname
|
|
1037
|
+
},
|
|
1038
|
+
menu: {
|
|
1039
|
+
// collapsedShowGroupTitle: true,
|
|
1040
|
+
defaultOpenAll: true
|
|
1041
|
+
// hideMenuWhenCollapsed: true,
|
|
1042
|
+
},
|
|
1043
|
+
avatarProps: showAvatarMenu ? {
|
|
1044
|
+
src: avatarImage,
|
|
1045
|
+
size: "small",
|
|
1046
|
+
title: avatarLabel,
|
|
1047
|
+
render: (_props, dom) => {
|
|
1048
|
+
return /* @__PURE__ */ React.createElement(
|
|
1049
|
+
Dropdown,
|
|
1050
|
+
{
|
|
1051
|
+
menu: {
|
|
1052
|
+
items: [
|
|
1053
|
+
{
|
|
1054
|
+
key: "logout",
|
|
1055
|
+
icon: /* @__PURE__ */ React.createElement(LogoutOutlined, null),
|
|
1056
|
+
label: "Sign out"
|
|
1057
|
+
}
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
dom
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
} : void 0,
|
|
1065
|
+
actionsRender: (_props) => {
|
|
1066
|
+
return [actionsChildren];
|
|
1067
|
+
},
|
|
1068
|
+
menuFooterRender: (props) => {
|
|
1069
|
+
if (props == null ? void 0 : props.collapsed)
|
|
1070
|
+
return void 0;
|
|
1071
|
+
return footerChildren;
|
|
1072
|
+
},
|
|
1073
|
+
onMenuHeaderClick: (e) => console.log(e),
|
|
1074
|
+
menuItemRender: (item, dom) => /* @__PURE__ */ React.createElement(Link, { href: item.path }, dom),
|
|
1075
|
+
headerTitleRender: (logo2, title, _) => {
|
|
1076
|
+
return /* @__PURE__ */ React.createElement(Link, { href: rootUrl }, logo2, title);
|
|
1077
|
+
}
|
|
1078
|
+
}),
|
|
1079
|
+
children
|
|
1080
|
+
));
|
|
1201
1081
|
}
|
|
1202
1082
|
|
|
1083
|
+
var __defProp$4 = Object.defineProperty;
|
|
1084
|
+
var __getOwnPropSymbols$4 = Object.getOwnPropertySymbols;
|
|
1085
|
+
var __hasOwnProp$4 = Object.prototype.hasOwnProperty;
|
|
1086
|
+
var __propIsEnum$4 = Object.prototype.propertyIsEnumerable;
|
|
1087
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1088
|
+
var __spreadValues$4 = (a, b) => {
|
|
1089
|
+
for (var prop in b || (b = {}))
|
|
1090
|
+
if (__hasOwnProp$4.call(b, prop))
|
|
1091
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1092
|
+
if (__getOwnPropSymbols$4)
|
|
1093
|
+
for (var prop of __getOwnPropSymbols$4(b)) {
|
|
1094
|
+
if (__propIsEnum$4.call(b, prop))
|
|
1095
|
+
__defNormalProp$4(a, prop, b[prop]);
|
|
1096
|
+
}
|
|
1097
|
+
return a;
|
|
1098
|
+
};
|
|
1203
1099
|
function generateNavMenuType(isNested, remainingDepth, displayName, defaultValue) {
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1100
|
+
return {
|
|
1101
|
+
displayName: displayName ? displayName : "Nested items",
|
|
1102
|
+
type: "array",
|
|
1103
|
+
defaultValue,
|
|
1104
|
+
advanced: isNested,
|
|
1105
|
+
itemType: {
|
|
1106
|
+
type: "object",
|
|
1107
|
+
nameFunc: (item) => item.name || (!displayName ? "Unnamed nested item" : "Unnamed item"),
|
|
1108
|
+
fields: __spreadValues$4({
|
|
1109
|
+
path: "href",
|
|
1110
|
+
name: "string",
|
|
1111
|
+
condition: {
|
|
1112
|
+
advanced: true,
|
|
1113
|
+
displayName: "Show only if",
|
|
1114
|
+
type: "exprEditor"
|
|
1115
|
+
}
|
|
1116
|
+
}, remainingDepth === 0 ? {} : {
|
|
1117
|
+
routes: generateNavMenuType(true, remainingDepth - 1)
|
|
1118
|
+
})
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1225
1121
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
type: "choice",
|
|
1282
|
-
options: ["default", "primary", "light", "dark", "custom"].map(function (v) { return ({
|
|
1283
|
-
label: capitalize(v),
|
|
1284
|
-
value: v,
|
|
1285
|
-
}); }),
|
|
1286
|
-
defaultValueHint: "default",
|
|
1287
|
-
},
|
|
1288
|
-
customBgColor: {
|
|
1289
|
-
type: "color",
|
|
1290
|
-
displayName: "Custom color",
|
|
1291
|
-
hidden: function (props) { var _a; return !(((_a = props.simpleNavTheme) === null || _a === void 0 ? void 0 : _a.scheme) === "custom"); },
|
|
1292
|
-
defaultValue: "#D73B58",
|
|
1293
|
-
},
|
|
1294
|
-
},
|
|
1295
|
-
},
|
|
1296
|
-
// Advanced, show later
|
|
1297
|
-
/*
|
|
1298
|
-
siderMenuType: {
|
|
1299
|
-
displayName: "Sidebar mode",
|
|
1300
|
-
type: "choice",
|
|
1301
|
-
options: ["sub", "group"].map((value) => ({
|
|
1302
|
-
value,
|
|
1303
|
-
label: capitalize(value),
|
|
1304
|
-
})),
|
|
1305
|
-
defaultValue: "sub",
|
|
1306
|
-
},
|
|
1307
|
-
contentWidth: {
|
|
1308
|
-
displayName: "Content width",
|
|
1122
|
+
const richLayoutMeta = {
|
|
1123
|
+
name: "hostless-rich-layout",
|
|
1124
|
+
displayName: "Rich App Layout",
|
|
1125
|
+
props: {
|
|
1126
|
+
children: {
|
|
1127
|
+
type: "slot",
|
|
1128
|
+
unstable__isMainContentSlot: true
|
|
1129
|
+
},
|
|
1130
|
+
actionsChildren: {
|
|
1131
|
+
type: "slot",
|
|
1132
|
+
hidePlaceholder: true
|
|
1133
|
+
},
|
|
1134
|
+
title: {
|
|
1135
|
+
displayName: "Title",
|
|
1136
|
+
type: "string",
|
|
1137
|
+
defaultValue: "App title"
|
|
1138
|
+
},
|
|
1139
|
+
logo: {
|
|
1140
|
+
displayName: "Logo",
|
|
1141
|
+
type: "imageUrl",
|
|
1142
|
+
hidden: (ps) => !ps.logo
|
|
1143
|
+
},
|
|
1144
|
+
logoElement: {
|
|
1145
|
+
type: "slot",
|
|
1146
|
+
displayName: "Logo",
|
|
1147
|
+
defaultValue: {
|
|
1148
|
+
type: "img",
|
|
1149
|
+
src: "https://static1.plasmic.app/fake-logo.svg"
|
|
1150
|
+
},
|
|
1151
|
+
hidden: (ps) => !!ps.logo
|
|
1152
|
+
},
|
|
1153
|
+
navMenuItems: generateNavMenuType(false, 2, "Nav menu items", [
|
|
1154
|
+
{
|
|
1155
|
+
path: "/",
|
|
1156
|
+
name: "Link 1"
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
path: "/",
|
|
1160
|
+
name: "Link 2"
|
|
1161
|
+
}
|
|
1162
|
+
]),
|
|
1163
|
+
layout: {
|
|
1164
|
+
displayName: "Layout",
|
|
1165
|
+
type: "choice",
|
|
1166
|
+
options: ["side", "top", "mix"].map((value) => ({
|
|
1167
|
+
value,
|
|
1168
|
+
label: capitalize(value)
|
|
1169
|
+
})),
|
|
1170
|
+
defaultValueHint: "top"
|
|
1171
|
+
},
|
|
1172
|
+
simpleNavTheme: {
|
|
1173
|
+
displayName: "Theme",
|
|
1174
|
+
type: "object",
|
|
1175
|
+
fields: {
|
|
1176
|
+
scheme: {
|
|
1309
1177
|
type: "choice",
|
|
1310
|
-
options: ["
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
hidden: function (ps) { var _a; return ((_a = ps.layout) !== null && _a !== void 0 ? _a : "top") !== "top"; },
|
|
1318
|
-
defaultValueHint: false,
|
|
1319
|
-
},
|
|
1320
|
-
fixSiderbar: {
|
|
1321
|
-
displayName: "Sticky sidebar",
|
|
1322
|
-
type: "boolean",
|
|
1323
|
-
hidden: function (ps) { var _a; return ((_a = ps.layout) !== null && _a !== void 0 ? _a : "top") !== "side"; },
|
|
1324
|
-
defaultValueHint: false,
|
|
1325
|
-
},
|
|
1326
|
-
/*
|
|
1327
|
-
showAvatarMenu: {
|
|
1328
|
-
displayName: "Show avatar",
|
|
1329
|
-
type: "boolean",
|
|
1330
|
-
defaultValue: true,
|
|
1331
|
-
},
|
|
1332
|
-
avatarLabel: {
|
|
1333
|
-
displayName: "Avatar label",
|
|
1334
|
-
type: "string",
|
|
1335
|
-
defaultValue: "User Name",
|
|
1336
|
-
},
|
|
1337
|
-
avatarImage: {
|
|
1338
|
-
displayName: "Avatar image",
|
|
1339
|
-
type: "imageUrl",
|
|
1340
|
-
defaultValue:
|
|
1341
|
-
"https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg",
|
|
1342
|
-
},
|
|
1343
|
-
*/
|
|
1344
|
-
menu: {
|
|
1345
|
-
displayName: "Menu",
|
|
1346
|
-
type: "object",
|
|
1347
|
-
fields: {
|
|
1348
|
-
defaultOpenAll: {
|
|
1349
|
-
displayName: "Default open all",
|
|
1350
|
-
type: "boolean",
|
|
1351
|
-
},
|
|
1352
|
-
hideMenuWhenCollapsed: {
|
|
1353
|
-
// displayName: "",
|
|
1354
|
-
type: "boolean",
|
|
1355
|
-
},
|
|
1356
|
-
},
|
|
1178
|
+
options: ["default", "primary", "light", "dark", "custom"].map(
|
|
1179
|
+
(v) => ({
|
|
1180
|
+
label: capitalize(v),
|
|
1181
|
+
value: v
|
|
1182
|
+
})
|
|
1183
|
+
),
|
|
1184
|
+
defaultValueHint: "default"
|
|
1357
1185
|
},
|
|
1186
|
+
customBgColor: {
|
|
1187
|
+
type: "color",
|
|
1188
|
+
displayName: "Custom color",
|
|
1189
|
+
hidden: (props) => {
|
|
1190
|
+
var _a;
|
|
1191
|
+
return !(((_a = props.simpleNavTheme) == null ? void 0 : _a.scheme) === "custom");
|
|
1192
|
+
},
|
|
1193
|
+
defaultValue: "#D73B58"
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1358
1196
|
},
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1197
|
+
// Advanced, show later
|
|
1198
|
+
/*
|
|
1199
|
+
siderMenuType: {
|
|
1200
|
+
displayName: "Sidebar mode",
|
|
1201
|
+
type: "choice",
|
|
1202
|
+
options: ["sub", "group"].map((value) => ({
|
|
1203
|
+
value,
|
|
1204
|
+
label: capitalize(value),
|
|
1205
|
+
})),
|
|
1206
|
+
defaultValue: "sub",
|
|
1363
1207
|
},
|
|
1364
|
-
|
|
1365
|
-
|
|
1208
|
+
contentWidth: {
|
|
1209
|
+
displayName: "Content width",
|
|
1210
|
+
type: "choice",
|
|
1211
|
+
options: ["Fluid", "Fixed"],
|
|
1212
|
+
defaultValueHint: "Fluid",
|
|
1213
|
+
},
|
|
1214
|
+
*/
|
|
1215
|
+
fixedHeader: {
|
|
1216
|
+
displayName: "Sticky header",
|
|
1217
|
+
type: "boolean",
|
|
1218
|
+
hidden: (ps) => {
|
|
1219
|
+
var _a;
|
|
1220
|
+
return ((_a = ps.layout) != null ? _a : "top") !== "top";
|
|
1221
|
+
},
|
|
1222
|
+
defaultValueHint: false
|
|
1223
|
+
},
|
|
1224
|
+
fixSiderbar: {
|
|
1225
|
+
displayName: "Sticky sidebar",
|
|
1226
|
+
type: "boolean",
|
|
1227
|
+
hidden: (ps) => {
|
|
1228
|
+
var _a;
|
|
1229
|
+
return ((_a = ps.layout) != null ? _a : "top") !== "side";
|
|
1230
|
+
},
|
|
1231
|
+
defaultValueHint: false
|
|
1232
|
+
},
|
|
1233
|
+
/*
|
|
1234
|
+
showAvatarMenu: {
|
|
1235
|
+
displayName: "Show avatar",
|
|
1236
|
+
type: "boolean",
|
|
1237
|
+
defaultValue: true,
|
|
1238
|
+
},
|
|
1239
|
+
avatarLabel: {
|
|
1240
|
+
displayName: "Avatar label",
|
|
1241
|
+
type: "string",
|
|
1242
|
+
defaultValue: "User Name",
|
|
1243
|
+
},
|
|
1244
|
+
avatarImage: {
|
|
1245
|
+
displayName: "Avatar image",
|
|
1246
|
+
type: "imageUrl",
|
|
1247
|
+
defaultValue:
|
|
1248
|
+
"https://gw.alipayobjects.com/zos/antfincdn/efFD%24IOql2/weixintupian_20170331104822.jpg",
|
|
1249
|
+
},
|
|
1250
|
+
*/
|
|
1251
|
+
menu: {
|
|
1252
|
+
displayName: "Menu",
|
|
1253
|
+
type: "object",
|
|
1254
|
+
fields: {
|
|
1255
|
+
defaultOpenAll: {
|
|
1256
|
+
displayName: "Default open all",
|
|
1257
|
+
type: "boolean"
|
|
1258
|
+
},
|
|
1259
|
+
hideMenuWhenCollapsed: {
|
|
1260
|
+
// displayName: "",
|
|
1261
|
+
type: "boolean"
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
defaultStyles: {
|
|
1267
|
+
width: "full-bleed",
|
|
1268
|
+
height: "stretch",
|
|
1269
|
+
minHeight: "100vh"
|
|
1270
|
+
},
|
|
1271
|
+
importName: "RichLayout",
|
|
1272
|
+
importPath: "@plasmicpkgs/plasmic-rich-components"
|
|
1366
1273
|
};
|
|
1367
1274
|
function registerRichLayout(loader) {
|
|
1368
|
-
|
|
1275
|
+
registerComponentHelper(loader, RichLayout, richLayoutMeta);
|
|
1369
1276
|
}
|
|
1370
1277
|
|
|
1371
1278
|
function useSortedFilteredData(data, columns) {
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1279
|
+
const [search, setSearch] = useState("");
|
|
1280
|
+
const [sortState, setSortState] = useState(void 0);
|
|
1281
|
+
const finalData = React.useMemo(() => {
|
|
1282
|
+
var _a;
|
|
1283
|
+
const filtered = (_a = data == null ? void 0 : data.data) == null ? void 0 : _a.filter(
|
|
1284
|
+
(row) => fastStringify(Object.values(row)).toLowerCase().includes(search)
|
|
1285
|
+
);
|
|
1286
|
+
const sorted = (sortState == null ? void 0 : sortState.sorter.column) ? (
|
|
1287
|
+
// We use .sort() rather than sortBy to use localeCompare
|
|
1288
|
+
(() => {
|
|
1289
|
+
var _a2;
|
|
1290
|
+
const cconfig = columns.find(
|
|
1291
|
+
(cc) => {
|
|
1292
|
+
var _a3;
|
|
1293
|
+
return cc.key === ((_a3 = sortState == null ? void 0 : sortState.sorter.column) == null ? void 0 : _a3.key);
|
|
1294
|
+
}
|
|
1295
|
+
);
|
|
1296
|
+
const expr = (_a2 = cconfig.expr) != null ? _a2 : (x) => x;
|
|
1297
|
+
return (filtered != null ? filtered : []).sort((aa, bb) => {
|
|
1298
|
+
var _a3, _b;
|
|
1299
|
+
const a = (_a3 = expr(aa, cconfig.fieldId ? aa == null ? void 0 : aa[cconfig.fieldId] : null)) != null ? _a3 : null, b = (_b = expr(bb, cconfig.fieldId ? bb == null ? void 0 : bb[cconfig.fieldId] : null)) != null ? _b : null;
|
|
1300
|
+
return typeof a === "string" ? a.localeCompare(b != null ? b : "") : typeof b === "string" ? -b.localeCompare(a != null ? a : "") : a - b;
|
|
1378
1301
|
});
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
? a.localeCompare(b !== null && b !== void 0 ? b : "")
|
|
1391
|
-
: typeof b === "string"
|
|
1392
|
-
? -b.localeCompare(a !== null && a !== void 0 ? a : "")
|
|
1393
|
-
: a - b;
|
|
1394
|
-
});
|
|
1395
|
-
})()
|
|
1396
|
-
: filtered;
|
|
1397
|
-
var reversed = (sortState === null || sortState === void 0 ? void 0 : sortState.sorter.order) === "descend" ? sorted === null || sorted === void 0 ? void 0 : sorted.reverse() : sorted;
|
|
1398
|
-
return reversed;
|
|
1399
|
-
}, [data, columns, sortState, search]);
|
|
1400
|
-
return {
|
|
1401
|
-
finalData: finalData,
|
|
1402
|
-
search: search,
|
|
1403
|
-
setSearch: setSearch,
|
|
1404
|
-
setSortState: setSortState,
|
|
1405
|
-
};
|
|
1302
|
+
})()
|
|
1303
|
+
) : filtered;
|
|
1304
|
+
const reversed = (sortState == null ? void 0 : sortState.sorter.order) === "descend" ? sorted == null ? void 0 : sorted.reverse() : sorted;
|
|
1305
|
+
return reversed;
|
|
1306
|
+
}, [data, columns, sortState, search]);
|
|
1307
|
+
return {
|
|
1308
|
+
finalData,
|
|
1309
|
+
search,
|
|
1310
|
+
setSearch,
|
|
1311
|
+
setSortState
|
|
1312
|
+
};
|
|
1406
1313
|
}
|
|
1407
1314
|
function deriveRowKey(data, rowKey) {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1315
|
+
var _a;
|
|
1316
|
+
if (rowKey) {
|
|
1317
|
+
return rowKey;
|
|
1318
|
+
}
|
|
1319
|
+
const schema = data == null ? void 0 : data.schema;
|
|
1320
|
+
if (schema) {
|
|
1321
|
+
return (_a = schema.fields[0]) == null ? void 0 : _a.id;
|
|
1322
|
+
}
|
|
1323
|
+
return void 0;
|
|
1417
1324
|
}
|
|
1418
1325
|
function deriveKeyOfRow(row, rowKey) {
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
return undefined;
|
|
1427
|
-
}
|
|
1326
|
+
if (typeof rowKey === "function") {
|
|
1327
|
+
return rowKey(row);
|
|
1328
|
+
} else if (typeof rowKey === "string") {
|
|
1329
|
+
return row[rowKey];
|
|
1330
|
+
} else {
|
|
1331
|
+
return void 0;
|
|
1332
|
+
}
|
|
1428
1333
|
}
|
|
1429
1334
|
function renderActions(rowActions, row, data, rowKey) {
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1335
|
+
return rowActions.map((_action) => {
|
|
1336
|
+
var _a;
|
|
1337
|
+
if (_action.type === "item") {
|
|
1338
|
+
return /* @__PURE__ */ React.createElement(
|
|
1339
|
+
"a",
|
|
1340
|
+
{
|
|
1341
|
+
key: _action.label,
|
|
1342
|
+
style: {
|
|
1343
|
+
whiteSpace: "nowrap"
|
|
1344
|
+
},
|
|
1345
|
+
onClick: () => {
|
|
1346
|
+
var _a2;
|
|
1347
|
+
return (_a2 = _action.onClick) == null ? void 0 : _a2.call(
|
|
1348
|
+
_action,
|
|
1349
|
+
deriveKeyOfRow(row, deriveRowKey(data, rowKey)),
|
|
1350
|
+
row
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
},
|
|
1354
|
+
_action.label
|
|
1355
|
+
);
|
|
1356
|
+
} else {
|
|
1357
|
+
return /* @__PURE__ */ React.createElement(
|
|
1358
|
+
Dropdown,
|
|
1359
|
+
{
|
|
1360
|
+
key: _action.label,
|
|
1361
|
+
menu: {
|
|
1362
|
+
items: ((_a = _action.children) != null ? _a : []).map((child) => ({
|
|
1363
|
+
key: child.label,
|
|
1364
|
+
label: child.label,
|
|
1365
|
+
onClick: () => {
|
|
1366
|
+
var _a2;
|
|
1367
|
+
return (_a2 = child.onClick) == null ? void 0 : _a2.call(
|
|
1368
|
+
child,
|
|
1369
|
+
deriveKeyOfRow(row, deriveRowKey(data, rowKey)),
|
|
1370
|
+
row
|
|
1371
|
+
);
|
|
1372
|
+
}
|
|
1373
|
+
}))
|
|
1374
|
+
}
|
|
1375
|
+
},
|
|
1376
|
+
/* @__PURE__ */ React.createElement(
|
|
1377
|
+
"a",
|
|
1378
|
+
{
|
|
1379
|
+
href: "javascript: void 0",
|
|
1380
|
+
style: {
|
|
1381
|
+
whiteSpace: "nowrap"
|
|
1382
|
+
}
|
|
1383
|
+
},
|
|
1384
|
+
_action.label
|
|
1385
|
+
)
|
|
1386
|
+
);
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1456
1389
|
}
|
|
1457
1390
|
|
|
1458
|
-
|
|
1391
|
+
var __defProp$3 = Object.defineProperty;
|
|
1392
|
+
var __defProps$2 = Object.defineProperties;
|
|
1393
|
+
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1394
|
+
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1395
|
+
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1396
|
+
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1397
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1398
|
+
var __spreadValues$3 = (a, b) => {
|
|
1399
|
+
for (var prop in b || (b = {}))
|
|
1400
|
+
if (__hasOwnProp$3.call(b, prop))
|
|
1401
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1402
|
+
if (__getOwnPropSymbols$3)
|
|
1403
|
+
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1404
|
+
if (__propIsEnum$3.call(b, prop))
|
|
1405
|
+
__defNormalProp$3(a, prop, b[prop]);
|
|
1406
|
+
}
|
|
1407
|
+
return a;
|
|
1408
|
+
};
|
|
1409
|
+
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1459
1410
|
function RichTable(props) {
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1411
|
+
const {
|
|
1412
|
+
className,
|
|
1413
|
+
data: rawData = {
|
|
1414
|
+
data: [],
|
|
1415
|
+
schema: {
|
|
1416
|
+
id: "inferred",
|
|
1417
|
+
fields: [
|
|
1418
|
+
{
|
|
1419
|
+
id: "id",
|
|
1420
|
+
type: "string",
|
|
1421
|
+
readOnly: false
|
|
1422
|
+
}
|
|
1423
|
+
]
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1475
1426
|
// children,
|
|
1476
|
-
pagination =
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
} })),
|
|
1526
|
-
React.createElement("style", { dangerouslySetInnerHTML: {
|
|
1527
|
-
__html: "\n :where(.css-dev-only-do-not-override-1p704s4).ant-pro-table-column-setting-overlay .ant-tree-treenode:hover .ant-pro-table-column-setting-list-item-option {\n display: none;\n }\n .plasmic-table-row-clickable {\n cursor: pointer;\n }\n .ant-pro-table-list-toolbar-right {\n flex-wrap: initial;\n flex-shrink: 0;\n }\n .ant-pro-table, .ant-pro-table > .ant-pro-card, .ant-pro-table .ant-table-wrapper, .ant-pro-table .ant-spin-nested-loading, .ant-pro-table .ant-table-container {\n height: 100%;\n }\n .ant-pro-table .ant-spin-container {\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n .ant-pro-table .ant-table {\n flex-grow: 1;\n min-height: 0;\n }\n .ant-pro-table .ant-pagination {\n flex-shrink: 0;\n }\n .ant-pro-table .ant-table-content {\n overflow: auto !important;\n height: 100%;\n }\n .ant-pro-table > .ant-pro-card > .ant-pro-card-body {\n display: flex;\n flex-direction: column;\n }\n .ant-pro-table .ant-table-wrapper {\n flex-grow: 1;\n min-height: 0;\n }\n .ant-pro-table .ant-table-thead > tr > th, .ant-pro-table .ant-table-thead > tr > td.ant-table-selection-column {\n position: sticky;\n top: 0;\n z-index: 2;\n }\n .ant-pro-table .ant-table-thead > tr > th.ant-table-cell-fix-left, .ant-pro-table .ant-table-thead > tr > th.ant-table-cell-fix-right {\n z-index: 3;\n }\n .ant-pro-table .ant-table-tbody > tr > td {\n z-index: 0;\n }\n .ant-pro-table .ant-table-tbody > tr > td.ant-table-cell-fix-left,.ant-pro-table .ant-table-tbody > tr > td.ant-table-cell-fix-right {\n z-index: 1;\n }\n ".concat(scopeClassName && hideSelectionBar
|
|
1528
|
-
? "\n .".concat(scopeClassName, " .ant-pro-table-alert {\n display: none;\n }\n ")
|
|
1529
|
-
: "", "\n "),
|
|
1530
|
-
} })));
|
|
1531
|
-
}
|
|
1532
|
-
var defaultColumnConfig$1 = function () {
|
|
1533
|
-
return ({
|
|
1534
|
-
key: mkShortId(),
|
|
1535
|
-
isEditableExpr: function () { return false; },
|
|
1536
|
-
disableSorting: false,
|
|
1537
|
-
sortByExpr: undefined,
|
|
1538
|
-
isHidden: false,
|
|
1539
|
-
formatting: {
|
|
1540
|
-
styles: {},
|
|
1541
|
-
align: "left",
|
|
1542
|
-
freeze: "off",
|
|
1427
|
+
pagination = true,
|
|
1428
|
+
defaultSize,
|
|
1429
|
+
title,
|
|
1430
|
+
addHref,
|
|
1431
|
+
pageSize = 10,
|
|
1432
|
+
hideSearch,
|
|
1433
|
+
hideDensity = true,
|
|
1434
|
+
hideColumnPicker,
|
|
1435
|
+
hideExports,
|
|
1436
|
+
hideSelectionBar = true,
|
|
1437
|
+
rowKey,
|
|
1438
|
+
scopeClassName
|
|
1439
|
+
} = props;
|
|
1440
|
+
const data = normalizeData(rawData);
|
|
1441
|
+
const { columnDefinitions, normalized } = useColumnDefinitions(data, props);
|
|
1442
|
+
const actionRef = useRef();
|
|
1443
|
+
const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
|
|
1444
|
+
data,
|
|
1445
|
+
normalized
|
|
1446
|
+
);
|
|
1447
|
+
const rowSelectionProps = useRowSelectionProps(data, props);
|
|
1448
|
+
const isClient = useIsClient();
|
|
1449
|
+
if (!isClient) {
|
|
1450
|
+
return null;
|
|
1451
|
+
}
|
|
1452
|
+
return /* @__PURE__ */ React.createElement("div", { className: `${className} ${scopeClassName != null ? scopeClassName : ""}` }, /* @__PURE__ */ React.createElement(
|
|
1453
|
+
ProTable,
|
|
1454
|
+
__spreadProps$2(__spreadValues$3({
|
|
1455
|
+
rowClassName: props.onRowClick || props.canSelectRows === "click" ? "plasmic-table-row-clickable" : void 0,
|
|
1456
|
+
actionRef,
|
|
1457
|
+
columns: columnDefinitions,
|
|
1458
|
+
onChange: (_pagination, _filters, sorter, _extra) => {
|
|
1459
|
+
setSortState({ sorter });
|
|
1460
|
+
},
|
|
1461
|
+
style: {
|
|
1462
|
+
width: "100%"
|
|
1463
|
+
},
|
|
1464
|
+
cardProps: {
|
|
1465
|
+
ghost: true
|
|
1466
|
+
}
|
|
1467
|
+
}, rowSelectionProps), {
|
|
1468
|
+
dataSource: finalData,
|
|
1469
|
+
rowKey: deriveRowKey(data, rowKey),
|
|
1470
|
+
defaultSize,
|
|
1471
|
+
editable: { type: "multiple" },
|
|
1472
|
+
search: false,
|
|
1473
|
+
options: {
|
|
1474
|
+
setting: hideColumnPicker ? false : {
|
|
1475
|
+
listsHeight: 400
|
|
1543
1476
|
},
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
}
|
|
1477
|
+
reload: false,
|
|
1478
|
+
density: !hideDensity
|
|
1479
|
+
},
|
|
1480
|
+
pagination: pagination ? {
|
|
1481
|
+
pageSize,
|
|
1482
|
+
onChange: (page) => console.log(page),
|
|
1483
|
+
showSizeChanger: false
|
|
1484
|
+
} : false,
|
|
1485
|
+
dateFormatter: "string",
|
|
1486
|
+
headerTitle: title,
|
|
1487
|
+
toolbar: {
|
|
1488
|
+
search: !hideSearch ? {
|
|
1489
|
+
value: search,
|
|
1490
|
+
onChange: (e) => setSearch(e.target.value),
|
|
1491
|
+
onSearch: () => {
|
|
1492
|
+
return;
|
|
1493
|
+
},
|
|
1494
|
+
placeholder: "Search"
|
|
1495
|
+
} : void 0
|
|
1496
|
+
},
|
|
1497
|
+
toolBarRender: () => [
|
|
1498
|
+
addHref && /* @__PURE__ */ React.createElement(
|
|
1499
|
+
Button,
|
|
1500
|
+
{
|
|
1501
|
+
key: "button",
|
|
1502
|
+
icon: /* @__PURE__ */ React.createElement(PlusOutlined, null),
|
|
1503
|
+
type: "primary",
|
|
1504
|
+
href: addHref
|
|
1505
|
+
},
|
|
1506
|
+
"Add"
|
|
1507
|
+
),
|
|
1508
|
+
!hideExports && /* @__PURE__ */ React.createElement(ExportMenu, { data })
|
|
1509
|
+
].filter((x) => !!x)
|
|
1510
|
+
})
|
|
1511
|
+
), /* @__PURE__ */ React.createElement(
|
|
1512
|
+
"style",
|
|
1513
|
+
{
|
|
1514
|
+
dangerouslySetInnerHTML: {
|
|
1515
|
+
__html: `
|
|
1516
|
+
:where(.css-dev-only-do-not-override-1p704s4).ant-pro-table-column-setting-overlay .ant-tree-treenode:hover .ant-pro-table-column-setting-list-item-option {
|
|
1517
|
+
display: none;
|
|
1518
|
+
}
|
|
1519
|
+
.plasmic-table-row-clickable {
|
|
1520
|
+
cursor: pointer;
|
|
1521
|
+
}
|
|
1522
|
+
.ant-pro-table-list-toolbar-right {
|
|
1523
|
+
flex-wrap: initial;
|
|
1524
|
+
flex-shrink: 0;
|
|
1525
|
+
}
|
|
1526
|
+
.ant-pro-table, .ant-pro-table > .ant-pro-card, .ant-pro-table .ant-table-wrapper, .ant-pro-table .ant-spin-nested-loading, .ant-pro-table .ant-table-container {
|
|
1527
|
+
height: 100%;
|
|
1528
|
+
}
|
|
1529
|
+
.ant-pro-table .ant-spin-container {
|
|
1530
|
+
height: 100%;
|
|
1531
|
+
display: flex;
|
|
1532
|
+
flex-direction: column;
|
|
1533
|
+
}
|
|
1534
|
+
.ant-pro-table .ant-table {
|
|
1535
|
+
flex-grow: 1;
|
|
1536
|
+
min-height: 0;
|
|
1537
|
+
}
|
|
1538
|
+
.ant-pro-table .ant-pagination {
|
|
1539
|
+
flex-shrink: 0;
|
|
1540
|
+
}
|
|
1541
|
+
.ant-pro-table .ant-table-content {
|
|
1542
|
+
overflow: auto !important;
|
|
1543
|
+
height: 100%;
|
|
1544
|
+
}
|
|
1545
|
+
.ant-pro-table > .ant-pro-card > .ant-pro-card-body {
|
|
1546
|
+
display: flex;
|
|
1547
|
+
flex-direction: column;
|
|
1548
|
+
}
|
|
1549
|
+
.ant-pro-table .ant-table-wrapper {
|
|
1550
|
+
flex-grow: 1;
|
|
1551
|
+
min-height: 0;
|
|
1552
|
+
}
|
|
1553
|
+
.ant-pro-table .ant-table-thead > tr > th, .ant-pro-table .ant-table-thead > tr > td.ant-table-selection-column {
|
|
1554
|
+
position: sticky;
|
|
1555
|
+
top: 0;
|
|
1556
|
+
z-index: 2;
|
|
1557
|
+
}
|
|
1558
|
+
.ant-pro-table .ant-table-thead > tr > th.ant-table-cell-fix-left, .ant-pro-table .ant-table-thead > tr > th.ant-table-cell-fix-right {
|
|
1559
|
+
z-index: 3;
|
|
1560
|
+
}
|
|
1561
|
+
.ant-pro-table .ant-table-tbody > tr > td {
|
|
1562
|
+
z-index: 0;
|
|
1563
|
+
}
|
|
1564
|
+
.ant-pro-table .ant-table-tbody > tr > td.ant-table-cell-fix-left,.ant-pro-table .ant-table-tbody > tr > td.ant-table-cell-fix-right {
|
|
1565
|
+
z-index: 1;
|
|
1566
|
+
}
|
|
1567
|
+
${scopeClassName && hideSelectionBar ? `
|
|
1568
|
+
.${scopeClassName} .ant-pro-table-alert {
|
|
1569
|
+
display: none;
|
|
1570
|
+
}
|
|
1571
|
+
` : ""}
|
|
1572
|
+
`
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
));
|
|
1576
|
+
}
|
|
1577
|
+
const defaultColumnConfig$1 = () => ({
|
|
1578
|
+
key: mkShortId(),
|
|
1579
|
+
isEditableExpr: () => false,
|
|
1580
|
+
disableSorting: false,
|
|
1581
|
+
sortByExpr: void 0,
|
|
1582
|
+
isHidden: false,
|
|
1583
|
+
formatting: {
|
|
1584
|
+
styles: {},
|
|
1585
|
+
align: "left",
|
|
1586
|
+
freeze: "off"
|
|
1587
|
+
},
|
|
1588
|
+
dataType: "auto"
|
|
1589
|
+
});
|
|
1547
1590
|
function useColumnDefinitions(data, props) {
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
},
|
|
1588
|
-
render: function (value, record, rowIndex) {
|
|
1589
|
-
return renderValue(record, cconfig);
|
|
1590
|
-
},
|
|
1591
|
-
};
|
|
1592
|
-
return columnDefinition;
|
|
1593
|
-
});
|
|
1594
|
-
var rowKey = props.rowKey;
|
|
1595
|
-
if (rowActions && rowActions.length > 0) {
|
|
1596
|
-
columnDefinitions.push({
|
|
1597
|
-
title: "Actions",
|
|
1598
|
-
valueType: "option",
|
|
1599
|
-
key: "__plasmicActions",
|
|
1600
|
-
fixed: "right",
|
|
1601
|
-
className: props.themeResetClassName,
|
|
1602
|
-
render: function (_text, row) { return __spreadArray([], renderActions(rowActions, row, data, rowKey), true); },
|
|
1603
|
-
});
|
|
1591
|
+
const { fields, setControlContextData, rowActions } = props;
|
|
1592
|
+
return React.useMemo(() => {
|
|
1593
|
+
const schema = data == null ? void 0 : data.schema;
|
|
1594
|
+
if (!data || !schema) {
|
|
1595
|
+
return { normalized: [], columnDefinitions: [] };
|
|
1596
|
+
}
|
|
1597
|
+
const { mergedFields, minimalFullLengthFields } = deriveFieldConfigs(fields != null ? fields : [], schema, (field) => __spreadValues$3(__spreadValues$3({}, defaultColumnConfig$1()), field && {
|
|
1598
|
+
key: field.id,
|
|
1599
|
+
fieldId: field.id,
|
|
1600
|
+
title: field.label || field.id,
|
|
1601
|
+
expr: (currentItem) => currentItem[field.id]
|
|
1602
|
+
}));
|
|
1603
|
+
setControlContextData == null ? void 0 : setControlContextData(__spreadProps$2(__spreadValues$3({}, data), { mergedFields, minimalFullLengthFields }));
|
|
1604
|
+
const normalized = mergedFields;
|
|
1605
|
+
const columnDefinitions = normalized.filter((cconfig) => !cconfig.isHidden).map((cconfig, _columnIndex, _columnsArray) => {
|
|
1606
|
+
const columnDefinition = {
|
|
1607
|
+
dataIndex: cconfig.fieldId,
|
|
1608
|
+
title: cconfig.title,
|
|
1609
|
+
// dataIndex: cconfig,
|
|
1610
|
+
key: cconfig.key,
|
|
1611
|
+
valueType: deriveValueType(cconfig),
|
|
1612
|
+
// To come later
|
|
1613
|
+
readonly: false,
|
|
1614
|
+
sorter: true,
|
|
1615
|
+
copyable: false,
|
|
1616
|
+
ellipsis: false,
|
|
1617
|
+
tip: void 0,
|
|
1618
|
+
formItemProps: {
|
|
1619
|
+
rules: []
|
|
1620
|
+
},
|
|
1621
|
+
disable: false,
|
|
1622
|
+
valueEnum: void 0,
|
|
1623
|
+
search: void 0,
|
|
1624
|
+
hideInSearch: false,
|
|
1625
|
+
renderFormItem: (_, { defaultRender }) => {
|
|
1626
|
+
return defaultRender(_);
|
|
1627
|
+
},
|
|
1628
|
+
render: (value, record, rowIndex) => {
|
|
1629
|
+
return renderValue(record, cconfig);
|
|
1604
1630
|
}
|
|
1605
|
-
|
|
1606
|
-
|
|
1631
|
+
};
|
|
1632
|
+
return columnDefinition;
|
|
1633
|
+
});
|
|
1634
|
+
const rowKey = props.rowKey;
|
|
1635
|
+
if (rowActions && rowActions.length > 0) {
|
|
1636
|
+
columnDefinitions.push({
|
|
1637
|
+
title: "Actions",
|
|
1638
|
+
valueType: "option",
|
|
1639
|
+
key: "__plasmicActions",
|
|
1640
|
+
fixed: "right",
|
|
1641
|
+
className: props.themeResetClassName,
|
|
1642
|
+
render: (_text, row) => [
|
|
1643
|
+
...renderActions(rowActions, row, data, rowKey)
|
|
1644
|
+
]
|
|
1645
|
+
});
|
|
1646
|
+
}
|
|
1647
|
+
return { normalized, columnDefinitions };
|
|
1648
|
+
}, [fields, data, setControlContextData, rowActions]);
|
|
1607
1649
|
}
|
|
1608
1650
|
function useRowSelectionProps(data, props) {
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1651
|
+
const {
|
|
1652
|
+
canSelectRows,
|
|
1653
|
+
selectedRowKey,
|
|
1654
|
+
onRowSelectionChanged,
|
|
1655
|
+
rowKey,
|
|
1656
|
+
onRowClick
|
|
1657
|
+
} = props;
|
|
1658
|
+
const deriveSelectedRowKeys = () => {
|
|
1659
|
+
if (!canSelectRows || canSelectRows === "none" || !deriveRowKey(data, rowKey)) {
|
|
1660
|
+
return [];
|
|
1661
|
+
}
|
|
1662
|
+
if (typeof selectedRowKey === "string") {
|
|
1663
|
+
return [selectedRowKey];
|
|
1664
|
+
} else if (Array.isArray(selectedRowKey)) {
|
|
1665
|
+
if (canSelectRows === "single" || canSelectRows === "click") {
|
|
1666
|
+
return selectedRowKey.slice(0, 1);
|
|
1667
|
+
} else {
|
|
1668
|
+
return selectedRowKey;
|
|
1669
|
+
}
|
|
1670
|
+
} else {
|
|
1671
|
+
return [];
|
|
1672
|
+
}
|
|
1673
|
+
};
|
|
1674
|
+
const rowSelection = canSelectRows && canSelectRows !== "none" ? __spreadValues$3({
|
|
1675
|
+
type: canSelectRows === "single" || canSelectRows === "click" ? "radio" : "checkbox",
|
|
1676
|
+
selectedRowKeys: deriveSelectedRowKeys(),
|
|
1677
|
+
onChange: (rowKeys, rows) => {
|
|
1678
|
+
onRowSelectionChanged == null ? void 0 : onRowSelectionChanged(rowKeys, rows);
|
|
1679
|
+
},
|
|
1680
|
+
alwaysShowAlert: true
|
|
1681
|
+
}, canSelectRows === "click" && {
|
|
1682
|
+
renderCell: () => null,
|
|
1683
|
+
columnWidth: 0,
|
|
1684
|
+
columnTitle: null,
|
|
1685
|
+
hideSelectAll: true
|
|
1686
|
+
}) : void 0;
|
|
1687
|
+
return {
|
|
1688
|
+
rowSelection,
|
|
1689
|
+
onRow: (row) => ({
|
|
1690
|
+
onClick: (event) => {
|
|
1691
|
+
const key = deriveKeyOfRow(row, deriveRowKey(data, rowKey));
|
|
1692
|
+
if (key != null && !isInteractable(event.target)) {
|
|
1693
|
+
if (canSelectRows === "click") {
|
|
1694
|
+
onRowSelectionChanged == null ? void 0 : onRowSelectionChanged([key], [row]);
|
|
1695
|
+
}
|
|
1696
|
+
onRowClick == null ? void 0 : onRowClick(key, row, event);
|
|
1629
1697
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
? "radio"
|
|
1634
|
-
: "checkbox", selectedRowKeys: deriveSelectedRowKeys(), onChange: function (rowKeys, rows) {
|
|
1635
|
-
onRowSelectionChanged === null || onRowSelectionChanged === void 0 ? void 0 : onRowSelectionChanged(rowKeys, rows);
|
|
1636
|
-
}, alwaysShowAlert: true }, (canSelectRows === "click" && {
|
|
1637
|
-
renderCell: function () { return null; },
|
|
1638
|
-
columnWidth: 0,
|
|
1639
|
-
columnTitle: null,
|
|
1640
|
-
hideSelectAll: true,
|
|
1641
|
-
})) : undefined;
|
|
1642
|
-
return {
|
|
1643
|
-
rowSelection: rowSelection,
|
|
1644
|
-
onRow: function (row) { return ({
|
|
1645
|
-
onClick: function (event) {
|
|
1646
|
-
var key = deriveKeyOfRow(row, deriveRowKey(data, rowKey));
|
|
1647
|
-
if (key != null && !isInteractable(event.target)) {
|
|
1648
|
-
if (canSelectRows === "click") {
|
|
1649
|
-
onRowSelectionChanged === null || onRowSelectionChanged === void 0 ? void 0 : onRowSelectionChanged([key], [row]);
|
|
1650
|
-
}
|
|
1651
|
-
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(key, row, event);
|
|
1652
|
-
}
|
|
1653
|
-
},
|
|
1654
|
-
}); },
|
|
1655
|
-
};
|
|
1698
|
+
}
|
|
1699
|
+
})
|
|
1700
|
+
};
|
|
1656
1701
|
}
|
|
1657
1702
|
function ExportMenu(props) {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
React.createElement(EllipsisOutlined, null))));
|
|
1703
|
+
const { data } = props;
|
|
1704
|
+
return /* @__PURE__ */ React.createElement(
|
|
1705
|
+
Dropdown,
|
|
1706
|
+
{
|
|
1707
|
+
key: "menu",
|
|
1708
|
+
menu: {
|
|
1709
|
+
items: [
|
|
1710
|
+
{
|
|
1711
|
+
label: "Download as CSV",
|
|
1712
|
+
key: "csv",
|
|
1713
|
+
onClick: async () => {
|
|
1714
|
+
var _a, _b;
|
|
1715
|
+
const writer = createObjectCsvStringifier({
|
|
1716
|
+
header: (_b = (_a = data == null ? void 0 : data.schema) == null ? void 0 : _a.fields.map((f) => ({
|
|
1717
|
+
id: f.id,
|
|
1718
|
+
title: f.id
|
|
1719
|
+
}))) != null ? _b : []
|
|
1720
|
+
});
|
|
1721
|
+
const dataStr = writer.getHeaderString() + writer.stringifyRecords(data == null ? void 0 : data.data);
|
|
1722
|
+
const filename = "data.csv";
|
|
1723
|
+
const blob = new Blob([dataStr], {
|
|
1724
|
+
type: "text/csv;charset=utf-8;"
|
|
1725
|
+
});
|
|
1726
|
+
if (navigator.msSaveBlob) {
|
|
1727
|
+
navigator.msSaveBlob(blob, filename);
|
|
1728
|
+
} else {
|
|
1729
|
+
const link = document.createElement("a");
|
|
1730
|
+
if (link.download !== void 0) {
|
|
1731
|
+
const url = URL.createObjectURL(blob);
|
|
1732
|
+
link.setAttribute("href", url);
|
|
1733
|
+
link.setAttribute("download", filename);
|
|
1734
|
+
link.style.visibility = "hidden";
|
|
1735
|
+
document.body.appendChild(link);
|
|
1736
|
+
link.click();
|
|
1737
|
+
document.body.removeChild(link);
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
label: "Download as JSON",
|
|
1744
|
+
key: "json",
|
|
1745
|
+
onClick: () => {
|
|
1746
|
+
const dataStr = fastStringify(data == null ? void 0 : data.data);
|
|
1747
|
+
const dataUri = `data:application/json;charset=utf-8, ${encodeURIComponent(
|
|
1748
|
+
dataStr
|
|
1749
|
+
)}`;
|
|
1750
|
+
const exportFileDefaultName = "data.json";
|
|
1751
|
+
const linkElement = document.createElement("a");
|
|
1752
|
+
linkElement.setAttribute("href", dataUri);
|
|
1753
|
+
linkElement.setAttribute("download", exportFileDefaultName);
|
|
1754
|
+
linkElement.click();
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
]
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
/* @__PURE__ */ React.createElement(Button, null, /* @__PURE__ */ React.createElement(EllipsisOutlined, null))
|
|
1761
|
+
);
|
|
1718
1762
|
}
|
|
1719
1763
|
|
|
1720
1764
|
function dataProp() {
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1765
|
+
return {
|
|
1766
|
+
type: "dataSourceOpData",
|
|
1767
|
+
description: "The data to display"
|
|
1768
|
+
};
|
|
1725
1769
|
}
|
|
1726
1770
|
function commonProps() {
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1771
|
+
return {
|
|
1772
|
+
pagination: {
|
|
1773
|
+
type: "boolean",
|
|
1774
|
+
advanced: true,
|
|
1775
|
+
defaultValueHint: true
|
|
1776
|
+
},
|
|
1777
|
+
pageSize: {
|
|
1778
|
+
type: "number",
|
|
1779
|
+
defaultValueHint: 10,
|
|
1780
|
+
advanced: true
|
|
1781
|
+
},
|
|
1782
|
+
hideSearch: {
|
|
1783
|
+
type: "boolean",
|
|
1784
|
+
description: "Hides the search toolbar",
|
|
1785
|
+
advanced: true
|
|
1786
|
+
}
|
|
1787
|
+
};
|
|
1744
1788
|
}
|
|
1745
1789
|
function rowActionsProp() {
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1790
|
+
return {
|
|
1791
|
+
type: "array",
|
|
1792
|
+
displayName: "Row actions",
|
|
1793
|
+
advanced: true,
|
|
1794
|
+
itemType: {
|
|
1795
|
+
type: "object",
|
|
1796
|
+
nameFunc: (item) => item.label,
|
|
1797
|
+
fields: {
|
|
1798
|
+
type: {
|
|
1799
|
+
type: "choice",
|
|
1800
|
+
options: ["item", "menu"],
|
|
1801
|
+
defaultValue: "item"
|
|
1802
|
+
},
|
|
1803
|
+
label: {
|
|
1804
|
+
type: "string",
|
|
1805
|
+
displayName: "Action label"
|
|
1806
|
+
},
|
|
1807
|
+
children: {
|
|
1808
|
+
type: "array",
|
|
1809
|
+
displayName: "Menu items",
|
|
1810
|
+
itemType: {
|
|
1751
1811
|
type: "object",
|
|
1752
|
-
nameFunc: function (item) { return item.label; },
|
|
1753
1812
|
fields: {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
fields: {
|
|
1769
|
-
label: {
|
|
1770
|
-
type: "string",
|
|
1771
|
-
displayName: "Action label",
|
|
1772
|
-
},
|
|
1773
|
-
onClick: {
|
|
1774
|
-
type: "eventHandler",
|
|
1775
|
-
argTypes: [
|
|
1776
|
-
{ name: "rowKey", type: "string" },
|
|
1777
|
-
{ name: "row", type: "object" },
|
|
1778
|
-
],
|
|
1779
|
-
},
|
|
1780
|
-
},
|
|
1781
|
-
},
|
|
1782
|
-
hidden: function (_ps, _ctx, _a) {
|
|
1783
|
-
var item = _a.item;
|
|
1784
|
-
return item.type !== "menu";
|
|
1785
|
-
},
|
|
1786
|
-
},
|
|
1787
|
-
onClick: {
|
|
1788
|
-
type: "eventHandler",
|
|
1789
|
-
displayName: "Action",
|
|
1790
|
-
argTypes: [
|
|
1791
|
-
{ name: "rowKey", type: "string" },
|
|
1792
|
-
{ name: "row", type: "object" },
|
|
1793
|
-
],
|
|
1794
|
-
hidden: function (_ps, _ctx, _a) {
|
|
1795
|
-
var item = _a.item;
|
|
1796
|
-
return item.type !== "item";
|
|
1797
|
-
},
|
|
1798
|
-
},
|
|
1799
|
-
},
|
|
1813
|
+
label: {
|
|
1814
|
+
type: "string",
|
|
1815
|
+
displayName: "Action label"
|
|
1816
|
+
},
|
|
1817
|
+
onClick: {
|
|
1818
|
+
type: "eventHandler",
|
|
1819
|
+
argTypes: [
|
|
1820
|
+
{ name: "rowKey", type: "string" },
|
|
1821
|
+
{ name: "row", type: "object" }
|
|
1822
|
+
]
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
},
|
|
1826
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
1800
1827
|
},
|
|
1801
|
-
|
|
1828
|
+
onClick: {
|
|
1829
|
+
type: "eventHandler",
|
|
1830
|
+
displayName: "Action",
|
|
1831
|
+
argTypes: [
|
|
1832
|
+
{ name: "rowKey", type: "string" },
|
|
1833
|
+
{ name: "row", type: "object" }
|
|
1834
|
+
],
|
|
1835
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
};
|
|
1802
1840
|
}
|
|
1803
1841
|
function onRowClickProp() {
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1842
|
+
return {
|
|
1843
|
+
type: "eventHandler",
|
|
1844
|
+
displayName: "On row clicked",
|
|
1845
|
+
argTypes: [
|
|
1846
|
+
{ name: "rowKey", type: "string" },
|
|
1847
|
+
{ name: "row", type: "object" },
|
|
1848
|
+
{ name: "event", type: "object" }
|
|
1849
|
+
]
|
|
1850
|
+
};
|
|
1813
1851
|
}
|
|
1814
1852
|
|
|
1815
|
-
var
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1853
|
+
var __defProp$2 = Object.defineProperty;
|
|
1854
|
+
var __defProps$1 = Object.defineProperties;
|
|
1855
|
+
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
1856
|
+
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
1857
|
+
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
1858
|
+
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
1859
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1860
|
+
var __spreadValues$2 = (a, b) => {
|
|
1861
|
+
for (var prop in b || (b = {}))
|
|
1862
|
+
if (__hasOwnProp$2.call(b, prop))
|
|
1863
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1864
|
+
if (__getOwnPropSymbols$2)
|
|
1865
|
+
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
1866
|
+
if (__propIsEnum$2.call(b, prop))
|
|
1867
|
+
__defNormalProp$2(a, prop, b[prop]);
|
|
1868
|
+
}
|
|
1869
|
+
return a;
|
|
1870
|
+
};
|
|
1871
|
+
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
1872
|
+
const tableHelpers = {
|
|
1873
|
+
states: {
|
|
1874
|
+
selectedRow: {
|
|
1875
|
+
onChangeArgsToValue: (rowKeys, rows) => {
|
|
1876
|
+
return rows[0];
|
|
1877
|
+
}
|
|
1878
|
+
},
|
|
1879
|
+
selectedRows: {
|
|
1880
|
+
onChangeArgsToValue: (rowKeys, rows) => {
|
|
1881
|
+
return rows;
|
|
1882
|
+
}
|
|
1883
|
+
},
|
|
1884
|
+
selectedRowKey: {
|
|
1885
|
+
onChangeArgsToValue: (rowKeys, rows) => {
|
|
1886
|
+
return rowKeys;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
};
|
|
1891
|
+
const dataTableMeta = {
|
|
1892
|
+
name: "hostless-rich-table",
|
|
1893
|
+
displayName: "Table",
|
|
1894
|
+
defaultStyles: {
|
|
1895
|
+
width: "stretch",
|
|
1896
|
+
padding: "16px",
|
|
1897
|
+
maxHeight: "100%"
|
|
1898
|
+
},
|
|
1899
|
+
props: __spreadProps$1(__spreadValues$2({
|
|
1900
|
+
data: dataProp(),
|
|
1901
|
+
fields: buildFieldsPropType({}),
|
|
1902
|
+
canSelectRows: {
|
|
1903
|
+
type: "choice",
|
|
1904
|
+
displayName: "Select rows?",
|
|
1905
|
+
options: [
|
|
1906
|
+
{ label: "No", value: "none" },
|
|
1907
|
+
{ label: "By clicking a row", value: "click" },
|
|
1908
|
+
{ label: "Using radio buttons", value: "single" },
|
|
1909
|
+
{ label: "Using checkboxes", value: "multiple" }
|
|
1910
|
+
],
|
|
1911
|
+
defaultValueHint: "none",
|
|
1912
|
+
description: "Lets user select table rows by clicking on a row, or using radio buttons, or checkboxes if multiple rows can be selected together. If you have interactive elements in your row and you don't want clicking on them to select the row, you may use radio buttons instead."
|
|
1913
|
+
},
|
|
1914
|
+
rowKey: {
|
|
1915
|
+
type: "string",
|
|
1916
|
+
displayName: "Row key",
|
|
1917
|
+
helpText: "Column key to use as row key; can also be a function that takes in a row and returns a key value",
|
|
1918
|
+
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none",
|
|
1919
|
+
defaultValueHint: (ps) => {
|
|
1920
|
+
const derivedRowKey = deriveRowKey(ps.data, ps.rowKey);
|
|
1921
|
+
return derivedRowKey !== void 0 ? `${derivedRowKey}` : void 0;
|
|
1922
|
+
}
|
|
1923
|
+
},
|
|
1924
|
+
selectedRowKey: {
|
|
1925
|
+
type: "string",
|
|
1926
|
+
displayName: "Selected Row Key",
|
|
1927
|
+
hidden: (ps) => ps.canSelectRows !== "single",
|
|
1928
|
+
advanced: true
|
|
1929
|
+
},
|
|
1930
|
+
selectedRowKeys: {
|
|
1931
|
+
type: "array",
|
|
1932
|
+
displayName: "Selected Row Keys",
|
|
1933
|
+
hidden: (ps) => ps.canSelectRows !== "multiple",
|
|
1934
|
+
advanced: true
|
|
1935
|
+
},
|
|
1936
|
+
onRowSelectionChanged: {
|
|
1937
|
+
type: "eventHandler",
|
|
1938
|
+
displayName: "On row selection changed",
|
|
1939
|
+
argTypes: [
|
|
1940
|
+
{ name: "rowKeys", type: "object" },
|
|
1941
|
+
{ name: "rows", type: "object" }
|
|
1942
|
+
]
|
|
1943
|
+
},
|
|
1944
|
+
onRowClick: onRowClickProp(),
|
|
1945
|
+
rowActions: rowActionsProp(),
|
|
1946
|
+
defaultSize: {
|
|
1947
|
+
displayName: "Density",
|
|
1948
|
+
type: "choice",
|
|
1949
|
+
options: [
|
|
1950
|
+
{
|
|
1951
|
+
value: "large",
|
|
1952
|
+
label: "Larger"
|
|
1826
1953
|
},
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
},
|
|
1954
|
+
{
|
|
1955
|
+
value: "middle",
|
|
1956
|
+
label: "Medium"
|
|
1831
1957
|
},
|
|
1958
|
+
{
|
|
1959
|
+
value: "small",
|
|
1960
|
+
label: "Compact"
|
|
1961
|
+
}
|
|
1962
|
+
],
|
|
1963
|
+
defaultValueHint: "large",
|
|
1964
|
+
advanced: true
|
|
1965
|
+
}
|
|
1966
|
+
}, commonProps()), {
|
|
1967
|
+
hideExports: {
|
|
1968
|
+
type: "boolean",
|
|
1969
|
+
description: "Hides the button for exporting table data to CSV",
|
|
1970
|
+
advanced: true
|
|
1832
1971
|
},
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
width: "stretch",
|
|
1839
|
-
padding: "16px",
|
|
1840
|
-
maxHeight: "100%",
|
|
1972
|
+
hideDensity: {
|
|
1973
|
+
type: "boolean",
|
|
1974
|
+
description: "Hides the control for changing the density of the table",
|
|
1975
|
+
advanced: true,
|
|
1976
|
+
defaultValueHint: true
|
|
1841
1977
|
},
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
{ label: "No", value: "none" },
|
|
1847
|
-
{ label: "By clicking a row", value: "click" },
|
|
1848
|
-
{ label: "Using radio buttons", value: "single" },
|
|
1849
|
-
{ label: "Using checkboxes", value: "multiple" },
|
|
1850
|
-
],
|
|
1851
|
-
defaultValueHint: "none",
|
|
1852
|
-
description: "Lets user select table rows by clicking on a row, or using radio buttons, or checkboxes if multiple rows can be selected together. If you have interactive elements in your row and you don't want clicking on them to select the row, you may use radio buttons instead.",
|
|
1853
|
-
}, rowKey: {
|
|
1854
|
-
type: "string",
|
|
1855
|
-
displayName: "Row key",
|
|
1856
|
-
helpText: "Column key to use as row key; can also be a function that takes in a row and returns a key value",
|
|
1857
|
-
hidden: function (ps) { return !ps.canSelectRows || ps.canSelectRows === "none"; },
|
|
1858
|
-
defaultValueHint: function (ps) {
|
|
1859
|
-
var derivedRowKey = deriveRowKey(ps.data, ps.rowKey);
|
|
1860
|
-
return derivedRowKey !== undefined ? "".concat(derivedRowKey) : undefined;
|
|
1861
|
-
},
|
|
1862
|
-
}, selectedRowKey: {
|
|
1863
|
-
type: "string",
|
|
1864
|
-
displayName: "Selected Row Key",
|
|
1865
|
-
hidden: function (ps) { return ps.canSelectRows !== "single"; },
|
|
1866
|
-
advanced: true,
|
|
1867
|
-
}, selectedRowKeys: {
|
|
1868
|
-
type: "array",
|
|
1869
|
-
displayName: "Selected Row Keys",
|
|
1870
|
-
hidden: function (ps) { return ps.canSelectRows !== "multiple"; },
|
|
1871
|
-
advanced: true,
|
|
1872
|
-
}, onRowSelectionChanged: {
|
|
1873
|
-
type: "eventHandler",
|
|
1874
|
-
displayName: "On row selection changed",
|
|
1875
|
-
argTypes: [
|
|
1876
|
-
{ name: "rowKeys", type: "object" },
|
|
1877
|
-
{ name: "rows", type: "object" },
|
|
1878
|
-
],
|
|
1879
|
-
}, onRowClick: onRowClickProp(), rowActions: rowActionsProp(), defaultSize: {
|
|
1880
|
-
displayName: "Density",
|
|
1881
|
-
type: "choice",
|
|
1882
|
-
options: [
|
|
1883
|
-
{
|
|
1884
|
-
value: "large",
|
|
1885
|
-
label: "Larger",
|
|
1886
|
-
},
|
|
1887
|
-
{
|
|
1888
|
-
value: "middle",
|
|
1889
|
-
label: "Medium",
|
|
1890
|
-
},
|
|
1891
|
-
{
|
|
1892
|
-
value: "small",
|
|
1893
|
-
label: "Compact",
|
|
1894
|
-
},
|
|
1895
|
-
],
|
|
1896
|
-
defaultValueHint: "large",
|
|
1897
|
-
advanced: true,
|
|
1898
|
-
} }, commonProps()), { hideExports: {
|
|
1899
|
-
type: "boolean",
|
|
1900
|
-
description: "Hides the button for exporting table data to CSV",
|
|
1901
|
-
advanced: true,
|
|
1902
|
-
}, hideDensity: {
|
|
1903
|
-
type: "boolean",
|
|
1904
|
-
description: "Hides the control for changing the density of the table",
|
|
1905
|
-
advanced: true,
|
|
1906
|
-
defaultValueHint: true,
|
|
1907
|
-
}, hideColumnPicker: {
|
|
1908
|
-
type: "boolean",
|
|
1909
|
-
description: "Hides the control for reordering and pinning columns",
|
|
1910
|
-
advanced: true,
|
|
1911
|
-
}, hideSelectionBar: {
|
|
1912
|
-
type: "boolean",
|
|
1913
|
-
description: "Hides the toolbar that allows the user to clear selection",
|
|
1914
|
-
advanced: true,
|
|
1915
|
-
hidden: function (ps) { return !ps.canSelectRows || ps.canSelectRows === "none"; },
|
|
1916
|
-
defaultValueHint: true,
|
|
1917
|
-
}, scopeClassName: {
|
|
1918
|
-
type: "styleScopeClass",
|
|
1919
|
-
scopeName: "instance",
|
|
1920
|
-
}, themeResetClassName: {
|
|
1921
|
-
type: "themeResetClass",
|
|
1922
|
-
targetAllTags: true,
|
|
1923
|
-
} }),
|
|
1924
|
-
states: {
|
|
1925
|
-
selectedRowKey: __assign({ type: "writable", valueProp: "selectedRowKey", onChangeProp: "onRowSelectionChanged", variableType: "text" }, tableHelpers.states.selectedRowKey),
|
|
1926
|
-
selectedRow: __assign({ type: "readonly", onChangeProp: "onRowSelectionChanged", variableType: "object" }, tableHelpers.states.selectedRow),
|
|
1927
|
-
selectedRows: __assign({ type: "readonly", onChangeProp: "onRowSelectionChanged", variableType: "array" }, tableHelpers.states.selectedRows),
|
|
1978
|
+
hideColumnPicker: {
|
|
1979
|
+
type: "boolean",
|
|
1980
|
+
description: "Hides the control for reordering and pinning columns",
|
|
1981
|
+
advanced: true
|
|
1928
1982
|
},
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1983
|
+
hideSelectionBar: {
|
|
1984
|
+
type: "boolean",
|
|
1985
|
+
description: "Hides the toolbar that allows the user to clear selection",
|
|
1986
|
+
advanced: true,
|
|
1987
|
+
hidden: (ps) => !ps.canSelectRows || ps.canSelectRows === "none",
|
|
1988
|
+
defaultValueHint: true
|
|
1933
1989
|
},
|
|
1934
|
-
|
|
1935
|
-
|
|
1990
|
+
scopeClassName: {
|
|
1991
|
+
type: "styleScopeClass",
|
|
1992
|
+
scopeName: "instance"
|
|
1993
|
+
},
|
|
1994
|
+
themeResetClassName: {
|
|
1995
|
+
type: "themeResetClass",
|
|
1996
|
+
targetAllTags: true
|
|
1997
|
+
}
|
|
1998
|
+
}),
|
|
1999
|
+
states: {
|
|
2000
|
+
selectedRowKey: __spreadValues$2({
|
|
2001
|
+
type: "writable",
|
|
2002
|
+
valueProp: "selectedRowKey",
|
|
2003
|
+
onChangeProp: "onRowSelectionChanged",
|
|
2004
|
+
variableType: "text"
|
|
2005
|
+
}, tableHelpers.states.selectedRowKey),
|
|
2006
|
+
selectedRow: __spreadValues$2({
|
|
2007
|
+
type: "readonly",
|
|
2008
|
+
onChangeProp: "onRowSelectionChanged",
|
|
2009
|
+
variableType: "object"
|
|
2010
|
+
}, tableHelpers.states.selectedRow),
|
|
2011
|
+
selectedRows: __spreadValues$2({
|
|
2012
|
+
type: "readonly",
|
|
2013
|
+
onChangeProp: "onRowSelectionChanged",
|
|
2014
|
+
variableType: "array"
|
|
2015
|
+
}, tableHelpers.states.selectedRows)
|
|
2016
|
+
},
|
|
2017
|
+
componentHelpers: {
|
|
2018
|
+
helpers: tableHelpers,
|
|
2019
|
+
importName: "tableHelpers",
|
|
2020
|
+
importPath: "@plasmicpkgs/plasmic-rich-components"
|
|
2021
|
+
},
|
|
2022
|
+
importName: "RichTable",
|
|
2023
|
+
importPath: "@plasmicpkgs/plasmic-rich-components"
|
|
1936
2024
|
};
|
|
1937
2025
|
function registerRichTable(loader) {
|
|
1938
|
-
|
|
2026
|
+
registerComponentHelper(loader, RichTable, dataTableMeta);
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
var __defProp$1 = Object.defineProperty;
|
|
2030
|
+
var __defProps = Object.defineProperties;
|
|
2031
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2032
|
+
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
2033
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
2034
|
+
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
2035
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2036
|
+
var __spreadValues$1 = (a, b) => {
|
|
2037
|
+
for (var prop in b || (b = {}))
|
|
2038
|
+
if (__hasOwnProp$1.call(b, prop))
|
|
2039
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
2040
|
+
if (__getOwnPropSymbols$1)
|
|
2041
|
+
for (var prop of __getOwnPropSymbols$1(b)) {
|
|
2042
|
+
if (__propIsEnum$1.call(b, prop))
|
|
2043
|
+
__defNormalProp$1(a, prop, b[prop]);
|
|
2044
|
+
}
|
|
2045
|
+
return a;
|
|
2046
|
+
};
|
|
2047
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2048
|
+
var __objRest = (source, exclude) => {
|
|
2049
|
+
var target = {};
|
|
2050
|
+
for (var prop in source)
|
|
2051
|
+
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2052
|
+
target[prop] = source[prop];
|
|
2053
|
+
if (source != null && __getOwnPropSymbols$1)
|
|
2054
|
+
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
2055
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
2056
|
+
target[prop] = source[prop];
|
|
2057
|
+
}
|
|
2058
|
+
return target;
|
|
2059
|
+
};
|
|
2060
|
+
const listCss = `
|
|
2061
|
+
.plasmic-list--grid .ant-list-items {
|
|
2062
|
+
display: grid;
|
|
2063
|
+
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
2064
|
+
gap: 16px;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
.plasmic-list-search {
|
|
2068
|
+
/* Matches RichTable search. */
|
|
2069
|
+
max-width: 200px;
|
|
2070
|
+
margin-bottom: 8px;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
.plasmic-list-item-content--unbordered {
|
|
2074
|
+
padding-left: 8px;
|
|
2075
|
+
padding-right: 8px;
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
.plasmic-list-item--clickable:hover {
|
|
2079
|
+
background-color: #8881;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
.plasmic-list-item-image {
|
|
2083
|
+
max-width: 80px;
|
|
2084
|
+
max-height: 80px;
|
|
2085
|
+
aspect-ratio: 1/1;
|
|
2086
|
+
object-fit: cover;
|
|
2087
|
+
border-radius: 8px;
|
|
1939
2088
|
}
|
|
1940
2089
|
|
|
1941
|
-
|
|
1942
|
-
|
|
2090
|
+
/* Unsure why needed, but cards otherwise can be much narrower. */
|
|
2091
|
+
.plasmic-list-item-card {
|
|
2092
|
+
width: 100%;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
.plasmic-list-item-card-cover {
|
|
2096
|
+
max-height: 300px;
|
|
2097
|
+
aspect-ratio: 1/1;
|
|
2098
|
+
object-fit: cover;
|
|
2099
|
+
}
|
|
2100
|
+
`;
|
|
1943
2101
|
function RichList(props) {
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2102
|
+
const _a = props, {
|
|
2103
|
+
data: rawData = {
|
|
2104
|
+
data: [],
|
|
2105
|
+
schema: {
|
|
2106
|
+
id: "inferred",
|
|
2107
|
+
fields: [
|
|
2108
|
+
{
|
|
2109
|
+
id: "id",
|
|
2110
|
+
type: "string",
|
|
2111
|
+
readOnly: false
|
|
2112
|
+
}
|
|
2113
|
+
]
|
|
2114
|
+
}
|
|
2115
|
+
},
|
|
2116
|
+
type = "list",
|
|
2117
|
+
bordered = true,
|
|
2118
|
+
className,
|
|
2119
|
+
size,
|
|
2120
|
+
header,
|
|
2121
|
+
footer,
|
|
2122
|
+
rowActions = [],
|
|
2123
|
+
title,
|
|
2124
|
+
pageSize = 10,
|
|
2125
|
+
hideSearch,
|
|
2126
|
+
rowKey,
|
|
2127
|
+
pagination,
|
|
2128
|
+
onRowClick
|
|
2129
|
+
} = _a; __objRest(_a, [
|
|
2130
|
+
"data",
|
|
2131
|
+
"type",
|
|
2132
|
+
"bordered",
|
|
2133
|
+
"className",
|
|
2134
|
+
"size",
|
|
2135
|
+
"header",
|
|
2136
|
+
"footer",
|
|
2137
|
+
"rowActions",
|
|
2138
|
+
"title",
|
|
2139
|
+
"pageSize",
|
|
2140
|
+
"hideSearch",
|
|
2141
|
+
"rowKey",
|
|
2142
|
+
"pagination",
|
|
2143
|
+
"onRowClick"
|
|
2144
|
+
]);
|
|
2145
|
+
const data = normalizeData(rawData);
|
|
2146
|
+
const { normalized, finalRoles: roleConfigs } = useRoleDefinitions(
|
|
2147
|
+
data,
|
|
2148
|
+
props
|
|
2149
|
+
);
|
|
2150
|
+
useRef();
|
|
2151
|
+
const linkTo = typeof props.linkTo === "function" ? props.linkTo : void 0;
|
|
2152
|
+
const { finalData, search, setSearch, setSortState } = useSortedFilteredData(
|
|
2153
|
+
data,
|
|
2154
|
+
normalized
|
|
2155
|
+
);
|
|
2156
|
+
const actuallyBordered = type === "list" ? bordered : false;
|
|
2157
|
+
return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement("style", null, listCss), !hideSearch && /* @__PURE__ */ React.createElement(
|
|
2158
|
+
Input.Search,
|
|
2159
|
+
{
|
|
2160
|
+
className: "plasmic-list-search",
|
|
2161
|
+
onChange: (e) => setSearch(e.target.value),
|
|
2162
|
+
value: search,
|
|
2163
|
+
placeholder: "Search"
|
|
2164
|
+
}
|
|
2165
|
+
), /* @__PURE__ */ React.createElement(
|
|
2166
|
+
List,
|
|
2167
|
+
{
|
|
2168
|
+
className: classNames({
|
|
2169
|
+
// We use CSS grid instead of the built-in Ant grid which can only define fixed # columns, and only at screen (and not container) breakpoints.
|
|
2170
|
+
"plasmic-list--grid": type === "grid"
|
|
2171
|
+
}),
|
|
2172
|
+
size,
|
|
2173
|
+
header,
|
|
2174
|
+
footer,
|
|
2175
|
+
dataSource: finalData,
|
|
2176
|
+
itemLayout: "horizontal",
|
|
2177
|
+
bordered: actuallyBordered,
|
|
2178
|
+
pagination: pagination ? {
|
|
2179
|
+
pageSize,
|
|
2180
|
+
showSizeChanger: false
|
|
2181
|
+
} : false,
|
|
2182
|
+
renderItem: (record, index) => {
|
|
2183
|
+
var _a2;
|
|
2184
|
+
const actions = renderActions(rowActions, record, data, rowKey);
|
|
2185
|
+
const image = maybe(
|
|
2186
|
+
maybeRenderString(record, (_a2 = roleConfigs.image) == null ? void 0 : _a2[0]),
|
|
2187
|
+
(src) => /* @__PURE__ */ React.createElement(
|
|
2188
|
+
"img",
|
|
2189
|
+
{
|
|
2190
|
+
src,
|
|
2191
|
+
className: type === "list" ? "plasmic-list-item-image" : "plasmic-list-item-card-cover"
|
|
2192
|
+
}
|
|
2193
|
+
)
|
|
2194
|
+
);
|
|
2195
|
+
const content = /* @__PURE__ */ React.createElement(
|
|
2196
|
+
ListItemContent,
|
|
2197
|
+
{
|
|
2198
|
+
bordered: actuallyBordered,
|
|
2199
|
+
image: type === "list" ? image : void 0,
|
|
2200
|
+
title: multiRenderValue(record, roleConfigs.title),
|
|
2201
|
+
subtitle: multiRenderValue(record, roleConfigs.subtitle),
|
|
2202
|
+
beforeTitle: multiRenderValue(record, roleConfigs.beforeTitle),
|
|
2203
|
+
afterTitle: multiRenderValue(record, roleConfigs.afterTitle),
|
|
2204
|
+
content: multiRenderValue(record, roleConfigs.content)
|
|
2205
|
+
}
|
|
2206
|
+
);
|
|
2207
|
+
function makeLinkWrapper() {
|
|
2208
|
+
if ((actions != null ? actions : []).length > 0)
|
|
2209
|
+
return void 0;
|
|
2210
|
+
const href = linkTo == null ? void 0 : linkTo(record);
|
|
2211
|
+
if (!href && !onRowClick)
|
|
2212
|
+
return void 0;
|
|
2213
|
+
const _linkWrapper = (x) => /* @__PURE__ */ React.createElement(
|
|
2214
|
+
"a",
|
|
2215
|
+
{
|
|
2216
|
+
href,
|
|
2217
|
+
onClick: (event) => {
|
|
2218
|
+
const key = deriveKeyOfRow(
|
|
2219
|
+
record,
|
|
2220
|
+
deriveRowKey(data, rowKey)
|
|
2221
|
+
);
|
|
2222
|
+
if (key != null && !isInteractable(event.target)) {
|
|
2223
|
+
onRowClick == null ? void 0 : onRowClick(key, record, event);
|
|
2009
2224
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2225
|
+
}
|
|
2226
|
+
},
|
|
2227
|
+
x
|
|
2228
|
+
);
|
|
2229
|
+
return _linkWrapper;
|
|
2230
|
+
}
|
|
2231
|
+
const linkWrapper = makeLinkWrapper();
|
|
2232
|
+
const hasLink = !!linkWrapper;
|
|
2233
|
+
function maybeLink(x) {
|
|
2234
|
+
var _a3;
|
|
2235
|
+
return (_a3 = linkWrapper == null ? void 0 : linkWrapper(x)) != null ? _a3 : x;
|
|
2236
|
+
}
|
|
2237
|
+
return type === "grid" ? /* @__PURE__ */ React.createElement(List.Item, null, maybeLink(
|
|
2238
|
+
/* @__PURE__ */ React.createElement(
|
|
2239
|
+
Card,
|
|
2240
|
+
{
|
|
2241
|
+
className: "plasmic-list-item-card",
|
|
2242
|
+
size: "small",
|
|
2243
|
+
cover: image,
|
|
2244
|
+
hoverable: hasLink,
|
|
2245
|
+
actions
|
|
2246
|
+
},
|
|
2247
|
+
content
|
|
2248
|
+
)
|
|
2249
|
+
)) : maybeLink(
|
|
2250
|
+
/* @__PURE__ */ React.createElement(
|
|
2251
|
+
List.Item,
|
|
2252
|
+
{
|
|
2253
|
+
actions,
|
|
2254
|
+
className: classNames({
|
|
2255
|
+
"plasmic-list-item--clickable": hasLink
|
|
2256
|
+
})
|
|
2257
|
+
},
|
|
2258
|
+
content
|
|
2259
|
+
)
|
|
2260
|
+
);
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
));
|
|
2014
2264
|
}
|
|
2015
2265
|
function ListItemContent(_a) {
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
title && (React.createElement("h4", { className: "".concat(prefixCls, "-item-meta-title"), style: { margin: 0 } }, title)),
|
|
2028
|
-
afterTitle && (React.createElement("div", { className: "".concat(prefixCls, "-item-meta-description") }, afterTitle))),
|
|
2029
|
-
subtitle && (React.createElement("div", { className: "".concat(prefixCls, "-item-meta-description") }, subtitle)),
|
|
2030
|
-
content && React.createElement("div", null, content))));
|
|
2031
|
-
}
|
|
2032
|
-
var defaultColumnConfig = function () {
|
|
2033
|
-
return ({
|
|
2034
|
-
key: mkShortId(),
|
|
2035
|
-
isEditableExpr: function () { return false; },
|
|
2036
|
-
disableSorting: false,
|
|
2037
|
-
sortByExpr: undefined,
|
|
2038
|
-
isHidden: false,
|
|
2039
|
-
formatting: {
|
|
2040
|
-
styles: {},
|
|
2041
|
-
align: "left",
|
|
2042
|
-
freeze: "off",
|
|
2043
|
-
},
|
|
2044
|
-
dataType: "auto",
|
|
2045
|
-
role: undefined,
|
|
2046
|
-
});
|
|
2047
|
-
};
|
|
2048
|
-
var roles = [
|
|
2049
|
-
"content",
|
|
2266
|
+
var _b = _a, {
|
|
2267
|
+
className,
|
|
2268
|
+
title,
|
|
2269
|
+
subtitle,
|
|
2270
|
+
image,
|
|
2271
|
+
beforeTitle,
|
|
2272
|
+
afterTitle,
|
|
2273
|
+
content,
|
|
2274
|
+
bordered
|
|
2275
|
+
} = _b, others = __objRest(_b, [
|
|
2276
|
+
"className",
|
|
2050
2277
|
"title",
|
|
2051
2278
|
"subtitle",
|
|
2279
|
+
"image",
|
|
2052
2280
|
"beforeTitle",
|
|
2053
2281
|
"afterTitle",
|
|
2054
|
-
"
|
|
2055
|
-
"
|
|
2282
|
+
"content",
|
|
2283
|
+
"bordered"
|
|
2284
|
+
]);
|
|
2285
|
+
const prefixCls = "ant-list";
|
|
2286
|
+
const classString = classNames(`${prefixCls}-item-meta`, className);
|
|
2287
|
+
return /* @__PURE__ */ React.createElement(
|
|
2288
|
+
"div",
|
|
2289
|
+
__spreadProps(__spreadValues$1({}, others), {
|
|
2290
|
+
className: classNames(
|
|
2291
|
+
{
|
|
2292
|
+
"plasmic-list-item-content--unbordered": !bordered
|
|
2293
|
+
},
|
|
2294
|
+
classString
|
|
2295
|
+
)
|
|
2296
|
+
}),
|
|
2297
|
+
image && /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-item-meta-avatar` }, image),
|
|
2298
|
+
/* @__PURE__ */ React.createElement(
|
|
2299
|
+
"div",
|
|
2300
|
+
{
|
|
2301
|
+
className: `${prefixCls}-item-meta-content`,
|
|
2302
|
+
style: { display: "flex", flexDirection: "column", gap: 4 }
|
|
2303
|
+
},
|
|
2304
|
+
beforeTitle && /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Tag, null, beforeTitle)),
|
|
2305
|
+
/* @__PURE__ */ React.createElement("div", { style: { display: "flex", gap: 8 } }, title && /* @__PURE__ */ React.createElement(
|
|
2306
|
+
"h4",
|
|
2307
|
+
{
|
|
2308
|
+
className: `${prefixCls}-item-meta-title`,
|
|
2309
|
+
style: { margin: 0 }
|
|
2310
|
+
},
|
|
2311
|
+
title
|
|
2312
|
+
), afterTitle && /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-item-meta-description` }, afterTitle)),
|
|
2313
|
+
subtitle && /* @__PURE__ */ React.createElement("div", { className: `${prefixCls}-item-meta-description` }, subtitle),
|
|
2314
|
+
content && /* @__PURE__ */ React.createElement("div", null, content)
|
|
2315
|
+
)
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
const defaultColumnConfig = () => ({
|
|
2319
|
+
key: mkShortId(),
|
|
2320
|
+
isEditableExpr: () => false,
|
|
2321
|
+
disableSorting: false,
|
|
2322
|
+
sortByExpr: void 0,
|
|
2323
|
+
isHidden: false,
|
|
2324
|
+
formatting: {
|
|
2325
|
+
styles: {},
|
|
2326
|
+
align: "left",
|
|
2327
|
+
freeze: "off"
|
|
2328
|
+
},
|
|
2329
|
+
dataType: "auto",
|
|
2330
|
+
role: void 0
|
|
2331
|
+
});
|
|
2332
|
+
const roles = [
|
|
2333
|
+
"content",
|
|
2334
|
+
"title",
|
|
2335
|
+
"subtitle",
|
|
2336
|
+
"beforeTitle",
|
|
2337
|
+
"afterTitle",
|
|
2338
|
+
"image",
|
|
2339
|
+
"unset"
|
|
2056
2340
|
];
|
|
2057
|
-
// This component is different from Table/Details since it has various different roles, so the UX is one of setting the choices for each role rather than a single list of fields.
|
|
2058
|
-
//
|
|
2059
|
-
// We first infer the defaults for each role.
|
|
2060
|
-
// This we always need to do because we want the choices to be 'stable'.
|
|
2061
|
-
// If the user sets one of the roles, without setting the others, we don't want to shift things around on the other roles as a result.
|
|
2062
|
-
// So the defaults need to always be there (they would only be irrelevant if all roles that would have had defaults were set/overridden by the user).
|
|
2063
|
-
//
|
|
2064
|
-
// Then, we layer on the user role choices.
|
|
2065
|
-
//
|
|
2066
|
-
// One UX wart is that unsetting a role will restore the default selection instead of clearing it.
|
|
2067
|
-
// User must know to actually set fieldId to none or (for arrays) remove the item.
|
|
2068
|
-
// Just another reason to fill in few roles by default.
|
|
2069
2341
|
function useRoleDefinitions(data, props) {
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
return !field.role &&
|
|
2130
|
-
((_a = field.fieldId) === null || _a === void 0 ? void 0 : _a.toLowerCase().match(/^(title|name|first[ _-]?name|full[ _-]?name)$/));
|
|
2131
|
-
});
|
|
2132
|
-
if (titleField) {
|
|
2133
|
-
titleField.role = "title";
|
|
2134
|
-
}
|
|
2342
|
+
const { fields, setControlContextData, rowActions } = props;
|
|
2343
|
+
return React.useMemo(() => {
|
|
2344
|
+
var _a, _b, _c, _d;
|
|
2345
|
+
const schema = data == null ? void 0 : data.schema;
|
|
2346
|
+
const schemaMap = new Map((_a = data == null ? void 0 : data.schema) == null ? void 0 : _a.fields.map((f) => [f.id, f]));
|
|
2347
|
+
if (!data || !schema) {
|
|
2348
|
+
return { normalized: [], roleConfigs: {}, finalRoles: {} };
|
|
2349
|
+
}
|
|
2350
|
+
function tagFieldConfigs(role) {
|
|
2351
|
+
var _a2;
|
|
2352
|
+
if (role !== "unset") {
|
|
2353
|
+
return ensureArray((_a2 = props[role]) != null ? _a2 : []).map((field) => {
|
|
2354
|
+
return __spreadProps(__spreadValues$1({}, field), {
|
|
2355
|
+
role
|
|
2356
|
+
});
|
|
2357
|
+
});
|
|
2358
|
+
} else {
|
|
2359
|
+
return [];
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
const { mergedFields, minimalFullLengthFields } = deriveFieldConfigs(
|
|
2363
|
+
[
|
|
2364
|
+
...tagFieldConfigs("image"),
|
|
2365
|
+
...tagFieldConfigs("content"),
|
|
2366
|
+
...tagFieldConfigs("title"),
|
|
2367
|
+
...tagFieldConfigs("beforeTitle"),
|
|
2368
|
+
...tagFieldConfigs("afterTitle"),
|
|
2369
|
+
...tagFieldConfigs("subtitle")
|
|
2370
|
+
],
|
|
2371
|
+
schema,
|
|
2372
|
+
(field) => __spreadValues$1(__spreadValues$1({}, defaultColumnConfig()), field && {
|
|
2373
|
+
key: field.id,
|
|
2374
|
+
fieldId: field.id,
|
|
2375
|
+
title: field.label || field.id,
|
|
2376
|
+
// undefined means not yet determined in this routine, not 'unset'
|
|
2377
|
+
role: void 0,
|
|
2378
|
+
expr: (currentItem) => currentItem[field.id]
|
|
2379
|
+
})
|
|
2380
|
+
);
|
|
2381
|
+
const normalized = mergedFields;
|
|
2382
|
+
if (data.data.length > 0 && !mergedFields.some((field) => field.role === "image")) {
|
|
2383
|
+
const sampleRows = Array.from(
|
|
2384
|
+
new Set(
|
|
2385
|
+
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9].map(
|
|
2386
|
+
(i) => Math.round(i / 9 * (data.data.length - 1))
|
|
2387
|
+
)
|
|
2388
|
+
)
|
|
2389
|
+
).map((i) => data.data[i]);
|
|
2390
|
+
const imageFieldCandidates = mergedFields.filter(
|
|
2391
|
+
(field) => !field.role && sampleRows.filter(
|
|
2392
|
+
(row) => field.fieldId && isLikeImage(row[field.fieldId])
|
|
2393
|
+
).length >= sampleRows.length / 2
|
|
2394
|
+
);
|
|
2395
|
+
const imageField = (_c = (_b = imageFieldCandidates.find(
|
|
2396
|
+
(f) => {
|
|
2397
|
+
var _a2;
|
|
2398
|
+
return (_a2 = f.fieldId) == null ? void 0 : _a2.match(
|
|
2399
|
+
/^(image|picture|pic|img|avatar|profile|photo|icon)$/i
|
|
2400
|
+
);
|
|
2135
2401
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
((_a = schemaMap.get(field.fieldId)) === null || _a === void 0 ? void 0 : _a.type) === "string";
|
|
2143
|
-
});
|
|
2144
|
-
if (contentField) {
|
|
2145
|
-
contentField.role = "content";
|
|
2146
|
-
}
|
|
2402
|
+
)) != null ? _b : imageFieldCandidates.find(
|
|
2403
|
+
(f) => {
|
|
2404
|
+
var _a2;
|
|
2405
|
+
return (_a2 = f.fieldId) == null ? void 0 : _a2.match(
|
|
2406
|
+
/.*(image|picture|pic|img|avatar|profile|photo|icon).*/i
|
|
2407
|
+
);
|
|
2147
2408
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2409
|
+
)) != null ? _c : imageFieldCandidates[0];
|
|
2410
|
+
if (imageField) {
|
|
2411
|
+
imageField.role = "image";
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
if (!mergedFields.some((field) => field.role === "title")) {
|
|
2415
|
+
const titleField = mergedFields.find(
|
|
2416
|
+
(field) => {
|
|
2417
|
+
var _a2;
|
|
2418
|
+
return !field.role && ((_a2 = field.fieldId) == null ? void 0 : _a2.toLowerCase().match(/^(title|name|first[ _-]?name|full[ _-]?name)$/));
|
|
2155
2419
|
}
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2420
|
+
);
|
|
2421
|
+
if (titleField) {
|
|
2422
|
+
titleField.role = "title";
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
if (!mergedFields.some((field) => field.role === "content")) {
|
|
2426
|
+
const contentField = mergedFields.find(
|
|
2427
|
+
(field) => {
|
|
2428
|
+
var _a2;
|
|
2429
|
+
return !field.role && field.fieldId && ((_a2 = schemaMap.get(field.fieldId)) == null ? void 0 : _a2.type) === "string";
|
|
2160
2430
|
}
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2431
|
+
);
|
|
2432
|
+
if (contentField) {
|
|
2433
|
+
contentField.role = "content";
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
const roleConfigs = ensure(groupBy(mergedFields, (f) => f.role));
|
|
2437
|
+
const finalRoles = {};
|
|
2438
|
+
for (const role of roles) {
|
|
2439
|
+
if (role !== "unset") {
|
|
2440
|
+
finalRoles[role] = (_d = maybe(props[role], ensureArray)) != null ? _d : roleConfigs[role];
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
const fieldIdToRole = new Map(mergedFields.map((f) => [f.fieldId, f.role]));
|
|
2444
|
+
for (const f of minimalFullLengthFields) {
|
|
2445
|
+
f.role = fieldIdToRole.get(f.fieldId);
|
|
2446
|
+
}
|
|
2447
|
+
setControlContextData == null ? void 0 : setControlContextData(__spreadProps(__spreadValues$1({}, data), { mergedFields, minimalFullLengthFields }));
|
|
2448
|
+
return { normalized, roleConfigs, finalRoles };
|
|
2449
|
+
}, [fields, data, setControlContextData, rowActions]);
|
|
2164
2450
|
}
|
|
2165
2451
|
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2452
|
+
var __defProp = Object.defineProperty;
|
|
2453
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2454
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2455
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2456
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2457
|
+
var __spreadValues = (a, b) => {
|
|
2458
|
+
for (var prop in b || (b = {}))
|
|
2459
|
+
if (__hasOwnProp.call(b, prop))
|
|
2460
|
+
__defNormalProp(a, prop, b[prop]);
|
|
2461
|
+
if (__getOwnPropSymbols)
|
|
2462
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
2463
|
+
if (__propIsEnum.call(b, prop))
|
|
2464
|
+
__defNormalProp(a, prop, b[prop]);
|
|
2465
|
+
}
|
|
2466
|
+
return a;
|
|
2467
|
+
};
|
|
2468
|
+
function roleProp({
|
|
2469
|
+
role,
|
|
2470
|
+
singular = false,
|
|
2471
|
+
advanced = false,
|
|
2472
|
+
displayName
|
|
2473
|
+
}) {
|
|
2474
|
+
return singular ? {
|
|
2475
|
+
type: "object",
|
|
2476
|
+
displayName,
|
|
2477
|
+
advanced,
|
|
2478
|
+
hidden: (ps) => !ps.data,
|
|
2479
|
+
nameFunc: (item) => maybe(
|
|
2480
|
+
item,
|
|
2481
|
+
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
2482
|
+
),
|
|
2483
|
+
fields: getFieldSubprops({
|
|
2484
|
+
canChangeField: true,
|
|
2485
|
+
noTitle: true
|
|
2486
|
+
}),
|
|
2487
|
+
defaultValueHint: (_props, contextData) => {
|
|
2488
|
+
var _a;
|
|
2489
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
2490
|
+
(f) => f.role === role
|
|
2491
|
+
);
|
|
2492
|
+
}
|
|
2493
|
+
} : buildFieldsPropType({
|
|
2494
|
+
displayName,
|
|
2495
|
+
advanced,
|
|
2496
|
+
noTitle: true,
|
|
2497
|
+
canChangeField: true,
|
|
2498
|
+
minimalValue: (_props, contextData) => {
|
|
2499
|
+
var _a;
|
|
2500
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
2501
|
+
(f) => f.role === role
|
|
2502
|
+
);
|
|
2503
|
+
}
|
|
2504
|
+
});
|
|
2198
2505
|
}
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2506
|
+
const richListMeta = {
|
|
2507
|
+
name: "hostless-rich-list",
|
|
2508
|
+
displayName: "Data List",
|
|
2509
|
+
defaultStyles: {
|
|
2510
|
+
width: "stretch",
|
|
2511
|
+
padding: "16px",
|
|
2512
|
+
maxHeight: "100%"
|
|
2513
|
+
},
|
|
2514
|
+
templates: {
|
|
2515
|
+
grid: {
|
|
2516
|
+
props: {}
|
|
2517
|
+
}
|
|
2518
|
+
},
|
|
2519
|
+
props: __spreadValues({
|
|
2520
|
+
data: dataProp(),
|
|
2521
|
+
type: {
|
|
2522
|
+
type: "choice",
|
|
2523
|
+
options: [
|
|
2524
|
+
{ value: "list", label: "List" },
|
|
2525
|
+
{ value: "grid", label: "Grid" }
|
|
2526
|
+
],
|
|
2527
|
+
defaultValueHint: "list"
|
|
2206
2528
|
},
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2529
|
+
header: {
|
|
2530
|
+
type: "slot",
|
|
2531
|
+
hidePlaceholder: true
|
|
2532
|
+
},
|
|
2533
|
+
footer: {
|
|
2534
|
+
type: "slot",
|
|
2535
|
+
hidePlaceholder: true
|
|
2536
|
+
},
|
|
2537
|
+
title: roleProp({ role: "title" }),
|
|
2538
|
+
content: roleProp({ role: "content" }),
|
|
2539
|
+
image: roleProp({ role: "image", singular: true }),
|
|
2540
|
+
subtitle: roleProp({
|
|
2541
|
+
role: "subtitle",
|
|
2542
|
+
displayName: "Subtitle",
|
|
2543
|
+
advanced: true
|
|
2544
|
+
}),
|
|
2545
|
+
// Haven't styled these yet!
|
|
2546
|
+
// beforeTitle: roleProp({ role: "beforeTitle", advanced: true }),
|
|
2547
|
+
// afterTitle: roleProp({ role: "afterTitle", advanced: true }),
|
|
2548
|
+
linkTo: {
|
|
2549
|
+
type: "function",
|
|
2550
|
+
control: {
|
|
2551
|
+
type: "href"
|
|
2552
|
+
},
|
|
2553
|
+
argNames: ["currentItem"],
|
|
2554
|
+
argValues: (_props, ctx) => {
|
|
2555
|
+
var _a;
|
|
2556
|
+
return [(_a = ctx == null ? void 0 : ctx.data) == null ? void 0 : _a[0]];
|
|
2557
|
+
}
|
|
2558
|
+
},
|
|
2559
|
+
onRowClick: onRowClickProp(),
|
|
2560
|
+
rowActions: rowActionsProp(),
|
|
2561
|
+
bordered: {
|
|
2562
|
+
type: "boolean",
|
|
2563
|
+
defaultValue: true,
|
|
2564
|
+
hidden: (ps) => {
|
|
2565
|
+
var _a;
|
|
2566
|
+
return ((_a = ps.type) != null ? _a : "list") !== "list";
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
}, commonProps()),
|
|
2570
|
+
importName: "RichList",
|
|
2571
|
+
importPath: "@plasmicpkgs/plasmic-rich-components"
|
|
2242
2572
|
};
|
|
2243
2573
|
function registerRichList(loader) {
|
|
2244
|
-
|
|
2574
|
+
registerComponentHelper(loader, RichList, richListMeta);
|
|
2245
2575
|
}
|
|
2246
2576
|
|
|
2247
2577
|
function registerAll(loader) {
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2578
|
+
registerRichLayout(loader);
|
|
2579
|
+
registerRichList(loader);
|
|
2580
|
+
registerRichTable(loader);
|
|
2581
|
+
registerRichDetails(loader);
|
|
2252
2582
|
}
|
|
2253
2583
|
|
|
2254
2584
|
export { RichDetails, RichLayout, RichList, RichTable, commonProps, dataProp, deriveKeyOfRow, deriveRowKey, ensureArray, isInteractable, isLikeImage, onRowClickProp, registerAll, renderActions, rowActionsProp, tableHelpers, useSortedFilteredData };
|