saasufy-components 5.0.2 → 5.1.1

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
@@ -286,6 +286,10 @@ Can also perform basic CRUD operations such as deleting or creating records by l
286
286
  </div>
287
287
  </template>
288
288
 
289
+ <template slot="no-item">
290
+ <div>There are no messages.</div>
291
+ </template>
292
+
289
293
  <template slot="loader">
290
294
  <div class="loading-spinner-container">
291
295
  <div class="spinning">&#8635;</div>
@@ -296,6 +300,13 @@ Can also perform basic CRUD operations such as deleting or creating records by l
296
300
  </collection-viewer>
297
301
  ```
298
302
 
303
+ In addition to the slots shown above, the `collection-viewer` also supports the following optional slots:
304
+ - `previous-page`: This is typically an `input` element of type `button` for pagination.
305
+ - `next-page`: This is typically an `input` element of type `button` for pagination.
306
+ - `page-number`: This is typically a `div` element to display the current page number. Alternatively, it can be an `input-provider` element to allow the user to manually type in the page number.
307
+ - `first-item`: This should be a `template` element. It can be used to inject an element just above the first record. This can be useful to render the `collection-viewer` as a table with a heading above table rows.
308
+ - `last-item`: This should be a `template` element. It can be used to inject an element just after the last record.
309
+
299
310
  **Attributes**
300
311
 
301
312
  - `collection-type` (required): Specifies the type of collection to display. This should match a `Model` available in your Saasufy service.
@@ -380,6 +391,7 @@ This component is similar to the `collection-adder` component except that it req
380
391
  - `model-values`: An optional list of key-value pairs in the format `field1=value1,field2=value2` to add to the newly created resource alongside the values collected from the user via the form. For non-string values, the type should be provided in the format `fieldName:type=value`; supported types are `string`, `number` and `boolean`. Unlike `collection-fields` which are rendered as input elements in the form, `model-values` are not shown to the user.
381
392
  - `success-message`: A message to show the user if the resource has been successfully added to the collection after submitting the form.
382
393
  - `trim-spaces`: If this attribute exists on the element, then leading and trailing spaces will be trimmed from each input element's value before submitting the form.
394
+ - `auto-reset-hidden-inputs`: If this attribute exists, then `hidden` input elements which are inside the `collection-adder-form` will be cleared along with other input fields. By default, `hidden` input elements are not cleared when the form is reset.
383
395
 
384
396
  **Attributes of slotted input, select, textarea... elements**
385
397
 
@@ -155,7 +155,7 @@ class CollectionAdderForm extends SocketConsumer {
155
155
  if (element.nodeName === 'INPUT') {
156
156
  if (element.type === 'checkbox' || element.type === 'radio') {
157
157
  element.checked = false;
158
- } else {
158
+ } else if (element.type !== 'hidden' || this.hasAttribute('auto-reset-hidden-inputs')) {
159
159
  element.value = '';
160
160
  }
161
161
  } else if (element.nodeName === 'TEXTAREA') {
package/input-provider.js CHANGED
@@ -116,6 +116,7 @@ class InputProvider extends HTMLElement {
116
116
  let height = this.getAttribute('height');
117
117
  let value = this.getAttribute('value') || '';
118
118
  let inputProps = this.getAttribute('input-props');
119
+ let name = this.getAttribute('name');
119
120
 
120
121
  let elementType;
121
122
  if (type === 'select') {
@@ -160,6 +161,9 @@ class InputProvider extends HTMLElement {
160
161
  if (placeholder) {
161
162
  this.inputElement.setAttribute('placeholder', placeholder);
162
163
  }
164
+ if (name) {
165
+ this.inputElement.setAttribute('name', name);
166
+ }
163
167
  if (inputProps) {
164
168
  let {
165
169
  fieldNames: attrNames,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "5.0.2",
3
+ "version": "5.1.1",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {