ecinc-cloud-wappaio 9.7.39 → 9.7.41

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.
@@ -281041,8 +281041,8 @@ RenderAttachColumn.install = function (Vue) {
281041
281041
  var DataTable = DataTable_src;
281042
281042
  var DataTable_Toolbar = Toolbar;
281043
281043
  var DataTable_RenderAttachColumn = RenderAttachColumn;
281044
- ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/DatetimeRange/src/index.vue?vue&type=template&id=8bfa0ffc&scoped=true
281045
- var srcvue_type_template_id_8bfa0ffc_scoped_true_render = function render() {
281044
+ ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/DatetimeRange/src/index.vue?vue&type=template&id=2e5427a8&scoped=true
281045
+ var srcvue_type_template_id_2e5427a8_scoped_true_render = function render() {
281046
281046
  var _vm = this,
281047
281047
  _c = _vm._self._c;
281048
281048
  return _c('el-row', [_vm.canEdit !== 1 && _vm.vo ? _c('el-col', {
@@ -281187,2048 +281187,10 @@ var srcvue_type_template_id_8bfa0ffc_scoped_true_render = function render() {
281187
281187
  }], null, false, 2421030280)
281188
281188
  })], 1) : _vm._e()], 1);
281189
281189
  };
281190
- var srcvue_type_template_id_8bfa0ffc_scoped_true_staticRenderFns = [];
281191
-
281192
- // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
281193
- var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(74100);
281194
- var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
281195
- ;// CONCATENATED MODULE: ./node_modules/vee-validate/dist/vee-validate.esm.js
281196
- /**
281197
- * vee-validate v3.4.15
281198
- * (c) 2023 Abdelrahman Awad
281199
- * @license MIT
281200
- */
281201
-
281202
-
281203
- /*! *****************************************************************************
281204
- Copyright (c) Microsoft Corporation.
281205
-
281206
- Permission to use, copy, modify, and/or distribute this software for any
281207
- purpose with or without fee is hereby granted.
281208
-
281209
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
281210
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
281211
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
281212
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
281213
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
281214
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
281215
- PERFORMANCE OF THIS SOFTWARE.
281216
- ***************************************************************************** */
281217
-
281218
- var __assign = function() {
281219
- __assign = Object.assign || function __assign(t) {
281220
- for (var s, i = 1, n = arguments.length; i < n; i++) {
281221
- s = arguments[i];
281222
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
281223
- }
281224
- return t;
281225
- };
281226
- return __assign.apply(this, arguments);
281227
- };
281228
-
281229
- function __awaiter(thisArg, _arguments, P, generator) {
281230
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
281231
- return new (P || (P = Promise))(function (resolve, reject) {
281232
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
281233
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
281234
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
281235
- step((generator = generator.apply(thisArg, _arguments || [])).next());
281236
- });
281237
- }
281238
-
281239
- function __generator(thisArg, body) {
281240
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
281241
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
281242
- function verb(n) { return function (v) { return step([n, v]); }; }
281243
- function step(op) {
281244
- if (f) throw new TypeError("Generator is already executing.");
281245
- while (_) try {
281246
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
281247
- if (y = 0, t) op = [op[0] & 2, t.value];
281248
- switch (op[0]) {
281249
- case 0: case 1: t = op; break;
281250
- case 4: _.label++; return { value: op[1], done: false };
281251
- case 5: _.label++; y = op[1]; op = [0]; continue;
281252
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
281253
- default:
281254
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
281255
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
281256
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
281257
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
281258
- if (t[2]) _.ops.pop();
281259
- _.trys.pop(); continue;
281260
- }
281261
- op = body.call(thisArg, _);
281262
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
281263
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
281264
- }
281265
- }
281266
-
281267
- function __spreadArrays() {
281268
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
281269
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
281270
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
281271
- r[k] = a[j];
281272
- return r;
281273
- }
281274
-
281275
- function vee_validate_esm_isNaN(value) {
281276
- // NaN is the one value that does not equal itself.
281277
- // eslint-disable-next-line
281278
- return value !== value;
281279
- }
281280
- function isNullOrUndefined(value) {
281281
- return value === null || value === undefined;
281282
- }
281283
- function isEmptyArray(arr) {
281284
- return Array.isArray(arr) && arr.length === 0;
281285
- }
281286
- var vee_validate_esm_isObject = function (obj) {
281287
- return obj !== null && obj && typeof obj === 'object' && !Array.isArray(obj);
281288
- };
281289
- /**
281290
- * A reference comparison function with NaN support
281291
- */
281292
- function isRefEqual(lhs, rhs) {
281293
- if (vee_validate_esm_isNaN(lhs) && vee_validate_esm_isNaN(rhs)) {
281294
- return true;
281295
- }
281296
- return lhs === rhs;
281297
- }
281298
- // Checks if a given value is not an empty string or null or undefined.
281299
- function isSpecified(val) {
281300
- if (val === '') {
281301
- return false;
281302
- }
281303
- return !isNullOrUndefined(val);
281304
- }
281305
- // eslint-disable-next-line @typescript-eslint/ban-types
281306
- function isCallable(fn) {
281307
- return typeof fn === 'function';
281308
- }
281309
- function isLocator(value) {
281310
- return isCallable(value) && !!value.__locatorRef;
281311
- }
281312
-
281313
- function findIndex(arrayLike, predicate) {
281314
- var array = Array.isArray(arrayLike) ? arrayLike : vee_validate_esm_toArray(arrayLike);
281315
- if (isCallable(array.findIndex)) {
281316
- return array.findIndex(predicate);
281317
- }
281318
- /* istanbul ignore next */
281319
- for (var i = 0; i < array.length; i++) {
281320
- if (predicate(array[i], i)) {
281321
- return i;
281322
- }
281323
- }
281324
- /* istanbul ignore next */
281325
- return -1;
281326
- }
281327
- /**
281328
- * finds the first element that satisfies the predicate callback, polyfills array.find
281329
- */
281330
- function find(arrayLike, predicate) {
281331
- var array = Array.isArray(arrayLike) ? arrayLike : vee_validate_esm_toArray(arrayLike);
281332
- var idx = findIndex(array, predicate);
281333
- return idx === -1 ? undefined : array[idx];
281334
- }
281335
- function includes(collection, item) {
281336
- return collection.indexOf(item) !== -1;
281337
- }
281338
- /**
281339
- * Converts an array-like object to array, provides a simple polyfill for Array.from
281340
- */
281341
- function vee_validate_esm_toArray(arrayLike) {
281342
- if (isCallable(Array.from)) {
281343
- return Array.from(arrayLike);
281344
- }
281345
- /* istanbul ignore next */
281346
- return _copyArray(arrayLike);
281347
- }
281348
- /* istanbul ignore next */
281349
- function _copyArray(arrayLike) {
281350
- var array = [];
281351
- var length = arrayLike.length;
281352
- for (var i = 0; i < length; i++) {
281353
- array.push(arrayLike[i]);
281354
- }
281355
- return array;
281356
- }
281357
- function values(obj) {
281358
- if (isCallable(Object.values)) {
281359
- return Object.values(obj);
281360
- }
281361
- // fallback to keys()
281362
- /* istanbul ignore next */
281363
- return Object.keys(obj).map(function (k) { return obj[k]; });
281364
- }
281365
- function vee_validate_esm_merge(target, source) {
281366
- Object.keys(source).forEach(function (key) {
281367
- if (vee_validate_esm_isObject(source[key])) {
281368
- if (!target[key]) {
281369
- target[key] = {};
281370
- }
281371
- vee_validate_esm_merge(target[key], source[key]);
281372
- return;
281373
- }
281374
- target[key] = source[key];
281375
- });
281376
- return target;
281377
- }
281378
-
281379
- function createFlags() {
281380
- return {
281381
- untouched: true,
281382
- touched: false,
281383
- dirty: false,
281384
- pristine: true,
281385
- valid: false,
281386
- invalid: false,
281387
- validated: false,
281388
- pending: false,
281389
- required: false,
281390
- changed: false,
281391
- passed: false,
281392
- failed: false
281393
- };
281394
- }
281395
-
281396
- function identity(x) {
281397
- return x;
281398
- }
281399
- function debounce(fn, wait, token) {
281400
- if (wait === void 0) { wait = 0; }
281401
- if (token === void 0) { token = { cancelled: false }; }
281402
- if (wait === 0) {
281403
- return fn;
281404
- }
281405
- var timeout;
281406
- return function () {
281407
- var args = [];
281408
- for (var _i = 0; _i < arguments.length; _i++) {
281409
- args[_i] = arguments[_i];
281410
- }
281411
- var later = function () {
281412
- timeout = undefined;
281413
- // check if the fn call was cancelled.
281414
- if (!token.cancelled)
281415
- fn.apply(void 0, args);
281416
- };
281417
- // because we might want to use Node.js setTimout for SSR.
281418
- clearTimeout(timeout);
281419
- timeout = setTimeout(later, wait);
281420
- };
281421
- }
281422
-
281423
- /**
281424
- * Emits a warning to the console
281425
- */
281426
- function warn(message) {
281427
- console.warn("[vee-validate] " + message);
281428
- }
281429
- /**
281430
- * Replaces placeholder values in a string with their actual values
281431
- */
281432
- function interpolate(template, values) {
281433
- return template.replace(/{([^}]+)}/g, function (_, p) {
281434
- return p in values ? values[p] : "{" + p + "}";
281435
- });
281436
- }
281437
-
281438
- var RULES = {};
281439
- function normalizeSchema(schema) {
281440
- var _a;
281441
- if ((_a = schema.params) === null || _a === void 0 ? void 0 : _a.length) {
281442
- schema.params = schema.params.map(function (param) {
281443
- if (typeof param === 'string') {
281444
- return { name: param };
281445
- }
281446
- return param;
281447
- });
281448
- }
281449
- return schema;
281450
- }
281451
- var RuleContainer = /** @class */ (function () {
281452
- function RuleContainer() {
281453
- }
281454
- RuleContainer.extend = function (name, schema) {
281455
- // if rule already exists, overwrite it.
281456
- var rule = normalizeSchema(schema);
281457
- if (RULES[name]) {
281458
- RULES[name] = vee_validate_esm_merge(RULES[name], schema);
281459
- return;
281460
- }
281461
- RULES[name] = __assign({ lazy: false, computesRequired: false }, rule);
281462
- };
281463
- RuleContainer.isLazy = function (name) {
281464
- var _a;
281465
- return !!((_a = RULES[name]) === null || _a === void 0 ? void 0 : _a.lazy);
281466
- };
281467
- RuleContainer.isRequireRule = function (name) {
281468
- var _a;
281469
- return !!((_a = RULES[name]) === null || _a === void 0 ? void 0 : _a.computesRequired);
281470
- };
281471
- RuleContainer.getRuleDefinition = function (ruleName) {
281472
- return RULES[ruleName];
281473
- };
281474
- return RuleContainer;
281475
- }());
281476
- /**
281477
- * Adds a custom validator to the list of validation rules.
281478
- */
281479
- function vee_validate_esm_extend(name, schema) {
281480
- // makes sure new rules are properly formatted.
281481
- guardExtend(name, schema);
281482
- // Full schema object.
281483
- if (typeof schema === 'object') {
281484
- RuleContainer.extend(name, schema);
281485
- return;
281486
- }
281487
- RuleContainer.extend(name, {
281488
- validate: schema
281489
- });
281490
- }
281491
- /**
281492
- * Guards from extension violations.
281493
- */
281494
- function guardExtend(name, validator) {
281495
- if (isCallable(validator)) {
281496
- return;
281497
- }
281498
- if (isCallable(validator.validate)) {
281499
- return;
281500
- }
281501
- if (RuleContainer.getRuleDefinition(name)) {
281502
- return;
281503
- }
281504
- throw new Error("Extension Error: The validator '" + name + "' must be a function or have a 'validate' method.");
281505
- }
281506
-
281507
- var DEFAULT_CONFIG = {
281508
- defaultMessage: "{_field_} is not valid.",
281509
- skipOptional: true,
281510
- classes: {
281511
- touched: 'touched',
281512
- untouched: 'untouched',
281513
- valid: 'valid',
281514
- invalid: 'invalid',
281515
- pristine: 'pristine',
281516
- dirty: 'dirty' // control has been interacted with
281517
- },
281518
- bails: true,
281519
- mode: 'aggressive',
281520
- useConstraintAttrs: true
281521
- };
281522
- var currentConfig = __assign({}, DEFAULT_CONFIG);
281523
- var getConfig = function () { return currentConfig; };
281524
- var setConfig = function (newConf) {
281525
- currentConfig = __assign(__assign({}, currentConfig), newConf);
281526
- };
281527
- var configure = function (cfg) {
281528
- setConfig(cfg);
281529
- };
281530
-
281531
- /**
281532
- * Normalizes the given rules expression.
281533
- */
281534
- function normalizeRules(rules) {
281535
- // if falsy value return an empty object.
281536
- var acc = {};
281537
- Object.defineProperty(acc, '_$$isNormalized', {
281538
- value: true,
281539
- writable: false,
281540
- enumerable: false,
281541
- configurable: false
281542
- });
281543
- if (!rules) {
281544
- return acc;
281545
- }
281546
- // Object is already normalized, skip.
281547
- if (vee_validate_esm_isObject(rules) && rules._$$isNormalized) {
281548
- return rules;
281549
- }
281550
- if (vee_validate_esm_isObject(rules)) {
281551
- return Object.keys(rules).reduce(function (prev, curr) {
281552
- var params = [];
281553
- if (rules[curr] === true) {
281554
- params = [];
281555
- }
281556
- else if (Array.isArray(rules[curr])) {
281557
- params = rules[curr];
281558
- }
281559
- else if (vee_validate_esm_isObject(rules[curr])) {
281560
- params = rules[curr];
281561
- }
281562
- else {
281563
- params = [rules[curr]];
281564
- }
281565
- if (rules[curr] !== false) {
281566
- prev[curr] = buildParams(curr, params);
281567
- }
281568
- return prev;
281569
- }, acc);
281570
- }
281571
- /* istanbul ignore if */
281572
- if (typeof rules !== 'string') {
281573
- warn('rules must be either a string or an object.');
281574
- return acc;
281575
- }
281576
- return rules.split('|').reduce(function (prev, rule) {
281577
- var parsedRule = parseRule(rule);
281578
- if (!parsedRule.name) {
281579
- return prev;
281580
- }
281581
- prev[parsedRule.name] = buildParams(parsedRule.name, parsedRule.params);
281582
- return prev;
281583
- }, acc);
281584
- }
281585
- function buildParams(ruleName, provided) {
281586
- var ruleSchema = RuleContainer.getRuleDefinition(ruleName);
281587
- if (!ruleSchema) {
281588
- return provided;
281589
- }
281590
- var params = {};
281591
- if (!ruleSchema.params && !Array.isArray(provided)) {
281592
- throw new Error('You provided an object params to a rule that has no defined schema.');
281593
- }
281594
- // Rule probably uses an array for their args, keep it as is.
281595
- if (Array.isArray(provided) && !ruleSchema.params) {
281596
- return provided;
281597
- }
281598
- var definedParams;
281599
- // collect the params schema.
281600
- if (!ruleSchema.params || (ruleSchema.params.length < provided.length && Array.isArray(provided))) {
281601
- var lastDefinedParam_1;
281602
- // collect any additional parameters in the last item.
281603
- definedParams = provided.map(function (_, idx) {
281604
- var _a;
281605
- var param = (_a = ruleSchema.params) === null || _a === void 0 ? void 0 : _a[idx];
281606
- lastDefinedParam_1 = param || lastDefinedParam_1;
281607
- if (!param) {
281608
- param = lastDefinedParam_1;
281609
- }
281610
- return param;
281611
- });
281612
- }
281613
- else {
281614
- definedParams = ruleSchema.params;
281615
- }
281616
- // Match the provided array length with a temporary schema.
281617
- for (var i = 0; i < definedParams.length; i++) {
281618
- var options = definedParams[i];
281619
- var value = options.default;
281620
- // if the provided is an array, map element value.
281621
- if (Array.isArray(provided)) {
281622
- if (i in provided) {
281623
- value = provided[i];
281624
- }
281625
- }
281626
- else {
281627
- // If the param exists in the provided object.
281628
- if (options.name in provided) {
281629
- value = provided[options.name];
281630
- // if the provided is the first param value.
281631
- }
281632
- else if (definedParams.length === 1) {
281633
- value = provided;
281634
- }
281635
- }
281636
- // if the param is a target, resolve the target value.
281637
- if (options.isTarget) {
281638
- value = createLocator(value, options.cast);
281639
- }
281640
- // A target param using interpolation
281641
- if (typeof value === 'string' && value[0] === '@') {
281642
- value = createLocator(value.slice(1), options.cast);
281643
- }
281644
- // If there is a transformer defined.
281645
- if (!isLocator(value) && options.cast) {
281646
- value = options.cast(value);
281647
- }
281648
- // already been set, probably multiple values.
281649
- if (params[options.name]) {
281650
- params[options.name] = Array.isArray(params[options.name]) ? params[options.name] : [params[options.name]];
281651
- params[options.name].push(value);
281652
- }
281653
- else {
281654
- // set the value.
281655
- params[options.name] = value;
281656
- }
281657
- }
281658
- return params;
281659
- }
281660
- /**
281661
- * Parses a rule string expression.
281662
- */
281663
- var parseRule = function (rule) {
281664
- var params = [];
281665
- var name = rule.split(':')[0];
281666
- if (includes(rule, ':')) {
281667
- params = rule
281668
- .split(':')
281669
- .slice(1)
281670
- .join(':')
281671
- .split(',');
281672
- }
281673
- return { name: name, params: params };
281674
- };
281675
- function createLocator(value, castFn) {
281676
- var locator = function (crossTable) {
281677
- var val = crossTable[value];
281678
- return castFn ? castFn(val) : val;
281679
- };
281680
- locator.__locatorRef = value;
281681
- return locator;
281682
- }
281683
- function extractLocators(params) {
281684
- if (Array.isArray(params)) {
281685
- return params.filter(function (param) {
281686
- return isLocator(param) || (typeof param === 'string' && param[0] === '@');
281687
- });
281688
- }
281689
- return Object.keys(params)
281690
- .filter(function (key) { return isLocator(params[key]); })
281691
- .map(function (key) { return params[key]; });
281692
- }
281693
-
281694
- /**
281695
- * Validates a value against the rules.
281696
- */
281697
- function validate(value, rules, options) {
281698
- if (options === void 0) { options = {}; }
281699
- return __awaiter(this, void 0, void 0, function () {
281700
- var shouldBail, skipIfEmpty, field, result, errors, failedRules, regenerateMap;
281701
- return __generator(this, function (_a) {
281702
- switch (_a.label) {
281703
- case 0:
281704
- shouldBail = options === null || options === void 0 ? void 0 : options.bails;
281705
- skipIfEmpty = options === null || options === void 0 ? void 0 : options.skipIfEmpty;
281706
- field = {
281707
- name: (options === null || options === void 0 ? void 0 : options.name) || '{field}',
281708
- rules: normalizeRules(rules),
281709
- bails: shouldBail !== null && shouldBail !== void 0 ? shouldBail : true,
281710
- skipIfEmpty: skipIfEmpty !== null && skipIfEmpty !== void 0 ? skipIfEmpty : true,
281711
- forceRequired: false,
281712
- crossTable: (options === null || options === void 0 ? void 0 : options.values) || {},
281713
- names: (options === null || options === void 0 ? void 0 : options.names) || {},
281714
- customMessages: (options === null || options === void 0 ? void 0 : options.customMessages) || {}
281715
- };
281716
- return [4 /*yield*/, _validate(field, value, options)];
281717
- case 1:
281718
- result = _a.sent();
281719
- errors = [];
281720
- failedRules = {};
281721
- regenerateMap = {};
281722
- result.errors.forEach(function (e) {
281723
- var msg = e.msg();
281724
- errors.push(msg);
281725
- failedRules[e.rule] = msg;
281726
- regenerateMap[e.rule] = e.msg;
281727
- });
281728
- return [2 /*return*/, {
281729
- valid: result.valid,
281730
- required: result.required,
281731
- errors: errors,
281732
- failedRules: failedRules,
281733
- regenerateMap: regenerateMap
281734
- }];
281735
- }
281736
- });
281737
- });
281738
- }
281739
- /**
281740
- * Starts the validation process.
281741
- */
281742
- function _validate(field, value, _a) {
281743
- var _b = (_a === void 0 ? {} : _a).isInitial, isInitial = _b === void 0 ? false : _b;
281744
- return __awaiter(this, void 0, void 0, function () {
281745
- var _c, shouldSkip, required, errors, rules, length, i, rule, result;
281746
- return __generator(this, function (_d) {
281747
- switch (_d.label) {
281748
- case 0: return [4 /*yield*/, _shouldSkip(field, value)];
281749
- case 1:
281750
- _c = _d.sent(), shouldSkip = _c.shouldSkip, required = _c.required, errors = _c.errors;
281751
- if (shouldSkip) {
281752
- return [2 /*return*/, {
281753
- valid: !errors.length,
281754
- required: required,
281755
- errors: errors
281756
- }];
281757
- }
281758
- rules = Object.keys(field.rules).filter(function (rule) { return !RuleContainer.isRequireRule(rule); });
281759
- length = rules.length;
281760
- i = 0;
281761
- _d.label = 2;
281762
- case 2:
281763
- if (!(i < length)) return [3 /*break*/, 5];
281764
- if (isInitial && RuleContainer.isLazy(rules[i])) {
281765
- return [3 /*break*/, 4];
281766
- }
281767
- rule = rules[i];
281768
- return [4 /*yield*/, _test(field, value, {
281769
- name: rule,
281770
- params: field.rules[rule]
281771
- })];
281772
- case 3:
281773
- result = _d.sent();
281774
- if (!result.valid && result.error) {
281775
- errors.push(result.error);
281776
- if (field.bails) {
281777
- return [2 /*return*/, {
281778
- valid: false,
281779
- required: required,
281780
- errors: errors
281781
- }];
281782
- }
281783
- }
281784
- _d.label = 4;
281785
- case 4:
281786
- i++;
281787
- return [3 /*break*/, 2];
281788
- case 5: return [2 /*return*/, {
281789
- valid: !errors.length,
281790
- required: required,
281791
- errors: errors
281792
- }];
281793
- }
281794
- });
281795
- });
281796
- }
281797
- function _shouldSkip(field, value) {
281798
- return __awaiter(this, void 0, void 0, function () {
281799
- var requireRules, length, errors, isEmpty, isEmptyAndOptional, isRequired, i, rule, result;
281800
- return __generator(this, function (_a) {
281801
- switch (_a.label) {
281802
- case 0:
281803
- requireRules = Object.keys(field.rules).filter(RuleContainer.isRequireRule);
281804
- length = requireRules.length;
281805
- errors = [];
281806
- isEmpty = isNullOrUndefined(value) || value === '' || isEmptyArray(value);
281807
- isEmptyAndOptional = isEmpty && field.skipIfEmpty;
281808
- i = 0;
281809
- _a.label = 1;
281810
- case 1:
281811
- if (!(i < length)) return [3 /*break*/, 4];
281812
- rule = requireRules[i];
281813
- return [4 /*yield*/, _test(field, value, {
281814
- name: rule,
281815
- params: field.rules[rule]
281816
- })];
281817
- case 2:
281818
- result = _a.sent();
281819
- if (!vee_validate_esm_isObject(result)) {
281820
- throw new Error('Require rules has to return an object (see docs)');
281821
- }
281822
- if (result.required !== undefined) {
281823
- isRequired = result.required;
281824
- }
281825
- if (!result.valid && result.error) {
281826
- errors.push(result.error);
281827
- // Exit early as the field is required and failed validation.
281828
- if (field.bails) {
281829
- return [2 /*return*/, {
281830
- shouldSkip: true,
281831
- required: result.required,
281832
- errors: errors
281833
- }];
281834
- }
281835
- }
281836
- _a.label = 3;
281837
- case 3:
281838
- i++;
281839
- return [3 /*break*/, 1];
281840
- case 4:
281841
- if (isEmpty && !isRequired && !field.skipIfEmpty) {
281842
- return [2 /*return*/, {
281843
- shouldSkip: false,
281844
- required: isRequired,
281845
- errors: errors
281846
- }];
281847
- }
281848
- // field is configured to run through the pipeline regardless
281849
- if (!field.bails && !isEmptyAndOptional) {
281850
- return [2 /*return*/, {
281851
- shouldSkip: false,
281852
- required: isRequired,
281853
- errors: errors
281854
- }];
281855
- }
281856
- // skip if the field is not required and has an empty value.
281857
- return [2 /*return*/, {
281858
- shouldSkip: !isRequired && isEmpty,
281859
- required: isRequired,
281860
- errors: errors
281861
- }];
281862
- }
281863
- });
281864
- });
281865
- }
281866
- /**
281867
- * Tests a single input value against a rule.
281868
- */
281869
- function _test(field, value, rule) {
281870
- return __awaiter(this, void 0, void 0, function () {
281871
- var ruleSchema, normalizedValue, params, result, values_1;
281872
- return __generator(this, function (_a) {
281873
- switch (_a.label) {
281874
- case 0:
281875
- ruleSchema = RuleContainer.getRuleDefinition(rule.name);
281876
- if (!ruleSchema || !ruleSchema.validate) {
281877
- throw new Error("No such validator '" + rule.name + "' exists.");
281878
- }
281879
- normalizedValue = ruleSchema.castValue ? ruleSchema.castValue(value) : value;
281880
- params = fillTargetValues(rule.params, field.crossTable);
281881
- return [4 /*yield*/, ruleSchema.validate(normalizedValue, params)];
281882
- case 1:
281883
- result = _a.sent();
281884
- if (typeof result === 'string') {
281885
- values_1 = __assign(__assign({}, (params || {})), { _field_: field.name, _value_: value, _rule_: rule.name });
281886
- return [2 /*return*/, {
281887
- valid: false,
281888
- error: { rule: rule.name, msg: function () { return interpolate(result, values_1); } }
281889
- }];
281890
- }
281891
- if (!vee_validate_esm_isObject(result)) {
281892
- result = { valid: result };
281893
- }
281894
- return [2 /*return*/, {
281895
- valid: result.valid,
281896
- required: result.required,
281897
- error: result.valid ? undefined : _generateFieldError(field, value, ruleSchema, rule.name, params)
281898
- }];
281899
- }
281900
- });
281901
- });
281902
- }
281903
- /**
281904
- * Generates error messages.
281905
- */
281906
- function _generateFieldError(field, value, ruleSchema, ruleName, params) {
281907
- var _a;
281908
- var message = (_a = field.customMessages[ruleName]) !== null && _a !== void 0 ? _a : ruleSchema.message;
281909
- var ruleTargets = _getRuleTargets(field, ruleSchema, ruleName);
281910
- var _b = _getUserTargets(field, ruleSchema, ruleName, message), userTargets = _b.userTargets, userMessage = _b.userMessage;
281911
- var values = __assign(__assign(__assign(__assign({}, (params || {})), { _field_: field.name, _value_: value, _rule_: ruleName }), ruleTargets), userTargets);
281912
- return {
281913
- msg: function () { return _normalizeMessage(userMessage || getConfig().defaultMessage, field.name, values); },
281914
- rule: ruleName
281915
- };
281916
- }
281917
- function _getRuleTargets(field, ruleSchema, ruleName) {
281918
- var params = ruleSchema.params;
281919
- if (!params) {
281920
- return {};
281921
- }
281922
- var numTargets = params.filter(function (param) { return param.isTarget; }).length;
281923
- if (numTargets <= 0) {
281924
- return {};
281925
- }
281926
- var names = {};
281927
- var ruleConfig = field.rules[ruleName];
281928
- if (!Array.isArray(ruleConfig) && vee_validate_esm_isObject(ruleConfig)) {
281929
- ruleConfig = params.map(function (param) {
281930
- return ruleConfig[param.name];
281931
- });
281932
- }
281933
- for (var index = 0; index < params.length; index++) {
281934
- var param = params[index];
281935
- var key = ruleConfig[index];
281936
- if (!isLocator(key)) {
281937
- continue;
281938
- }
281939
- key = key.__locatorRef;
281940
- var name_1 = field.names[key] || key;
281941
- names[param.name] = name_1;
281942
- names["_" + param.name + "_"] = field.crossTable[key];
281943
- }
281944
- return names;
281945
- }
281946
- function _getUserTargets(field, ruleSchema, ruleName, userMessage) {
281947
- var userTargets = {};
281948
- var rules = field.rules[ruleName];
281949
- var params = ruleSchema.params || [];
281950
- // early return if no rules
281951
- if (!rules) {
281952
- return {};
281953
- }
281954
- // check all rules to convert targets
281955
- Object.keys(rules).forEach(function (key, index) {
281956
- // get the rule
281957
- var rule = rules[key];
281958
- if (!isLocator(rule)) {
281959
- return {};
281960
- }
281961
- // get associated parameter
281962
- var param = params[index];
281963
- if (!param) {
281964
- return {};
281965
- }
281966
- // grab the name of the target
281967
- var name = rule.__locatorRef;
281968
- userTargets[param.name] = field.names[name] || name;
281969
- userTargets["_" + param.name + "_"] = field.crossTable[name];
281970
- });
281971
- return {
281972
- userTargets: userTargets,
281973
- userMessage: userMessage
281974
- };
281975
- }
281976
- function _normalizeMessage(template, field, values) {
281977
- if (typeof template === 'function') {
281978
- return template(field, values);
281979
- }
281980
- return interpolate(template, __assign(__assign({}, values), { _field_: field }));
281981
- }
281982
- function fillTargetValues(params, crossTable) {
281983
- if (Array.isArray(params)) {
281984
- return params.map(function (param) {
281985
- var targetPart = typeof param === 'string' && param[0] === '@' ? param.slice(1) : param;
281986
- if (targetPart in crossTable) {
281987
- return crossTable[targetPart];
281988
- }
281989
- return param;
281990
- });
281991
- }
281992
- var values = {};
281993
- var normalize = function (value) {
281994
- if (isLocator(value)) {
281995
- return value(crossTable);
281996
- }
281997
- return value;
281998
- };
281999
- Object.keys(params).forEach(function (param) {
282000
- values[param] = normalize(params[param]);
282001
- });
282002
- return values;
282003
- }
282004
-
282005
- var aggressive = function () { return ({
282006
- on: ['input', 'blur']
282007
- }); };
282008
- var lazy = function () { return ({
282009
- on: ['change', 'blur']
282010
- }); };
282011
- var eager = function (_a) {
282012
- var errors = _a.errors;
282013
- if (errors.length) {
282014
- return {
282015
- on: ['input', 'change']
282016
- };
282017
- }
282018
- return {
282019
- on: ['change', 'blur']
282020
- };
282021
- };
282022
- var passive = function () { return ({
282023
- on: []
282024
- }); };
282025
- var modes = {
282026
- aggressive: aggressive,
282027
- eager: eager,
282028
- passive: passive,
282029
- lazy: lazy
282030
- };
282031
- var setInteractionMode = function (mode, implementation) {
282032
- setConfig({ mode: mode });
282033
- if (!implementation) {
282034
- return;
282035
- }
282036
- if (!isCallable(implementation)) {
282037
- throw new Error('A mode implementation must be a function');
282038
- }
282039
- modes[mode] = implementation;
282040
- };
282041
-
282042
- var EVENT_BUS = new (external_commonjs_vue_commonjs2_vue_root_Vue_default())();
282043
- function localeChanged() {
282044
- EVENT_BUS.$emit('change:locale');
282045
- }
282046
-
282047
- var Dictionary = /** @class */ (function () {
282048
- function Dictionary(locale, dictionary) {
282049
- this.container = {};
282050
- this.locale = locale;
282051
- this.merge(dictionary);
282052
- }
282053
- Dictionary.prototype.resolve = function (field, rule, values) {
282054
- return this.format(this.locale, field, rule, values);
282055
- };
282056
- Dictionary.prototype.format = function (locale, field, rule, values) {
282057
- var _a, _b, _c, _d, _e, _f, _g, _h;
282058
- var message;
282059
- // find if specific message for that field was specified.
282060
- var fieldContainer = (_c = (_b = (_a = this.container[locale]) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b[field]) === null || _c === void 0 ? void 0 : _c[rule];
282061
- var messageContainer = (_e = (_d = this.container[locale]) === null || _d === void 0 ? void 0 : _d.messages) === null || _e === void 0 ? void 0 : _e[rule];
282062
- message = fieldContainer || messageContainer || '';
282063
- if (!message) {
282064
- message = '{_field_} is not valid';
282065
- }
282066
- field = (_h = (_g = (_f = this.container[locale]) === null || _f === void 0 ? void 0 : _f.names) === null || _g === void 0 ? void 0 : _g[field]) !== null && _h !== void 0 ? _h : field;
282067
- return isCallable(message) ? message(field, values) : interpolate(message, __assign(__assign({}, values), { _field_: field }));
282068
- };
282069
- Dictionary.prototype.merge = function (dictionary) {
282070
- vee_validate_esm_merge(this.container, dictionary);
282071
- };
282072
- Dictionary.prototype.hasRule = function (name) {
282073
- var _a, _b;
282074
- return !!((_b = (_a = this.container[this.locale]) === null || _a === void 0 ? void 0 : _a.messages) === null || _b === void 0 ? void 0 : _b[name]);
282075
- };
282076
- return Dictionary;
282077
- }());
282078
- var DICTIONARY;
282079
- function localize(locale, dictionary) {
282080
- var _a;
282081
- if (!DICTIONARY) {
282082
- DICTIONARY = new Dictionary('en', {});
282083
- setConfig({
282084
- defaultMessage: function (field, values) {
282085
- return DICTIONARY.resolve(field, values === null || values === void 0 ? void 0 : values._rule_, values || {});
282086
- }
282087
- });
282088
- }
282089
- if (typeof locale === 'string') {
282090
- DICTIONARY.locale = locale;
282091
- if (dictionary) {
282092
- DICTIONARY.merge((_a = {}, _a[locale] = dictionary, _a));
282093
- }
282094
- localeChanged();
282095
- return;
282096
- }
282097
- DICTIONARY.merge(locale);
282098
- }
282099
-
282100
- // do not edit .js files directly - edit src/index.jst
282101
-
282102
-
282103
-
282104
- var fastDeepEqual = function equal(a, b) {
282105
- if (a === b) return true;
282106
-
282107
- if (a && b && typeof a == 'object' && typeof b == 'object') {
282108
- if (a.constructor !== b.constructor) return false;
282109
-
282110
- var length, i, keys;
282111
- if (Array.isArray(a)) {
282112
- length = a.length;
282113
- if (length != b.length) return false;
282114
- for (i = length; i-- !== 0;)
282115
- if (!equal(a[i], b[i])) return false;
282116
- return true;
282117
- }
282118
-
282119
-
282120
-
282121
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
282122
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
282123
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
282124
-
282125
- keys = Object.keys(a);
282126
- length = keys.length;
282127
- if (length !== Object.keys(b).length) return false;
282128
-
282129
- for (i = length; i-- !== 0;)
282130
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
282131
-
282132
- for (i = length; i-- !== 0;) {
282133
- var key = keys[i];
282134
-
282135
- if (!equal(a[key], b[key])) return false;
282136
- }
282137
-
282138
- return true;
282139
- }
282140
-
282141
- // true if both NaN, false otherwise
282142
- return a!==a && b!==b;
282143
- };
282144
-
282145
- var isEvent = function (evt) {
282146
- if (!evt) {
282147
- return false;
282148
- }
282149
- if (typeof Event !== 'undefined' && isCallable(Event) && evt instanceof Event) {
282150
- return true;
282151
- }
282152
- // this is for IE
282153
- /* istanbul ignore next */
282154
- if (evt && evt.srcElement) {
282155
- return true;
282156
- }
282157
- return false;
282158
- };
282159
- function normalizeEventValue(value) {
282160
- var _a, _b;
282161
- if (!isEvent(value)) {
282162
- return value;
282163
- }
282164
- var input = value.target;
282165
- if (input.type === 'file' && input.files) {
282166
- return vee_validate_esm_toArray(input.files);
282167
- }
282168
- // If the input has a `v-model.number` modifier applied.
282169
- if ((_a = input._vModifiers) === null || _a === void 0 ? void 0 : _a.number) {
282170
- // as per the spec the v-model.number uses parseFloat
282171
- var valueAsNumber = parseFloat(input.value);
282172
- if (vee_validate_esm_isNaN(valueAsNumber)) {
282173
- return input.value;
282174
- }
282175
- return valueAsNumber;
282176
- }
282177
- if ((_b = input._vModifiers) === null || _b === void 0 ? void 0 : _b.trim) {
282178
- var trimmedValue = typeof input.value === 'string' ? input.value.trim() : input.value;
282179
- return trimmedValue;
282180
- }
282181
- return input.value;
282182
- }
282183
-
282184
- var isTextInput = function (vnode) {
282185
- var _a;
282186
- var attrs = ((_a = vnode.data) === null || _a === void 0 ? void 0 : _a.attrs) || vnode.elm;
282187
- // it will fallback to being a text input per browsers spec.
282188
- if (vnode.tag === 'input' && (!attrs || !attrs.type)) {
282189
- return true;
282190
- }
282191
- if (vnode.tag === 'textarea') {
282192
- return true;
282193
- }
282194
- return includes(['text', 'password', 'search', 'email', 'tel', 'url', 'number'], attrs === null || attrs === void 0 ? void 0 : attrs.type);
282195
- };
282196
- // export const isCheckboxOrRadioInput = (vnode: VNode): boolean => {
282197
- // const attrs = (vnode.data && vnode.data.attrs) || vnode.elm;
282198
- // return includes(['radio', 'checkbox'], attrs && attrs.type);
282199
- // };
282200
- // Gets the model object on the vnode.
282201
- function findModel(vnode) {
282202
- if (!vnode.data) {
282203
- return undefined;
282204
- }
282205
- // Component Model
282206
- // THIS IS NOT TYPED IN OFFICIAL VUE TYPINGS
282207
- // eslint-disable-next-line
282208
- var nonStandardVNodeData = vnode.data;
282209
- if ('model' in nonStandardVNodeData) {
282210
- return nonStandardVNodeData.model;
282211
- }
282212
- if (!vnode.data.directives) {
282213
- return undefined;
282214
- }
282215
- return find(vnode.data.directives, function (d) { return d.name === 'model'; });
282216
- }
282217
- function findValue(vnode) {
282218
- var _a, _b;
282219
- var model = findModel(vnode);
282220
- if (model) {
282221
- return { value: model.value };
282222
- }
282223
- var config = findModelConfig(vnode);
282224
- var prop = (config === null || config === void 0 ? void 0 : config.prop) || 'value';
282225
- if (((_a = vnode.componentOptions) === null || _a === void 0 ? void 0 : _a.propsData) && prop in vnode.componentOptions.propsData) {
282226
- var propsDataWithValue = vnode.componentOptions.propsData;
282227
- return { value: propsDataWithValue[prop] };
282228
- }
282229
- if (((_b = vnode.data) === null || _b === void 0 ? void 0 : _b.domProps) && 'value' in vnode.data.domProps) {
282230
- return { value: vnode.data.domProps.value };
282231
- }
282232
- return undefined;
282233
- }
282234
- function extractChildren(vnode) {
282235
- if (Array.isArray(vnode)) {
282236
- return vnode;
282237
- }
282238
- if (Array.isArray(vnode.children)) {
282239
- return vnode.children;
282240
- }
282241
- /* istanbul ignore next */
282242
- if (vnode.componentOptions && Array.isArray(vnode.componentOptions.children)) {
282243
- return vnode.componentOptions.children;
282244
- }
282245
- return [];
282246
- }
282247
- function findInputNodes(vnode) {
282248
- if (!Array.isArray(vnode) && findValue(vnode) !== undefined) {
282249
- return [vnode];
282250
- }
282251
- var children = extractChildren(vnode);
282252
- return children.reduce(function (nodes, node) {
282253
- var candidates = findInputNodes(node);
282254
- if (candidates.length) {
282255
- nodes.push.apply(nodes, candidates);
282256
- }
282257
- return nodes;
282258
- }, []);
282259
- }
282260
- // Resolves v-model config if exists.
282261
- function findModelConfig(vnode) {
282262
- /* istanbul ignore next */
282263
- if (!vnode.componentOptions)
282264
- return null;
282265
- // This is also not typed in the standard Vue TS.
282266
- return vnode.componentOptions.Ctor.options.model;
282267
- }
282268
- // Adds a listener to vnode listener object.
282269
- function mergeVNodeListeners(obj, eventName, handler) {
282270
- // no listener at all.
282271
- if (isNullOrUndefined(obj[eventName])) {
282272
- obj[eventName] = [handler];
282273
- return;
282274
- }
282275
- // Is an invoker.
282276
- if (isCallable(obj[eventName]) && obj[eventName].fns) {
282277
- var invoker = obj[eventName];
282278
- invoker.fns = Array.isArray(invoker.fns) ? invoker.fns : [invoker.fns];
282279
- if (!includes(invoker.fns, handler)) {
282280
- invoker.fns.push(handler);
282281
- }
282282
- return;
282283
- }
282284
- if (isCallable(obj[eventName])) {
282285
- var prev = obj[eventName];
282286
- obj[eventName] = [prev];
282287
- }
282288
- if (Array.isArray(obj[eventName]) && !includes(obj[eventName], handler)) {
282289
- obj[eventName].push(handler);
282290
- }
282291
- }
282292
- // Adds a listener to a native HTML vnode.
282293
- function addNativeNodeListener(node, eventName, handler) {
282294
- /* istanbul ignore next */
282295
- if (!node.data) {
282296
- node.data = {};
282297
- }
282298
- if (isNullOrUndefined(node.data.on)) {
282299
- node.data.on = {};
282300
- }
282301
- mergeVNodeListeners(node.data.on, eventName, handler);
282302
- }
282303
- // Adds a listener to a Vue component vnode.
282304
- function addComponentNodeListener(node, eventName, handler) {
282305
- /* istanbul ignore next */
282306
- if (!node.componentOptions) {
282307
- return;
282308
- }
282309
- /* istanbul ignore next */
282310
- if (!node.componentOptions.listeners) {
282311
- node.componentOptions.listeners = {};
282312
- }
282313
- mergeVNodeListeners(node.componentOptions.listeners, eventName, handler);
282314
- }
282315
- function addVNodeListener(vnode, eventName, handler) {
282316
- if (vnode.componentOptions) {
282317
- addComponentNodeListener(vnode, eventName, handler);
282318
- return;
282319
- }
282320
- addNativeNodeListener(vnode, eventName, handler);
282321
- }
282322
- // Determines if `change` should be used over `input` for listeners.
282323
- function getInputEventName(vnode, model) {
282324
- var _a;
282325
- // Is a component.
282326
- if (vnode.componentOptions) {
282327
- var event_1 = (findModelConfig(vnode) || { event: 'input' }).event;
282328
- return event_1 || 'input';
282329
- }
282330
- // Lazy Models typically use change event
282331
- if ((_a = model === null || model === void 0 ? void 0 : model.modifiers) === null || _a === void 0 ? void 0 : _a.lazy) {
282332
- return 'change';
282333
- }
282334
- // is a textual-type input.
282335
- if (isTextInput(vnode)) {
282336
- return 'input';
282337
- }
282338
- return 'change';
282339
- }
282340
- function isHTMLNode(node) {
282341
- return includes(['input', 'select', 'textarea'], node.tag);
282342
- }
282343
- // TODO: Type this one properly.
282344
- function normalizeSlots(slots, ctx) {
282345
- var acc = [];
282346
- return Object.keys(slots).reduce(function (arr, key) {
282347
- slots[key].forEach(function (vnode) {
282348
- if (!vnode.context) {
282349
- slots[key].context = ctx;
282350
- if (!vnode.data) {
282351
- vnode.data = {};
282352
- }
282353
- vnode.data.slot = key;
282354
- }
282355
- });
282356
- return arr.concat(slots[key]);
282357
- }, acc);
282358
- }
282359
- function resolveTextualRules(vnode) {
282360
- var _a;
282361
- var attrs = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.attrs;
282362
- var rules = {};
282363
- if (!attrs)
282364
- return rules;
282365
- if (attrs.type === 'email' && RuleContainer.getRuleDefinition('email')) {
282366
- rules.email = ['multiple' in attrs];
282367
- }
282368
- if (attrs.pattern && RuleContainer.getRuleDefinition('regex')) {
282369
- rules.regex = attrs.pattern;
282370
- }
282371
- if (attrs.maxlength >= 0 && RuleContainer.getRuleDefinition('max')) {
282372
- rules.max = attrs.maxlength;
282373
- }
282374
- if (attrs.minlength >= 0 && RuleContainer.getRuleDefinition('min')) {
282375
- rules.min = attrs.minlength;
282376
- }
282377
- if (attrs.type === 'number') {
282378
- if (isSpecified(attrs.min) && RuleContainer.getRuleDefinition('min_value')) {
282379
- rules.min_value = Number(attrs.min);
282380
- }
282381
- if (isSpecified(attrs.max) && RuleContainer.getRuleDefinition('max_value')) {
282382
- rules.max_value = Number(attrs.max);
282383
- }
282384
- }
282385
- return rules;
282386
- }
282387
- function resolveRules(vnode) {
282388
- var _a;
282389
- var htmlTags = ['input', 'select', 'textarea'];
282390
- var attrs = (_a = vnode.data) === null || _a === void 0 ? void 0 : _a.attrs;
282391
- if (!includes(htmlTags, vnode.tag) || !attrs) {
282392
- return {};
282393
- }
282394
- var rules = {};
282395
- if ('required' in attrs && attrs.required !== false && RuleContainer.getRuleDefinition('required')) {
282396
- rules.required = attrs.type === 'checkbox' ? [true] : true;
282397
- }
282398
- if (isTextInput(vnode)) {
282399
- return normalizeRules(__assign(__assign({}, rules), resolveTextualRules(vnode)));
282400
- }
282401
- return normalizeRules(rules);
282402
- }
282403
- function normalizeChildren(context, slotProps) {
282404
- if (context.$scopedSlots.default) {
282405
- return context.$scopedSlots.default(slotProps) || [];
282406
- }
282407
- return context.$slots.default || [];
282408
- }
282409
-
282410
- /**
282411
- * Determines if a provider needs to run validation.
282412
- */
282413
- function shouldValidate(ctx, value) {
282414
- // when an immediate/initial validation is needed and wasn't done before.
282415
- if (!ctx._ignoreImmediate && ctx.immediate) {
282416
- return true;
282417
- }
282418
- // when the value changes for whatever reason.
282419
- if (!isRefEqual(ctx.value, value) && ctx.normalizedEvents.length) {
282420
- return true;
282421
- }
282422
- // when it needs validation due to props/cross-fields changes.
282423
- if (ctx._needsValidation) {
282424
- return true;
282425
- }
282426
- // when the initial value is undefined and the field wasn't rendered yet.
282427
- if (!ctx.initialized && value === undefined) {
282428
- return true;
282429
- }
282430
- return false;
282431
- }
282432
- function createValidationCtx(ctx) {
282433
- return __assign(__assign({}, ctx.flags), { errors: ctx.errors, classes: ctx.classes, failedRules: ctx.failedRules, reset: function () { return ctx.reset(); }, validate: function () {
282434
- var args = [];
282435
- for (var _i = 0; _i < arguments.length; _i++) {
282436
- args[_i] = arguments[_i];
282437
- }
282438
- return ctx.validate.apply(ctx, args);
282439
- }, ariaInput: {
282440
- 'aria-invalid': ctx.flags.invalid ? 'true' : 'false',
282441
- 'aria-required': ctx.isRequired ? 'true' : 'false',
282442
- 'aria-errormessage': "vee_" + ctx.id
282443
- }, ariaMsg: {
282444
- id: "vee_" + ctx.id,
282445
- 'aria-live': ctx.errors.length ? 'assertive' : 'off'
282446
- } });
282447
- }
282448
- function onRenderUpdate(vm, value) {
282449
- if (!vm.initialized) {
282450
- vm.initialValue = value;
282451
- }
282452
- var validateNow = shouldValidate(vm, value);
282453
- vm._needsValidation = false;
282454
- vm.value = value;
282455
- vm._ignoreImmediate = true;
282456
- if (!validateNow) {
282457
- return;
282458
- }
282459
- var validate = function () {
282460
- if (vm.immediate || vm.flags.validated) {
282461
- return triggerThreadSafeValidation(vm);
282462
- }
282463
- vm.validateSilent();
282464
- };
282465
- if (vm.initialized) {
282466
- validate();
282467
- return;
282468
- }
282469
- vm.$once('hook:mounted', function () { return validate(); });
282470
- }
282471
- function computeModeSetting(ctx) {
282472
- var compute = (isCallable(ctx.mode) ? ctx.mode : modes[ctx.mode]);
282473
- return compute(ctx);
282474
- }
282475
- function triggerThreadSafeValidation(vm) {
282476
- var pendingPromise = vm.validateSilent();
282477
- // avoids race conditions between successive validations.
282478
- vm._pendingValidation = pendingPromise;
282479
- return pendingPromise.then(function (result) {
282480
- if (pendingPromise === vm._pendingValidation) {
282481
- vm.applyResult(result);
282482
- vm._pendingValidation = undefined;
282483
- }
282484
- return result;
282485
- });
282486
- }
282487
- // Creates the common handlers for a validatable context.
282488
- function createCommonHandlers(vm) {
282489
- if (!vm.$veeOnInput) {
282490
- vm.$veeOnInput = function (e) {
282491
- vm.syncValue(e); // track and keep the value updated.
282492
- vm.setFlags({ dirty: true, pristine: false });
282493
- };
282494
- }
282495
- var onInput = vm.$veeOnInput;
282496
- if (!vm.$veeOnBlur) {
282497
- vm.$veeOnBlur = function () {
282498
- vm.setFlags({ touched: true, untouched: false });
282499
- };
282500
- }
282501
- // Blur event listener.
282502
- var onBlur = vm.$veeOnBlur;
282503
- var onValidate = vm.$veeHandler;
282504
- var mode = computeModeSetting(vm);
282505
- // Handle debounce changes.
282506
- if (!onValidate || vm.$veeDebounce !== vm.debounce) {
282507
- onValidate = debounce(function () {
282508
- vm.$nextTick(function () {
282509
- if (!vm._pendingReset) {
282510
- triggerThreadSafeValidation(vm);
282511
- }
282512
- vm._pendingReset = false;
282513
- });
282514
- }, mode.debounce || vm.debounce);
282515
- // Cache the handler so we don't create it each time.
282516
- vm.$veeHandler = onValidate;
282517
- // cache the debounce value so we detect if it was changed.
282518
- vm.$veeDebounce = vm.debounce;
282519
- }
282520
- return { onInput: onInput, onBlur: onBlur, onValidate: onValidate };
282521
- }
282522
- // Adds all plugin listeners to the vnode.
282523
- function addListeners(vm, node) {
282524
- var value = findValue(node);
282525
- // cache the input eventName.
282526
- vm._inputEventName = vm._inputEventName || getInputEventName(node, findModel(node));
282527
- onRenderUpdate(vm, value === null || value === void 0 ? void 0 : value.value);
282528
- var _a = createCommonHandlers(vm), onInput = _a.onInput, onBlur = _a.onBlur, onValidate = _a.onValidate;
282529
- addVNodeListener(node, vm._inputEventName, onInput);
282530
- addVNodeListener(node, 'blur', onBlur);
282531
- // add the validation listeners.
282532
- vm.normalizedEvents.forEach(function (evt) {
282533
- addVNodeListener(node, evt, onValidate);
282534
- });
282535
- vm.initialized = true;
282536
- }
282537
-
282538
- var PROVIDER_COUNTER = 0;
282539
- function data$1() {
282540
- var errors = [];
282541
- var fieldName = '';
282542
- var defaultValues = {
282543
- errors: errors,
282544
- value: undefined,
282545
- initialized: false,
282546
- initialValue: undefined,
282547
- flags: createFlags(),
282548
- failedRules: {},
282549
- isActive: true,
282550
- fieldName: fieldName,
282551
- id: ''
282552
- };
282553
- return defaultValues;
282554
- }
282555
- var ValidationProvider = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend({
282556
- name: 'ValidationProvider',
282557
- inject: {
282558
- $_veeObserver: {
282559
- from: '$_veeObserver',
282560
- default: function () {
282561
- if (!this.$vnode.context.$_veeObserver) {
282562
- this.$vnode.context.$_veeObserver = createObserver();
282563
- }
282564
- return this.$vnode.context.$_veeObserver;
282565
- }
282566
- }
282567
- },
282568
- props: {
282569
- vid: {
282570
- type: String,
282571
- default: ''
282572
- },
282573
- name: {
282574
- type: String,
282575
- default: null
282576
- },
282577
- mode: {
282578
- type: [String, Function],
282579
- default: function () {
282580
- return getConfig().mode;
282581
- }
282582
- },
282583
- rules: {
282584
- type: [Object, String],
282585
- default: null
282586
- },
282587
- immediate: {
282588
- type: Boolean,
282589
- default: false
282590
- },
282591
- bails: {
282592
- type: Boolean,
282593
- default: function () { return getConfig().bails; }
282594
- },
282595
- skipIfEmpty: {
282596
- type: Boolean,
282597
- default: function () { return getConfig().skipOptional; }
282598
- },
282599
- debounce: {
282600
- type: Number,
282601
- default: 0
282602
- },
282603
- tag: {
282604
- type: String,
282605
- default: 'span'
282606
- },
282607
- slim: {
282608
- type: Boolean,
282609
- default: false
282610
- },
282611
- disabled: {
282612
- type: Boolean,
282613
- default: false
282614
- },
282615
- customMessages: {
282616
- type: Object,
282617
- default: function () {
282618
- return {};
282619
- }
282620
- },
282621
- detectInput: {
282622
- type: Boolean,
282623
- default: true
282624
- }
282625
- },
282626
- watch: {
282627
- rules: {
282628
- deep: true,
282629
- handler: function (val, oldVal) {
282630
- this._needsValidation = !fastDeepEqual(val, oldVal);
282631
- }
282632
- }
282633
- },
282634
- data: data$1,
282635
- computed: {
282636
- fieldDeps: function () {
282637
- var _this = this;
282638
- return Object.keys(this.normalizedRules).reduce(function (acc, rule) {
282639
- var deps = extractLocators(_this.normalizedRules[rule]).map(function (dep) {
282640
- return isLocator(dep) ? dep.__locatorRef : dep.slice(1);
282641
- });
282642
- acc.push.apply(acc, deps);
282643
- deps.forEach(function (depName) {
282644
- watchCrossFieldDep(_this, depName);
282645
- });
282646
- return acc;
282647
- }, []);
282648
- },
282649
- normalizedEvents: function () {
282650
- var _this = this;
282651
- var on = computeModeSetting(this).on;
282652
- return (on || []).map(function (e) {
282653
- if (e === 'input') {
282654
- return _this._inputEventName;
282655
- }
282656
- return e;
282657
- });
282658
- },
282659
- isRequired: function () {
282660
- var rules = __assign(__assign({}, this._resolvedRules), this.normalizedRules);
282661
- var isRequired = Object.keys(rules).some(RuleContainer.isRequireRule);
282662
- this.flags.required = !!isRequired;
282663
- return isRequired;
282664
- },
282665
- classes: function () {
282666
- var names = getConfig().classes;
282667
- return computeClassObj(names, this.flags);
282668
- },
282669
- normalizedRules: function () {
282670
- return normalizeRules(this.rules);
282671
- }
282672
- },
282673
- mounted: function () {
282674
- var _this = this;
282675
- var onLocaleChanged = function () {
282676
- if (!_this.flags.validated) {
282677
- return;
282678
- }
282679
- var regenerateMap = _this._regenerateMap;
282680
- if (regenerateMap) {
282681
- var errors_1 = [];
282682
- var failedRules_1 = {};
282683
- Object.keys(regenerateMap).forEach(function (rule) {
282684
- var msg = regenerateMap[rule]();
282685
- errors_1.push(msg);
282686
- failedRules_1[rule] = msg;
282687
- });
282688
- _this.applyResult({ errors: errors_1, failedRules: failedRules_1, regenerateMap: regenerateMap });
282689
- return;
282690
- }
282691
- _this.validate();
282692
- };
282693
- EVENT_BUS.$on('change:locale', onLocaleChanged);
282694
- this.$on('hook:beforeDestroy', function () {
282695
- EVENT_BUS.$off('change:locale', onLocaleChanged);
282696
- });
282697
- },
282698
- render: function (h) {
282699
- var _this = this;
282700
- this.registerField();
282701
- var ctx = createValidationCtx(this);
282702
- var children = normalizeChildren(this, ctx);
282703
- // Automatic v-model detection
282704
- if (this.detectInput) {
282705
- var inputs = findInputNodes(children);
282706
- if (inputs.length) {
282707
- inputs.forEach(function (input, idx) {
282708
- var _a, _b, _c, _d, _e, _f;
282709
- // If the elements are not checkboxes and there are more input nodes
282710
- if (!includes(['checkbox', 'radio'], (_b = (_a = input.data) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.type) && idx > 0) {
282711
- return;
282712
- }
282713
- var resolved = getConfig().useConstraintAttrs ? resolveRules(input) : {};
282714
- if (!fastDeepEqual(_this._resolvedRules, resolved)) {
282715
- _this._needsValidation = true;
282716
- }
282717
- if (isHTMLNode(input)) {
282718
- _this.fieldName = ((_d = (_c = input.data) === null || _c === void 0 ? void 0 : _c.attrs) === null || _d === void 0 ? void 0 : _d.name) || ((_f = (_e = input.data) === null || _e === void 0 ? void 0 : _e.attrs) === null || _f === void 0 ? void 0 : _f.id);
282719
- }
282720
- _this._resolvedRules = resolved;
282721
- addListeners(_this, input);
282722
- });
282723
- }
282724
- }
282725
- return this.slim && children.length <= 1 ? children[0] : h(this.tag, children);
282726
- },
282727
- beforeDestroy: function () {
282728
- // cleanup reference.
282729
- this.$_veeObserver.unobserve(this.id);
282730
- },
282731
- activated: function () {
282732
- this.isActive = true;
282733
- },
282734
- deactivated: function () {
282735
- this.isActive = false;
282736
- },
282737
- methods: {
282738
- setFlags: function (flags) {
282739
- var _this = this;
282740
- Object.keys(flags).forEach(function (flag) {
282741
- _this.flags[flag] = flags[flag];
282742
- });
282743
- },
282744
- syncValue: function (v) {
282745
- var value = normalizeEventValue(v);
282746
- this.value = value;
282747
- this.flags.changed = !fastDeepEqual(this.initialValue, value);
282748
- },
282749
- reset: function () {
282750
- var _this = this;
282751
- this.errors = [];
282752
- this.initialValue = this.value;
282753
- var flags = createFlags();
282754
- flags.required = this.isRequired;
282755
- this.setFlags(flags);
282756
- this.failedRules = {};
282757
- this.validateSilent();
282758
- this._pendingValidation = undefined;
282759
- this._pendingReset = true;
282760
- setTimeout(function () {
282761
- _this._pendingReset = false;
282762
- }, this.debounce);
282763
- },
282764
- validate: function () {
282765
- var args = [];
282766
- for (var _i = 0; _i < arguments.length; _i++) {
282767
- args[_i] = arguments[_i];
282768
- }
282769
- return __awaiter(this, void 0, void 0, function () {
282770
- return __generator(this, function (_a) {
282771
- if (args.length > 0) {
282772
- this.syncValue(args[0]);
282773
- }
282774
- return [2 /*return*/, triggerThreadSafeValidation(this)];
282775
- });
282776
- });
282777
- },
282778
- validateSilent: function () {
282779
- return __awaiter(this, void 0, void 0, function () {
282780
- var rules, result;
282781
- return __generator(this, function (_a) {
282782
- switch (_a.label) {
282783
- case 0:
282784
- this.setFlags({ pending: true });
282785
- rules = __assign(__assign({}, this._resolvedRules), this.normalizedRules);
282786
- Object.defineProperty(rules, '_$$isNormalized', {
282787
- value: true,
282788
- writable: false,
282789
- enumerable: false,
282790
- configurable: false
282791
- });
282792
- return [4 /*yield*/, validate(this.value, rules, __assign(__assign({ name: this.name || this.fieldName }, createLookup(this)), { bails: this.bails, skipIfEmpty: this.skipIfEmpty, isInitial: !this.initialized, customMessages: this.customMessages }))];
282793
- case 1:
282794
- result = _a.sent();
282795
- this.setFlags({
282796
- pending: false,
282797
- valid: result.valid,
282798
- invalid: !result.valid
282799
- });
282800
- if (result.required !== undefined) {
282801
- this.setFlags({
282802
- required: result.required
282803
- });
282804
- }
282805
- return [2 /*return*/, result];
282806
- }
282807
- });
282808
- });
282809
- },
282810
- setErrors: function (errors) {
282811
- this.applyResult({ errors: errors, failedRules: {} });
282812
- },
282813
- applyResult: function (_a) {
282814
- var errors = _a.errors, failedRules = _a.failedRules, regenerateMap = _a.regenerateMap;
282815
- this.errors = errors;
282816
- this._regenerateMap = regenerateMap;
282817
- this.failedRules = __assign({}, (failedRules || {}));
282818
- this.setFlags({
282819
- valid: !errors.length,
282820
- passed: !errors.length,
282821
- invalid: !!errors.length,
282822
- failed: !!errors.length,
282823
- validated: true,
282824
- changed: !fastDeepEqual(this.value, this.initialValue)
282825
- });
282826
- },
282827
- registerField: function () {
282828
- updateRenderingContextRefs(this);
282829
- },
282830
- checkComputesRequiredState: function () {
282831
- var rules = __assign(__assign({}, this._resolvedRules), this.normalizedRules);
282832
- var isRequired = Object.keys(rules).some(RuleContainer.isRequireRule);
282833
- return isRequired;
282834
- }
282835
- }
282836
- });
282837
- function computeClassObj(names, flags) {
282838
- var acc = {};
282839
- var keys = Object.keys(flags);
282840
- var length = keys.length;
282841
- var _loop_1 = function (i) {
282842
- var flag = keys[i];
282843
- var className = (names && names[flag]) || flag;
282844
- var value = flags[flag];
282845
- if (isNullOrUndefined(value)) {
282846
- return "continue";
282847
- }
282848
- if ((flag === 'valid' || flag === 'invalid') && !flags.validated) {
282849
- return "continue";
282850
- }
282851
- if (typeof className === 'string') {
282852
- acc[className] = value;
282853
- }
282854
- else if (Array.isArray(className)) {
282855
- className.forEach(function (cls) {
282856
- acc[cls] = value;
282857
- });
282858
- }
282859
- };
282860
- for (var i = 0; i < length; i++) {
282861
- _loop_1(i);
282862
- }
282863
- return acc;
282864
- }
282865
- function createLookup(vm) {
282866
- var providers = vm.$_veeObserver.refs;
282867
- var reduced = {
282868
- names: {},
282869
- values: {}
282870
- };
282871
- return vm.fieldDeps.reduce(function (acc, depName) {
282872
- if (!providers[depName]) {
282873
- return acc;
282874
- }
282875
- acc.values[depName] = providers[depName].value;
282876
- acc.names[depName] = providers[depName].name;
282877
- return acc;
282878
- }, reduced);
282879
- }
282880
- function extractId(vm) {
282881
- if (vm.vid) {
282882
- return vm.vid;
282883
- }
282884
- if (vm.name) {
282885
- return vm.name;
282886
- }
282887
- if (vm.id) {
282888
- return vm.id;
282889
- }
282890
- if (vm.fieldName) {
282891
- return vm.fieldName;
282892
- }
282893
- PROVIDER_COUNTER++;
282894
- return "_vee_" + PROVIDER_COUNTER;
282895
- }
282896
- function updateRenderingContextRefs(vm) {
282897
- var providedId = extractId(vm);
282898
- var id = vm.id;
282899
- // Nothing has changed.
282900
- if (!vm.isActive || (id === providedId && vm.$_veeObserver.refs[id])) {
282901
- return;
282902
- }
282903
- // vid was changed.
282904
- if (id !== providedId && vm.$_veeObserver.refs[id] === vm) {
282905
- vm.$_veeObserver.unobserve(id);
282906
- }
282907
- vm.id = providedId;
282908
- vm.$_veeObserver.observe(vm);
282909
- }
282910
- function createObserver() {
282911
- return {
282912
- refs: {},
282913
- observe: function (vm) {
282914
- this.refs[vm.id] = vm;
282915
- },
282916
- unobserve: function (id) {
282917
- delete this.refs[id];
282918
- }
282919
- };
282920
- }
282921
- function watchCrossFieldDep(ctx, depName, withHooks) {
282922
- if (withHooks === void 0) { withHooks = true; }
282923
- var providers = ctx.$_veeObserver.refs;
282924
- if (!ctx._veeWatchers) {
282925
- ctx._veeWatchers = {};
282926
- }
282927
- if (!providers[depName] && withHooks) {
282928
- return ctx.$once('hook:mounted', function () {
282929
- watchCrossFieldDep(ctx, depName, false);
282930
- });
282931
- }
282932
- if (!isCallable(ctx._veeWatchers[depName]) && providers[depName]) {
282933
- ctx._veeWatchers[depName] = providers[depName].$watch('value', function () {
282934
- var isComputesRequired = ctx.checkComputesRequiredState();
282935
- if (ctx.flags.validated) {
282936
- ctx._needsValidation = true;
282937
- ctx.validate();
282938
- }
282939
- // Validate dependent field silently if it has rules with computesRequired
282940
- if (isComputesRequired && !ctx.flags.validated) {
282941
- ctx.validateSilent();
282942
- }
282943
- });
282944
- }
282945
- }
282946
-
282947
- var FLAGS_STRATEGIES = [
282948
- ['pristine', 'every'],
282949
- ['dirty', 'some'],
282950
- ['touched', 'some'],
282951
- ['untouched', 'every'],
282952
- ['valid', 'every'],
282953
- ['invalid', 'some'],
282954
- ['pending', 'some'],
282955
- ['validated', 'every'],
282956
- ['changed', 'some'],
282957
- ['passed', 'every'],
282958
- ['failed', 'some']
282959
- ];
282960
- var OBSERVER_COUNTER = 0;
282961
- function data() {
282962
- var refs = {};
282963
- var errors = {};
282964
- var flags = createObserverFlags();
282965
- var fields = {};
282966
- // FIXME: Not sure of this one can be typed, circular type reference.
282967
- var observers = [];
282968
- return {
282969
- id: '',
282970
- refs: refs,
282971
- observers: observers,
282972
- errors: errors,
282973
- flags: flags,
282974
- fields: fields
282975
- };
282976
- }
282977
- function provideSelf() {
282978
- return {
282979
- $_veeObserver: this
282980
- };
282981
- }
282982
- var ValidationObserver = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend({
282983
- name: 'ValidationObserver',
282984
- provide: provideSelf,
282985
- inject: {
282986
- $_veeObserver: {
282987
- from: '$_veeObserver',
282988
- default: function () {
282989
- if (!this.$vnode.context.$_veeObserver) {
282990
- return null;
282991
- }
282992
- return this.$vnode.context.$_veeObserver;
282993
- }
282994
- }
282995
- },
282996
- props: {
282997
- tag: {
282998
- type: String,
282999
- default: 'span'
283000
- },
283001
- vid: {
283002
- type: String,
283003
- default: function () {
283004
- return "obs_" + OBSERVER_COUNTER++;
283005
- }
283006
- },
283007
- slim: {
283008
- type: Boolean,
283009
- default: false
283010
- },
283011
- disabled: {
283012
- type: Boolean,
283013
- default: false
283014
- }
283015
- },
283016
- data: data,
283017
- created: function () {
283018
- var _this = this;
283019
- this.id = this.vid;
283020
- register(this);
283021
- var onChange = debounce(function (_a) {
283022
- var errors = _a.errors, flags = _a.flags, fields = _a.fields;
283023
- _this.errors = errors;
283024
- _this.flags = flags;
283025
- _this.fields = fields;
283026
- }, 16);
283027
- this.$watch(computeObserverState, onChange);
283028
- },
283029
- activated: function () {
283030
- register(this);
283031
- },
283032
- deactivated: function () {
283033
- unregister(this);
283034
- },
283035
- beforeDestroy: function () {
283036
- unregister(this);
283037
- },
283038
- render: function (h) {
283039
- var children = normalizeChildren(this, prepareSlotProps(this));
283040
- return this.slim && children.length <= 1 ? children[0] : h(this.tag, { on: this.$listeners }, children);
283041
- },
283042
- methods: {
283043
- observe: function (subscriber, kind) {
283044
- var _a;
283045
- if (kind === void 0) { kind = 'provider'; }
283046
- if (kind === 'observer') {
283047
- this.observers.push(subscriber);
283048
- return;
283049
- }
283050
- this.refs = __assign(__assign({}, this.refs), (_a = {}, _a[subscriber.id] = subscriber, _a));
283051
- },
283052
- unobserve: function (id, kind) {
283053
- if (kind === void 0) { kind = 'provider'; }
283054
- if (kind === 'provider') {
283055
- var provider = this.refs[id];
283056
- if (!provider) {
283057
- return;
283058
- }
283059
- this.$delete(this.refs, id);
283060
- return;
283061
- }
283062
- var idx = findIndex(this.observers, function (o) { return o.id === id; });
283063
- if (idx !== -1) {
283064
- this.observers.splice(idx, 1);
283065
- }
283066
- },
283067
- validateWithInfo: function (_a) {
283068
- var _b = (_a === void 0 ? {} : _a).silent, silent = _b === void 0 ? false : _b;
283069
- return __awaiter(this, void 0, void 0, function () {
283070
- var results, isValid, _c, errors, flags, fields;
283071
- return __generator(this, function (_d) {
283072
- switch (_d.label) {
283073
- case 0: return [4 /*yield*/, Promise.all(__spreadArrays(values(this.refs)
283074
- .filter(function (r) { return !r.disabled; })
283075
- .map(function (ref) { return ref[silent ? 'validateSilent' : 'validate']().then(function (r) { return r.valid; }); }), this.observers.filter(function (o) { return !o.disabled; }).map(function (obs) { return obs.validate({ silent: silent }); })))];
283076
- case 1:
283077
- results = _d.sent();
283078
- isValid = results.every(function (r) { return r; });
283079
- _c = computeObserverState.call(this), errors = _c.errors, flags = _c.flags, fields = _c.fields;
283080
- this.errors = errors;
283081
- this.flags = flags;
283082
- this.fields = fields;
283083
- return [2 /*return*/, {
283084
- errors: errors,
283085
- flags: flags,
283086
- fields: fields,
283087
- isValid: isValid
283088
- }];
283089
- }
283090
- });
283091
- });
283092
- },
283093
- validate: function (_a) {
283094
- var _b = (_a === void 0 ? {} : _a).silent, silent = _b === void 0 ? false : _b;
283095
- return __awaiter(this, void 0, void 0, function () {
283096
- var isValid;
283097
- return __generator(this, function (_c) {
283098
- switch (_c.label) {
283099
- case 0: return [4 /*yield*/, this.validateWithInfo({ silent: silent })];
283100
- case 1:
283101
- isValid = (_c.sent()).isValid;
283102
- return [2 /*return*/, isValid];
283103
- }
283104
- });
283105
- });
283106
- },
283107
- handleSubmit: function (cb) {
283108
- return __awaiter(this, void 0, void 0, function () {
283109
- var isValid;
283110
- return __generator(this, function (_a) {
283111
- switch (_a.label) {
283112
- case 0: return [4 /*yield*/, this.validate()];
283113
- case 1:
283114
- isValid = _a.sent();
283115
- if (!isValid || !cb) {
283116
- return [2 /*return*/];
283117
- }
283118
- return [2 /*return*/, cb()];
283119
- }
283120
- });
283121
- });
283122
- },
283123
- reset: function () {
283124
- return __spreadArrays(values(this.refs), this.observers).forEach(function (ref) { return ref.reset(); });
283125
- },
283126
- setErrors: function (errors) {
283127
- var _this = this;
283128
- Object.keys(errors).forEach(function (key) {
283129
- var provider = _this.refs[key];
283130
- if (!provider)
283131
- return;
283132
- var errorArr = errors[key] || [];
283133
- errorArr = typeof errorArr === 'string' ? [errorArr] : errorArr;
283134
- provider.setErrors(errorArr);
283135
- });
283136
- this.observers.forEach(function (observer) {
283137
- observer.setErrors(errors);
283138
- });
283139
- }
283140
- }
283141
- });
283142
- function unregister(vm) {
283143
- if (vm.$_veeObserver) {
283144
- vm.$_veeObserver.unobserve(vm.id, 'observer');
283145
- }
283146
- }
283147
- function register(vm) {
283148
- if (vm.$_veeObserver) {
283149
- vm.$_veeObserver.observe(vm, 'observer');
283150
- }
283151
- }
283152
- function prepareSlotProps(vm) {
283153
- return __assign(__assign({}, vm.flags), { errors: vm.errors, fields: vm.fields, validate: vm.validate, validateWithInfo: vm.validateWithInfo, passes: vm.handleSubmit, handleSubmit: vm.handleSubmit, reset: vm.reset });
283154
- }
283155
- // Creates a modified version of validation flags
283156
- function createObserverFlags() {
283157
- return __assign(__assign({}, createFlags()), { valid: true, invalid: false });
283158
- }
283159
- function computeObserverState() {
283160
- var vms = __spreadArrays(values(this.refs), this.observers.filter(function (o) { return !o.disabled; }));
283161
- var errors = {};
283162
- var flags = createObserverFlags();
283163
- var fields = {};
283164
- var length = vms.length;
283165
- for (var i = 0; i < length; i++) {
283166
- var vm = vms[i];
283167
- // validation provider
283168
- if (Array.isArray(vm.errors)) {
283169
- errors[vm.id] = vm.errors;
283170
- fields[vm.id] = __assign({ id: vm.id, name: vm.name, failedRules: vm.failedRules }, vm.flags);
283171
- continue;
283172
- }
283173
- // Nested observer, merge errors and fields
283174
- errors = __assign(__assign({}, errors), vm.errors);
283175
- fields = __assign(__assign({}, fields), vm.fields);
283176
- }
283177
- FLAGS_STRATEGIES.forEach(function (_a) {
283178
- var flag = _a[0], method = _a[1];
283179
- flags[flag] = vms[method](function (vm) { return vm.flags[flag]; });
283180
- });
283181
- return { errors: errors, flags: flags, fields: fields };
283182
- }
283183
-
283184
- function withValidation(component, mapProps) {
283185
- var _a;
283186
- if (mapProps === void 0) { mapProps = identity; }
283187
- var options = 'options' in component ? component.options : component;
283188
- var providerOpts = ValidationProvider.options;
283189
- var hoc = {
283190
- name: (options.name || 'AnonymousHoc') + "WithValidation",
283191
- props: __assign({}, providerOpts.props),
283192
- data: providerOpts.data,
283193
- computed: __assign({}, providerOpts.computed),
283194
- methods: __assign({}, providerOpts.methods),
283195
- beforeDestroy: providerOpts.beforeDestroy,
283196
- inject: providerOpts.inject
283197
- };
283198
- var eventName = ((_a = options === null || options === void 0 ? void 0 : options.model) === null || _a === void 0 ? void 0 : _a.event) || 'input';
283199
- hoc.render = function (h) {
283200
- var _a;
283201
- this.registerField();
283202
- var vctx = createValidationCtx(this);
283203
- var listeners = __assign({}, this.$listeners);
283204
- var model = findModel(this.$vnode);
283205
- this._inputEventName = this._inputEventName || getInputEventName(this.$vnode, model);
283206
- var value = findValue(this.$vnode);
283207
- onRenderUpdate(this, value === null || value === void 0 ? void 0 : value.value);
283208
- var _b = createCommonHandlers(this), onInput = _b.onInput, onBlur = _b.onBlur, onValidate = _b.onValidate;
283209
- mergeVNodeListeners(listeners, eventName, onInput);
283210
- mergeVNodeListeners(listeners, 'blur', onBlur);
283211
- this.normalizedEvents.forEach(function (evt) {
283212
- mergeVNodeListeners(listeners, evt, onValidate);
283213
- });
283214
- // Props are any attrs not associated with ValidationProvider Plus the model prop.
283215
- // WARNING: Accidental prop overwrite will probably happen.
283216
- var prop = (findModelConfig(this.$vnode) || { prop: 'value' }).prop;
283217
- var props = __assign(__assign(__assign({}, this.$attrs), (_a = {}, _a[prop] = model === null || model === void 0 ? void 0 : model.value, _a)), mapProps(vctx));
283218
- return h(options, {
283219
- attrs: this.$attrs,
283220
- props: props,
283221
- on: listeners,
283222
- scopedSlots: this.$scopedSlots
283223
- }, normalizeSlots(this.$slots, this.$vnode.context));
283224
- };
283225
- return hoc;
283226
- }
283227
-
283228
- var version = '3.4.15';
283229
-
283230
-
281190
+ var srcvue_type_template_id_2e5427a8_scoped_true_staticRenderFns = [];
283231
281191
 
281192
+ ;// CONCATENATED MODULE: external {"commonjs":"vee-validate","commonjs2":"vee-validate","root":"VeeValidate"}
281193
+ var external_commonjs_vee_validate_commonjs2_vee_validate_root_VeeValidate_namespaceObject = require("vee-validate");
283232
281194
  ;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./packages/ecwapp/DatetimeRange/src/index.vue?vue&type=script&lang=js
283233
281195
 
283234
281196
 
@@ -283300,31 +281262,38 @@ var version = '3.4.15';
283300
281262
  // 消息函数在生成时对 params.target(原始日期值)格式化为显示格式
283301
281263
  var self = this;
283302
281264
  var afterMessage = function afterMessage(field, values) {
283303
- var target = values.target ? (0,utils/* formatTime */.fU)(values.target, self.format) : '';
283304
- return "".concat(field, "\u5FC5\u987B\u5728").concat(target, "\u4E4B\u540E");
281265
+ var t = typeof values.target === 'function' ? '' : values.target ? (0,utils/* formatTime */.fU)(values.target, self.format) : '';
281266
+ return "".concat(field, "\u5FC5\u987B\u5728").concat(t, "\u4E4B\u540E");
283305
281267
  };
283306
281268
  var beforeMessage = function beforeMessage(field, values) {
283307
- var target = values.target ? (0,utils/* formatTime */.fU)(values.target, self.format) : '';
283308
- return "".concat(field, "\u5FC5\u987B\u5728").concat(target, "\u4E4B\u524D");
281269
+ var t = typeof values.target === 'function' ? '' : values.target ? (0,utils/* formatTime */.fU)(values.target, self.format) : '';
281270
+ return "".concat(field, "\u5FC5\u987B\u5728").concat(t, "\u4E4B\u524D");
283309
281271
  };
283310
- vee_validate_esm_extend('after', {
281272
+
281273
+ // loadLocalize 可能重置 isTarget:true,使 target 变为 locator 函数,需防御性处理
281274
+ var resolveTarget = function resolveTarget(target) {
281275
+ return typeof target === 'function' ? undefined : target;
281276
+ };
281277
+ (0,external_commonjs_vee_validate_commonjs2_vee_validate_root_VeeValidate_namespaceObject.extend)('after', {
283311
281278
  params: [{
283312
281279
  name: 'target'
283313
281280
  }],
283314
281281
  message: afterMessage,
283315
281282
  validate: function validate(value, _ref) {
283316
281283
  var target = _ref.target;
283317
- return !target || value >= target;
281284
+ var raw = resolveTarget(target);
281285
+ return !raw || value >= raw;
283318
281286
  }
283319
281287
  });
283320
- vee_validate_esm_extend('before', {
281288
+ (0,external_commonjs_vee_validate_commonjs2_vee_validate_root_VeeValidate_namespaceObject.extend)('before', {
283321
281289
  params: [{
283322
281290
  name: 'target'
283323
281291
  }],
283324
281292
  message: beforeMessage,
283325
281293
  validate: function validate(value, _ref2) {
283326
281294
  var target = _ref2.target;
283327
- return !target || value <= target;
281295
+ var raw = resolveTarget(target);
281296
+ return !raw || value <= raw;
283328
281297
  }
283329
281298
  });
283330
281299
  if (this.type === 'date' && this.format === null) {
@@ -283395,11 +281364,11 @@ var version = '3.4.15';
283395
281364
  ;
283396
281365
  var DatetimeRange_src_component = (0,componentNormalizer/* default */.A)(
283397
281366
  ecwapp_DatetimeRange_srcvue_type_script_lang_js,
283398
- srcvue_type_template_id_8bfa0ffc_scoped_true_render,
283399
- srcvue_type_template_id_8bfa0ffc_scoped_true_staticRenderFns,
281367
+ srcvue_type_template_id_2e5427a8_scoped_true_render,
281368
+ srcvue_type_template_id_2e5427a8_scoped_true_staticRenderFns,
283400
281369
  false,
283401
281370
  null,
283402
- "8bfa0ffc",
281371
+ "2e5427a8",
283403
281372
  null
283404
281373
 
283405
281374
  )
@@ -288671,6 +286640,9 @@ WfNames_src.install = function (Vue) {
288671
286640
  Vue.component(WfNames_src.name, WfNames_src);
288672
286641
  };
288673
286642
  /* harmony default export */ var WfNames = (WfNames_src);
286643
+ // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
286644
+ var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(74100);
286645
+ var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
288674
286646
  ;// CONCATENATED MODULE: ./packages/common/directive/field-lbl/index.js
288675
286647
 
288676
286648
  /**