@stonecrop/atable 0.13.12 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,12 +3,12 @@
3
3
  *
4
4
  * Fields are excluded when:
5
5
  * - `hidden: true` — field should not be visible in any view
6
- * - no `fieldtype` — non-scalar entry (nested table or fieldset), has no column equivalent
6
+ * - no `component` — non-scalar entry (nested table or fieldset), no column equivalent
7
7
  *
8
8
  * `fieldname` is renamed to `name`; `hidden` is stripped. All other `ColumnSchema` properties
9
9
  * spread through automatically.
10
10
  *
11
- * For `fieldtype: 'Link'` fields without an explicit `cellComponent`:
11
+ * For link fields (those carrying `doctype`) without an explicit `cellComponent`:
12
12
  * - `linkDoctype` is set from the field's `doctype` property (used by ACell's async resolver).
13
13
  * - A synchronous `format` function is added (unless the field already has one) that handles
14
14
  * both bare ID strings and pre-resolved `{ id, displayText }` objects.
@@ -17,16 +17,13 @@
17
17
  */
18
18
  export function schemaToColumns(schema) {
19
19
  return schema
20
- .filter(f => !f.hidden && f.fieldtype)
20
+ .filter(f => !f.hidden && f.component)
21
21
  .map(({ fieldname, hidden: _hidden, ...rest }) => {
22
22
  const col = Object.assign({ name: fieldname }, rest);
23
- // Link fields: store the linked doctype for async resolution by ACell,
24
- // and add a sync format that handles pre-resolved AFormLinkValue objects.
25
- if (rest.fieldtype === 'Link' && !rest.cellComponent) {
26
- const fields = rest;
27
- const linkedDoctype = typeof fields.doctype === 'string' ? fields.doctype : undefined;
28
- if (linkedDoctype)
29
- col.linkDoctype = linkedDoctype;
23
+ // Link fields: store the linked doctype for async resolution by ACell, and add a sync
24
+ // format that handles pre-resolved AFormLinkValue objects.
25
+ if (rest.doctype && !rest.cellComponent) {
26
+ col.linkDoctype = rest.doctype;
30
27
  if (!rest.format) {
31
28
  col.format = (v) => {
32
29
  if (v === null || v === undefined)