saasufy-components 3.1.5 → 3.2.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
@@ -226,6 +226,7 @@ Can also perform basic CRUD operations such as deleting or creating records by l
226
226
  - `collection-view-params` (required): Parameters for the view, specified as comma-separated key-value pairs (e.g., key1=value1,key2=value2). These parameters can customize the behavior of the collection view. The keys must match `paramFields` specified in your Saasufy service under the relevant `View`.
227
227
  - `collection-page-size`: Sets how many items from the collection are displayed at once. This is useful for pagination, allowing users to navigate through large sets of data in chunks.
228
228
  - `collection-page-offset`: Indicates the current page offset in the collection's data. It’s like telling the browser which page of data you want to display initially.
229
+ - `collection-get-count`: If this attribute is present, the component will get the record count of the target view. The count can be rendered into the template by prefixing the model name with a dollar sign and accessing the `count` property like this: `{{$MyModelName.count}}`.
229
230
  - `type-alias`: Allows you to provide an alternative name for your `Model` to use when injecting values inside the template. This is useful for situations where you may have multiple `collection-browser` elements and/or `model-viewer` elements of the same type nested inside each other and want to avoid `Model` name clashes in the nested template definitions. For example, if the `type-alias` in the snippet above was set to `SubChat`, then `{{Chat.message}}` would become `{{SubChat.message}}`.
230
231
  - `hide-error-logs`: A flag which, when present, suppresses error logs from being printed to the console.
231
232
  - `max-show-loader`: If this attribute is present, your slotted `loader` element will be shown as often as possible; this includes situations where the collection is merely refreshing itself. It is disabled by default.
@@ -369,6 +370,7 @@ In the example above, the name of the first element can be accessed with `{{Cate
369
370
  - `collection-view-params` (required): Parameters for the view, specified as comma-separated key-value pairs (e.g., key1=value1,key2=value2). These parameters can customize the behavior of the collection view. The keys must match `paramFields` specified in your Saasufy service under the relevant `View`.
370
371
  - `collection-page-size`: Sets how many items from the collection are displayed at once. This is useful for pagination, allowing users to navigate through large sets of data in chunks.
371
372
  - `collection-page-offset`: Indicates the current page offset in the collection's data. It’s like telling the browser which page of data you want to display initially.
373
+ - `collection-get-count`: If this attribute is present, the component will get the record count of the target view. The count can be rendered into the template by prefixing the model name with a dollar sign and accessing the `count` property like this: `{{$MyModelName.count}}`.
372
374
  - `type-alias`: Allows you to provide an alternative name for your `Model` to use when injecting values inside the template. This is useful for situations where you may have multiple `collection-browser` elements and/or `model-viewer` elements of the same type nested inside each other and want to avoid `Model` name clashes in the nested template definitions. For example, if the `type-alias` in the snippet above was set to `SubChat`, then `{{Chat.message}}` would become `{{SubChat.message}}`.
373
375
  - `hide-error-logs`: A flag which, when present, suppresses error logs from being printed to the console.
374
376
 
@@ -103,6 +103,7 @@ class CollectionBrowser extends SocketConsumer {
103
103
  'collection-view-params',
104
104
  'collection-page-size',
105
105
  'collection-page-offset',
106
+ 'collection-get-count',
106
107
  'max-show-loader',
107
108
  'type-alias',
108
109
  'hide-error-logs'
@@ -203,7 +204,10 @@ class CollectionBrowser extends SocketConsumer {
203
204
  for (let modelItem of this.collection.value) {
204
205
  let itemString = renderTemplate(
205
206
  itemTemplate.innerHTML,
206
- { [type]: modelItem },
207
+ {
208
+ [type]: modelItem,
209
+ [`$${type}`]: this.collection.meta
210
+ },
207
211
  this.socket
208
212
  );
209
213
  items.push(itemString);
@@ -222,6 +226,7 @@ class CollectionBrowser extends SocketConsumer {
222
226
  let collectionPageSize = this.getAttribute('collection-page-size');
223
227
  let collectionViewParams = this.getAttribute('collection-view-params') || '';
224
228
  let collectionPageOffset = this.getAttribute('collection-page-offset');
229
+ let collectionGetCount = this.hasAttribute('collection-get-count');
225
230
  let hideErrorLogs = this.hasAttribute('hide-error-logs');
226
231
  let collectionReloadDelay = Number(
227
232
  this.getAttribute('collection-reload-delay') || DEFAULT_RELOAD_DELAY
@@ -239,7 +244,8 @@ class CollectionBrowser extends SocketConsumer {
239
244
  viewParams,
240
245
  pageSize: Number(collectionPageSize || 10),
241
246
  pageOffset: Number(collectionPageOffset || 0),
242
- changeReloadDelay: collectionReloadDelay
247
+ changeReloadDelay: collectionReloadDelay,
248
+ getCount: collectionGetCount
243
249
  });
244
250
 
245
251
  this.shadowRoot.innerHTML = `
@@ -74,6 +74,7 @@ class CollectionReducer extends SocketConsumer {
74
74
  'collection-view-params',
75
75
  'collection-page-size',
76
76
  'collection-page-offset',
77
+ 'collection-get-count',
77
78
  'max-show-loader',
78
79
  'type-alias',
79
80
  'hide-error-logs'
@@ -165,7 +166,7 @@ class CollectionReducer extends SocketConsumer {
165
166
  let type = this.getAttribute('type-alias') || this.collection.type;
166
167
  let itemString = renderTemplate(
167
168
  itemTemplate.innerHTML,
168
- { [type]: this.collection.value },
169
+ { [type]: this.collection.value, [`$${type}`]: this.collection.meta },
169
170
  this.socket
170
171
  );
171
172
  viewportNode.innerHTML = itemString;
@@ -179,6 +180,7 @@ class CollectionReducer extends SocketConsumer {
179
180
  let collectionPageSize = this.getAttribute('collection-page-size');
180
181
  let collectionViewParams = this.getAttribute('collection-view-params') || '';
181
182
  let collectionPageOffset = this.getAttribute('collection-page-offset');
183
+ let collectionGetCount = this.hasAttribute('collection-get-count');
182
184
  let hideErrorLogs = this.hasAttribute('hide-error-logs');
183
185
  let collectionReloadDelay = Number(
184
186
  this.getAttribute('collection-reload-delay') || DEFAULT_RELOAD_DELAY
@@ -196,7 +198,8 @@ class CollectionReducer extends SocketConsumer {
196
198
  viewParams,
197
199
  pageSize: Number(collectionPageSize || 10),
198
200
  pageOffset: Number(collectionPageOffset || 0),
199
- changeReloadDelay: collectionReloadDelay
201
+ changeReloadDelay: collectionReloadDelay,
202
+ getCount: collectionGetCount
200
203
  });
201
204
 
202
205
  this.shadowRoot.innerHTML = `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "3.1.5",
3
+ "version": "3.2.0",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/styles.css CHANGED
@@ -1,5 +1,6 @@
1
1
  body {
2
2
  margin: 0;
3
+ font-family: Arial, Helvetica, sans-serif;
3
4
  }
4
5
 
5
6
  a {