simplyflow 0.2.2 → 0.2.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/package.json +1 -1
- package/src/bind.mjs +4 -4
- package/src/model.mjs +5 -4
package/package.json
CHANGED
package/src/bind.mjs
CHANGED
|
@@ -25,7 +25,7 @@ class SimplyBind {
|
|
|
25
25
|
const getBindingAttribute = (el) => {
|
|
26
26
|
const foundAttribute = bindAttributes.find(attr => el.hasAttribute(attr))
|
|
27
27
|
if (!foundAttribute) {
|
|
28
|
-
console.error('No matching attribute found',el)
|
|
28
|
+
console.error('No matching attribute found',el,attr)
|
|
29
29
|
}
|
|
30
30
|
return foundAttribute
|
|
31
31
|
}
|
|
@@ -119,7 +119,7 @@ class SimplyBind {
|
|
|
119
119
|
updateBindings(changes)
|
|
120
120
|
})
|
|
121
121
|
|
|
122
|
-
this.observer.observe(options.container, {
|
|
122
|
+
this.observer.observe(this.options.container, {
|
|
123
123
|
subtree: true,
|
|
124
124
|
childList: true
|
|
125
125
|
})
|
|
@@ -364,7 +364,7 @@ export function defaultListTransformer(context) {
|
|
|
364
364
|
const attribute = this.options.attribute
|
|
365
365
|
|
|
366
366
|
if (!Array.isArray(value)) {
|
|
367
|
-
console.error('Value is not an array.', el, value)
|
|
367
|
+
console.error('Value is not an array.', el, path, value)
|
|
368
368
|
} else if (!templates?.length) {
|
|
369
369
|
console.error('No templates found in', el)
|
|
370
370
|
} else {
|
|
@@ -382,7 +382,7 @@ export function defaultMapTransformer(context) {
|
|
|
382
382
|
const attribute = this.options.attribute
|
|
383
383
|
|
|
384
384
|
if (typeof value != 'object') {
|
|
385
|
-
console.error('Value is not an object.', el, value)
|
|
385
|
+
console.error('Value is not an object.', el, path, value)
|
|
386
386
|
} else if (!templates?.length) {
|
|
387
387
|
console.error('No templates found in', el)
|
|
388
388
|
} else {
|
package/src/model.mjs
CHANGED
|
@@ -141,18 +141,19 @@ export function filter(options) {
|
|
|
141
141
|
if (!options?.name || typeof options.name!=='string') {
|
|
142
142
|
throw new Error('filter requires options.name to be a string')
|
|
143
143
|
}
|
|
144
|
-
if (this.state.options[options.name]) {
|
|
145
|
-
throw new Error('a filter with this name already exists on this model')
|
|
146
|
-
}
|
|
147
144
|
if (!options.matches || typeof options.matches!=='function') {
|
|
148
145
|
throw new Error('filter requires options.matches to be a function')
|
|
149
146
|
}
|
|
150
147
|
return function(data) {
|
|
148
|
+
if (this.state.options[options.name]) {
|
|
149
|
+
throw new Error('a filter with this name already exists on this model')
|
|
150
|
+
}
|
|
151
151
|
this.state.options[options.name] = options
|
|
152
152
|
return effect(() => {
|
|
153
153
|
if (this.state.options[options.name].enabled) {
|
|
154
|
-
return data.filter(this.state.options[options.name].matches)
|
|
154
|
+
return data.current.filter(this.state.options[options.name].matches.bind(this))
|
|
155
155
|
}
|
|
156
|
+
return data.current
|
|
156
157
|
})
|
|
157
158
|
}
|
|
158
159
|
}
|