{"version":3,"file":"index.mjs","sources":["../packages/index.ts"],"sourcesContent":["import powerfulForm from './powerful-form'\nimport { PowerfulFormSymbol } from './keys'\nimport components from './components'\nimport type { InjectProps } from '~/index'\nimport type { App, Plugin } from 'vue'\nimport type { FormType } from './typings/form-view'\nexport * from './powerful-form'\nexport * from './locale/packages'\nexport * from '~/utils'\nexport * from '~/hooks/useGetRefs'\nexport type * from './typings/index'\n\n// 获取类型\nexport const getType = <T>(target: T) =>\n  Object.prototype.toString.call(target).slice(8, -1)\n\n// 深度克隆\nexport const deepClone = <T>(target: T) => {\n  let result\n  if (getType(target) === 'Object') {\n    result = {} as T\n  } else if (getType(target) === 'Array') {\n    result = [] as T\n  } else result = target\n\n  for (const i in target) {\n    const item = target[i]\n    if (getType(item) === 'Object' || getType(item) === 'Array') {\n      result[i] = deepClone(item)\n    } else result[i] = item\n  }\n  return result\n}\n\nexport const formViewSetData = <T extends keyof FormType>(\n  data: FormType[T]\n): FormType[T] => data\n\nexport const componentRegister = (app: App) => {\n  components.forEach((c) => {\n    if (!app._context.components[c.name!]) {\n      app.component(c.name!, c)\n    }\n  })\n}\n\nconst makeInstaller = (components: Plugin[] = []) => {\n  const install = (app: App, options?: InjectProps) => {\n    components.forEach((c) => {\n      app.use(c)\n    })\n    app.provide(PowerfulFormSymbol, options ? options : {})\n  }\n\n  return install\n}\n\nexport default {\n  install: makeInstaller([powerfulForm]),\n}\n"],"names":["getType","target","deepClone","result","i","item","components","formViewSetData","data","componentRegister","app","c"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6BI,MAAAA,IAAA,CAAAC,MAAA,OAAA,UAAA,SAAA,KAAAA,CAAA,EAAA,MAAA,GAAA,EAAA,GAAcC,IAAK,CAAAD,MAAA;AACrB,MAAAE;AACO,EAAAH,EAAAC,CAAA,MAAA,WACTE,IAAA,CAAA,IAEaH,EAAAC,CAAA,MAEK,UAELE,IAAA,CAAA,IAETA,IAASF;AACH,aAAAG,KAAAH,GAAY;AAClB,UAAAI,IAAAJ,EAAAG,CAAA;AACD,IAAAJ,EAAAK,CAAA,MAAA,YAAAL,EAAAK,CAAA,MAAA,UACHF,EAAAC,CAAA,IAAAF,EAAAG,CAAA,IAGQF,EAAAC,CAAA,IAAUC;AAAA,EACdC;AACE,SAAAH;AAAS,GAECI,IAAA,CAAAC,MAA8BA,GAC5CC,IAAA,CAAAC,MAAA;AAEO,EAAAJ,EAAA,QAAA,CAAAK,MAAA;AACT,IAAAD,EAAA,SAAA,WAAAC,EAAA,IAAA,KAEeD,EAAA,UAAAC,EAAA,MAAAA,CAAA;AAAA,EAEf,CAAA;;;;;;;;"}