@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 1.21 kB
JavaScript
const e={rootId:`brick_id`,parentId:`parent_id`,parentIdRef:`parent_id_ref`},t={mode:`tree-table`,baseTablePriority:500,isDatabaseConfig:e=>e.mode===`tree-table`,getSchemaDefinition:t=>{let n=t.table.depth>1;return{columns:[{name:e.rootId,type:t.db.getDataType(`integer`),nullable:!1,foreignKey:{table:t.table.root,column:`id`,onDelete:`cascade`}},{name:e.parentId,type:t.db.getDataType(`integer`),nullable:!0,foreignKey:n&&t.table.parent!==t.table.root?{table:t.table.parent,column:`id`,onDelete:`cascade`}:void 0},{name:e.parentIdRef,type:t.db.getDataType(`integer`),nullable:!0}]}},getChildFieldConfigs:e=>!(`fields`in e)||!Array.isArray(e.fields)?null:e.fields,getInsertPriority:e=>e?.length??0,getPriorityOffsetForDepth:e=>e*10,clientTypeGen:e=>{let n=t.getChildFieldConfigs(e.field)??[],r=e.helpers.renderFieldMap(n,{builder:e.builder,collectionUsesTranslations:e.collectionUsesTranslations,withinGroup:!0});return{fieldType:e.fieldType??e.helpers.renderBaseFieldType({field:e.field,mode:`groups`,groupFieldsType:r.typeText,hasGroupRef:e.hasGroupRef}),declarations:[...e.declarations??[],...r.declarations]}}};export{t as treeTableMode,e as treeTableSchemaColumns};
//# sourceMappingURL=tree-table.mjs.map