feat: front matter in decks
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { Layer, LayerConfig } from '../types';
|
||||
import {CSV} from "../../utils/csv-loader";
|
||||
|
||||
/**
|
||||
* 解析 layers 字符串
|
||||
@@ -51,11 +52,14 @@ export function formatLayers(layers: LayerConfig[]): string {
|
||||
* 初始化图层配置
|
||||
*/
|
||||
export function initLayerConfigs(
|
||||
data: any[],
|
||||
data: CSV<any>,
|
||||
existingLayersStr: string
|
||||
): LayerConfig[] {
|
||||
const parsed = parseLayers(existingLayersStr);
|
||||
const allProps = Object.keys(data[0] || {}).filter(k => k !== 'label');
|
||||
if(data.frontmatter){
|
||||
allProps.push(...Object.keys(data.frontmatter));
|
||||
}
|
||||
|
||||
return allProps.map(prop => {
|
||||
const existing = parsed.find(l => l.prop === prop);
|
||||
|
||||
Reference in New Issue
Block a user