UNPKG

zp-figma-converter

Version:

Convert Figma designs to various code formats

90 lines 3.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CheckBoxParser = void 0; const widget_parser_1 = require("./widget-parser"); const xml_utils_1 = require("../../../../utils/xml-utils"); /** * Parser for CheckBoxData */ class CheckBoxParser extends widget_parser_1.WidgetParser { parse(nodeData) { const result = this.parseBaseAttributes(nodeData); // CheckBox specific properties if (nodeData.TouchEnable !== undefined) result['@_TouchEnable'] = (0, xml_utils_1.boolToString)(nodeData.TouchEnable); if (nodeData.DisplayState !== undefined) result['@_DisplayState'] = (0, xml_utils_1.boolToString)(nodeData.DisplayState); if (nodeData.SelectedState !== undefined) result['@_SelectedState'] = (0, xml_utils_1.boolToString)(nodeData.SelectedState); if (nodeData.CheckedState !== undefined) result['@_CheckedState'] = (0, xml_utils_1.boolToString)(nodeData.CheckedState); // Process các thuộc tính cũ của CheckBox if (nodeData.BackGroundBoxData) { result.BackGroundBoxData = { '@_Type': nodeData.BackGroundBoxData.Type, '@_Path': nodeData.BackGroundBoxData.Path, '@_Plist': nodeData.BackGroundBoxData.Plist }; } if (nodeData.BackGroundBoxDisabledData) { result.BackGroundBoxDisabledData = { '@_Type': nodeData.BackGroundBoxDisabledData.Type, '@_Path': nodeData.BackGroundBoxDisabledData.Path, '@_Plist': nodeData.BackGroundBoxDisabledData.Plist }; } if (nodeData.FrontCrossData) { result.FrontCrossData = { '@_Type': nodeData.FrontCrossData.Type, '@_Path': nodeData.FrontCrossData.Path, '@_Plist': nodeData.FrontCrossData.Plist }; } if (nodeData.FrontCrossDisabledData) { result.FrontCrossDisabledData = { '@_Type': nodeData.FrontCrossDisabledData.Type, '@_Path': nodeData.FrontCrossDisabledData.Path, '@_Plist': nodeData.FrontCrossDisabledData.Plist }; } // Process các thuộc tính mới của CheckBox if (nodeData.NormalBackFileData) { result.NormalBackFileData = { '@_Type': nodeData.NormalBackFileData.Type, '@_Path': nodeData.NormalBackFileData.Path, '@_Plist': nodeData.NormalBackFileData.Plist }; } if (nodeData.PressedBackFileData) { result.PressedBackFileData = { '@_Type': nodeData.PressedBackFileData.Type, '@_Path': nodeData.PressedBackFileData.Path, '@_Plist': nodeData.PressedBackFileData.Plist }; } if (nodeData.DisableBackFileData) { result.DisableBackFileData = { '@_Type': nodeData.DisableBackFileData.Type, '@_Path': nodeData.DisableBackFileData.Path, '@_Plist': nodeData.DisableBackFileData.Plist }; } if (nodeData.NodeNormalFileData) { result.NodeNormalFileData = { '@_Type': nodeData.NodeNormalFileData.Type, '@_Path': nodeData.NodeNormalFileData.Path, '@_Plist': nodeData.NodeNormalFileData.Plist }; } if (nodeData.NodeDisableFileData) { result.NodeDisableFileData = { '@_Type': nodeData.NodeDisableFileData.Type, '@_Path': nodeData.NodeDisableFileData.Path, '@_Plist': nodeData.NodeDisableFileData.Plist }; } return result; } } exports.CheckBoxParser = CheckBoxParser; //# sourceMappingURL=check-box-parser.js.map