Skip to content

Commit

Permalink
fixing the rootContainerName parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
maliknajjar committed Jan 21, 2024
1 parent 12adaf3 commit a805f23
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/guifier/classes/Data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import clone from 'clone'

import type { Property, ParametersInternal } from '../types'
import type { Property, Parameters } from '../types'

import { XMLParser, XMLBuilder } from 'fast-xml-parser'
import * as toml from 'toml'
Expand All @@ -18,18 +18,18 @@ import xmlFormat from 'xml-formatter'
export class Data {
public rawData: any
public parsedData: Property = defaultProperty
public params: ParametersInternal
public params: Parameters
private readonly path: Array<number | string> = []

constructor (data: string, dataType: DataType, params: ParametersInternal) {
constructor (data: string, dataType: DataType, params: Parameters) {
// add guifier params
this.params = params

// converting data types string into a js object
this.rawData = this.deserializeData(data, dataType)

// adding meta data (private properties) to the properties that dont have them
this.parsedData = this.addMetaDataRecursively(this.rawData, this.params.rootContainerName)
this.parsedData = this.addMetaDataRecursively(this.rawData, 'root')

// normalizing _rules array in the property meta data
this.normalizingRules()
Expand Down
2 changes: 1 addition & 1 deletion src/guifier/fields/containers/Container/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export abstract class Container extends Field {
const objectName = this.property._key
const guifierContainerHeaderKeyName = document.createElement('div')
guifierContainerHeaderKeyName.classList.add('guifierContainerHeaderKeyName')
guifierContainerHeaderKeyName.innerHTML = `${objectName}`
guifierContainerHeaderKeyName.innerHTML = this.property._path.length === 1 ? this.params.rootContainerName : `${objectName}`
guifierContainerHeader.append(guifierContainerHeaderKeyName)

// todo: add this part to a function
Expand Down
8 changes: 4 additions & 4 deletions src/guifier/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export const ParameterSchema = z.object({
data: z.any(),
dataType: z.string(),
rootContainerName: z.string().default('root'),
withoutContainer: z.boolean().optional().default(false),
flipBackgroundColors: z.boolean().optional().default(false),
expandFieldsToFullWidth: z.boolean().optional().default(false),
readOnlyMode: z.boolean().optional().default(false),
withoutContainer: z.boolean().default(false),
flipBackgroundColors: z.boolean().default(false),
expandFieldsToFullWidth: z.boolean().default(false),
readOnlyMode: z.boolean().default(false),
onChange: z.function().optional(),
xmlRootName: z.any()
})
Expand Down

0 comments on commit a805f23

Please sign in to comment.