saasufy-components 8.4.1 → 8.4.3

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
@@ -129,6 +129,12 @@ import {
129
129
  } from 'saasufy-components/utils.js';
130
130
  ```
131
131
 
132
+ A reference to a socket can be obtained from a `socket-provider` element like this:
133
+
134
+ ```javascript
135
+ let socket = document.querySelector('socket-provider').getSocket();
136
+ ```
137
+
132
138
  **Available functions:**
133
139
 
134
140
  - `getRecordIds({ socket, type, viewName, viewParams, startPage, maxPages, pageSize })`: Retrieves record IDs from a collection view across multiple pages. Returns an array of IDs.
@@ -139,8 +145,8 @@ import {
139
145
  **Example usage:**
140
146
  ```javascript
141
147
  // Process all products one by one without loading them all into memory at once
142
- const productGenerator = generateRecords({
143
- socket: mySocket,
148
+ let productGenerator = generateRecords({
149
+ socket,
144
150
  type: 'Product',
145
151
  viewName: 'alphabeticalView',
146
152
  viewParams: { category: 'electronics' },
@@ -156,6 +156,7 @@ class CollectionAdderForm extends SocketConsumer {
156
156
  }
157
157
  let consumers = this.getAttribute('consumers');
158
158
  let outcomeConsumers = this.getAttribute(outputValue.error ? 'error-consumers' : 'success-consumers');
159
+ let oppositeOutcomeConsumers = this.getAttribute(outputValue.error ? 'success-consumers' : 'error-consumers');
159
160
  if (consumers) {
160
161
  if (outcomeConsumers) {
161
162
  consumers = `${consumers},${outcomeConsumers}`;
@@ -164,7 +165,9 @@ class CollectionAdderForm extends SocketConsumer {
164
165
  consumers = outcomeConsumers;
165
166
  }
166
167
  let providerTemplate = this.getAttribute('provider-template');
167
- updateConsumerElements(consumers, outputValue, providerTemplate, this.getAttribute('name'));
168
+ let selfName = this.getAttribute('name');
169
+ updateConsumerElements(consumers, outputValue, providerTemplate, selfName);
170
+ updateConsumerElements(oppositeOutcomeConsumers, '', null, selfName);
168
171
  }
169
172
 
170
173
  getAllInputElements() {
@@ -150,6 +150,7 @@ class CollectionAdder extends SocketConsumer {
150
150
  }
151
151
  let consumers = this.getAttribute('consumers');
152
152
  let outcomeConsumers = this.getAttribute(outputValue.error ? 'error-consumers' : 'success-consumers');
153
+ let oppositeOutcomeConsumers = this.getAttribute(outputValue.error ? 'success-consumers' : 'error-consumers');
153
154
  if (consumers) {
154
155
  if (outcomeConsumers) {
155
156
  consumers = `${consumers},${outcomeConsumers}`;
@@ -158,7 +159,9 @@ class CollectionAdder extends SocketConsumer {
158
159
  consumers = outcomeConsumers;
159
160
  }
160
161
  let providerTemplate = this.getAttribute('provider-template');
161
- updateConsumerElements(consumers, outputValue, providerTemplate, this.getAttribute('name'));
162
+ let selfName = this.getAttribute('name');
163
+ updateConsumerElements(consumers, outputValue, providerTemplate, selfName);
164
+ updateConsumerElements(oppositeOutcomeConsumers, '', null, selfName);
162
165
  }
163
166
 
164
167
  reset() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "8.4.1",
3
+ "version": "8.4.3",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {