ui_bibz 3.0.12 → 4.0.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +3 -3
- data/.github/workflows/linter.yml +13 -12
- data/.overcommit.yml +6 -0
- data/.rubocop.yml +6 -0
- data/.ruby-version +1 -1
- data/Gemfile +19 -12
- data/Gemfile.lock +178 -138
- data/app/assets/config/ui_bibz.js +12 -0
- data/app/assets/javascripts/forms/formula.js +82 -0
- data/app/assets/javascripts/forms/input-connected.js +132 -0
- data/app/assets/javascripts/forms/jquery.multi-select-extend.js +52 -0
- data/app/assets/javascripts/forms.js +160 -0
- data/app/assets/javascripts/interfaces.js +56 -0
- data/app/assets/javascripts/tables.js +49 -0
- data/app/assets/javascripts/ui_bibz_js.js +37 -0
- data/app/assets/stylesheets/navigations/_nav.sass +2 -0
- data/app/assets/stylesheets/navigations/_navbar.sass +12 -0
- data/app/assets/stylesheets/navigations/_progress_bar.sass +2 -0
- data/app/assets/stylesheets/navigations/_toolbar.sass +3 -0
- data/app/assets/stylesheets/sass/_boxes.sass +1 -0
- data/app/assets/stylesheets/sass/_containers.sass +2 -0
- data/app/assets/stylesheets/sass/_fixes.sass +2 -0
- data/app/assets/stylesheets/sass/_forms.sass +8 -0
- data/app/assets/stylesheets/sass/_navigations.sass +4 -0
- data/app/assets/stylesheets/sass/_notifications.sass +4 -0
- data/app/assets/stylesheets/sass/_tables.sass +2 -0
- data/app/assets/stylesheets/sass/_variables_mixins_functions.sass +3 -0
- data/app/assets/stylesheets/sass/boxes/_card.sass +4 -0
- data/app/assets/stylesheets/sass/containers/_panel.scss +330 -0
- data/app/assets/stylesheets/sass/forms/_bootstrap_select.sass +5 -0
- data/app/assets/stylesheets/sass/forms/_button.sass +3 -0
- data/app/assets/stylesheets/sass/forms/_date_picker.sass +3 -0
- data/app/assets/stylesheets/sass/forms/_form_check.sass +10 -0
- data/app/assets/stylesheets/sass/forms/_formula_field.sass +17 -0
- data/app/assets/stylesheets/sass/forms/_multiselect.sass +44 -0
- data/app/assets/stylesheets/sass/forms/_range.sass +44 -0
- data/app/assets/stylesheets/sass/forms/_slider.sass +136 -0
- data/app/assets/stylesheets/sass/forms/_surround_field.sass +25 -0
- data/app/assets/stylesheets/sass/notifications/_badge.sass +5 -0
- data/app/assets/stylesheets/sass/notifications/_glyph.sass +3 -0
- data/app/assets/stylesheets/sass/notifications/_star.sass +2 -0
- data/app/assets/stylesheets/sass/notifications/_toast.sass +3 -0
- data/app/assets/stylesheets/sass/tables/_table.sass +39 -0
- data/app/assets/stylesheets/sass/tables/_table_card.sass +39 -0
- data/app/assets/stylesheets/ui_bibz.sass +26 -0
- data/bin/test +3 -5
- data/config/importmap.rb +19 -0
- data/config/initializers/assets.rb +5 -0
- data/config/initializers/will_paginate.rb +1 -3
- data/lib/ui_bibz/builders/data_html_options_builder.rb +118 -0
- data/lib/ui_bibz/builders/html_classes_builder.rb +89 -0
- data/lib/ui_bibz/builders/html_options_builder.rb +22 -0
- data/lib/ui_bibz/concerns/models/searchable.rb +1 -1
- data/lib/ui_bibz/factory_methods/component_initialize_factory_method.rb +33 -0
- data/lib/ui_bibz/helpers/ui/core/boxes_helper.rb +12 -12
- data/lib/ui_bibz/helpers/ui/core/forms_helper.rb +50 -50
- data/lib/ui_bibz/helpers/ui/core/icons_helper.rb +6 -6
- data/lib/ui_bibz/helpers/ui/core/layouts_helper.rb +2 -2
- data/lib/ui_bibz/helpers/ui/core/lists_helper.rb +2 -2
- data/lib/ui_bibz/helpers/ui/core/navigations_helper.rb +12 -12
- data/lib/ui_bibz/helpers/ui/core/notifications_helper.rb +4 -4
- data/lib/ui_bibz/helpers/ui/core/windows_helper.rb +10 -2
- data/lib/ui_bibz/helpers/ui/ux_helper.rb +2 -2
- data/lib/ui_bibz/helpers/utils_helper.rb +2 -2
- data/lib/ui_bibz/infos.rb +3 -3
- data/lib/ui_bibz/inputs/ui_bibz_form/ui_bibz_form_builder.rb +12 -12
- data/lib/ui_bibz/inputs/ui_bibz_inputs/collection_input.rb +1 -1
- data/lib/ui_bibz/rails/engine.rb +21 -4
- data/lib/ui_bibz/strategies/component_initialize_abstract_strategy.rb +27 -0
- data/lib/ui_bibz/strategies/component_initialize_block_strategy.rb +31 -0
- data/lib/ui_bibz/strategies/component_initialize_hash_strategy.rb +18 -0
- data/lib/ui_bibz/strategies/component_initialize_standard_strategy.rb +18 -0
- data/lib/ui_bibz/ui/concerns/card_itemable_concern.rb +4 -4
- data/lib/ui_bibz/ui/concerns/notification_concern.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card_accordion.rb +4 -4
- data/lib/ui_bibz/ui/core/boxes/card_column.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card_deck.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/card_grid.rb +0 -3
- data/lib/ui_bibz/ui/core/boxes/card_group.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/components/card_body.rb +9 -9
- data/lib/ui_bibz/ui/core/boxes/components/card_col.rb +2 -2
- data/lib/ui_bibz/ui/core/boxes/components/card_list_group.rb +1 -1
- data/lib/ui_bibz/ui/core/boxes/components/card_row.rb +1 -1
- data/lib/ui_bibz/ui/core/component.rb +13 -62
- data/lib/ui_bibz/ui/core/forms/buttons/button.rb +3 -1
- data/lib/ui_bibz/ui/core/forms/buttons/button_group.rb +11 -11
- data/lib/ui_bibz/ui/core/forms/choices/box_switch_field.rb +7 -7
- data/lib/ui_bibz/ui/core/forms/choices/checkbox_field.rb +2 -2
- data/lib/ui_bibz/ui/core/forms/choices/choice_group.rb +5 -6
- data/lib/ui_bibz/ui/core/forms/choices/components/choice.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/dates/date_picker_field.rb +15 -15
- data/lib/ui_bibz/ui/core/forms/dropdowns/components/dropdown_link.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/dropdowns/dropdown.rb +5 -5
- data/lib/ui_bibz/ui/core/forms/numbers/slider_field.rb +1 -1
- data/lib/ui_bibz/ui/core/forms/selects/dropdown_select_field.rb +10 -10
- data/lib/ui_bibz/ui/core/forms/selects/multi_column_field.rb +2 -2
- data/lib/ui_bibz/ui/core/forms/surrounds/surround_field.rb +32 -32
- data/lib/ui_bibz/ui/core/forms/textareas/markdown_editor_field.rb +7 -8
- data/lib/ui_bibz/ui/core/icons/components/glyph_text.rb +1 -1
- data/lib/ui_bibz/ui/core/icons/glyph.rb +4 -3
- data/lib/ui_bibz/ui/core/layouts/row.rb +2 -2
- data/lib/ui_bibz/ui/core/lists/components/list.rb +4 -4
- data/lib/ui_bibz/ui/core/lists/list_group.rb +1 -1
- data/lib/ui_bibz/ui/core/navigations/breadcrumb.rb +6 -4
- data/lib/ui_bibz/ui/core/navigations/components/nav_link_span.rb +1 -2
- data/lib/ui_bibz/ui/core/navigations/components/navbar_form.rb +6 -5
- data/lib/ui_bibz/ui/core/navigations/components/toolbar_form.rb +2 -2
- data/lib/ui_bibz/ui/core/navigations/nav.rb +10 -6
- data/lib/ui_bibz/ui/core/navigations/navbar.rb +21 -19
- data/lib/ui_bibz/ui/core/navigations/pagination.rb +3 -3
- data/lib/ui_bibz/ui/core/navigations/toolbar.rb +5 -5
- data/lib/ui_bibz/ui/core/notifications/alert.rb +4 -5
- data/lib/ui_bibz/ui/core/notifications/badge.rb +6 -2
- data/lib/ui_bibz/ui/core/notifications/components/toast_header.rb +1 -1
- data/lib/ui_bibz/ui/core/notifications/progress_bar.rb +3 -3
- data/lib/ui_bibz/ui/core/notifications/toast.rb +8 -9
- data/lib/ui_bibz/ui/core/windows/components/offcanvas_body.rb +47 -0
- data/lib/ui_bibz/ui/core/windows/components/offcanvas_header.rb +54 -0
- data/lib/ui_bibz/ui/core/windows/modal.rb +9 -9
- data/lib/ui_bibz/ui/core/windows/offcanvas.rb +84 -0
- data/lib/ui_bibz/ui/extensions/core/component/glyph_extension.rb +4 -20
- data/lib/ui_bibz/ui/extensions/core/component/klass_extension.rb +11 -19
- data/lib/ui_bibz/ui/extensions/core/forms/connect_extension.rb +1 -1
- data/lib/ui_bibz/ui/ux/containers/components/panel_column.rb +3 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_deck.rb +3 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_group.rb +3 -3
- data/lib/ui_bibz/ui/ux/containers/components/panel_header.rb +4 -4
- data/lib/ui_bibz/ui/ux/containers/panel.rb +13 -13
- data/lib/ui_bibz/ui/ux/tables/components/actions.rb +4 -4
- data/lib/ui_bibz/ui/ux/tables/components/column.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/components/columns.rb +2 -2
- data/lib/ui_bibz/ui/ux/tables/extensions/sortable.rb +1 -1
- data/lib/ui_bibz/ui/ux/tables/table.rb +5 -5
- data/lib/ui_bibz/ui/ux/tables/table_card.rb +6 -6
- data/lib/ui_bibz/ui/ux/tables/table_search_field.rb +1 -1
- data/lib/ui_bibz/utils/breakdown_class_name_generator.rb +3 -3
- data/lib/ui_bibz/utils/screwdriver.rb +1 -1
- data/lib/ui_bibz/view_objects/glyph_component_view_object.rb +38 -0
- data/lib/ui_bibz.rb +25 -0
- data/test/builders/data_html_classes_builder_test.rb +37 -0
- data/test/builders/html_classes_builder_test.rb +76 -0
- data/test/dummy/Rakefile +1 -1
- data/test/dummy/app/assets/stylesheets/application.css +1 -15
- data/test/dummy/app/channels/application_cable/channel.rb +6 -0
- data/test/dummy/app/channels/application_cable/connection.rb +6 -0
- data/test/dummy/app/jobs/application_job.rb +9 -0
- data/test/dummy/app/mailers/application_mailer.rb +6 -0
- data/test/dummy/app/views/layouts/application.html.erb +10 -12
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/rails +3 -3
- data/test/dummy/bin/rake +2 -2
- data/test/dummy/bin/setup +12 -12
- data/test/dummy/config/application.rb +13 -17
- data/test/dummy/config/boot.rb +3 -3
- data/test/dummy/config/database.yml +2 -2
- data/test/dummy/config/environment.rb +1 -1
- data/test/dummy/config/environments/development.rb +21 -16
- data/test/dummy/config/environments/production.rb +16 -41
- data/test/dummy/config/environments/test.rb +19 -8
- data/test/dummy/config/importmap.rb +11 -0
- data/test/dummy/config/initializers/content_security_policy.rb +21 -24
- data/test/dummy/config/initializers/filter_parameter_logging.rb +6 -2
- data/test/dummy/config/initializers/inflections.rb +4 -4
- data/test/dummy/config/initializers/permissions_policy.rb +12 -0
- data/test/dummy/config/locales/en.yml +13 -3
- data/test/dummy/config/puma.rb +7 -2
- data/test/dummy/config/storage.yml +5 -5
- data/test/dummy/config.ru +2 -1
- data/test/simple_form_test.rb +24 -24
- data/test/ui/core/boxes/card_test.rb +2 -1
- data/test/ui/core/component_test.rb +2 -2
- data/test/ui/core/forms/buttons/button_group_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_link_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_refresh_test.rb +1 -1
- data/test/ui/core/forms/buttons/button_test.rb +2 -2
- data/test/ui/core/forms/choices/box_switch_field_test.rb +10 -10
- data/test/ui/core/forms/choices/checkbox_field_test.rb +1 -1
- data/test/ui/core/forms/choices/choice_group_test.rb +1 -1
- data/test/ui/core/forms/dropdowns/dropdown_test.rb +1 -1
- data/test/ui/core/forms/numbers/formula_field_test.rb +1 -1
- data/test/ui/core/forms/selects/dropdown_select_field_test.rb +2 -2
- data/test/ui/core/forms/selects/select_field_test.rb +1 -1
- data/test/ui/core/forms/surrounds/surround_field_test.rb +4 -4
- data/test/ui/core/forms/texts/auto_complete_field_test.rb +2 -2
- data/test/ui/core/icons/glyph_test.rb +8 -4
- data/test/ui/core/icons/star_test.rb +12 -6
- data/test/ui/core/navigations/breadcrumb_test.rb +1 -1
- data/test/ui/core/navigations/link_test.rb +1 -1
- data/test/ui/core/navigations/nav_test.rb +11 -0
- data/test/ui/core/notifications/alert_test.rb +1 -1
- data/test/ui/core/notifications/badge_test.rb +3 -3
- data/test/ui/core/notifications/popover_test.rb +4 -4
- data/test/ui/core/notifications/spinner_test.rb +1 -1
- data/test/ui/core/notifications/toast_test.rb +1 -1
- data/test/ui/core/notifications/tooltip_test.rb +4 -4
- data/test/ui/core/windows/offcanvas_test.rb +27 -0
- data/test/ui/ux/containers/panel_test.rb +1 -1
- data/test/ui/ux/tables/table_test.rb +3 -3
- data/test/view_objects/glyph_component_view_object_test.rb +17 -0
- data/ui_bibz.gemspec +6 -20
- data/vendor/assets/fonts/fontawesome/fa-brands-400.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-brands-400.woff2 +0 -0
- data/vendor/assets/fonts/fontawesome/fa-regular-400.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-regular-400.woff2 +0 -0
- data/vendor/assets/fonts/fontawesome/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-solid-900.woff2 +0 -0
- data/vendor/assets/fonts/fontawesome/fa-v4compatibility.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fa-v4compatibility.woff2 +0 -0
- data/vendor/assets/javascripts/bootstrap-markdown.js +1 -1555
- data/vendor/assets/javascripts/bootstrap-multiselect.min.js +40 -1176
- data/vendor/assets/javascripts/bootstrap-switch.min.js +9 -21
- data/vendor/assets/javascripts/bs-custom-file-input.min.js +0 -1
- data/vendor/assets/javascripts/fontawesome/all.js +5977 -0
- data/vendor/assets/javascripts/fontawesome/all.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/brands.js +749 -0
- data/vendor/assets/javascripts/fontawesome/brands.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/conflict-detection.js +1138 -0
- data/vendor/assets/javascripts/fontawesome/conflict-detection.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/fontawesome.js +3126 -0
- data/vendor/assets/javascripts/fontawesome/fontawesome.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/regular.js +445 -0
- data/vendor/assets/javascripts/fontawesome/regular.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/solid.js +1672 -0
- data/vendor/assets/javascripts/fontawesome/solid.min.js +6 -0
- data/vendor/assets/javascripts/fontawesome/v4-shims.js +225 -0
- data/vendor/assets/javascripts/fontawesome/v4-shims.min.js +6 -0
- data/vendor/assets/javascripts/fuzzysort.js +562 -0
- data/vendor/assets/javascripts/jquery-3.7.0.min.js +2 -0
- data/vendor/assets/javascripts/jquery.multi-select.min.js +725 -1
- data/vendor/assets/stylesheets/bootstrap-multiselect.sass +115 -0
- data/vendor/assets/stylesheets/bootstrap-switch.scss +211 -0
- data/vendor/assets/stylesheets/fontawesome/_animated.scss +142 -9
- data/vendor/assets/stylesheets/fontawesome/_bordered-pulled.scss +13 -13
- data/vendor/assets/stylesheets/fontawesome/_core.scss +28 -6
- data/vendor/assets/stylesheets/fontawesome/_fixed-width.scss +2 -1
- data/vendor/assets/stylesheets/fontawesome/_functions.scss +57 -0
- data/vendor/assets/stylesheets/fontawesome/_icons.scss +7 -1438
- data/vendor/assets/stylesheets/fontawesome/_list.scss +4 -4
- data/vendor/assets/stylesheets/fontawesome/_mixins.scss +53 -34
- data/vendor/assets/stylesheets/fontawesome/_rotated-flipped.scss +25 -18
- data/vendor/assets/stylesheets/fontawesome/_screen-reader.scss +12 -3
- data/vendor/assets/stylesheets/fontawesome/_shims.scss +640 -664
- data/vendor/assets/stylesheets/fontawesome/_sizing.scss +16 -0
- data/vendor/assets/stylesheets/fontawesome/_stacked.scss +5 -4
- data/vendor/assets/stylesheets/fontawesome/_variables.scss +4896 -1393
- data/vendor/assets/stylesheets/fontawesome/brands.scss +17 -10
- data/vendor/assets/stylesheets/fontawesome/fontawesome.scss +7 -2
- data/vendor/assets/stylesheets/fontawesome/regular.scss +13 -10
- data/vendor/assets/stylesheets/fontawesome/solid.scss +13 -11
- data/vendor/assets/stylesheets/fontawesome/v4-shims.scss +6 -1
- data/vendor/assets/stylesheets/multi-select.css +92 -0
- metadata +120 -348
- data/.gitlab-ci.yml +0 -17
- data/.travis.yml +0 -24
- data/lib/ui_bibz/ui/extensions/core/component/popover_extension.rb +0 -70
- data/structure.md +0 -68
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/javascripts/packs/index.js +0 -3
- data/test/dummy/config/initializers/application_controller_renderer.rb +0 -9
- data/test/dummy/config/initializers/assets.rb +0 -14
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -8
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -7
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/session_store.rb +0 -5
- data/test/dummy/config/initializers/ui_bibz.rb +0 -5
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -16
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/config/spring.rb +0 -8
- data/test/dummy/test/models/user_test.rb +0 -9
- data/vendor/assets/fonts/fa-brands-400.eot +0 -0
- data/vendor/assets/fonts/fa-brands-400.svg +0 -3570
- data/vendor/assets/fonts/fa-brands-400.ttf +0 -0
- data/vendor/assets/fonts/fa-brands-400.woff +0 -0
- data/vendor/assets/fonts/fa-brands-400.woff2 +0 -0
- data/vendor/assets/fonts/fa-regular-400.eot +0 -0
- data/vendor/assets/fonts/fa-regular-400.svg +0 -803
- data/vendor/assets/fonts/fa-regular-400.ttf +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff +0 -0
- data/vendor/assets/fonts/fa-regular-400.woff2 +0 -0
- data/vendor/assets/fonts/fa-solid-900.eot +0 -0
- data/vendor/assets/fonts/fa-solid-900.svg +0 -4938
- data/vendor/assets/fonts/fa-solid-900.ttf +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff +0 -0
- data/vendor/assets/fonts/fa-solid-900.woff2 +0 -0
- data/vendor/assets/javascripts/all.js +0 -4441
- data/vendor/assets/javascripts/all.min.js +0 -5
- data/vendor/assets/stylesheets/all.min.css +0 -5
- data/vendor/assets/stylesheets/fontawesome/_larger.scss +0 -23
- data/vendor/assets/stylesheets/svg-with-js.css +0 -5
- /data/{test/dummy/app/mailers/.keep → app/assets/stylesheets/sass/forms/_dropdown.sass} +0 -0
- /data/{test/dummy/app/views/users/index.html.erb → app/assets/stylesheets/sass/forms/_input_refresh_button.sass} +0 -0
@@ -1,22 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
* you may not use this file except in compliance with the License.
|
10
|
-
* You may obtain a copy of the License at
|
11
|
-
*
|
12
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
*
|
14
|
-
* Unless required by applicable law or agreed to in writing, software
|
15
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
* See the License for the specific language governing permissions and
|
18
|
-
* limitations under the License.
|
19
|
-
* ========================================================================
|
20
|
-
*/
|
1
|
+
/**
|
2
|
+
* bootstrap-switch - Turn checkboxes and radio buttons into toggle switches.
|
3
|
+
*
|
4
|
+
* @version v3.3.5
|
5
|
+
* @homepage https://bttstrp.github.io/bootstrap-switch
|
6
|
+
* @author Mattia Larentis <mattia@larentis.eu> (http://larentis.eu)
|
7
|
+
* @license MIT
|
8
|
+
*/
|
21
9
|
|
22
|
-
(function(){var t=[].slice;!function(e,i){"use strict";var n;return n=function(){function t(t,i){null==i&&(i={}),this.$element=e(t),this.options=e.extend({},e.fn.bootstrapSwitch.defaults,{state:this.$element.is(":checked"),size:this.$element.data("size"),animate:this.$element.data("animate"),disabled:this.$element.is(":disabled"),readonly:this.$element.is("[readonly]"),indeterminate:this.$element.data("indeterminate"),inverse:this.$element.data("inverse"),radioAllOff:this.$element.data("radio-all-off"),onColor:this.$element.data("on-color"),offColor:this.$element.data("off-color"),onText:this.$element.data("on-text"),offText:this.$element.data("off-text"),labelText:this.$element.data("label-text"),handleWidth:this.$element.data("handle-width"),labelWidth:this.$element.data("label-width"),baseClass:this.$element.data("base-class"),wrapperClass:this.$element.data("wrapper-class")},i),this.prevOptions={},this.$wrapper=e("<div>",{"class":function(t){return function(){var e;return e=[""+t.options.baseClass].concat(t._getClasses(t.options.wrapperClass)),e.push(t.options.state?t.options.baseClass+"-on":t.options.baseClass+"-off"),null!=t.options.size&&e.push(t.options.baseClass+"-"+t.options.size),t.options.disabled&&e.push(t.options.baseClass+"-disabled"),t.options.readonly&&e.push(t.options.baseClass+"-readonly"),t.options.indeterminate&&e.push(t.options.baseClass+"-indeterminate"),t.options.inverse&&e.push(t.options.baseClass+"-inverse"),t.$element.attr("id")&&e.push(t.options.baseClass+"-id-"+t.$element.attr("id")),e.join(" ")}}(this)()}),this.$container=e("<div>",{"class":this.options.baseClass+"-container"}),this.$on=e("<span>",{html:this.options.onText,"class":this.options.baseClass+"-handle-on "+this.options.baseClass+"-"+this.options.onColor}),this.$off=e("<span>",{html:this.options.offText,"class":this.options.baseClass+"-handle-off "+this.options.baseClass+"-"+this.options.offColor}),this.$label=e("<span>",{html:this.options.labelText,"class":this.options.baseClass+"-label"}),this.$element.on("init.bootstrapSwitch",function(e){return function(){return e.options.onInit.apply(t,arguments)}}(this)),this.$element.on("switchChange.bootstrapSwitch",function(i){return function(n){return!1===i.options.onSwitchChange.apply(t,arguments)?i.$element.is(":radio")?e("[name='"+i.$element.attr("name")+"']").trigger("previousState.bootstrapSwitch",!0):i.$element.trigger("previousState.bootstrapSwitch",!0):void 0}}(this)),this.$container=this.$element.wrap(this.$container).parent(),this.$wrapper=this.$container.wrap(this.$wrapper).parent(),this.$element.before(this.options.inverse?this.$off:this.$on).before(this.$label).before(this.options.inverse?this.$on:this.$off),this.options.indeterminate&&this.$element.prop("indeterminate",!0),this._init(),this._elementHandlers(),this._handleHandlers(),this._labelHandlers(),this._formHandler(),this._externalLabelHandler(),this.$element.trigger("init.bootstrapSwitch",this.options.state)}return t.prototype._constructor=t,t.prototype.setPrevOptions=function(){return this.prevOptions=e.extend(!0,{},this.options)},t.prototype.state=function(t,i){return"undefined"==typeof t?this.options.state:this.options.disabled||this.options.readonly?this.$element:this.options.state&&!this.options.radioAllOff&&this.$element.is(":radio")?this.$element:(this.$element.is(":radio")?e("[name='"+this.$element.attr("name")+"']").trigger("setPreviousOptions.bootstrapSwitch"):this.$element.trigger("setPreviousOptions.bootstrapSwitch"),this.options.indeterminate&&this.indeterminate(!1),t=!!t,this.$element.prop("checked",t).trigger("change.bootstrapSwitch",i),this.$element)},t.prototype.toggleState=function(t){return this.options.disabled||this.options.readonly?this.$element:this.options.indeterminate?(this.indeterminate(!1),this.state(!0)):this.$element.prop("checked",!this.options.state).trigger("change.bootstrapSwitch",t)},t.prototype.size=function(t){return"undefined"==typeof t?this.options.size:(null!=this.options.size&&this.$wrapper.removeClass(this.options.baseClass+"-"+this.options.size),t&&this.$wrapper.addClass(this.options.baseClass+"-"+t),this._width(),this._containerPosition(),this.options.size=t,this.$element)},t.prototype.animate=function(t){return"undefined"==typeof t?this.options.animate:(t=!!t,t===this.options.animate?this.$element:this.toggleAnimate())},t.prototype.toggleAnimate=function(){return this.options.animate=!this.options.animate,this.$wrapper.toggleClass(this.options.baseClass+"-animate"),this.$element},t.prototype.disabled=function(t){return"undefined"==typeof t?this.options.disabled:(t=!!t,t===this.options.disabled?this.$element:this.toggleDisabled())},t.prototype.toggleDisabled=function(){return this.options.disabled=!this.options.disabled,this.$element.prop("disabled",this.options.disabled),this.$wrapper.toggleClass(this.options.baseClass+"-disabled"),this.$element},t.prototype.readonly=function(t){return"undefined"==typeof t?this.options.readonly:(t=!!t,t===this.options.readonly?this.$element:this.toggleReadonly())},t.prototype.toggleReadonly=function(){return this.options.readonly=!this.options.readonly,this.$element.prop("readonly",this.options.readonly),this.$wrapper.toggleClass(this.options.baseClass+"-readonly"),this.$element},t.prototype.indeterminate=function(t){return"undefined"==typeof t?this.options.indeterminate:(t=!!t,t===this.options.indeterminate?this.$element:this.toggleIndeterminate())},t.prototype.toggleIndeterminate=function(){return this.options.indeterminate=!this.options.indeterminate,this.$element.prop("indeterminate",this.options.indeterminate),this.$wrapper.toggleClass(this.options.baseClass+"-indeterminate"),this._containerPosition(),this.$element},t.prototype.inverse=function(t){return"undefined"==typeof t?this.options.inverse:(t=!!t,t===this.options.inverse?this.$element:this.toggleInverse())},t.prototype.toggleInverse=function(){var t,e;return this.$wrapper.toggleClass(this.options.baseClass+"-inverse"),e=this.$on.clone(!0),t=this.$off.clone(!0),this.$on.replaceWith(t),this.$off.replaceWith(e),this.$on=t,this.$off=e,this.options.inverse=!this.options.inverse,this.$element},t.prototype.onColor=function(t){var e;return e=this.options.onColor,"undefined"==typeof t?e:(null!=e&&this.$on.removeClass(this.options.baseClass+"-"+e),this.$on.addClass(this.options.baseClass+"-"+t),this.options.onColor=t,this.$element)},t.prototype.offColor=function(t){var e;return e=this.options.offColor,"undefined"==typeof t?e:(null!=e&&this.$off.removeClass(this.options.baseClass+"-"+e),this.$off.addClass(this.options.baseClass+"-"+t),this.options.offColor=t,this.$element)},t.prototype.onText=function(t){return"undefined"==typeof t?this.options.onText:(this.$on.html(t),this._width(),this._containerPosition(),this.options.onText=t,this.$element)},t.prototype.offText=function(t){return"undefined"==typeof t?this.options.offText:(this.$off.html(t),this._width(),this._containerPosition(),this.options.offText=t,this.$element)},t.prototype.labelText=function(t){return"undefined"==typeof t?this.options.labelText:(this.$label.html(t),this._width(),this.options.labelText=t,this.$element)},t.prototype.handleWidth=function(t){return"undefined"==typeof t?this.options.handleWidth:(this.options.handleWidth=t,this._width(),this._containerPosition(),this.$element)},t.prototype.labelWidth=function(t){return"undefined"==typeof t?this.options.labelWidth:(this.options.labelWidth=t,this._width(),this._containerPosition(),this.$element)},t.prototype.baseClass=function(t){return this.options.baseClass},t.prototype.wrapperClass=function(t){return"undefined"==typeof t?this.options.wrapperClass:(t||(t=e.fn.bootstrapSwitch.defaults.wrapperClass),this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(" ")),this.$wrapper.addClass(this._getClasses(t).join(" ")),this.options.wrapperClass=t,this.$element)},t.prototype.radioAllOff=function(t){return"undefined"==typeof t?this.options.radioAllOff:(t=!!t,t===this.options.radioAllOff?this.$element:(this.options.radioAllOff=t,this.$element))},t.prototype.onInit=function(t){return"undefined"==typeof t?this.options.onInit:(t||(t=e.fn.bootstrapSwitch.defaults.onInit),this.options.onInit=t,this.$element)},t.prototype.onSwitchChange=function(t){return"undefined"==typeof t?this.options.onSwitchChange:(t||(t=e.fn.bootstrapSwitch.defaults.onSwitchChange),this.options.onSwitchChange=t,this.$element)},t.prototype.destroy=function(){var t;return t=this.$element.closest("form"),t.length&&t.off("reset.bootstrapSwitch").removeData("bootstrap-switch"),this.$container.children().not(this.$element).remove(),this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch"),this.$element},t.prototype._width=function(){var t,e;return t=this.$on.add(this.$off),t.add(this.$label).css("width",""),e="auto"===this.options.handleWidth?Math.max(this.$on.width(),this.$off.width()):this.options.handleWidth,t.width(e),this.$label.width(function(t){return function(i,n){return"auto"!==t.options.labelWidth?t.options.labelWidth:e>n?e:n}}(this)),this._handleWidth=this.$on.outerWidth(),this._labelWidth=this.$label.outerWidth(),this.$container.width(2*this._handleWidth+this._labelWidth),this.$wrapper.width(this._handleWidth+this._labelWidth)},t.prototype._containerPosition=function(t,e){return null==t&&(t=this.options.state),this.$container.css("margin-left",function(e){return function(){var i;return i=[0,"-"+e._handleWidth+"px"],e.options.indeterminate?"-"+e._handleWidth/2+"px":t?e.options.inverse?i[1]:i[0]:e.options.inverse?i[0]:i[1]}}(this)),e?setTimeout(function(){return e()},50):void 0},t.prototype._init=function(){var t,e;return t=function(t){return function(){return t.setPrevOptions(),t._width(),t._containerPosition(null,function(){return t.options.animate?t.$wrapper.addClass(t.options.baseClass+"-animate"):void 0})}}(this),this.$wrapper.is(":visible")?t():e=i.setInterval(function(n){return function(){return n.$wrapper.is(":visible")?(t(),i.clearInterval(e)):void 0}}(this),50)},t.prototype._elementHandlers=function(){return this.$element.on({"setPreviousOptions.bootstrapSwitch":function(t){return function(e){return t.setPrevOptions()}}(this),"previousState.bootstrapSwitch":function(t){return function(e){return t.options=t.prevOptions,t.options.indeterminate&&t.$wrapper.addClass(t.options.baseClass+"-indeterminate"),t.$element.prop("checked",t.options.state).trigger("change.bootstrapSwitch",!0)}}(this),"change.bootstrapSwitch":function(t){return function(i,n){var o;return i.preventDefault(),i.stopImmediatePropagation(),o=t.$element.is(":checked"),t._containerPosition(o),o!==t.options.state?(t.options.state=o,t.$wrapper.toggleClass(t.options.baseClass+"-off").toggleClass(t.options.baseClass+"-on"),n?void 0:(t.$element.is(":radio")&&e("[name='"+t.$element.attr("name")+"']").not(t.$element).prop("checked",!1).trigger("change.bootstrapSwitch",!0),t.$element.trigger("switchChange.bootstrapSwitch",[o]))):void 0}}(this),"focus.bootstrapSwitch":function(t){return function(e){return e.preventDefault(),t.$wrapper.addClass(t.options.baseClass+"-focused")}}(this),"blur.bootstrapSwitch":function(t){return function(e){return e.preventDefault(),t.$wrapper.removeClass(t.options.baseClass+"-focused")}}(this),"keydown.bootstrapSwitch":function(t){return function(e){if(e.which&&!t.options.disabled&&!t.options.readonly)switch(e.which){case 37:return e.preventDefault(),e.stopImmediatePropagation(),t.state(!1);case 39:return e.preventDefault(),e.stopImmediatePropagation(),t.state(!0)}}}(this)})},t.prototype._handleHandlers=function(){return this.$on.on("click.bootstrapSwitch",function(t){return function(e){return e.preventDefault(),e.stopPropagation(),t.state(!1),t.$element.trigger("focus.bootstrapSwitch")}}(this)),this.$off.on("click.bootstrapSwitch",function(t){return function(e){return e.preventDefault(),e.stopPropagation(),t.state(!0),t.$element.trigger("focus.bootstrapSwitch")}}(this))},t.prototype._labelHandlers=function(){return this.$label.on({click:function(t){return t.stopPropagation()},"mousedown.bootstrapSwitch touchstart.bootstrapSwitch":function(t){return function(e){return t._dragStart||t.options.disabled||t.options.readonly?void 0:(e.preventDefault(),e.stopPropagation(),t._dragStart=(e.pageX||e.originalEvent.touches[0].pageX)-parseInt(t.$container.css("margin-left"),10),t.options.animate&&t.$wrapper.removeClass(t.options.baseClass+"-animate"),t.$element.trigger("focus.bootstrapSwitch"))}}(this),"mousemove.bootstrapSwitch touchmove.bootstrapSwitch":function(t){return function(e){var i;if(null!=t._dragStart&&(e.preventDefault(),i=(e.pageX||e.originalEvent.touches[0].pageX)-t._dragStart,!(i<-t._handleWidth||i>0)))return t._dragEnd=i,t.$container.css("margin-left",t._dragEnd+"px")}}(this),"mouseup.bootstrapSwitch touchend.bootstrapSwitch":function(t){return function(e){var i;if(t._dragStart)return e.preventDefault(),t.options.animate&&t.$wrapper.addClass(t.options.baseClass+"-animate"),t._dragEnd?(i=t._dragEnd>-(t._handleWidth/2),t._dragEnd=!1,t.state(t.options.inverse?!i:i)):t.state(!t.options.state),t._dragStart=!1}}(this),"mouseleave.bootstrapSwitch":function(t){return function(e){return t.$label.trigger("mouseup.bootstrapSwitch")}}(this)})},t.prototype._externalLabelHandler=function(){var t;return t=this.$element.closest("label"),t.on("click",function(e){return function(i){return i.preventDefault(),i.stopImmediatePropagation(),i.target===t[0]?e.toggleState():void 0}}(this))},t.prototype._formHandler=function(){var t;return t=this.$element.closest("form"),t.data("bootstrap-switch")?void 0:t.on("reset.bootstrapSwitch",function(){return i.setTimeout(function(){return t.find("input").filter(function(){return e(this).data("bootstrap-switch")}).each(function(){return e(this).bootstrapSwitch("state",this.checked)})},1)}).data("bootstrap-switch",!0)},t.prototype._getClasses=function(t){var i,n,o,s;if(!e.isArray(t))return[this.options.baseClass+"-"+t];for(n=[],o=0,s=t.length;s>o;o++)i=t[o],n.push(this.options.baseClass+"-"+i);return n},t}(),e.fn.bootstrapSwitch=function(){var i,o,s;return o=arguments[0],i=2<=arguments.length?t.call(arguments,1):[],s=this,this.each(function(){var t,a;return t=e(this),a=t.data("bootstrap-switch"),a||t.data("bootstrap-switch",a=new n(this,o)),"string"==typeof o?s=a[o].apply(a,i):void 0}),s},e.fn.bootstrapSwitch.Constructor=n,e.fn.bootstrapSwitch.defaults={state:!0,size:null,animate:!0,disabled:!1,readonly:!1,indeterminate:!1,inverse:!1,radioAllOff:!1,onColor:"primary",offColor:"default",onText:"ON",offText:"OFF",labelText:" ",handleWidth:"auto",labelWidth:"auto",baseClass:"bootstrap-switch",wrapperClass:"wrapper",onInit:function(){},onSwitchChange:function(){}}}(window.jQuery,window)}).call(this);
|
10
|
+
!function(e,t){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["jquery"],function(e){return t(e)}):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(e.jQuery)}(this,function(a){'use strict';function c(x,y){if(!(x instanceof y))throw new TypeError('Cannot call a class as a function')}function d(x,y){var z=x.state,A=x.size,B=x.disabled,C=x.readonly,D=x.indeterminate,E=x.inverse;return[z?'on':'off',A,B?'disabled':void 0,C?'readonly':void 0,D?'indeterminate':void 0,E?'inverse':void 0,y?'id-'+y:void 0].filter(function(F){return null==F})}function e(){return{state:this.$element.is(':checked'),size:this.$element.data('size'),animate:this.$element.data('animate'),disabled:this.$element.is(':disabled'),readonly:this.$element.is('[readonly]'),indeterminate:this.$element.data('indeterminate'),inverse:this.$element.data('inverse'),radioAllOff:this.$element.data('radio-all-off'),onColor:this.$element.data('on-color'),offColor:this.$element.data('off-color'),onText:this.$element.data('on-text'),offText:this.$element.data('off-text'),labelText:this.$element.data('label-text'),handleWidth:this.$element.data('handle-width'),labelWidth:this.$element.data('label-width'),baseClass:this.$element.data('base-class'),wrapperClass:this.$element.data('wrapper-class')}}function f(){var x=this,y=this.$on.add(this.$off).add(this.$label).css('width',''),z='auto'===this.options.handleWidth?Math.round(Math.max(this.$on.width(),this.$off.width())):this.options.handleWidth;return y.width(z),this.$label.width(function(A,B){return'auto'===x.options.labelWidth?B<z?z:B:x.options.labelWidth}),this.privateHandleWidth=this.$on.outerWidth(),this.privateLabelWidth=this.$label.outerWidth(),this.$container.width(2*this.privateHandleWidth+this.privateLabelWidth),this.$wrapper.width(this.privateHandleWidth+this.privateLabelWidth)}function g(){var x=this,y=0<arguments.length&&arguments[0]!==void 0?arguments[0]:this.ope;this.$container.css('margin-left',function(){var z=[0,'-'+x.privateHandleWidth+'px'];return x.options.indeterminate?'-'+x.privateHandleWidth/2+'px':y?x.options.inverse?z[1]:z[0]:x.options.inverse?z[0]:z[1]})}function h(x){return this.options.baseClass+'-'+x}function j(){var x=this,y=function(){x.setPrevOptions(),f.call(x),g.call(x),setTimeout(function(){return x.options.animate&&x.$wrapper.addClass(h.call(x,'animate'))},50)};if(this.$wrapper.is(':visible'))return void y();var z=window.setInterval(function(){return x.$wrapper.is(':visible')&&(y()||!0)&&window.clearInterval(z)},50)}function k(){var x=this;return this.$element.on({'setPreviousOptions.bootstrapSwitch':function(){return x.setPrevOptions()},'previousState.bootstrapSwitch':function(){x.options=x.prevOptions,x.options.indeterminate&&x.$wrapper.addClass(h.call(x,'indeterminate')),x.$element.prop('checked',x.options.state).trigger('change.bootstrapSwitch',!0)},'change.bootstrapSwitch':function(z,A){z.preventDefault(),z.stopImmediatePropagation();var B=x.$element.is(':checked');g.call(x,B);B===x.options.state||(x.options.state=B,x.$wrapper.toggleClass(h.call(x,'off')).toggleClass(h.call(x,'on')),!A&&(x.$element.is(':radio')&&u('[name="'+x.$element.attr('name')+'"]').not(x.$element).prop('checked',!1).trigger('change.bootstrapSwitch',!0),x.$element.trigger('switchChange.bootstrapSwitch',[B])))},'focus.bootstrapSwitch':function(z){z.preventDefault(),x.$wrapper.addClass(h.call(x,'focused'))},'blur.bootstrapSwitch':function(z){z.preventDefault(),x.$wrapper.removeClass(h.call(x,'focused'))},'keydown.bootstrapSwitch':function(z){!z.which||x.options.disabled||x.options.readonly||(37===z.which||39===z.which)&&(z.preventDefault(),z.stopImmediatePropagation(),x.state(39===z.which))}})}function l(){var x=this;return this.$on.on('click.bootstrapSwitch',function(y){return y.preventDefault(),y.stopPropagation(),x.state(!1),x.$element.trigger('focus.bootstrapSwitch')}),this.$off.on('click.bootstrapSwitch',function(y){return y.preventDefault(),y.stopPropagation(),x.state(!0),x.$element.trigger('focus.bootstrapSwitch')})}function m(){var x=this,y=void 0,z=void 0;this.$label.on({click:function(C){C.stopPropagation()},'mousedown.bootstrapSwitch touchstart.bootstrapSwitch':function(C){y||x.options.disabled||x.options.readonly||(C.preventDefault(),C.stopPropagation(),y=(C.pageX||C.originalEvent.touches[0].pageX)-parseInt(x.$container.css('margin-left'),10),x.options.animate&&x.$wrapper.removeClass(h.call(x,'animate')),x.$element.trigger('focus.bootstrapSwitch'))},'mousemove.bootstrapSwitch touchmove.bootstrapSwitch':function(C){if(null!=y){var D=(C.pageX||C.originalEvent.touches[0].pageX)-y;C.preventDefault(),D<-x.privateHandleWidth||0<D||(z=D,x.$container.css('margin-left',z+'px'))}},'mouseup.bootstrapSwitch touchend.bootstrapSwitch':function(C){if(y){if(C.preventDefault(),x.options.animate&&x.$wrapper.addClass(h.call(x,'animate')),z){var D=z>-(x.privateHandleWidth/2);z=!1,x.state(x.options.inverse?!D:D)}else x.state(!x.options.state);y=!1}},'mouseleave.bootstrapSwitch':function(){x.$label.trigger('mouseup.bootstrapSwitch')}})}function n(){var x=this,y=this.$element.closest('label');y.on('click',function(z){z.preventDefault(),z.stopImmediatePropagation(),z.target===y[0]&&x.toggleState()})}function o(){function x(){return u(this).data('bootstrap-switch')}function y(){return u(this).bootstrapSwitch('state',this.checked)}var z=this.$element.closest('form');z.data('bootstrap-switch')||z.on('reset.bootstrapSwitch',function(){window.setTimeout(function(){z.find('input').filter(x).each(y)},1)}).data('bootstrap-switch',!0)}function p(x){var y=this;return u.isArray(x)?x.map(function(z){return h.call(y,z)}):[h.call(this,x)]}var r=function(x){return x&&x.__esModule?x:{default:x}}(a),s=Object.assign||function(x){for(var z,y=1;y<arguments.length;y++)for(var A in z=arguments[y],z)Object.prototype.hasOwnProperty.call(z,A)&&(x[A]=z[A]);return x},t=function(){function x(y,z){for(var B,A=0;A<z.length;A++)B=z[A],B.enumerable=B.enumerable||!1,B.configurable=!0,'value'in B&&(B.writable=!0),Object.defineProperty(y,B.key,B)}return function(y,z,A){return z&&x(y.prototype,z),A&&x(y,A),y}}(),u=r.default||window.jQuery||window.$,w=function(){function x(y){var z=this,A=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};c(this,x),this.$element=u(y),this.options=u.extend({},u.fn.bootstrapSwitch.defaults,e.call(this),A),this.prevOptions={},this.$wrapper=u('<div>',{class:function(){return d(z.options,z.$element.attr('id')).map(function(C){return h.call(z,C)}).concat([z.options.baseClass],p.call(z,z.options.wrapperClass)).join(' ')}}),this.$container=u('<div>',{class:h.call(this,'container')}),this.$on=u('<span>',{html:this.options.onText,class:h.call(this,'handle-on')+' '+h.call(this,this.options.onColor)}),this.$off=u('<span>',{html:this.options.offText,class:h.call(this,'handle-off')+' '+h.call(this,this.options.offColor)}),this.$label=u('<span>',{html:this.options.labelText,class:h.call(this,'label')}),this.$element.on('init.bootstrapSwitch',function(){return z.options.onInit(y)}),this.$element.on('switchChange.bootstrapSwitch',function(){for(var B=arguments.length,C=Array(B),D=0;D<B;D++)C[D]=arguments[D];var E=z.options.onSwitchChange.apply(y,C);!1===E&&(z.$element.is(':radio')?u('[name="'+z.$element.attr('name')+'"]').trigger('previousState.bootstrapSwitch',!0):z.$element.trigger('previousState.bootstrapSwitch',!0))}),this.$container=this.$element.wrap(this.$container).parent(),this.$wrapper=this.$container.wrap(this.$wrapper).parent(),this.$element.before(this.options.inverse?this.$off:this.$on).before(this.$label).before(this.options.inverse?this.$on:this.$off),this.options.indeterminate&&this.$element.prop('indeterminate',!0),j.call(this),k.call(this),l.call(this),m.call(this),o.call(this),n.call(this),this.$element.trigger('init.bootstrapSwitch',this.options.state)}return t(x,[{key:'setPrevOptions',value:function(){this.prevOptions=s({},this.options)}},{key:'state',value:function(z,A){return'undefined'==typeof z?this.options.state:this.options.disabled||this.options.readonly||this.options.state&&!this.options.radioAllOff&&this.$element.is(':radio')?this.$element:(this.$element.is(':radio')?u('[name="'+this.$element.attr('name')+'"]').trigger('setPreviousOptions.bootstrapSwitch'):this.$element.trigger('setPreviousOptions.bootstrapSwitch'),this.options.indeterminate&&this.indeterminate(!1),this.$element.prop('checked',!!z).trigger('change.bootstrapSwitch',A),this.$element)}},{key:'toggleState',value:function(z){return this.options.disabled||this.options.readonly?this.$element:this.options.indeterminate?(this.indeterminate(!1),this.state(!0)):this.$element.prop('checked',!this.options.state).trigger('change.bootstrapSwitch',z)}},{key:'size',value:function(z){return'undefined'==typeof z?this.options.size:(null!=this.options.size&&this.$wrapper.removeClass(h.call(this,this.options.size)),z&&this.$wrapper.addClass(h.call(this,z)),f.call(this),g.call(this),this.options.size=z,this.$element)}},{key:'animate',value:function(z){return'undefined'==typeof z?this.options.animate:this.options.animate===!!z?this.$element:this.toggleAnimate()}},{key:'toggleAnimate',value:function(){return this.options.animate=!this.options.animate,this.$wrapper.toggleClass(h.call(this,'animate')),this.$element}},{key:'disabled',value:function(z){return'undefined'==typeof z?this.options.disabled:this.options.disabled===!!z?this.$element:this.toggleDisabled()}},{key:'toggleDisabled',value:function(){return this.options.disabled=!this.options.disabled,this.$element.prop('disabled',this.options.disabled),this.$wrapper.toggleClass(h.call(this,'disabled')),this.$element}},{key:'readonly',value:function(z){return'undefined'==typeof z?this.options.readonly:this.options.readonly===!!z?this.$element:this.toggleReadonly()}},{key:'toggleReadonly',value:function(){return this.options.readonly=!this.options.readonly,this.$element.prop('readonly',this.options.readonly),this.$wrapper.toggleClass(h.call(this,'readonly')),this.$element}},{key:'indeterminate',value:function(z){return'undefined'==typeof z?this.options.indeterminate:this.options.indeterminate===!!z?this.$element:this.toggleIndeterminate()}},{key:'toggleIndeterminate',value:function(){return this.options.indeterminate=!this.options.indeterminate,this.$element.prop('indeterminate',this.options.indeterminate),this.$wrapper.toggleClass(h.call(this,'indeterminate')),g.call(this),this.$element}},{key:'inverse',value:function(z){return'undefined'==typeof z?this.options.inverse:this.options.inverse===!!z?this.$element:this.toggleInverse()}},{key:'toggleInverse',value:function(){this.$wrapper.toggleClass(h.call(this,'inverse'));var z=this.$on.clone(!0),A=this.$off.clone(!0);return this.$on.replaceWith(A),this.$off.replaceWith(z),this.$on=A,this.$off=z,this.options.inverse=!this.options.inverse,this.$element}},{key:'onColor',value:function(z){return'undefined'==typeof z?this.options.onColor:(this.options.onColor&&this.$on.removeClass(h.call(this,this.options.onColor)),this.$on.addClass(h.call(this,z)),this.options.onColor=z,this.$element)}},{key:'offColor',value:function(z){return'undefined'==typeof z?this.options.offColor:(this.options.offColor&&this.$off.removeClass(h.call(this,this.options.offColor)),this.$off.addClass(h.call(this,z)),this.options.offColor=z,this.$element)}},{key:'onText',value:function(z){return'undefined'==typeof z?this.options.onText:(this.$on.html(z),f.call(this),g.call(this),this.options.onText=z,this.$element)}},{key:'offText',value:function(z){return'undefined'==typeof z?this.options.offText:(this.$off.html(z),f.call(this),g.call(this),this.options.offText=z,this.$element)}},{key:'labelText',value:function(z){return'undefined'==typeof z?this.options.labelText:(this.$label.html(z),f.call(this),this.options.labelText=z,this.$element)}},{key:'handleWidth',value:function(z){return'undefined'==typeof z?this.options.handleWidth:(this.options.handleWidth=z,f.call(this),g.call(this),this.$element)}},{key:'labelWidth',value:function(z){return'undefined'==typeof z?this.options.labelWidth:(this.options.labelWidth=z,f.call(this),g.call(this),this.$element)}},{key:'baseClass',value:function(){return this.options.baseClass}},{key:'wrapperClass',value:function(z){if('undefined'==typeof z)return this.options.wrapperClass;var y=z||u.fn.bootstrapSwitch.defaults.wrapperClass;return this.$wrapper.removeClass(p.call(this,this.options.wrapperClass).join(' ')),this.$wrapper.addClass(p.call(this,y).join(' ')),this.options.wrapperClass=y,this.$element}},{key:'radioAllOff',value:function(z){if('undefined'==typeof z)return this.options.radioAllOff;var A=!!z;return this.options.radioAllOff===A?this.$element:(this.options.radioAllOff=A,this.$element)}},{key:'onInit',value:function(z){return'undefined'==typeof z?this.options.onInit:(this.options.onInit=z||u.fn.bootstrapSwitch.defaults.onInit,this.$element)}},{key:'onSwitchChange',value:function(z){return'undefined'==typeof z?this.options.onSwitchChange:(this.options.onSwitchChange=z||u.fn.bootstrapSwitch.defaults.onSwitchChange,this.$element)}},{key:'destroy',value:function(){var z=this.$element.closest('form');return z.length&&z.off('reset.bootstrapSwitch').removeData('bootstrap-switch'),this.$container.children().not(this.$element).remove(),this.$element.unwrap().unwrap().off('.bootstrapSwitch').removeData('bootstrap-switch'),this.$element}}]),x}();u.fn.bootstrapSwitch=function(x){for(var z=arguments.length,A=Array(1<z?z-1:0),B=1;B<z;B++)A[B-1]=arguments[B];return Array.prototype.reduce.call(this,function(C,D){var E=u(D),F=E.data('bootstrap-switch'),G=F||new w(D,x);return F||E.data('bootstrap-switch',G),'string'==typeof x?G[x].apply(G,A):C},this)},u.fn.bootstrapSwitch.Constructor=w,u.fn.bootstrapSwitch.defaults={state:!0,size:null,animate:!0,disabled:!1,readonly:!1,indeterminate:!1,inverse:!1,radioAllOff:!1,onColor:'primary',offColor:'default',onText:'ON',offText:'OFF',labelText:' ',handleWidth:'auto',labelWidth:'auto',baseClass:'bootstrap-switch',wrapperClass:'wrapper',onInit:function(){},onSwitchChange:function(){}}});
|
@@ -4,4 +4,3 @@
|
|
4
4
|
* Licensed under MIT (https://github.com/Johann-S/bs-custom-file-input/blob/master/LICENSE)
|
5
5
|
*/
|
6
6
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.bsCustomFileInput=t()}(this,function(){"use strict";var d={CUSTOMFILE:'.custom-file input[type="file"]',CUSTOMFILELABEL:".custom-file-label",FORM:"form",INPUT:"input"},r=function(e){if(0<e.childNodes.length)for(var t=[].slice.call(e.childNodes),n=0;n<t.length;n++){var r=t[n];if(3!==r.nodeType)return r}return e},u=function(e){var t=e.bsCustomFileInput.defaultText,n=e.parentNode.querySelector(d.CUSTOMFILELABEL);n&&(r(n).innerHTML=t)},n=!!window.File,l=function(e){if(e.hasAttribute("multiple")&&n)return[].slice.call(e.files).map(function(e){return e.name}).join(", ");if(-1===e.value.indexOf("fakepath"))return e.value;var t=e.value.split("\\");return t[t.length-1]};function v(){var e=this.parentNode.querySelector(d.CUSTOMFILELABEL);if(e){var t=r(e),n=l(this);n.length?t.innerHTML=n:u(this)}}function p(){for(var e=[].slice.call(this.querySelectorAll(d.INPUT)).filter(function(e){return!!e.bsCustomFileInput}),t=0,n=e.length;t<n;t++)u(e[t])}var m="bsCustomFileInput",L="reset",h="change";return{init:function(e,t){void 0===e&&(e=d.CUSTOMFILE),void 0===t&&(t=d.FORM);for(var n,r,l,i=[].slice.call(document.querySelectorAll(e)),o=[].slice.call(document.querySelectorAll(t)),u=0,c=i.length;u<c;u++){var f=i[u];Object.defineProperty(f,m,{value:{defaultText:(n=f,r=void 0,void 0,r="",l=n.parentNode.querySelector(d.CUSTOMFILELABEL),l&&(r=l.innerHTML),r)},writable:!0}),f.addEventListener(h,v)}for(var a=0,s=o.length;a<s;a++)o[a].addEventListener(L,p),Object.defineProperty(o[a],m,{value:!0,writable:!0})},destroy:function(){for(var e=[].slice.call(document.querySelectorAll(d.FORM)).filter(function(e){return!!e.bsCustomFileInput}),t=[].slice.call(document.querySelectorAll(d.INPUT)).filter(function(e){return!!e.bsCustomFileInput}),n=0,r=t.length;n<r;n++){var l=t[n];u(l),l[m]=void 0,l.removeEventListener(h,v)}for(var i=0,o=e.length;i<o;i++)e[i].removeEventListener(L,p),e[i][m]=void 0}}});
|
7
|
-
//# sourceMappingURL=bs-custom-file-input.min.js.map
|