kui-utils 0.0.6 → 0.0.8

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/cjs/index.js CHANGED
@@ -2118,6 +2118,10 @@ var Paginator = /** @class */ (function () {
2118
2118
  this.stopFetching = function () {
2119
2119
  _this.isFetching = false;
2120
2120
  };
2121
+ this.refresh = function () {
2122
+ _this.clearOffset();
2123
+ _this.startFetching();
2124
+ };
2121
2125
  this.limit = limit;
2122
2126
  this.offset = 0;
2123
2127
  this.isFinishPage = false;
@@ -2128,7 +2132,7 @@ var Paginator = /** @class */ (function () {
2128
2132
  }());
2129
2133
 
2130
2134
  var SortingFilter = /** @class */ (function () {
2131
- function SortingFilter() {
2135
+ function SortingFilter(orderBy, filterQuery) {
2132
2136
  var _this = this;
2133
2137
  this.updateSearchQuery = function (newQuery) {
2134
2138
  _this.searchQuery = newQuery;
@@ -2143,9 +2147,9 @@ var SortingFilter = /** @class */ (function () {
2143
2147
  _this.orderBy = orderBy;
2144
2148
  };
2145
2149
  this.searchQuery = "";
2146
- this.filterQuery = "";
2150
+ this.filterQuery = filterQuery || "";
2147
2151
  this.order = "asc";
2148
- this.orderBy = "";
2152
+ this.orderBy = orderBy || "";
2149
2153
  mobx.makeAutoObservable(this);
2150
2154
  }
2151
2155
  Object.defineProperty(SortingFilter.prototype, "searchParams", {
@@ -2159,7 +2163,11 @@ var SortingFilter = /** @class */ (function () {
2159
2163
  });
2160
2164
  Object.defineProperty(SortingFilter.prototype, "orderParams", {
2161
2165
  get: function () {
2162
- return this.orderBy ? "&ordering=".concat(this.orderBy) : "";
2166
+ if (this.orderBy) {
2167
+ var order = this.order === "desc" ? "-" : "";
2168
+ return "&ordering=".concat(order).concat(this.orderBy);
2169
+ }
2170
+ return "";
2163
2171
  },
2164
2172
  enumerable: false,
2165
2173
  configurable: true
@@ -2254,6 +2262,30 @@ var MultistepForm = /** @class */ (function () {
2254
2262
  return MultistepForm;
2255
2263
  }());
2256
2264
 
2265
+ var Editor = /** @class */ (function () {
2266
+ function Editor() {
2267
+ var _this = this;
2268
+ this.startEditing = function () {
2269
+ _this.isEditing = true;
2270
+ _this.blockToSendForm();
2271
+ };
2272
+ this.endEditing = function () {
2273
+ _this.isEditing = false;
2274
+ _this.blockToSendForm();
2275
+ };
2276
+ this.allowToSendForm = function () {
2277
+ _this.isAllowedToSendForm = true;
2278
+ };
2279
+ this.blockToSendForm = function () {
2280
+ _this.isAllowedToSendForm = false;
2281
+ };
2282
+ this.isEditing = false;
2283
+ this.isAllowedToSendForm = false;
2284
+ mobx.makeAutoObservable(this);
2285
+ }
2286
+ return Editor;
2287
+ }());
2288
+
2257
2289
  var phoneRegExp = /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;
2258
2290
  var isValidWithMaskExp = /^[^_]+$/;
2259
2291
  var dateRegExp = /(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d/;
@@ -2269,6 +2301,7 @@ var simplePasswordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{10,
2269
2301
  var mediumPasswordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{12,}$/;
2270
2302
  var strongPasswordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{14,}$/;
2271
2303
 
2304
+ exports.Editor = Editor;
2272
2305
  exports.Loader = Loader;
2273
2306
  exports.MultistepForm = MultistepForm;
2274
2307
  exports.Paginator = Paginator;