OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_EDITOR_FIELD_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_EDITOR_FIELD_H_ |
6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_EDITOR_FIELD_H_ | 6 #define IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_EDITOR_FIELD_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h" | 10 #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h" |
11 | 11 |
12 @class AutofillEditItem; | 12 @class CollectionViewItem; |
| 13 |
| 14 // Type of the editor field. i.e., text field or selector field. |
| 15 typedef NS_ENUM(NSInteger, EditorFieldType) { |
| 16 EditorFieldTypeTextField, |
| 17 EditorFieldTypeSelector, |
| 18 }; |
13 | 19 |
14 // Field definition for an editor field. Used for building the UI and | 20 // Field definition for an editor field. Used for building the UI and |
15 // validation. | 21 // validation. |
16 @interface EditorField : NSObject | 22 @interface EditorField : NSObject |
17 | 23 |
18 // Autofill type for the field. | 24 // Autofill type for the field. |
19 @property(nonatomic, assign) AutofillUIType autofillUIType; | 25 @property(nonatomic, assign) AutofillUIType autofillUIType; |
| 26 // Type of the field. |
| 27 @property(nonatomic, assign) EditorFieldType fieldType; |
20 // Label for the field. | 28 // Label for the field. |
21 @property(nonatomic, copy) NSString* label; | 29 @property(nonatomic, copy) NSString* label; |
22 // Value of the field. May be nil. | 30 // Value of the field. May be nil. |
23 @property(nonatomic, copy) NSString* value; | 31 @property(nonatomic, copy) NSString* value; |
| 32 // Optional display value. Used in selector editor fields where |value| is not |
| 33 // meant for display purposes. |
| 34 @property(nonatomic, copy) NSString* displayValue; |
24 // Whether the field is required. | 35 // Whether the field is required. |
25 @property(nonatomic, getter=isRequired) BOOL required; | 36 @property(nonatomic, getter=isRequired) BOOL required; |
26 // The associated AutofillEditItem instance. May be nil. | 37 // The associated CollectionViewItem instance. May be nil. |
27 @property(nonatomic, strong) AutofillEditItem* item; | 38 @property(nonatomic, strong) CollectionViewItem* item; |
28 // The section identifier for the associated AutofillEditItem. | 39 // The section identifier for the associated AutofillEditItem. |
29 @property(nonatomic, assign) NSInteger sectionIdentifier; | 40 @property(nonatomic, assign) NSInteger sectionIdentifier; |
30 | 41 |
31 - (instancetype)initWithAutofillUIType:(AutofillUIType)autofillUIType | 42 - (instancetype)initWithAutofillUIType:(AutofillUIType)autofillUIType |
| 43 fieldType:(EditorFieldType)fieldType |
32 label:(NSString*)label | 44 label:(NSString*)label |
33 value:(NSString*)value | 45 value:(NSString*)value |
34 required:(BOOL)required; | 46 required:(BOOL)required; |
35 | 47 |
36 @end | 48 @end |
37 | 49 |
38 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_EDITOR_FIELD_H_ | 50 #endif // IOS_CHROME_BROWSER_UI_PAYMENTS_PAYMENT_REQUEST_EDITOR_FIELD_H_ |
OLD | NEW |