xianniu-ui 0.5.2-beta.0 → 0.5.2-beta.1

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.
Files changed (37) hide show
  1. package/lib/static/css/chunk-elementUI.0b417c2d.css +1 -0
  2. package/lib/static/fonts/element-icons.535877f5.woff +0 -0
  3. package/lib/static/fonts/element-icons.732389de.ttf +0 -0
  4. package/lib/xianniu-ui.common.chunk-elementUI.js +77 -67837
  5. package/lib/xianniu-ui.common.chunk-libs~253ae210.js +0 -1222
  6. package/lib/xianniu-ui.common.chunk-libs~31ecd969.js +1055 -1072
  7. package/lib/xianniu-ui.common.chunk-libs~93acefaf.js +1 -1
  8. package/lib/xianniu-ui.common.chunk-libs~af0f4b76.js +1 -1
  9. package/lib/xianniu-ui.common.chunk-libs~d939e436.js +42 -106
  10. package/lib/xianniu-ui.common.chunk-libs~dfe5688e.js +1 -1
  11. package/lib/xianniu-ui.common.js +1 -1
  12. package/lib/xianniu-ui.common.xianniu-ui.common.js +36 -27
  13. package/lib/xianniu-ui.umd.chunk-elementUI.js +77 -67837
  14. package/lib/xianniu-ui.umd.chunk-libs~253ae210.js +0 -1222
  15. package/lib/xianniu-ui.umd.chunk-libs~31ecd969.js +1055 -1072
  16. package/lib/xianniu-ui.umd.chunk-libs~93acefaf.js +1 -1
  17. package/lib/xianniu-ui.umd.chunk-libs~af0f4b76.js +1 -1
  18. package/lib/xianniu-ui.umd.chunk-libs~d939e436.js +42 -106
  19. package/lib/xianniu-ui.umd.chunk-libs~dfe5688e.js +1 -1
  20. package/lib/xianniu-ui.umd.js +1 -1
  21. package/lib/xianniu-ui.umd.min.chunk-elementUI.js +1 -9
  22. package/lib/xianniu-ui.umd.min.chunk-libs~253ae210.js +1 -1
  23. package/lib/xianniu-ui.umd.min.chunk-libs~31ecd969.js +1 -1
  24. package/lib/xianniu-ui.umd.min.chunk-libs~93acefaf.js +1 -1
  25. package/lib/xianniu-ui.umd.min.chunk-libs~af0f4b76.js +1 -1
  26. package/lib/xianniu-ui.umd.min.chunk-libs~d939e436.js +1 -1
  27. package/lib/xianniu-ui.umd.min.chunk-libs~dfe5688e.js +1 -1
  28. package/lib/xianniu-ui.umd.min.js +1 -1
  29. package/lib/xianniu-ui.umd.min.xianniu-ui.umd.min.js +1 -1
  30. package/lib/xianniu-ui.umd.xianniu-ui.umd.js +36 -27
  31. package/package.json +1 -1
  32. package/lib/xianniu-ui.common.chunk-libs~6cb95173.js +0 -1594
  33. package/lib/xianniu-ui.common.chunk-libs~b58f7129.js +0 -1723
  34. package/lib/xianniu-ui.umd.chunk-libs~6cb95173.js +0 -1594
  35. package/lib/xianniu-ui.umd.chunk-libs~b58f7129.js +0 -1723
  36. package/lib/xianniu-ui.umd.min.chunk-libs~6cb95173.js +0 -1
  37. package/lib/xianniu-ui.umd.min.chunk-libs~b58f7129.js +0 -16
@@ -1566,1228 +1566,6 @@ CancelToken.source = function source() {
1566
1566
  module.exports = CancelToken;
1567
1567
 
1568
1568
 
1569
- /***/ }),
1570
-
1571
- /***/ "a15e":
1572
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
1573
-
1574
- "use strict";
1575
- // ESM COMPAT FLAG
1576
- __webpack_require__.r(__webpack_exports__);
1577
-
1578
- // EXTERNAL MODULE: ./node_modules/babel-runtime/helpers/extends.js
1579
- var helpers_extends = __webpack_require__("41b2");
1580
- var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);
1581
-
1582
- // EXTERNAL MODULE: ./node_modules/babel-runtime/helpers/typeof.js
1583
- var helpers_typeof = __webpack_require__("1098");
1584
- var typeof_default = /*#__PURE__*/__webpack_require__.n(helpers_typeof);
1585
-
1586
- // CONCATENATED MODULE: ./node_modules/async-validator/es/util.js
1587
-
1588
-
1589
- var formatRegExp = /%[sdj%]/g;
1590
-
1591
- var warning = function warning() {};
1592
-
1593
- // don't print warning message when in production env or node runtime
1594
- if (false) {}
1595
-
1596
- function format() {
1597
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1598
- args[_key] = arguments[_key];
1599
- }
1600
-
1601
- var i = 1;
1602
- var f = args[0];
1603
- var len = args.length;
1604
- if (typeof f === 'function') {
1605
- return f.apply(null, args.slice(1));
1606
- }
1607
- if (typeof f === 'string') {
1608
- var str = String(f).replace(formatRegExp, function (x) {
1609
- if (x === '%%') {
1610
- return '%';
1611
- }
1612
- if (i >= len) {
1613
- return x;
1614
- }
1615
- switch (x) {
1616
- case '%s':
1617
- return String(args[i++]);
1618
- case '%d':
1619
- return Number(args[i++]);
1620
- case '%j':
1621
- try {
1622
- return JSON.stringify(args[i++]);
1623
- } catch (_) {
1624
- return '[Circular]';
1625
- }
1626
- break;
1627
- default:
1628
- return x;
1629
- }
1630
- });
1631
- for (var arg = args[i]; i < len; arg = args[++i]) {
1632
- str += ' ' + arg;
1633
- }
1634
- return str;
1635
- }
1636
- return f;
1637
- }
1638
-
1639
- function isNativeStringType(type) {
1640
- return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern';
1641
- }
1642
-
1643
- function isEmptyValue(value, type) {
1644
- if (value === undefined || value === null) {
1645
- return true;
1646
- }
1647
- if (type === 'array' && Array.isArray(value) && !value.length) {
1648
- return true;
1649
- }
1650
- if (isNativeStringType(type) && typeof value === 'string' && !value) {
1651
- return true;
1652
- }
1653
- return false;
1654
- }
1655
-
1656
- function isEmptyObject(obj) {
1657
- return Object.keys(obj).length === 0;
1658
- }
1659
-
1660
- function asyncParallelArray(arr, func, callback) {
1661
- var results = [];
1662
- var total = 0;
1663
- var arrLength = arr.length;
1664
-
1665
- function count(errors) {
1666
- results.push.apply(results, errors);
1667
- total++;
1668
- if (total === arrLength) {
1669
- callback(results);
1670
- }
1671
- }
1672
-
1673
- arr.forEach(function (a) {
1674
- func(a, count);
1675
- });
1676
- }
1677
-
1678
- function asyncSerialArray(arr, func, callback) {
1679
- var index = 0;
1680
- var arrLength = arr.length;
1681
-
1682
- function next(errors) {
1683
- if (errors && errors.length) {
1684
- callback(errors);
1685
- return;
1686
- }
1687
- var original = index;
1688
- index = index + 1;
1689
- if (original < arrLength) {
1690
- func(arr[original], next);
1691
- } else {
1692
- callback([]);
1693
- }
1694
- }
1695
-
1696
- next([]);
1697
- }
1698
-
1699
- function flattenObjArr(objArr) {
1700
- var ret = [];
1701
- Object.keys(objArr).forEach(function (k) {
1702
- ret.push.apply(ret, objArr[k]);
1703
- });
1704
- return ret;
1705
- }
1706
-
1707
- function asyncMap(objArr, option, func, callback) {
1708
- if (option.first) {
1709
- var flattenArr = flattenObjArr(objArr);
1710
- return asyncSerialArray(flattenArr, func, callback);
1711
- }
1712
- var firstFields = option.firstFields || [];
1713
- if (firstFields === true) {
1714
- firstFields = Object.keys(objArr);
1715
- }
1716
- var objArrKeys = Object.keys(objArr);
1717
- var objArrLength = objArrKeys.length;
1718
- var total = 0;
1719
- var results = [];
1720
- var next = function next(errors) {
1721
- results.push.apply(results, errors);
1722
- total++;
1723
- if (total === objArrLength) {
1724
- callback(results);
1725
- }
1726
- };
1727
- objArrKeys.forEach(function (key) {
1728
- var arr = objArr[key];
1729
- if (firstFields.indexOf(key) !== -1) {
1730
- asyncSerialArray(arr, func, next);
1731
- } else {
1732
- asyncParallelArray(arr, func, next);
1733
- }
1734
- });
1735
- }
1736
-
1737
- function complementError(rule) {
1738
- return function (oe) {
1739
- if (oe && oe.message) {
1740
- oe.field = oe.field || rule.fullField;
1741
- return oe;
1742
- }
1743
- return {
1744
- message: oe,
1745
- field: oe.field || rule.fullField
1746
- };
1747
- };
1748
- }
1749
-
1750
- function deepMerge(target, source) {
1751
- if (source) {
1752
- for (var s in source) {
1753
- if (source.hasOwnProperty(s)) {
1754
- var value = source[s];
1755
- if ((typeof value === 'undefined' ? 'undefined' : typeof_default()(value)) === 'object' && typeof_default()(target[s]) === 'object') {
1756
- target[s] = extends_default()({}, target[s], value);
1757
- } else {
1758
- target[s] = value;
1759
- }
1760
- }
1761
- }
1762
- }
1763
- return target;
1764
- }
1765
- // CONCATENATED MODULE: ./node_modules/async-validator/es/rule/required.js
1766
-
1767
-
1768
- /**
1769
- * Rule for validating required fields.
1770
- *
1771
- * @param rule The validation rule.
1772
- * @param value The value of the field on the source object.
1773
- * @param source The source object being validated.
1774
- * @param errors An array of errors that this rule may add
1775
- * validation errors to.
1776
- * @param options The validation options.
1777
- * @param options.messages The validation messages.
1778
- */
1779
- function required(rule, value, source, errors, options, type) {
1780
- if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) {
1781
- errors.push(format(options.messages.required, rule.fullField));
1782
- }
1783
- }
1784
-
1785
- /* harmony default export */ var rule_required = (required);
1786
- // CONCATENATED MODULE: ./node_modules/async-validator/es/rule/whitespace.js
1787
-
1788
-
1789
- /**
1790
- * Rule for validating whitespace.
1791
- *
1792
- * @param rule The validation rule.
1793
- * @param value The value of the field on the source object.
1794
- * @param source The source object being validated.
1795
- * @param errors An array of errors that this rule may add
1796
- * validation errors to.
1797
- * @param options The validation options.
1798
- * @param options.messages The validation messages.
1799
- */
1800
- function whitespace(rule, value, source, errors, options) {
1801
- if (/^\s+$/.test(value) || value === '') {
1802
- errors.push(format(options.messages.whitespace, rule.fullField));
1803
- }
1804
- }
1805
-
1806
- /* harmony default export */ var rule_whitespace = (whitespace);
1807
- // CONCATENATED MODULE: ./node_modules/async-validator/es/rule/type.js
1808
-
1809
-
1810
-
1811
-
1812
- /* eslint max-len:0 */
1813
-
1814
- var pattern = {
1815
- // http://emailregex.com/
1816
- email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
1817
- url: new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'),
1818
- hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
1819
- };
1820
-
1821
- var types = {
1822
- integer: function integer(value) {
1823
- return types.number(value) && parseInt(value, 10) === value;
1824
- },
1825
- float: function float(value) {
1826
- return types.number(value) && !types.integer(value);
1827
- },
1828
- array: function array(value) {
1829
- return Array.isArray(value);
1830
- },
1831
- regexp: function regexp(value) {
1832
- if (value instanceof RegExp) {
1833
- return true;
1834
- }
1835
- try {
1836
- return !!new RegExp(value);
1837
- } catch (e) {
1838
- return false;
1839
- }
1840
- },
1841
- date: function date(value) {
1842
- return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function';
1843
- },
1844
- number: function number(value) {
1845
- if (isNaN(value)) {
1846
- return false;
1847
- }
1848
- return typeof value === 'number';
1849
- },
1850
- object: function object(value) {
1851
- return (typeof value === 'undefined' ? 'undefined' : typeof_default()(value)) === 'object' && !types.array(value);
1852
- },
1853
- method: function method(value) {
1854
- return typeof value === 'function';
1855
- },
1856
- email: function email(value) {
1857
- return typeof value === 'string' && !!value.match(pattern.email) && value.length < 255;
1858
- },
1859
- url: function url(value) {
1860
- return typeof value === 'string' && !!value.match(pattern.url);
1861
- },
1862
- hex: function hex(value) {
1863
- return typeof value === 'string' && !!value.match(pattern.hex);
1864
- }
1865
- };
1866
-
1867
- /**
1868
- * Rule for validating the type of a value.
1869
- *
1870
- * @param rule The validation rule.
1871
- * @param value The value of the field on the source object.
1872
- * @param source The source object being validated.
1873
- * @param errors An array of errors that this rule may add
1874
- * validation errors to.
1875
- * @param options The validation options.
1876
- * @param options.messages The validation messages.
1877
- */
1878
- function type_type(rule, value, source, errors, options) {
1879
- if (rule.required && value === undefined) {
1880
- rule_required(rule, value, source, errors, options);
1881
- return;
1882
- }
1883
- var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex'];
1884
- var ruleType = rule.type;
1885
- if (custom.indexOf(ruleType) > -1) {
1886
- if (!types[ruleType](value)) {
1887
- errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
1888
- }
1889
- // straight typeof check
1890
- } else if (ruleType && (typeof value === 'undefined' ? 'undefined' : typeof_default()(value)) !== rule.type) {
1891
- errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
1892
- }
1893
- }
1894
-
1895
- /* harmony default export */ var rule_type = (type_type);
1896
- // CONCATENATED MODULE: ./node_modules/async-validator/es/rule/range.js
1897
-
1898
-
1899
- /**
1900
- * Rule for validating minimum and maximum allowed values.
1901
- *
1902
- * @param rule The validation rule.
1903
- * @param value The value of the field on the source object.
1904
- * @param source The source object being validated.
1905
- * @param errors An array of errors that this rule may add
1906
- * validation errors to.
1907
- * @param options The validation options.
1908
- * @param options.messages The validation messages.
1909
- */
1910
- function range(rule, value, source, errors, options) {
1911
- var len = typeof rule.len === 'number';
1912
- var min = typeof rule.min === 'number';
1913
- var max = typeof rule.max === 'number';
1914
- // 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane)
1915
- var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
1916
- var val = value;
1917
- var key = null;
1918
- var num = typeof value === 'number';
1919
- var str = typeof value === 'string';
1920
- var arr = Array.isArray(value);
1921
- if (num) {
1922
- key = 'number';
1923
- } else if (str) {
1924
- key = 'string';
1925
- } else if (arr) {
1926
- key = 'array';
1927
- }
1928
- // if the value is not of a supported type for range validation
1929
- // the validation rule rule should use the
1930
- // type property to also test for a particular type
1931
- if (!key) {
1932
- return false;
1933
- }
1934
- if (arr) {
1935
- val = value.length;
1936
- }
1937
- if (str) {
1938
- // 处理码点大于U+010000的文字length属性不准确的bug,如"𠮷𠮷𠮷".lenght !== 3
1939
- val = value.replace(spRegexp, '_').length;
1940
- }
1941
- if (len) {
1942
- if (val !== rule.len) {
1943
- errors.push(format(options.messages[key].len, rule.fullField, rule.len));
1944
- }
1945
- } else if (min && !max && val < rule.min) {
1946
- errors.push(format(options.messages[key].min, rule.fullField, rule.min));
1947
- } else if (max && !min && val > rule.max) {
1948
- errors.push(format(options.messages[key].max, rule.fullField, rule.max));
1949
- } else if (min && max && (val < rule.min || val > rule.max)) {
1950
- errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
1951
- }
1952
- }
1953
-
1954
- /* harmony default export */ var rule_range = (range);
1955
- // CONCATENATED MODULE: ./node_modules/async-validator/es/rule/enum.js
1956
-
1957
- var ENUM = 'enum';
1958
-
1959
- /**
1960
- * Rule for validating a value exists in an enumerable list.
1961
- *
1962
- * @param rule The validation rule.
1963
- * @param value The value of the field on the source object.
1964
- * @param source The source object being validated.
1965
- * @param errors An array of errors that this rule may add
1966
- * validation errors to.
1967
- * @param options The validation options.
1968
- * @param options.messages The validation messages.
1969
- */
1970
- function enumerable(rule, value, source, errors, options) {
1971
- rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
1972
- if (rule[ENUM].indexOf(value) === -1) {
1973
- errors.push(format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')));
1974
- }
1975
- }
1976
-
1977
- /* harmony default export */ var rule_enum = (enumerable);
1978
- // CONCATENATED MODULE: ./node_modules/async-validator/es/rule/pattern.js
1979
-
1980
-
1981
- /**
1982
- * Rule for validating a regular expression pattern.
1983
- *
1984
- * @param rule The validation rule.
1985
- * @param value The value of the field on the source object.
1986
- * @param source The source object being validated.
1987
- * @param errors An array of errors that this rule may add
1988
- * validation errors to.
1989
- * @param options The validation options.
1990
- * @param options.messages The validation messages.
1991
- */
1992
- function pattern_pattern(rule, value, source, errors, options) {
1993
- if (rule.pattern) {
1994
- if (rule.pattern instanceof RegExp) {
1995
- // if a RegExp instance is passed, reset `lastIndex` in case its `global`
1996
- // flag is accidentally set to `true`, which in a validation scenario
1997
- // is not necessary and the result might be misleading
1998
- rule.pattern.lastIndex = 0;
1999
- if (!rule.pattern.test(value)) {
2000
- errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
2001
- }
2002
- } else if (typeof rule.pattern === 'string') {
2003
- var _pattern = new RegExp(rule.pattern);
2004
- if (!_pattern.test(value)) {
2005
- errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
2006
- }
2007
- }
2008
- }
2009
- }
2010
-
2011
- /* harmony default export */ var rule_pattern = (pattern_pattern);
2012
- // CONCATENATED MODULE: ./node_modules/async-validator/es/rule/index.js
2013
-
2014
-
2015
-
2016
-
2017
-
2018
-
2019
-
2020
- /* harmony default export */ var es_rule = ({
2021
- required: rule_required,
2022
- whitespace: rule_whitespace,
2023
- type: rule_type,
2024
- range: rule_range,
2025
- 'enum': rule_enum,
2026
- pattern: rule_pattern
2027
- });
2028
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/string.js
2029
-
2030
-
2031
-
2032
- /**
2033
- * Performs validation for string types.
2034
- *
2035
- * @param rule The validation rule.
2036
- * @param value The value of the field on the source object.
2037
- * @param callback The callback function.
2038
- * @param source The source object being validated.
2039
- * @param options The validation options.
2040
- * @param options.messages The validation messages.
2041
- */
2042
- function string(rule, value, callback, source, options) {
2043
- var errors = [];
2044
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2045
- if (validate) {
2046
- if (isEmptyValue(value, 'string') && !rule.required) {
2047
- return callback();
2048
- }
2049
- es_rule.required(rule, value, source, errors, options, 'string');
2050
- if (!isEmptyValue(value, 'string')) {
2051
- es_rule.type(rule, value, source, errors, options);
2052
- es_rule.range(rule, value, source, errors, options);
2053
- es_rule.pattern(rule, value, source, errors, options);
2054
- if (rule.whitespace === true) {
2055
- es_rule.whitespace(rule, value, source, errors, options);
2056
- }
2057
- }
2058
- }
2059
- callback(errors);
2060
- }
2061
-
2062
- /* harmony default export */ var validator_string = (string);
2063
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/method.js
2064
-
2065
-
2066
-
2067
- /**
2068
- * Validates a function.
2069
- *
2070
- * @param rule The validation rule.
2071
- * @param value The value of the field on the source object.
2072
- * @param callback The callback function.
2073
- * @param source The source object being validated.
2074
- * @param options The validation options.
2075
- * @param options.messages The validation messages.
2076
- */
2077
- function method(rule, value, callback, source, options) {
2078
- var errors = [];
2079
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2080
- if (validate) {
2081
- if (isEmptyValue(value) && !rule.required) {
2082
- return callback();
2083
- }
2084
- es_rule.required(rule, value, source, errors, options);
2085
- if (value !== undefined) {
2086
- es_rule.type(rule, value, source, errors, options);
2087
- }
2088
- }
2089
- callback(errors);
2090
- }
2091
-
2092
- /* harmony default export */ var validator_method = (method);
2093
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/number.js
2094
-
2095
-
2096
-
2097
- /**
2098
- * Validates a number.
2099
- *
2100
- * @param rule The validation rule.
2101
- * @param value The value of the field on the source object.
2102
- * @param callback The callback function.
2103
- * @param source The source object being validated.
2104
- * @param options The validation options.
2105
- * @param options.messages The validation messages.
2106
- */
2107
- function number(rule, value, callback, source, options) {
2108
- var errors = [];
2109
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2110
- if (validate) {
2111
- if (isEmptyValue(value) && !rule.required) {
2112
- return callback();
2113
- }
2114
- es_rule.required(rule, value, source, errors, options);
2115
- if (value !== undefined) {
2116
- es_rule.type(rule, value, source, errors, options);
2117
- es_rule.range(rule, value, source, errors, options);
2118
- }
2119
- }
2120
- callback(errors);
2121
- }
2122
-
2123
- /* harmony default export */ var validator_number = (number);
2124
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/boolean.js
2125
-
2126
-
2127
-
2128
- /**
2129
- * Validates a boolean.
2130
- *
2131
- * @param rule The validation rule.
2132
- * @param value The value of the field on the source object.
2133
- * @param callback The callback function.
2134
- * @param source The source object being validated.
2135
- * @param options The validation options.
2136
- * @param options.messages The validation messages.
2137
- */
2138
- function boolean_boolean(rule, value, callback, source, options) {
2139
- var errors = [];
2140
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2141
- if (validate) {
2142
- if (isEmptyValue(value) && !rule.required) {
2143
- return callback();
2144
- }
2145
- es_rule.required(rule, value, source, errors, options);
2146
- if (value !== undefined) {
2147
- es_rule.type(rule, value, source, errors, options);
2148
- }
2149
- }
2150
- callback(errors);
2151
- }
2152
-
2153
- /* harmony default export */ var validator_boolean = (boolean_boolean);
2154
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/regexp.js
2155
-
2156
-
2157
-
2158
- /**
2159
- * Validates the regular expression type.
2160
- *
2161
- * @param rule The validation rule.
2162
- * @param value The value of the field on the source object.
2163
- * @param callback The callback function.
2164
- * @param source The source object being validated.
2165
- * @param options The validation options.
2166
- * @param options.messages The validation messages.
2167
- */
2168
- function regexp(rule, value, callback, source, options) {
2169
- var errors = [];
2170
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2171
- if (validate) {
2172
- if (isEmptyValue(value) && !rule.required) {
2173
- return callback();
2174
- }
2175
- es_rule.required(rule, value, source, errors, options);
2176
- if (!isEmptyValue(value)) {
2177
- es_rule.type(rule, value, source, errors, options);
2178
- }
2179
- }
2180
- callback(errors);
2181
- }
2182
-
2183
- /* harmony default export */ var validator_regexp = (regexp);
2184
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/integer.js
2185
-
2186
-
2187
-
2188
- /**
2189
- * Validates a number is an integer.
2190
- *
2191
- * @param rule The validation rule.
2192
- * @param value The value of the field on the source object.
2193
- * @param callback The callback function.
2194
- * @param source The source object being validated.
2195
- * @param options The validation options.
2196
- * @param options.messages The validation messages.
2197
- */
2198
- function integer(rule, value, callback, source, options) {
2199
- var errors = [];
2200
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2201
- if (validate) {
2202
- if (isEmptyValue(value) && !rule.required) {
2203
- return callback();
2204
- }
2205
- es_rule.required(rule, value, source, errors, options);
2206
- if (value !== undefined) {
2207
- es_rule.type(rule, value, source, errors, options);
2208
- es_rule.range(rule, value, source, errors, options);
2209
- }
2210
- }
2211
- callback(errors);
2212
- }
2213
-
2214
- /* harmony default export */ var validator_integer = (integer);
2215
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/float.js
2216
-
2217
-
2218
-
2219
- /**
2220
- * Validates a number is a floating point number.
2221
- *
2222
- * @param rule The validation rule.
2223
- * @param value The value of the field on the source object.
2224
- * @param callback The callback function.
2225
- * @param source The source object being validated.
2226
- * @param options The validation options.
2227
- * @param options.messages The validation messages.
2228
- */
2229
- function floatFn(rule, value, callback, source, options) {
2230
- var errors = [];
2231
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2232
- if (validate) {
2233
- if (isEmptyValue(value) && !rule.required) {
2234
- return callback();
2235
- }
2236
- es_rule.required(rule, value, source, errors, options);
2237
- if (value !== undefined) {
2238
- es_rule.type(rule, value, source, errors, options);
2239
- es_rule.range(rule, value, source, errors, options);
2240
- }
2241
- }
2242
- callback(errors);
2243
- }
2244
-
2245
- /* harmony default export */ var validator_float = (floatFn);
2246
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/array.js
2247
-
2248
-
2249
- /**
2250
- * Validates an array.
2251
- *
2252
- * @param rule The validation rule.
2253
- * @param value The value of the field on the source object.
2254
- * @param callback The callback function.
2255
- * @param source The source object being validated.
2256
- * @param options The validation options.
2257
- * @param options.messages The validation messages.
2258
- */
2259
- function array(rule, value, callback, source, options) {
2260
- var errors = [];
2261
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2262
- if (validate) {
2263
- if (isEmptyValue(value, 'array') && !rule.required) {
2264
- return callback();
2265
- }
2266
- es_rule.required(rule, value, source, errors, options, 'array');
2267
- if (!isEmptyValue(value, 'array')) {
2268
- es_rule.type(rule, value, source, errors, options);
2269
- es_rule.range(rule, value, source, errors, options);
2270
- }
2271
- }
2272
- callback(errors);
2273
- }
2274
-
2275
- /* harmony default export */ var validator_array = (array);
2276
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/object.js
2277
-
2278
-
2279
-
2280
- /**
2281
- * Validates an object.
2282
- *
2283
- * @param rule The validation rule.
2284
- * @param value The value of the field on the source object.
2285
- * @param callback The callback function.
2286
- * @param source The source object being validated.
2287
- * @param options The validation options.
2288
- * @param options.messages The validation messages.
2289
- */
2290
- function object_object(rule, value, callback, source, options) {
2291
- var errors = [];
2292
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2293
- if (validate) {
2294
- if (isEmptyValue(value) && !rule.required) {
2295
- return callback();
2296
- }
2297
- es_rule.required(rule, value, source, errors, options);
2298
- if (value !== undefined) {
2299
- es_rule.type(rule, value, source, errors, options);
2300
- }
2301
- }
2302
- callback(errors);
2303
- }
2304
-
2305
- /* harmony default export */ var validator_object = (object_object);
2306
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/enum.js
2307
-
2308
-
2309
- var enum_ENUM = 'enum';
2310
-
2311
- /**
2312
- * Validates an enumerable list.
2313
- *
2314
- * @param rule The validation rule.
2315
- * @param value The value of the field on the source object.
2316
- * @param callback The callback function.
2317
- * @param source The source object being validated.
2318
- * @param options The validation options.
2319
- * @param options.messages The validation messages.
2320
- */
2321
- function enum_enumerable(rule, value, callback, source, options) {
2322
- var errors = [];
2323
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2324
- if (validate) {
2325
- if (isEmptyValue(value) && !rule.required) {
2326
- return callback();
2327
- }
2328
- es_rule.required(rule, value, source, errors, options);
2329
- if (value) {
2330
- es_rule[enum_ENUM](rule, value, source, errors, options);
2331
- }
2332
- }
2333
- callback(errors);
2334
- }
2335
-
2336
- /* harmony default export */ var validator_enum = (enum_enumerable);
2337
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/pattern.js
2338
-
2339
-
2340
-
2341
- /**
2342
- * Validates a regular expression pattern.
2343
- *
2344
- * Performs validation when a rule only contains
2345
- * a pattern property but is not declared as a string type.
2346
- *
2347
- * @param rule The validation rule.
2348
- * @param value The value of the field on the source object.
2349
- * @param callback The callback function.
2350
- * @param source The source object being validated.
2351
- * @param options The validation options.
2352
- * @param options.messages The validation messages.
2353
- */
2354
- function validator_pattern_pattern(rule, value, callback, source, options) {
2355
- var errors = [];
2356
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2357
- if (validate) {
2358
- if (isEmptyValue(value, 'string') && !rule.required) {
2359
- return callback();
2360
- }
2361
- es_rule.required(rule, value, source, errors, options);
2362
- if (!isEmptyValue(value, 'string')) {
2363
- es_rule.pattern(rule, value, source, errors, options);
2364
- }
2365
- }
2366
- callback(errors);
2367
- }
2368
-
2369
- /* harmony default export */ var validator_pattern = (validator_pattern_pattern);
2370
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/date.js
2371
-
2372
-
2373
-
2374
- function date(rule, value, callback, source, options) {
2375
- // console.log('integer rule called %j', rule);
2376
- var errors = [];
2377
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2378
- // console.log('validate on %s value', value);
2379
- if (validate) {
2380
- if (isEmptyValue(value) && !rule.required) {
2381
- return callback();
2382
- }
2383
- es_rule.required(rule, value, source, errors, options);
2384
- if (!isEmptyValue(value)) {
2385
- var dateObject = void 0;
2386
-
2387
- if (typeof value === 'number') {
2388
- dateObject = new Date(value);
2389
- } else {
2390
- dateObject = value;
2391
- }
2392
-
2393
- es_rule.type(rule, dateObject, source, errors, options);
2394
- if (dateObject) {
2395
- es_rule.range(rule, dateObject.getTime(), source, errors, options);
2396
- }
2397
- }
2398
- }
2399
- callback(errors);
2400
- }
2401
-
2402
- /* harmony default export */ var validator_date = (date);
2403
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/required.js
2404
-
2405
-
2406
-
2407
- function required_required(rule, value, callback, source, options) {
2408
- var errors = [];
2409
- var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : typeof_default()(value);
2410
- es_rule.required(rule, value, source, errors, options, type);
2411
- callback(errors);
2412
- }
2413
-
2414
- /* harmony default export */ var validator_required = (required_required);
2415
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/type.js
2416
-
2417
-
2418
-
2419
- function validator_type_type(rule, value, callback, source, options) {
2420
- var ruleType = rule.type;
2421
- var errors = [];
2422
- var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
2423
- if (validate) {
2424
- if (isEmptyValue(value, ruleType) && !rule.required) {
2425
- return callback();
2426
- }
2427
- es_rule.required(rule, value, source, errors, options, ruleType);
2428
- if (!isEmptyValue(value, ruleType)) {
2429
- es_rule.type(rule, value, source, errors, options);
2430
- }
2431
- }
2432
- callback(errors);
2433
- }
2434
-
2435
- /* harmony default export */ var validator_type = (validator_type_type);
2436
- // CONCATENATED MODULE: ./node_modules/async-validator/es/validator/index.js
2437
-
2438
-
2439
-
2440
-
2441
-
2442
-
2443
-
2444
-
2445
-
2446
-
2447
-
2448
-
2449
-
2450
-
2451
-
2452
- /* harmony default export */ var es_validator = ({
2453
- string: validator_string,
2454
- method: validator_method,
2455
- number: validator_number,
2456
- boolean: validator_boolean,
2457
- regexp: validator_regexp,
2458
- integer: validator_integer,
2459
- float: validator_float,
2460
- array: validator_array,
2461
- object: validator_object,
2462
- 'enum': validator_enum,
2463
- pattern: validator_pattern,
2464
- date: validator_date,
2465
- url: validator_type,
2466
- hex: validator_type,
2467
- email: validator_type,
2468
- required: validator_required
2469
- });
2470
- // CONCATENATED MODULE: ./node_modules/async-validator/es/messages.js
2471
- function newMessages() {
2472
- return {
2473
- 'default': 'Validation error on field %s',
2474
- required: '%s is required',
2475
- 'enum': '%s must be one of %s',
2476
- whitespace: '%s cannot be empty',
2477
- date: {
2478
- format: '%s date %s is invalid for format %s',
2479
- parse: '%s date could not be parsed, %s is invalid ',
2480
- invalid: '%s date %s is invalid'
2481
- },
2482
- types: {
2483
- string: '%s is not a %s',
2484
- method: '%s is not a %s (function)',
2485
- array: '%s is not an %s',
2486
- object: '%s is not an %s',
2487
- number: '%s is not a %s',
2488
- date: '%s is not a %s',
2489
- boolean: '%s is not a %s',
2490
- integer: '%s is not an %s',
2491
- float: '%s is not a %s',
2492
- regexp: '%s is not a valid %s',
2493
- email: '%s is not a valid %s',
2494
- url: '%s is not a valid %s',
2495
- hex: '%s is not a valid %s'
2496
- },
2497
- string: {
2498
- len: '%s must be exactly %s characters',
2499
- min: '%s must be at least %s characters',
2500
- max: '%s cannot be longer than %s characters',
2501
- range: '%s must be between %s and %s characters'
2502
- },
2503
- number: {
2504
- len: '%s must equal %s',
2505
- min: '%s cannot be less than %s',
2506
- max: '%s cannot be greater than %s',
2507
- range: '%s must be between %s and %s'
2508
- },
2509
- array: {
2510
- len: '%s must be exactly %s in length',
2511
- min: '%s cannot be less than %s in length',
2512
- max: '%s cannot be greater than %s in length',
2513
- range: '%s must be between %s and %s in length'
2514
- },
2515
- pattern: {
2516
- mismatch: '%s value %s does not match pattern %s'
2517
- },
2518
- clone: function clone() {
2519
- var cloned = JSON.parse(JSON.stringify(this));
2520
- cloned.clone = this.clone;
2521
- return cloned;
2522
- }
2523
- };
2524
- }
2525
-
2526
- var messages_messages = newMessages();
2527
- // CONCATENATED MODULE: ./node_modules/async-validator/es/index.js
2528
-
2529
-
2530
-
2531
-
2532
-
2533
-
2534
- /**
2535
- * Encapsulates a validation schema.
2536
- *
2537
- * @param descriptor An object declaring validation rules
2538
- * for this schema.
2539
- */
2540
- function Schema(descriptor) {
2541
- this.rules = null;
2542
- this._messages = messages_messages;
2543
- this.define(descriptor);
2544
- }
2545
-
2546
- Schema.prototype = {
2547
- messages: function messages(_messages) {
2548
- if (_messages) {
2549
- this._messages = deepMerge(newMessages(), _messages);
2550
- }
2551
- return this._messages;
2552
- },
2553
- define: function define(rules) {
2554
- if (!rules) {
2555
- throw new Error('Cannot configure a schema with no rules');
2556
- }
2557
- if ((typeof rules === 'undefined' ? 'undefined' : typeof_default()(rules)) !== 'object' || Array.isArray(rules)) {
2558
- throw new Error('Rules must be an object');
2559
- }
2560
- this.rules = {};
2561
- var z = void 0;
2562
- var item = void 0;
2563
- for (z in rules) {
2564
- if (rules.hasOwnProperty(z)) {
2565
- item = rules[z];
2566
- this.rules[z] = Array.isArray(item) ? item : [item];
2567
- }
2568
- }
2569
- },
2570
- validate: function validate(source_) {
2571
- var _this = this;
2572
-
2573
- var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2574
- var oc = arguments[2];
2575
-
2576
- var source = source_;
2577
- var options = o;
2578
- var callback = oc;
2579
- if (typeof options === 'function') {
2580
- callback = options;
2581
- options = {};
2582
- }
2583
- if (!this.rules || Object.keys(this.rules).length === 0) {
2584
- if (callback) {
2585
- callback();
2586
- }
2587
- return;
2588
- }
2589
- function complete(results) {
2590
- var i = void 0;
2591
- var field = void 0;
2592
- var errors = [];
2593
- var fields = {};
2594
-
2595
- function add(e) {
2596
- if (Array.isArray(e)) {
2597
- errors = errors.concat.apply(errors, e);
2598
- } else {
2599
- errors.push(e);
2600
- }
2601
- }
2602
-
2603
- for (i = 0; i < results.length; i++) {
2604
- add(results[i]);
2605
- }
2606
- if (!errors.length) {
2607
- errors = null;
2608
- fields = null;
2609
- } else {
2610
- for (i = 0; i < errors.length; i++) {
2611
- field = errors[i].field;
2612
- fields[field] = fields[field] || [];
2613
- fields[field].push(errors[i]);
2614
- }
2615
- }
2616
- callback(errors, fields);
2617
- }
2618
-
2619
- if (options.messages) {
2620
- var messages = this.messages();
2621
- if (messages === messages_messages) {
2622
- messages = newMessages();
2623
- }
2624
- deepMerge(messages, options.messages);
2625
- options.messages = messages;
2626
- } else {
2627
- options.messages = this.messages();
2628
- }
2629
- var arr = void 0;
2630
- var value = void 0;
2631
- var series = {};
2632
- var keys = options.keys || Object.keys(this.rules);
2633
- keys.forEach(function (z) {
2634
- arr = _this.rules[z];
2635
- value = source[z];
2636
- arr.forEach(function (r) {
2637
- var rule = r;
2638
- if (typeof rule.transform === 'function') {
2639
- if (source === source_) {
2640
- source = extends_default()({}, source);
2641
- }
2642
- value = source[z] = rule.transform(value);
2643
- }
2644
- if (typeof rule === 'function') {
2645
- rule = {
2646
- validator: rule
2647
- };
2648
- } else {
2649
- rule = extends_default()({}, rule);
2650
- }
2651
- rule.validator = _this.getValidationMethod(rule);
2652
- rule.field = z;
2653
- rule.fullField = rule.fullField || z;
2654
- rule.type = _this.getType(rule);
2655
- if (!rule.validator) {
2656
- return;
2657
- }
2658
- series[z] = series[z] || [];
2659
- series[z].push({
2660
- rule: rule,
2661
- value: value,
2662
- source: source,
2663
- field: z
2664
- });
2665
- });
2666
- });
2667
- var errorFields = {};
2668
- asyncMap(series, options, function (data, doIt) {
2669
- var rule = data.rule;
2670
- var deep = (rule.type === 'object' || rule.type === 'array') && (typeof_default()(rule.fields) === 'object' || typeof_default()(rule.defaultField) === 'object');
2671
- deep = deep && (rule.required || !rule.required && data.value);
2672
- rule.field = data.field;
2673
- function addFullfield(key, schema) {
2674
- return extends_default()({}, schema, {
2675
- fullField: rule.fullField + '.' + key
2676
- });
2677
- }
2678
-
2679
- function cb() {
2680
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
2681
-
2682
- var errors = e;
2683
- if (!Array.isArray(errors)) {
2684
- errors = [errors];
2685
- }
2686
- if (errors.length) {
2687
- warning('async-validator:', errors);
2688
- }
2689
- if (errors.length && rule.message) {
2690
- errors = [].concat(rule.message);
2691
- }
2692
-
2693
- errors = errors.map(complementError(rule));
2694
-
2695
- if (options.first && errors.length) {
2696
- errorFields[rule.field] = 1;
2697
- return doIt(errors);
2698
- }
2699
- if (!deep) {
2700
- doIt(errors);
2701
- } else {
2702
- // if rule is required but the target object
2703
- // does not exist fail at the rule level and don't
2704
- // go deeper
2705
- if (rule.required && !data.value) {
2706
- if (rule.message) {
2707
- errors = [].concat(rule.message).map(complementError(rule));
2708
- } else if (options.error) {
2709
- errors = [options.error(rule, format(options.messages.required, rule.field))];
2710
- } else {
2711
- errors = [];
2712
- }
2713
- return doIt(errors);
2714
- }
2715
-
2716
- var fieldsSchema = {};
2717
- if (rule.defaultField) {
2718
- for (var k in data.value) {
2719
- if (data.value.hasOwnProperty(k)) {
2720
- fieldsSchema[k] = rule.defaultField;
2721
- }
2722
- }
2723
- }
2724
- fieldsSchema = extends_default()({}, fieldsSchema, data.rule.fields);
2725
- for (var f in fieldsSchema) {
2726
- if (fieldsSchema.hasOwnProperty(f)) {
2727
- var fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]];
2728
- fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f));
2729
- }
2730
- }
2731
- var schema = new Schema(fieldsSchema);
2732
- schema.messages(options.messages);
2733
- if (data.rule.options) {
2734
- data.rule.options.messages = options.messages;
2735
- data.rule.options.error = options.error;
2736
- }
2737
- schema.validate(data.value, data.rule.options || options, function (errs) {
2738
- doIt(errs && errs.length ? errors.concat(errs) : errs);
2739
- });
2740
- }
2741
- }
2742
-
2743
- var res = rule.validator(rule, data.value, cb, data.source, options);
2744
- if (res && res.then) {
2745
- res.then(function () {
2746
- return cb();
2747
- }, function (e) {
2748
- return cb(e);
2749
- });
2750
- }
2751
- }, function (results) {
2752
- complete(results);
2753
- });
2754
- },
2755
- getType: function getType(rule) {
2756
- if (rule.type === undefined && rule.pattern instanceof RegExp) {
2757
- rule.type = 'pattern';
2758
- }
2759
- if (typeof rule.validator !== 'function' && rule.type && !es_validator.hasOwnProperty(rule.type)) {
2760
- throw new Error(format('Unknown rule type %s', rule.type));
2761
- }
2762
- return rule.type || 'string';
2763
- },
2764
- getValidationMethod: function getValidationMethod(rule) {
2765
- if (typeof rule.validator === 'function') {
2766
- return rule.validator;
2767
- }
2768
- var keys = Object.keys(rule);
2769
- var messageIndex = keys.indexOf('message');
2770
- if (messageIndex !== -1) {
2771
- keys.splice(messageIndex, 1);
2772
- }
2773
- if (keys.length === 1 && keys[0] === 'required') {
2774
- return es_validator.required;
2775
- }
2776
- return es_validator[this.getType(rule)] || false;
2777
- }
2778
- };
2779
-
2780
- Schema.register = function register(type, validator) {
2781
- if (typeof validator !== 'function') {
2782
- throw new Error('Cannot register a validator by type, validator is not a function');
2783
- }
2784
- es_validator[type] = validator;
2785
- };
2786
-
2787
- Schema.messages = messages_messages;
2788
-
2789
- /* harmony default export */ var es = __webpack_exports__["default"] = (Schema);
2790
-
2791
1569
  /***/ }),
2792
1570
 
2793
1571
  /***/ "ade3":