not-bulma 0.3.77 → 0.3.78
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/dist/notBulma.js +813 -722
- package/dist/notBulma.min.js +1 -1
- package/package.json +1 -1
- package/src/common.js +1 -0
- package/src/form/form.svelte +40 -51
- package/src/form.js +30 -19
- package/src/frame/validation/runner.js +1 -0
- package/src/ncCRUD.js +240 -240
- package/src/various/filter.svelte +0 -2
package/dist/notBulma.js
CHANGED
|
@@ -929,14 +929,14 @@ var notBulma = (function (exports) {
|
|
|
929
929
|
var concat$3 = functionUncurryThis([].concat);
|
|
930
930
|
|
|
931
931
|
// all object keys, includes non-enumerable and symbols
|
|
932
|
-
var ownKeys$
|
|
932
|
+
var ownKeys$5 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
933
933
|
var keys = objectGetOwnPropertyNames.f(anObject(it));
|
|
934
934
|
var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
|
935
935
|
return getOwnPropertySymbols ? concat$3(keys, getOwnPropertySymbols(it)) : keys;
|
|
936
936
|
};
|
|
937
937
|
|
|
938
938
|
var copyConstructorProperties = function (target, source) {
|
|
939
|
-
var keys = ownKeys$
|
|
939
|
+
var keys = ownKeys$5(source);
|
|
940
940
|
var defineProperty = objectDefineProperty.f;
|
|
941
941
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
942
942
|
for (var i = 0; i < keys.length; i++) {
|
|
@@ -2865,7 +2865,7 @@ var notBulma = (function (exports) {
|
|
|
2865
2865
|
getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
|
|
2866
2866
|
var O = toIndexedObject(object);
|
|
2867
2867
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
2868
|
-
var keys = ownKeys$
|
|
2868
|
+
var keys = ownKeys$5(O);
|
|
2869
2869
|
var result = {};
|
|
2870
2870
|
var index = 0;
|
|
2871
2871
|
var key, descriptor;
|
|
@@ -6655,9 +6655,9 @@ var notBulma = (function (exports) {
|
|
|
6655
6655
|
|
|
6656
6656
|
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
6657
6657
|
|
|
6658
|
-
function ownKeys$
|
|
6658
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6659
6659
|
|
|
6660
|
-
function _objectSpread$
|
|
6660
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { defineProperty$4(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6661
6661
|
/*
|
|
6662
6662
|
https://github.com/TehShrike/is-mergeable-object
|
|
6663
6663
|
|
|
@@ -7233,7 +7233,7 @@ var notBulma = (function (exports) {
|
|
|
7233
7233
|
targets = {}; //various collections
|
|
7234
7234
|
|
|
7235
7235
|
if (arguments.length == 1) {
|
|
7236
|
-
targets = _objectSpread$
|
|
7236
|
+
targets = _objectSpread$4({}, arguments[0]);
|
|
7237
7237
|
|
|
7238
7238
|
if (Object.hasOwnProperty.call(arguments[0], 'defaultConf')) {
|
|
7239
7239
|
defaultConf = arguments[0].defaultConf;
|
|
@@ -7465,17 +7465,17 @@ var notBulma = (function (exports) {
|
|
|
7465
7465
|
target.router.routes[routeType] = {};
|
|
7466
7466
|
}
|
|
7467
7467
|
|
|
7468
|
-
Object.assign(target.router.routes[routeType], _objectSpread$
|
|
7468
|
+
Object.assign(target.router.routes[routeType], _objectSpread$4({}, wscOptions.router.routes[routeType]));
|
|
7469
7469
|
}
|
|
7470
7470
|
}
|
|
7471
7471
|
}
|
|
7472
7472
|
|
|
7473
7473
|
if (Object.prototype.hasOwnProperty.call(wscOptions, 'messenger')) {
|
|
7474
|
-
Object.assign(target.messenger, _objectSpread$
|
|
7474
|
+
Object.assign(target.messenger, _objectSpread$4({}, wscOptions.messenger));
|
|
7475
7475
|
}
|
|
7476
7476
|
|
|
7477
7477
|
if (Object.prototype.hasOwnProperty.call(wscOptions, 'connection')) {
|
|
7478
|
-
Object.assign(target.connection, _objectSpread$
|
|
7478
|
+
Object.assign(target.connection, _objectSpread$4({}, wscOptions.connection));
|
|
7479
7479
|
}
|
|
7480
7480
|
|
|
7481
7481
|
for (var _i = 0, _arr = ['name', 'getToken', 'logger', 'identity', 'credentials']; _i < _arr.length; _i++) {
|
|
@@ -17334,6 +17334,148 @@ var notBulma = (function (exports) {
|
|
|
17334
17334
|
|
|
17335
17335
|
var validator = unwrapExports(validator_1);
|
|
17336
17336
|
|
|
17337
|
+
var UICommon = /*#__PURE__*/function () {
|
|
17338
|
+
function UICommon() {
|
|
17339
|
+
classCallCheck(this, UICommon);
|
|
17340
|
+
}
|
|
17341
|
+
|
|
17342
|
+
createClass(UICommon, null, [{
|
|
17343
|
+
key: "formatPhone",
|
|
17344
|
+
value:
|
|
17345
|
+
/**
|
|
17346
|
+
* Reformats input from any string to strict phone format
|
|
17347
|
+
* @param {string} phone free style phone number
|
|
17348
|
+
* @returns {string} phone number
|
|
17349
|
+
**/
|
|
17350
|
+
function formatPhone(val) {
|
|
17351
|
+
var filler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.FILLER;
|
|
17352
|
+
//starting from 11 digits in phone number
|
|
17353
|
+
var slots = [1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5];
|
|
17354
|
+
var digits = val.replace(/\D/g, ''); //if there are more, move them to country code slot
|
|
17355
|
+
|
|
17356
|
+
if (digits.length > 11) {
|
|
17357
|
+
var d = digits.length - 11;
|
|
17358
|
+
|
|
17359
|
+
while (d > 0) {
|
|
17360
|
+
d--;
|
|
17361
|
+
slots.unshift(1);
|
|
17362
|
+
}
|
|
17363
|
+
}
|
|
17364
|
+
|
|
17365
|
+
var stack = ['', '', '', '', ''];
|
|
17366
|
+
Array.from(digits).forEach(function (digit, index) {
|
|
17367
|
+
var slot = slots[index];
|
|
17368
|
+
stack[slot - 1] = stack[slot - 1] + digit;
|
|
17369
|
+
}); //creating map of parts lengths
|
|
17370
|
+
|
|
17371
|
+
var lens = slots.reduce(function (acc, curr) {
|
|
17372
|
+
if (typeof acc[curr] === 'undefined') {
|
|
17373
|
+
acc[curr] = 1;
|
|
17374
|
+
} else {
|
|
17375
|
+
acc[curr] += 1;
|
|
17376
|
+
}
|
|
17377
|
+
|
|
17378
|
+
return acc;
|
|
17379
|
+
}, {}); //fill empty positions with filler (_)
|
|
17380
|
+
|
|
17381
|
+
for (var t in stack) {
|
|
17382
|
+
var dif = lens[parseInt(t) + 1] - stack[t].length;
|
|
17383
|
+
|
|
17384
|
+
while (dif > 0) {
|
|
17385
|
+
stack[t] = stack[t] + filler;
|
|
17386
|
+
dif--;
|
|
17387
|
+
}
|
|
17388
|
+
}
|
|
17389
|
+
|
|
17390
|
+
return "+".concat(stack[0], " (").concat(stack[1], ") ").concat(stack[2], "-").concat(stack[3], "-").concat(stack[4]);
|
|
17391
|
+
}
|
|
17392
|
+
}, {
|
|
17393
|
+
key: "setMoneySign",
|
|
17394
|
+
value: function setMoneySign(val) {
|
|
17395
|
+
this.MONEY_SIGN = val;
|
|
17396
|
+
}
|
|
17397
|
+
}, {
|
|
17398
|
+
key: "formatPrice",
|
|
17399
|
+
value: function formatPrice(price) {
|
|
17400
|
+
var major = parseInt(Math.floor(price / 100)),
|
|
17401
|
+
minor = parseInt(price % 100);
|
|
17402
|
+
major = '' + major;
|
|
17403
|
+
return "".concat(this.MONEY_SIGN).concat(major, ".").concat(minor);
|
|
17404
|
+
}
|
|
17405
|
+
}, {
|
|
17406
|
+
key: "formatTimestamp",
|
|
17407
|
+
value: function formatTimestamp(timestamp) {
|
|
17408
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
17409
|
+
var offsetLocal = new Date().getTimezoneOffset();
|
|
17410
|
+
var deltaOffset = (offsetLocal - parseInt(offset)) * 60 * 1000;
|
|
17411
|
+
var localDateTime = new Date(parseInt(timestamp) - deltaOffset);
|
|
17412
|
+
return localDateTime.toLocaleString(window.navigator.language);
|
|
17413
|
+
}
|
|
17414
|
+
}, {
|
|
17415
|
+
key: "declOfNum",
|
|
17416
|
+
value: function declOfNum(n, text_forms) {
|
|
17417
|
+
n = Math.abs(n) % 100;
|
|
17418
|
+
var n1 = n % 10;
|
|
17419
|
+
|
|
17420
|
+
if (n > 10 && n < 20) {
|
|
17421
|
+
return text_forms[2];
|
|
17422
|
+
}
|
|
17423
|
+
|
|
17424
|
+
if (n1 > 1 && n1 < 5) {
|
|
17425
|
+
return text_forms[1];
|
|
17426
|
+
}
|
|
17427
|
+
|
|
17428
|
+
if (n1 == 1) {
|
|
17429
|
+
return text_forms[0];
|
|
17430
|
+
}
|
|
17431
|
+
|
|
17432
|
+
return text_forms[2];
|
|
17433
|
+
}
|
|
17434
|
+
}, {
|
|
17435
|
+
key: "humanizedTimeDiff",
|
|
17436
|
+
value: function humanizedTimeDiff(date
|
|
17437
|
+
/* unix time */
|
|
17438
|
+
) {
|
|
17439
|
+
var currentTime = new Date().getTime();
|
|
17440
|
+
var sec = Math.round((currentTime - date) / 1000);
|
|
17441
|
+
var unit;
|
|
17442
|
+
|
|
17443
|
+
if (sec < 60) {
|
|
17444
|
+
unit = this.declOfNum(sec, this.TIME.SECONDS);
|
|
17445
|
+
return "".concat(sec, " ").concat(unit, " \u043D\u0430\u0437\u0430\u0434");
|
|
17446
|
+
} else if (sec < 3600) {
|
|
17447
|
+
var min = Math.floor(sec / 60);
|
|
17448
|
+
unit = this.declOfNum(min, this.TIME.MINUTES);
|
|
17449
|
+
return "".concat(min, " ").concat(unit, " \u043D\u0430\u0437\u0430\u0434");
|
|
17450
|
+
} else {
|
|
17451
|
+
var hours = Math.floor(sec / (60 * 60));
|
|
17452
|
+
unit = this.declOfNum(hours, this.TIME.HOURS);
|
|
17453
|
+
return "".concat(hours, " ").concat(unit, " \u043D\u0430\u0437\u0430\u0434");
|
|
17454
|
+
}
|
|
17455
|
+
}
|
|
17456
|
+
}]);
|
|
17457
|
+
|
|
17458
|
+
return UICommon;
|
|
17459
|
+
}();
|
|
17460
|
+
|
|
17461
|
+
defineProperty$4(UICommon, "ERROR_DEFAULT", 'Что пошло не так.');
|
|
17462
|
+
|
|
17463
|
+
defineProperty$4(UICommon, "DEFAULT_REDIRECT_TIMEOUT", 3000);
|
|
17464
|
+
|
|
17465
|
+
defineProperty$4(UICommon, "CLASS_OK", 'is-success');
|
|
17466
|
+
|
|
17467
|
+
defineProperty$4(UICommon, "CLASS_ERR", 'is-danger');
|
|
17468
|
+
|
|
17469
|
+
defineProperty$4(UICommon, "FILLER", '_');
|
|
17470
|
+
|
|
17471
|
+
defineProperty$4(UICommon, "MONEY_SIGN", '₽');
|
|
17472
|
+
|
|
17473
|
+
defineProperty$4(UICommon, "TIME", {
|
|
17474
|
+
SECONDS: ['секунду', 'секунды', 'секунд'],
|
|
17475
|
+
MINUTES: ['минуту', 'минуты', 'минут'],
|
|
17476
|
+
HOURS: ['час', 'часа', 'часов']
|
|
17477
|
+
});
|
|
17478
|
+
|
|
17337
17479
|
/* src/form/ui.label.svelte generated by Svelte v3.44.2 */
|
|
17338
17480
|
|
|
17339
17481
|
function create_fragment$Z(ctx) {
|
|
@@ -18190,7 +18332,7 @@ var notBulma = (function (exports) {
|
|
|
18190
18332
|
return child_ctx;
|
|
18191
18333
|
}
|
|
18192
18334
|
|
|
18193
|
-
// (
|
|
18335
|
+
// (262:0) {:else}
|
|
18194
18336
|
function create_else_block$v(ctx) {
|
|
18195
18337
|
let t0;
|
|
18196
18338
|
let t1;
|
|
@@ -18361,7 +18503,7 @@ var notBulma = (function (exports) {
|
|
|
18361
18503
|
};
|
|
18362
18504
|
}
|
|
18363
18505
|
|
|
18364
|
-
// (
|
|
18506
|
+
// (258:0) {#if success}
|
|
18365
18507
|
function create_if_block$E(ctx) {
|
|
18366
18508
|
let div;
|
|
18367
18509
|
let h3;
|
|
@@ -18392,7 +18534,7 @@ var notBulma = (function (exports) {
|
|
|
18392
18534
|
};
|
|
18393
18535
|
}
|
|
18394
18536
|
|
|
18395
|
-
// (
|
|
18537
|
+
// (263:0) {#if title }
|
|
18396
18538
|
function create_if_block_15(ctx) {
|
|
18397
18539
|
let h5;
|
|
18398
18540
|
let t_value = /*$LOCALE*/ ctx[15][/*title*/ ctx[5]] + "";
|
|
@@ -18417,7 +18559,7 @@ var notBulma = (function (exports) {
|
|
|
18417
18559
|
};
|
|
18418
18560
|
}
|
|
18419
18561
|
|
|
18420
|
-
// (
|
|
18562
|
+
// (266:0) {#if description }
|
|
18421
18563
|
function create_if_block_14(ctx) {
|
|
18422
18564
|
let h6;
|
|
18423
18565
|
let t_value = /*$LOCALE*/ ctx[15][/*description*/ ctx[6]] + "";
|
|
@@ -18442,7 +18584,7 @@ var notBulma = (function (exports) {
|
|
|
18442
18584
|
};
|
|
18443
18585
|
}
|
|
18444
18586
|
|
|
18445
|
-
// (
|
|
18587
|
+
// (270:0) {#if options.buttonsFirst }
|
|
18446
18588
|
function create_if_block_10(ctx) {
|
|
18447
18589
|
let div;
|
|
18448
18590
|
let t0;
|
|
@@ -18523,7 +18665,7 @@ var notBulma = (function (exports) {
|
|
|
18523
18665
|
};
|
|
18524
18666
|
}
|
|
18525
18667
|
|
|
18526
|
-
// (
|
|
18668
|
+
// (272:1) {#if cancel.enabled}
|
|
18527
18669
|
function create_if_block_13(ctx) {
|
|
18528
18670
|
let button;
|
|
18529
18671
|
let t_value = /*$LOCALE*/ ctx[15][/*cancel*/ ctx[8].caption] + "";
|
|
@@ -18566,7 +18708,7 @@ var notBulma = (function (exports) {
|
|
|
18566
18708
|
};
|
|
18567
18709
|
}
|
|
18568
18710
|
|
|
18569
|
-
// (
|
|
18711
|
+
// (275:1) {#if submit.enabled}
|
|
18570
18712
|
function create_if_block_12(ctx) {
|
|
18571
18713
|
let button;
|
|
18572
18714
|
let t_value = /*$LOCALE*/ ctx[15][/*submit*/ ctx[7].caption] + "";
|
|
@@ -18614,7 +18756,7 @@ var notBulma = (function (exports) {
|
|
|
18614
18756
|
};
|
|
18615
18757
|
}
|
|
18616
18758
|
|
|
18617
|
-
// (
|
|
18759
|
+
// (280:0) {#if formErrors.length > 0 }
|
|
18618
18760
|
function create_if_block_11(ctx) {
|
|
18619
18761
|
let div;
|
|
18620
18762
|
let t_value = /*formErrors*/ ctx[12].join(', ') + "";
|
|
@@ -18639,7 +18781,7 @@ var notBulma = (function (exports) {
|
|
|
18639
18781
|
};
|
|
18640
18782
|
}
|
|
18641
18783
|
|
|
18642
|
-
// (
|
|
18784
|
+
// (306:0) {:else}
|
|
18643
18785
|
function create_else_block_2$2(ctx) {
|
|
18644
18786
|
let div;
|
|
18645
18787
|
let t0;
|
|
@@ -18672,7 +18814,7 @@ var notBulma = (function (exports) {
|
|
|
18672
18814
|
};
|
|
18673
18815
|
}
|
|
18674
18816
|
|
|
18675
|
-
// (
|
|
18817
|
+
// (302:0) {#if form[field] && form[field].component }
|
|
18676
18818
|
function create_if_block_8$1(ctx) {
|
|
18677
18819
|
let if_block_anchor;
|
|
18678
18820
|
let current;
|
|
@@ -18728,7 +18870,7 @@ var notBulma = (function (exports) {
|
|
|
18728
18870
|
};
|
|
18729
18871
|
}
|
|
18730
18872
|
|
|
18731
|
-
// (
|
|
18873
|
+
// (287:0) {#if Array.isArray(field) }
|
|
18732
18874
|
function create_if_block_5$6(ctx) {
|
|
18733
18875
|
let div;
|
|
18734
18876
|
let current;
|
|
@@ -18815,7 +18957,7 @@ var notBulma = (function (exports) {
|
|
|
18815
18957
|
};
|
|
18816
18958
|
}
|
|
18817
18959
|
|
|
18818
|
-
// (
|
|
18960
|
+
// (303:0) {#if form[field].visible}
|
|
18819
18961
|
function create_if_block_9$1(ctx) {
|
|
18820
18962
|
let uifield;
|
|
18821
18963
|
let current;
|
|
@@ -18862,7 +19004,7 @@ var notBulma = (function (exports) {
|
|
|
18862
19004
|
};
|
|
18863
19005
|
}
|
|
18864
19006
|
|
|
18865
|
-
// (
|
|
19007
|
+
// (296:1) {:else}
|
|
18866
19008
|
function create_else_block_1$3(ctx) {
|
|
18867
19009
|
let div;
|
|
18868
19010
|
let t0;
|
|
@@ -18895,7 +19037,7 @@ var notBulma = (function (exports) {
|
|
|
18895
19037
|
};
|
|
18896
19038
|
}
|
|
18897
19039
|
|
|
18898
|
-
// (
|
|
19040
|
+
// (290:1) {#if form[subfield] && form[subfield].component }
|
|
18899
19041
|
function create_if_block_6$3(ctx) {
|
|
18900
19042
|
let if_block_anchor;
|
|
18901
19043
|
let current;
|
|
@@ -18951,7 +19093,7 @@ var notBulma = (function (exports) {
|
|
|
18951
19093
|
};
|
|
18952
19094
|
}
|
|
18953
19095
|
|
|
18954
|
-
// (
|
|
19096
|
+
// (291:1) {#if form[subfield].visible }
|
|
18955
19097
|
function create_if_block_7$2(ctx) {
|
|
18956
19098
|
let div;
|
|
18957
19099
|
let uifield;
|
|
@@ -19013,7 +19155,7 @@ var notBulma = (function (exports) {
|
|
|
19013
19155
|
};
|
|
19014
19156
|
}
|
|
19015
19157
|
|
|
19016
|
-
// (
|
|
19158
|
+
// (289:1) {#each field as subfield }
|
|
19017
19159
|
function create_each_block_1$4(ctx) {
|
|
19018
19160
|
let current_block_type_index;
|
|
19019
19161
|
let if_block;
|
|
@@ -19083,7 +19225,7 @@ var notBulma = (function (exports) {
|
|
|
19083
19225
|
};
|
|
19084
19226
|
}
|
|
19085
19227
|
|
|
19086
|
-
// (
|
|
19228
|
+
// (286:0) {#each fields as field}
|
|
19087
19229
|
function create_each_block$g(ctx) {
|
|
19088
19230
|
let show_if;
|
|
19089
19231
|
let current_block_type_index;
|
|
@@ -19156,7 +19298,7 @@ var notBulma = (function (exports) {
|
|
|
19156
19298
|
};
|
|
19157
19299
|
}
|
|
19158
19300
|
|
|
19159
|
-
// (
|
|
19301
|
+
// (312:0) {#if !options.buttonsFirst }
|
|
19160
19302
|
function create_if_block_1$t(ctx) {
|
|
19161
19303
|
let t0;
|
|
19162
19304
|
let div;
|
|
@@ -19233,7 +19375,7 @@ var notBulma = (function (exports) {
|
|
|
19233
19375
|
};
|
|
19234
19376
|
}
|
|
19235
19377
|
|
|
19236
|
-
// (
|
|
19378
|
+
// (313:0) {#if formErrors.length > 0 }
|
|
19237
19379
|
function create_if_block_4$e(ctx) {
|
|
19238
19380
|
let div;
|
|
19239
19381
|
let t_value = /*formErrors*/ ctx[12].join(', ') + "";
|
|
@@ -19258,7 +19400,7 @@ var notBulma = (function (exports) {
|
|
|
19258
19400
|
};
|
|
19259
19401
|
}
|
|
19260
19402
|
|
|
19261
|
-
// (
|
|
19403
|
+
// (317:1) {#if cancel.enabled}
|
|
19262
19404
|
function create_if_block_3$i(ctx) {
|
|
19263
19405
|
let button;
|
|
19264
19406
|
let t_value = /*$LOCALE*/ ctx[15][/*cancel*/ ctx[8].caption] + "";
|
|
@@ -19301,7 +19443,7 @@ var notBulma = (function (exports) {
|
|
|
19301
19443
|
};
|
|
19302
19444
|
}
|
|
19303
19445
|
|
|
19304
|
-
// (
|
|
19446
|
+
// (320:1) {#if submit.enabled}
|
|
19305
19447
|
function create_if_block_2$k(ctx) {
|
|
19306
19448
|
let button;
|
|
19307
19449
|
let t_value = /*$LOCALE*/ ctx[15][/*submit*/ ctx[7].caption] + "";
|
|
@@ -19449,6 +19591,7 @@ var notBulma = (function (exports) {
|
|
|
19449
19591
|
let dispatch = createEventDispatcher();
|
|
19450
19592
|
let form = {};
|
|
19451
19593
|
let formErrors = [];
|
|
19594
|
+
let formHasErrors = false;
|
|
19452
19595
|
let fieldsHasErrors = false;
|
|
19453
19596
|
let success = false;
|
|
19454
19597
|
|
|
@@ -19553,20 +19696,6 @@ var notBulma = (function (exports) {
|
|
|
19553
19696
|
dispatch(`field.valid`, { fieldName });
|
|
19554
19697
|
}
|
|
19555
19698
|
|
|
19556
|
-
function fieldErrorsNotChanged(fieldName, errs) {
|
|
19557
|
-
let oldErrs = form[fieldName].errors;
|
|
19558
|
-
|
|
19559
|
-
if (oldErrs === false && errs === false) {
|
|
19560
|
-
return true;
|
|
19561
|
-
} else {
|
|
19562
|
-
if (Array.isArray(oldErrs) && Array.isArray(errs)) {
|
|
19563
|
-
return oldErrs.join('. ') === errs.join('. ');
|
|
19564
|
-
} else {
|
|
19565
|
-
return false;
|
|
19566
|
-
}
|
|
19567
|
-
}
|
|
19568
|
-
}
|
|
19569
|
-
|
|
19570
19699
|
function initFormByField(fieldName) {
|
|
19571
19700
|
if (Array.isArray(fieldName)) {
|
|
19572
19701
|
fieldName.forEach(initFormByField);
|
|
@@ -19593,8 +19722,12 @@ var notBulma = (function (exports) {
|
|
|
19593
19722
|
});
|
|
19594
19723
|
|
|
19595
19724
|
function updateFormValidationStatus(result) {
|
|
19725
|
+
$$invalidate(31, formHasErrors = false); /* FormValidationSession.getCompleteResult() */
|
|
19726
|
+
$$invalidate(32, fieldsHasErrors = false);
|
|
19727
|
+
|
|
19596
19728
|
if (Array.isArray(result.form) && result.form.length) {
|
|
19597
|
-
formErrors.splice(0, formErrors.length, ...result.form);
|
|
19729
|
+
formErrors.splice(0, formErrors.length, ...result.form);
|
|
19730
|
+
$$invalidate(31, formHasErrors = true);
|
|
19598
19731
|
} else {
|
|
19599
19732
|
formErrors.splice(0, formErrors.length);
|
|
19600
19733
|
}
|
|
@@ -19605,6 +19738,7 @@ var notBulma = (function (exports) {
|
|
|
19605
19738
|
for (let fieldName in result.fields) {
|
|
19606
19739
|
if (Array.isArray(result.fields[fieldName]) && result.fields[fieldName].length) {
|
|
19607
19740
|
setFormFieldInvalid(fieldName, result.fields[fieldName]);
|
|
19741
|
+
$$invalidate(32, fieldsHasErrors = true);
|
|
19608
19742
|
} else {
|
|
19609
19743
|
setFormFieldValid(fieldName);
|
|
19610
19744
|
}
|
|
@@ -19691,8 +19825,8 @@ var notBulma = (function (exports) {
|
|
|
19691
19825
|
};
|
|
19692
19826
|
|
|
19693
19827
|
$$self.$$.update = () => {
|
|
19694
|
-
if ($$self.$$.dirty[1] & /*fieldsHasErrors*/
|
|
19695
|
-
$$invalidate(14, formInvalid = fieldsHasErrors);
|
|
19828
|
+
if ($$self.$$.dirty[1] & /*formHasErrors, fieldsHasErrors*/ 3) {
|
|
19829
|
+
$$invalidate(14, formInvalid = formHasErrors || fieldsHasErrors);
|
|
19696
19830
|
}
|
|
19697
19831
|
};
|
|
19698
19832
|
|
|
@@ -19720,7 +19854,6 @@ var notBulma = (function (exports) {
|
|
|
19720
19854
|
fieldIsValid,
|
|
19721
19855
|
setFormFieldInvalid,
|
|
19722
19856
|
setFormFieldValid,
|
|
19723
|
-
fieldErrorsNotChanged,
|
|
19724
19857
|
updateFormValidationStatus,
|
|
19725
19858
|
showSuccess,
|
|
19726
19859
|
setLoading,
|
|
@@ -19729,6 +19862,7 @@ var notBulma = (function (exports) {
|
|
|
19729
19862
|
setVisibleFields,
|
|
19730
19863
|
setInvisibleFields,
|
|
19731
19864
|
setFieldValue,
|
|
19865
|
+
formHasErrors,
|
|
19732
19866
|
fieldsHasErrors
|
|
19733
19867
|
];
|
|
19734
19868
|
}
|
|
@@ -19750,8 +19884,7 @@ var notBulma = (function (exports) {
|
|
|
19750
19884
|
fieldIsValid: 20,
|
|
19751
19885
|
setFormFieldInvalid: 21,
|
|
19752
19886
|
setFormFieldValid: 22,
|
|
19753
|
-
|
|
19754
|
-
updateFormValidationStatus: 24,
|
|
19887
|
+
updateFormValidationStatus: 23,
|
|
19755
19888
|
fields: 1,
|
|
19756
19889
|
options: 2,
|
|
19757
19890
|
SUCCESS_TEXT: 3,
|
|
@@ -19762,14 +19895,14 @@ var notBulma = (function (exports) {
|
|
|
19762
19895
|
cancel: 8,
|
|
19763
19896
|
loading: 0,
|
|
19764
19897
|
submitForm: 9,
|
|
19765
|
-
showSuccess:
|
|
19898
|
+
showSuccess: 24,
|
|
19766
19899
|
rejectForm: 10,
|
|
19767
|
-
setLoading:
|
|
19768
|
-
resetLoading:
|
|
19769
|
-
setFieldsVisibility:
|
|
19770
|
-
setVisibleFields:
|
|
19771
|
-
setInvisibleFields:
|
|
19772
|
-
setFieldValue:
|
|
19900
|
+
setLoading: 25,
|
|
19901
|
+
resetLoading: 26,
|
|
19902
|
+
setFieldsVisibility: 27,
|
|
19903
|
+
setVisibleFields: 28,
|
|
19904
|
+
setInvisibleFields: 29,
|
|
19905
|
+
setFieldValue: 30
|
|
19773
19906
|
},
|
|
19774
19907
|
null,
|
|
19775
19908
|
[-1, -1]
|
|
@@ -19800,280 +19933,39 @@ var notBulma = (function (exports) {
|
|
|
19800
19933
|
return this.$$.ctx[22];
|
|
19801
19934
|
}
|
|
19802
19935
|
|
|
19803
|
-
get fieldErrorsNotChanged() {
|
|
19804
|
-
return this.$$.ctx[23];
|
|
19805
|
-
}
|
|
19806
|
-
|
|
19807
19936
|
get updateFormValidationStatus() {
|
|
19808
|
-
return this.$$.ctx[
|
|
19937
|
+
return this.$$.ctx[23];
|
|
19809
19938
|
}
|
|
19810
19939
|
|
|
19811
19940
|
get showSuccess() {
|
|
19812
|
-
return this.$$.ctx[
|
|
19941
|
+
return this.$$.ctx[24];
|
|
19813
19942
|
}
|
|
19814
19943
|
|
|
19815
19944
|
get setLoading() {
|
|
19816
|
-
return this.$$.ctx[
|
|
19945
|
+
return this.$$.ctx[25];
|
|
19817
19946
|
}
|
|
19818
19947
|
|
|
19819
19948
|
get resetLoading() {
|
|
19820
|
-
return this.$$.ctx[
|
|
19949
|
+
return this.$$.ctx[26];
|
|
19821
19950
|
}
|
|
19822
19951
|
|
|
19823
19952
|
get setFieldsVisibility() {
|
|
19824
|
-
return this.$$.ctx[
|
|
19953
|
+
return this.$$.ctx[27];
|
|
19825
19954
|
}
|
|
19826
19955
|
|
|
19827
19956
|
get setVisibleFields() {
|
|
19828
|
-
return this.$$.ctx[
|
|
19957
|
+
return this.$$.ctx[28];
|
|
19829
19958
|
}
|
|
19830
19959
|
|
|
19831
19960
|
get setInvisibleFields() {
|
|
19832
|
-
return this.$$.ctx[
|
|
19961
|
+
return this.$$.ctx[29];
|
|
19833
19962
|
}
|
|
19834
19963
|
|
|
19835
19964
|
get setFieldValue() {
|
|
19836
|
-
return this.$$.ctx[
|
|
19965
|
+
return this.$$.ctx[30];
|
|
19837
19966
|
}
|
|
19838
19967
|
}
|
|
19839
19968
|
|
|
19840
|
-
var Form = /*#__PURE__*/function () {
|
|
19841
|
-
function Form() {
|
|
19842
|
-
classCallCheck(this, Form);
|
|
19843
|
-
}
|
|
19844
|
-
|
|
19845
|
-
createClass(Form, null, [{
|
|
19846
|
-
key: "addComponent",
|
|
19847
|
-
value: function addComponent(name, value) {
|
|
19848
|
-
COMPONENTS.add(name, value);
|
|
19849
|
-
}
|
|
19850
|
-
}, {
|
|
19851
|
-
key: "addVariants",
|
|
19852
|
-
value: function addVariants(name, value) {
|
|
19853
|
-
VARIANTS.add(name, value);
|
|
19854
|
-
}
|
|
19855
|
-
}, {
|
|
19856
|
-
key: "addField",
|
|
19857
|
-
value: function addField(name, field) {
|
|
19858
|
-
FIELDS.add(name, field);
|
|
19859
|
-
}
|
|
19860
|
-
}, {
|
|
19861
|
-
key: "actionFieldsInit",
|
|
19862
|
-
value: function actionFieldsInit(fieldName, options, validators, data) {
|
|
19863
|
-
var _this = this;
|
|
19864
|
-
|
|
19865
|
-
if (Array.isArray(fieldName)) {
|
|
19866
|
-
fieldName.forEach(function (subFieldName) {
|
|
19867
|
-
_this.actionFieldsInit(subFieldName, options, validators, data);
|
|
19868
|
-
});
|
|
19869
|
-
} else {
|
|
19870
|
-
if (!Object.prototype.hasOwnProperty.call(options, 'fields')) {
|
|
19871
|
-
options.fields = {};
|
|
19872
|
-
}
|
|
19873
|
-
|
|
19874
|
-
if (!Object.prototype.hasOwnProperty.call(options.fields, fieldName)) {
|
|
19875
|
-
options.fields[fieldName] = {};
|
|
19876
|
-
} //copying validators
|
|
19877
|
-
|
|
19878
|
-
|
|
19879
|
-
if (validators && validators.fields && Object.prototype.hasOwnProperty.call(validators.fields, fieldName)) {
|
|
19880
|
-
options.fields[fieldName].validate = validators.fields[fieldName];
|
|
19881
|
-
} //copying initial data
|
|
19882
|
-
|
|
19883
|
-
|
|
19884
|
-
if (typeof data !== 'undefined' && data !== null && typeof data[fieldName] !== 'undefined' && data[fieldName] !== null) {
|
|
19885
|
-
options.fields[fieldName].value = data[fieldName];
|
|
19886
|
-
}
|
|
19887
|
-
}
|
|
19888
|
-
}
|
|
19889
|
-
}, {
|
|
19890
|
-
key: "build",
|
|
19891
|
-
value: function build(_ref) {
|
|
19892
|
-
var target = _ref.target,
|
|
19893
|
-
manifest = _ref.manifest,
|
|
19894
|
-
action = _ref.action,
|
|
19895
|
-
_ref$options = _ref.options,
|
|
19896
|
-
options = _ref$options === void 0 ? {} : _ref$options,
|
|
19897
|
-
_ref$validators = _ref.validators,
|
|
19898
|
-
validators = _ref$validators === void 0 ? {} : _ref$validators,
|
|
19899
|
-
_ref$data = _ref.data,
|
|
19900
|
-
data = _ref$data === void 0 ? null : _ref$data;
|
|
19901
|
-
return new Form$1({
|
|
19902
|
-
target: target,
|
|
19903
|
-
props: this.prebuild({
|
|
19904
|
-
manifest: manifest,
|
|
19905
|
-
action: action,
|
|
19906
|
-
options: options,
|
|
19907
|
-
validators: validators,
|
|
19908
|
-
data: data
|
|
19909
|
-
})
|
|
19910
|
-
});
|
|
19911
|
-
}
|
|
19912
|
-
}, {
|
|
19913
|
-
key: "prebuild",
|
|
19914
|
-
value: function prebuild(_ref2) {
|
|
19915
|
-
var manifest = _ref2.manifest,
|
|
19916
|
-
action = _ref2.action,
|
|
19917
|
-
_ref2$options = _ref2.options,
|
|
19918
|
-
options = _ref2$options === void 0 ? {} : _ref2$options,
|
|
19919
|
-
_ref2$validators = _ref2.validators,
|
|
19920
|
-
validators = _ref2$validators === void 0 ? {} : _ref2$validators,
|
|
19921
|
-
_ref2$data = _ref2.data,
|
|
19922
|
-
data = _ref2$data === void 0 ? null : _ref2$data;
|
|
19923
|
-
|
|
19924
|
-
if (Object.prototype.hasOwnProperty.call(manifest, 'fields')) {
|
|
19925
|
-
FIELDS.import(manifest.fields);
|
|
19926
|
-
}
|
|
19927
|
-
|
|
19928
|
-
if (typeof options === 'undefined' || options === null) {
|
|
19929
|
-
options = {};
|
|
19930
|
-
}
|
|
19931
|
-
|
|
19932
|
-
if (manifest.actions[action] && manifest.actions[action].fields) {
|
|
19933
|
-
this.actionFieldsInit(manifest.actions[action].fields, options, validators, data);
|
|
19934
|
-
}
|
|
19935
|
-
|
|
19936
|
-
if (typeof validators !== 'undefined' && validators !== null) {
|
|
19937
|
-
if (Object.prototype.hasOwnProperty.call(validators, 'forms')) {
|
|
19938
|
-
if (Object.prototype.hasOwnProperty.call(validators.forms, action)) {
|
|
19939
|
-
options.validate = validators.forms[action];
|
|
19940
|
-
}
|
|
19941
|
-
}
|
|
19942
|
-
}
|
|
19943
|
-
|
|
19944
|
-
return {
|
|
19945
|
-
title: manifest.actions[action].title,
|
|
19946
|
-
description: manifest.actions[action].description,
|
|
19947
|
-
fields: manifest.actions[action].fields,
|
|
19948
|
-
options: options
|
|
19949
|
-
};
|
|
19950
|
-
}
|
|
19951
|
-
}, {
|
|
19952
|
-
key: "getVariantTitle",
|
|
19953
|
-
value: function getVariantTitle(name, id) {
|
|
19954
|
-
var lib = VARIANTS.get(name);
|
|
19955
|
-
var result = lib.filter(function (item) {
|
|
19956
|
-
return item.id === id;
|
|
19957
|
-
});
|
|
19958
|
-
return result.length === 1 ? result[0] : 'noname';
|
|
19959
|
-
}
|
|
19960
|
-
}]);
|
|
19961
|
-
|
|
19962
|
-
return Form;
|
|
19963
|
-
}();
|
|
19964
|
-
|
|
19965
|
-
defineProperty$4(Form, "validator", validator);
|
|
19966
|
-
|
|
19967
|
-
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19968
|
-
|
|
19969
|
-
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { defineProperty$4(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19970
|
-
|
|
19971
|
-
var ValidatorsBuilder = /*#__PURE__*/function () {
|
|
19972
|
-
function ValidatorsBuilder(app, getValidatorEnv) {
|
|
19973
|
-
classCallCheck(this, ValidatorsBuilder);
|
|
19974
|
-
|
|
19975
|
-
this.app = app;
|
|
19976
|
-
this.getValidatorEnv = getValidatorEnv;
|
|
19977
|
-
}
|
|
19978
|
-
|
|
19979
|
-
createClass(ValidatorsBuilder, [{
|
|
19980
|
-
key: "augmentValidators",
|
|
19981
|
-
value: function augmentValidators(validators) {
|
|
19982
|
-
if (Object.prototype.hasOwnProperty.call(validators, 'fields')) {
|
|
19983
|
-
for (var fieldName in validators.fields) {
|
|
19984
|
-
validators.fields[fieldName] = this.augmentValidators(validators.fields[fieldName]);
|
|
19985
|
-
}
|
|
19986
|
-
}
|
|
19987
|
-
|
|
19988
|
-
if (Object.prototype.hasOwnProperty.call(validators, 'fields')) {
|
|
19989
|
-
for (var formName in validators.forms) {
|
|
19990
|
-
validators.forms[formName] = this.augmentFormValidators(validators.forms[formName]);
|
|
19991
|
-
}
|
|
19992
|
-
}
|
|
19993
|
-
|
|
19994
|
-
return validators;
|
|
19995
|
-
}
|
|
19996
|
-
}, {
|
|
19997
|
-
key: "augmentFieldsValidators",
|
|
19998
|
-
value: function augmentFieldsValidators(fieldValidators) {
|
|
19999
|
-
var _this = this;
|
|
20000
|
-
|
|
20001
|
-
return fieldValidators.map(function (field) {
|
|
20002
|
-
return _this.augmentValidator(field);
|
|
20003
|
-
});
|
|
20004
|
-
}
|
|
20005
|
-
}, {
|
|
20006
|
-
key: "augmentFieldValidator",
|
|
20007
|
-
value: function augmentFieldValidator(rule) {
|
|
20008
|
-
if (rule.validator) {
|
|
20009
|
-
if (typeof rule.validator === 'string') {
|
|
20010
|
-
return this.augmentValidatorObsolete(rule);
|
|
20011
|
-
} else {
|
|
20012
|
-
return this.augmentValidatorModern(rule);
|
|
20013
|
-
}
|
|
20014
|
-
}
|
|
20015
|
-
|
|
20016
|
-
return rule;
|
|
20017
|
-
}
|
|
20018
|
-
}, {
|
|
20019
|
-
key: "augmentFieldValidatorObsolete",
|
|
20020
|
-
value: function augmentFieldValidatorObsolete(rule) {
|
|
20021
|
-
if (Form.validator && Object.prototype.hasOwnProperty.call(Form.validator, rule.validator)) {
|
|
20022
|
-
var validatorName = rule.validator;
|
|
20023
|
-
|
|
20024
|
-
var result = _objectSpread$2({}, rule);
|
|
20025
|
-
|
|
20026
|
-
delete result.validator;
|
|
20027
|
-
|
|
20028
|
-
result.validator = function (val) {
|
|
20029
|
-
return Form.validator[validatorName](val, rule.arguments);
|
|
20030
|
-
};
|
|
20031
|
-
|
|
20032
|
-
return result;
|
|
20033
|
-
} else {
|
|
20034
|
-
return _objectSpread$2({}, rule);
|
|
20035
|
-
}
|
|
20036
|
-
}
|
|
20037
|
-
}, {
|
|
20038
|
-
key: "augmentFieldValidatorModern",
|
|
20039
|
-
value: function augmentFieldValidatorModern(rule) {
|
|
20040
|
-
var _this2 = this;
|
|
20041
|
-
|
|
20042
|
-
var ruleValidator = rule.validator;
|
|
20043
|
-
|
|
20044
|
-
var result = _objectSpread$2({}, rule);
|
|
20045
|
-
|
|
20046
|
-
delete result.validator;
|
|
20047
|
-
|
|
20048
|
-
result.validator = function (val) {
|
|
20049
|
-
return ruleValidator(val, _this2.getValidatorEnv());
|
|
20050
|
-
};
|
|
20051
|
-
|
|
20052
|
-
return result;
|
|
20053
|
-
}
|
|
20054
|
-
}, {
|
|
20055
|
-
key: "augmentFormValidator",
|
|
20056
|
-
value: function augmentFormValidator(rule) {
|
|
20057
|
-
var _this3 = this;
|
|
20058
|
-
|
|
20059
|
-
return function (val, validationResults) {
|
|
20060
|
-
return rule(val, validationResults, _this3.getValidatorEnv());
|
|
20061
|
-
};
|
|
20062
|
-
}
|
|
20063
|
-
}, {
|
|
20064
|
-
key: "augmentFormValidators",
|
|
20065
|
-
value: function augmentFormValidators(rules) {
|
|
20066
|
-
var _this4 = this;
|
|
20067
|
-
|
|
20068
|
-
return rules.map(function (rule) {
|
|
20069
|
-
return _this4.augmentFormValidator(rule);
|
|
20070
|
-
});
|
|
20071
|
-
}
|
|
20072
|
-
}]);
|
|
20073
|
-
|
|
20074
|
-
return ValidatorsBuilder;
|
|
20075
|
-
}();
|
|
20076
|
-
|
|
20077
19969
|
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
20078
19970
|
|
|
20079
19971
|
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
@@ -20539,6 +20431,263 @@ var notBulma = (function (exports) {
|
|
|
20539
20431
|
return FormValidationRunner;
|
|
20540
20432
|
}();
|
|
20541
20433
|
|
|
20434
|
+
var Form = /*#__PURE__*/function () {
|
|
20435
|
+
function Form() {
|
|
20436
|
+
classCallCheck(this, Form);
|
|
20437
|
+
}
|
|
20438
|
+
|
|
20439
|
+
createClass(Form, null, [{
|
|
20440
|
+
key: "addComponent",
|
|
20441
|
+
value: function addComponent(name, value) {
|
|
20442
|
+
COMPONENTS.add(name, value);
|
|
20443
|
+
}
|
|
20444
|
+
}, {
|
|
20445
|
+
key: "addVariants",
|
|
20446
|
+
value: function addVariants(name, value) {
|
|
20447
|
+
VARIANTS.add(name, value);
|
|
20448
|
+
}
|
|
20449
|
+
}, {
|
|
20450
|
+
key: "addField",
|
|
20451
|
+
value: function addField(name, field) {
|
|
20452
|
+
FIELDS.add(name, field);
|
|
20453
|
+
}
|
|
20454
|
+
}, {
|
|
20455
|
+
key: "actionFieldsInit",
|
|
20456
|
+
value: function actionFieldsInit(fieldName, options, data) {
|
|
20457
|
+
var _this = this;
|
|
20458
|
+
|
|
20459
|
+
if (Array.isArray(fieldName)) {
|
|
20460
|
+
fieldName.forEach(function (subFieldName) {
|
|
20461
|
+
_this.actionFieldsInit(subFieldName, options, data);
|
|
20462
|
+
});
|
|
20463
|
+
} else {
|
|
20464
|
+
if (!Object.prototype.hasOwnProperty.call(options, 'fields')) {
|
|
20465
|
+
options.fields = {};
|
|
20466
|
+
}
|
|
20467
|
+
|
|
20468
|
+
if (!Object.prototype.hasOwnProperty.call(options.fields, fieldName)) {
|
|
20469
|
+
options.fields[fieldName] = {};
|
|
20470
|
+
} //copying initial data
|
|
20471
|
+
|
|
20472
|
+
|
|
20473
|
+
if (typeof data !== 'undefined' && data !== null && typeof data[fieldName] !== 'undefined' && data[fieldName] !== null) {
|
|
20474
|
+
options.fields[fieldName].value = data[fieldName];
|
|
20475
|
+
}
|
|
20476
|
+
}
|
|
20477
|
+
}
|
|
20478
|
+
}, {
|
|
20479
|
+
key: "build",
|
|
20480
|
+
value: function build(_ref) {
|
|
20481
|
+
var target = _ref.target,
|
|
20482
|
+
manifest = _ref.manifest,
|
|
20483
|
+
action = _ref.action,
|
|
20484
|
+
_ref$options = _ref.options,
|
|
20485
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
20486
|
+
_ref$validators = _ref.validators,
|
|
20487
|
+
validators = _ref$validators === void 0 ? {} : _ref$validators,
|
|
20488
|
+
_ref$data = _ref.data,
|
|
20489
|
+
data = _ref$data === void 0 ? null : _ref$data;
|
|
20490
|
+
var formUI = new Form$1({
|
|
20491
|
+
target: target,
|
|
20492
|
+
props: Form.prebuild({
|
|
20493
|
+
manifest: manifest,
|
|
20494
|
+
action: action,
|
|
20495
|
+
options: options,
|
|
20496
|
+
data: data
|
|
20497
|
+
})
|
|
20498
|
+
});
|
|
20499
|
+
var formValidator = new FormValidationRunner$1(validators);
|
|
20500
|
+
formUI.$on('change', /*#__PURE__*/asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
20501
|
+
var session;
|
|
20502
|
+
return regenerator.wrap(function _callee$(_context) {
|
|
20503
|
+
while (1) {
|
|
20504
|
+
switch (_context.prev = _context.next) {
|
|
20505
|
+
case 0:
|
|
20506
|
+
_context.prev = 0;
|
|
20507
|
+
_context.next = 3;
|
|
20508
|
+
return formValidator.all(formUI.collectData(), action);
|
|
20509
|
+
|
|
20510
|
+
case 3:
|
|
20511
|
+
session = _context.sent;
|
|
20512
|
+
formUI.updateFormValidationStatus(session.getCompleteResult());
|
|
20513
|
+
_context.next = 11;
|
|
20514
|
+
break;
|
|
20515
|
+
|
|
20516
|
+
case 7:
|
|
20517
|
+
_context.prev = 7;
|
|
20518
|
+
_context.t0 = _context["catch"](0);
|
|
20519
|
+
formUI.updateFormValidationStatus({
|
|
20520
|
+
form: [UICommon.ERROR_DEFAULT]
|
|
20521
|
+
});
|
|
20522
|
+
notCommon$1.report(_context.t0);
|
|
20523
|
+
|
|
20524
|
+
case 11:
|
|
20525
|
+
case "end":
|
|
20526
|
+
return _context.stop();
|
|
20527
|
+
}
|
|
20528
|
+
}
|
|
20529
|
+
}, _callee, null, [[0, 7]]);
|
|
20530
|
+
})));
|
|
20531
|
+
return {
|
|
20532
|
+
ui: formUI,
|
|
20533
|
+
validator: formValidator
|
|
20534
|
+
};
|
|
20535
|
+
}
|
|
20536
|
+
}, {
|
|
20537
|
+
key: "prebuild",
|
|
20538
|
+
value: function prebuild(_ref3) {
|
|
20539
|
+
var manifest = _ref3.manifest,
|
|
20540
|
+
action = _ref3.action,
|
|
20541
|
+
_ref3$options = _ref3.options,
|
|
20542
|
+
options = _ref3$options === void 0 ? {} : _ref3$options,
|
|
20543
|
+
_ref3$data = _ref3.data,
|
|
20544
|
+
data = _ref3$data === void 0 ? null : _ref3$data;
|
|
20545
|
+
|
|
20546
|
+
if (Object.prototype.hasOwnProperty.call(manifest, 'fields')) {
|
|
20547
|
+
FIELDS.import(manifest.fields);
|
|
20548
|
+
}
|
|
20549
|
+
|
|
20550
|
+
if (typeof options === 'undefined' || options === null) {
|
|
20551
|
+
options = {};
|
|
20552
|
+
}
|
|
20553
|
+
|
|
20554
|
+
if (manifest.actions[action] && manifest.actions[action].fields) {
|
|
20555
|
+
this.actionFieldsInit(manifest.actions[action].fields, options, data);
|
|
20556
|
+
}
|
|
20557
|
+
|
|
20558
|
+
return {
|
|
20559
|
+
title: manifest.actions[action].title,
|
|
20560
|
+
description: manifest.actions[action].description,
|
|
20561
|
+
fields: manifest.actions[action].fields,
|
|
20562
|
+
options: options
|
|
20563
|
+
};
|
|
20564
|
+
}
|
|
20565
|
+
}, {
|
|
20566
|
+
key: "getVariantTitle",
|
|
20567
|
+
value: function getVariantTitle(name, id) {
|
|
20568
|
+
var lib = VARIANTS.get(name);
|
|
20569
|
+
var result = lib.filter(function (item) {
|
|
20570
|
+
return item.id === id;
|
|
20571
|
+
});
|
|
20572
|
+
return result.length === 1 ? result[0] : 'noname';
|
|
20573
|
+
}
|
|
20574
|
+
}]);
|
|
20575
|
+
|
|
20576
|
+
return Form;
|
|
20577
|
+
}();
|
|
20578
|
+
|
|
20579
|
+
defineProperty$4(Form, "validator", validator);
|
|
20580
|
+
|
|
20581
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
20582
|
+
|
|
20583
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { defineProperty$4(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
20584
|
+
|
|
20585
|
+
var ValidatorsBuilder = /*#__PURE__*/function () {
|
|
20586
|
+
function ValidatorsBuilder(app, getValidatorEnv) {
|
|
20587
|
+
classCallCheck(this, ValidatorsBuilder);
|
|
20588
|
+
|
|
20589
|
+
this.app = app;
|
|
20590
|
+
this.getValidatorEnv = getValidatorEnv;
|
|
20591
|
+
}
|
|
20592
|
+
|
|
20593
|
+
createClass(ValidatorsBuilder, [{
|
|
20594
|
+
key: "augmentValidators",
|
|
20595
|
+
value: function augmentValidators(validators) {
|
|
20596
|
+
if (Object.prototype.hasOwnProperty.call(validators, 'fields')) {
|
|
20597
|
+
for (var fieldName in validators.fields) {
|
|
20598
|
+
validators.fields[fieldName] = this.augmentValidators(validators.fields[fieldName]);
|
|
20599
|
+
}
|
|
20600
|
+
}
|
|
20601
|
+
|
|
20602
|
+
if (Object.prototype.hasOwnProperty.call(validators, 'fields')) {
|
|
20603
|
+
for (var formName in validators.forms) {
|
|
20604
|
+
validators.forms[formName] = this.augmentFormValidators(validators.forms[formName]);
|
|
20605
|
+
}
|
|
20606
|
+
}
|
|
20607
|
+
|
|
20608
|
+
return validators;
|
|
20609
|
+
}
|
|
20610
|
+
}, {
|
|
20611
|
+
key: "augmentFieldsValidators",
|
|
20612
|
+
value: function augmentFieldsValidators(fieldValidators) {
|
|
20613
|
+
var _this = this;
|
|
20614
|
+
|
|
20615
|
+
return fieldValidators.map(function (field) {
|
|
20616
|
+
return _this.augmentValidator(field);
|
|
20617
|
+
});
|
|
20618
|
+
}
|
|
20619
|
+
}, {
|
|
20620
|
+
key: "augmentFieldValidator",
|
|
20621
|
+
value: function augmentFieldValidator(rule) {
|
|
20622
|
+
if (rule.validator) {
|
|
20623
|
+
if (typeof rule.validator === 'string') {
|
|
20624
|
+
return this.augmentValidatorObsolete(rule);
|
|
20625
|
+
} else {
|
|
20626
|
+
return this.augmentValidatorModern(rule);
|
|
20627
|
+
}
|
|
20628
|
+
}
|
|
20629
|
+
|
|
20630
|
+
return rule;
|
|
20631
|
+
}
|
|
20632
|
+
}, {
|
|
20633
|
+
key: "augmentFieldValidatorObsolete",
|
|
20634
|
+
value: function augmentFieldValidatorObsolete(rule) {
|
|
20635
|
+
if (Form.validator && Object.prototype.hasOwnProperty.call(Form.validator, rule.validator)) {
|
|
20636
|
+
var validatorName = rule.validator;
|
|
20637
|
+
|
|
20638
|
+
var result = _objectSpread$3({}, rule);
|
|
20639
|
+
|
|
20640
|
+
delete result.validator;
|
|
20641
|
+
|
|
20642
|
+
result.validator = function (val) {
|
|
20643
|
+
return Form.validator[validatorName](val, rule.arguments);
|
|
20644
|
+
};
|
|
20645
|
+
|
|
20646
|
+
return result;
|
|
20647
|
+
} else {
|
|
20648
|
+
return _objectSpread$3({}, rule);
|
|
20649
|
+
}
|
|
20650
|
+
}
|
|
20651
|
+
}, {
|
|
20652
|
+
key: "augmentFieldValidatorModern",
|
|
20653
|
+
value: function augmentFieldValidatorModern(rule) {
|
|
20654
|
+
var _this2 = this;
|
|
20655
|
+
|
|
20656
|
+
var ruleValidator = rule.validator;
|
|
20657
|
+
|
|
20658
|
+
var result = _objectSpread$3({}, rule);
|
|
20659
|
+
|
|
20660
|
+
delete result.validator;
|
|
20661
|
+
|
|
20662
|
+
result.validator = function (val) {
|
|
20663
|
+
return ruleValidator(val, _this2.getValidatorEnv());
|
|
20664
|
+
};
|
|
20665
|
+
|
|
20666
|
+
return result;
|
|
20667
|
+
}
|
|
20668
|
+
}, {
|
|
20669
|
+
key: "augmentFormValidator",
|
|
20670
|
+
value: function augmentFormValidator(rule) {
|
|
20671
|
+
var _this3 = this;
|
|
20672
|
+
|
|
20673
|
+
return function (val, validationResults) {
|
|
20674
|
+
return rule(val, validationResults, _this3.getValidatorEnv());
|
|
20675
|
+
};
|
|
20676
|
+
}
|
|
20677
|
+
}, {
|
|
20678
|
+
key: "augmentFormValidators",
|
|
20679
|
+
value: function augmentFormValidators(rules) {
|
|
20680
|
+
var _this4 = this;
|
|
20681
|
+
|
|
20682
|
+
return rules.map(function (rule) {
|
|
20683
|
+
return _this4.augmentFormValidator(rule);
|
|
20684
|
+
});
|
|
20685
|
+
}
|
|
20686
|
+
}]);
|
|
20687
|
+
|
|
20688
|
+
return ValidatorsBuilder;
|
|
20689
|
+
}();
|
|
20690
|
+
|
|
20542
20691
|
//import 'babel-polyfill/dist/polyfill';
|
|
20543
20692
|
|
|
20544
20693
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -20558,9 +20707,9 @@ var notBulma = (function (exports) {
|
|
|
20558
20707
|
FormValidationSession: FormValidationSession$1
|
|
20559
20708
|
});
|
|
20560
20709
|
|
|
20561
|
-
function ownKeys$
|
|
20710
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
20562
20711
|
|
|
20563
|
-
function _objectSpread$
|
|
20712
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { defineProperty$4(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
20564
20713
|
|
|
20565
20714
|
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }
|
|
20566
20715
|
|
|
@@ -20652,7 +20801,7 @@ var notBulma = (function (exports) {
|
|
|
20652
20801
|
value: function set(dict) {
|
|
20653
20802
|
LOCALE.set(dict);
|
|
20654
20803
|
this.saveToStorage(dict);
|
|
20655
|
-
this.dict = Object.assign({}, _objectSpread$
|
|
20804
|
+
this.dict = Object.assign({}, _objectSpread$2({}, dict));
|
|
20656
20805
|
this.emit('change');
|
|
20657
20806
|
}
|
|
20658
20807
|
}, {
|
|
@@ -25513,9 +25662,9 @@ var notBulma = (function (exports) {
|
|
|
25513
25662
|
|
|
25514
25663
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
25515
25664
|
|
|
25516
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25665
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25517
25666
|
|
|
25518
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty$4(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25667
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { defineProperty$4(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
25519
25668
|
|
|
25520
25669
|
var Menu = /*#__PURE__*/function () {
|
|
25521
25670
|
function Menu() {
|
|
@@ -25534,7 +25683,7 @@ var notBulma = (function (exports) {
|
|
|
25534
25683
|
}, {
|
|
25535
25684
|
key: "setOptions",
|
|
25536
25685
|
value: function setOptions(options) {
|
|
25537
|
-
this.options = _objectSpread(_objectSpread({}, this.options), options);
|
|
25686
|
+
this.options = _objectSpread$1(_objectSpread$1({}, this.options), options);
|
|
25538
25687
|
return this;
|
|
25539
25688
|
}
|
|
25540
25689
|
}, {
|
|
@@ -25694,14 +25843,14 @@ var notBulma = (function (exports) {
|
|
|
25694
25843
|
key: "updateSectionTag",
|
|
25695
25844
|
value: function updateSectionTag(sectionId, tag) {
|
|
25696
25845
|
this.updateSection(sectionId, function (section) {
|
|
25697
|
-
section.tag = _objectSpread(_objectSpread({}, section.tag), tag);
|
|
25846
|
+
section.tag = _objectSpread$1(_objectSpread$1({}, section.tag), tag);
|
|
25698
25847
|
});
|
|
25699
25848
|
}
|
|
25700
25849
|
}, {
|
|
25701
25850
|
key: "updateItemTag",
|
|
25702
25851
|
value: function updateItemTag(itemId, tag) {
|
|
25703
25852
|
this.updateItem(itemId, function (item) {
|
|
25704
|
-
item.tag = _objectSpread(_objectSpread({}, item.tag), tag);
|
|
25853
|
+
item.tag = _objectSpread$1(_objectSpread$1({}, item.tag), tag);
|
|
25705
25854
|
});
|
|
25706
25855
|
}
|
|
25707
25856
|
}, {
|
|
@@ -27787,146 +27936,6 @@ var notBulma = (function (exports) {
|
|
|
27787
27936
|
}
|
|
27788
27937
|
}
|
|
27789
27938
|
|
|
27790
|
-
var UICommon = /*#__PURE__*/function () {
|
|
27791
|
-
function UICommon() {
|
|
27792
|
-
classCallCheck(this, UICommon);
|
|
27793
|
-
}
|
|
27794
|
-
|
|
27795
|
-
createClass(UICommon, null, [{
|
|
27796
|
-
key: "formatPhone",
|
|
27797
|
-
value:
|
|
27798
|
-
/**
|
|
27799
|
-
* Reformats input from any string to strict phone format
|
|
27800
|
-
* @param {string} phone free style phone number
|
|
27801
|
-
* @returns {string} phone number
|
|
27802
|
-
**/
|
|
27803
|
-
function formatPhone(val) {
|
|
27804
|
-
var filler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.FILLER;
|
|
27805
|
-
//starting from 11 digits in phone number
|
|
27806
|
-
var slots = [1, 2, 2, 2, 3, 3, 3, 4, 4, 5, 5];
|
|
27807
|
-
var digits = val.replace(/\D/g, ''); //if there are more, move them to country code slot
|
|
27808
|
-
|
|
27809
|
-
if (digits.length > 11) {
|
|
27810
|
-
var d = digits.length - 11;
|
|
27811
|
-
|
|
27812
|
-
while (d > 0) {
|
|
27813
|
-
d--;
|
|
27814
|
-
slots.unshift(1);
|
|
27815
|
-
}
|
|
27816
|
-
}
|
|
27817
|
-
|
|
27818
|
-
var stack = ['', '', '', '', ''];
|
|
27819
|
-
Array.from(digits).forEach(function (digit, index) {
|
|
27820
|
-
var slot = slots[index];
|
|
27821
|
-
stack[slot - 1] = stack[slot - 1] + digit;
|
|
27822
|
-
}); //creating map of parts lengths
|
|
27823
|
-
|
|
27824
|
-
var lens = slots.reduce(function (acc, curr) {
|
|
27825
|
-
if (typeof acc[curr] === 'undefined') {
|
|
27826
|
-
acc[curr] = 1;
|
|
27827
|
-
} else {
|
|
27828
|
-
acc[curr] += 1;
|
|
27829
|
-
}
|
|
27830
|
-
|
|
27831
|
-
return acc;
|
|
27832
|
-
}, {}); //fill empty positions with filler (_)
|
|
27833
|
-
|
|
27834
|
-
for (var t in stack) {
|
|
27835
|
-
var dif = lens[parseInt(t) + 1] - stack[t].length;
|
|
27836
|
-
|
|
27837
|
-
while (dif > 0) {
|
|
27838
|
-
stack[t] = stack[t] + filler;
|
|
27839
|
-
dif--;
|
|
27840
|
-
}
|
|
27841
|
-
}
|
|
27842
|
-
|
|
27843
|
-
return "+".concat(stack[0], " (").concat(stack[1], ") ").concat(stack[2], "-").concat(stack[3], "-").concat(stack[4]);
|
|
27844
|
-
}
|
|
27845
|
-
}, {
|
|
27846
|
-
key: "setMoneySign",
|
|
27847
|
-
value: function setMoneySign(val) {
|
|
27848
|
-
this.MONEY_SIGN = val;
|
|
27849
|
-
}
|
|
27850
|
-
}, {
|
|
27851
|
-
key: "formatPrice",
|
|
27852
|
-
value: function formatPrice(price) {
|
|
27853
|
-
var major = parseInt(Math.floor(price / 100)),
|
|
27854
|
-
minor = parseInt(price % 100);
|
|
27855
|
-
major = '' + major;
|
|
27856
|
-
return "".concat(this.MONEY_SIGN).concat(major, ".").concat(minor);
|
|
27857
|
-
}
|
|
27858
|
-
}, {
|
|
27859
|
-
key: "formatTimestamp",
|
|
27860
|
-
value: function formatTimestamp(timestamp) {
|
|
27861
|
-
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
27862
|
-
var offsetLocal = new Date().getTimezoneOffset();
|
|
27863
|
-
var deltaOffset = (offsetLocal - parseInt(offset)) * 60 * 1000;
|
|
27864
|
-
var localDateTime = new Date(parseInt(timestamp) - deltaOffset);
|
|
27865
|
-
return localDateTime.toLocaleString(window.navigator.language);
|
|
27866
|
-
}
|
|
27867
|
-
}, {
|
|
27868
|
-
key: "declOfNum",
|
|
27869
|
-
value: function declOfNum(n, text_forms) {
|
|
27870
|
-
n = Math.abs(n) % 100;
|
|
27871
|
-
var n1 = n % 10;
|
|
27872
|
-
|
|
27873
|
-
if (n > 10 && n < 20) {
|
|
27874
|
-
return text_forms[2];
|
|
27875
|
-
}
|
|
27876
|
-
|
|
27877
|
-
if (n1 > 1 && n1 < 5) {
|
|
27878
|
-
return text_forms[1];
|
|
27879
|
-
}
|
|
27880
|
-
|
|
27881
|
-
if (n1 == 1) {
|
|
27882
|
-
return text_forms[0];
|
|
27883
|
-
}
|
|
27884
|
-
|
|
27885
|
-
return text_forms[2];
|
|
27886
|
-
}
|
|
27887
|
-
}, {
|
|
27888
|
-
key: "humanizedTimeDiff",
|
|
27889
|
-
value: function humanizedTimeDiff(date
|
|
27890
|
-
/* unix time */
|
|
27891
|
-
) {
|
|
27892
|
-
var currentTime = new Date().getTime();
|
|
27893
|
-
var sec = Math.round((currentTime - date) / 1000);
|
|
27894
|
-
var unit;
|
|
27895
|
-
|
|
27896
|
-
if (sec < 60) {
|
|
27897
|
-
unit = this.declOfNum(sec, this.TIME.SECONDS);
|
|
27898
|
-
return "".concat(sec, " ").concat(unit, " \u043D\u0430\u0437\u0430\u0434");
|
|
27899
|
-
} else if (sec < 3600) {
|
|
27900
|
-
var min = Math.floor(sec / 60);
|
|
27901
|
-
unit = this.declOfNum(min, this.TIME.MINUTES);
|
|
27902
|
-
return "".concat(min, " ").concat(unit, " \u043D\u0430\u0437\u0430\u0434");
|
|
27903
|
-
} else {
|
|
27904
|
-
var hours = Math.floor(sec / (60 * 60));
|
|
27905
|
-
unit = this.declOfNum(hours, this.TIME.HOURS);
|
|
27906
|
-
return "".concat(hours, " ").concat(unit, " \u043D\u0430\u0437\u0430\u0434");
|
|
27907
|
-
}
|
|
27908
|
-
}
|
|
27909
|
-
}]);
|
|
27910
|
-
|
|
27911
|
-
return UICommon;
|
|
27912
|
-
}();
|
|
27913
|
-
|
|
27914
|
-
defineProperty$4(UICommon, "DEFAULT_REDIRECT_TIMEOUT", 3000);
|
|
27915
|
-
|
|
27916
|
-
defineProperty$4(UICommon, "CLASS_OK", 'is-success');
|
|
27917
|
-
|
|
27918
|
-
defineProperty$4(UICommon, "CLASS_ERR", 'is-danger');
|
|
27919
|
-
|
|
27920
|
-
defineProperty$4(UICommon, "FILLER", '_');
|
|
27921
|
-
|
|
27922
|
-
defineProperty$4(UICommon, "MONEY_SIGN", '₽');
|
|
27923
|
-
|
|
27924
|
-
defineProperty$4(UICommon, "TIME", {
|
|
27925
|
-
SECONDS: ['секунду', 'секунды', 'секунд'],
|
|
27926
|
-
MINUTES: ['минуту', 'минуты', 'минут'],
|
|
27927
|
-
HOURS: ['час', 'часа', 'часов']
|
|
27928
|
-
});
|
|
27929
|
-
|
|
27930
27939
|
/* src/form/ui.textfield.svelte generated by Svelte v3.44.2 */
|
|
27931
27940
|
|
|
27932
27941
|
function create_if_block_4$b(ctx) {
|
|
@@ -41864,11 +41873,13 @@ var notBulma = (function (exports) {
|
|
|
41864
41873
|
UIColumn: Ui_column
|
|
41865
41874
|
});
|
|
41866
41875
|
|
|
41876
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
41877
|
+
|
|
41878
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { defineProperty$4(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
41879
|
+
|
|
41867
41880
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }
|
|
41868
41881
|
|
|
41869
41882
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41870
|
-
|
|
41871
|
-
var ERROR_DEFAULT = 'Что пошло не так.';
|
|
41872
41883
|
var BREADCRUMBS = [];
|
|
41873
41884
|
|
|
41874
41885
|
var ncCRUD = /*#__PURE__*/function (_notController) {
|
|
@@ -41883,6 +41894,7 @@ var notBulma = (function (exports) {
|
|
|
41883
41894
|
|
|
41884
41895
|
_this = _super.call(this, app, "CRUD.".concat(name));
|
|
41885
41896
|
_this.ui = {};
|
|
41897
|
+
_this.validator = {};
|
|
41886
41898
|
_this.els = {};
|
|
41887
41899
|
|
|
41888
41900
|
_this.setOptions('names', {
|
|
@@ -42042,15 +42054,16 @@ var notBulma = (function (exports) {
|
|
|
42042
42054
|
|
|
42043
42055
|
case 14:
|
|
42044
42056
|
this.log('preload finished');
|
|
42045
|
-
_context.next =
|
|
42057
|
+
_context.next = 21;
|
|
42046
42058
|
break;
|
|
42047
42059
|
|
|
42048
42060
|
case 17:
|
|
42049
42061
|
_context.prev = 17;
|
|
42050
42062
|
_context.t0 = _context["catch"](1);
|
|
42051
|
-
this.
|
|
42063
|
+
this.report(_context.t0);
|
|
42064
|
+
this.showErrorMessage(_context.t0);
|
|
42052
42065
|
|
|
42053
|
-
case
|
|
42066
|
+
case 21:
|
|
42054
42067
|
case "end":
|
|
42055
42068
|
return _context.stop();
|
|
42056
42069
|
}
|
|
@@ -42097,59 +42110,66 @@ var notBulma = (function (exports) {
|
|
|
42097
42110
|
value: function route() {
|
|
42098
42111
|
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
42099
42112
|
|
|
42100
|
-
|
|
42101
|
-
if (params
|
|
42102
|
-
|
|
42103
|
-
|
|
42104
|
-
|
|
42105
|
-
|
|
42106
|
-
|
|
42107
|
-
if (params
|
|
42108
|
-
|
|
42109
|
-
|
|
42110
|
-
|
|
42111
|
-
|
|
42112
|
-
|
|
42113
|
+
try {
|
|
42114
|
+
if (params.length == 1) {
|
|
42115
|
+
if (params[0] === 'create') {
|
|
42116
|
+
return this.runCreate(params);
|
|
42117
|
+
} else {
|
|
42118
|
+
return this.runDetails(params);
|
|
42119
|
+
}
|
|
42120
|
+
} else if (params.length > 1) {
|
|
42121
|
+
if (params[1] === 'delete') {
|
|
42122
|
+
return this.runDelete(params);
|
|
42123
|
+
} else if (params[1] === 'update') {
|
|
42124
|
+
return this.runUpdate(params);
|
|
42125
|
+
} else {
|
|
42126
|
+
var routeRunnerName = 'run' + notCommon$1.capitalizeFirstLetter(params[1]);
|
|
42113
42127
|
|
|
42114
|
-
|
|
42115
|
-
|
|
42128
|
+
if (this[routeRunnerName] && typeof this[routeRunnerName] === 'function') {
|
|
42129
|
+
return this[routeRunnerName](params);
|
|
42130
|
+
}
|
|
42116
42131
|
}
|
|
42117
42132
|
}
|
|
42118
|
-
}
|
|
42119
42133
|
|
|
42120
|
-
|
|
42134
|
+
return this.runList(params);
|
|
42135
|
+
} catch (e) {
|
|
42136
|
+
notCommon$1.report(e);
|
|
42137
|
+
this.showErrorMessage(e);
|
|
42138
|
+
}
|
|
42121
42139
|
}
|
|
42122
42140
|
}, {
|
|
42123
42141
|
key: "runCreate",
|
|
42124
42142
|
value: function () {
|
|
42125
|
-
var _runCreate = asyncToGenerator( /*#__PURE__*/regenerator.mark(function
|
|
42143
|
+
var _runCreate = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee3() {
|
|
42126
42144
|
var _this4 = this;
|
|
42127
42145
|
|
|
42128
|
-
var defData, manifest;
|
|
42129
|
-
|
|
42146
|
+
var defData, manifest, _Form$build, ui, validator;
|
|
42147
|
+
|
|
42148
|
+
return regenerator.wrap(function _callee3$(_context3) {
|
|
42130
42149
|
while (1) {
|
|
42131
|
-
switch (
|
|
42150
|
+
switch (_context3.prev = _context3.next) {
|
|
42132
42151
|
case 0:
|
|
42133
|
-
|
|
42152
|
+
_context3.prev = 0;
|
|
42153
|
+
_context3.next = 3;
|
|
42134
42154
|
return this.preloadVariants('create');
|
|
42135
42155
|
|
|
42136
|
-
case
|
|
42156
|
+
case 3:
|
|
42137
42157
|
this.setBreadcrumbs([{
|
|
42138
42158
|
title: 'Добавление',
|
|
42139
42159
|
url: this.getModelActionURL(false, 'create')
|
|
42140
42160
|
}]);
|
|
42141
42161
|
|
|
42142
42162
|
if (!this.ui.create) {
|
|
42143
|
-
|
|
42163
|
+
_context3.next = 8;
|
|
42144
42164
|
break;
|
|
42145
42165
|
}
|
|
42146
42166
|
|
|
42147
|
-
return
|
|
42167
|
+
return _context3.abrupt("return");
|
|
42148
42168
|
|
|
42149
|
-
case
|
|
42169
|
+
case 8:
|
|
42150
42170
|
this.$destroyUI();
|
|
42151
42171
|
|
|
42152
|
-
case
|
|
42172
|
+
case 9:
|
|
42153
42173
|
defData = this.createDefault();
|
|
42154
42174
|
|
|
42155
42175
|
if (defData.getData) {
|
|
@@ -42157,26 +42177,64 @@ var notBulma = (function (exports) {
|
|
|
42157
42177
|
}
|
|
42158
42178
|
|
|
42159
42179
|
manifest = this.app.getInterfaceManifest()[this.getModelName()];
|
|
42160
|
-
|
|
42180
|
+
_Form$build = Form.build({
|
|
42161
42181
|
target: this.els.main,
|
|
42162
42182
|
manifest: manifest,
|
|
42163
42183
|
action: 'create',
|
|
42164
42184
|
options: {},
|
|
42165
42185
|
validators: this.getOptions('Validators'),
|
|
42166
42186
|
data: defData
|
|
42167
|
-
});
|
|
42168
|
-
this.ui.create
|
|
42169
|
-
|
|
42170
|
-
|
|
42187
|
+
}), ui = _Form$build.ui, validator = _Form$build.validator;
|
|
42188
|
+
this.ui.create = ui;
|
|
42189
|
+
this.validator.create = validator;
|
|
42190
|
+
this.ui.create.$on('submit', /*#__PURE__*/function () {
|
|
42191
|
+
var _ref = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(ev) {
|
|
42192
|
+
var success;
|
|
42193
|
+
return regenerator.wrap(function _callee2$(_context2) {
|
|
42194
|
+
while (1) {
|
|
42195
|
+
switch (_context2.prev = _context2.next) {
|
|
42196
|
+
case 0:
|
|
42197
|
+
_context2.next = 2;
|
|
42198
|
+
return _this4.onActionSubmit('create', ev.detail);
|
|
42199
|
+
|
|
42200
|
+
case 2:
|
|
42201
|
+
success = _context2.sent;
|
|
42202
|
+
|
|
42203
|
+
if (success) {
|
|
42204
|
+
setTimeout(function () {
|
|
42205
|
+
return _this4.goList();
|
|
42206
|
+
}, 1000);
|
|
42207
|
+
}
|
|
42208
|
+
|
|
42209
|
+
case 4:
|
|
42210
|
+
case "end":
|
|
42211
|
+
return _context2.stop();
|
|
42212
|
+
}
|
|
42213
|
+
}
|
|
42214
|
+
}, _callee2);
|
|
42215
|
+
}));
|
|
42216
|
+
|
|
42217
|
+
return function (_x) {
|
|
42218
|
+
return _ref.apply(this, arguments);
|
|
42219
|
+
};
|
|
42220
|
+
}());
|
|
42171
42221
|
this.ui.create.$on('reject', this.goList.bind(this));
|
|
42172
42222
|
this.emit('after:render:create');
|
|
42223
|
+
_context3.next = 24;
|
|
42224
|
+
break;
|
|
42173
42225
|
|
|
42174
|
-
case
|
|
42226
|
+
case 20:
|
|
42227
|
+
_context3.prev = 20;
|
|
42228
|
+
_context3.t0 = _context3["catch"](0);
|
|
42229
|
+
notCommon$1.report(_context3.t0);
|
|
42230
|
+
this.showErrorMessage(_context3.t0);
|
|
42231
|
+
|
|
42232
|
+
case 24:
|
|
42175
42233
|
case "end":
|
|
42176
|
-
return
|
|
42234
|
+
return _context3.stop();
|
|
42177
42235
|
}
|
|
42178
42236
|
}
|
|
42179
|
-
},
|
|
42237
|
+
}, _callee3, this, [[0, 20]]);
|
|
42180
42238
|
}));
|
|
42181
42239
|
|
|
42182
42240
|
function runCreate() {
|
|
@@ -42188,74 +42246,85 @@ var notBulma = (function (exports) {
|
|
|
42188
42246
|
}, {
|
|
42189
42247
|
key: "runDetails",
|
|
42190
42248
|
value: function () {
|
|
42191
|
-
var _runDetails = asyncToGenerator( /*#__PURE__*/regenerator.mark(function
|
|
42192
|
-
var
|
|
42249
|
+
var _runDetails = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee4(params) {
|
|
42250
|
+
var idField, query, manifest, res, title, _Form$build2, ui, validator;
|
|
42193
42251
|
|
|
42194
|
-
|
|
42195
|
-
return regenerator.wrap(function _callee3$(_context3) {
|
|
42252
|
+
return regenerator.wrap(function _callee4$(_context4) {
|
|
42196
42253
|
while (1) {
|
|
42197
|
-
switch (
|
|
42254
|
+
switch (_context4.prev = _context4.next) {
|
|
42198
42255
|
case 0:
|
|
42256
|
+
_context4.prev = 0;
|
|
42199
42257
|
idField = this.getOptions('details.idField', '_id'), query = {};
|
|
42200
|
-
|
|
42258
|
+
_context4.next = 4;
|
|
42201
42259
|
return this.preloadVariants('details');
|
|
42202
42260
|
|
|
42203
|
-
case
|
|
42261
|
+
case 4:
|
|
42204
42262
|
this.setBreadcrumbs([{
|
|
42205
42263
|
title: 'Просмотр',
|
|
42206
42264
|
url: this.getModelActionURL(params[0], false)
|
|
42207
42265
|
}]);
|
|
42208
42266
|
|
|
42209
42267
|
if (!this.ui.details) {
|
|
42210
|
-
|
|
42268
|
+
_context4.next = 9;
|
|
42211
42269
|
break;
|
|
42212
42270
|
}
|
|
42213
42271
|
|
|
42214
|
-
return
|
|
42272
|
+
return _context4.abrupt("return");
|
|
42215
42273
|
|
|
42216
|
-
case
|
|
42274
|
+
case 9:
|
|
42217
42275
|
this.$destroyUI();
|
|
42218
42276
|
|
|
42219
|
-
case
|
|
42277
|
+
case 10:
|
|
42220
42278
|
manifest = this.app.getInterfaceManifest()[this.getModelName()];
|
|
42221
42279
|
query[idField] = params[0];
|
|
42222
|
-
|
|
42223
|
-
|
|
42224
|
-
var title = _this5.getItemTitle(res.result);
|
|
42225
|
-
|
|
42226
|
-
_this5.setBreadcrumbs([{
|
|
42227
|
-
title: "\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \"".concat(title, "\""),
|
|
42228
|
-
url: _this5.getModelActionURL(params[0], false)
|
|
42229
|
-
}]);
|
|
42230
|
-
|
|
42231
|
-
_this5.ui.details = Form.build({
|
|
42232
|
-
target: _this5.els.main,
|
|
42233
|
-
manifest: manifest,
|
|
42234
|
-
action: 'get',
|
|
42235
|
-
options: {
|
|
42236
|
-
readonly: true
|
|
42237
|
-
},
|
|
42238
|
-
validators: _this5.getOptions('Validators'),
|
|
42239
|
-
data: res.result
|
|
42240
|
-
});
|
|
42241
|
-
|
|
42242
|
-
_this5.emit('after:render:details');
|
|
42243
|
-
|
|
42244
|
-
_this5.ui.details.$on('reject', _this5.goList.bind(_this5));
|
|
42245
|
-
} else {
|
|
42246
|
-
_this5.showErrorMessage(res);
|
|
42247
|
-
}
|
|
42248
|
-
}).catch(this.error.bind(this));
|
|
42280
|
+
_context4.next = 14;
|
|
42281
|
+
return this.getModel(query)['$get']();
|
|
42249
42282
|
|
|
42250
|
-
case
|
|
42283
|
+
case 14:
|
|
42284
|
+
res = _context4.sent;
|
|
42285
|
+
|
|
42286
|
+
if (res.status === 'ok') {
|
|
42287
|
+
title = this.getItemTitle(res.result);
|
|
42288
|
+
this.setBreadcrumbs([{
|
|
42289
|
+
title: "\u041F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \"".concat(title, "\""),
|
|
42290
|
+
url: this.getModelActionURL(params[0], false)
|
|
42291
|
+
}]);
|
|
42292
|
+
_Form$build2 = Form.build({
|
|
42293
|
+
target: this.els.main,
|
|
42294
|
+
manifest: manifest,
|
|
42295
|
+
action: 'get',
|
|
42296
|
+
options: {
|
|
42297
|
+
readonly: true
|
|
42298
|
+
},
|
|
42299
|
+
validators: this.getOptions('Validators'),
|
|
42300
|
+
data: res.result
|
|
42301
|
+
}), ui = _Form$build2.ui, validator = _Form$build2.validator;
|
|
42302
|
+
this.ui.details = ui;
|
|
42303
|
+
this.validator.details = validator;
|
|
42304
|
+
this.emit('after:render:details');
|
|
42305
|
+
this.ui.details.$on('reject', this.goList.bind(this));
|
|
42306
|
+
} else {
|
|
42307
|
+
this.showErrorMessage(res);
|
|
42308
|
+
}
|
|
42309
|
+
|
|
42310
|
+
_context4.next = 22;
|
|
42311
|
+
break;
|
|
42312
|
+
|
|
42313
|
+
case 18:
|
|
42314
|
+
_context4.prev = 18;
|
|
42315
|
+
_context4.t0 = _context4["catch"](0);
|
|
42316
|
+
notCommon$1.report(_context4.t0);
|
|
42317
|
+
this.showErrorMessage(_context4.t0);
|
|
42318
|
+
|
|
42319
|
+
case 22:
|
|
42251
42320
|
case "end":
|
|
42252
|
-
return
|
|
42321
|
+
return _context4.stop();
|
|
42253
42322
|
}
|
|
42254
42323
|
}
|
|
42255
|
-
},
|
|
42324
|
+
}, _callee4, this, [[0, 18]]);
|
|
42256
42325
|
}));
|
|
42257
42326
|
|
|
42258
|
-
function runDetails(
|
|
42327
|
+
function runDetails(_x2) {
|
|
42259
42328
|
return _runDetails.apply(this, arguments);
|
|
42260
42329
|
}
|
|
42261
42330
|
|
|
@@ -42264,76 +42333,112 @@ var notBulma = (function (exports) {
|
|
|
42264
42333
|
}, {
|
|
42265
42334
|
key: "runUpdate",
|
|
42266
42335
|
value: function () {
|
|
42267
|
-
var _runUpdate = asyncToGenerator( /*#__PURE__*/regenerator.mark(function
|
|
42268
|
-
var
|
|
42336
|
+
var _runUpdate = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee6(params) {
|
|
42337
|
+
var _this5 = this;
|
|
42269
42338
|
|
|
42270
|
-
var idField, query, manifest;
|
|
42271
|
-
|
|
42339
|
+
var idField, query, id, manifest, res, title, _Form$build3, ui, validator;
|
|
42340
|
+
|
|
42341
|
+
return regenerator.wrap(function _callee6$(_context6) {
|
|
42272
42342
|
while (1) {
|
|
42273
|
-
switch (
|
|
42343
|
+
switch (_context6.prev = _context6.next) {
|
|
42274
42344
|
case 0:
|
|
42275
|
-
|
|
42276
|
-
|
|
42345
|
+
_context6.prev = 0;
|
|
42346
|
+
idField = this.getOptions('update.idField', '_id'), query = {}, id = params[0];
|
|
42347
|
+
_context6.next = 4;
|
|
42277
42348
|
return this.preloadVariants('update');
|
|
42278
42349
|
|
|
42279
|
-
case
|
|
42350
|
+
case 4:
|
|
42280
42351
|
this.setBreadcrumbs([{
|
|
42281
42352
|
title: 'Редактирование',
|
|
42282
|
-
url: this.getModelActionURL(
|
|
42353
|
+
url: this.getModelActionURL(id, 'update')
|
|
42283
42354
|
}]);
|
|
42284
42355
|
|
|
42285
42356
|
if (!this.ui.update) {
|
|
42286
|
-
|
|
42357
|
+
_context6.next = 9;
|
|
42287
42358
|
break;
|
|
42288
42359
|
}
|
|
42289
42360
|
|
|
42290
|
-
return
|
|
42361
|
+
return _context6.abrupt("return");
|
|
42291
42362
|
|
|
42292
|
-
case
|
|
42363
|
+
case 9:
|
|
42293
42364
|
this.$destroyUI();
|
|
42294
42365
|
|
|
42295
|
-
case
|
|
42366
|
+
case 10:
|
|
42296
42367
|
manifest = this.app.getInterfaceManifest()[this.getModelName()];
|
|
42297
42368
|
query[idField] = params[0];
|
|
42298
|
-
|
|
42299
|
-
|
|
42300
|
-
var title = _this6.getItemTitle(res.result);
|
|
42301
|
-
|
|
42302
|
-
_this6.setBreadcrumbs([{
|
|
42303
|
-
title: "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \"".concat(title, "\""),
|
|
42304
|
-
url: _this6.getModelActionURL(params[0], 'update')
|
|
42305
|
-
}]);
|
|
42306
|
-
|
|
42307
|
-
_this6.ui.update = Form.build({
|
|
42308
|
-
target: _this6.els.main,
|
|
42309
|
-
manifest: manifest,
|
|
42310
|
-
action: 'update',
|
|
42311
|
-
options: {},
|
|
42312
|
-
validators: _this6.getOptions('Validators'),
|
|
42313
|
-
data: notCommon$1.stripProxy(res.result)
|
|
42314
|
-
});
|
|
42315
|
-
|
|
42316
|
-
_this6.ui.update.$on('submit', function (ev) {
|
|
42317
|
-
_this6.onUpdateFormSubmit(ev.detail);
|
|
42318
|
-
});
|
|
42319
|
-
|
|
42320
|
-
_this6.ui.update.$on('reject', _this6.goList.bind(_this6));
|
|
42321
|
-
|
|
42322
|
-
_this6.emit('after:render:update');
|
|
42323
|
-
} else {
|
|
42324
|
-
_this6.showErrorMessage(res);
|
|
42325
|
-
}
|
|
42326
|
-
}).catch(this.error.bind(this));
|
|
42369
|
+
_context6.next = 14;
|
|
42370
|
+
return this.getModel(query).$getRaw();
|
|
42327
42371
|
|
|
42328
|
-
case
|
|
42372
|
+
case 14:
|
|
42373
|
+
res = _context6.sent;
|
|
42374
|
+
|
|
42375
|
+
if (res.status === 'ok') {
|
|
42376
|
+
title = this.getItemTitle(res.result);
|
|
42377
|
+
this.setBreadcrumbs([{
|
|
42378
|
+
title: "\u0420\u0435\u0434\u0430\u043A\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435 \"".concat(title, "\""),
|
|
42379
|
+
url: this.getModelActionURL(params[0], 'update')
|
|
42380
|
+
}]);
|
|
42381
|
+
_Form$build3 = Form.build({
|
|
42382
|
+
target: this.els.main,
|
|
42383
|
+
manifest: manifest,
|
|
42384
|
+
action: 'update',
|
|
42385
|
+
options: {},
|
|
42386
|
+
validators: this.getOptions('Validators'),
|
|
42387
|
+
data: notCommon$1.stripProxy(res.result)
|
|
42388
|
+
}), ui = _Form$build3.ui, validator = _Form$build3.validator;
|
|
42389
|
+
this.ui.update = ui;
|
|
42390
|
+
this.validator.update = validator;
|
|
42391
|
+
this.ui.update.$on('submit', /*#__PURE__*/function () {
|
|
42392
|
+
var _ref2 = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee5(ev) {
|
|
42393
|
+
var success;
|
|
42394
|
+
return regenerator.wrap(function _callee5$(_context5) {
|
|
42395
|
+
while (1) {
|
|
42396
|
+
switch (_context5.prev = _context5.next) {
|
|
42397
|
+
case 0:
|
|
42398
|
+
success = _this5.onActionSubmit('update', ev.detail);
|
|
42399
|
+
|
|
42400
|
+
if (success) {
|
|
42401
|
+
setTimeout(function () {
|
|
42402
|
+
return _this5.goDetails(id);
|
|
42403
|
+
}, 1000);
|
|
42404
|
+
}
|
|
42405
|
+
|
|
42406
|
+
case 2:
|
|
42407
|
+
case "end":
|
|
42408
|
+
return _context5.stop();
|
|
42409
|
+
}
|
|
42410
|
+
}
|
|
42411
|
+
}, _callee5);
|
|
42412
|
+
}));
|
|
42413
|
+
|
|
42414
|
+
return function (_x4) {
|
|
42415
|
+
return _ref2.apply(this, arguments);
|
|
42416
|
+
};
|
|
42417
|
+
}());
|
|
42418
|
+
this.ui.update.$on('reject', this.goList.bind(this));
|
|
42419
|
+
this.emit('after:render:update');
|
|
42420
|
+
} else {
|
|
42421
|
+
this.showErrorMessage(res);
|
|
42422
|
+
}
|
|
42423
|
+
|
|
42424
|
+
_context6.next = 22;
|
|
42425
|
+
break;
|
|
42426
|
+
|
|
42427
|
+
case 18:
|
|
42428
|
+
_context6.prev = 18;
|
|
42429
|
+
_context6.t0 = _context6["catch"](0);
|
|
42430
|
+
notCommon$1.report(_context6.t0);
|
|
42431
|
+
this.showErrorMessage(_context6.t0);
|
|
42432
|
+
|
|
42433
|
+
case 22:
|
|
42329
42434
|
case "end":
|
|
42330
|
-
return
|
|
42435
|
+
return _context6.stop();
|
|
42331
42436
|
}
|
|
42332
42437
|
}
|
|
42333
|
-
},
|
|
42438
|
+
}, _callee6, this, [[0, 18]]);
|
|
42334
42439
|
}));
|
|
42335
42440
|
|
|
42336
|
-
function runUpdate(
|
|
42441
|
+
function runUpdate(_x3) {
|
|
42337
42442
|
return _runUpdate.apply(this, arguments);
|
|
42338
42443
|
}
|
|
42339
42444
|
|
|
@@ -42342,45 +42447,64 @@ var notBulma = (function (exports) {
|
|
|
42342
42447
|
}, {
|
|
42343
42448
|
key: "runDelete",
|
|
42344
42449
|
value: function () {
|
|
42345
|
-
var _runDelete = asyncToGenerator( /*#__PURE__*/regenerator.mark(function
|
|
42346
|
-
var
|
|
42347
|
-
|
|
42348
|
-
return regenerator.wrap(function _callee5$(_context5) {
|
|
42450
|
+
var _runDelete = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee7(params) {
|
|
42451
|
+
var success;
|
|
42452
|
+
return regenerator.wrap(function _callee7$(_context7) {
|
|
42349
42453
|
while (1) {
|
|
42350
|
-
switch (
|
|
42454
|
+
switch (_context7.prev = _context7.next) {
|
|
42351
42455
|
case 0:
|
|
42352
|
-
|
|
42456
|
+
_context7.prev = 0;
|
|
42457
|
+
_context7.next = 3;
|
|
42353
42458
|
return this.preloadVariants('delete');
|
|
42354
42459
|
|
|
42355
|
-
case
|
|
42460
|
+
case 3:
|
|
42356
42461
|
this.setBreadcrumbs([{
|
|
42357
42462
|
title: 'Удаление',
|
|
42358
42463
|
url: this.getModelActionURL(params[0], 'delete')
|
|
42359
42464
|
}]);
|
|
42360
42465
|
|
|
42361
|
-
if (confirm('Удалить запись?')) {
|
|
42362
|
-
|
|
42363
|
-
|
|
42364
|
-
|
|
42365
|
-
|
|
42366
|
-
|
|
42367
|
-
|
|
42466
|
+
if (!confirm('Удалить запись?')) {
|
|
42467
|
+
_context7.next = 11;
|
|
42468
|
+
break;
|
|
42469
|
+
}
|
|
42470
|
+
|
|
42471
|
+
_context7.next = 7;
|
|
42472
|
+
return this.onActionSubmit('delete', {
|
|
42473
|
+
_id: params[0]
|
|
42474
|
+
});
|
|
42475
|
+
|
|
42476
|
+
case 7:
|
|
42477
|
+
success = _context7.sent;
|
|
42368
42478
|
|
|
42369
|
-
|
|
42370
|
-
});
|
|
42371
|
-
} else {
|
|
42479
|
+
if (success) {
|
|
42372
42480
|
this.goList();
|
|
42373
42481
|
}
|
|
42374
42482
|
|
|
42375
|
-
|
|
42483
|
+
_context7.next = 12;
|
|
42484
|
+
break;
|
|
42485
|
+
|
|
42486
|
+
case 11:
|
|
42487
|
+
this.goList();
|
|
42488
|
+
|
|
42489
|
+
case 12:
|
|
42490
|
+
_context7.next = 18;
|
|
42491
|
+
break;
|
|
42492
|
+
|
|
42493
|
+
case 14:
|
|
42494
|
+
_context7.prev = 14;
|
|
42495
|
+
_context7.t0 = _context7["catch"](0);
|
|
42496
|
+
notCommon$1.report(_context7.t0);
|
|
42497
|
+
this.showErrorMessage(_context7.t0);
|
|
42498
|
+
|
|
42499
|
+
case 18:
|
|
42376
42500
|
case "end":
|
|
42377
|
-
return
|
|
42501
|
+
return _context7.stop();
|
|
42378
42502
|
}
|
|
42379
42503
|
}
|
|
42380
|
-
},
|
|
42504
|
+
}, _callee7, this, [[0, 14]]);
|
|
42381
42505
|
}));
|
|
42382
42506
|
|
|
42383
|
-
function runDelete(
|
|
42507
|
+
function runDelete(_x5) {
|
|
42384
42508
|
return _runDelete.apply(this, arguments);
|
|
42385
42509
|
}
|
|
42386
42510
|
|
|
@@ -42389,34 +42513,35 @@ var notBulma = (function (exports) {
|
|
|
42389
42513
|
}, {
|
|
42390
42514
|
key: "runList",
|
|
42391
42515
|
value: function () {
|
|
42392
|
-
var _runList = asyncToGenerator( /*#__PURE__*/regenerator.mark(function
|
|
42393
|
-
var
|
|
42516
|
+
var _runList = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee8() {
|
|
42517
|
+
var _this6 = this;
|
|
42394
42518
|
|
|
42395
42519
|
var DEFAULT_OPTIONS_TABLE, TABLE_OPTIONS;
|
|
42396
|
-
return regenerator.wrap(function
|
|
42520
|
+
return regenerator.wrap(function _callee8$(_context8) {
|
|
42397
42521
|
while (1) {
|
|
42398
|
-
switch (
|
|
42522
|
+
switch (_context8.prev = _context8.next) {
|
|
42399
42523
|
case 0:
|
|
42400
|
-
|
|
42524
|
+
_context8.prev = 0;
|
|
42525
|
+
_context8.next = 3;
|
|
42401
42526
|
return this.preloadVariants('list');
|
|
42402
42527
|
|
|
42403
|
-
case
|
|
42528
|
+
case 3:
|
|
42404
42529
|
this.setBreadcrumbs([{
|
|
42405
42530
|
title: 'Список',
|
|
42406
42531
|
url: this.getModelURL()
|
|
42407
42532
|
}]);
|
|
42408
42533
|
|
|
42409
42534
|
if (!this.ui.list) {
|
|
42410
|
-
|
|
42535
|
+
_context8.next = 8;
|
|
42411
42536
|
break;
|
|
42412
42537
|
}
|
|
42413
42538
|
|
|
42414
|
-
return
|
|
42539
|
+
return _context8.abrupt("return");
|
|
42415
42540
|
|
|
42416
|
-
case
|
|
42541
|
+
case 8:
|
|
42417
42542
|
this.$destroyUI();
|
|
42418
42543
|
|
|
42419
|
-
case
|
|
42544
|
+
case 9:
|
|
42420
42545
|
DEFAULT_OPTIONS_TABLE = {
|
|
42421
42546
|
interface: {
|
|
42422
42547
|
combined: true,
|
|
@@ -42447,7 +42572,7 @@ var notBulma = (function (exports) {
|
|
|
42447
42572
|
}
|
|
42448
42573
|
};
|
|
42449
42574
|
Object.keys(DEFAULT_OPTIONS_TABLE).forEach(function (key) {
|
|
42450
|
-
var optVal =
|
|
42575
|
+
var optVal = _this6.getOptions("list.".concat(key), DEFAULT_OPTIONS_TABLE[key]);
|
|
42451
42576
|
|
|
42452
42577
|
if (typeof optVal !== 'undefined') {
|
|
42453
42578
|
TABLE_OPTIONS.options[key] = optVal;
|
|
@@ -42455,13 +42580,21 @@ var notBulma = (function (exports) {
|
|
|
42455
42580
|
});
|
|
42456
42581
|
this.ui.list = new notTable(TABLE_OPTIONS);
|
|
42457
42582
|
this.emit('after:render:list');
|
|
42583
|
+
_context8.next = 20;
|
|
42584
|
+
break;
|
|
42585
|
+
|
|
42586
|
+
case 16:
|
|
42587
|
+
_context8.prev = 16;
|
|
42588
|
+
_context8.t0 = _context8["catch"](0);
|
|
42589
|
+
notCommon$1.report(_context8.t0);
|
|
42590
|
+
this.showErrorMessage(_context8.t0);
|
|
42458
42591
|
|
|
42459
|
-
case
|
|
42592
|
+
case 20:
|
|
42460
42593
|
case "end":
|
|
42461
|
-
return
|
|
42594
|
+
return _context8.stop();
|
|
42462
42595
|
}
|
|
42463
42596
|
}
|
|
42464
|
-
},
|
|
42597
|
+
}, _callee8, this, [[0, 16]]);
|
|
42465
42598
|
}));
|
|
42466
42599
|
|
|
42467
42600
|
function runList() {
|
|
@@ -42496,91 +42629,74 @@ var notBulma = (function (exports) {
|
|
|
42496
42629
|
this.app.getWorking('router').navigate(this.getModelURL());
|
|
42497
42630
|
}
|
|
42498
42631
|
}, {
|
|
42499
|
-
key: "
|
|
42500
|
-
value: function
|
|
42501
|
-
var
|
|
42632
|
+
key: "onActionSubmit",
|
|
42633
|
+
value: function () {
|
|
42634
|
+
var _onActionSubmit = asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee9(action, item) {
|
|
42635
|
+
var result;
|
|
42636
|
+
return regenerator.wrap(function _callee9$(_context9) {
|
|
42637
|
+
while (1) {
|
|
42638
|
+
switch (_context9.prev = _context9.next) {
|
|
42639
|
+
case 0:
|
|
42640
|
+
_context9.prev = 0;
|
|
42641
|
+
this.ui[action].setLoading();
|
|
42642
|
+
result = this.getModel(item)["$".concat(action)]();
|
|
42643
|
+
this.processResult(this.ui[action], result);
|
|
42644
|
+
return _context9.abrupt("return", true);
|
|
42502
42645
|
|
|
42503
|
-
|
|
42504
|
-
|
|
42505
|
-
|
|
42646
|
+
case 7:
|
|
42647
|
+
_context9.prev = 7;
|
|
42648
|
+
_context9.t0 = _context9["catch"](0);
|
|
42649
|
+
this.processResult(this.ui[action], _context9.t0);
|
|
42650
|
+
return _context9.abrupt("return", false);
|
|
42506
42651
|
|
|
42507
|
-
|
|
42652
|
+
case 11:
|
|
42653
|
+
_context9.prev = 11;
|
|
42654
|
+
this.ui[action].resetLoading();
|
|
42655
|
+
return _context9.finish(11);
|
|
42508
42656
|
|
|
42509
|
-
|
|
42510
|
-
|
|
42511
|
-
|
|
42512
|
-
|
|
42513
|
-
|
|
42514
|
-
|
|
42515
|
-
|
|
42516
|
-
});
|
|
42517
|
-
}
|
|
42518
|
-
}, {
|
|
42519
|
-
key: "onUpdateFormSubmit",
|
|
42520
|
-
value: function onUpdateFormSubmit(item) {
|
|
42521
|
-
var _this10 = this;
|
|
42657
|
+
case 14:
|
|
42658
|
+
case "end":
|
|
42659
|
+
return _context9.stop();
|
|
42660
|
+
}
|
|
42661
|
+
}
|
|
42662
|
+
}, _callee9, this, [[0, 7, 11, 14]]);
|
|
42663
|
+
}));
|
|
42522
42664
|
|
|
42523
|
-
|
|
42524
|
-
|
|
42525
|
-
|
|
42665
|
+
function onActionSubmit(_x6, _x7) {
|
|
42666
|
+
return _onActionSubmit.apply(this, arguments);
|
|
42667
|
+
}
|
|
42526
42668
|
|
|
42527
|
-
|
|
42528
|
-
|
|
42529
|
-
return _this10.goList(_this10.app);
|
|
42530
|
-
}, 3000);
|
|
42531
|
-
}
|
|
42532
|
-
}).catch(function (e) {
|
|
42533
|
-
_this10.showResult(_this10.ui.update, e);
|
|
42534
|
-
});
|
|
42535
|
-
}
|
|
42669
|
+
return onActionSubmit;
|
|
42670
|
+
}()
|
|
42536
42671
|
}, {
|
|
42537
|
-
key: "
|
|
42538
|
-
value: function
|
|
42539
|
-
|
|
42672
|
+
key: "processResult",
|
|
42673
|
+
value: function processResult(ui, result) {
|
|
42674
|
+
var ifSuccess = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
|
|
42540
42675
|
|
|
42541
|
-
if (
|
|
42542
|
-
|
|
42543
|
-
|
|
42676
|
+
if (result.status === 'ok') {
|
|
42677
|
+
ui.showSuccess();
|
|
42678
|
+
ifSuccess && ifSuccess();
|
|
42544
42679
|
} else {
|
|
42545
|
-
|
|
42546
|
-
if (res.status === 'error') {
|
|
42547
|
-
if (!Array.isArray(res.error)) {
|
|
42548
|
-
res.error = [ERROR_DEFAULT];
|
|
42549
|
-
}
|
|
42550
|
-
|
|
42551
|
-
ui.addFormError(res.error);
|
|
42552
|
-
} else if (res.status === 'ok') {
|
|
42553
|
-
ui.showSuccess();
|
|
42554
|
-
}
|
|
42555
|
-
} else {
|
|
42556
|
-
this.processFieldsErrors(ui, res);
|
|
42557
|
-
|
|
42558
|
-
if (res.error) {
|
|
42559
|
-
ui.addFormError(res.error);
|
|
42560
|
-
}
|
|
42561
|
-
|
|
42562
|
-
if (!res.error) {
|
|
42563
|
-
ui.showSuccess();
|
|
42564
|
-
}
|
|
42565
|
-
}
|
|
42680
|
+
this.setFormErrors(ui, result);
|
|
42566
42681
|
}
|
|
42567
42682
|
}
|
|
42568
42683
|
}, {
|
|
42569
|
-
key: "
|
|
42570
|
-
value: function
|
|
42571
|
-
|
|
42572
|
-
|
|
42573
|
-
|
|
42574
|
-
|
|
42575
|
-
|
|
42576
|
-
Object.keys(res.errors).forEach(function (fieldName) {
|
|
42577
|
-
var _res$error;
|
|
42684
|
+
key: "setFormErrors",
|
|
42685
|
+
value: function setFormErrors(ui, result) {
|
|
42686
|
+
var status = {
|
|
42687
|
+
form: [],
|
|
42688
|
+
fields: {}
|
|
42689
|
+
};
|
|
42578
42690
|
|
|
42579
|
-
|
|
42691
|
+
if (result.message) {
|
|
42692
|
+
result.form.push(result.message);
|
|
42693
|
+
}
|
|
42580
42694
|
|
|
42581
|
-
|
|
42582
|
-
});
|
|
42695
|
+
if (result.errors && Object.keys(result.errors).length > 0) {
|
|
42696
|
+
result.errors = _objectSpread({}, result.errors);
|
|
42583
42697
|
}
|
|
42698
|
+
|
|
42699
|
+
ui.updateFormValidationStatus(status);
|
|
42584
42700
|
}
|
|
42585
42701
|
}, {
|
|
42586
42702
|
key: "$destroyUI",
|
|
@@ -42589,6 +42705,10 @@ var notBulma = (function (exports) {
|
|
|
42589
42705
|
this.ui[name].$destroy && this.ui[name].$destroy();
|
|
42590
42706
|
delete this.ui[name];
|
|
42591
42707
|
}
|
|
42708
|
+
|
|
42709
|
+
for (var _name in this.validator) {
|
|
42710
|
+
delete this.validator[_name];
|
|
42711
|
+
}
|
|
42592
42712
|
}
|
|
42593
42713
|
}, {
|
|
42594
42714
|
key: "showErrorMessage",
|
|
@@ -42598,7 +42718,7 @@ var notBulma = (function (exports) {
|
|
|
42598
42718
|
target: this.els.main,
|
|
42599
42719
|
props: {
|
|
42600
42720
|
title: 'Произошла ошибка',
|
|
42601
|
-
message: res.
|
|
42721
|
+
message: res.message ? res.message : UICommon.ERROR_DEFAULT
|
|
42602
42722
|
}
|
|
42603
42723
|
});
|
|
42604
42724
|
}
|
|
@@ -42618,35 +42738,7 @@ var notBulma = (function (exports) {
|
|
|
42618
42738
|
return ncCRUD;
|
|
42619
42739
|
}(notController$1);
|
|
42620
42740
|
|
|
42621
|
-
defineProperty$4(ncCRUD, "ERROR_DEFAULT",
|
|
42622
|
-
|
|
42623
|
-
var Validators = {
|
|
42624
|
-
fields: {
|
|
42625
|
-
term: function term(value) {
|
|
42626
|
-
var errors = [];
|
|
42627
|
-
|
|
42628
|
-
if (value !== '') {
|
|
42629
|
-
if (!Form.validator.isLength(value, {
|
|
42630
|
-
min: 3
|
|
42631
|
-
})) {
|
|
42632
|
-
errors.push('Минимальная длина 3 знаков');
|
|
42633
|
-
}
|
|
42634
|
-
}
|
|
42635
|
-
|
|
42636
|
-
return errors;
|
|
42637
|
-
}
|
|
42638
|
-
},
|
|
42639
|
-
forms: {
|
|
42640
|
-
search: function search() {
|
|
42641
|
-
var errors = {
|
|
42642
|
-
clean: true,
|
|
42643
|
-
fields: {},
|
|
42644
|
-
form: []
|
|
42645
|
-
};
|
|
42646
|
-
return errors;
|
|
42647
|
-
}
|
|
42648
|
-
}
|
|
42649
|
-
};
|
|
42741
|
+
defineProperty$4(ncCRUD, "ERROR_DEFAULT", UICommon.ERROR_DEFAULT);
|
|
42650
42742
|
|
|
42651
42743
|
/* src/various/filter.svelte generated by Svelte v3.44.2 */
|
|
42652
42744
|
|
|
@@ -42688,7 +42780,7 @@ var notBulma = (function (exports) {
|
|
|
42688
42780
|
};
|
|
42689
42781
|
}
|
|
42690
42782
|
|
|
42691
|
-
// (
|
|
42783
|
+
// (213:4) {#if show}
|
|
42692
42784
|
function create_if_block(ctx) {
|
|
42693
42785
|
let if_block_anchor;
|
|
42694
42786
|
let current;
|
|
@@ -42744,7 +42836,7 @@ var notBulma = (function (exports) {
|
|
|
42744
42836
|
};
|
|
42745
42837
|
}
|
|
42746
42838
|
|
|
42747
|
-
// (
|
|
42839
|
+
// (214:4) {#if props}
|
|
42748
42840
|
function create_if_block_1(ctx) {
|
|
42749
42841
|
let uiform;
|
|
42750
42842
|
let current;
|
|
@@ -42802,7 +42894,7 @@ var notBulma = (function (exports) {
|
|
|
42802
42894
|
};
|
|
42803
42895
|
}
|
|
42804
42896
|
|
|
42805
|
-
// (
|
|
42897
|
+
// (212:0) <UIContainer id='search-filter'>
|
|
42806
42898
|
function create_default_slot(ctx) {
|
|
42807
42899
|
let current_block_type_index;
|
|
42808
42900
|
let if_block;
|
|
@@ -43050,7 +43142,6 @@ var notBulma = (function (exports) {
|
|
|
43050
43142
|
$$invalidate(2, props = Form.prebuild({
|
|
43051
43143
|
manifest,
|
|
43052
43144
|
action: 'search',
|
|
43053
|
-
validators: Validators,
|
|
43054
43145
|
options: formOptions
|
|
43055
43146
|
}));
|
|
43056
43147
|
});
|