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