mirror of
https://github.com/wintercms/winter.git
synced 2024-06-28 05:33:29 +02:00
Split input controls to their own docs
This commit is contained in:
parent
8a12b2f37f
commit
c1a9cbb2f2
15
modules/system/assets/ui/docs/input.hotkey.md
Normal file
15
modules/system/assets/ui/docs/input.hotkey.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Input Hotkey API
|
||||
|
||||
Scripts that manage user input events.
|
||||
|
||||
# Example
|
||||
|
||||
<button data-hotkey="b" onclick="alert('B is for Banana!')">
|
||||
Press "B" on your keyboard
|
||||
</button>
|
||||
|
||||
<button data-hotkey="shift+r" onclick="confirm('Shift gears...?')">
|
||||
Press "Shift + R" on your keyboard
|
||||
</button>
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
# Input
|
||||
|
||||
Scripts that manage user input events.
|
||||
|
||||
# Example
|
||||
|
||||
<h4>Example: input.hotkey</h4>
|
||||
|
||||
<button data-hotkey="b" onclick="alert('B is for Banana!')">
|
||||
Press "B" on your keyboard
|
||||
</button>
|
||||
|
||||
<button data-hotkey="shift+r" onclick="confirm('Shift gears...?')">
|
||||
Press "Shift + R" on your keyboard
|
||||
</button>
|
||||
|
||||
<!-----------------------------------------------------------------><hr />
|
||||
|
||||
<h4>Example: input.preset</h4>
|
||||
|
||||
<input type="text" id="presetExample1" placeholder="Type something" />
|
||||
<input type="text"
|
||||
data-input-preset="#presetExample1"
|
||||
placeholder="Watch here"
|
||||
disabled />
|
||||
|
||||
<!-----------------------------------------------------------------><hr />
|
||||
|
||||
<h4>Example: input.trigger</h4>
|
||||
|
||||
<input type="checkbox" id="triggerChk1" />
|
||||
<button class="btn disabled"
|
||||
data-trigger-action="enable"
|
||||
data-trigger="#triggerChk1"
|
||||
data-trigger-condition="checked">
|
||||
Check the checkbox
|
||||
</button>
|
||||
|
||||
<!-----------------------------------------------------------------><hr />
|
||||
|
||||
<h4>Example: input.monitor</h4>
|
||||
|
6
modules/system/assets/ui/docs/input.monitor.md
Normal file
6
modules/system/assets/ui/docs/input.monitor.md
Normal file
@ -0,0 +1,6 @@
|
||||
# Input Monitoring
|
||||
|
||||
Scripts that manage user input events.
|
||||
|
||||
# Example
|
||||
|
11
modules/system/assets/ui/docs/input.preset.md
Normal file
11
modules/system/assets/ui/docs/input.preset.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Input Preset API
|
||||
|
||||
Scripts that manage user input events.
|
||||
|
||||
# Example
|
||||
|
||||
<input type="text" id="presetExample1" placeholder="Type something" />
|
||||
<input type="text"
|
||||
data-input-preset="#presetExample1"
|
||||
placeholder="Watch here"
|
||||
disabled />
|
50
modules/system/assets/ui/docs/input.trigger.md
Normal file
50
modules/system/assets/ui/docs/input.trigger.md
Normal file
@ -0,0 +1,50 @@
|
||||
# Input Trigger API
|
||||
|
||||
The API allows to change elements' visibility or status (enabled/disabled) basing on other elements' statuses. Example: enable a button if any checkbox inside another element is checked.
|
||||
|
||||
### Supported data attributes:
|
||||
|
||||
- data-trigger-action, values: show, hide, enable, disable, empty
|
||||
- data-trigger: a CSS selector for elements that trigger the action (checkboxes)
|
||||
- data-trigger-condition, values:
|
||||
- checked: determines the condition the elements specified in the data-trigger should satisfy in order the condition to be considered as "true".
|
||||
- value[somevalue]: determines if the value of data-trigger equals the specified value (somevalue) the condition is considered "true".
|
||||
- data-trigger-closest-parent: optional, specifies a CSS selector for a closest common parent for the source and destination input elements.
|
||||
|
||||
Example code:
|
||||
|
||||
<input type="button" class="btn disabled"
|
||||
data-trigger-action="enable"
|
||||
data-trigger="#cblist input[type=checkbox]"
|
||||
data-trigger-condition="checked" ... >
|
||||
|
||||
### Supported events:
|
||||
|
||||
- oc.triggerOn.update - triggers the update. Trigger this event on the element the plugin is bound to to
|
||||
force it to check the condition and update itself. This is useful when the page content is updated with AJAX.
|
||||
|
||||
### JavaScript API:
|
||||
|
||||
$('#mybutton').triggerOn({
|
||||
triggerCondition: 'checked',
|
||||
trigger: '#cblist input[type=checkbox]',
|
||||
triggerAction: 'enable'
|
||||
})
|
||||
|
||||
# Example
|
||||
|
||||
<input type="checkbox" id="triggerChk1" />
|
||||
<button class="btn disabled"
|
||||
data-trigger-action="enable"
|
||||
data-trigger="#triggerChk1"
|
||||
data-trigger-condition="checked">
|
||||
Check the checkbox
|
||||
</button>
|
||||
|
||||
<input type="text" id="triggerTxt1" value="" placeholder="Enter 'foo' or 'bar' here" />
|
||||
<button class="btn disabled"
|
||||
data-trigger-action="enable"
|
||||
data-trigger="#triggerTxt1"
|
||||
data-trigger-condition="value[foo][bar]">
|
||||
Passphrase valid!
|
||||
</button>
|
@ -78,13 +78,10 @@
|
||||
this.updateTarget($(this.options.trigger + ':checked', this.triggerParent).length > 0)
|
||||
}
|
||||
else if (this.triggerCondition == 'value') {
|
||||
var trigger = $(this.options.trigger + ':checked', this.triggerParent);
|
||||
if (trigger.length) {
|
||||
this.updateTarget(trigger.val() == this.triggerConditionValue)
|
||||
}
|
||||
else {
|
||||
this.updateTarget($(this.options.trigger, this.triggerParent).val() == this.triggerConditionValue)
|
||||
}
|
||||
var trigger = $(this.options.trigger + ':checked', this.triggerParent),
|
||||
needle = trigger.length ? trigger.val() : $(this.options.trigger, this.triggerParent).val()
|
||||
|
||||
this.updateTarget($.inArray(needle, this.triggerConditionValue) != -1)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user