{"version":3,"file":"ngx-formly-nativescript-select.mjs","names":[],"sources":["../../../../src/ui/nativescript/select/src/select.type.ts","../../../../src/ui/nativescript/select/src/select.config.ts","../../../../src/ui/nativescript/select/src/select.module.ts"],"sourcesContent":["import { Component, ChangeDetectionStrategy, Type } from '@angular/core';\nimport { FieldType, FieldTypeConfig, FormlyFieldConfig } from '@ngx-formly/core';\nimport { action } from '@nativescript/core/ui/dialogs';\nimport { FormlyFieldProps } from '@ngx-formly/nativescript/form-field';\nimport { FormlyFieldSelectProps } from '@ngx-formly/core/select';\n\ninterface SelectProps extends FormlyFieldProps, FormlyFieldSelectProps {}\n\nexport interface FormlySelectFieldConfig extends FormlyFieldConfig<SelectProps> {\n  type: 'select' | Type<FormlyFieldSelect>;\n}\n\n@Component({\n  selector: 'formly-field-ns-select',\n  template: `\n    @if (props.options | formlySelectOptions: field | async; as options) {\n      <Button (tap)=\"tap(options)\" [text]=\"selectedItem(options)\"></Button>\n    }\n  `,\n  changeDetection: ChangeDetectionStrategy.OnPush,\n  standalone: false,\n})\nexport class FormlyFieldSelect extends FieldType<FieldTypeConfig<SelectProps>> {\n  tap(options: any[]) {\n    action({ title: this.props.label, actions: options.map((o) => o.label) }).then((selectedAction) =>\n      this.formControl.patchValue(options.find((o) => o.label === selectedAction).value),\n    );\n  }\n\n  selectedItem(options: any[]) {\n    if (this.formControl.value) {\n      return options.find((o) => o.value === this.formControl.value).label;\n    }\n\n    return this.props.placeholder;\n  }\n}\n","import { ConfigOption } from '@ngx-formly/core';\nimport { FormlyFieldSelect } from './select.type';\n\nexport function withFormlyFieldSelect(): ConfigOption {\n  return {\n    types: [\n      {\n        name: 'select',\n        component: FormlyFieldSelect,\n        wrappers: ['form-field'],\n      },\n      { name: 'enum', extends: 'select' },\n    ],\n  };\n}\n","import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormlyModule } from '@ngx-formly/core';\nimport { FormlySelectModule } from '@ngx-formly/core/select';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { NativeScriptFormsModule } from '@nativescript/angular';\n\nimport { FormlyNsFormFieldModule } from '@ngx-formly/nativescript/form-field';\nimport { FormlyFieldSelect } from './select.type';\nimport { withFormlyFieldSelect } from './select.config';\n\n@NgModule({\n  declarations: [FormlyFieldSelect],\n  imports: [\n    CommonModule,\n    ReactiveFormsModule,\n    NativeScriptFormsModule,\n\n    FormlyNsFormFieldModule,\n    FormlySelectModule,\n    FormlyModule.forChild(withFormlyFieldSelect()),\n  ],\n  schemas: [NO_ERRORS_SCHEMA],\n})\nexport class FormlyNsSelectFieldModule {}\n"],"mappings":";;;;;;;;;;;;AAsBA,IAAa,oBAAb,MAAa,0BAA0B,UAAuC;CAC5E,IAAI,SAAc;EAChB,OAAO;GAAE,OAAO,KAAK,MAAM;GAAO,SAAS,QAAQ,KAAK,MAAM,EAAE,KAAK;EAAC,CAAE,CAAC,CAAC,MAAM,mBAC9E,KAAK,YAAY,WAAW,QAAQ,MAAM,MAAM,EAAE,UAAU,cAAc,CAAC,CAAC,KAAK,CAAC;CAEtF;CAEA,aAAa,SAAc;EACzB,IAAI,KAAK,YAAY,OACnB,OAAO,QAAQ,MAAM,MAAM,EAAE,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC;EAGjE,OAAO,KAAK,MAAM;CACpB;CAbW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiB,MAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAjB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAiB,cAAA;GAAA,UAAA;GAAA,iBAAA;GAAA,UAAA;GAAA,UARlB;;;;;GAIT,UAAA;GAAA,cAAA,CAAA;IAAA,MAAA;IAAA,MAAA,KAAA;IAAA,MAAA;GAAA,GAAA;IAAA,MAAA;IAAA,MAAA,GAAA;IAAA,MA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