cotomy 0.3.1 → 0.3.2
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/LICENSE +20 -20
- package/README.md +303 -302
- package/dist/browser/cotomy.js +12 -4
- package/dist/browser/cotomy.js.map +1 -1
- package/dist/browser/cotomy.min.js +1 -1
- package/dist/browser/cotomy.min.js.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/form.js +3 -3
- package/dist/esm/view.js +8 -0
- package/dist/esm/view.js.map +1 -1
- package/dist/types/view.d.ts +2 -0
- package/package.json +61 -61
package/dist/browser/cotomy.js
CHANGED
|
@@ -174,7 +174,7 @@ module.exports = cuid;
|
|
|
174
174
|
/***/ 826:
|
|
175
175
|
/***/ (function(module) {
|
|
176
176
|
|
|
177
|
-
!function(t,i){ true?module.exports=i():0}(this,(function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var
|
|
177
|
+
!function(t,i){ true?module.exports=i():0}(this,(function(){"use strict";var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var r=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),r.call(this,t)};var o=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else o.call(this)};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s;if(0===u)return this.utc(f);var r=this.clone();if(f)return r.$offset=u,r.$u=!1,r;var o=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(r=this.local().add(u+o,t)).$offset=u,r.$x.$localOffset=o,r};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return"s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)}}}));
|
|
178
178
|
|
|
179
179
|
/***/ })
|
|
180
180
|
|
|
@@ -892,6 +892,10 @@ class CotomyElement {
|
|
|
892
892
|
const ctor = (type ?? CotomyElement);
|
|
893
893
|
return new ctor(element);
|
|
894
894
|
}
|
|
895
|
+
static last(selector, type) {
|
|
896
|
+
const elements = this.find(selector, type);
|
|
897
|
+
return elements.pop();
|
|
898
|
+
}
|
|
895
899
|
static find(selector, type) {
|
|
896
900
|
const elements = document.querySelectorAll(selector);
|
|
897
901
|
const ctor = (type ?? CotomyElement);
|
|
@@ -1389,6 +1393,10 @@ class CotomyElement {
|
|
|
1389
1393
|
const elements = this.find(selector, type);
|
|
1390
1394
|
return elements.shift() ?? undefined;
|
|
1391
1395
|
}
|
|
1396
|
+
last(selector = "*", type) {
|
|
1397
|
+
const elements = this.find(selector, type);
|
|
1398
|
+
return elements.pop() ?? undefined;
|
|
1399
|
+
}
|
|
1392
1400
|
contains(selector) {
|
|
1393
1401
|
return this.find(selector).length > 0;
|
|
1394
1402
|
}
|
|
@@ -2651,7 +2659,7 @@ class CotomyEntityApiForm extends CotomyApiForm {
|
|
|
2651
2659
|
this.attribute("data-cotomy-entity-key", addedParts[0]);
|
|
2652
2660
|
}
|
|
2653
2661
|
else {
|
|
2654
|
-
const msg = `Location does not contain a single entity key segment.
|
|
2662
|
+
const msg = `Location does not contain a single entity key segment.
|
|
2655
2663
|
action="${baseAction}", location="${locPath}", added=["${addedParts.join('","')}"]`;
|
|
2656
2664
|
throw new Error(msg);
|
|
2657
2665
|
}
|
|
@@ -2741,8 +2749,8 @@ class CotomyEntityFillApiForm extends CotomyEntityApiForm {
|
|
|
2741
2749
|
}
|
|
2742
2750
|
}
|
|
2743
2751
|
applyValueToInputs(pname, value) {
|
|
2744
|
-
this.find(`input[name="${pname}" i]:not([data-cotomy-fill="false"]):not([multiple]),
|
|
2745
|
-
textarea[name="${pname}" i]:not([data-cotomy-fill="false"]),
|
|
2752
|
+
this.find(`input[name="${pname}" i]:not([data-cotomy-fill="false"]):not([multiple]),
|
|
2753
|
+
textarea[name="${pname}" i]:not([data-cotomy-fill="false"]),
|
|
2746
2754
|
select[name="${pname}" i]:not([data-cotomy-fill="false"]):not([multiple])`).forEach(input => {
|
|
2747
2755
|
if (CotomyDebugSettings.isEnabled(CotomyDebugFeature.Fill)) {
|
|
2748
2756
|
console.debug(`Filling input[name="${pname}"] with value:`, value);
|