saasufy-components 4.4.0 → 4.5.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.
package/README.md CHANGED
@@ -532,6 +532,7 @@ Used for displaying and editing a single field of a model instance in real time.
532
532
  - `model-id` (required): The id of the model instance/record to bind to.
533
533
  - `model-field` (required): The field of the model instance/record to bind to for reading and updating.
534
534
  - `debounce-delay`: The delay in milliseconds to wait before sending an update to the server. This is useful to batch multiple updates together (as is common when user is typing). Default is 300ms.
535
+ - `disable-instant-flush`: If specified, changes will only be saved once they have settled (E.g. after the element has lost focus or when the enter key is pressed).
535
536
  - `list`: If specified, this sets the list attribute of the inner `input` element to provide input suggestions (only works with standard input elements).
536
537
  - `type`: The type of the input component; can be `text`, `number`, `select`, `textarea`, `checkbox` or `file`.
537
538
  - `placeholder`: Can be used to set the placeholder text on the inner input element.
@@ -650,6 +651,7 @@ This component can be configured to provide its data to multiple components (con
650
651
  - `input-id`: Can be used to set an `id` attribute on the inner `input` element.
651
652
  - `list`: If specified, this sets the list attribute of the inner `input` element to provide input suggestions (only works with standard input elements).
652
653
  - `type`: The type of the input component; can be `text`, `number`, `select`, `textarea` or `checkbox`.
654
+ - `disable-instant-flush`: If specified, changes will only be saved once they have settled (E.g. after the element has lost focus or when the enter key is pressed).
653
655
  - `placeholder`: Can be used to set the placeholder text on the inner input element.
654
656
  - `consumers`: This allows you to connect this `input-provider` to other elements on your page. It takes a list of selectors with optional attributes to target in the format `element-selector:attribute-name`. For example `.my-input:value` will find all elements with a `my-input` class and update their `value` attributes with the value of the `input-provider` component in real-time. You can specify multiple selectors separated by commas such as `.my-input,my-div`; in this case, because attribute names are not specified, values will be injected into the `value` attribute (for input elements) or into the `innerHTML` property (for other kinds of elements). The default attribute/property depends on the element type.
655
657
  - `provider-template`: A template string within which the `{{value}}` can be injected before passing to consumers.
package/input-provider.js CHANGED
@@ -222,6 +222,7 @@ class InputProvider extends HTMLElement {
222
222
  if (inputElement.type !== 'checkbox') {
223
223
  onInputKeyUp = async (event) => {
224
224
  this.updateInputClassList(event.target.value);
225
+ if (this.hasAttribute('disable-instant-flush')) return;
225
226
  debounce(async () => {
226
227
  let elementName = this.getAttribute('name');
227
228
  let providerTemplate = this.getAttribute('provider-template');
package/model-input.js CHANGED
@@ -395,6 +395,7 @@ class ModelInput extends SocketConsumer {
395
395
  if (inputType !== 'checkbox' && inputType !== 'select' && inputType !== 'file') {
396
396
  onInputKeyUp = async (event) => {
397
397
  inputElement.classList.remove(successStyleClass);
398
+ if (this.hasAttribute('disable-instant-flush')) return;
398
399
  debounce(async () => {
399
400
  if (event.target.value === String(model.value[fieldName] || '')) return;
400
401
  let providerTemplate = this.getAttribute('provider-template');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {