@aglyn/plugins-data 1.0.0-beta.246 → 1.0.0-beta.249
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/package.json +10 -10
- package/src/lib/components/dataset-field-inputs.component.d.ts +37 -0
- package/src/lib/components/dataset-field-inputs.component.js +243 -0
- package/src/lib/components/dataset-field-inputs.component.js.map +1 -0
- package/src/lib/components/host-datasets-card.component.js +149 -136
- package/src/lib/components/host-datasets-card.component.js.map +1 -1
- package/src/lib/declarations.server.js +3 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/form-target/form-dataset-binding.js +3 -2
- package/src/lib/form-target/form-dataset-binding.js.map +1 -1
- package/src/lib/model/dataset-image-field.d.ts +5 -0
- package/src/lib/model/dataset-image-field.js +8 -3
- package/src/lib/model/dataset-image-field.js.map +1 -1
- package/src/lib/model/dataset-page-field.d.ts +42 -0
- package/src/lib/model/dataset-page-field.js +57 -0
- package/src/lib/model/dataset-page-field.js.map +1 -0
- package/src/lib/plugin.js +12 -2
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/dataset-ai-capability.js +4 -2
- package/src/lib/server/dataset-ai-capability.js.map +1 -1
- package/src/lib/server/dataset-drafts.d.ts +6 -1
- package/src/lib/server/dataset-drafts.js +11 -2
- package/src/lib/server/dataset-drafts.js.map +1 -1
|
@@ -37,6 +37,7 @@ import { listQueryConstraints } from "@aglyn/tenant-feature-instance/hooks/use-l
|
|
|
37
37
|
import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
|
|
38
38
|
import { DatasetSchemaDialog } from "./dataset-schema-dialog.component.js";
|
|
39
39
|
import { DatasetRecordDialog } from "./dataset-record-dialog.component.js";
|
|
40
|
+
import { DatasetRecordSiteContext } from "./dataset-field-inputs.component.js";
|
|
40
41
|
import { datasetRecordFilter, planRecordQuery, recordColumn } from "./dataset-record-filter.js";
|
|
41
42
|
import { coerceDocumentValues, datasetIntegrityUpdate, datasetValueToInput, effectiveDatasetModel, formatDatasetValue, modelFromFieldEntries, validateDocument } from "../model/dataset-models.js";
|
|
42
43
|
import { fillRecordAddresses } from "../record-pages/record-pages.js";
|
|
@@ -114,6 +115,15 @@ export function newDatasetSharingNote(siteOnly) {
|
|
|
114
115
|
createdFromHostId
|
|
115
116
|
]);
|
|
116
117
|
/**
|
|
118
|
+
* The site the record editor's Page field lists pages from (AGL-3763): the
|
|
119
|
+
* site whose Data page this is, and none on the organization Data page,
|
|
120
|
+
* where a dataset is no one site's.
|
|
121
|
+
*/ const recordSite = useMemo(()=>({
|
|
122
|
+
hostId: createdFromHostId
|
|
123
|
+
}), [
|
|
124
|
+
createdFromHostId
|
|
125
|
+
]);
|
|
126
|
+
/**
|
|
117
127
|
* Whether a dataset created here starts on this site alone: the org chose
|
|
118
128
|
* "Only the site they were created in" and there is a site to limit it to.
|
|
119
129
|
* The caption reads it so it never promises All sites to a create that
|
|
@@ -1329,146 +1339,149 @@ export function newDatasetSharingNote(siteOnly) {
|
|
|
1329
1339
|
flexDirection: 'column',
|
|
1330
1340
|
gap: 2
|
|
1331
1341
|
},
|
|
1332
|
-
children:
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
} : undefined,
|
|
1358
|
-
onChange: (event)=>setValue(event.target.value)
|
|
1359
|
-
};
|
|
1360
|
-
// Custom field types (AGL-434): the declaring plugin's Input
|
|
1361
|
-
// takes over; values stay in input form (strings) so the
|
|
1362
|
-
// existing coerce/validate pipeline is unchanged.
|
|
1363
|
-
const customFieldType = getCustomFieldType(field.customType);
|
|
1364
|
-
if (customFieldType == null ? void 0 : customFieldType.Input) {
|
|
1365
|
-
const CustomInput = customFieldType.Input;
|
|
1366
|
-
return /*#__PURE__*/ _jsxs(Stack, {
|
|
1342
|
+
children: /*#__PURE__*/ _jsx(DatasetRecordSiteContext.Provider, {
|
|
1343
|
+
value: recordSite,
|
|
1344
|
+
children: fields.map((fieldId, index)=>{
|
|
1345
|
+
var _ref;
|
|
1346
|
+
var _field_validation_options, _field_validation;
|
|
1347
|
+
const field = model.fields[fieldId];
|
|
1348
|
+
if (!field) return null;
|
|
1349
|
+
const value = (_ref = editor == null ? void 0 : editor.values[fieldId]) != null ? _ref : '';
|
|
1350
|
+
const error = editor == null ? void 0 : editor.errors[fieldId];
|
|
1351
|
+
const label = field.required ? `${field.name} *` : field.name;
|
|
1352
|
+
const setValue = (nextValue)=>setEditor((prev)=>prev ? _extends({}, prev, {
|
|
1353
|
+
values: _extends({}, prev.values, {
|
|
1354
|
+
[fieldId]: nextValue
|
|
1355
|
+
}),
|
|
1356
|
+
errors: _extends({}, prev.errors, {
|
|
1357
|
+
[fieldId]: ''
|
|
1358
|
+
})
|
|
1359
|
+
}) : prev);
|
|
1360
|
+
const common = {
|
|
1361
|
+
label,
|
|
1362
|
+
value,
|
|
1363
|
+
size: 'small',
|
|
1364
|
+
autoFocus: index === 0,
|
|
1365
|
+
error: Boolean(error),
|
|
1366
|
+
helperText: error || field.description,
|
|
1367
1367
|
sx: index === 0 ? {
|
|
1368
1368
|
mt: 1
|
|
1369
1369
|
} : undefined,
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1370
|
+
onChange: (event)=>setValue(event.target.value)
|
|
1371
|
+
};
|
|
1372
|
+
// Custom field types (AGL-434): the declaring plugin's Input
|
|
1373
|
+
// takes over; values stay in input form (strings) so the
|
|
1374
|
+
// existing coerce/validate pipeline is unchanged.
|
|
1375
|
+
const customFieldType = getCustomFieldType(field.customType);
|
|
1376
|
+
if (customFieldType == null ? void 0 : customFieldType.Input) {
|
|
1377
|
+
const CustomInput = customFieldType.Input;
|
|
1378
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
1379
|
+
sx: index === 0 ? {
|
|
1380
|
+
mt: 1
|
|
1381
|
+
} : undefined,
|
|
1382
|
+
children: [
|
|
1383
|
+
/*#__PURE__*/ _jsx(CustomInput, {
|
|
1384
|
+
value: value,
|
|
1385
|
+
label: common.label,
|
|
1386
|
+
onChange: (next)=>setValue(String(next != null ? next : ''))
|
|
1387
|
+
}),
|
|
1388
|
+
error || field.description ? /*#__PURE__*/ _jsx(Typography, {
|
|
1389
|
+
variant: "caption",
|
|
1390
|
+
color: error ? 'error' : 'text.secondary',
|
|
1391
|
+
children: error || field.description
|
|
1392
|
+
}) : null
|
|
1393
|
+
]
|
|
1394
|
+
}, fieldId);
|
|
1395
|
+
}
|
|
1396
|
+
// Typed inputs per FT.Tag (AGL-179).
|
|
1397
|
+
if (field.type === 'bool') {
|
|
1398
|
+
return /*#__PURE__*/ _jsxs(TextField, _extends({}, common, {
|
|
1399
|
+
select: true,
|
|
1400
|
+
children: [
|
|
1401
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
1402
|
+
value: "",
|
|
1403
|
+
children: '—'
|
|
1404
|
+
}),
|
|
1405
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
1406
|
+
value: "true",
|
|
1407
|
+
children: 'Yes'
|
|
1408
|
+
}),
|
|
1409
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
1410
|
+
value: "false",
|
|
1411
|
+
children: 'No'
|
|
1412
|
+
})
|
|
1413
|
+
]
|
|
1414
|
+
}), fieldId);
|
|
1415
|
+
}
|
|
1416
|
+
if (field.type === 'text' && ((_field_validation = field.validation) == null ? void 0 : (_field_validation_options = _field_validation.options) == null ? void 0 : _field_validation_options.length)) {
|
|
1417
|
+
return /*#__PURE__*/ _jsxs(TextField, _extends({}, common, {
|
|
1418
|
+
select: true,
|
|
1419
|
+
children: [
|
|
1420
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
1421
|
+
value: "",
|
|
1422
|
+
children: '—'
|
|
1423
|
+
}),
|
|
1424
|
+
field.validation.options.map((option)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
1425
|
+
value: option,
|
|
1426
|
+
children: option
|
|
1427
|
+
}, option))
|
|
1428
|
+
]
|
|
1429
|
+
}), fieldId);
|
|
1430
|
+
}
|
|
1431
|
+
if (field.type === 'reference') {
|
|
1432
|
+
var _refOptions_fieldId;
|
|
1433
|
+
var _field_reference;
|
|
1434
|
+
const options = (_refOptions_fieldId = refOptions[fieldId]) != null ? _refOptions_fieldId : [];
|
|
1435
|
+
const multiple = Boolean((_field_reference = field.reference) == null ? void 0 : _field_reference.multiple);
|
|
1436
|
+
const selectedIds = value.split(',').map((part)=>part.trim()).filter(Boolean);
|
|
1437
|
+
return /*#__PURE__*/ _jsxs(TextField, _extends({}, common, {
|
|
1438
|
+
select: true,
|
|
1439
|
+
value: multiple ? selectedIds : value,
|
|
1440
|
+
slotProps: {
|
|
1441
|
+
select: multiple ? {
|
|
1442
|
+
multiple: true,
|
|
1443
|
+
onChange: (event)=>setValue(event.target.value.join(', '))
|
|
1444
|
+
} : undefined
|
|
1445
|
+
},
|
|
1446
|
+
children: [
|
|
1447
|
+
multiple ? null : /*#__PURE__*/ _jsx(MenuItem, {
|
|
1448
|
+
value: "",
|
|
1449
|
+
children: '—'
|
|
1450
|
+
}),
|
|
1451
|
+
options.map((option)=>/*#__PURE__*/ _jsx(MenuItem, {
|
|
1452
|
+
value: option.id,
|
|
1453
|
+
children: option.label
|
|
1454
|
+
}, option.id))
|
|
1455
|
+
]
|
|
1456
|
+
}), fieldId);
|
|
1457
|
+
}
|
|
1458
|
+
if (field.type === 'int32' || field.type === 'int64' || field.type === 'float') {
|
|
1459
|
+
return /*#__PURE__*/ _jsx(TextField, _extends({}, common, {
|
|
1460
|
+
type: "number"
|
|
1461
|
+
}), fieldId);
|
|
1462
|
+
}
|
|
1463
|
+
if (field.type === 'timestamp') {
|
|
1464
|
+
return /*#__PURE__*/ _jsx(TextField, _extends({}, common, {
|
|
1465
|
+
type: "datetime-local",
|
|
1466
|
+
slotProps: {
|
|
1467
|
+
inputLabel: {
|
|
1468
|
+
shrink: true
|
|
1469
|
+
}
|
|
1457
1470
|
}
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1471
|
+
}), fieldId);
|
|
1472
|
+
}
|
|
1473
|
+
if (field.type === 'coordinates') {
|
|
1474
|
+
return /*#__PURE__*/ _jsx(TextField, _extends({}, common, {
|
|
1475
|
+
helperText: error || field.description || 'lat, lon'
|
|
1476
|
+
}), fieldId);
|
|
1477
|
+
}
|
|
1478
|
+
if (field.type === 'sorted') {
|
|
1479
|
+
return /*#__PURE__*/ _jsx(TextField, _extends({}, common, {
|
|
1480
|
+
helperText: error || field.description || 'Comma-separated list'
|
|
1481
|
+
}), fieldId);
|
|
1482
|
+
}
|
|
1483
|
+
return /*#__PURE__*/ _jsx(TextField, _extends({}, common), fieldId);
|
|
1484
|
+
})
|
|
1472
1485
|
})
|
|
1473
1486
|
}),
|
|
1474
1487
|
/*#__PURE__*/ _jsxs(DialogActions, {
|