sproutcore 1.7.1.beta → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +44 -0
- data/README.rdoc +20 -20
- data/VERSION.yml +3 -3
- data/lib/Buildfile +1 -1
- data/lib/buildtasks/build.rake +5 -0
- data/lib/buildtasks/manifest.rake +19 -1
- data/lib/frameworks/sproutcore/Buildfile +19 -17
- data/lib/frameworks/sproutcore/CHANGELOG.md +163 -29
- data/lib/frameworks/sproutcore/README.md +29 -8
- data/lib/frameworks/sproutcore/apps/statechart_routing/Buildfile +12 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/controllers/login_controller.js +11 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/controllers/main_controller.js +7 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/controllers/statechart_controller.js +17 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/core.js +25 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/main.js +15 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/_theme.css +18 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/bar_page.js +14 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/foo_page.js +14 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/loading.rhtml +9 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/login_page.js +61 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/main_page.js +46 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/statechart.js +76 -0
- data/lib/frameworks/sproutcore/apps/statechart_routing/theme.js +27 -0
- data/lib/frameworks/sproutcore/apps/tests/controllers/targets.js +1 -1
- data/lib/frameworks/sproutcore/apps/tests/states/no_targets.js +1 -1
- data/lib/frameworks/sproutcore/apps/tests/states/ready_detail.js +1 -1
- data/lib/frameworks/sproutcore/apps/tests/states/ready_empty.js +1 -1
- data/lib/frameworks/sproutcore/apps/tests/states/ready_list.js +1 -1
- data/lib/frameworks/sproutcore/apps/tests/states/ready_no_tests.js +1 -1
- data/lib/frameworks/sproutcore/apps/welcome/controllers/targets.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +14 -1
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +15 -15
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +8 -5
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +302 -70
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +19 -14
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +471 -149
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +42 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/run_loop.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/string.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/delegate_support.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/selection_support.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/body_overflow.js +63 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +37 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +28 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/sparse_array_delegate.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +66 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/cursor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +58 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js.orig +445 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +51 -31
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/ready.js +5 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +53 -69
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +98 -72
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +37 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +23 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/browser.js +66 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/event.js +22 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/locale.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/end.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/escape_html.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_className.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/update.js +17 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/selection_set/remove.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build_children.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/class_name_bindings_test.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createChildViews.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +50 -30
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/acceleration.js +46 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +1 -43
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +8 -34
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +10 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +6 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +22 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +46 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +23 -9
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +294 -302
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js.orig +1531 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +14 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/many_array.js +63 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +50 -10
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/destroy.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +114 -67
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/compare.js +54 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +29 -9
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/parse.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +37 -45
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +127 -127
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +16 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +42 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +13 -7
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/resources/strings.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/debug/core.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +1 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +19 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +30 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +24 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +121 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +15 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +39 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/popup_button.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -51
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +11 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +0 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +9 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/content.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/reload.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +107 -81
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +68 -60
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +57 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/integration.js +21 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroller.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +32 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +0 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +77 -132
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +5 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +16 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +52 -52
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +147 -147
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +11 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +22 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +13 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +462 -441
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +48 -62
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +22 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +150 -32
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +104 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +42 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +148 -154
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +8 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/files.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/library.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/targets.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/controllers/view_configs.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/mixins/drop_down.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/states/ready.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/plist_item.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/apps/greenhouse/views/web.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/controllers/page_design.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/css/css_style_sheet.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/object_designer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/mixins/snap_lines.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/designer_drop_target.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/drawing.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/views/page_item_view.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +59 -53
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/menu/views/menu/scroll.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphism/simple.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/core_scroll.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/desktop/scroll.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/views/touch/scroll.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +14 -10
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +17 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +38 -14
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +5 -13
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/children.js +19 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/methods.js +20 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/split_thumb.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +35 -12
- data/lib/frameworks/sproutcore/frameworks/formatters/README +6 -0
- data/lib/frameworks/sproutcore/frameworks/formatters/english.lproj/strings.js +174 -0
- data/lib/frameworks/sproutcore/frameworks/formatters/formatters/date_formatter.js +351 -0
- data/lib/frameworks/sproutcore/frameworks/formatters/tests/date_formatter.js +517 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +345 -138
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +5 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +176 -42
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +137 -105
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gestureable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +16 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/validatable.js +47 -47
- data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +28 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/benchmark.css +0 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/bootstrap.rhtml +34 -19
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +1 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +8 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +179 -47
- data/lib/frameworks/sproutcore/frameworks/foundation/system/task_queue.js +34 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +26 -12
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +12 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_metric_optimization.js +202 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_value_support/content.js +77 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editable/beginEditing.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editable/commitEditing.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editable/discardEditing.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editor/beginEditing.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editor/commitEditing.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_editor/discardEditing.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/pointInElement.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +0 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +163 -149
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/password.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +16 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +67 -54
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +49 -38
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +285 -242
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffer.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffered.js +19 -22
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-sc.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery.js +231 -186
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +145 -143
- data/lib/frameworks/sproutcore/frameworks/media/views/video.js +156 -154
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js.orig +540 -0
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -8
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +12 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +98 -32
- data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +7 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +98 -13
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +8 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +23 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +69 -18
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +57 -31
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +189 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +82 -22
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +125 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js +37 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +16 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +75 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/string.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/mixins/statechart_delegate.js +113 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/private/state_path_matcher.js +312 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +18 -22
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +508 -131
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state_route_handler_context.js +78 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +265 -44
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +16 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/responder/responder_chain.js +11 -3
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/private/state_path_matcher.js +116 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/add_substate.js +108 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/find_first_relative_current_state/with_concurrent.js +179 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/find_first_relative_current_state/without_concurrent.js +74 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/get_state.js +141 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/get_substate.js +340 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/route_triggered.js +161 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state/methods/try_to_handle_event.js +288 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/history_state/standard/without_concurrent_states/context.js +5 -33
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/routing/with_concurrent_states/basic.js +213 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/routing/without_concurrent_states/basic.js +212 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/without_concurrent_states/core.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/{state/namespacing.js → statechart/methods/get_state.js} +3 -41
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/statechart/{invoke_state_method.js → methods/invoke_state_method.js} +1 -1
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/{event_handling/advanced → statechart}/respond_to_event.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/system/state_route_handler_context/methods/retry.js +64 -0
- data/lib/frameworks/sproutcore/frameworks/table/core.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/controls/button.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars.js +29 -5
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/bind.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/collection.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/localization.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/ext/handlebars/view.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{handlebars → template_view}/handlebars.js +493 -357
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/mixins/template_helpers/checkbox_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/mixins/template_helpers/text_field_support.js +13 -2
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/panes/template.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/controls/button.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/mixins/template_helpers/checkbox_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/mixins/template_helpers/text_field_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/panes/template.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/views/template/collection.js +39 -14
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/views/template/core.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/tests/views/template/handlebars.js +57 -6
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/views/bindable_span.js +21 -6
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/views/template.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/{core_foundation → template_view}/views/template_collection.js +55 -26
- data/lib/frameworks/sproutcore/frameworks/testing/system/equiv.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +122 -122
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/testing/system/suite.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +0 -1
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +4 -4
- data/lib/frameworks/sproutcore/lib/index.rhtml +55 -32
- data/lib/frameworks/sproutcore/license.js +2 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/body.css +5 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/18px/button.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/24px/button.css +21 -13
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/30px/button.css +17 -10
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/button.css +4 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/24px/button.css +20 -12
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/30px/button.css +16 -8
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/jumbo/button.css +17 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/dark/small/button.css +17 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/disclosure/ace/disclosure.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/master-detail/master-detail.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/popover.css +5 -3
- data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/core.css +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/english.lproj/toolbar.css +1 -1
- data/lib/gen/app/USAGE +17 -4
- data/lib/gen/language/Buildfile +4 -4
- data/lib/gen/language/USAGE +4 -4
- data/lib/gen/page/templates/pages/@target_name@/Buildfile +7 -7
- data/lib/gen/{html_app → statechart_app}/Buildfile +0 -0
- data/lib/gen/{html_app → statechart_app}/README +0 -0
- data/lib/gen/statechart_app/USAGE +21 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/Buildfile +9 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/core.js +24 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/main.js +26 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/resources/_theme.css +18 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/resources/loading.rhtml +9 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/resources/main_page.js +21 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/statechart.js +8 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/states/ready_state.js +12 -0
- data/lib/gen/statechart_app/templates/apps/@target_name@/theme.js +24 -0
- data/lib/sproutcore/builders.rb +1 -0
- data/lib/sproutcore/builders/base.rb +19 -1
- data/lib/sproutcore/builders/chance_file.rb +6 -1
- data/lib/sproutcore/builders/handlebars.rb +1 -9
- data/lib/sproutcore/builders/javascript.rb +1 -10
- data/lib/sproutcore/builders/json.rb +25 -0
- data/lib/sproutcore/builders/less.rb +1 -1
- data/lib/sproutcore/builders/sass.rb +1 -1
- data/lib/sproutcore/builders/stylesheet.rb +1 -9
- data/lib/sproutcore/helpers/html5_manifest.rb +1 -1
- data/lib/sproutcore/helpers/static_helper.rb +42 -0
- data/lib/sproutcore/rack/proxy.rb +21 -3
- data/lib/sproutcore/rack/service.rb +3 -2
- data/lib/sproutcore/tools.rb +18 -25
- data/lib/sproutcore/tools/gen.rb +10 -3
- data/lib/sproutcore/tools/init.rb +11 -10
- data/spec/buildtasks/manifest/prepare_build_tasks/json_spec.rb +62 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -1
- data/spec/fixtures/builder_tests/apps/json_test/sc_static.json +2 -0
- data/spec/lib/builders/json_spec.rb +53 -0
- data/sproutcore.gemspec +2 -2
- data/vendor/chance/lib/chance/parser.rb +1 -1
- metadata +222 -177
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +0 -259
- data/lib/frameworks/sproutcore/frameworks/documentation/core.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +0 -69
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/editable/ui.js +0 -44
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/ui.js +0 -64
- data/lib/frameworks/sproutcore/frameworks/mini/license.js +0 -30
- data/lib/gen/html_app/USAGE +0 -15
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +0 -11
- data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -6
- data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +0 -1
- data/lib/gen/html_project/Buildfile +0 -45
- data/lib/gen/html_project/INIT +0 -3
- data/lib/gen/html_project/README +0 -1
- data/lib/gen/html_project/USAGE +0 -2
- data/lib/gen/html_project/templates/@filename@/Buildfile +0 -5
- data/lib/gen/html_project/templates/@filename@/README +0 -4
|
@@ -13,12 +13,12 @@ SC.REGULAR_WEIGHT = 'normal';
|
|
|
13
13
|
SC.BOLD_WEIGHT = 'bold';
|
|
14
14
|
/**
|
|
15
15
|
@class
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
Displays a static string of text.
|
|
18
|
-
|
|
19
|
-
You use a label view anytime you need to display a static string of text
|
|
18
|
+
|
|
19
|
+
You use a label view anytime you need to display a static string of text
|
|
20
20
|
or to display text that may need to be edited using only an inline control.
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
@extends SC.View
|
|
23
23
|
@extends SC.Control
|
|
24
24
|
@extends SC.InlineEditable
|
|
@@ -30,7 +30,7 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
|
|
|
30
30
|
|
|
31
31
|
classNames: ['sc-label-view'],
|
|
32
32
|
|
|
33
|
-
displayProperties: ['displayTitle', 'textAlign', 'fontWeight', 'icon', 'escapeHTML', 'needsEllipsis', 'hint'],
|
|
33
|
+
displayProperties: ['displayTitle', 'textAlign', 'fontWeight', 'icon', 'escapeHTML', 'needsEllipsis', 'hint', 'toolTip'],
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
The delegate that gets notified of events related to the editing process. Set
|
|
@@ -42,30 +42,30 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
|
|
|
42
42
|
inlineEditorDelegate: SC.InlineTextFieldDelegate,
|
|
43
43
|
|
|
44
44
|
isEditable: NO,
|
|
45
|
-
|
|
45
|
+
|
|
46
46
|
/**
|
|
47
|
-
The exampleInlineTextFieldView property is by default a
|
|
47
|
+
The exampleInlineTextFieldView property is by default a
|
|
48
48
|
SC.InlineTextFieldView but it can be set to a customized inline text field
|
|
49
49
|
view.
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
@property
|
|
52
52
|
@type {SC.View}
|
|
53
53
|
@default {SC.InlineTextFieldView}
|
|
54
54
|
*/
|
|
55
55
|
exampleEditor: SC.InlineTextFieldView,
|
|
56
|
-
|
|
56
|
+
|
|
57
57
|
/**
|
|
58
58
|
Specify the font weight for this. You may pass SC.REGULAR_WEIGHT, or SC.BOLD_WEIGHT.
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
@property {String} SC.REGULAR_WEIGHT|SC.BOLD_WEIGHT
|
|
61
61
|
@default null
|
|
62
62
|
@deprecated Use CSS instead.
|
|
63
63
|
*/
|
|
64
64
|
fontWeight: null,
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
/**
|
|
67
67
|
If true, value will be escaped to avoid scripting attacks.
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
This is a default value that can be overridden by the
|
|
70
70
|
settings on the owner view.
|
|
71
71
|
*/
|
|
@@ -78,40 +78,51 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
|
|
|
78
78
|
*/
|
|
79
79
|
localize: NO,
|
|
80
80
|
localizeBindingDefault: SC.Binding.oneWay().bool(),
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
/**
|
|
83
83
|
Set this to a validator or to a function and the value
|
|
84
84
|
will be passed through it before being set.
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
This is a default default that can be overidden by the
|
|
87
87
|
settings in the owner view.
|
|
88
88
|
*/
|
|
89
89
|
formatter: null,
|
|
90
90
|
|
|
91
|
-
/**
|
|
91
|
+
/**
|
|
92
92
|
The value of the label.
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
You may also set the value using a content object and a contentValueKey.
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
@field {String}
|
|
97
97
|
*/
|
|
98
98
|
value: '',
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
/**
|
|
101
101
|
The hint to display if no value is set. Should be used only if isEditable
|
|
102
102
|
is set to YES.
|
|
103
103
|
*/
|
|
104
104
|
hint: null,
|
|
105
105
|
|
|
106
|
+
/*
|
|
107
|
+
Whether hint should be shown or not. By default this is tied to isEditable
|
|
108
|
+
so the hint will only show if isEditable is YES.
|
|
109
|
+
|
|
110
|
+
@type Boolean
|
|
111
|
+
@property
|
|
112
|
+
*/
|
|
113
|
+
hintEnabled: function() {
|
|
114
|
+
return this.get('isEditable');
|
|
115
|
+
}.property('isEditable').cacheable(),
|
|
116
|
+
|
|
106
117
|
/**
|
|
107
118
|
An optional icon to display to the left of the label. Set this value
|
|
108
119
|
to either a CSS class name (for spriting) or an image URL.
|
|
109
120
|
*/
|
|
110
121
|
icon: null,
|
|
111
|
-
|
|
122
|
+
|
|
112
123
|
/**
|
|
113
124
|
Set the alignment of the label view.
|
|
114
|
-
|
|
125
|
+
|
|
115
126
|
@property {String} SC.ALIGN_LEFT|SC.ALIGN_CENTER|SC.ALIGN_RIGHT
|
|
116
127
|
@default null
|
|
117
128
|
@deprecated Use CSS instead.
|
|
@@ -139,26 +150,26 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
|
|
|
139
150
|
|
|
140
151
|
/**
|
|
141
152
|
[RO] The value that will actually be displayed.
|
|
142
|
-
|
|
143
|
-
This property is dynamically computed by applying localization,
|
|
153
|
+
|
|
154
|
+
This property is dynamically computed by applying localization,
|
|
144
155
|
string conversion and other normalization utilities.
|
|
145
|
-
|
|
156
|
+
|
|
146
157
|
@field
|
|
147
158
|
*/
|
|
148
159
|
displayTitle: function() {
|
|
149
160
|
var value, formatter;
|
|
150
|
-
|
|
161
|
+
|
|
151
162
|
value = this.get('value') ;
|
|
152
|
-
|
|
163
|
+
|
|
153
164
|
// 1. apply the formatter
|
|
154
165
|
formatter = this.getDelegateProperty('formatter', this.displayDelegate) ;
|
|
155
166
|
if (formatter) {
|
|
156
|
-
var formattedValue = (SC.typeOf(formatter) === SC.T_FUNCTION) ?
|
|
167
|
+
var formattedValue = (SC.typeOf(formatter) === SC.T_FUNCTION) ?
|
|
157
168
|
formatter(value, this) : formatter.fieldValueForObject(value, this) ;
|
|
158
169
|
if (!SC.none(formattedValue)) value = formattedValue ;
|
|
159
170
|
}
|
|
160
|
-
|
|
161
|
-
// 2. If the returned value is an array, convert items to strings and
|
|
171
|
+
|
|
172
|
+
// 2. If the returned value is an array, convert items to strings and
|
|
162
173
|
// join with commas.
|
|
163
174
|
if (SC.typeOf(value) === SC.T_ARRAY) {
|
|
164
175
|
var ary = [];
|
|
@@ -169,35 +180,35 @@ SC.LabelView = SC.View.extend(SC.Control, SC.InlineEditable,
|
|
|
169
180
|
}
|
|
170
181
|
value = ary.join(',') ;
|
|
171
182
|
}
|
|
172
|
-
|
|
183
|
+
|
|
173
184
|
// 3. If value is not a string, convert to string. (handles 0)
|
|
174
185
|
if (!SC.none(value) && value.toString) value = value.toString() ;
|
|
175
|
-
|
|
186
|
+
|
|
176
187
|
// 4. Localize
|
|
177
188
|
if (value && this.getDelegateProperty('localize', this.displayDelegate)) value = SC.String.loc(value) ;
|
|
178
|
-
|
|
189
|
+
|
|
179
190
|
return value ;
|
|
180
191
|
}.property('value', 'localize', 'formatter').cacheable(),
|
|
181
|
-
|
|
182
|
-
|
|
192
|
+
|
|
193
|
+
|
|
183
194
|
/**
|
|
184
195
|
[RO] The hint value that will actually be displayed.
|
|
185
|
-
|
|
186
|
-
This property is dynamically computed by applying localization
|
|
196
|
+
|
|
197
|
+
This property is dynamically computed by applying localization
|
|
187
198
|
and other normalization utilities.
|
|
188
|
-
|
|
199
|
+
|
|
189
200
|
*/
|
|
190
201
|
hintValue: function() {
|
|
191
202
|
var hintVal = this.get('hint');
|
|
192
203
|
return hintVal ;
|
|
193
204
|
}.property('hint').cacheable(),
|
|
194
|
-
|
|
205
|
+
|
|
195
206
|
/**
|
|
196
207
|
Event dispatcher callback.
|
|
197
208
|
If isEditable is set to true, opens the inline text editor view.
|
|
198
209
|
|
|
199
210
|
@param {DOMMouseEvent} evt DOM event
|
|
200
|
-
|
|
211
|
+
|
|
201
212
|
*/
|
|
202
213
|
doubleClick: function( evt ) { return this.beginEditing(); },
|
|
203
214
|
|
|
@@ -23,18 +23,9 @@ sc_require('mixins/editable');
|
|
|
23
23
|
SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
24
24
|
/** @scope SC.TextFieldView.prototype */ {
|
|
25
25
|
|
|
26
|
-
tagName: 'label',
|
|
27
26
|
classNames: ['sc-text-field-view'],
|
|
28
27
|
isTextField: YES,
|
|
29
28
|
|
|
30
|
-
/**
|
|
31
|
-
The WAI-ARIA role for text field view. This property's value should not be
|
|
32
|
-
changed.
|
|
33
|
-
|
|
34
|
-
@property {String}
|
|
35
|
-
*/
|
|
36
|
-
ariaRole: 'textbox',
|
|
37
|
-
|
|
38
29
|
// ..........................................................
|
|
39
30
|
// PROPERTIES
|
|
40
31
|
//
|
|
@@ -42,7 +33,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
42
33
|
/**
|
|
43
34
|
When applyImmediately is turned on, every keystroke will set the value
|
|
44
35
|
of the underlying object. Turning it off will only set the value on blur.
|
|
45
|
-
|
|
36
|
+
|
|
46
37
|
@type String
|
|
47
38
|
@default YES
|
|
48
39
|
*/
|
|
@@ -58,7 +49,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
58
49
|
|
|
59
50
|
/**
|
|
60
51
|
If YES, the field will hide its text from display. The default value is NO.
|
|
61
|
-
|
|
52
|
+
|
|
62
53
|
@property
|
|
63
54
|
@type Boolean
|
|
64
55
|
*/
|
|
@@ -68,7 +59,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
68
59
|
If YES then allow multi-line input. This will also change the default
|
|
69
60
|
tag type from "input" to "textarea". Otherwise, pressing return will
|
|
70
61
|
trigger the default insertion handler.
|
|
71
|
-
|
|
62
|
+
|
|
72
63
|
@property
|
|
73
64
|
@type Boolean
|
|
74
65
|
*/
|
|
@@ -76,46 +67,86 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
76
67
|
|
|
77
68
|
/**
|
|
78
69
|
The hint to display while the field is not active.
|
|
79
|
-
|
|
70
|
+
|
|
80
71
|
@property
|
|
81
72
|
@type String
|
|
82
73
|
*/
|
|
83
74
|
hint: '',
|
|
84
75
|
|
|
76
|
+
/**
|
|
77
|
+
The hint to display while the field is not active.
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
@type String
|
|
81
|
+
*/
|
|
82
|
+
type: 'text',
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
This property will set a tabindex="-1" on your view if set to NO.
|
|
86
|
+
|
|
87
|
+
This gives us control over the native tabbing behavior. When nextValidKeyView
|
|
88
|
+
reaches the end of the views in the pane views tree, it won't go to a textfield
|
|
89
|
+
that can accept the default tabbing behavior in any other pane. This was a
|
|
90
|
+
problem when you had an alert on top of a mainPane with textfields.
|
|
91
|
+
|
|
92
|
+
Modal panes set this to NO on all textfields that don't belong to itself.
|
|
93
|
+
@property {Boolean}
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
isBrowserFocusable: YES,
|
|
97
|
+
|
|
98
|
+
autoCorrect: true,
|
|
99
|
+
autoCapitalize: true,
|
|
100
|
+
|
|
101
|
+
|
|
85
102
|
/*
|
|
86
|
-
|
|
103
|
+
Localizes the hint if necessary.
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
@type String
|
|
87
107
|
*/
|
|
88
108
|
formattedHint: function() {
|
|
89
109
|
var hint = this.get('hint');
|
|
90
|
-
|
|
91
110
|
return typeof(hint) === 'string' && this.get('localize') ? SC.String.loc(hint) : hint;
|
|
92
111
|
}.property('hint', 'localize').cacheable(),
|
|
93
112
|
|
|
113
|
+
/**
|
|
114
|
+
Whether to show the hint while the field has focus. If YES, it will disappear
|
|
115
|
+
as soon as any character is in the field.
|
|
116
|
+
|
|
117
|
+
@property
|
|
118
|
+
@type Boolean
|
|
119
|
+
*/
|
|
120
|
+
hintOnFocus: YES,
|
|
121
|
+
|
|
94
122
|
/*
|
|
95
|
-
|
|
123
|
+
Whether the hint should be localized or not.
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
@type Boolean
|
|
96
127
|
*/
|
|
97
128
|
localize: YES,
|
|
98
129
|
|
|
99
130
|
/**
|
|
100
131
|
If YES then the text field is currently editing.
|
|
101
|
-
|
|
132
|
+
|
|
102
133
|
@property
|
|
103
134
|
@type Boolean
|
|
104
135
|
*/
|
|
105
136
|
isEditing: NO,
|
|
106
|
-
|
|
137
|
+
|
|
107
138
|
/**
|
|
108
|
-
If you set this property to false the tab key won't trigger its default
|
|
139
|
+
If you set this property to false the tab key won't trigger its default
|
|
109
140
|
behavior (tabbing to the next field).
|
|
110
|
-
|
|
141
|
+
|
|
111
142
|
@property
|
|
112
143
|
@type Boolean
|
|
113
144
|
*/
|
|
114
145
|
defaultTabbingEnabled: YES,
|
|
115
|
-
|
|
146
|
+
|
|
116
147
|
/**
|
|
117
148
|
Enabled context menu for textfields.
|
|
118
|
-
|
|
149
|
+
|
|
119
150
|
@property
|
|
120
151
|
@type Boolean
|
|
121
152
|
*/
|
|
@@ -128,7 +159,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
128
159
|
If false, 'value' is only updated when commitEditing() is called (this
|
|
129
160
|
is called automatically when the text field loses focus), or whenever
|
|
130
161
|
the return key is pressed while editing the field.
|
|
131
|
-
|
|
162
|
+
|
|
132
163
|
@type Boolean
|
|
133
164
|
@default null
|
|
134
165
|
*/
|
|
@@ -138,7 +169,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
138
169
|
If no, will not allow transform or validation errors (SC.Error objects)
|
|
139
170
|
to be passed to 'value'. Upon focus lost, the text field will revert
|
|
140
171
|
to its previous value.
|
|
141
|
-
|
|
172
|
+
|
|
142
173
|
@property
|
|
143
174
|
@type Boolean
|
|
144
175
|
*/
|
|
@@ -163,7 +194,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
163
194
|
defined on the "padding" element. If you would like to customize the
|
|
164
195
|
amount of left padding used when the accessory view is visible, make the
|
|
165
196
|
accessory view wider, with empty space on the right.
|
|
166
|
-
|
|
197
|
+
|
|
167
198
|
@property
|
|
168
199
|
@type SC.View
|
|
169
200
|
*/
|
|
@@ -189,32 +220,32 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
189
220
|
defined on the "padding" element. If you would like to customize the
|
|
190
221
|
amount of right padding used when the accessory view is visible, make the
|
|
191
222
|
accessory view wider, with empty space on the left.
|
|
192
|
-
|
|
223
|
+
|
|
193
224
|
@property
|
|
194
225
|
@type SC.View
|
|
195
226
|
*/
|
|
196
227
|
rightAccessoryView: null,
|
|
197
|
-
|
|
228
|
+
|
|
198
229
|
/**
|
|
199
|
-
This property will enable disable HTML5 spell checking if available on the
|
|
230
|
+
This property will enable disable HTML5 spell checking if available on the
|
|
200
231
|
browser. As of today Safari 4+, Chrome 3+ and Firefox 3+ support it
|
|
201
|
-
|
|
232
|
+
|
|
202
233
|
@property
|
|
203
234
|
@type Boolean
|
|
204
235
|
*/
|
|
205
236
|
spellCheckEnabled: YES,
|
|
206
|
-
|
|
237
|
+
|
|
207
238
|
/**
|
|
208
239
|
Maximum amount of characters this field will allow.
|
|
209
|
-
|
|
240
|
+
|
|
210
241
|
@property
|
|
211
242
|
@type Number
|
|
212
243
|
*/
|
|
213
244
|
maxLength: 5096,
|
|
214
|
-
|
|
245
|
+
|
|
215
246
|
/**
|
|
216
247
|
Whether to render a border or not.
|
|
217
|
-
|
|
248
|
+
|
|
218
249
|
@property
|
|
219
250
|
@type Boolean
|
|
220
251
|
*/
|
|
@@ -236,11 +267,11 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
236
267
|
Whether to show hint or not
|
|
237
268
|
*/
|
|
238
269
|
_hintON: YES,
|
|
239
|
-
|
|
270
|
+
|
|
240
271
|
init: function() {
|
|
241
272
|
var val = this.get('value');
|
|
242
|
-
this._hintON = (!val || val && val.length===0) ? YES : NO;
|
|
243
|
-
|
|
273
|
+
this._hintON = ((!val || val && val.length===0) && !this.get('hintOnFocus')) ? YES : NO;
|
|
274
|
+
|
|
244
275
|
var continuouslyUpdatesValue = this.get('continouslyUpdatesValue');
|
|
245
276
|
if (continuouslyUpdatesValue !== null && continuouslyUpdatesValue !== undefined) {
|
|
246
277
|
this.set('applyImmediately', continuouslyUpdatesValue);
|
|
@@ -249,16 +280,16 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
249
280
|
SC.Logger.warn("SC.TextFieldView#continuouslyUpdatesValue is deprecated. Please use #applyImmediately instead.");
|
|
250
281
|
// @endif
|
|
251
282
|
}
|
|
252
|
-
|
|
283
|
+
|
|
253
284
|
return sc_super();
|
|
254
285
|
},
|
|
255
286
|
|
|
256
|
-
/**
|
|
287
|
+
/**
|
|
257
288
|
This property indicates if the value in the text field can be changed.
|
|
258
289
|
If set to NO, a readOnly attribute will be added to the DOM Element.
|
|
259
|
-
|
|
290
|
+
|
|
260
291
|
Note if isEnabled is NO this property will have no effect.
|
|
261
|
-
|
|
292
|
+
|
|
262
293
|
@property
|
|
263
294
|
@type Boolean
|
|
264
295
|
*/
|
|
@@ -298,7 +329,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
298
329
|
end = element.selectionEnd ;
|
|
299
330
|
}
|
|
300
331
|
}
|
|
301
|
-
// In Firefox when you ask the selectionStart or End of a hidden
|
|
332
|
+
// In Firefox when you ask the selectionStart or End of a hidden
|
|
302
333
|
// input, sometimes it throws a weird error.
|
|
303
334
|
// Adding this to just ignore it.
|
|
304
335
|
catch (e){
|
|
@@ -375,7 +406,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
375
406
|
// INTERNAL SUPPORT
|
|
376
407
|
//
|
|
377
408
|
|
|
378
|
-
displayProperties: ['formattedHint', 'fieldValue', 'isEditing', 'isEditable', 'leftAccessoryView', 'rightAccessoryView', 'isTextArea'],
|
|
409
|
+
displayProperties: ['isBrowserFocusable','formattedHint', 'fieldValue', 'isEditing', 'isEditable', 'leftAccessoryView', 'rightAccessoryView', 'isTextArea'],
|
|
379
410
|
|
|
380
411
|
createChildViews: function() {
|
|
381
412
|
sc_super();
|
|
@@ -389,9 +420,9 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
389
420
|
accessoryViewObserver: function() {
|
|
390
421
|
var classNames,
|
|
391
422
|
viewProperties = ['leftAccessoryView', 'rightAccessoryView'],
|
|
392
|
-
len = viewProperties.length , i, viewProperty, previousView,
|
|
423
|
+
len = viewProperties.length , i, viewProperty, previousView,
|
|
393
424
|
accessoryView;
|
|
394
|
-
|
|
425
|
+
|
|
395
426
|
for (i=0; i<len; i++) {
|
|
396
427
|
viewProperty = viewProperties[i] ;
|
|
397
428
|
|
|
@@ -401,9 +432,9 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
401
432
|
|
|
402
433
|
// If the view is the same, there's nothing to do. Otherwise, remove
|
|
403
434
|
// the old one (if any) and add the new one.
|
|
404
|
-
if (! (previousView
|
|
405
|
-
&&
|
|
406
|
-
|
|
435
|
+
if (! (previousView &&
|
|
436
|
+
accessoryView &&
|
|
437
|
+
(previousView === accessoryView) ) ) {
|
|
407
438
|
|
|
408
439
|
// If there was a previous previous accessory view, remove it now.
|
|
409
440
|
if (previousView) {
|
|
@@ -480,16 +511,6 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
480
511
|
// update layer classes always
|
|
481
512
|
context.setClass('not-empty', v.length > 0);
|
|
482
513
|
|
|
483
|
-
//addressing accessibility
|
|
484
|
-
if(firstTime) {
|
|
485
|
-
context.attr('aria-multiline', this.get('isTextArea'));
|
|
486
|
-
context.attr('aria-disabled', !this.get('isEnabled'));
|
|
487
|
-
context.attr('aria-readonly', this.get('isEnabled') && !this.get('isEditable'));
|
|
488
|
-
}
|
|
489
|
-
if(!SC.ok(this.get('value'))) {
|
|
490
|
-
context.attr('aria-invalid', YES);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
514
|
// If we have accessory views, we'll want to update the padding on the
|
|
494
515
|
// hint to compensate for the width of the accessory view. (It'd be nice
|
|
495
516
|
// if we could add in the original padding, too, but there's no efficient
|
|
@@ -502,47 +523,72 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
502
523
|
if (leftAdjustment) leftAdjustment += 'px' ;
|
|
503
524
|
if (rightAdjustment) rightAdjustment += 'px' ;
|
|
504
525
|
|
|
505
|
-
|
|
506
|
-
if(SC.browser.mozilla) this.invokeLast(this._applyFirefoxCursorFix);
|
|
526
|
+
this._renderField(context, firstTime, v, leftAdjustment, rightAdjustment);
|
|
507
527
|
},
|
|
508
528
|
|
|
509
529
|
/** @private
|
|
510
530
|
If isTextArea is changed (this might happen in inlineeditor constantly)
|
|
511
531
|
force the field render to render like the firsttime to avoid writing extra
|
|
512
|
-
code. This can be useful also
|
|
532
|
+
code. This can be useful also
|
|
513
533
|
*/
|
|
514
534
|
_forceRenderFirstTime: NO,
|
|
515
|
-
|
|
535
|
+
|
|
516
536
|
/** @private */
|
|
517
537
|
_renderFieldLikeFirstTime: function(){
|
|
518
538
|
this.set('_forceRenderFirstTime', YES);
|
|
519
539
|
}.observes('isTextArea'),
|
|
520
|
-
|
|
540
|
+
|
|
521
541
|
/** @private */
|
|
522
542
|
_renderField: function(context, firstTime, value, leftAdjustment, rightAdjustment) {
|
|
523
543
|
// TODO: The cleanest thing might be to create a sub- rendering context
|
|
524
544
|
// here, but currently SC.RenderContext will render sibling
|
|
525
545
|
// contexts as parent/child.
|
|
526
546
|
|
|
527
|
-
var hint = this.get('formattedHint'),
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
maxLength = this.get('maxLength'),
|
|
547
|
+
var hint = this.get('formattedHint'),
|
|
548
|
+
hintOnFocus = this.get('hintOnFocus'),
|
|
549
|
+
hintString = '',
|
|
550
|
+
maxLength = this.get('maxLength'),
|
|
551
|
+
isTextArea = this.get('isTextArea'),
|
|
552
|
+
isEnabled = this.get('isEnabled'),
|
|
553
|
+
isEditable = this.get('isEditable'),
|
|
554
|
+
autoCorrect = this.get('autoCorrect'),
|
|
555
|
+
autoCapitalize = this.get('autoCapitalize'),
|
|
556
|
+
isBrowserFocusable = this.get('isBrowserFocusable'),
|
|
557
|
+
spellCheckString='', autocapitalizeString='', autocorrectString='',
|
|
558
|
+
name, adjustmentStyle, type, hintElements, element, paddingElementStyle,
|
|
559
|
+
fieldClassNames, isOldSafari, activeState, browserFocusable;
|
|
560
|
+
|
|
561
|
+
context.setClass('text-area', isTextArea);
|
|
531
562
|
|
|
532
|
-
context.setClass('text-area', this.get('isTextArea'));
|
|
533
|
-
|
|
534
563
|
//Adding this to differentiate between older and newer versions of safari
|
|
535
|
-
//since the internal default field padding changed
|
|
536
|
-
isOldSafari= SC.browser.isWebkit &&
|
|
564
|
+
//since the internal default field padding changed
|
|
565
|
+
isOldSafari= SC.browser.isWebkit &&
|
|
566
|
+
SC.browser.compare(SC.browser.engineVersion, '532')<0;
|
|
537
567
|
context.setClass('oldWebKitFieldPadding', isOldSafari);
|
|
538
|
-
|
|
539
|
-
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
540
571
|
if (firstTime || this._forceRenderFirstTime) {
|
|
541
572
|
this._forceRenderFirstTime = NO;
|
|
542
|
-
activeState =
|
|
573
|
+
activeState = isEnabled ? (isEditable ? '' : 'readonly="readonly"') : 'disabled="disabled"' ;
|
|
543
574
|
name = this.get('layerId');
|
|
544
|
-
|
|
545
|
-
|
|
575
|
+
|
|
576
|
+
spellCheckString = this.get('spellCheckEnabled') ? ' spellcheck="true"' : ' spellcheck="false"';
|
|
577
|
+
|
|
578
|
+
if(SC.browser.mobileSafari){
|
|
579
|
+
autocorrectString = !autoCorrect ? ' autocorrect="off"' : '';
|
|
580
|
+
autocapitalizeString = !autoCapitalize ? ' autocapitalize="off"' : '';
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
if(isBrowserFocusable){
|
|
584
|
+
browserFocusable = 'tabindex="-1"';
|
|
585
|
+
}
|
|
586
|
+
// if hint is on and we don't want it to show on focus, create one
|
|
587
|
+
if(SC.platform.input.placeholder && !hintOnFocus) {
|
|
588
|
+
hintString = ' placeholder="' + hint + '"';
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
if(this.get('shouldRenderBorder')) context.push('<div class="border"></div>');
|
|
546
592
|
|
|
547
593
|
// Render the padding element, with any necessary positioning
|
|
548
594
|
// adjustments to accommodate accessory views.
|
|
@@ -553,77 +599,90 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
553
599
|
if (rightAdjustment) adjustmentStyle += 'right: ' + rightAdjustment + ';' ;
|
|
554
600
|
adjustmentStyle += '"' ;
|
|
555
601
|
}
|
|
556
|
-
context.push('<
|
|
557
|
-
|
|
602
|
+
context.push('<div class="padding" '+adjustmentStyle+'>');
|
|
603
|
+
|
|
558
604
|
value = this.get('escapeHTML') ? SC.RenderContext.escapeHTML(value) : value;
|
|
559
|
-
if(!SC.platform.input.placeholder && (!value || (value && value.length===0))) {
|
|
605
|
+
if(this._hintON && !SC.platform.input.placeholder && (!value || (value && value.length===0))) {
|
|
560
606
|
value = hint;
|
|
561
607
|
context.setClass('sc-hint', YES);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if(hintOnFocus) {
|
|
611
|
+
var hintStr = '<div aria-hidden="true" class="hint '+
|
|
612
|
+
(isTextArea ? '':'ellipsis')+'%@">'+ hint + '</div>';
|
|
613
|
+
context.push(hintStr.fmt(value ? ' sc-hidden': ''));
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
fieldClassNames = "field";
|
|
617
|
+
|
|
571
618
|
// Render the input/textarea field itself, and close off the padding.
|
|
572
|
-
if (
|
|
573
|
-
context.push('<textarea class="'
|
|
574
|
-
'" '
|
|
575
|
-
spellCheckString
|
|
576
|
-
|
|
619
|
+
if (isTextArea) {
|
|
620
|
+
context.push('<textarea aria-label="' + hint + '" aria-multiline="true" class="'+fieldClassNames+'" name="'+ name+
|
|
621
|
+
'" '+ activeState + hintString +
|
|
622
|
+
spellCheckString + autocorrectString + browserFocusable +
|
|
623
|
+
autocapitalizeString + ' maxlength="'+ maxLength+ '">'+
|
|
624
|
+
value+ '</textarea></div>') ;
|
|
577
625
|
}
|
|
578
626
|
else {
|
|
579
|
-
type = '
|
|
580
|
-
|
|
627
|
+
type = this.get('type');
|
|
628
|
+
|
|
581
629
|
// Internet Explorer won't let us change the type attribute later
|
|
582
630
|
// so we force it to password if needed now, or if the value is not the hint
|
|
583
|
-
if (this.get('isPassword')
|
|
584
|
-
|
|
585
|
-
context.push('<input class="',fieldClassNames,'" type="', type,
|
|
586
|
-
'" name="', name, '" ', activeState, ' value="', value,
|
|
587
|
-
'" placeholder="',hint,'"', spellCheckString,
|
|
588
|
-
' maxlength="', maxLength, '" /></span>') ;
|
|
589
|
-
}
|
|
631
|
+
if (this.get('isPassword')) { type = 'password'; }
|
|
590
632
|
|
|
633
|
+
context.push('<input aria-label="' + hint + '" class="'+fieldClassNames+'" type="'+ type+
|
|
634
|
+
'" name="'+ name + '" '+ activeState + ' value="'+ value + '"' +
|
|
635
|
+
hintString + spellCheckString+ browserFocusable +
|
|
636
|
+
' maxlength="'+ maxLength+ '" '+autocorrectString+' ' +
|
|
637
|
+
autocapitalizeString+'/></div>') ;
|
|
638
|
+
}
|
|
591
639
|
}
|
|
592
640
|
else {
|
|
593
641
|
var input= this.$input(),
|
|
594
642
|
elem = input[0],
|
|
595
643
|
val = this.get('value');
|
|
596
644
|
|
|
645
|
+
if(hintOnFocus) this.$('.hint')[0].innerHTML = hint;
|
|
646
|
+
else if(!hintOnFocus) elem.placeholder = hint;
|
|
647
|
+
|
|
597
648
|
if (!val || (val && val.length === 0)) {
|
|
598
|
-
if (this.
|
|
649
|
+
if (this.get('isPassword')) { elem.type = 'password'; }
|
|
650
|
+
|
|
651
|
+
if (!SC.platform.input.placeholder && this._hintON) {
|
|
652
|
+
if (!this.get('isFirstResponder')) {
|
|
599
653
|
// Internet Explorer doesn't allow you to modify the type afterwards
|
|
600
654
|
// jQuery throws an exception as well, so set attribute directly
|
|
601
|
-
if (this.get('isPassword') && elem.type === "password" && !SC.browser.isIE) { elem.type = 'text'; }
|
|
602
655
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
} else {
|
|
656
|
+
context.setClass('sc-hint', YES);
|
|
657
|
+
input.val(hint);
|
|
658
|
+
} else {
|
|
607
659
|
// Internet Explorer doesn't allow you to modify the type afterwards
|
|
608
660
|
// jQuery throws an exception as well, so set attribute directly
|
|
609
|
-
if (this.get('isPassword') && elem.type === 'text' && !SC.browser.isIE) { elem.type = 'password'; }
|
|
610
|
-
|
|
611
|
-
if (!SC.platform.input.placeholder) {
|
|
612
661
|
context.setClass('sc-hint', NO);
|
|
613
662
|
input.val('');
|
|
614
663
|
}
|
|
615
664
|
}
|
|
616
665
|
}
|
|
617
666
|
|
|
618
|
-
if
|
|
667
|
+
if(SC.browser.mobileSafari){
|
|
668
|
+
input.attr('autoCapitalize', !autoCapitalize ? 'off':'true');
|
|
669
|
+
input.attr('autoCorrect', !autoCorrect ? 'off':'true');
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
if (!hintOnFocus && SC.platform.input.placeholder) input.attr('placeholder', hint);
|
|
619
673
|
|
|
674
|
+
if(isBrowserFocusable){
|
|
675
|
+
input.removeAttr('tabindex');
|
|
676
|
+
}else{
|
|
677
|
+
input.attr('tabindex', '-1');
|
|
678
|
+
}
|
|
620
679
|
// Enable/disable the actual input/textarea as appropriate.
|
|
621
680
|
element = input[0];
|
|
622
681
|
if (element) {
|
|
623
|
-
if (!
|
|
682
|
+
if (!isEnabled) {
|
|
624
683
|
element.disabled = 'true' ;
|
|
625
684
|
element.readOnly = null ;
|
|
626
|
-
} else if(!
|
|
685
|
+
} else if(!isEditable) {
|
|
627
686
|
element.disabled = null ;
|
|
628
687
|
element.readOnly = 'true' ;
|
|
629
688
|
} else {
|
|
@@ -695,74 +754,75 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
695
754
|
//
|
|
696
755
|
|
|
697
756
|
didCreateLayer: function() {
|
|
698
|
-
sc_super();
|
|
757
|
+
sc_super();
|
|
758
|
+
if(!SC.platform.input.placeholder) this.invokeLast(this._setInitialPlaceHolderIE);
|
|
699
759
|
// For some strange reason if we add focus/blur events to textarea
|
|
700
760
|
// inmediately they won't work. However if I add them at the end of the
|
|
701
761
|
// runLoop it works fine.
|
|
702
|
-
if(!SC.platform.input.placeholder && this._hintON){
|
|
703
|
-
var currentValue = this.$input().val();
|
|
704
|
-
if(!currentValue || (currentValue && currentValue.length===0)){
|
|
705
|
-
this.$input().val(this.get('formattedHint'));
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
762
|
if(this.get('isTextArea')) {
|
|
709
763
|
this.invokeLast(this._addTextAreaEvents);
|
|
710
764
|
}
|
|
711
765
|
else {
|
|
712
766
|
this._addTextAreaEvents();
|
|
713
|
-
|
|
767
|
+
|
|
714
768
|
// In Firefox, for input fields only (that is, not textarea elements),
|
|
715
769
|
// if the cursor is at the end of the field, the "down" key will not
|
|
716
770
|
// result in a "keypress" event for the document (only for the input
|
|
717
771
|
// element), although it will be bubbled up in other contexts. Since
|
|
718
772
|
// SproutCore's event dispatching requires the document to see the
|
|
719
773
|
// event, we'll manually forward the event along.
|
|
720
|
-
if (SC.browser.
|
|
774
|
+
if (SC.browser.isMozilla) {
|
|
721
775
|
var input = this.$input();
|
|
722
776
|
SC.Event.add(input, 'keypress', this, this._firefox_dispatch_keypress);
|
|
723
777
|
}
|
|
724
778
|
}
|
|
725
779
|
},
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
780
|
+
|
|
781
|
+
/** @private
|
|
782
|
+
Set initial placeholder for IE
|
|
783
|
+
*/
|
|
784
|
+
_setInitialPlaceHolderIE: function() {
|
|
785
|
+
if(!SC.platform.input.placeholder && this._hintON){
|
|
786
|
+
var input = this.$input(),
|
|
787
|
+
currentValue = input.val();
|
|
788
|
+
if(!currentValue || (currentValue && currentValue.length===0)){
|
|
789
|
+
input.val(this.get('formattedHint'));
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
|
|
794
|
+
/** @private
|
|
729
795
|
Adds all the textarea events. This functions is called by didCreateLayer
|
|
730
|
-
at different moments depending if it is a textarea or not. Appending
|
|
731
|
-
events to text areas is not reliable unless the element is already added
|
|
796
|
+
at different moments depending if it is a textarea or not. Appending
|
|
797
|
+
events to text areas is not reliable unless the element is already added
|
|
732
798
|
to the DOM.
|
|
733
|
-
|
|
799
|
+
|
|
734
800
|
*/
|
|
735
801
|
_addTextAreaEvents: function() {
|
|
736
802
|
var input = this.$input();
|
|
737
803
|
SC.Event.add(input, 'focus', this, this._textField_fieldDidFocus);
|
|
738
804
|
SC.Event.add(input, 'blur', this, this._textField_fieldDidBlur);
|
|
739
|
-
|
|
805
|
+
|
|
740
806
|
// There are certain ways users can select text that we can't identify via
|
|
741
807
|
// our key/mouse down/up handlers (such as the user choosing Select All
|
|
742
808
|
// from a menu).
|
|
743
809
|
SC.Event.add(input, 'select', this, this._textField_selectionDidChange);
|
|
744
|
-
|
|
745
|
-
if(SC.browser.mozilla){
|
|
746
|
-
// cache references to layer items to improve firefox hack perf
|
|
747
|
-
this._cacheInputElement = this.$input();
|
|
748
|
-
this._cachePaddingElement = this.$('.padding');
|
|
749
|
-
}
|
|
750
810
|
},
|
|
751
811
|
|
|
752
812
|
/**
|
|
753
813
|
Removes all the events attached to the textfield
|
|
754
814
|
*/
|
|
755
|
-
|
|
815
|
+
|
|
756
816
|
willDestroyLayer: function() {
|
|
757
817
|
sc_super();
|
|
758
|
-
|
|
818
|
+
|
|
759
819
|
var input = this.$input();
|
|
760
820
|
SC.Event.remove(input, 'focus', this, this._textField_fieldDidFocus);
|
|
761
821
|
SC.Event.remove(input, 'blur', this, this._textField_fieldDidBlur);
|
|
762
822
|
SC.Event.remove(input, 'select', this, this._textField_selectionDidChange);
|
|
763
823
|
SC.Event.remove(input, 'keypress', this, this._firefox_dispatch_keypress);
|
|
764
824
|
},
|
|
765
|
-
|
|
825
|
+
|
|
766
826
|
/** @private
|
|
767
827
|
This function is called by the event when the textfield gets focus
|
|
768
828
|
*/
|
|
@@ -776,7 +836,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
776
836
|
}
|
|
777
837
|
}, this);
|
|
778
838
|
},
|
|
779
|
-
|
|
839
|
+
|
|
780
840
|
/** @private
|
|
781
841
|
This function is called by the event when the textfield blurs
|
|
782
842
|
*/
|
|
@@ -788,7 +848,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
788
848
|
// use it for the delegate to end editing
|
|
789
849
|
this.fieldDidBlur(this._origEvent || evt);
|
|
790
850
|
var val = this.get('value');
|
|
791
|
-
if(!SC.platform.input.placeholder && ((!val) || (val && val.length===0))) {
|
|
851
|
+
if(!SC.platform.input.placeholder && !this.get('hintOnFocus') && ((!val) || (val && val.length===0))) {
|
|
792
852
|
this._hintON = YES;
|
|
793
853
|
}
|
|
794
854
|
}, this);
|
|
@@ -798,30 +858,30 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
798
858
|
this.becomeFirstResponder();
|
|
799
859
|
|
|
800
860
|
this.beginEditing(evt);
|
|
801
|
-
|
|
802
|
-
// We have to hide the intercept pane, as it blocks the events.
|
|
861
|
+
|
|
862
|
+
// We have to hide the intercept pane, as it blocks the events.
|
|
803
863
|
// However, show any that we previously hid, first just in case something wacky happened.
|
|
804
864
|
if (this._didHideInterceptForPane) {
|
|
805
865
|
this._didHideInterceptForPane.showTouchIntercept();
|
|
806
866
|
this._didHideInterceptForPane = null;
|
|
807
867
|
}
|
|
808
|
-
|
|
868
|
+
|
|
809
869
|
// now, hide the intercept on this pane if it has one
|
|
810
870
|
var pane = this.get('pane');
|
|
811
871
|
if (pane && pane.get('hasTouchIntercept')) {
|
|
812
872
|
// hide
|
|
813
873
|
pane.hideTouchIntercept();
|
|
814
|
-
|
|
874
|
+
|
|
815
875
|
// and set our internal one so we can unhide it (even if the pane somehow changes)
|
|
816
876
|
this._didHideInterceptForPane = this.get("pane");
|
|
817
877
|
}
|
|
818
878
|
},
|
|
819
|
-
|
|
879
|
+
|
|
820
880
|
fieldDidBlur: function(evt) {
|
|
821
|
-
this.resignFirstResponder() ;
|
|
881
|
+
this.resignFirstResponder(evt) ;
|
|
822
882
|
|
|
823
883
|
if(this.get('commitOnBlur')) this.commitEditing(evt);
|
|
824
|
-
|
|
884
|
+
|
|
825
885
|
// get the pane we hid intercept pane for (if any)
|
|
826
886
|
var touchPane = this._didHideInterceptForPane;
|
|
827
887
|
if (touchPane) {
|
|
@@ -829,71 +889,38 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
829
889
|
touchPane = null;
|
|
830
890
|
}
|
|
831
891
|
},
|
|
832
|
-
|
|
892
|
+
|
|
893
|
+
/** @private */
|
|
833
894
|
_field_fieldValueDidChange: function(evt) {
|
|
834
895
|
if(this.get('focused')){
|
|
835
896
|
SC.run(function() {
|
|
836
|
-
this.fieldValueDidChange(NO);
|
|
897
|
+
this.fieldValueDidChange(NO);
|
|
837
898
|
}, this);
|
|
838
899
|
}
|
|
900
|
+
this.updateHintOnFocus();
|
|
839
901
|
},
|
|
840
902
|
|
|
841
903
|
/** @private
|
|
842
|
-
|
|
904
|
+
Make sure to update visibility of hint if it changes
|
|
843
905
|
*/
|
|
844
|
-
|
|
845
|
-
|
|
906
|
+
updateHintOnFocus: function() {
|
|
907
|
+
// if there is a value in the field, hide the hint
|
|
908
|
+
var hintOnFocus = this.get('hintOnFocus');
|
|
909
|
+
if(!hintOnFocus) return;
|
|
910
|
+
|
|
911
|
+
if(this.getFieldValue()) {
|
|
912
|
+
this.$('.hint').addClass('sc-hidden');
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
this.$('.hint').removeClass('sc-hidden');
|
|
916
|
+
}
|
|
917
|
+
}.observes('value'),
|
|
918
|
+
|
|
846
919
|
/** @private
|
|
847
|
-
|
|
848
|
-
and textareas and now they work better. But we have to keep this for older
|
|
849
|
-
versions.
|
|
920
|
+
Move magic number out so it can be over-written later in inline editor
|
|
850
921
|
*/
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
// Contact me if you need to change or improve the code. After several
|
|
854
|
-
// iterations the new way to apply the fix seems to be the most
|
|
855
|
-
// consistent.
|
|
856
|
-
// This fixes: selection visibility, cursor visibility, and the ability
|
|
857
|
-
// to fix the cursor at any position. As of FF 3.5.3 mozilla hasn't fixed this
|
|
858
|
-
// bug, even though related bugs that I've found on their database appear
|
|
859
|
-
// as fixed.
|
|
860
|
-
|
|
861
|
-
// UPDATE: Things seem to be working on FF3.6 therefore we are disabling the
|
|
862
|
-
// hack for the latest versions of FF.
|
|
863
|
-
//
|
|
864
|
-
// Juan Pinzon
|
|
865
|
-
|
|
866
|
-
if (parseFloat(SC.browser.mozilla)<1.9 && !this.get('useStaticLayout')) {
|
|
867
|
-
var top, left, width, height, p, layer, element, textfield;
|
|
868
|
-
|
|
869
|
-
// I'm caching in didCreateLayer this elements to improve perf
|
|
870
|
-
element = this._cacheInputElement;
|
|
871
|
-
textfield = this._cachePaddingElement;
|
|
872
|
-
if(textfield && textfield[0]){
|
|
873
|
-
layer = textfield[0];
|
|
874
|
-
p = SC.$(layer).offset() ;
|
|
875
|
-
|
|
876
|
-
// this is to take into account an styling issue.
|
|
877
|
-
// this is counterproductive in FF >= 3.6
|
|
878
|
-
if(SC.browser.compareVersion(1,9,2) < 0 &&
|
|
879
|
-
element[0].tagName.toLowerCase()==="input") {
|
|
880
|
-
top = p.top+this._topOffsetForFirefoxCursorFix;
|
|
881
|
-
}
|
|
882
|
-
else top = p.top;
|
|
883
|
-
left = p.left;
|
|
884
|
-
width = layer.offsetWidth;
|
|
885
|
-
height = layer.offsetHeight ;
|
|
886
|
-
|
|
887
|
-
var style = 'position: fixed; top: %@px; left: %@px; width: %@px; height: %@px;'.fmt(top, left, width, height) ;
|
|
888
|
-
// if the style is the same don't re-apply
|
|
889
|
-
if(!this._prevStyle || this._prevStyle!=style) element.attr('style', style) ;
|
|
890
|
-
this._prevStyle = style;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
return this ;
|
|
894
|
-
},
|
|
895
|
-
|
|
896
|
-
|
|
922
|
+
_topOffsetForFirefoxCursorFix: 3,
|
|
923
|
+
|
|
897
924
|
/** @private
|
|
898
925
|
In Firefox, as of 3.6 -- including 3.0 and 3.5 -- for input fields only
|
|
899
926
|
(that is, not textarea elements), if the cursor is at the end of the
|
|
@@ -907,7 +934,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
907
934
|
value = this.get('value'),
|
|
908
935
|
valueLen = value ? value.length : 0,
|
|
909
936
|
responder;
|
|
910
|
-
|
|
937
|
+
|
|
911
938
|
if (!selection || ((selection.get('length') === 0 && (selection.get('start') === 0) || selection.get('end') === valueLen))) {
|
|
912
939
|
responder = SC.RootResponder.responder;
|
|
913
940
|
if(evt.keyCode===9) return;
|
|
@@ -915,7 +942,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
915
942
|
evt.stopPropagation();
|
|
916
943
|
}
|
|
917
944
|
},
|
|
918
|
-
|
|
945
|
+
|
|
919
946
|
/** @private */
|
|
920
947
|
_textField_selectionDidChange: function() {
|
|
921
948
|
this.notifyPropertyChange('selection');
|
|
@@ -934,58 +961,60 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
934
961
|
didBecomeKeyResponderFrom: function(keyView) {
|
|
935
962
|
if(this.get('isVisibleInWindow')) {
|
|
936
963
|
var inp = this.$input()[0];
|
|
937
|
-
try{
|
|
938
|
-
if(inp) inp.focus();
|
|
939
|
-
}
|
|
964
|
+
try{
|
|
965
|
+
if(inp) inp.focus();
|
|
966
|
+
}
|
|
940
967
|
catch(e){}
|
|
941
968
|
if(!this._txtFieldMouseDown){
|
|
942
969
|
this.invokeLast(this._selectRootElement) ;
|
|
943
970
|
}
|
|
944
971
|
}
|
|
945
972
|
},
|
|
946
|
-
|
|
973
|
+
|
|
947
974
|
/** @private
|
|
948
975
|
In IE, you can't modify functions on DOM elements so we need to wrap the
|
|
949
976
|
call to select() like this.
|
|
950
977
|
*/
|
|
951
978
|
_selectRootElement: function() {
|
|
952
|
-
var inputElem = this.$input()[0]
|
|
979
|
+
var inputElem = this.$input()[0],
|
|
980
|
+
isLion;
|
|
953
981
|
// Make sure input element still exists, as a redraw could have remove it
|
|
954
982
|
// already.
|
|
955
|
-
if(inputElem)
|
|
983
|
+
if(inputElem){
|
|
984
|
+
// Determine if the OS is OS 10.7 "Lion"
|
|
985
|
+
isLion = SC.browser.os === SC.OS.mac &&
|
|
986
|
+
SC.browser.compare(SC.browser.osVersion, '10.7') === 0;
|
|
987
|
+
|
|
988
|
+
if(!(SC.browser.name === SC.BROWSER.safari &&
|
|
989
|
+
isLion && SC.buildLocale==='ko-kr')) {
|
|
990
|
+
inputElem.select() ;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
956
993
|
else this._textField_selectionDidChange();
|
|
957
994
|
},
|
|
958
|
-
|
|
959
|
-
/** @private
|
|
995
|
+
|
|
996
|
+
/** @private
|
|
960
997
|
When we lose first responder, blur the text field if needed and show
|
|
961
998
|
the hint text if needed.
|
|
962
999
|
*/
|
|
963
1000
|
didLoseKeyResponderTo: function(keyView) {
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
SC.RunLoop.end();
|
|
1001
|
+
var el = this.$input()[0];
|
|
1002
|
+
if (el) el.blur();
|
|
967
1003
|
this.invokeLater("scrollToOriginIfNeeded", 100);
|
|
968
1004
|
},
|
|
969
|
-
|
|
1005
|
+
|
|
970
1006
|
/** @private
|
|
971
1007
|
Scrolls to origin if necessary (if the pane's current firstResponder is not a text field).
|
|
972
1008
|
*/
|
|
973
1009
|
scrollToOriginIfNeeded: function() {
|
|
974
1010
|
var pane = this.get("pane");
|
|
975
1011
|
if (!pane) return;
|
|
976
|
-
|
|
1012
|
+
|
|
977
1013
|
var first = pane.get("firstResponder");
|
|
978
1014
|
if (!first || !first.get("isTextField")) {
|
|
979
1015
|
document.body.scrollTop = document.body.scrollLeft = 0;
|
|
980
1016
|
}
|
|
981
1017
|
},
|
|
982
|
-
|
|
983
|
-
parentViewDidResize: function() {
|
|
984
|
-
if (SC.browser.mozilla) {
|
|
985
|
-
this.invokeLast(this._applyFirefoxCursorFix);
|
|
986
|
-
}
|
|
987
|
-
sc_super();
|
|
988
|
-
},
|
|
989
1018
|
|
|
990
1019
|
/**
|
|
991
1020
|
Simply allow keyDown & keyUp to pass through to the default web browser
|
|
@@ -1011,19 +1040,18 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
1011
1040
|
else evt.allowDefault();
|
|
1012
1041
|
return YES ; // handled
|
|
1013
1042
|
}
|
|
1014
|
-
|
|
1043
|
+
|
|
1015
1044
|
// maxlength for textareas
|
|
1016
1045
|
if(!SC.platform.input.maxlength && this.get('isTextArea')){
|
|
1017
1046
|
var val = this.get('value');
|
|
1018
1047
|
|
|
1019
1048
|
// This code is nasty. It's thanks gecko .keycode table that has charters like & with the same keycode as up arrow key
|
|
1020
|
-
if(val && ((!SC.browser.
|
|
1021
|
-
(SC.browser.
|
|
1049
|
+
if(val && ((!SC.browser.isMozilla && which>47) ||
|
|
1050
|
+
(SC.browser.isMozilla && ((which>32 && which<43) || which>47) && !(keyCode>36 && keyCode<41))) &&
|
|
1022
1051
|
(val.length >= this.get('maxLength'))) {
|
|
1023
1052
|
maxLengthReached = true;
|
|
1024
1053
|
}
|
|
1025
1054
|
}
|
|
1026
|
-
|
|
1027
1055
|
// validate keyDown...
|
|
1028
1056
|
// do not validate on touch, as it prevents return.
|
|
1029
1057
|
if ((this.performValidateKeyDown(evt) || SC.platform.touch) && !maxLengthReached) {
|
|
@@ -1034,18 +1062,20 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
1034
1062
|
}
|
|
1035
1063
|
|
|
1036
1064
|
if (this.get('applyImmediately')) {
|
|
1037
|
-
//
|
|
1038
|
-
//
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1065
|
+
// There used to be an invokeLater here instead of setTimeout. What we
|
|
1066
|
+
// really need is setTimeout.
|
|
1067
|
+
var self = this;
|
|
1068
|
+
setTimeout(function() {
|
|
1069
|
+
self.fieldValueDidChange();
|
|
1070
|
+
}, 10);
|
|
1042
1071
|
}
|
|
1043
1072
|
|
|
1044
1073
|
return YES;
|
|
1045
1074
|
},
|
|
1046
|
-
|
|
1075
|
+
|
|
1047
1076
|
keyUp: function(evt) {
|
|
1048
|
-
if (SC.browser.
|
|
1077
|
+
if (SC.browser.isMozilla &&
|
|
1078
|
+
evt.keyCode === SC.Event.KEY_RETURN) { this.fieldValueDidChange(); }
|
|
1049
1079
|
|
|
1050
1080
|
// The caret/selection could have moved. In some browsers, though, the
|
|
1051
1081
|
// element's values won't be updated until after this event is finished
|
|
@@ -1055,10 +1085,11 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
1055
1085
|
evt.allowDefault();
|
|
1056
1086
|
return YES;
|
|
1057
1087
|
},
|
|
1058
|
-
|
|
1088
|
+
|
|
1059
1089
|
mouseDown: function(evt) {
|
|
1060
1090
|
var fieldValue = this.get('fieldValue'); // use 'fieldValue' since we want actual text
|
|
1061
1091
|
this._txtFieldMouseDown=YES;
|
|
1092
|
+
this.becomeFirstResponder();
|
|
1062
1093
|
if (!this.get('isEnabled')) {
|
|
1063
1094
|
evt.stop();
|
|
1064
1095
|
return YES;
|
|
@@ -1073,14 +1104,14 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
1073
1104
|
// element's values won't be updated until after this event is finished
|
|
1074
1105
|
// processing.
|
|
1075
1106
|
this.notifyPropertyChange('selection');
|
|
1076
|
-
|
|
1107
|
+
|
|
1077
1108
|
if (!this.get('isEnabled')) {
|
|
1078
1109
|
evt.stop();
|
|
1079
1110
|
return YES;
|
|
1080
|
-
}
|
|
1111
|
+
}
|
|
1081
1112
|
return sc_super();
|
|
1082
1113
|
},
|
|
1083
|
-
|
|
1114
|
+
|
|
1084
1115
|
touchStart: function(evt) {
|
|
1085
1116
|
return this.mouseDown(evt);
|
|
1086
1117
|
},
|
|
@@ -1088,7 +1119,7 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
1088
1119
|
touchEnd: function(evt) {
|
|
1089
1120
|
return this.mouseUp(evt);
|
|
1090
1121
|
},
|
|
1091
|
-
|
|
1122
|
+
|
|
1092
1123
|
/**
|
|
1093
1124
|
Adds mouse wheel support for textareas.
|
|
1094
1125
|
*/
|
|
@@ -1100,12 +1131,24 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
1100
1131
|
},
|
|
1101
1132
|
|
|
1102
1133
|
/*
|
|
1103
|
-
Allows text selection in IE. We block the IE only event selectStart to
|
|
1134
|
+
Allows text selection in IE. We block the IE only event selectStart to
|
|
1104
1135
|
block text selection in all other views.
|
|
1105
1136
|
*/
|
|
1106
1137
|
selectStart: function(evt) {
|
|
1107
1138
|
return YES;
|
|
1108
1139
|
},
|
|
1140
|
+
|
|
1141
|
+
/** @private
|
|
1142
|
+
Overridden from SC.FieldView. Provides correct tag name based on the
|
|
1143
|
+
'isTextArea' property.
|
|
1144
|
+
*/
|
|
1145
|
+
_inputElementTagName: function() {
|
|
1146
|
+
if (this.get('isTextArea')) {
|
|
1147
|
+
return 'textarea';
|
|
1148
|
+
} else {
|
|
1149
|
+
return 'input';
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1109
1152
|
|
|
1110
1153
|
/** @private
|
|
1111
1154
|
This observer makes sure to hide the hint when a value is entered, or
|
|
@@ -1120,9 +1163,9 @@ SC.TextFieldView = SC.FieldView.extend(SC.StaticLayout, SC.Editable,
|
|
|
1120
1163
|
if (!SC.platform.input.maxlength && val.length > max) {
|
|
1121
1164
|
this.set('value', val.substr(0, max));
|
|
1122
1165
|
}
|
|
1123
|
-
} else {
|
|
1166
|
+
} else if(!this.get('hintOnFocus')) {
|
|
1124
1167
|
this._hintON = YES;
|
|
1125
1168
|
}
|
|
1126
1169
|
}.observes('value')
|
|
1127
|
-
|
|
1170
|
+
|
|
1128
1171
|
});
|