1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | (function (global, factory) {
|
8 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
|
9 | typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
|
10 | (factory((global.formCreate = {}),global.Vue));
|
11 | }(this, (function (exports,Vue$1) { 'use strict';
|
12 |
|
13 | Vue$1 = Vue$1 && Vue$1.hasOwnProperty('default') ? Vue$1['default'] : Vue$1;
|
14 |
|
15 | var toString = {}.toString;
|
16 |
|
17 | var classofRaw = function (it) {
|
18 | return toString.call(it).slice(8, -1);
|
19 | };
|
20 |
|
21 |
|
22 |
|
23 | var isArray = Array.isArray || function isArray(arg) {
|
24 | return classofRaw(arg) == 'Array';
|
25 | };
|
26 |
|
27 | var isObject = function (it) {
|
28 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
29 | };
|
30 |
|
31 |
|
32 |
|
33 | var requireObjectCoercible = function (it) {
|
34 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
35 | return it;
|
36 | };
|
37 |
|
38 |
|
39 |
|
40 | var toObject = function (argument) {
|
41 | return Object(requireObjectCoercible(argument));
|
42 | };
|
43 |
|
44 | var ceil = Math.ceil;
|
45 | var floor = Math.floor;
|
46 |
|
47 |
|
48 |
|
49 | var toInteger = function (argument) {
|
50 | return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
51 | };
|
52 |
|
53 | var min = Math.min;
|
54 |
|
55 |
|
56 |
|
57 | var toLength = function (argument) {
|
58 | return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | var toPrimitive = function (it, S) {
|
66 | if (!isObject(it)) return it;
|
67 | var fn, val;
|
68 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
69 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
70 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
71 | throw TypeError("Can't convert object to primitive value");
|
72 | };
|
73 |
|
74 | var fails = function (exec) {
|
75 | try {
|
76 | return !!exec();
|
77 | } catch (error) {
|
78 | return true;
|
79 | }
|
80 | };
|
81 |
|
82 |
|
83 | var descriptors = !fails(function () {
|
84 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
85 | });
|
86 |
|
87 |
|
88 | var global$1 = typeof window == 'object' && window && window.Math == Math ? window
|
89 | : typeof self == 'object' && self && self.Math == Math ? self
|
90 |
|
91 | : Function('return this')();
|
92 |
|
93 | var document$1 = global$1.document;
|
94 |
|
95 | var exist = isObject(document$1) && isObject(document$1.createElement);
|
96 |
|
97 | var documentCreateElement = function (it) {
|
98 | return exist ? document$1.createElement(it) : {};
|
99 | };
|
100 |
|
101 |
|
102 | var ie8DomDefine = !descriptors && !fails(function () {
|
103 | return Object.defineProperty(documentCreateElement('div'), 'a', {
|
104 | get: function () { return 7; }
|
105 | }).a != 7;
|
106 | });
|
107 |
|
108 | var anObject = function (it) {
|
109 | if (!isObject(it)) {
|
110 | throw TypeError(String(it) + ' is not an object');
|
111 | } return it;
|
112 | };
|
113 |
|
114 | var nativeDefineProperty = Object.defineProperty;
|
115 |
|
116 | var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
117 | anObject(O);
|
118 | P = toPrimitive(P, true);
|
119 | anObject(Attributes);
|
120 | if (ie8DomDefine) try {
|
121 | return nativeDefineProperty(O, P, Attributes);
|
122 | } catch (error) { }
|
123 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
124 | if ('value' in Attributes) O[P] = Attributes.value;
|
125 | return O;
|
126 | };
|
127 |
|
128 | var objectDefineProperty = {
|
129 | f: f
|
130 | };
|
131 |
|
132 | var createPropertyDescriptor = function (bitmap, value) {
|
133 | return {
|
134 | enumerable: !(bitmap & 1),
|
135 | configurable: !(bitmap & 2),
|
136 | writable: !(bitmap & 4),
|
137 | value: value
|
138 | };
|
139 | };
|
140 |
|
141 | var createProperty = function (object, key, value) {
|
142 | var propertyKey = toPrimitive(key);
|
143 | if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
144 | else object[propertyKey] = value;
|
145 | };
|
146 |
|
147 | function createCommonjsModule(fn, module) {
|
148 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
149 | }
|
150 |
|
151 | var hide = descriptors ? function (object, key, value) {
|
152 | return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
153 | } : function (object, key, value) {
|
154 | object[key] = value;
|
155 | return object;
|
156 | };
|
157 |
|
158 | var setGlobal = function (key, value) {
|
159 | try {
|
160 | hide(global$1, key, value);
|
161 | } catch (error) {
|
162 | global$1[key] = value;
|
163 | } return value;
|
164 | };
|
165 |
|
166 | var isPure = false;
|
167 |
|
168 | var shared = createCommonjsModule(function (module) {
|
169 | var SHARED = '__core-js_shared__';
|
170 | var store = global$1[SHARED] || setGlobal(SHARED, {});
|
171 |
|
172 | (module.exports = function (key, value) {
|
173 | return store[key] || (store[key] = value !== undefined ? value : {});
|
174 | })('versions', []).push({
|
175 | version: '3.0.1',
|
176 | mode: isPure ? 'pure' : 'global',
|
177 | copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
178 | });
|
179 | });
|
180 |
|
181 | var id = 0;
|
182 | var postfix = Math.random();
|
183 |
|
184 | var uid = function (key) {
|
185 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
|
186 | };
|
187 |
|
188 |
|
189 | var nativeSymbol = !fails(function () {
|
190 |
|
191 | return !String(Symbol());
|
192 | });
|
193 |
|
194 | var store = shared('wks');
|
195 |
|
196 | var Symbol$1 = global$1.Symbol;
|
197 |
|
198 |
|
199 | var wellKnownSymbol = function (name) {
|
200 | return store[name] || (store[name] = nativeSymbol && Symbol$1[name]
|
201 | || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
|
202 | };
|
203 |
|
204 | var SPECIES = wellKnownSymbol('species');
|
205 |
|
206 |
|
207 |
|
208 | var arraySpeciesCreate = function (originalArray, length) {
|
209 | var C;
|
210 | if (isArray(originalArray)) {
|
211 | C = originalArray.constructor;
|
212 |
|
213 | if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
|
214 | else if (isObject(C)) {
|
215 | C = C[SPECIES];
|
216 | if (C === null) C = undefined;
|
217 | }
|
218 | } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
|
219 | };
|
220 |
|
221 | var SPECIES$1 = wellKnownSymbol('species');
|
222 |
|
223 | var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
224 | return !fails(function () {
|
225 | var array = [];
|
226 | var constructor = array.constructor = {};
|
227 | constructor[SPECIES$1] = function () {
|
228 | return { foo: 1 };
|
229 | };
|
230 | return array[METHOD_NAME](Boolean).foo !== 1;
|
231 | });
|
232 | };
|
233 |
|
234 | var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
235 | var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
236 |
|
237 |
|
238 | var NASHORN_BUG = nativeGetOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
239 |
|
240 | var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
241 | var descriptor = nativeGetOwnPropertyDescriptor(this, V);
|
242 | return !!descriptor && descriptor.enumerable;
|
243 | } : nativePropertyIsEnumerable;
|
244 |
|
245 | var objectPropertyIsEnumerable = {
|
246 | f: f$1
|
247 | };
|
248 |
|
249 |
|
250 |
|
251 |
|
252 | var split = ''.split;
|
253 |
|
254 | var indexedObject = fails(function () {
|
255 |
|
256 |
|
257 | return !Object('z').propertyIsEnumerable(0);
|
258 | }) ? function (it) {
|
259 | return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
|
260 | } : Object;
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 | var toIndexedObject = function (it) {
|
267 | return indexedObject(requireObjectCoercible(it));
|
268 | };
|
269 |
|
270 | var hasOwnProperty = {}.hasOwnProperty;
|
271 |
|
272 | var has = function (it, key) {
|
273 | return hasOwnProperty.call(it, key);
|
274 | };
|
275 |
|
276 | var nativeGetOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
277 |
|
278 | var f$2 = descriptors ? nativeGetOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
279 | O = toIndexedObject(O);
|
280 | P = toPrimitive(P, true);
|
281 | if (ie8DomDefine) try {
|
282 | return nativeGetOwnPropertyDescriptor$1(O, P);
|
283 | } catch (error) { }
|
284 | if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
|
285 | };
|
286 |
|
287 | var objectGetOwnPropertyDescriptor = {
|
288 | f: f$2
|
289 | };
|
290 |
|
291 | var functionToString = shared('native-function-to-string', Function.toString);
|
292 |
|
293 | var WeakMap$1 = global$1.WeakMap;
|
294 |
|
295 | var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(functionToString.call(WeakMap$1));
|
296 |
|
297 | var shared$1 = shared('keys');
|
298 |
|
299 |
|
300 | var sharedKey = function (key) {
|
301 | return shared$1[key] || (shared$1[key] = uid(key));
|
302 | };
|
303 |
|
304 | var hiddenKeys = {};
|
305 |
|
306 | var WeakMap$2 = global$1.WeakMap;
|
307 | var set, get, has$1;
|
308 |
|
309 | var enforce = function (it) {
|
310 | return has$1(it) ? get(it) : set(it, {});
|
311 | };
|
312 |
|
313 | var getterFor = function (TYPE) {
|
314 | return function (it) {
|
315 | var state;
|
316 | if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
317 | throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
318 | } return state;
|
319 | };
|
320 | };
|
321 |
|
322 | if (nativeWeakMap) {
|
323 | var store$1 = new WeakMap$2();
|
324 | var wmget = store$1.get;
|
325 | var wmhas = store$1.has;
|
326 | var wmset = store$1.set;
|
327 | set = function (it, metadata) {
|
328 | wmset.call(store$1, it, metadata);
|
329 | return metadata;
|
330 | };
|
331 | get = function (it) {
|
332 | return wmget.call(store$1, it) || {};
|
333 | };
|
334 | has$1 = function (it) {
|
335 | return wmhas.call(store$1, it);
|
336 | };
|
337 | } else {
|
338 | var STATE = sharedKey('state');
|
339 | hiddenKeys[STATE] = true;
|
340 | set = function (it, metadata) {
|
341 | hide(it, STATE, metadata);
|
342 | return metadata;
|
343 | };
|
344 | get = function (it) {
|
345 | return has(it, STATE) ? it[STATE] : {};
|
346 | };
|
347 | has$1 = function (it) {
|
348 | return has(it, STATE);
|
349 | };
|
350 | }
|
351 |
|
352 | var internalState = {
|
353 | set: set,
|
354 | get: get,
|
355 | has: has$1,
|
356 | enforce: enforce,
|
357 | getterFor: getterFor
|
358 | };
|
359 |
|
360 | var redefine = createCommonjsModule(function (module) {
|
361 | var getInternalState = internalState.get;
|
362 | var enforceInternalState = internalState.enforce;
|
363 | var TEMPLATE = String(functionToString).split('toString');
|
364 |
|
365 | shared('inspectSource', function (it) {
|
366 | return functionToString.call(it);
|
367 | });
|
368 |
|
369 | (module.exports = function (O, key, value, options) {
|
370 | var unsafe = options ? !!options.unsafe : false;
|
371 | var simple = options ? !!options.enumerable : false;
|
372 | var noTargetGet = options ? !!options.noTargetGet : false;
|
373 | if (typeof value == 'function') {
|
374 | if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
|
375 | enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
376 | }
|
377 | if (O === global$1) {
|
378 | if (simple) O[key] = value;
|
379 | else setGlobal(key, value);
|
380 | return;
|
381 | } else if (!unsafe) {
|
382 | delete O[key];
|
383 | } else if (!noTargetGet && O[key]) {
|
384 | simple = true;
|
385 | }
|
386 | if (simple) O[key] = value;
|
387 | else hide(O, key, value);
|
388 |
|
389 | })(Function.prototype, 'toString', function toString() {
|
390 | return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
|
391 | });
|
392 | });
|
393 |
|
394 | var max = Math.max;
|
395 | var min$1 = Math.min;
|
396 |
|
397 |
|
398 |
|
399 |
|
400 | var toAbsoluteIndex = function (index, length) {
|
401 | var integer = toInteger(index);
|
402 | return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
403 | };
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 | var arrayIncludes = function (IS_INCLUDES) {
|
411 | return function ($this, el, fromIndex) {
|
412 | var O = toIndexedObject($this);
|
413 | var length = toLength(O.length);
|
414 | var index = toAbsoluteIndex(fromIndex, length);
|
415 | var value;
|
416 |
|
417 |
|
418 | if (IS_INCLUDES && el != el) while (length > index) {
|
419 | value = O[index++];
|
420 |
|
421 | if (value != value) return true;
|
422 |
|
423 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
424 | if (O[index] === el) return IS_INCLUDES || index || 0;
|
425 | } return !IS_INCLUDES && -1;
|
426 | };
|
427 | };
|
428 |
|
429 | var arrayIndexOf = arrayIncludes(false);
|
430 |
|
431 |
|
432 | var objectKeysInternal = function (object, names) {
|
433 | var O = toIndexedObject(object);
|
434 | var i = 0;
|
435 | var result = [];
|
436 | var key;
|
437 | for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
438 |
|
439 | while (names.length > i) if (has(O, key = names[i++])) {
|
440 | ~arrayIndexOf(result, key) || result.push(key);
|
441 | }
|
442 | return result;
|
443 | };
|
444 |
|
445 |
|
446 | var enumBugKeys = [
|
447 | 'constructor',
|
448 | 'hasOwnProperty',
|
449 | 'isPrototypeOf',
|
450 | 'propertyIsEnumerable',
|
451 | 'toLocaleString',
|
452 | 'toString',
|
453 | 'valueOf'
|
454 | ];
|
455 |
|
456 |
|
457 |
|
458 | var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
459 |
|
460 | var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
461 | return objectKeysInternal(O, hiddenKeys$1);
|
462 | };
|
463 |
|
464 | var objectGetOwnPropertyNames = {
|
465 | f: f$3
|
466 | };
|
467 |
|
468 | var f$4 = Object.getOwnPropertySymbols;
|
469 |
|
470 | var objectGetOwnPropertySymbols = {
|
471 | f: f$4
|
472 | };
|
473 |
|
474 | var Reflect$1 = global$1.Reflect;
|
475 |
|
476 |
|
477 | var ownKeys = Reflect$1 && Reflect$1.ownKeys || function ownKeys(it) {
|
478 | var keys = objectGetOwnPropertyNames.f(anObject(it));
|
479 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
480 | return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
481 | };
|
482 |
|
483 | var copyConstructorProperties = function (target, source) {
|
484 | var keys = ownKeys(source);
|
485 | var defineProperty = objectDefineProperty.f;
|
486 | var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
487 | for (var i = 0; i < keys.length; i++) {
|
488 | var key = keys[i];
|
489 | if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
490 | }
|
491 | };
|
492 |
|
493 | var replacement = /#|\.prototype\./;
|
494 |
|
495 | var isForced = function (feature, detection) {
|
496 | var value = data[normalize(feature)];
|
497 | return value == POLYFILL ? true
|
498 | : value == NATIVE ? false
|
499 | : typeof detection == 'function' ? fails(detection)
|
500 | : !!detection;
|
501 | };
|
502 |
|
503 | var normalize = isForced.normalize = function (string) {
|
504 | return String(string).replace(replacement, '.').toLowerCase();
|
505 | };
|
506 |
|
507 | var data = isForced.data = {};
|
508 | var NATIVE = isForced.NATIVE = 'N';
|
509 | var POLYFILL = isForced.POLYFILL = 'P';
|
510 |
|
511 | var isForced_1 = isForced;
|
512 |
|
513 | var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 | |
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 | var _export = function (options, source) {
|
535 | var TARGET = options.target;
|
536 | var GLOBAL = options.global;
|
537 | var STATIC = options.stat;
|
538 | var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
539 | if (GLOBAL) {
|
540 | target = global$1;
|
541 | } else if (STATIC) {
|
542 | target = global$1[TARGET] || setGlobal(TARGET, {});
|
543 | } else {
|
544 | target = (global$1[TARGET] || {}).prototype;
|
545 | }
|
546 | if (target) for (key in source) {
|
547 | sourceProperty = source[key];
|
548 | if (options.noTargetGet) {
|
549 | descriptor = getOwnPropertyDescriptor(target, key);
|
550 | targetProperty = descriptor && descriptor.value;
|
551 | } else targetProperty = target[key];
|
552 | FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
553 |
|
554 | if (!FORCED && targetProperty !== undefined) {
|
555 | if (typeof sourceProperty === typeof targetProperty) continue;
|
556 | copyConstructorProperties(sourceProperty, targetProperty);
|
557 | }
|
558 |
|
559 | if (options.sham || (targetProperty && targetProperty.sham)) {
|
560 | hide(sourceProperty, 'sham', true);
|
561 | }
|
562 |
|
563 | redefine(target, key, sourceProperty, options);
|
564 | }
|
565 | };
|
566 |
|
567 | var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
568 | var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
569 | var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
570 |
|
571 | var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
|
572 | var array = [];
|
573 | array[IS_CONCAT_SPREADABLE] = false;
|
574 | return array.concat()[0] !== array;
|
575 | });
|
576 |
|
577 | var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
578 |
|
579 | var isConcatSpreadable = function (O) {
|
580 | if (!isObject(O)) return false;
|
581 | var spreadable = O[IS_CONCAT_SPREADABLE];
|
582 | return spreadable !== undefined ? !!spreadable : isArray(O);
|
583 | };
|
584 |
|
585 | var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
586 |
|
587 |
|
588 |
|
589 |
|
590 | _export({ target: 'Array', proto: true, forced: FORCED }, {
|
591 | concat: function concat(arg) {
|
592 | var O = toObject(this);
|
593 | var A = arraySpeciesCreate(O, 0);
|
594 | var n = 0;
|
595 | var i, k, length, len, E;
|
596 | for (i = -1, length = arguments.length; i < length; i++) {
|
597 | E = i === -1 ? O : arguments[i];
|
598 | if (isConcatSpreadable(E)) {
|
599 | len = toLength(E.length);
|
600 | if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
601 | for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
602 | } else {
|
603 | if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
604 | createProperty(A, n++, E);
|
605 | }
|
606 | }
|
607 | A.length = n;
|
608 | return A;
|
609 | }
|
610 | });
|
611 |
|
612 | var aFunction = function (it) {
|
613 | if (typeof it != 'function') {
|
614 | throw TypeError(String(it) + ' is not a function');
|
615 | } return it;
|
616 | };
|
617 |
|
618 |
|
619 | var bindContext = function (fn, that, length) {
|
620 | aFunction(fn);
|
621 | if (that === undefined) return fn;
|
622 | switch (length) {
|
623 | case 0: return function () {
|
624 | return fn.call(that);
|
625 | };
|
626 | case 1: return function (a) {
|
627 | return fn.call(that, a);
|
628 | };
|
629 | case 2: return function (a, b) {
|
630 | return fn.call(that, a, b);
|
631 | };
|
632 | case 3: return function (a, b, c) {
|
633 | return fn.call(that, a, b, c);
|
634 | };
|
635 | }
|
636 | return function (/* ...args */) {
|
637 | return fn.apply(that, arguments);
|
638 | };
|
639 | };
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | var arrayMethods = function (TYPE, specificCreate) {
|
657 | var IS_MAP = TYPE == 1;
|
658 | var IS_FILTER = TYPE == 2;
|
659 | var IS_SOME = TYPE == 3;
|
660 | var IS_EVERY = TYPE == 4;
|
661 | var IS_FIND_INDEX = TYPE == 6;
|
662 | var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
|
663 | var create = specificCreate || arraySpeciesCreate;
|
664 | return function ($this, callbackfn, that) {
|
665 | var O = toObject($this);
|
666 | var self = indexedObject(O);
|
667 | var boundFunction = bindContext(callbackfn, that, 3);
|
668 | var length = toLength(self.length);
|
669 | var index = 0;
|
670 | var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
|
671 | var value, result;
|
672 | for (;length > index; index++) if (NO_HOLES || index in self) {
|
673 | value = self[index];
|
674 | result = boundFunction(value, index, O);
|
675 | if (TYPE) {
|
676 | if (IS_MAP) target[index] = result;
|
677 | else if (result) switch (TYPE) {
|
678 | case 3: return true;
|
679 | case 5: return value;
|
680 | case 6: return index;
|
681 | case 2: target.push(value);
|
682 | } else if (IS_EVERY) return false;
|
683 | }
|
684 | }
|
685 | return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
|
686 | };
|
687 | };
|
688 |
|
689 | var internalFilter = arrayMethods(2);
|
690 |
|
691 | var SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('filter');
|
692 |
|
693 |
|
694 |
|
695 |
|
696 | _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$1 }, {
|
697 | filter: function filter(callbackfn /* , thisArg */) {
|
698 | return internalFilter(this, callbackfn, arguments[1]);
|
699 | }
|
700 | });
|
701 |
|
702 | var internalMap = arrayMethods(1);
|
703 |
|
704 | var SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
|
705 |
|
706 |
|
707 |
|
708 |
|
709 | _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$2 }, {
|
710 | map: function map(callbackfn /* , thisArg */) {
|
711 | return internalMap(this, callbackfn, arguments[1]);
|
712 | }
|
713 | });
|
714 |
|
715 | var max$1 = Math.max;
|
716 | var min$2 = Math.min;
|
717 | var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
|
718 | var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
|
719 |
|
720 | var SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('splice');
|
721 |
|
722 |
|
723 |
|
724 |
|
725 | _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$3 }, {
|
726 | splice: function splice(start, deleteCount /* , ...items */) {
|
727 | var O = toObject(this);
|
728 | var len = toLength(O.length);
|
729 | var actualStart = toAbsoluteIndex(start, len);
|
730 | var argumentsLength = arguments.length;
|
731 | var insertCount, actualDeleteCount, A, k, from, to;
|
732 | if (argumentsLength === 0) {
|
733 | insertCount = actualDeleteCount = 0;
|
734 | } else if (argumentsLength === 1) {
|
735 | insertCount = 0;
|
736 | actualDeleteCount = len - actualStart;
|
737 | } else {
|
738 | insertCount = argumentsLength - 2;
|
739 | actualDeleteCount = min$2(max$1(toInteger(deleteCount), 0), len - actualStart);
|
740 | }
|
741 | if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER$1) {
|
742 | throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
|
743 | }
|
744 | A = arraySpeciesCreate(O, actualDeleteCount);
|
745 | for (k = 0; k < actualDeleteCount; k++) {
|
746 | from = actualStart + k;
|
747 | if (from in O) createProperty(A, k, O[from]);
|
748 | }
|
749 | A.length = actualDeleteCount;
|
750 | if (insertCount < actualDeleteCount) {
|
751 | for (k = actualStart; k < len - actualDeleteCount; k++) {
|
752 | from = k + actualDeleteCount;
|
753 | to = k + insertCount;
|
754 | if (from in O) O[to] = O[from];
|
755 | else delete O[to];
|
756 | }
|
757 | for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
|
758 | } else if (insertCount > actualDeleteCount) {
|
759 | for (k = len - actualDeleteCount; k > actualStart; k--) {
|
760 | from = k + actualDeleteCount - 1;
|
761 | to = k + insertCount - 1;
|
762 | if (from in O) O[to] = O[from];
|
763 | else delete O[to];
|
764 | }
|
765 | }
|
766 | for (k = 0; k < insertCount; k++) {
|
767 | O[k + actualStart] = arguments[k + 2];
|
768 | }
|
769 | O.length = len - actualDeleteCount + insertCount;
|
770 | return A;
|
771 | }
|
772 | });
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 | var objectKeys = Object.keys || function keys(O) {
|
779 | return objectKeysInternal(O, enumBugKeys);
|
780 | };
|
781 |
|
782 | var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
783 |
|
784 |
|
785 |
|
786 | _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
787 | keys: function keys(it) {
|
788 | return objectKeys(toObject(it));
|
789 | }
|
790 | });
|
791 |
|
792 |
|
793 |
|
794 | var domIterables = {
|
795 | CSSRuleList: 0,
|
796 | CSSStyleDeclaration: 0,
|
797 | CSSValueList: 0,
|
798 | ClientRectList: 0,
|
799 | DOMRectList: 0,
|
800 | DOMStringList: 0,
|
801 | DOMTokenList: 1,
|
802 | DataTransferItemList: 0,
|
803 | FileList: 0,
|
804 | HTMLAllCollection: 0,
|
805 | HTMLCollection: 0,
|
806 | HTMLFormElement: 0,
|
807 | HTMLSelectElement: 0,
|
808 | MediaList: 0,
|
809 | MimeTypeArray: 0,
|
810 | NamedNodeMap: 0,
|
811 | NodeList: 1,
|
812 | PaintRequestList: 0,
|
813 | Plugin: 0,
|
814 | PluginArray: 0,
|
815 | SVGLengthList: 0,
|
816 | SVGNumberList: 0,
|
817 | SVGPathSegList: 0,
|
818 | SVGPointList: 0,
|
819 | SVGStringList: 0,
|
820 | SVGTransformList: 0,
|
821 | SourceBufferList: 0,
|
822 | StyleSheetList: 0,
|
823 | TextTrackCueList: 0,
|
824 | TextTrackList: 0,
|
825 | TouchList: 0
|
826 | };
|
827 |
|
828 | var sloppyArrayMethod = function (METHOD_NAME, argument) {
|
829 | var method = [][METHOD_NAME];
|
830 | return !method || !fails(function () {
|
831 |
|
832 | method.call(null, argument || function () { throw 1; }, 1);
|
833 | });
|
834 | };
|
835 |
|
836 | var nativeForEach = [].forEach;
|
837 | var internalForEach = arrayMethods(0);
|
838 |
|
839 | var SLOPPY_METHOD = sloppyArrayMethod('forEach');
|
840 |
|
841 |
|
842 |
|
843 | var arrayForEach = SLOPPY_METHOD ? function forEach(callbackfn /* , thisArg */) {
|
844 | return internalForEach(this, callbackfn, arguments[1]);
|
845 | } : nativeForEach;
|
846 |
|
847 | for (var COLLECTION_NAME in domIterables) {
|
848 | var Collection = global$1[COLLECTION_NAME];
|
849 | var CollectionPrototype = Collection && Collection.prototype;
|
850 |
|
851 | if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
|
852 | hide(CollectionPrototype, 'forEach', arrayForEach);
|
853 | } catch (error) {
|
854 | CollectionPrototype.forEach = arrayForEach;
|
855 | }
|
856 | }
|
857 |
|
858 | function _typeof(obj) {
|
859 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
860 | _typeof = function (obj) {
|
861 | return typeof obj;
|
862 | };
|
863 | } else {
|
864 | _typeof = function (obj) {
|
865 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
866 | };
|
867 | }
|
868 |
|
869 | return _typeof(obj);
|
870 | }
|
871 |
|
872 | function _classCallCheck(instance, Constructor) {
|
873 | if (!(instance instanceof Constructor)) {
|
874 | throw new TypeError("Cannot call a class as a function");
|
875 | }
|
876 | }
|
877 |
|
878 | function _defineProperties(target, props) {
|
879 | for (var i = 0; i < props.length; i++) {
|
880 | var descriptor = props[i];
|
881 | descriptor.enumerable = descriptor.enumerable || false;
|
882 | descriptor.configurable = true;
|
883 | if ("value" in descriptor) descriptor.writable = true;
|
884 | Object.defineProperty(target, descriptor.key, descriptor);
|
885 | }
|
886 | }
|
887 |
|
888 | function _createClass(Constructor, protoProps, staticProps) {
|
889 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
890 | if (staticProps) _defineProperties(Constructor, staticProps);
|
891 | return Constructor;
|
892 | }
|
893 |
|
894 | function _defineProperty(obj, key, value) {
|
895 | if (key in obj) {
|
896 | Object.defineProperty(obj, key, {
|
897 | value: value,
|
898 | enumerable: true,
|
899 | configurable: true,
|
900 | writable: true
|
901 | });
|
902 | } else {
|
903 | obj[key] = value;
|
904 | }
|
905 |
|
906 | return obj;
|
907 | }
|
908 |
|
909 | function _objectSpread(target) {
|
910 | for (var i = 1; i < arguments.length; i++) {
|
911 | var source = arguments[i] != null ? arguments[i] : {};
|
912 | var ownKeys = Object.keys(source);
|
913 |
|
914 | if (typeof Object.getOwnPropertySymbols === 'function') {
|
915 | ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
916 | return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
917 | }));
|
918 | }
|
919 |
|
920 | ownKeys.forEach(function (key) {
|
921 | _defineProperty(target, key, source[key]);
|
922 | });
|
923 | }
|
924 |
|
925 | return target;
|
926 | }
|
927 |
|
928 | function _inherits(subClass, superClass) {
|
929 | if (typeof superClass !== "function" && superClass !== null) {
|
930 | throw new TypeError("Super expression must either be null or a function");
|
931 | }
|
932 |
|
933 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
934 | constructor: {
|
935 | value: subClass,
|
936 | writable: true,
|
937 | configurable: true
|
938 | }
|
939 | });
|
940 | if (superClass) _setPrototypeOf(subClass, superClass);
|
941 | }
|
942 |
|
943 | function _getPrototypeOf(o) {
|
944 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
945 | return o.__proto__ || Object.getPrototypeOf(o);
|
946 | };
|
947 | return _getPrototypeOf(o);
|
948 | }
|
949 |
|
950 | function _setPrototypeOf(o, p) {
|
951 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
952 | o.__proto__ = p;
|
953 | return o;
|
954 | };
|
955 |
|
956 | return _setPrototypeOf(o, p);
|
957 | }
|
958 |
|
959 | function _assertThisInitialized(self) {
|
960 | if (self === void 0) {
|
961 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
962 | }
|
963 |
|
964 | return self;
|
965 | }
|
966 |
|
967 | function _possibleConstructorReturn(self, call) {
|
968 | if (call && (typeof call === "object" || typeof call === "function")) {
|
969 | return call;
|
970 | }
|
971 |
|
972 | return _assertThisInitialized(self);
|
973 | }
|
974 |
|
975 | function _superPropBase(object, property) {
|
976 | while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
977 | object = _getPrototypeOf(object);
|
978 | if (object === null) break;
|
979 | }
|
980 |
|
981 | return object;
|
982 | }
|
983 |
|
984 | function _get(target, property, receiver) {
|
985 | if (typeof Reflect !== "undefined" && Reflect.get) {
|
986 | _get = Reflect.get;
|
987 | } else {
|
988 | _get = function _get(target, property, receiver) {
|
989 | var base = _superPropBase(target, property);
|
990 |
|
991 | if (!base) return;
|
992 | var desc = Object.getOwnPropertyDescriptor(base, property);
|
993 |
|
994 | if (desc.get) {
|
995 | return desc.get.call(receiver);
|
996 | }
|
997 |
|
998 | return desc.value;
|
999 | };
|
1000 | }
|
1001 |
|
1002 | return _get(target, property, receiver || target);
|
1003 | }
|
1004 |
|
1005 | function _toConsumableArray(arr) {
|
1006 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
1007 | }
|
1008 |
|
1009 | function _arrayWithoutHoles(arr) {
|
1010 | if (Array.isArray(arr)) {
|
1011 | for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
1012 |
|
1013 | return arr2;
|
1014 | }
|
1015 | }
|
1016 |
|
1017 | function _iterableToArray(iter) {
|
1018 | if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
1019 | }
|
1020 |
|
1021 | function _nonIterableSpread() {
|
1022 | throw new TypeError("Invalid attempt to spread non-iterable instance");
|
1023 | }
|
1024 |
|
1025 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
1026 |
|
1027 | var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
1028 |
|
1029 |
|
1030 | var tryGet = function (it, key) {
|
1031 | try {
|
1032 | return it[key];
|
1033 | } catch (error) { }
|
1034 | };
|
1035 |
|
1036 |
|
1037 | var classof = function (it) {
|
1038 | var O, tag, result;
|
1039 | return it === undefined ? 'Undefined' : it === null ? 'Null'
|
1040 |
|
1041 | : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
|
1042 |
|
1043 | : CORRECT_ARGUMENTS ? classofRaw(O)
|
1044 |
|
1045 | : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
|
1046 | };
|
1047 |
|
1048 | var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
1049 | var test = {};
|
1050 |
|
1051 | test[TO_STRING_TAG$1] = 'z';
|
1052 |
|
1053 |
|
1054 |
|
1055 | var objectToString = String(test) !== '[object z]' ? function toString() {
|
1056 | return '[object ' + classof(this) + ']';
|
1057 | } : test.toString;
|
1058 |
|
1059 | var ObjectPrototype = Object.prototype;
|
1060 |
|
1061 |
|
1062 |
|
1063 | if (objectToString !== ObjectPrototype.toString) {
|
1064 | redefine(ObjectPrototype, 'toString', objectToString, { unsafe: true });
|
1065 | }
|
1066 |
|
1067 | var validateSetPrototypeOfArguments = function (O, proto) {
|
1068 | anObject(O);
|
1069 | if (!isObject(proto) && proto !== null) {
|
1070 | throw TypeError("Can't set " + String(proto) + ' as a prototype');
|
1071 | }
|
1072 | };
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 | var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
1079 | var correctSetter = false;
|
1080 | var test = {};
|
1081 | var setter;
|
1082 | try {
|
1083 | setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
1084 | setter.call(test, []);
|
1085 | correctSetter = test instanceof Array;
|
1086 | } catch (error) { }
|
1087 | return function setPrototypeOf(O, proto) {
|
1088 | validateSetPrototypeOfArguments(O, proto);
|
1089 | if (correctSetter) setter.call(O, proto);
|
1090 | else O.__proto__ = proto;
|
1091 | return O;
|
1092 | };
|
1093 | }() : undefined);
|
1094 |
|
1095 | var inheritIfRequired = function (that, target, C) {
|
1096 | var S = target.constructor;
|
1097 | var P;
|
1098 | if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && objectSetPrototypeOf) {
|
1099 | objectSetPrototypeOf(that, P);
|
1100 | } return that;
|
1101 | };
|
1102 |
|
1103 | var MATCH = wellKnownSymbol('match');
|
1104 |
|
1105 |
|
1106 |
|
1107 | var isRegexp = function (it) {
|
1108 | var isRegExp;
|
1109 | return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
1110 | };
|
1111 |
|
1112 |
|
1113 |
|
1114 | var regexpFlags = function () {
|
1115 | var that = anObject(this);
|
1116 | var result = '';
|
1117 | if (that.global) result += 'g';
|
1118 | if (that.ignoreCase) result += 'i';
|
1119 | if (that.multiline) result += 'm';
|
1120 | if (that.unicode) result += 'u';
|
1121 | if (that.sticky) result += 'y';
|
1122 | return result;
|
1123 | };
|
1124 |
|
1125 | var path = global$1;
|
1126 |
|
1127 | var aFunction$1 = function (variable) {
|
1128 | return typeof variable == 'function' ? variable : undefined;
|
1129 | };
|
1130 |
|
1131 | var getBuiltIn = function (namespace, method) {
|
1132 | return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global$1[namespace])
|
1133 | : path[namespace] && path[namespace][method] || global$1[namespace] && global$1[namespace][method];
|
1134 | };
|
1135 |
|
1136 | var SPECIES$2 = wellKnownSymbol('species');
|
1137 |
|
1138 | var setSpecies = function (CONSTRUCTOR_NAME) {
|
1139 | var C = getBuiltIn(CONSTRUCTOR_NAME);
|
1140 | var defineProperty = objectDefineProperty.f;
|
1141 | if (descriptors && C && !C[SPECIES$2]) defineProperty(C, SPECIES$2, {
|
1142 | configurable: true,
|
1143 | get: function () { return this; }
|
1144 | });
|
1145 | };
|
1146 |
|
1147 | var MATCH$1 = wellKnownSymbol('match');
|
1148 |
|
1149 |
|
1150 |
|
1151 | var defineProperty = objectDefineProperty.f;
|
1152 | var getOwnPropertyNames = objectGetOwnPropertyNames.f;
|
1153 |
|
1154 |
|
1155 |
|
1156 |
|
1157 | var NativeRegExp = global$1.RegExp;
|
1158 | var RegExpPrototype = NativeRegExp.prototype;
|
1159 | var re1 = /a/g;
|
1160 | var re2 = /a/g;
|
1161 |
|
1162 |
|
1163 | var CORRECT_NEW = new NativeRegExp(re1) !== re1;
|
1164 |
|
1165 | var FORCED$1 = isForced_1('RegExp', descriptors && (!CORRECT_NEW || fails(function () {
|
1166 | re2[MATCH$1] = false;
|
1167 |
|
1168 | return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
|
1169 | })));
|
1170 |
|
1171 |
|
1172 |
|
1173 | if (FORCED$1) {
|
1174 | var RegExpWrapper = function RegExp(pattern, flags) {
|
1175 | var thisIsRegExp = this instanceof RegExpWrapper;
|
1176 | var patternIsRegExp = isRegexp(pattern);
|
1177 | var flagsAreUndefined = flags === undefined;
|
1178 | return !thisIsRegExp && patternIsRegExp && pattern.constructor === RegExpWrapper && flagsAreUndefined ? pattern
|
1179 | : inheritIfRequired(CORRECT_NEW
|
1180 | ? new NativeRegExp(patternIsRegExp && !flagsAreUndefined ? pattern.source : pattern, flags)
|
1181 | : NativeRegExp((patternIsRegExp = pattern instanceof RegExpWrapper)
|
1182 | ? pattern.source
|
1183 | : pattern, patternIsRegExp && flagsAreUndefined ? regexpFlags.call(pattern) : flags)
|
1184 | , thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
|
1185 | };
|
1186 | var proxy = function (key) {
|
1187 | key in RegExpWrapper || defineProperty(RegExpWrapper, key, {
|
1188 | configurable: true,
|
1189 | get: function () { return NativeRegExp[key]; },
|
1190 | set: function (it) { NativeRegExp[key] = it; }
|
1191 | });
|
1192 | };
|
1193 | var keys = getOwnPropertyNames(NativeRegExp);
|
1194 | var i = 0;
|
1195 | while (i < keys.length) proxy(keys[i++]);
|
1196 | RegExpPrototype.constructor = RegExpWrapper;
|
1197 | RegExpWrapper.prototype = RegExpPrototype;
|
1198 | redefine(global$1, 'RegExp', RegExpWrapper);
|
1199 | }
|
1200 |
|
1201 |
|
1202 | setSpecies('RegExp');
|
1203 |
|
1204 | var TO_STRING = 'toString';
|
1205 | var nativeToString = /./[TO_STRING];
|
1206 |
|
1207 | var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
|
1208 |
|
1209 | var INCORRECT_NAME = nativeToString.name != TO_STRING;
|
1210 |
|
1211 |
|
1212 |
|
1213 | if (NOT_GENERIC || INCORRECT_NAME) {
|
1214 | redefine(RegExp.prototype, TO_STRING, function toString() {
|
1215 | var R = anObject(this);
|
1216 | return '/'.concat(R.source, '/',
|
1217 | 'flags' in R ? R.flags : !descriptors && R instanceof RegExp ? regexpFlags.call(R) : undefined);
|
1218 | }, { unsafe: true });
|
1219 | }
|
1220 |
|
1221 |
|
1222 |
|
1223 | var stringAt = function (that, pos, CONVERT_TO_STRING) {
|
1224 | var S = String(requireObjectCoercible(that));
|
1225 | var position = toInteger(pos);
|
1226 | var size = S.length;
|
1227 | var first, second;
|
1228 | if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
|
1229 | first = S.charCodeAt(position);
|
1230 | return first < 0xD800 || first > 0xDBFF || position + 1 === size
|
1231 | || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
|
1232 | ? CONVERT_TO_STRING ? S.charAt(position) : first
|
1233 | : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
|
1234 | };
|
1235 |
|
1236 |
|
1237 |
|
1238 | var advanceStringIndex = function (S, index, unicode) {
|
1239 | return index + (unicode ? stringAt(S, index, true).length : 1);
|
1240 | };
|
1241 |
|
1242 | var nativeExec = RegExp.prototype.exec;
|
1243 |
|
1244 |
|
1245 |
|
1246 | var nativeReplace = String.prototype.replace;
|
1247 |
|
1248 | var patchedExec = nativeExec;
|
1249 |
|
1250 | var UPDATES_LAST_INDEX_WRONG = (function () {
|
1251 | var re1 = /a/;
|
1252 | var re2 = /b*/g;
|
1253 | nativeExec.call(re1, 'a');
|
1254 | nativeExec.call(re2, 'a');
|
1255 | return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
1256 | })();
|
1257 |
|
1258 |
|
1259 | var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
1260 |
|
1261 | var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
|
1262 |
|
1263 | if (PATCH) {
|
1264 | patchedExec = function exec(str) {
|
1265 | var re = this;
|
1266 | var lastIndex, reCopy, match, i;
|
1267 |
|
1268 | if (NPCG_INCLUDED) {
|
1269 | reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
|
1270 | }
|
1271 | if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
|
1272 |
|
1273 | match = nativeExec.call(re, str);
|
1274 |
|
1275 | if (UPDATES_LAST_INDEX_WRONG && match) {
|
1276 | re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
|
1277 | }
|
1278 | if (NPCG_INCLUDED && match && match.length > 1) {
|
1279 |
|
1280 |
|
1281 | nativeReplace.call(match[0], reCopy, function () {
|
1282 | for (i = 1; i < arguments.length - 2; i++) {
|
1283 | if (arguments[i] === undefined) match[i] = undefined;
|
1284 | }
|
1285 | });
|
1286 | }
|
1287 |
|
1288 | return match;
|
1289 | };
|
1290 | }
|
1291 |
|
1292 | var regexpExec = patchedExec;
|
1293 |
|
1294 |
|
1295 |
|
1296 | var regexpExecAbstract = function (R, S) {
|
1297 | var exec = R.exec;
|
1298 | if (typeof exec === 'function') {
|
1299 | var result = exec.call(R, S);
|
1300 | if (typeof result !== 'object') {
|
1301 | throw TypeError('RegExp exec method returned something other than an Object or null');
|
1302 | }
|
1303 | return result;
|
1304 | }
|
1305 |
|
1306 | if (classofRaw(R) !== 'RegExp') {
|
1307 | throw TypeError('RegExp#exec called on incompatible receiver');
|
1308 | }
|
1309 |
|
1310 | return regexpExec.call(R, S);
|
1311 | };
|
1312 |
|
1313 | var SPECIES$3 = wellKnownSymbol('species');
|
1314 |
|
1315 | var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
|
1316 |
|
1317 |
|
1318 |
|
1319 | var re = /./;
|
1320 | re.exec = function () {
|
1321 | var result = [];
|
1322 | result.groups = { a: '7' };
|
1323 | return result;
|
1324 | };
|
1325 | return ''.replace(re, '$<a>') !== '7';
|
1326 | });
|
1327 |
|
1328 |
|
1329 |
|
1330 | var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
1331 | var re = /(?:)/;
|
1332 | var originalExec = re.exec;
|
1333 | re.exec = function () { return originalExec.apply(this, arguments); };
|
1334 | var result = 'ab'.split(re);
|
1335 | return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
1336 | });
|
1337 |
|
1338 | var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
|
1339 | var SYMBOL = wellKnownSymbol(KEY);
|
1340 |
|
1341 | var DELEGATES_TO_SYMBOL = !fails(function () {
|
1342 |
|
1343 | var O = {};
|
1344 | O[SYMBOL] = function () { return 7; };
|
1345 | return ''[KEY](O) != 7;
|
1346 | });
|
1347 |
|
1348 | var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
|
1349 |
|
1350 | var execCalled = false;
|
1351 | var re = /a/;
|
1352 | re.exec = function () { execCalled = true; return null; };
|
1353 |
|
1354 | if (KEY === 'split') {
|
1355 |
|
1356 |
|
1357 | re.constructor = {};
|
1358 | re.constructor[SPECIES$3] = function () { return re; };
|
1359 | }
|
1360 |
|
1361 | re[SYMBOL]('');
|
1362 | return !execCalled;
|
1363 | });
|
1364 |
|
1365 | if (
|
1366 | !DELEGATES_TO_SYMBOL ||
|
1367 | !DELEGATES_TO_EXEC ||
|
1368 | (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
|
1369 | (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
|
1370 | ) {
|
1371 | var nativeRegExpMethod = /./[SYMBOL];
|
1372 | var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
1373 | if (regexp.exec === regexpExec) {
|
1374 | if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
|
1375 |
|
1376 |
|
1377 |
|
1378 | return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
|
1379 | }
|
1380 | return { done: true, value: nativeMethod.call(str, regexp, arg2) };
|
1381 | }
|
1382 | return { done: false };
|
1383 | });
|
1384 | var stringMethod = methods[0];
|
1385 | var regexMethod = methods[1];
|
1386 |
|
1387 | redefine(String.prototype, KEY, stringMethod);
|
1388 | redefine(RegExp.prototype, SYMBOL, length == 2
|
1389 |
|
1390 |
|
1391 | ? function (string, arg) { return regexMethod.call(string, this, arg); }
|
1392 |
|
1393 |
|
1394 | : function (string) { return regexMethod.call(string, this); }
|
1395 | );
|
1396 | if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
|
1397 | }
|
1398 | };
|
1399 |
|
1400 | var max$2 = Math.max;
|
1401 | var min$3 = Math.min;
|
1402 | var floor$1 = Math.floor;
|
1403 | var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g;
|
1404 | var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g;
|
1405 |
|
1406 | var maybeToString = function (it) {
|
1407 | return it === undefined ? it : String(it);
|
1408 | };
|
1409 |
|
1410 |
|
1411 | fixRegexpWellKnownSymbolLogic(
|
1412 | 'replace',
|
1413 | 2,
|
1414 | function (REPLACE, nativeReplace, maybeCallNative) {
|
1415 | return [
|
1416 |
|
1417 |
|
1418 | function replace(searchValue, replaceValue) {
|
1419 | var O = requireObjectCoercible(this);
|
1420 | var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
|
1421 | return replacer !== undefined
|
1422 | ? replacer.call(searchValue, O, replaceValue)
|
1423 | : nativeReplace.call(String(O), searchValue, replaceValue);
|
1424 | },
|
1425 |
|
1426 |
|
1427 | function (regexp, replaceValue) {
|
1428 | var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
|
1429 | if (res.done) return res.value;
|
1430 |
|
1431 | var rx = anObject(regexp);
|
1432 | var S = String(this);
|
1433 |
|
1434 | var functionalReplace = typeof replaceValue === 'function';
|
1435 | if (!functionalReplace) replaceValue = String(replaceValue);
|
1436 |
|
1437 | var global = rx.global;
|
1438 | if (global) {
|
1439 | var fullUnicode = rx.unicode;
|
1440 | rx.lastIndex = 0;
|
1441 | }
|
1442 | var results = [];
|
1443 | while (true) {
|
1444 | var result = regexpExecAbstract(rx, S);
|
1445 | if (result === null) break;
|
1446 |
|
1447 | results.push(result);
|
1448 | if (!global) break;
|
1449 |
|
1450 | var matchStr = String(result[0]);
|
1451 | if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
|
1452 | }
|
1453 |
|
1454 | var accumulatedResult = '';
|
1455 | var nextSourcePosition = 0;
|
1456 | for (var i = 0; i < results.length; i++) {
|
1457 | result = results[i];
|
1458 |
|
1459 | var matched = String(result[0]);
|
1460 | var position = max$2(min$3(toInteger(result.index), S.length), 0);
|
1461 | var captures = [];
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 | for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
|
1468 | var namedCaptures = result.groups;
|
1469 | if (functionalReplace) {
|
1470 | var replacerArgs = [matched].concat(captures, position, S);
|
1471 | if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
|
1472 | var replacement = String(replaceValue.apply(undefined, replacerArgs));
|
1473 | } else {
|
1474 | replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
|
1475 | }
|
1476 | if (position >= nextSourcePosition) {
|
1477 | accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
|
1478 | nextSourcePosition = position + matched.length;
|
1479 | }
|
1480 | }
|
1481 | return accumulatedResult + S.slice(nextSourcePosition);
|
1482 | }
|
1483 | ];
|
1484 |
|
1485 |
|
1486 | function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
|
1487 | var tailPos = position + matched.length;
|
1488 | var m = captures.length;
|
1489 | var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
|
1490 | if (namedCaptures !== undefined) {
|
1491 | namedCaptures = toObject(namedCaptures);
|
1492 | symbols = SUBSTITUTION_SYMBOLS;
|
1493 | }
|
1494 | return nativeReplace.call(replacement, symbols, function (match, ch) {
|
1495 | var capture;
|
1496 | switch (ch.charAt(0)) {
|
1497 | case '$': return '$';
|
1498 | case '&': return matched;
|
1499 | case '`': return str.slice(0, position);
|
1500 | case "'": return str.slice(tailPos);
|
1501 | case '<':
|
1502 | capture = namedCaptures[ch.slice(1, -1)];
|
1503 | break;
|
1504 | default:
|
1505 | var n = +ch;
|
1506 | if (n === 0) return match;
|
1507 | if (n > m) {
|
1508 | var f = floor$1(n / 10);
|
1509 | if (f === 0) return match;
|
1510 | if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
|
1511 | return match;
|
1512 | }
|
1513 | capture = captures[n - 1];
|
1514 | }
|
1515 | return capture === undefined ? '' : capture;
|
1516 | });
|
1517 | }
|
1518 | }
|
1519 | );
|
1520 |
|
1521 | var navigator = global$1.navigator;
|
1522 |
|
1523 | var userAgent = navigator && navigator.userAgent || '';
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 | var slice = [].slice;
|
1529 |
|
1530 | var MSIE = /MSIE .\./.test(userAgent);
|
1531 |
|
1532 | var wrap = function (set) {
|
1533 | return function (fn, time /* , ...args */) {
|
1534 | var boundArgs = arguments.length > 2;
|
1535 | var args = boundArgs ? slice.call(arguments, 2) : false;
|
1536 | return set(boundArgs ? function () {
|
1537 |
|
1538 | (typeof fn == 'function' ? fn : Function(fn)).apply(this, args);
|
1539 | } : fn, time);
|
1540 | };
|
1541 | };
|
1542 |
|
1543 | _export({ global: true, bind: true, forced: MSIE }, {
|
1544 | setTimeout: wrap(global$1.setTimeout),
|
1545 | setInterval: wrap(global$1.setInterval)
|
1546 | });
|
1547 |
|
1548 | function $nt(fn) {
|
1549 | Vue$1.nextTick(fn);
|
1550 | }
|
1551 | function $set(target, field, value) {
|
1552 | Vue$1.set(target, field, value);
|
1553 | }
|
1554 | function $del(target, field) {
|
1555 | Vue$1.delete(target, field);
|
1556 | }
|
1557 | function isValidChildren(children) {
|
1558 | return Array.isArray(children) && children.length > 0;
|
1559 | }
|
1560 | var _toString = Object.prototype.toString;
|
1561 | function isUndef(v) {
|
1562 | return v === undefined || v === null;
|
1563 | }
|
1564 | function toString$1(val) {
|
1565 | return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
|
1566 | }
|
1567 | function extend(to, _from) {
|
1568 | for (var key in _from) {
|
1569 | $set(to, key, _from[key]);
|
1570 | }
|
1571 |
|
1572 | return to;
|
1573 | }
|
1574 | function debounce(fn, wait) {
|
1575 | var timeout = null;
|
1576 | return function () {
|
1577 | for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
|
1578 | arg[_key] = arguments[_key];
|
1579 | }
|
1580 |
|
1581 | if (timeout !== null) clearTimeout(timeout);
|
1582 | timeout = setTimeout(function () {
|
1583 | return fn.apply(void 0, arg);
|
1584 | }, wait);
|
1585 | };
|
1586 | }
|
1587 | function isDate(arg) {
|
1588 | return _toString.call(arg) === '[object Date]';
|
1589 | }
|
1590 | function isPlainObject(arg) {
|
1591 | return _toString.call(arg) === '[object Object]';
|
1592 | }
|
1593 | function isFunction(arg) {
|
1594 | return _toString.call(arg) === '[object Function]';
|
1595 | }
|
1596 | function isString(arg) {
|
1597 | return _toString.call(arg) === '[object String]';
|
1598 | }
|
1599 | function isNumber(arg) {
|
1600 | return _toString.call(arg) === '[object Number]';
|
1601 | }
|
1602 | function isBool(arg) {
|
1603 | return _toString.call(arg) === '[object Boolean]';
|
1604 | }
|
1605 | function toLine(name) {
|
1606 | var line = name.replace(/([A-Z])/g, '-$1').toLowerCase();
|
1607 | if (line.indexOf('-') === 0) line = line.substr(1);
|
1608 | return line;
|
1609 | }
|
1610 | function isNumeric(n) {
|
1611 | return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
|
1612 | }
|
1613 | function toArray(a) {
|
1614 | return Array.isArray(a) ? a : [a];
|
1615 | }
|
1616 | function isElement(arg) {
|
1617 | return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !isPlainObject(arg);
|
1618 | }
|
1619 | function deepExtend(origin) {
|
1620 | var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1621 | var isArr = false;
|
1622 |
|
1623 | for (var key in target) {
|
1624 | if (Object.prototype.hasOwnProperty.call(target, key)) {
|
1625 | var clone = target[key];
|
1626 |
|
1627 | if ((isArr = Array.isArray(clone)) || isPlainObject(clone)) {
|
1628 | var nst = origin[key] === undefined;
|
1629 |
|
1630 | if (isArr) {
|
1631 | isArr = false;
|
1632 | nst && $set(origin, key, []);
|
1633 | } else {
|
1634 | nst && $set(origin, key, {});
|
1635 | }
|
1636 |
|
1637 | deepExtend(origin[key], clone);
|
1638 | } else {
|
1639 | $set(origin, key, clone);
|
1640 | }
|
1641 | }
|
1642 | }
|
1643 |
|
1644 | return origin;
|
1645 | }
|
1646 | var id$2 = 0;
|
1647 | function uniqueId() {
|
1648 | return ++id$2;
|
1649 | }
|
1650 | function toDefSlot(slot, $h, rule) {
|
1651 | return [slot && isFunction(slot) ? slot.call(rule, $h) : slot];
|
1652 | }
|
1653 | function timeStampToDate(timeStamp) {
|
1654 | if (isDate(timeStamp)) return timeStamp;else {
|
1655 | var date = new Date(timeStamp);
|
1656 | return date.toString() === 'Invalid Date' ? timeStamp : date;
|
1657 | }
|
1658 | }
|
1659 | function preventDefault(e) {
|
1660 | e.preventDefault();
|
1661 | }
|
1662 | function dateFormat(fmt) {
|
1663 | var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
|
1664 | var o = {
|
1665 | "M+": date.getMonth() + 1,
|
1666 | "d+": date.getDate(),
|
1667 | "h+": date.getHours(),
|
1668 | "m+": date.getMinutes(),
|
1669 | "s+": date.getSeconds(),
|
1670 | "q+": Math.floor((date.getMonth() + 3) / 3),
|
1671 | "S": date.getMilliseconds()
|
1672 | };
|
1673 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
|
1674 |
|
1675 | for (var k in o) {
|
1676 | if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
|
1677 | }
|
1678 |
|
1679 | return fmt;
|
1680 | }
|
1681 | function errMsg() {
|
1682 | return '\n\x67\x69\x74\x68\x75\x62\x3a\x68\x74\x74\x70' + '\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f' + '\x6d\x2f\x78\x61\x62\x6f\x79\x2f\x66\x6f\x72\x6d\x2d' + '\x63\x72\x65\x61\x74\x65\n\x64\x6f\x63\x75\x6d\x65' + '\x6e\x74\x3a\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77' + '\x2e\x66\x6f\x72\x6d\x2d\x63\x72\x65\x61\x74\x65\x2e' + '\x63\x6f\x6d';
|
1683 | }
|
1684 |
|
1685 | var baseComponent = {
|
1686 | data: function data() {
|
1687 | return {
|
1688 | rules: {},
|
1689 | components: {},
|
1690 | cptData: {},
|
1691 | buttonProps: {},
|
1692 | resetProps: {},
|
1693 | trueData: {},
|
1694 | jsonData: {},
|
1695 | $f: {},
|
1696 | isShow: true,
|
1697 | unique: 1
|
1698 | };
|
1699 | },
|
1700 | components: components,
|
1701 | methods: {
|
1702 | _formField: function _formField() {
|
1703 | return Object.keys(this.trueData);
|
1704 | },
|
1705 | _changeFormData: function _changeFormData(field, value) {
|
1706 | if (Object.keys(this.cptData).indexOf(field) !== -1) this.$set(this.cptData, field, value);
|
1707 | },
|
1708 | _changeValue: function _changeValue(field, value) {
|
1709 | this.$set(this.trueData[field], 'value', value);
|
1710 | },
|
1711 | _value: function _value(field) {
|
1712 | return this.trueData[field] === undefined ? undefined : this.trueData[field].value;
|
1713 | },
|
1714 | _trueData: function _trueData(field) {
|
1715 | return this.trueData[field];
|
1716 | },
|
1717 | _formData: function _formData(field) {
|
1718 | return this.cptData[field];
|
1719 | },
|
1720 | _removeField: function _removeField(field) {
|
1721 | $del(this.cptData, field);
|
1722 | $del(this.trueData, field);
|
1723 | $del(this.jsonData, field);
|
1724 | if (this.components[field] !== undefined) $del(this.components, field);
|
1725 | },
|
1726 | _buttonProps: function _buttonProps(props) {
|
1727 | this.$set(this, 'buttonProps', deepExtend(this.buttonProps, props));
|
1728 | },
|
1729 | _resetProps: function _resetProps(props) {
|
1730 | this.$set(this, 'resetProps', deepExtend(this.resetProps, props));
|
1731 | },
|
1732 | __init: function __init() {},
|
1733 | _refresh: function _refresh() {
|
1734 | this.unique += 1;
|
1735 | },
|
1736 | _sync: function _sync() {
|
1737 | this.unique += 1;
|
1738 | this._fComponent.fRender.cacheUnique = this.unique;
|
1739 | },
|
1740 | _change: function _change(field, json) {
|
1741 | if (this.jsonData[field] !== json) {
|
1742 | this.jsonData[field] = json;
|
1743 | return true;
|
1744 | }
|
1745 |
|
1746 | return false;
|
1747 | }
|
1748 | },
|
1749 | beforeDestroy: function beforeDestroy() {
|
1750 | this._fComponent.reload([]);
|
1751 | }
|
1752 | };
|
1753 |
|
1754 | var formCreateName = 'FormCreate';
|
1755 |
|
1756 | var $FormCreate = function $FormCreate() {
|
1757 | return {
|
1758 | name: formCreateName,
|
1759 | mixins: [baseComponent],
|
1760 | props: {
|
1761 | rule: {
|
1762 | type: Array,
|
1763 | required: true,
|
1764 | default: function _default() {
|
1765 | return {};
|
1766 | }
|
1767 | },
|
1768 | option: {
|
1769 | type: Object,
|
1770 | default: function _default() {
|
1771 | return {};
|
1772 | },
|
1773 | required: false
|
1774 | },
|
1775 | value: Object
|
1776 | },
|
1777 | render: function render() {
|
1778 | return this._fComponent.render();
|
1779 | },
|
1780 | beforeCreate: function beforeCreate() {
|
1781 | var _this$$options$propsD = this.$options.propsData,
|
1782 | rule = _this$$options$propsD.rule,
|
1783 | option = _this$$options$propsD.option;
|
1784 |
|
1785 | var _fc = new FormCreate(rule, option);
|
1786 |
|
1787 | this._fComponent = _fc;
|
1788 | _fc._type = 'rule';
|
1789 |
|
1790 | _fc.beforeBoot(this);
|
1791 | },
|
1792 | created: function created() {
|
1793 | var _fc = this._fComponent;
|
1794 |
|
1795 | _fc.boot();
|
1796 |
|
1797 | this.$f = _fc.fCreateApi;
|
1798 | this.$emit('input', _fc.fCreateApi);
|
1799 | },
|
1800 | mounted: function mounted() {
|
1801 | var _this = this;
|
1802 |
|
1803 | var _fc = this._fComponent;
|
1804 |
|
1805 | _fc.mounted(this);
|
1806 |
|
1807 | this.$watch('rule', function (n) {
|
1808 | _fc.reload(n);
|
1809 |
|
1810 | _this.$emit('input', _this.$f);
|
1811 | });
|
1812 | this.$watch('option', function (n) {
|
1813 | $nt(function () {
|
1814 | _this._sync();
|
1815 | });
|
1816 | }, {
|
1817 | deep: true
|
1818 | });
|
1819 |
|
1820 | this.__init();
|
1821 |
|
1822 | this.$emit('input', this.$f);
|
1823 | }
|
1824 | };
|
1825 | };
|
1826 |
|
1827 | function coreComponent(fComponent) {
|
1828 | return {
|
1829 | name: "".concat(formCreateName, "Core"),
|
1830 | mixins: [baseComponent],
|
1831 | render: function render() {
|
1832 | return fComponent.render();
|
1833 | },
|
1834 | beforeCreate: function beforeCreate() {
|
1835 | this._fComponent = fComponent;
|
1836 | fComponent._type = 'rules';
|
1837 | fComponent.beforeBoot(this);
|
1838 | },
|
1839 | created: function created() {
|
1840 | fComponent.boot();
|
1841 | this.$f = fComponent.fCreateApi;
|
1842 | },
|
1843 | mounted: function mounted() {
|
1844 | var _this = this;
|
1845 |
|
1846 | fComponent.mounted(this);
|
1847 | this.$watch('rules', function (n) {
|
1848 | _this._fComponent.reload(n);
|
1849 | });
|
1850 | this.$watch('option', function (n) {
|
1851 | $nt(function () {
|
1852 | _this._sync();
|
1853 | });
|
1854 | }, {
|
1855 | deep: true
|
1856 | });
|
1857 |
|
1858 | this.__init();
|
1859 | }
|
1860 | };
|
1861 | }
|
1862 |
|
1863 | var Handler = function () {
|
1864 | function Handler(vm, _rule, Render, options, noValue) {
|
1865 | _classCallCheck(this, Handler);
|
1866 |
|
1867 | var rule = parseRule(_rule, vm, noValue);
|
1868 | this.rule = rule;
|
1869 | this.noValue = noValue;
|
1870 | this.type = toString$1(rule.type).toLowerCase();
|
1871 | this.isDef = true;
|
1872 | this.vm = vm;
|
1873 | this.el = {};
|
1874 | this.watch = [];
|
1875 | this.root = [];
|
1876 | this.orgChildren = [];
|
1877 |
|
1878 | if (!rule.field && noValue) {
|
1879 | this.field = '_def_' + uniqueId();
|
1880 | this.isDef = false;
|
1881 | } else {
|
1882 | this.field = rule.field;
|
1883 | }
|
1884 |
|
1885 | this.init();
|
1886 | var id = uniqueId();
|
1887 | this.id = id;
|
1888 | this.unique = 'fc_' + id;
|
1889 | this.key = 'key_' + id;
|
1890 | this.refName = '__' + this.field + this.id;
|
1891 | if (isUndef(rule.props.elementId)) $set(rule.props, 'elementId', this.unique);
|
1892 | this.refresh();
|
1893 | this.render = new Render(vm, this, options);
|
1894 | }
|
1895 |
|
1896 | _createClass(Handler, [{
|
1897 | key: "refresh",
|
1898 | value: function refresh() {
|
1899 | var rule = this.rule;
|
1900 | this.parseValue = this.toFormValue(rule.value);
|
1901 | this.orgChildren = isValidChildren(rule.children) ? _toConsumableArray(rule.children) : [];
|
1902 | this.deleted = false;
|
1903 | return this;
|
1904 | }
|
1905 | }, {
|
1906 | key: "init",
|
1907 | value: function init() {}
|
1908 | }, {
|
1909 | key: "toFormValue",
|
1910 | value: function toFormValue(value) {
|
1911 | return value;
|
1912 | }
|
1913 | }, {
|
1914 | key: "toValue",
|
1915 | value: function toValue(parseValue) {
|
1916 | return parseValue;
|
1917 | }
|
1918 | }, {
|
1919 | key: "setValue",
|
1920 | value: function setValue(value) {
|
1921 | this.rule.value = value;
|
1922 |
|
1923 | this.vm._changeValue(this.field, value);
|
1924 | }
|
1925 | }, {
|
1926 | key: "getValue",
|
1927 | value: function getValue() {
|
1928 | return this.vm._value(this.field);
|
1929 | }
|
1930 | }, {
|
1931 | key: "watchValue",
|
1932 | value: function watchValue(n) {
|
1933 | $set(this.rule, 'value', n);
|
1934 |
|
1935 | this.vm._changeFormData(this.field, this.toFormValue(n));
|
1936 | }
|
1937 | }, {
|
1938 | key: "watchFormValue",
|
1939 | value: function watchFormValue(n) {}
|
1940 | }, {
|
1941 | key: "reset",
|
1942 | value: function reset() {
|
1943 | this.vm._changeValue(this.field, this.defaultValue);
|
1944 |
|
1945 | this.clearMsg();
|
1946 | }
|
1947 | }, {
|
1948 | key: "clearMsg",
|
1949 | value: function clearMsg() {
|
1950 | var refName = 'fItem' + this.refName,
|
1951 | fItem = this.vm.$refs[refName];
|
1952 |
|
1953 | if (fItem) {
|
1954 | fItem.validateMessage = '';
|
1955 | fItem.validateState = '';
|
1956 | fItem.validateDisabled = true;
|
1957 | }
|
1958 | }
|
1959 | }, {
|
1960 | key: "mounted",
|
1961 | value: function mounted() {
|
1962 | var refName = 'fItem' + this.refName,
|
1963 | vm = this.vm;
|
1964 | this.el = vm.$refs[this.refName] || {};
|
1965 | if (this.defaultValue === undefined) this.defaultValue = this.toValue(vm.$refs[refName] && !isUndef(vm.$refs[refName].initialValue) ? vm.$refs[refName].initialValue : deepExtend({}, {
|
1966 | value: this.rule.value
|
1967 | }).value);
|
1968 | }
|
1969 | }, {
|
1970 | key: "$emit",
|
1971 | value: function $emit(eventName) {
|
1972 | var _this$rule$vm, _this$el;
|
1973 |
|
1974 | eventName = "fc:".concat(eventName);
|
1975 |
|
1976 | for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1977 | params[_key - 1] = arguments[_key];
|
1978 | }
|
1979 |
|
1980 | if (this.type === 'template' && this.rule.template) (_this$rule$vm = this.rule.vm).$emit.apply(_this$rule$vm, [eventName].concat(params));else if (this.noValue === true && this.el.$emit) (_this$el = this.el).$emit.apply(_this$el, [eventName].concat(params));
|
1981 | }
|
1982 | }]);
|
1983 |
|
1984 | return Handler;
|
1985 | }();
|
1986 | function defRule() {
|
1987 | return {
|
1988 | validate: [],
|
1989 | event: {},
|
1990 | col: {},
|
1991 | emit: [],
|
1992 | props: {},
|
1993 | on: {},
|
1994 | options: [],
|
1995 | title: '',
|
1996 | value: '',
|
1997 | field: '',
|
1998 | className: ''
|
1999 | };
|
2000 | }
|
2001 | function parseRule(rule, vm, noVal) {
|
2002 | var def = defRule();
|
2003 | Object.keys(def).forEach(function (k) {
|
2004 | if (isUndef(rule[k])) $set(rule, k, def[k]);
|
2005 | });
|
2006 | var parseRule = {
|
2007 | col: parseCol(rule.col),
|
2008 | props: parseProps(rule.props),
|
2009 | emitEvent: parseEmit(rule.field, rule.emitPrefix, rule.emit, vm),
|
2010 | validate: parseArray(rule.validate),
|
2011 | options: parseArray(rule.options)
|
2012 | };
|
2013 | parseRule.event = extend(rule.event, parseRule.emitEvent);
|
2014 | parseRule.on = parseOn(rule.on, parseRule.emitEvent);
|
2015 | Object.keys(parseRule).forEach(function (k) {
|
2016 | $set(rule, k, parseRule[k]);
|
2017 | });
|
2018 |
|
2019 | if (!rule.field && !noVal) {
|
2020 | console.error('规则的 field 字段不能空' + errMsg());
|
2021 | }
|
2022 |
|
2023 | return rule;
|
2024 | }
|
2025 | function parseOn(on, emitEvent) {
|
2026 | if (Object.keys(emitEvent).length > 0) extend(on, emitEvent);
|
2027 | return on;
|
2028 | }
|
2029 | function parseArray(validate) {
|
2030 | return Array.isArray(validate) ? validate : [];
|
2031 | }
|
2032 | function parseEmit(field, emitPrefix, emit, vm) {
|
2033 | var event = {};
|
2034 | if (!Array.isArray(emit)) return event;
|
2035 | emit.forEach(function (eventName) {
|
2036 | var fieldKey = toLine("".concat(field, "-").concat(eventName)).replace('_', '-');
|
2037 | var emitKey = emitPrefix ? "".concat(emitPrefix, "-").toLowerCase() + toLine(eventName) : emitPrefix;
|
2038 |
|
2039 | event[eventName] = function () {
|
2040 | for (var _len2 = arguments.length, arg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
2041 | arg[_key2] = arguments[_key2];
|
2042 | }
|
2043 |
|
2044 | vm.$emit.apply(vm, [fieldKey].concat(arg));
|
2045 | if (emitKey && fieldKey !== emitKey) vm.$emit.apply(vm, [emitKey].concat(arg));
|
2046 | };
|
2047 | });
|
2048 | return event;
|
2049 | }
|
2050 | function parseProps(props) {
|
2051 | if (isUndef(props.hidden)) $set(props, 'hidden', false);
|
2052 | if (isUndef(props.visibility)) $set(props, 'visibility', false);
|
2053 | return props;
|
2054 | }
|
2055 | function parseCol(col) {
|
2056 | if (isNumeric(col)) {
|
2057 | return {
|
2058 | span: col
|
2059 | };
|
2060 | } else if (col.span === undefined) $set(col, 'span', 24);
|
2061 |
|
2062 | return col;
|
2063 | }
|
2064 |
|
2065 | function parseVData(data) {
|
2066 | if (isString(data)) data = {
|
2067 | domProps: {
|
2068 | innerHTML: data
|
2069 | }
|
2070 | };else if (data && isFunction(data.get)) data = data.get();
|
2071 | return data;
|
2072 | }
|
2073 | function getVNode(VNode) {
|
2074 | return isFunction(VNode) ? VNode() : VNode || [];
|
2075 | }
|
2076 |
|
2077 | var VNode = function () {
|
2078 | function VNode(vm) {
|
2079 | _classCallCheck(this, VNode);
|
2080 |
|
2081 | this.setVm(vm);
|
2082 | }
|
2083 |
|
2084 | _createClass(VNode, [{
|
2085 | key: "setVm",
|
2086 | value: function setVm(vm) {
|
2087 | this.vm = vm;
|
2088 | this.$h = vm.$createElement;
|
2089 | }
|
2090 | }, {
|
2091 | key: "make",
|
2092 | value: function make(nodeName, data, VNodeFn) {
|
2093 | var Node = this.$h(nodeName, parseVData(data), getVNode(VNodeFn));
|
2094 | Node.context = this.vm;
|
2095 | return Node;
|
2096 | }
|
2097 | }], [{
|
2098 | key: "use",
|
2099 | value: function use(nodes) {
|
2100 | Object.keys(nodes).forEach(function (k) {
|
2101 | VNode.prototype[k] = function (data, VNodeFn) {
|
2102 | return this.make(nodes[k], data, VNodeFn);
|
2103 | };
|
2104 | });
|
2105 | }
|
2106 | }]);
|
2107 |
|
2108 | return VNode;
|
2109 | }();
|
2110 |
|
2111 | function defVData() {
|
2112 | return {
|
2113 | class: {},
|
2114 | style: {},
|
2115 | attrs: {},
|
2116 | props: {},
|
2117 | domProps: {},
|
2118 | on: {},
|
2119 | nativeOn: {},
|
2120 | directives: [],
|
2121 | scopedSlots: {},
|
2122 | slot: undefined,
|
2123 | key: undefined,
|
2124 | ref: undefined
|
2125 | };
|
2126 | }
|
2127 |
|
2128 | var VData = function () {
|
2129 | function VData() {
|
2130 | _classCallCheck(this, VData);
|
2131 |
|
2132 | this.init();
|
2133 | }
|
2134 |
|
2135 | _createClass(VData, [{
|
2136 | key: "class",
|
2137 | value: function _class(classList) {
|
2138 | var _this = this;
|
2139 |
|
2140 | var status = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
2141 | if (isUndef(classList)) return this;
|
2142 |
|
2143 | if (Array.isArray(classList)) {
|
2144 | classList.forEach(function (cls) {
|
2145 | $set(_this._data.class, toString$1(cls), true);
|
2146 | });
|
2147 | } else if (isPlainObject(classList)) {
|
2148 | $set(this._data, 'class', extend(this._data.class, classList));
|
2149 | } else {
|
2150 | $set(this._data.class, toString$1(classList), status === undefined ? true : status);
|
2151 | }
|
2152 |
|
2153 | return this;
|
2154 | }
|
2155 | }, {
|
2156 | key: "directives",
|
2157 | value: function directives(_directives) {
|
2158 | if (isUndef(_directives)) return this;
|
2159 | $set(this._data, 'directives', this._data.directives.concat(toArray(_directives)));
|
2160 | return this;
|
2161 | }
|
2162 | }, {
|
2163 | key: "init",
|
2164 | value: function init() {
|
2165 | this._data = defVData();
|
2166 | return this;
|
2167 | }
|
2168 | }, {
|
2169 | key: "get",
|
2170 | value: function get() {
|
2171 | this._prev = this._data;
|
2172 | this.init();
|
2173 | return this._prev;
|
2174 | }
|
2175 | }]);
|
2176 |
|
2177 | return VData;
|
2178 | }();
|
2179 | var keyList = ['ref', 'key', 'slot'];
|
2180 | var objList = ['scopedSlots', 'nativeOn', 'on', 'domProps', 'props', 'attrs', 'style'];
|
2181 | keyList.forEach(function (key) {
|
2182 | VData.prototype[key] = function (val) {
|
2183 | $set(this._data, key, val);
|
2184 | return this;
|
2185 | };
|
2186 | });
|
2187 | objList.forEach(function (key) {
|
2188 | VData.prototype[key] = function (obj, val) {
|
2189 | if (isUndef(obj)) return this;
|
2190 |
|
2191 | if (isPlainObject(obj)) {
|
2192 | $set(this._data, key, extend(this._data[key], obj));
|
2193 | } else {
|
2194 | $set(this._data[key], toString$1(obj), val);
|
2195 | }
|
2196 |
|
2197 | return this;
|
2198 | };
|
2199 | });
|
2200 |
|
2201 | var upperCaseReg = /[A-Z]/;
|
2202 | function isAttr(name, value) {
|
2203 | return !upperCaseReg.test(name) && (isString(value) || isNumber(value));
|
2204 | }
|
2205 | var $de = debounce(function (fn) {
|
2206 | return fn();
|
2207 | }, 1);
|
2208 |
|
2209 | var Render = function () {
|
2210 | function Render(vm, handler) {
|
2211 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
2212 |
|
2213 | _classCallCheck(this, Render);
|
2214 |
|
2215 | this.vm = vm;
|
2216 | this.handler = handler;
|
2217 | this.options = options;
|
2218 | this.vNode = new VNode(vm);
|
2219 | this.vData = new VData();
|
2220 | this.cache = null;
|
2221 | this.$tickEvent = [];
|
2222 | this.init();
|
2223 | }
|
2224 |
|
2225 | _createClass(Render, [{
|
2226 | key: "init",
|
2227 | value: function init() {}
|
2228 | }, {
|
2229 | key: "cacheParse",
|
2230 | value: function cacheParse(form, _super) {
|
2231 | var _this$handler = this.handler,
|
2232 | noValue = _this$handler.noValue,
|
2233 | noCache = _this$handler.noCache;
|
2234 | if (!this.cache || noValue === true || noCache === true) this.cache = _super ? Render.prototype.parse.call(this, form) : this.parse(form);
|
2235 |
|
2236 | var eventList = _toConsumableArray(this.$tickEvent);
|
2237 |
|
2238 | this.$tickEvent = [];
|
2239 | if (eventList.length) $nt(function () {
|
2240 | eventList.forEach(function (event) {
|
2241 | return event();
|
2242 | });
|
2243 | });
|
2244 | return this.cache;
|
2245 | }
|
2246 | }, {
|
2247 | key: "sync",
|
2248 | value: function sync(event) {
|
2249 | if (isFunction(event)) this.$tickEvent.push(event);
|
2250 | this.clearCache();
|
2251 |
|
2252 | this.vm._sync();
|
2253 | }
|
2254 | }, {
|
2255 | key: "clearCache",
|
2256 | value: function clearCache() {
|
2257 | this.cache = null;
|
2258 | var children = this.handler.rule.children;
|
2259 | if (isValidChildren(children)) children.forEach(function (child) {
|
2260 | return !isString(child) && child.__handler__.render.clearCache();
|
2261 | });
|
2262 | }
|
2263 | }, {
|
2264 | key: "childrenParse",
|
2265 | value: function childrenParse(form) {
|
2266 | var _this$handler2 = this.handler,
|
2267 | rule = _this$handler2.rule,
|
2268 | orgChildren = _this$handler2.orgChildren,
|
2269 | vm = _this$handler2.vm,
|
2270 | children = rule.children,
|
2271 | vn = [];
|
2272 |
|
2273 | if (isValidChildren(children)) {
|
2274 | orgChildren.forEach(function (_rule) {
|
2275 | if (children.indexOf(_rule) === -1) {
|
2276 | vm._fComponent.removeField(_rule.__field__);
|
2277 | }
|
2278 | });
|
2279 | vn = children.map(function (child) {
|
2280 | if (isString(child)) return [child];
|
2281 |
|
2282 | if (child.__handler__) {
|
2283 | return child.__handler__.render.cacheParse(form, true);
|
2284 | }
|
2285 |
|
2286 | $de(function () {
|
2287 | return vm._fComponent.reload();
|
2288 | });
|
2289 | });
|
2290 | this.handler.orgChildren = _toConsumableArray(children);
|
2291 | } else if (orgChildren.length > 0) {
|
2292 | orgChildren.forEach(function (_rule) {
|
2293 | vm._fComponent.removeField(_rule.__field__);
|
2294 | });
|
2295 | this.handler.orgChildren = [];
|
2296 | }
|
2297 |
|
2298 | return vn;
|
2299 | }
|
2300 | }, {
|
2301 | key: "parse",
|
2302 | value: function parse(form) {
|
2303 | var _this$handler3 = this.handler,
|
2304 | type = _this$handler3.type,
|
2305 | rule = _this$handler3.rule,
|
2306 | refName = _this$handler3.refName,
|
2307 | key = _this$handler3.key,
|
2308 | noValue = _this$handler3.noValue;
|
2309 |
|
2310 | if (type === 'template' && rule.template) {
|
2311 | if (Vue$1.compile === undefined) {
|
2312 | console.error('使用的 Vue 版本不支持 compile' + errMsg());
|
2313 | return [];
|
2314 | }
|
2315 |
|
2316 | if (isUndef(rule.vm)) rule.vm = new Vue$1();
|
2317 | var vn = Vue$1.compile(rule.template, {}).render.call(rule.vm);
|
2318 | if (vn.data === undefined) vn.data = {};
|
2319 | extend(vn.data, rule);
|
2320 | vn.key = key;
|
2321 | return [vn];
|
2322 | } else if (!noValue) {
|
2323 | return form.makeComponent(this.handler.render);
|
2324 | } else {
|
2325 | rule.ref = refName;
|
2326 | if (isUndef(rule.key)) rule.key = 'def' + uniqueId();
|
2327 |
|
2328 | var _vn = this.vNode.make(type, _objectSpread({}, rule), this.childrenParse(form));
|
2329 |
|
2330 | _vn.key = key;
|
2331 | return [_vn];
|
2332 | }
|
2333 | }
|
2334 | }, {
|
2335 | key: "inputProps",
|
2336 | value: function inputProps() {
|
2337 | var _this = this;
|
2338 |
|
2339 | var _this$handler4 = this.handler,
|
2340 | refName = _this$handler4.refName,
|
2341 | key = _this$handler4.key,
|
2342 | field = _this$handler4.field,
|
2343 | rule = _this$handler4.rule;
|
2344 | var props = rule.props,
|
2345 | event = rule.event;
|
2346 | Object.keys(this.vData._data).forEach(function (key) {
|
2347 | if (rule[key] !== undefined) _this.vData[key](rule[key]);
|
2348 | });
|
2349 | var data = this.vData.props({
|
2350 | value: this.vm._formData(field)
|
2351 | }).ref(refName).key(key + 'fc' + field).on(event).on('input', function (value) {
|
2352 | _this.onInput(value);
|
2353 | });
|
2354 | data.attrs(Object.keys(props).reduce(function (initial, val) {
|
2355 | if (isAttr(val, props[val])) initial[val] = props[val];
|
2356 | return initial;
|
2357 | }, {}));
|
2358 | if (isUndef(props.size)) data.props({
|
2359 | size: this.options.form.size
|
2360 | });
|
2361 | return data;
|
2362 | }
|
2363 | }, {
|
2364 | key: "onInput",
|
2365 | value: function onInput(value) {
|
2366 | value = isUndef(value) ? '' : value;
|
2367 | var handler = this.handler,
|
2368 | _this$handler5 = this.handler,
|
2369 | field = _this$handler5.field,
|
2370 | vm = _this$handler5.vm,
|
2371 | trueValue = handler.toValue(value);
|
2372 |
|
2373 | vm._changeFormData(field, value);
|
2374 |
|
2375 | if (!vm._change(field, JSON.stringify(trueValue))) return;
|
2376 | handler.setValue(trueValue);
|
2377 | handler.watchFormValue(value);
|
2378 | handler.render.sync();
|
2379 | }
|
2380 | }]);
|
2381 |
|
2382 | return Render;
|
2383 | }();
|
2384 | function defaultRenderFactory(node) {
|
2385 | var setKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2386 | return function (_Render) {
|
2387 | _inherits(render, _Render);
|
2388 |
|
2389 | function render() {
|
2390 | _classCallCheck(this, render);
|
2391 |
|
2392 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
2393 | }
|
2394 |
|
2395 | _createClass(render, [{
|
2396 | key: "parse",
|
2397 | value: function parse(form) {
|
2398 | var props = this.inputProps();
|
2399 | if (setKey) props.key(this.handler.key);
|
2400 | return [this.vNode[node](props.get(), this.childrenParse(form))];
|
2401 | }
|
2402 | }]);
|
2403 |
|
2404 | return render;
|
2405 | }(Render);
|
2406 | }
|
2407 |
|
2408 | function getBaseConfig() {
|
2409 | return {
|
2410 | mounted: function mounted($f) {},
|
2411 | onReload: function onReload($f) {},
|
2412 | onSubmit: function onSubmit(formData, $f) {},
|
2413 | el: null,
|
2414 | switchMaker: true
|
2415 | };
|
2416 | }
|
2417 |
|
2418 | var version = "1.6.5";
|
2419 | var ui = "element";
|
2420 | var formCreateStyleElId = 'form-create-style';
|
2421 | var drive = {};
|
2422 | function getRule(rule) {
|
2423 | if (isFunction(rule.getRule)) return rule.getRule();else return rule;
|
2424 | }
|
2425 | function getComponent(vm, rule, createOptions) {
|
2426 | var componentList = drive.componentList,
|
2427 | name = toString$1(rule.type).toLowerCase(),
|
2428 | component = isComponent(name) ? componentList[name] : getUdfComponent();
|
2429 | return new component.handler(vm, rule, component.render, createOptions, component.noValue);
|
2430 | }
|
2431 | function isComponent(type) {
|
2432 | return drive.componentList[type] !== undefined;
|
2433 | }
|
2434 | function getUdfComponent() {
|
2435 | return {
|
2436 | handler: Handler,
|
2437 | render: Render,
|
2438 | noValue: true
|
2439 | };
|
2440 | }
|
2441 | var _vue = typeof window !== 'undefined' && window.Vue ? window.Vue : Vue$1;
|
2442 | function bindHandler(rule, handler) {
|
2443 | Object.defineProperties(rule, {
|
2444 | __field__: {
|
2445 | value: handler.field,
|
2446 | enumerable: false,
|
2447 | configurable: false
|
2448 | },
|
2449 | __handler__: {
|
2450 | value: handler,
|
2451 | enumerable: false,
|
2452 | configurable: false
|
2453 | }
|
2454 | });
|
2455 | }
|
2456 | function initStyle() {
|
2457 | if (document.getElementById(formCreateStyleElId) !== null) return;
|
2458 | var style = document.createElement('style');
|
2459 | style.id = formCreateStyleElId;
|
2460 | style.innerText = drive.style;
|
2461 | document.getElementsByTagName('head')[0].appendChild(style);
|
2462 | }
|
2463 | function margeGlobal(_options) {
|
2464 | if (isBool(_options.sumbitBtn)) $set(_options, 'sumbitBtn', {
|
2465 | show: _options.sumbitBtn
|
2466 | });
|
2467 | if (isBool(_options.resetBtn)) $set(_options, 'resetBtn', {
|
2468 | show: _options.resetBtn
|
2469 | });
|
2470 | var options = deepExtend(extend(drive.getConfig(), getBaseConfig()), _options);
|
2471 | $set(options, 'el', !options.el ? window.document.body : isElement(options.el) ? options.el : document.querySelector(options.el));
|
2472 | return options;
|
2473 | }
|
2474 | function delHandler(handler) {
|
2475 | handler.watch.forEach(function (unWatch) {
|
2476 | return unWatch();
|
2477 | });
|
2478 | handler.watch = [];
|
2479 | handler.deleted = true;
|
2480 | }
|
2481 | var components = {
|
2482 | 'form-create': _vue.extend($FormCreate())
|
2483 | };
|
2484 | function setComponent(id, component) {
|
2485 | if (component) {
|
2486 | return _vue.component(toString$1(id), component);
|
2487 | } else if (id) return components[toString$1(id)];else return _objectSpread({}, components);
|
2488 | }
|
2489 |
|
2490 | var FormCreate = function () {
|
2491 | function FormCreate(rules) {
|
2492 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2493 |
|
2494 | _classCallCheck(this, FormCreate);
|
2495 |
|
2496 | this.fRender = undefined;
|
2497 | this.fCreateApi = undefined;
|
2498 | this.$parent = undefined;
|
2499 | this.id = uniqueId();
|
2500 | this.validate = {};
|
2501 |
|
2502 | this.__init(rules, options);
|
2503 |
|
2504 | initStyle();
|
2505 | this.$tick = debounce(function (fn) {
|
2506 | return fn();
|
2507 | }, 150);
|
2508 | }
|
2509 |
|
2510 | _createClass(FormCreate, [{
|
2511 | key: "__init",
|
2512 | value: function __init(rules, options) {
|
2513 | this.options = margeGlobal(options);
|
2514 | this.rules = Array.isArray(rules) ? rules : [];
|
2515 | this.origin = _toConsumableArray(this.rules);
|
2516 | this.handlers = {};
|
2517 | this.formData = {};
|
2518 | this.trueData = {};
|
2519 | this.components = {};
|
2520 | this.fieldList = [];
|
2521 | this.switchMaker = this.options.switchMaker;
|
2522 | }
|
2523 | }, {
|
2524 | key: "render",
|
2525 | value: function render() {
|
2526 | return this.fRender.render(this.vm);
|
2527 | }
|
2528 | }, {
|
2529 | key: "beforeBoot",
|
2530 | value: function beforeBoot(vm) {
|
2531 | this.vm = vm;
|
2532 | this.createHandler(this.rules);
|
2533 | this.fRender = new drive.formRender(this);
|
2534 | }
|
2535 | }, {
|
2536 | key: "boot",
|
2537 | value: function boot() {
|
2538 | var vm = this.vm;
|
2539 | vm.$set(vm, 'cptData', this.formData);
|
2540 | vm.$set(vm, 'trueData', this.trueData);
|
2541 | vm.$set(vm, 'buttonProps', this.options.submitBtn);
|
2542 | vm.$set(vm, 'resetProps', this.options.resetBtn);
|
2543 | vm.$set(vm, 'rules', this.rules);
|
2544 | vm.$set(vm, 'components', this.components);
|
2545 | if (this.fCreateApi === undefined) this.fCreateApi = drive.getGlobalApi(this);
|
2546 | this.fCreateApi.rule = this.rules;
|
2547 | this.fCreateApi.config = this.options;
|
2548 | }
|
2549 | }, {
|
2550 | key: "setHandler",
|
2551 | value: function setHandler(handler) {
|
2552 | var rule = handler.rule,
|
2553 | field = handler.field,
|
2554 | isDef = handler.isDef;
|
2555 | this.handlers[field] = handler;
|
2556 |
|
2557 | if (handler.noValue === true) {
|
2558 | if (isDef === true) $set(this.components, field, rule);
|
2559 | return;
|
2560 | }
|
2561 |
|
2562 | $set(this.formData, field, handler.parseValue);
|
2563 | $set(this.validate, field, rule.validate);
|
2564 | $set(this.trueData, field, rule);
|
2565 | }
|
2566 | }, {
|
2567 | key: "notField",
|
2568 | value: function notField(field) {
|
2569 | return this.handlers[field] === undefined;
|
2570 | }
|
2571 | }, {
|
2572 | key: "createHandler",
|
2573 | value: function createHandler(rules, child) {
|
2574 | var _this = this;
|
2575 |
|
2576 | rules.map(function (_rule, index) {
|
2577 | if (child && isString(_rule)) return;
|
2578 | if (!_rule.type) return console.error("\u672A\u5B9A\u4E49\u751F\u6210\u89C4\u5219\u7684 type \u5B57\u6BB5" + errMsg());
|
2579 | var rule = getRule(_rule),
|
2580 | handler;
|
2581 |
|
2582 | if (_rule.__handler__) {
|
2583 | handler = _rule.__handler__;
|
2584 | if (handler.vm !== _this.vm && !handler.deleted) return console.error("\u7B2C".concat(index + 1, "\u6761\u89C4\u5219\u6B63\u5728\u5176\u4ED6\u7684 <form-create> \u4E2D\u4F7F\u7528") + errMsg());
|
2585 | handler.vm = _this.vm;
|
2586 | handler.render.vm = _this.vm;
|
2587 | handler.render.vNode.setVm(_this.vm);
|
2588 | handler.refresh();
|
2589 | } else {
|
2590 | handler = getComponent(_this.vm, rule, _this.options);
|
2591 | }
|
2592 |
|
2593 | var children = handler.rule.children;
|
2594 | if (!_this.notField(handler.field)) return console.error("".concat(rule.field, " \u5B57\u6BB5\u5DF2\u5B58\u5728") + errMsg());
|
2595 |
|
2596 | if (_this.switchMaker) {
|
2597 | rules[index] = rule;
|
2598 | if (!child) _this.origin[index] = rule;
|
2599 | _rule = rule;
|
2600 | }
|
2601 |
|
2602 | _this.setHandler(handler);
|
2603 |
|
2604 | if (!_rule.__handler__) {
|
2605 | bindHandler(_rule, handler);
|
2606 | }
|
2607 |
|
2608 | if (isValidChildren(children)) _this.createHandler(children, true);
|
2609 | if (!child) _this.fieldList.push(handler.field);
|
2610 | return handler;
|
2611 | }).filter(function (h) {
|
2612 | return h;
|
2613 | }).forEach(function (h) {
|
2614 | h.root = rules;
|
2615 | });
|
2616 | return rules;
|
2617 | }
|
2618 | }, {
|
2619 | key: "create",
|
2620 | value: function create(Vue) {
|
2621 | var $fCreate = Vue.extend(coreComponent(this)),
|
2622 | $vm = new $fCreate().$mount();
|
2623 | this.options.el.appendChild($vm.$el);
|
2624 | return $vm;
|
2625 | }
|
2626 | }, {
|
2627 | key: "mounted",
|
2628 | value: function mounted(vm) {
|
2629 | var _this2 = this;
|
2630 |
|
2631 | var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
2632 | this.vm = vm;
|
2633 | var _this$options = this.options,
|
2634 | mounted = _this$options.mounted,
|
2635 | onReload = _this$options.onReload;
|
2636 | Object.keys(this.handlers).forEach(function (field) {
|
2637 | var handler = _this2.handlers[field];
|
2638 | if (handler.watch.length === 0) _this2.addHandlerWatch(handler);
|
2639 | handler.mounted();
|
2640 | });
|
2641 | Object.keys(vm.cptData).forEach(function (field) {
|
2642 | var value = _this2.handlers[field].toValue(vm.cptData[field]);
|
2643 |
|
2644 | vm.jsonData[field] = JSON.stringify(value);
|
2645 |
|
2646 | vm._changeValue(field, value);
|
2647 | });
|
2648 |
|
2649 | if (first) {
|
2650 | mounted && mounted(this.fCreateApi);
|
2651 | this.$emit('mounted', this.fCreateApi);
|
2652 | }
|
2653 |
|
2654 | onReload && onReload(this.fCreateApi);
|
2655 | this.$emit('reload', this.fCreateApi);
|
2656 | }
|
2657 | }, {
|
2658 | key: "$emit",
|
2659 | value: function $emit(eventName) {
|
2660 | for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
2661 | params[_key - 1] = arguments[_key];
|
2662 | }
|
2663 |
|
2664 | if (this.$parent) {
|
2665 | var _this$$parent;
|
2666 |
|
2667 | (_this$$parent = this.$parent).$emit.apply(_this$$parent, ["fc:".concat(eventName)].concat(params));
|
2668 | } else {
|
2669 | var _this$vm;
|
2670 |
|
2671 | (_this$vm = this.vm).$emit.apply(_this$vm, [eventName].concat(params));
|
2672 | }
|
2673 | }
|
2674 | }, {
|
2675 | key: "removeField",
|
2676 | value: function removeField(field) {
|
2677 | if (this.handlers[field] === undefined) return;
|
2678 | var index = this.fieldList.indexOf(field);
|
2679 | delHandler(this.handlers[field]);
|
2680 | $del(this.handlers, field);
|
2681 | $del(this.validate, field);
|
2682 |
|
2683 | if (index !== -1) {
|
2684 | this.fieldList.splice(index, 1);
|
2685 | }
|
2686 |
|
2687 | this.vm._removeField(field);
|
2688 | }
|
2689 | }, {
|
2690 | key: "addHandlerWatch",
|
2691 | value: function addHandlerWatch(handler) {
|
2692 | var _this3 = this;
|
2693 |
|
2694 | if (handler.noValue === true) return;
|
2695 | var field = handler.field,
|
2696 | vm = this.vm;
|
2697 | var unWatch = vm.$watch(function () {
|
2698 | return vm.cptData[field];
|
2699 | }, function (n) {
|
2700 | if (_this3.handlers[field] === undefined) return delHandler(handler);
|
2701 | var trueValue = handler.toValue(n),
|
2702 | json = JSON.stringify(trueValue);
|
2703 |
|
2704 | if (vm._change(field, json)) {
|
2705 | handler.setValue(trueValue);
|
2706 | handler.watchFormValue(n);
|
2707 | }
|
2708 | }, {
|
2709 | deep: true
|
2710 | });
|
2711 | var unWatch2 = vm.$watch(function () {
|
2712 | return vm.trueData[field].value;
|
2713 | }, function (n) {
|
2714 | if (n === undefined) return;
|
2715 | if (_this3.handlers[field] === undefined) return delHandler(handler);
|
2716 | var json = JSON.stringify(n);
|
2717 |
|
2718 | if (vm._change(field, json)) {
|
2719 | handler.watchValue(n);
|
2720 | $nt(function () {
|
2721 | return handler.render.sync();
|
2722 | });
|
2723 | }
|
2724 | }, {
|
2725 | deep: true
|
2726 | });
|
2727 | handler.watch.push(unWatch, unWatch2);
|
2728 |
|
2729 | var bind = function bind() {
|
2730 | if (_this3.handlers[field] === undefined) delHandler(handler);else _this3.$tick(function () {
|
2731 | return handler.render.sync();
|
2732 | });
|
2733 | };
|
2734 |
|
2735 | Object.keys(vm._trueData(field)).forEach(function (key) {
|
2736 | if (key === 'value') return;
|
2737 | handler.watch.push(vm.$watch(function () {
|
2738 | return vm.trueData[field][key];
|
2739 | }, bind, {
|
2740 | deep: true
|
2741 | }));
|
2742 | });
|
2743 | }
|
2744 | }, {
|
2745 | key: "reload",
|
2746 | value: function reload(rules) {
|
2747 | var _this4 = this;
|
2748 |
|
2749 | var vm = this.vm;
|
2750 | if (!rules) return this.reload(this.rules);
|
2751 | if (!this.origin.length) this.fCreateApi.refresh();
|
2752 | this.origin = _toConsumableArray(rules);
|
2753 | Object.keys(this.handlers).forEach(function (field) {
|
2754 | return _this4.removeField(field);
|
2755 | });
|
2756 |
|
2757 | this.__init(rules, this.options);
|
2758 |
|
2759 | this.beforeBoot(vm);
|
2760 | this.boot();
|
2761 |
|
2762 | vm.__init();
|
2763 |
|
2764 | $nt(function () {
|
2765 | _this4.mounted(vm, false);
|
2766 | });
|
2767 | vm.$f = this.fCreateApi;
|
2768 | }
|
2769 | }, {
|
2770 | key: "getFormRef",
|
2771 | value: function getFormRef() {
|
2772 | return this.vm.$refs[this.fRender.refName];
|
2773 | }
|
2774 | }], [{
|
2775 | key: "create",
|
2776 | value: function create(rules) {
|
2777 | var _opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2778 |
|
2779 | var $parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
2780 | var opt = isElement(_opt) ? {
|
2781 | el: _opt
|
2782 | } : _opt;
|
2783 | var fComponent = new FormCreate(rules, opt),
|
2784 | $vm = fComponent.create(_vue);
|
2785 | fComponent.$parent = $parent;
|
2786 | return fComponent.fCreateApi;
|
2787 | }
|
2788 | }, {
|
2789 | key: "install",
|
2790 | value: function install(Vue) {
|
2791 | var $formCreate = function $formCreate(rules) {
|
2792 | var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2793 | return FormCreate.create(rules, opt, this);
|
2794 | };
|
2795 |
|
2796 | $formCreate.maker = FormCreate.maker;
|
2797 | $formCreate.version = version;
|
2798 | $formCreate.ui = ui;
|
2799 | $formCreate.component = setComponent;
|
2800 | Vue.prototype.$formCreate = $formCreate;
|
2801 | Vue.component(formCreateName, Vue.extend($FormCreate()));
|
2802 | _vue = Vue;
|
2803 | }
|
2804 | }, {
|
2805 | key: "init",
|
2806 | value: function init(rules) {
|
2807 | var _opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
2808 |
|
2809 | var opt = isElement(_opt) ? {
|
2810 | el: _opt
|
2811 | } : _opt;
|
2812 | var fComponent = new FormCreate(rules, opt);
|
2813 |
|
2814 | var $fCreate = _vue.extend(coreComponent(fComponent));
|
2815 |
|
2816 | var $vm = new $fCreate().$mount();
|
2817 | return {
|
2818 | mount: function mount($el) {
|
2819 | if ($el && isElement($el)) $set(fComponent.options, 'el', $el);
|
2820 | fComponent.options.el.appendChild($vm.$el);
|
2821 | return fComponent.fCreateApi;
|
2822 | },
|
2823 | remove: function remove() {
|
2824 | fComponent.options.el.removeChild($vm.$el);
|
2825 | },
|
2826 | $f: fComponent.fCreateApi
|
2827 | };
|
2828 | }
|
2829 | }]);
|
2830 |
|
2831 | return FormCreate;
|
2832 | }();
|
2833 | FormCreate.version = version;
|
2834 | FormCreate.ui = ui;
|
2835 | FormCreate.component = setComponent;
|
2836 | function setDrive(_drive) {
|
2837 | drive = _drive;
|
2838 |
|
2839 | _drive.install(FormCreate);
|
2840 | }
|
2841 | function install(Vue) {
|
2842 | if (Vue._installedFormCreate === true) return;
|
2843 | Vue._installedFormCreate = true;
|
2844 | Vue.use(FormCreate);
|
2845 | }
|
2846 |
|
2847 | var Form = function () {
|
2848 | function Form(fComponent) {
|
2849 | _classCallCheck(this, Form);
|
2850 |
|
2851 | var id = fComponent.id,
|
2852 | vm = fComponent.vm,
|
2853 | fieldList = fComponent.fieldList,
|
2854 | handlers = fComponent.handlers;
|
2855 | this.vm = vm;
|
2856 | this.handlers = handlers;
|
2857 | this.renderSort = fieldList;
|
2858 | this._fc = fComponent;
|
2859 | this.vNode = new VNode(vm);
|
2860 | this.vData = new VData();
|
2861 | this.unique = id;
|
2862 | this.refName = "cForm".concat(id);
|
2863 | this.cacheUnique = 0;
|
2864 | }
|
2865 |
|
2866 | _createClass(Form, [{
|
2867 | key: "getRender",
|
2868 | value: function getRender(field) {
|
2869 | return this.handlers[field].render;
|
2870 | }
|
2871 | }, {
|
2872 | key: "render",
|
2873 | value: function render(vm) {
|
2874 | var _this = this;
|
2875 |
|
2876 | if (!vm.isShow) return;
|
2877 | this.vNode.setVm(vm);
|
2878 |
|
2879 | if (this.cacheUnique !== vm.unique) {
|
2880 | this.renderSort.forEach(function (field) {
|
2881 | _this.getRender(field).clearCache();
|
2882 | });
|
2883 | this.cacheUnique = vm.unique;
|
2884 | }
|
2885 |
|
2886 | this.propsData = this.vData.props(this._fc.options.form).props({
|
2887 | model: this._fc.formData,
|
2888 | rules: this._fc.validate,
|
2889 | key: 'form' + this.unique
|
2890 | }).ref(this.refName).nativeOn({
|
2891 | submit: preventDefault
|
2892 | }).class('form-create', true).key(this.unique).get();
|
2893 | var unique = this.unique,
|
2894 | vn = this.renderSort.map(function (field) {
|
2895 | var render = _this.getRender(field);
|
2896 |
|
2897 | if (render.handler.type === 'hidden') return;
|
2898 | return _this.makeComponent(render);
|
2899 | }).filter(function (val) {
|
2900 | return val !== undefined;
|
2901 | });
|
2902 | if (vn.length > 0) vn.push(this.makeFormBtn(unique));
|
2903 | return this.vNode.form(this.propsData, vn.length > 0 ? [this.vNode.row(extend({
|
2904 | props: this._fc.options.row || {}
|
2905 | }, {
|
2906 | key: 'row' + unique
|
2907 | }), vn)] : []);
|
2908 | }
|
2909 | }, {
|
2910 | key: "makeComponent",
|
2911 | value: function makeComponent(render) {
|
2912 | return this.makeFormItem(render.handler, render.cacheParse(this), "fItem".concat(render.handler.key).concat(this.unique));
|
2913 | }
|
2914 | }, {
|
2915 | key: "makeFormItem",
|
2916 | value: function makeFormItem(_ref, VNodeFn, fItemUnique) {
|
2917 | var type = _ref.type,
|
2918 | rule = _ref.rule,
|
2919 | unique = _ref.unique,
|
2920 | field = _ref.field,
|
2921 | refName = _ref.refName;
|
2922 | var labelWidth = !isComponent(type) && !rule.col.labelWidth && !rule.title ? 1 : rule.col.labelWidth;
|
2923 | labelWidth = isNumeric(labelWidth) ? labelWidth + 'px' : labelWidth;
|
2924 | var className = rule.className,
|
2925 | propsData = this.vData.props({
|
2926 | prop: field,
|
2927 | label: rule.title,
|
2928 | labelFor: unique,
|
2929 | rules: rule.validate,
|
2930 | labelWidth: labelWidth,
|
2931 | required: rule.props.required
|
2932 | }).key(fItemUnique).ref('fItem' + refName).class(className).get(),
|
2933 | node = this.vNode.formItem(propsData, VNodeFn);
|
2934 | return this.propsData.props.inline === true ? [node] : this.makeCol(rule, fItemUnique, [node]);
|
2935 | }
|
2936 | }, {
|
2937 | key: "makeCol",
|
2938 | value: function makeCol(rule, fItemUnique, VNodeFn) {
|
2939 | return this.vNode.col({
|
2940 | props: rule.col,
|
2941 | 'class': {
|
2942 | '__fc_h': rule.props.hidden === true,
|
2943 | '__fc_v': rule.props.visibility === true
|
2944 | },
|
2945 | key: "".concat(fItemUnique, "col1")
|
2946 | }, VNodeFn);
|
2947 | }
|
2948 | }, {
|
2949 | key: "makeFormBtn",
|
2950 | value: function makeFormBtn(unique) {
|
2951 | var btn = [],
|
2952 | submitBtnShow = false !== this.vm.buttonProps && false !== this.vm.buttonProps.show,
|
2953 | resetBtnShow = false !== this.vm.resetProps && false !== this.vm.resetProps.show;
|
2954 | if (submitBtnShow) btn.push(this.makeSubmitBtn(unique, resetBtnShow ? 19 : 24));
|
2955 | if (resetBtnShow) btn.push(this.makeResetBtn(unique, 4));
|
2956 | return this.vNode.col({
|
2957 | props: {
|
2958 | span: 24
|
2959 | },
|
2960 | key: "".concat(this.unique, "col2")
|
2961 | }, btn);
|
2962 | }
|
2963 | }, {
|
2964 | key: "makeResetBtn",
|
2965 | value: function makeResetBtn(unique, span) {
|
2966 | var _this2 = this;
|
2967 |
|
2968 | var resetBtn = this._fc.options.resetBtn,
|
2969 | props = isUndef(this._fc.options.resetBtn.col) ? {
|
2970 | span: span,
|
2971 | push: 1
|
2972 | } : resetBtn.col;
|
2973 | return this.vNode.col({
|
2974 | props: props,
|
2975 | key: "".concat(this.unique, "col3")
|
2976 | }, [this.vNode.button({
|
2977 | key: "frsbtn".concat(unique),
|
2978 | props: this.vm.resetProps,
|
2979 | on: {
|
2980 | "click": function click() {
|
2981 | var fApi = _this2._fc.fCreateApi;
|
2982 | isFunction(resetBtn.click) ? resetBtn.click(fApi) : fApi.resetFields();
|
2983 | }
|
2984 | },
|
2985 | style: {
|
2986 | width: this.vm.resetProps.width
|
2987 | }
|
2988 | }, [this.vm.resetProps.innerText])]);
|
2989 | }
|
2990 | }, {
|
2991 | key: "makeSubmitBtn",
|
2992 | value: function makeSubmitBtn(unique, span) {
|
2993 | var _this3 = this;
|
2994 |
|
2995 | var submitBtn = this._fc.options.submitBtn,
|
2996 | props = isUndef(this._fc.options.submitBtn.col) ? {
|
2997 | span: span
|
2998 | } : submitBtn.col;
|
2999 | return this.vNode.col({
|
3000 | props: props,
|
3001 | key: "".concat(this.unique, "col4")
|
3002 | }, [this.vNode.button({
|
3003 | key: "fbtn".concat(unique),
|
3004 | props: this.vm.buttonProps,
|
3005 | on: {
|
3006 | "click": function click() {
|
3007 | var fApi = _this3._fc.fCreateApi;
|
3008 | isFunction(submitBtn.click) ? submitBtn.click(fApi) : fApi.submit();
|
3009 | }
|
3010 | },
|
3011 | style: {
|
3012 | width: this.vm.resetProps.width
|
3013 | }
|
3014 | }, [this.vm.buttonProps.innerText])]);
|
3015 | }
|
3016 | }]);
|
3017 |
|
3018 | return Form;
|
3019 | }();
|
3020 |
|
3021 | function baseRule() {
|
3022 | return {
|
3023 | event: {},
|
3024 | validate: [],
|
3025 | options: [],
|
3026 | col: {},
|
3027 | children: [],
|
3028 | emit: [],
|
3029 | template: null,
|
3030 | emitPrefix: null
|
3031 | };
|
3032 | }
|
3033 | function creatorFactory(name) {
|
3034 | return function (title, field, value) {
|
3035 | var props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
3036 | return new Creator(name, title, field, value, props);
|
3037 | };
|
3038 | }
|
3039 | function creatorTypeFactory(name, type) {
|
3040 | var typeName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'type';
|
3041 | return function (title, field, value) {
|
3042 | var props = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
3043 | var maker = new Creator(name, title, field, value, props);
|
3044 | if (isFunction(type)) type(maker);else maker.props(typeName, type);
|
3045 | return maker;
|
3046 | };
|
3047 | }
|
3048 |
|
3049 | var Creator = function (_VData) {
|
3050 | _inherits(Creator, _VData);
|
3051 |
|
3052 | function Creator(type, title, field, value) {
|
3053 | var _this;
|
3054 |
|
3055 | var props = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
3056 |
|
3057 | _classCallCheck(this, Creator);
|
3058 |
|
3059 | _this = _possibleConstructorReturn(this, _getPrototypeOf(Creator).call(this));
|
3060 | _this.rule = extend(baseRule(), {
|
3061 | type: type,
|
3062 | title: title,
|
3063 | field: field,
|
3064 | value: value
|
3065 | });
|
3066 |
|
3067 | _this.props({
|
3068 | hidden: false,
|
3069 | visibility: false
|
3070 | });
|
3071 |
|
3072 | if (isPlainObject(props)) _this.props(props);
|
3073 | return _this;
|
3074 | }
|
3075 |
|
3076 | _createClass(Creator, [{
|
3077 | key: "type",
|
3078 | value: function type(_type) {
|
3079 | this.props('type', _type);
|
3080 | return this;
|
3081 | }
|
3082 | }, {
|
3083 | key: "get",
|
3084 | value: function get() {
|
3085 | return this._data;
|
3086 | }
|
3087 | }, {
|
3088 | key: "getRule",
|
3089 | value: function getRule() {
|
3090 | return extend(this.rule, this.get());
|
3091 | }
|
3092 | }, {
|
3093 | key: "setValue",
|
3094 | value: function setValue(value) {
|
3095 | $set(this.rule, 'value', value);
|
3096 | return this;
|
3097 | }
|
3098 | }]);
|
3099 |
|
3100 | return Creator;
|
3101 | }(VData);
|
3102 | var keyAttrs = ['emitPrefix', 'className', 'defaultSlot'];
|
3103 | keyAttrs.forEach(function (attr) {
|
3104 | Creator.prototype[attr] = function (value) {
|
3105 | $set(this.rule, attr, value);
|
3106 | return this;
|
3107 | };
|
3108 | });
|
3109 | var objAttrs = ['event', 'col'];
|
3110 | objAttrs.forEach(function (attr) {
|
3111 | Creator.prototype[attr] = function (opt) {
|
3112 | $set(this.rule, attr, extend(this.rule[attr], opt));
|
3113 | return this;
|
3114 | };
|
3115 | });
|
3116 | var arrAttrs = ['validate', 'options', 'children', 'emit'];
|
3117 | arrAttrs.forEach(function (attr) {
|
3118 | Creator.prototype[attr] = function (opt) {
|
3119 | if (!Array.isArray(opt)) opt = [opt];
|
3120 | $set(this.rule, attr, this.rule[attr].concat(opt));
|
3121 | return this;
|
3122 | };
|
3123 | });
|
3124 |
|
3125 | var name = "hidden";
|
3126 |
|
3127 | var render = function (_Render) {
|
3128 | _inherits(render, _Render);
|
3129 |
|
3130 | function render() {
|
3131 | _classCallCheck(this, render);
|
3132 |
|
3133 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
3134 | }
|
3135 |
|
3136 | _createClass(render, [{
|
3137 | key: "parse",
|
3138 | value: function parse() {
|
3139 | return [];
|
3140 | }
|
3141 | }]);
|
3142 |
|
3143 | return render;
|
3144 | }(Render);
|
3145 |
|
3146 | var maker = _defineProperty({}, name, function (field, value) {
|
3147 | return creatorFactory(name)('', field, value);
|
3148 | });
|
3149 |
|
3150 | var hidden = {
|
3151 | handler: Handler,
|
3152 | render: render,
|
3153 | name: name,
|
3154 | maker: maker
|
3155 | };
|
3156 |
|
3157 | var handler = function (_Handler) {
|
3158 | _inherits(handler, _Handler);
|
3159 |
|
3160 | function handler() {
|
3161 | _classCallCheck(this, handler);
|
3162 |
|
3163 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3164 | }
|
3165 |
|
3166 | _createClass(handler, [{
|
3167 | key: "init",
|
3168 | value: function init() {
|
3169 | var props = this.rule.props;
|
3170 | if (isUndef(props.disabled)) $set(props, 'disabled', false);
|
3171 | }
|
3172 | }, {
|
3173 | key: "toFormValue",
|
3174 | value: function toFormValue(value) {
|
3175 | if (!value) value = [];else if (!Array.isArray(value)) value = [value];
|
3176 | return this.rule.options.filter(function (opt) {
|
3177 | return value.indexOf(opt.value) !== -1;
|
3178 | }).map(function (option) {
|
3179 | return option.label;
|
3180 | });
|
3181 | }
|
3182 | }, {
|
3183 | key: "toValue",
|
3184 | value: function toValue(parseValue) {
|
3185 | var value = this.rule.options.filter(function (opt) {
|
3186 | return parseValue.indexOf(opt.label) !== -1;
|
3187 | }).map(function (opt) {
|
3188 | return opt.value;
|
3189 | });
|
3190 | if (this.rule.options.length === 1) return value[0] === undefined ? '' : value[0];else return value;
|
3191 | }
|
3192 | }, {
|
3193 | key: "watchFormValue",
|
3194 | value: function watchFormValue(n) {
|
3195 | _get(_getPrototypeOf(handler.prototype), "watchFormValue", this).call(this, n);
|
3196 |
|
3197 | this.render.sync();
|
3198 | }
|
3199 | }]);
|
3200 |
|
3201 | return handler;
|
3202 | }(Handler);
|
3203 |
|
3204 | var render$1 = function (_Render) {
|
3205 | _inherits(render, _Render);
|
3206 |
|
3207 | function render() {
|
3208 | _classCallCheck(this, render);
|
3209 |
|
3210 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
3211 | }
|
3212 |
|
3213 | _createClass(render, [{
|
3214 | key: "parse",
|
3215 | value: function parse() {
|
3216 | var _this = this;
|
3217 |
|
3218 | var _this$handler = this.handler,
|
3219 | unique = _this$handler.unique,
|
3220 | _this$handler$rule = _this$handler.rule,
|
3221 | options = _this$handler$rule.options,
|
3222 | props = _this$handler$rule.props,
|
3223 | key = _this$handler.key;
|
3224 | return [this.vNode.checkboxGroup(this.inputProps().key(key).get(), function () {
|
3225 | return options.map(function (option, index) {
|
3226 | var clone = _objectSpread({}, option),
|
3227 | isBtn = props.type === 'button';
|
3228 |
|
3229 | delete clone.value;
|
3230 | return _this.vNode[isBtn ? 'checkboxBtn' : 'checkbox']({
|
3231 | props: clone,
|
3232 | key: (isBtn ? 'b' : 'i') + "copt".concat(index).concat(unique)
|
3233 | });
|
3234 | });
|
3235 | })];
|
3236 | }
|
3237 | }]);
|
3238 |
|
3239 | return render;
|
3240 | }(Render);
|
3241 |
|
3242 | var name$1 = "checkbox";
|
3243 | var checkbox = {
|
3244 | handler: handler,
|
3245 | render: render$1,
|
3246 | name: name$1
|
3247 | };
|
3248 |
|
3249 | var handler$1 = function (_Handler) {
|
3250 | _inherits(handler, _Handler);
|
3251 |
|
3252 | function handler() {
|
3253 | _classCallCheck(this, handler);
|
3254 |
|
3255 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3256 | }
|
3257 |
|
3258 | _createClass(handler, [{
|
3259 | key: "toFormValue",
|
3260 | value: function toFormValue(value) {
|
3261 | return this.rule.options.filter(function (opt) {
|
3262 | return opt.value === value;
|
3263 | }).reduce(function (initial, opt) {
|
3264 | return opt.label;
|
3265 | }, '');
|
3266 | }
|
3267 | }, {
|
3268 | key: "toValue",
|
3269 | value: function toValue(parseValue) {
|
3270 | return this.rule.options.filter(function (opt) {
|
3271 | return opt.label === parseValue;
|
3272 | }).reduce(function (initial, opt) {
|
3273 | return opt.value;
|
3274 | }, '');
|
3275 | }
|
3276 | }]);
|
3277 |
|
3278 | return handler;
|
3279 | }(Handler);
|
3280 |
|
3281 | var render$2 = function (_Render) {
|
3282 | _inherits(render, _Render);
|
3283 |
|
3284 | function render() {
|
3285 | _classCallCheck(this, render);
|
3286 |
|
3287 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
3288 | }
|
3289 |
|
3290 | _createClass(render, [{
|
3291 | key: "parse",
|
3292 | value: function parse() {
|
3293 | var _this = this;
|
3294 |
|
3295 | var _this$handler = this.handler,
|
3296 | unique = _this$handler.unique,
|
3297 | _this$handler$rule = _this$handler.rule,
|
3298 | options = _this$handler$rule.options,
|
3299 | props = _this$handler$rule.props;
|
3300 | return [this.vNode.radioGroup(this.inputProps().get(), function () {
|
3301 | return options.map(function (option, index) {
|
3302 | var clone = _objectSpread({}, option),
|
3303 | isBtn = props.type === 'button';
|
3304 |
|
3305 | delete clone.value;
|
3306 | return _this.vNode[isBtn ? 'radioBtn' : 'radio']({
|
3307 | props: clone,
|
3308 | key: (isBtn ? 'b' : 'i') + "ropt".concat(index).concat(unique)
|
3309 | });
|
3310 | });
|
3311 | })];
|
3312 | }
|
3313 | }]);
|
3314 |
|
3315 | return render;
|
3316 | }(Render);
|
3317 |
|
3318 | var name$2 = "radio";
|
3319 | var radio = {
|
3320 | handler: handler$1,
|
3321 | render: render$2,
|
3322 | name: name$2
|
3323 | };
|
3324 |
|
3325 | var handler$2 = function (_Handler) {
|
3326 | _inherits(handler, _Handler);
|
3327 |
|
3328 | function handler() {
|
3329 | _classCallCheck(this, handler);
|
3330 |
|
3331 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3332 | }
|
3333 |
|
3334 | _createClass(handler, [{
|
3335 | key: "init",
|
3336 | value: function init() {
|
3337 | var props = this.rule.props;
|
3338 | if (props.autosize && props.autosize.minRows) $set(props, 'rows', props.autosize.minRows || 2);
|
3339 | }
|
3340 | }, {
|
3341 | key: "toFormValue",
|
3342 | value: function toFormValue(v) {
|
3343 | return toString$1(v);
|
3344 | }
|
3345 | }]);
|
3346 |
|
3347 | return handler;
|
3348 | }(Handler);
|
3349 |
|
3350 | var name$3 = "input";
|
3351 | var maker$1 = ['password', 'url', 'email', 'text', 'textarea'].reduce(function (initial, type) {
|
3352 | initial[type] = creatorTypeFactory(name$3, type);
|
3353 | return initial;
|
3354 | }, {});
|
3355 | maker$1.idate = creatorTypeFactory(name$3, 'date');
|
3356 | var render$3 = defaultRenderFactory(name$3);
|
3357 | var input = {
|
3358 | handler: handler$2,
|
3359 | render: render$3,
|
3360 | name: name$3,
|
3361 | maker: maker$1
|
3362 | };
|
3363 |
|
3364 | var handler$3 = function (_Handler) {
|
3365 | _inherits(handler, _Handler);
|
3366 |
|
3367 | function handler() {
|
3368 | _classCallCheck(this, handler);
|
3369 |
|
3370 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3371 | }
|
3372 |
|
3373 | _createClass(handler, [{
|
3374 | key: "init",
|
3375 | value: function init() {
|
3376 | var rule = this.rule;
|
3377 | if (!Array.isArray(rule.data)) $set(rule, 'data', []);
|
3378 | }
|
3379 | }, {
|
3380 | key: "watchFormValue",
|
3381 | value: function watchFormValue(n) {
|
3382 | _get(_getPrototypeOf(handler.prototype), "watchFormValue", this).call(this, n);
|
3383 |
|
3384 | this.render.sync();
|
3385 | }
|
3386 | }]);
|
3387 |
|
3388 | return handler;
|
3389 | }(Handler);
|
3390 |
|
3391 | var name$4 = 'autoComplete';
|
3392 | var maker$2 = {
|
3393 | auto: creatorFactory(name$4)
|
3394 | };
|
3395 | var render$4 = defaultRenderFactory(name$4, true);
|
3396 | var autocomplete = {
|
3397 | handler: handler$3,
|
3398 | render: render$4,
|
3399 | name: name$4,
|
3400 | maker: maker$2
|
3401 | };
|
3402 |
|
3403 |
|
3404 |
|
3405 | var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
3406 |
|
3407 | var whitespace = '[' + whitespaces + ']';
|
3408 | var ltrim = RegExp('^' + whitespace + whitespace + '*');
|
3409 | var rtrim = RegExp(whitespace + whitespace + '*$');
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 | var stringTrim = function (string, TYPE) {
|
3415 | string = String(requireObjectCoercible(string));
|
3416 | if (TYPE & 1) string = string.replace(ltrim, '');
|
3417 | if (TYPE & 2) string = string.replace(rtrim, '');
|
3418 | return string;
|
3419 | };
|
3420 |
|
3421 | var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
3422 | anObject(O);
|
3423 | var keys = objectKeys(Properties);
|
3424 | var length = keys.length;
|
3425 | var i = 0;
|
3426 | var key;
|
3427 | while (length > i) objectDefineProperty.f(O, key = keys[i++], Properties[key]);
|
3428 | return O;
|
3429 | };
|
3430 |
|
3431 | var document$2 = global$1.document;
|
3432 |
|
3433 | var html = document$2 && document$2.documentElement;
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 | var IE_PROTO = sharedKey('IE_PROTO');
|
3442 | var PROTOTYPE = 'prototype';
|
3443 | var Empty = function () { };
|
3444 |
|
3445 |
|
3446 | var createDict = function () {
|
3447 |
|
3448 | var iframe = documentCreateElement('iframe');
|
3449 | var length = enumBugKeys.length;
|
3450 | var lt = '<';
|
3451 | var script = 'script';
|
3452 | var gt = '>';
|
3453 | var js = 'java' + script + ':';
|
3454 | var iframeDocument;
|
3455 | iframe.style.display = 'none';
|
3456 | html.appendChild(iframe);
|
3457 | iframe.src = String(js);
|
3458 | iframeDocument = iframe.contentWindow.document;
|
3459 | iframeDocument.open();
|
3460 | iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
|
3461 | iframeDocument.close();
|
3462 | createDict = iframeDocument.F;
|
3463 | while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
3464 | return createDict();
|
3465 | };
|
3466 |
|
3467 | var objectCreate = Object.create || function create(O, Properties) {
|
3468 | var result;
|
3469 | if (O !== null) {
|
3470 | Empty[PROTOTYPE] = anObject(O);
|
3471 | result = new Empty();
|
3472 | Empty[PROTOTYPE] = null;
|
3473 |
|
3474 | result[IE_PROTO] = O;
|
3475 | } else result = createDict();
|
3476 | return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
3477 | };
|
3478 |
|
3479 | hiddenKeys[IE_PROTO] = true;
|
3480 |
|
3481 | var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
|
3482 | var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
3483 | var defineProperty$1 = objectDefineProperty.f;
|
3484 |
|
3485 | var NUMBER = 'Number';
|
3486 | var NativeNumber = global$1[NUMBER];
|
3487 | var NumberPrototype = NativeNumber.prototype;
|
3488 |
|
3489 |
|
3490 | var BROKEN_CLASSOF = classofRaw(objectCreate(NumberPrototype)) == NUMBER;
|
3491 | var NATIVE_TRIM = 'trim' in String.prototype;
|
3492 |
|
3493 |
|
3494 |
|
3495 | var toNumber = function (argument) {
|
3496 | var it = toPrimitive(argument, false);
|
3497 | var first, third, radix, maxCode, digits, length, i, code;
|
3498 | if (typeof it == 'string' && it.length > 2) {
|
3499 | it = NATIVE_TRIM ? it.trim() : stringTrim(it, 3);
|
3500 | first = it.charCodeAt(0);
|
3501 | if (first === 43 || first === 45) {
|
3502 | third = it.charCodeAt(2);
|
3503 | if (third === 88 || third === 120) return NaN;
|
3504 | } else if (first === 48) {
|
3505 | switch (it.charCodeAt(1)) {
|
3506 | case 66: case 98: radix = 2; maxCode = 49; break;
|
3507 | case 79: case 111: radix = 8; maxCode = 55; break;
|
3508 | default: return +it;
|
3509 | }
|
3510 | digits = it.slice(2);
|
3511 | length = digits.length;
|
3512 | for (i = 0; i < length; i++) {
|
3513 | code = digits.charCodeAt(i);
|
3514 |
|
3515 |
|
3516 | if (code < 48 || code > maxCode) return NaN;
|
3517 | } return parseInt(digits, radix);
|
3518 | }
|
3519 | } return +it;
|
3520 | };
|
3521 |
|
3522 |
|
3523 |
|
3524 | if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
|
3525 | var NumberWrapper = function Number(value) {
|
3526 | var it = arguments.length < 1 ? 0 : value;
|
3527 | var that = this;
|
3528 | return that instanceof NumberWrapper
|
3529 |
|
3530 | && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(that); }) : classofRaw(that) != NUMBER)
|
3531 | ? inheritIfRequired(new NativeNumber(toNumber(it)), that, NumberWrapper) : toNumber(it);
|
3532 | };
|
3533 | for (var keys$1 = descriptors ? getOwnPropertyNames$1(NativeNumber) : (
|
3534 |
|
3535 | 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
|
3536 |
|
3537 | 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
|
3538 | 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
|
3539 | ).split(','), j = 0, key; keys$1.length > j; j++) {
|
3540 | if (has(NativeNumber, key = keys$1[j]) && !has(NumberWrapper, key)) {
|
3541 | defineProperty$1(NumberWrapper, key, getOwnPropertyDescriptor$1(NativeNumber, key));
|
3542 | }
|
3543 | }
|
3544 | NumberWrapper.prototype = NumberPrototype;
|
3545 | NumberPrototype.constructor = NumberWrapper;
|
3546 | redefine(global$1, NUMBER, NumberWrapper);
|
3547 | }
|
3548 |
|
3549 |
|
3550 |
|
3551 | _export({ target: 'Number', stat: true }, {
|
3552 | isNaN: function isNaN(number) {
|
3553 |
|
3554 | return number != number;
|
3555 | }
|
3556 | });
|
3557 |
|
3558 | var handler$4 = function (_Handler) {
|
3559 | _inherits(handler, _Handler);
|
3560 |
|
3561 | function handler() {
|
3562 | _classCallCheck(this, handler);
|
3563 |
|
3564 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3565 | }
|
3566 |
|
3567 | _createClass(handler, [{
|
3568 | key: "toFormValue",
|
3569 | value: function toFormValue(value) {
|
3570 | var parseValue = parseFloat(value);
|
3571 | if (Number.isNaN(parseValue)) parseValue = 0;
|
3572 | return parseValue;
|
3573 | }
|
3574 | }]);
|
3575 |
|
3576 | return handler;
|
3577 | }(Handler);
|
3578 |
|
3579 | var name$5 = "inputNumber";
|
3580 | var maker$3 = {
|
3581 | number: creatorFactory(name$5)
|
3582 | };
|
3583 | var render$5 = defaultRenderFactory(name$5);
|
3584 | var inputnumber = {
|
3585 | handler: handler$4,
|
3586 | render: render$5,
|
3587 | name: name$5,
|
3588 | maker: maker$3
|
3589 | };
|
3590 |
|
3591 | var handler$5 = function (_Handler) {
|
3592 | _inherits(handler, _Handler);
|
3593 |
|
3594 | function handler() {
|
3595 | _classCallCheck(this, handler);
|
3596 |
|
3597 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3598 | }
|
3599 |
|
3600 | _createClass(handler, [{
|
3601 | key: "toFormValue",
|
3602 | value: function toFormValue(value) {
|
3603 | var isArr = Array.isArray(value);
|
3604 | if (this.rule.props.multiple === true) return isArr === true ? value : [value];else return isArr === true ? value[0] || '' : value;
|
3605 | }
|
3606 | }, {
|
3607 | key: "watchFormValue",
|
3608 | value: function watchFormValue(n) {
|
3609 | _get(_getPrototypeOf(handler.prototype), "watchFormValue", this).call(this, n);
|
3610 |
|
3611 | this.render.sync();
|
3612 | }
|
3613 | }]);
|
3614 |
|
3615 | return handler;
|
3616 | }(Handler);
|
3617 |
|
3618 | var render$6 = function (_Render) {
|
3619 | _inherits(render, _Render);
|
3620 |
|
3621 | function render() {
|
3622 | _classCallCheck(this, render);
|
3623 |
|
3624 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
3625 | }
|
3626 |
|
3627 | _createClass(render, [{
|
3628 | key: "parse",
|
3629 | value: function parse() {
|
3630 | var _this = this;
|
3631 |
|
3632 | var _this$handler = this.handler,
|
3633 | unique = _this$handler.unique,
|
3634 | rule = _this$handler.rule;
|
3635 | return [this.vNode.select(this.inputProps().get(), function () {
|
3636 | return rule.options.map(function (option, index) {
|
3637 | return _this.vNode.option({
|
3638 | props: option,
|
3639 | key: "sopt".concat(index).concat(unique)
|
3640 | }, toDefSlot(option.slot, _this.vm.$createElement, rule));
|
3641 | });
|
3642 | })];
|
3643 | }
|
3644 | }]);
|
3645 |
|
3646 | return render;
|
3647 | }(Render);
|
3648 |
|
3649 | var name$6 = "select";
|
3650 | var maker$4 = {
|
3651 | selectMultiple: creatorTypeFactory(name$6, true, 'multiple'),
|
3652 | selectOne: creatorTypeFactory(name$6, false, 'multiple')
|
3653 | };
|
3654 | var select = {
|
3655 | handler: handler$5,
|
3656 | render: render$6,
|
3657 | name: name$6,
|
3658 | maker: maker$4
|
3659 | };
|
3660 |
|
3661 | var handler$6 = function (_Handler) {
|
3662 | _inherits(handler, _Handler);
|
3663 |
|
3664 | function handler() {
|
3665 | _classCallCheck(this, handler);
|
3666 |
|
3667 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3668 | }
|
3669 |
|
3670 | _createClass(handler, [{
|
3671 | key: "init",
|
3672 | value: function init() {
|
3673 | var rule = this.rule;
|
3674 | if (!rule.props.data) $set(rule.props, 'data', []);
|
3675 | if (!rule.props.options) $set(rule.props, 'options', []);
|
3676 | if (!Array.isArray(this.rule.value)) $set(rule, 'value', []);
|
3677 | }
|
3678 | }, {
|
3679 | key: "toFormValue",
|
3680 | value: function toFormValue(value) {
|
3681 | return Array.isArray(value) ? value : [];
|
3682 | }
|
3683 | }, {
|
3684 | key: "mounted",
|
3685 | value: function mounted() {
|
3686 | _get(_getPrototypeOf(handler.prototype), "mounted", this).call(this);
|
3687 |
|
3688 | this.vm._changeFormData(this.field, this.toFormValue(this.el.value));
|
3689 | }
|
3690 | }]);
|
3691 |
|
3692 | return handler;
|
3693 | }(Handler);
|
3694 |
|
3695 | var name$7 = 'cascader';
|
3696 | var render$7 = defaultRenderFactory(name$7);
|
3697 | var cascader = {
|
3698 | handler: handler$6,
|
3699 | render: render$7,
|
3700 | name: name$7
|
3701 | };
|
3702 |
|
3703 | var handler$7 = function (_Handler) {
|
3704 | _inherits(handler, _Handler);
|
3705 |
|
3706 | function handler() {
|
3707 | _classCallCheck(this, handler);
|
3708 |
|
3709 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3710 | }
|
3711 |
|
3712 | _createClass(handler, [{
|
3713 | key: "init",
|
3714 | value: function init() {
|
3715 | var rule = this.rule;
|
3716 | $set(rule.props, 'min', rule.props.min === undefined ? 0 : parseFloat(rule.props.min) || 0);
|
3717 | }
|
3718 | }, {
|
3719 | key: "toFormValue",
|
3720 | value: function toFormValue(value) {
|
3721 | var rule = this.rule,
|
3722 | isArr = Array.isArray(value),
|
3723 | props = rule.props,
|
3724 | min = props.min,
|
3725 | parseValue;
|
3726 |
|
3727 | if (props.range === true) {
|
3728 | parseValue = isArr ? value : [min, parseFloat(value) || min];
|
3729 | } else {
|
3730 | parseValue = isArr ? parseFloat(value[0]) || min : parseFloat(value);
|
3731 | }
|
3732 |
|
3733 | return parseValue;
|
3734 | }
|
3735 | }]);
|
3736 |
|
3737 | return handler;
|
3738 | }(Handler);
|
3739 |
|
3740 | var name$8 = "slider";
|
3741 | var maker$5 = {
|
3742 | sliderRange: creatorTypeFactory(name$8, true, 'range')
|
3743 | };
|
3744 | var render$8 = defaultRenderFactory(name$8);
|
3745 | var slider = {
|
3746 | handler: handler$7,
|
3747 | render: render$8,
|
3748 | name: name$8,
|
3749 | maker: maker$5
|
3750 | };
|
3751 |
|
3752 | function getTime(date) {
|
3753 | return isDate(date) ? dateFormat('hh:mm:ss', date) : date;
|
3754 | }
|
3755 | function toDate(time) {
|
3756 | return new Date('2018-02-14 ' + time);
|
3757 | }
|
3758 |
|
3759 | var handler$8 = function (_Handler) {
|
3760 | _inherits(handler, _Handler);
|
3761 |
|
3762 | function handler() {
|
3763 | _classCallCheck(this, handler);
|
3764 |
|
3765 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3766 | }
|
3767 |
|
3768 | _createClass(handler, [{
|
3769 | key: "init",
|
3770 | value: function init() {
|
3771 | var props = this.rule.props;
|
3772 | if (!props.type) $set(props, 'type', 'time');
|
3773 | }
|
3774 | }, {
|
3775 | key: "toFormValue",
|
3776 | value: function toFormValue(value) {
|
3777 | var parseValue,
|
3778 | isArr = Array.isArray(value);
|
3779 |
|
3780 | if (this.rule.props.isRange === true) {
|
3781 | if (isArr && value.length === 2) {
|
3782 | parseValue = value.map(function (time) {
|
3783 | return !time ? '' : getTime(timeStampToDate(time));
|
3784 | });
|
3785 | } else {
|
3786 | parseValue = '';
|
3787 | }
|
3788 | } else {
|
3789 | isArr && (value = value[0]);
|
3790 | parseValue = !value ? '' : getTime(timeStampToDate(value));
|
3791 | }
|
3792 |
|
3793 | return Array.isArray(parseValue) ? parseValue.map(function (time) {
|
3794 | return !time ? '' : toDate(time);
|
3795 | }) : !parseValue ? '' : toDate(parseValue);
|
3796 | }
|
3797 | }, {
|
3798 | key: "toValue",
|
3799 | value: function toValue(n) {
|
3800 | var val = this.el.formatToString(n);
|
3801 | if (this.rule.props.isRange === true && !val) val = ['', ''];
|
3802 | return val;
|
3803 | }
|
3804 | }, {
|
3805 | key: "mounted",
|
3806 | value: function mounted() {
|
3807 | _get(_getPrototypeOf(handler.prototype), "mounted", this).call(this);
|
3808 |
|
3809 | this.rule.value = this.el.displayValue;
|
3810 |
|
3811 | this.vm._changeFormData(this.field, this.toFormValue(this.el.displayValue));
|
3812 | }
|
3813 | }]);
|
3814 |
|
3815 | return handler;
|
3816 | }(Handler);
|
3817 |
|
3818 | function getTime$1(date) {
|
3819 | return isDate(date) ? dateFormat('hh:mm:ss', date) : date;
|
3820 | }
|
3821 |
|
3822 | var handler$9 = function (_Handler) {
|
3823 | _inherits(handler, _Handler);
|
3824 |
|
3825 | function handler() {
|
3826 | _classCallCheck(this, handler);
|
3827 |
|
3828 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3829 | }
|
3830 |
|
3831 | _createClass(handler, [{
|
3832 | key: "init",
|
3833 | value: function init() {
|
3834 | var props = this.rule.props;
|
3835 | if (!props.type) $set(props, 'type', 'time');
|
3836 | if (isUndef(props.confirm)) $set(props, 'confirm', true);
|
3837 | }
|
3838 | }, {
|
3839 | key: "toFormValue",
|
3840 | value: function toFormValue(value) {
|
3841 | var parseValue,
|
3842 | isArr = Array.isArray(value);
|
3843 |
|
3844 | if ('timerange' === this.rule.props.type) {
|
3845 | if (isArr) {
|
3846 | parseValue = value.map(function (time) {
|
3847 | return !time ? '' : getTime$1(timeStampToDate(time));
|
3848 | });
|
3849 | } else {
|
3850 | parseValue = ['', ''];
|
3851 | }
|
3852 | } else {
|
3853 | isArr && (value = value[0]);
|
3854 | parseValue = !value ? '' : getTime$1(timeStampToDate(value));
|
3855 | }
|
3856 |
|
3857 | return parseValue;
|
3858 | }
|
3859 | }, {
|
3860 | key: "mounted",
|
3861 | value: function mounted() {
|
3862 | _get(_getPrototypeOf(handler.prototype), "mounted", this).call(this);
|
3863 |
|
3864 | this.rule.value = this.el.publicStringValue;
|
3865 |
|
3866 | this.vm._changeFormData(this.field, this.toFormValue(this.el.publicStringValue));
|
3867 | }
|
3868 | }]);
|
3869 |
|
3870 | return handler;
|
3871 | }(Handler);
|
3872 |
|
3873 | var name$9 = "timePicker";
|
3874 | var render$9 = defaultRenderFactory(name$9, true);
|
3875 |
|
3876 | var name$a = "timePicker";
|
3877 | var maker$7 = {
|
3878 | time: creatorTypeFactory(name$a, function (m) {
|
3879 | return m.props.isRange = false;
|
3880 | }),
|
3881 | timeRange: creatorTypeFactory(name$a, function (m) {
|
3882 | return m.props.isRange = true;
|
3883 | })
|
3884 | };
|
3885 | var timepicker = {
|
3886 | handler: handler$8,
|
3887 | render: render$9,
|
3888 | name: name$a,
|
3889 | maker: maker$7
|
3890 | };
|
3891 |
|
3892 | var handler$a = function (_Handler) {
|
3893 | _inherits(handler, _Handler);
|
3894 |
|
3895 | function handler() {
|
3896 | _classCallCheck(this, handler);
|
3897 |
|
3898 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3899 | }
|
3900 |
|
3901 | _createClass(handler, [{
|
3902 | key: "init",
|
3903 | value: function init() {
|
3904 | var props = this.rule.props;
|
3905 | $set(props, 'type', !props.type ? 'date' : toString$1(props.type).toLowerCase());
|
3906 | }
|
3907 | }, {
|
3908 | key: "toFormValue",
|
3909 | value: function toFormValue(value) {
|
3910 | var isArr = Array.isArray(value),
|
3911 | props = this.rule.props,
|
3912 | parseValue;
|
3913 |
|
3914 | if (['daterange', 'datetimerange', 'dates'].indexOf(props.type) !== -1) {
|
3915 | if (isArr) {
|
3916 | parseValue = value.map(function (time) {
|
3917 | return !time ? '' : timeStampToDate(time);
|
3918 | });
|
3919 | } else {
|
3920 | parseValue = props.type === 'dates' ? [] : ['', ''];
|
3921 | }
|
3922 | } else if ('date' === props.type && props.multiple === true) {
|
3923 | parseValue = toString$1(value);
|
3924 | } else {
|
3925 | parseValue = isArr ? value[0] || '' : value;
|
3926 | parseValue = !parseValue ? '' : timeStampToDate(parseValue);
|
3927 | }
|
3928 |
|
3929 | return parseValue;
|
3930 | }
|
3931 | }, {
|
3932 | key: "toValue",
|
3933 | value: function toValue(n) {
|
3934 | var type = this.rule.props.type,
|
3935 | value = this.el.formatToString(n);
|
3936 | if (!value && ['daterange', 'datetimerange'].indexOf(type) !== -1) return ['', ''];else return value;
|
3937 | }
|
3938 | }, {
|
3939 | key: "mounted",
|
3940 | value: function mounted() {
|
3941 | _get(_getPrototypeOf(handler.prototype), "mounted", this).call(this);
|
3942 |
|
3943 | var value = this.el.formatToString(this.vm._formData(this.field));
|
3944 | this.rule.value = value;
|
3945 | this.setValue(value);
|
3946 | }
|
3947 | }]);
|
3948 |
|
3949 | return handler;
|
3950 | }(Handler);
|
3951 |
|
3952 | var handler$b = function (_Handler) {
|
3953 | _inherits(handler, _Handler);
|
3954 |
|
3955 | function handler() {
|
3956 | _classCallCheck(this, handler);
|
3957 |
|
3958 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
3959 | }
|
3960 |
|
3961 | _createClass(handler, [{
|
3962 | key: "init",
|
3963 | value: function init() {
|
3964 | var props = this.rule.props;
|
3965 | $set(props, 'type', !props.type ? 'date' : toString$1(props.type).toLowerCase());
|
3966 | if (isUndef(props.startDate)) $set(props, 'startDate', timeStampToDate(props.startDate));
|
3967 | }
|
3968 | }, {
|
3969 | key: "toFormValue",
|
3970 | value: function toFormValue(value) {
|
3971 | var isArr = Array.isArray(value),
|
3972 | props = this.rule.props,
|
3973 | parseValue;
|
3974 |
|
3975 | if (['daterange', 'datetimerange'].indexOf(props.type) !== -1) {
|
3976 | if (isArr) {
|
3977 | parseValue = value.map(function (time) {
|
3978 | return !time ? '' : timeStampToDate(time);
|
3979 | });
|
3980 | } else {
|
3981 | parseValue = ['', ''];
|
3982 | }
|
3983 | } else if ('date' === props.type && props.multiple === true) {
|
3984 | parseValue = toString$1(value);
|
3985 | } else {
|
3986 | parseValue = isArr ? value[0] || '' : value;
|
3987 | parseValue = !parseValue ? '' : timeStampToDate(parseValue);
|
3988 | }
|
3989 |
|
3990 | return parseValue;
|
3991 | }
|
3992 | }, {
|
3993 | key: "toValue",
|
3994 | value: function toValue() {
|
3995 | return this.el.publicStringValue;
|
3996 | }
|
3997 | }, {
|
3998 | key: "mounted",
|
3999 | value: function mounted() {
|
4000 | _get(_getPrototypeOf(handler.prototype), "mounted", this).call(this);
|
4001 |
|
4002 | this.rule.value = this.el.publicStringValue;
|
4003 |
|
4004 | this.vm._changeFormData(this.field, this.toFormValue(this.el.publicStringValue));
|
4005 | }
|
4006 | }]);
|
4007 |
|
4008 | return handler;
|
4009 | }(Handler);
|
4010 |
|
4011 | var name$b = "datePicker";
|
4012 | var maker$8 = ['date', 'dateRange', 'dateTime', 'dateTimeRange', 'year', 'month'].reduce(function (initial, type) {
|
4013 | initial[type] = creatorTypeFactory(name$b, type.toLowerCase());
|
4014 | return initial;
|
4015 | }, {});
|
4016 | var render$a = defaultRenderFactory(name$b, true);
|
4017 |
|
4018 | var name$c = "datePicker";
|
4019 | var maker$9 = ['year', 'month', 'date', 'dates', 'week', 'datetime', 'datetimeRange', 'dateRange'].reduce(function (initial, type) {
|
4020 | initial[type] = creatorTypeFactory(name$c, type.toLowerCase());
|
4021 | return initial;
|
4022 | }, {});
|
4023 | var datepicker = {
|
4024 | handler: handler$a,
|
4025 | render: render$a,
|
4026 | name: name$c,
|
4027 | maker: maker$9
|
4028 | };
|
4029 |
|
4030 | var handler$c = function (_Handler) {
|
4031 | _inherits(handler, _Handler);
|
4032 |
|
4033 | function handler() {
|
4034 | _classCallCheck(this, handler);
|
4035 |
|
4036 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
4037 | }
|
4038 |
|
4039 | _createClass(handler, [{
|
4040 | key: "toFormValue",
|
4041 | value: function toFormValue(value) {
|
4042 | var parseValue = parseFloat(value);
|
4043 | if (Number.isNaN(parseValue)) parseValue = 0;
|
4044 | return parseValue;
|
4045 | }
|
4046 | }]);
|
4047 |
|
4048 | return handler;
|
4049 | }(Handler);
|
4050 |
|
4051 | var name$d = "rate";
|
4052 | var render$b = defaultRenderFactory(name$d);
|
4053 | var rate = {
|
4054 | handler: handler$c,
|
4055 | render: render$b,
|
4056 | name: name$d
|
4057 | };
|
4058 |
|
4059 | var handler$d = function (_Handler) {
|
4060 | _inherits(handler, _Handler);
|
4061 |
|
4062 | function handler() {
|
4063 | _classCallCheck(this, handler);
|
4064 |
|
4065 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
4066 | }
|
4067 |
|
4068 | _createClass(handler, [{
|
4069 | key: "watchFormValue",
|
4070 | value: function watchFormValue(n) {
|
4071 | _get(_getPrototypeOf(handler.prototype), "watchFormValue", this).call(this, n);
|
4072 |
|
4073 | this.render.sync();
|
4074 | }
|
4075 | }]);
|
4076 |
|
4077 | return handler;
|
4078 | }(Handler);
|
4079 |
|
4080 | var name$e = "colorPicker";
|
4081 | var maker$a = {
|
4082 | color: creatorFactory(name$e)
|
4083 | };
|
4084 | var render$c = defaultRenderFactory(name$e, true);
|
4085 | var colorpicker = {
|
4086 | handler: handler$d,
|
4087 | render: render$c,
|
4088 | name: name$e,
|
4089 | maker: maker$a
|
4090 | };
|
4091 |
|
4092 | var handler$e = function (_Handler) {
|
4093 | _inherits(handler, _Handler);
|
4094 |
|
4095 | function handler() {
|
4096 | _classCallCheck(this, handler);
|
4097 |
|
4098 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
4099 | }
|
4100 |
|
4101 | _createClass(handler, [{
|
4102 | key: "init",
|
4103 | value: function init() {
|
4104 | var props = this.rule.props;
|
4105 | if (isUndef(props.nodeKey)) $set(props, 'nodeKey', 'id');
|
4106 | if (isUndef(props.props)) $set(props, 'props', {
|
4107 | label: "title"
|
4108 | });
|
4109 | if (isUndef(props.defaultExpandAll)) $set(props, 'defaultExpandAll', true);
|
4110 | }
|
4111 | }, {
|
4112 | key: "toValue",
|
4113 | value: function toValue(parseValue) {
|
4114 | return this.el.getCheckedKeys();
|
4115 | }
|
4116 | }, {
|
4117 | key: "watchValue",
|
4118 | value: function watchValue(n) {
|
4119 | _get(_getPrototypeOf(handler.prototype), "watchValue", this).call(this, n);
|
4120 |
|
4121 | this.updateValue(n);
|
4122 | }
|
4123 | }, {
|
4124 | key: "mounted",
|
4125 | value: function mounted() {
|
4126 | _get(_getPrototypeOf(handler.prototype), "mounted", this).call(this);
|
4127 |
|
4128 | this.updateValue(this.rule.value);
|
4129 | }
|
4130 | }, {
|
4131 | key: "updateValue",
|
4132 | value: function updateValue(n) {
|
4133 | this.el.setCheckedKeys(n);
|
4134 | this.setValue(this.el.getCheckedKeys());
|
4135 | }
|
4136 | }]);
|
4137 |
|
4138 | return handler;
|
4139 | }(Handler);
|
4140 |
|
4141 | var render$d = function (_Render) {
|
4142 | _inherits(render, _Render);
|
4143 |
|
4144 | function render() {
|
4145 | _classCallCheck(this, render);
|
4146 |
|
4147 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
4148 | }
|
4149 |
|
4150 | _createClass(render, [{
|
4151 | key: "parse",
|
4152 | value: function parse() {
|
4153 | var _this = this;
|
4154 |
|
4155 | var _this$handler = this.handler,
|
4156 | rule = _this$handler.rule,
|
4157 | refName = _this$handler.refName,
|
4158 | unique = _this$handler.unique,
|
4159 | props = this.vData.on(rule.event).on({
|
4160 | check: function check() {
|
4161 | var _rule$event;
|
4162 |
|
4163 | _this.handler.setValue(_this.handler.el.getCheckedKeys());
|
4164 |
|
4165 | rule.event['check'] && (_rule$event = rule.event)['check'].apply(_rule$event, arguments);
|
4166 | }
|
4167 | }).props(rule.props).ref(refName).key("fip".concat(unique)).get();
|
4168 | var inputProps = this.inputProps().props({
|
4169 | type: "text",
|
4170 | value: '' + this.handler.rule.value,
|
4171 | disable: true,
|
4172 | readonly: true
|
4173 | }).key('fipit' + unique).class('__fc_h').ref("".concat(refName, "it")).on('input', function () {}).get();
|
4174 | return [this.vNode.tree(props), this.vNode.input(inputProps)];
|
4175 | }
|
4176 | }]);
|
4177 |
|
4178 | return render;
|
4179 | }(Render);
|
4180 |
|
4181 | var name$f = "tree";
|
4182 | var tree = {
|
4183 | handler: handler$e,
|
4184 | render: render$d,
|
4185 | name: name$f
|
4186 | };
|
4187 |
|
4188 | var SPECIES$4 = wellKnownSymbol('species');
|
4189 |
|
4190 |
|
4191 |
|
4192 | var speciesConstructor = function (O, defaultConstructor) {
|
4193 | var C = anObject(O).constructor;
|
4194 | var S;
|
4195 | return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aFunction(S);
|
4196 | };
|
4197 |
|
4198 | var arrayPush = [].push;
|
4199 | var min$4 = Math.min;
|
4200 | var MAX_UINT32 = 0xFFFFFFFF;
|
4201 |
|
4202 |
|
4203 | var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
|
4204 |
|
4205 |
|
4206 | fixRegexpWellKnownSymbolLogic(
|
4207 | 'split',
|
4208 | 2,
|
4209 | function (SPLIT, nativeSplit, maybeCallNative) {
|
4210 | var internalSplit;
|
4211 | if (
|
4212 | 'abbc'.split(/(b)*/)[1] == 'c' ||
|
4213 | 'test'.split(/(?:)/, -1).length != 4 ||
|
4214 | 'ab'.split(/(?:ab)*/).length != 2 ||
|
4215 | '.'.split(/(.?)(.?)/).length != 4 ||
|
4216 | '.'.split(/()()/).length > 1 ||
|
4217 | ''.split(/.?/).length
|
4218 | ) {
|
4219 |
|
4220 | internalSplit = function (separator, limit) {
|
4221 | var string = String(requireObjectCoercible(this));
|
4222 | var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
4223 | if (lim === 0) return [];
|
4224 | if (separator === undefined) return [string];
|
4225 |
|
4226 | if (!isRegexp(separator)) {
|
4227 | return nativeSplit.call(string, separator, lim);
|
4228 | }
|
4229 | var output = [];
|
4230 | var flags = (separator.ignoreCase ? 'i' : '') +
|
4231 | (separator.multiline ? 'm' : '') +
|
4232 | (separator.unicode ? 'u' : '') +
|
4233 | (separator.sticky ? 'y' : '');
|
4234 | var lastLastIndex = 0;
|
4235 |
|
4236 | var separatorCopy = new RegExp(separator.source, flags + 'g');
|
4237 | var match, lastIndex, lastLength;
|
4238 | while (match = regexpExec.call(separatorCopy, string)) {
|
4239 | lastIndex = separatorCopy.lastIndex;
|
4240 | if (lastIndex > lastLastIndex) {
|
4241 | output.push(string.slice(lastLastIndex, match.index));
|
4242 | if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
|
4243 | lastLength = match[0].length;
|
4244 | lastLastIndex = lastIndex;
|
4245 | if (output.length >= lim) break;
|
4246 | }
|
4247 | if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++;
|
4248 | }
|
4249 | if (lastLastIndex === string.length) {
|
4250 | if (lastLength || !separatorCopy.test('')) output.push('');
|
4251 | } else output.push(string.slice(lastLastIndex));
|
4252 | return output.length > lim ? output.slice(0, lim) : output;
|
4253 | };
|
4254 |
|
4255 | } else if ('0'.split(undefined, 0).length) {
|
4256 | internalSplit = function (separator, limit) {
|
4257 | return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
|
4258 | };
|
4259 | } else internalSplit = nativeSplit;
|
4260 |
|
4261 | return [
|
4262 |
|
4263 |
|
4264 | function split(separator, limit) {
|
4265 | var O = requireObjectCoercible(this);
|
4266 | var splitter = separator == undefined ? undefined : separator[SPLIT];
|
4267 | return splitter !== undefined
|
4268 | ? splitter.call(separator, O, limit)
|
4269 | : internalSplit.call(String(O), separator, limit);
|
4270 | },
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 | function (regexp, limit) {
|
4277 | var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
|
4278 | if (res.done) return res.value;
|
4279 |
|
4280 | var rx = anObject(regexp);
|
4281 | var S = String(this);
|
4282 | var C = speciesConstructor(rx, RegExp);
|
4283 |
|
4284 | var unicodeMatching = rx.unicode;
|
4285 | var flags = (rx.ignoreCase ? 'i' : '') +
|
4286 | (rx.multiline ? 'm' : '') +
|
4287 | (rx.unicode ? 'u' : '') +
|
4288 | (SUPPORTS_Y ? 'y' : 'g');
|
4289 |
|
4290 |
|
4291 |
|
4292 | var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
|
4293 | var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
|
4294 | if (lim === 0) return [];
|
4295 | if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
|
4296 | var p = 0;
|
4297 | var q = 0;
|
4298 | var A = [];
|
4299 | while (q < S.length) {
|
4300 | splitter.lastIndex = SUPPORTS_Y ? q : 0;
|
4301 | var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
|
4302 | var e;
|
4303 | if (
|
4304 | z === null ||
|
4305 | (e = min$4(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
|
4306 | ) {
|
4307 | q = advanceStringIndex(S, q, unicodeMatching);
|
4308 | } else {
|
4309 | A.push(S.slice(p, q));
|
4310 | if (A.length === lim) return A;
|
4311 | for (var i = 1; i <= z.length - 1; i++) {
|
4312 | A.push(z[i]);
|
4313 | if (A.length === lim) return A;
|
4314 | }
|
4315 | q = p = e;
|
4316 | }
|
4317 | }
|
4318 | A.push(S.slice(p));
|
4319 | return A;
|
4320 | }
|
4321 | ];
|
4322 | },
|
4323 | !SUPPORTS_Y
|
4324 | );
|
4325 |
|
4326 | function getFileName(pic) {
|
4327 | return toString$1(pic).split('/').pop();
|
4328 | }
|
4329 | function parseValue(value) {
|
4330 | return Array.isArray(value) ? value : !value ? [] : [value];
|
4331 | }
|
4332 |
|
4333 | var handler$f = function (_Handler) {
|
4334 | _inherits(handler, _Handler);
|
4335 |
|
4336 | function handler() {
|
4337 | _classCallCheck(this, handler);
|
4338 |
|
4339 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
4340 | }
|
4341 |
|
4342 | _createClass(handler, [{
|
4343 | key: "init",
|
4344 | value: function init() {
|
4345 | this.parseValue = [];
|
4346 | var props = this.rule.props;
|
4347 | props.fileList = [];
|
4348 | props.showFileList = false;
|
4349 | if (isUndef(props.uploadType)) $set(props, 'uploadType', 'file');
|
4350 | if (!props.modalTitle) $set(props, 'modalTitle', '预览');
|
4351 | if (props.uploadType === 'file' && isUndef(props.handleIcon)) $set(props, 'handleIcon', false);
|
4352 | $set(this.rule, 'value', parseValue(this.rule.value));
|
4353 | }
|
4354 | }, {
|
4355 | key: "toFormValue",
|
4356 | value: function toFormValue(value) {
|
4357 | var _this = this;
|
4358 |
|
4359 | var files = parseValue(value);
|
4360 | this.parseValue.splice(0, this.parseValue.length);
|
4361 | files.forEach(function (file) {
|
4362 | return _this.push(file);
|
4363 | });
|
4364 | $set(this.rule.props, 'fileList', this.parseValue);
|
4365 | return this.parseValue;
|
4366 | }
|
4367 | }, {
|
4368 | key: "mounted",
|
4369 | value: function mounted() {
|
4370 | _get(_getPrototypeOf(handler.prototype), "mounted", this).call(this);
|
4371 |
|
4372 | $set(this.rule.props, 'fileList', this.parseValue);
|
4373 | this.changeParseValue(this.el.uploadFiles || []);
|
4374 | }
|
4375 | }, {
|
4376 | key: "push",
|
4377 | value: function push(file) {
|
4378 | this.parseValue.push({
|
4379 | url: file,
|
4380 | name: getFileName(file)
|
4381 | });
|
4382 | }
|
4383 | }, {
|
4384 | key: "toValue",
|
4385 | value: function toValue(parseValue) {
|
4386 | if (isUndef(parseValue)) return [];
|
4387 | var files = parseValue.map(function (file) {
|
4388 | return file.url;
|
4389 | }).filter(function (file) {
|
4390 | return file !== undefined;
|
4391 | });
|
4392 | return this.rule.props.limit === 1 ? files[0] || '' : files;
|
4393 | }
|
4394 | }, {
|
4395 | key: "changeParseValue",
|
4396 | value: function changeParseValue(parseValue) {
|
4397 | this.parseValue = parseValue;
|
4398 |
|
4399 | this.vm._changeFormData(this.field, parseValue);
|
4400 | }
|
4401 | }, {
|
4402 | key: "watchValue",
|
4403 | value: function watchValue(n) {
|
4404 | var b = true;
|
4405 | this.rule.props.fileList.forEach(function (pic) {
|
4406 | b = b && (pic.percentage === undefined || pic.status === 'success');
|
4407 | });
|
4408 | if (b) _get(_getPrototypeOf(handler.prototype), "watchValue", this).call(this, n);
|
4409 | }
|
4410 | }]);
|
4411 |
|
4412 | return handler;
|
4413 | }(Handler);
|
4414 |
|
4415 | var vNode = new VNode({});
|
4416 |
|
4417 | var Modal = function Modal(options, cb) {
|
4418 | if (isUndef(options.width)) options.width = '30%';
|
4419 | return {
|
4420 | name: 'fc-modal',
|
4421 | data: function data() {
|
4422 | return _objectSpread({
|
4423 | visible: true
|
4424 | }, options);
|
4425 | },
|
4426 | render: function render() {
|
4427 | vNode.setVm(this);
|
4428 | return vNode.modal({
|
4429 | props: this.$data,
|
4430 | on: {
|
4431 | close: this.onClose,
|
4432 | closed: this.onClosed
|
4433 | }
|
4434 | }, [cb(vNode, this)]);
|
4435 | },
|
4436 | methods: {
|
4437 | onClose: function onClose() {
|
4438 | this.visible = false;
|
4439 | },
|
4440 | onClosed: function onClosed() {
|
4441 | this.$el.parentNode.removeChild(this.$el);
|
4442 | }
|
4443 | }
|
4444 | };
|
4445 | };
|
4446 |
|
4447 | function mount(options, content) {
|
4448 | var $modal = _vue.extend(Modal(options, content)),
|
4449 | $vm = new $modal().$mount();
|
4450 |
|
4451 | window.document.body.appendChild($vm.$el);
|
4452 | }
|
4453 | function defaultOnHandle(src, title) {
|
4454 | mount({
|
4455 | title: title
|
4456 | }, function (vNode) {
|
4457 | return vNode.make('img', {
|
4458 | style: {
|
4459 | width: '100%'
|
4460 | },
|
4461 | attrs: {
|
4462 | src: src
|
4463 | }
|
4464 | });
|
4465 | });
|
4466 | }
|
4467 |
|
4468 | var render$e = function (_Render) {
|
4469 | _inherits(render, _Render);
|
4470 |
|
4471 | function render() {
|
4472 | _classCallCheck(this, render);
|
4473 |
|
4474 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
4475 | }
|
4476 |
|
4477 | _createClass(render, [{
|
4478 | key: "init",
|
4479 | value: function init() {
|
4480 | var _this = this;
|
4481 |
|
4482 | var handler = this.handler;
|
4483 | this.uploadOptions = extend(_objectSpread({}, this.options.upload), this.handler.rule.props);
|
4484 | this.issetIcon = this.uploadOptions.allowRemove || this.uploadOptions.handleIcon;
|
4485 | this.propsData = this.vData.props(this.uploadOptions).class('fc-upload-con', true).props('onSuccess', function () {
|
4486 | return _this.onSuccess.apply(_this, arguments);
|
4487 | }).ref(handler.refName).key("fip".concat(handler.unique)).get();
|
4488 | }
|
4489 | }, {
|
4490 | key: "onSuccess",
|
4491 | value: function onSuccess(response, file, fileList) {
|
4492 | var url = this.uploadOptions.onSuccess.call(null, response, file, fileList);
|
4493 |
|
4494 | if (!isUndef(url)) {
|
4495 | file.url = url;
|
4496 | file.showProgress = false;
|
4497 | } else {
|
4498 | var index = fileList.indexOf(file);
|
4499 | if (index !== -1) fileList.splice(index, 1);
|
4500 | }
|
4501 |
|
4502 | this.handler.changeParseValue(this.handler.el.uploadFiles);
|
4503 | }
|
4504 | }, {
|
4505 | key: "onHandle",
|
4506 | value: function onHandle(src) {
|
4507 | var fn = this.uploadOptions.onHandle;
|
4508 | if (fn) return fn(src);else defaultOnHandle(src, this.uploadOptions.modalTitle);
|
4509 | }
|
4510 | }, {
|
4511 | key: "parse",
|
4512 | value: function parse() {
|
4513 | var _this2 = this;
|
4514 |
|
4515 | var _this$handler = this.handler,
|
4516 | unique = _this$handler.unique,
|
4517 | field = _this$handler.field;
|
4518 | this.init();
|
4519 | if (this.uploadOptions.handleIcon === true) this.uploadOptions.handleIcon = 'el-icon-view';
|
4520 |
|
4521 | var value = this.vm._formData(field),
|
4522 | render = this.uploadOptions.showFileList ? [] : _toConsumableArray(value.map(function (file, index) {
|
4523 | if (!isUndef(file.percentage) && file.showProgress !== false && file.status !== 'success') {
|
4524 | return _this2.makeProgress(file, "uppg".concat(index).concat(unique));
|
4525 | } else if (file.status === undefined || file.status === 'success') {
|
4526 | return _this2.makeUploadView(file.url, "upview".concat(index).concat(unique), index);
|
4527 | }
|
4528 | }));
|
4529 |
|
4530 | var isShow = !this.uploadOptions.limit || this.uploadOptions.limit > value.length;
|
4531 | render.push(this.makeUploadBtn(unique, isShow));
|
4532 | return [this.vNode.make('div', {
|
4533 | key: "div4".concat(unique),
|
4534 | class: {
|
4535 | 'fc-upload': true,
|
4536 | 'fc-hide-btn': !isShow
|
4537 | }
|
4538 | }, render)];
|
4539 | }
|
4540 | }, {
|
4541 | key: "cacheParse",
|
4542 | value: function cacheParse(form) {
|
4543 | this.cache = null;
|
4544 | return _get(_getPrototypeOf(render.prototype), "cacheParse", this).call(this, form);
|
4545 | }
|
4546 | }, {
|
4547 | key: "makeUploadView",
|
4548 | value: function makeUploadView(src, key, index) {
|
4549 | var _this3 = this;
|
4550 |
|
4551 | return this.vNode.make('div', {
|
4552 | key: "div1".concat(key),
|
4553 | class: ['fc-files']
|
4554 | }, function () {
|
4555 | var container = [];
|
4556 |
|
4557 | if (_this3.handler.rule.props.uploadType === 'image') {
|
4558 | container.push(_this3.vNode.make('img', {
|
4559 | key: "img".concat(key),
|
4560 | attrs: {
|
4561 | src: src
|
4562 | }
|
4563 | }));
|
4564 | } else {
|
4565 | container.push(_this3.vNode.icon({
|
4566 | key: "file".concat(key),
|
4567 | 'class': ['el-icon-tickets']
|
4568 | }));
|
4569 | }
|
4570 |
|
4571 | if (_this3.issetIcon) container.push(_this3.makeIcons(src, key, index));
|
4572 | return container;
|
4573 | });
|
4574 | }
|
4575 | }, {
|
4576 | key: "makeIcons",
|
4577 | value: function makeIcons(src, key, index) {
|
4578 | var _this4 = this;
|
4579 |
|
4580 | return this.vNode.make('div', {
|
4581 | key: "div2".concat(key),
|
4582 | class: ['fc-upload-cover']
|
4583 | }, function () {
|
4584 | var icon = [];
|
4585 | if (!!_this4.uploadOptions.handleIcon) icon.push(_this4.makeHandleIcon(src, key, index));
|
4586 | if (_this4.uploadOptions.allowRemove === true) icon.push(_this4.makeRemoveIcon(src, key, index));
|
4587 | return icon;
|
4588 | });
|
4589 | }
|
4590 | }, {
|
4591 | key: "makeProgress",
|
4592 | value: function makeProgress(file, unique) {
|
4593 | return this.vNode.make('div', {
|
4594 | key: "div3".concat(unique),
|
4595 | class: ['fc-files']
|
4596 | }, [this.vNode.progress({
|
4597 | key: "upp".concat(unique),
|
4598 | props: {
|
4599 | percentage: file.percentage,
|
4600 | type: 'circle',
|
4601 | width: 54
|
4602 | }
|
4603 | })]);
|
4604 | }
|
4605 | }, {
|
4606 | key: "makeUploadBtn",
|
4607 | value: function makeUploadBtn(unique, isShow) {
|
4608 | return this.vNode.upload(this.propsData, isShow === true ? [this.vNode.make('div', {
|
4609 | key: "div5".concat(unique),
|
4610 | class: ['fc-upload-btn']
|
4611 | }, [this.vNode.icon({
|
4612 | key: "upi".concat(unique),
|
4613 | 'class': ['el-icon-upload2']
|
4614 | })])] : []);
|
4615 | }
|
4616 | }, {
|
4617 | key: "makeRemoveIcon",
|
4618 | value: function makeRemoveIcon(src, key, index) {
|
4619 | var _this5 = this;
|
4620 |
|
4621 | return this.vNode.icon({
|
4622 | key: "upri".concat(key).concat(index),
|
4623 | 'class': ['el-icon-delete'],
|
4624 | on: {
|
4625 | 'click': function click() {
|
4626 | if (_this5.uploadOptions.disabled === true) return;
|
4627 | var fileList = _this5.handler.el.uploadFiles,
|
4628 | file = fileList[index];
|
4629 |
|
4630 | _this5.handler.el.handleRemove(file);
|
4631 | }
|
4632 | }
|
4633 | });
|
4634 | }
|
4635 | }, {
|
4636 | key: "makeHandleIcon",
|
4637 | value: function makeHandleIcon(src, key, index) {
|
4638 | var _this6 = this;
|
4639 |
|
4640 | return this.vNode.icon({
|
4641 | key: "uphi".concat(key).concat(index),
|
4642 | 'class': ['el-icon-view'],
|
4643 | on: {
|
4644 | 'click': function click() {
|
4645 | if (_this6.uploadOptions.disabled === true) return;
|
4646 |
|
4647 | _this6.onHandle(src);
|
4648 | }
|
4649 | }
|
4650 | });
|
4651 | }
|
4652 | }]);
|
4653 |
|
4654 | return render;
|
4655 | }(Render);
|
4656 |
|
4657 | var name$g = "upload";
|
4658 | var types = {
|
4659 | image: ['image', 0],
|
4660 | file: ['file', 0],
|
4661 | uploadFileOne: ['file', 1],
|
4662 | uploadImageOne: ['image', 1]
|
4663 | };
|
4664 | var maker$b = Object.keys(types).reduce(function (initial, key) {
|
4665 | initial[key] = creatorTypeFactory(name$g, function (m) {
|
4666 | return m.props({
|
4667 | uploadType: types[key][0],
|
4668 | limit: types[key][1]
|
4669 | });
|
4670 | });
|
4671 | return initial;
|
4672 | }, {});
|
4673 | maker$b.uploadImage = maker$b.image;
|
4674 | maker$b.uploadFile = maker$b.file;
|
4675 | var upload = {
|
4676 | handler: handler$f,
|
4677 | render: render$e,
|
4678 | name: name$g,
|
4679 | maker: maker$b
|
4680 | };
|
4681 |
|
4682 | function parseRule$1(rule) {
|
4683 | var props = rule.props;
|
4684 | if (!props.type) $set(props, 'type', 'input');
|
4685 | if (!props.icon) $set(props, 'icon', 'el-icon-upload2');
|
4686 | if (!props.height) $set(props, 'height', '370px');
|
4687 | if (isUndef(props.spin)) $set(props, 'spin', true);
|
4688 | if (!props.title) $set(props, 'title', '请选择' + rule.title);
|
4689 | if (!props.maxLength) $set(props, 'maxLength', 0);
|
4690 | if (!props.okBtnText) $set(props, 'okBtnText', '确定');
|
4691 | if (!props.closeBtnText) $set(props, 'closeBtnText', '关闭');
|
4692 | if (!props.modalTitle) $set(props, 'modalTitle', '预览');
|
4693 | var handleIcon = props.handleIcon;
|
4694 | if (props.type === 'file' && props.handleIcon === undefined) handleIcon = false;else handleIcon = props.handleIcon === true || props.handleIcon === undefined ? 'el-icon-view' : props.handleIcon;
|
4695 | $set(props, 'handleIcon', handleIcon);
|
4696 | if (props.allowRemove === undefined) $set(props, 'allowRemove', true);
|
4697 | }
|
4698 |
|
4699 | var handler$g = function (_Handler) {
|
4700 | _inherits(handler, _Handler);
|
4701 |
|
4702 | function handler() {
|
4703 | _classCallCheck(this, handler);
|
4704 |
|
4705 | return _possibleConstructorReturn(this, _getPrototypeOf(handler).apply(this, arguments));
|
4706 | }
|
4707 |
|
4708 | _createClass(handler, [{
|
4709 | key: "init",
|
4710 | value: function init() {
|
4711 | parseRule$1(this.rule);
|
4712 | }
|
4713 | }, {
|
4714 | key: "toFormValue",
|
4715 | value: function toFormValue(value) {
|
4716 | var parseValue,
|
4717 | oldValue = value,
|
4718 | isArr = Array.isArray(oldValue);
|
4719 | if (oldValue === '') parseValue = [];else if (!isArr) parseValue = [oldValue];else parseValue = oldValue;
|
4720 | this.parseValue = parseValue;
|
4721 | return parseValue;
|
4722 | }
|
4723 | }, {
|
4724 | key: "toValue",
|
4725 | value: function toValue(parseValue) {
|
4726 | return this.rule.props.maxLength != 1 ? parseValue : parseValue[0] === undefined ? '' : parseValue[0];
|
4727 | }
|
4728 | }, {
|
4729 | key: "watchValue",
|
4730 | value: function watchValue(n) {
|
4731 | _get(_getPrototypeOf(handler.prototype), "watchValue", this).call(this, n);
|
4732 |
|
4733 | this.render.onChange(n);
|
4734 | this.render.sync();
|
4735 | }
|
4736 | }, {
|
4737 | key: "watchFormValue",
|
4738 | value: function watchFormValue(n) {
|
4739 | _get(_getPrototypeOf(handler.prototype), "watchFormValue", this).call(this, n);
|
4740 |
|
4741 | this.parseValue = n;
|
4742 | this.render.sync();
|
4743 | }
|
4744 | }]);
|
4745 |
|
4746 | return handler;
|
4747 | }(Handler);
|
4748 |
|
4749 | var eventList = {
|
4750 | onOpen: 'on-open',
|
4751 | onChange: 'on-change',
|
4752 | onCancel: 'on-cancel',
|
4753 | onOk: 'on-ok'
|
4754 | };
|
4755 |
|
4756 | var render$f = function (_Render) {
|
4757 | _inherits(render, _Render);
|
4758 |
|
4759 | function render() {
|
4760 | _classCallCheck(this, render);
|
4761 |
|
4762 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
4763 | }
|
4764 |
|
4765 | _createClass(render, [{
|
4766 | key: "init",
|
4767 | value: function init() {
|
4768 | this._props = this.handler.rule.props;
|
4769 | this.issetIcon = this._props.handleIcon !== false || this._props.allowRemove === true;
|
4770 | }
|
4771 | }, {
|
4772 | key: "parse",
|
4773 | value: function parse() {
|
4774 | this.init();
|
4775 | var type = this._props.type,
|
4776 | vNode;
|
4777 | if (type === 'image') vNode = this.makeGroup(this.makeImage());else if (type === 'file') vNode = this.makeGroup(this.makeFile());else vNode = this.makeInput();
|
4778 | return vNode;
|
4779 | }
|
4780 | }, {
|
4781 | key: "makeInput",
|
4782 | value: function makeInput(hidden) {
|
4783 | var _this = this;
|
4784 |
|
4785 | var unique = this.handler.unique,
|
4786 | props = this.inputProps().props({
|
4787 | type: "text",
|
4788 | value: this.handler.parseValue.toString(),
|
4789 | icon: this._props.icon,
|
4790 | readonly: true,
|
4791 | clearable: true
|
4792 | }).on('on-click', function () {
|
4793 | _this.showModel();
|
4794 | }).on('input', function () {}).key('ifit' + unique).style({
|
4795 | display: hidden === true ? 'none' : 'inline-block'
|
4796 | }).get();
|
4797 | return [this.vNode.input(props)];
|
4798 | }
|
4799 | }, {
|
4800 | key: "makeGroup",
|
4801 | value: function makeGroup(render) {
|
4802 | var unique = this.handler.unique,
|
4803 | field = this.handler.field;
|
4804 | return [this.vNode.make('div', {
|
4805 | key: "ifgp1".concat(unique),
|
4806 | class: ['fc-upload', 'fc-frame'],
|
4807 | ref: this.handler.refName,
|
4808 | props: {
|
4809 | value: this.vm._formData(field)
|
4810 | }
|
4811 | }, render), this.makeInput(true)];
|
4812 | }
|
4813 | }, {
|
4814 | key: "makeImage",
|
4815 | value: function makeImage() {
|
4816 | var _this2 = this;
|
4817 |
|
4818 | var unique = this.handler.unique;
|
4819 | var vNode = this.handler.parseValue.map(function (src, index) {
|
4820 | return _this2.vNode.make('div', {
|
4821 | key: "ifid1".concat(unique).concat(index),
|
4822 | class: ['fc-files']
|
4823 | }, [_this2.vNode.make('img', {
|
4824 | key: "ifim".concat(unique).concat(index),
|
4825 | attrs: {
|
4826 | src: src
|
4827 | }
|
4828 | }), _this2.makeIcons(src, unique, index)]);
|
4829 | });
|
4830 | vNode.push(this.makeBtn());
|
4831 | return vNode;
|
4832 | }
|
4833 | }, {
|
4834 | key: "makeFile",
|
4835 | value: function makeFile() {
|
4836 | var _this3 = this;
|
4837 |
|
4838 | var unique = this.handler.unique;
|
4839 | var vNode = this.handler.parseValue.map(function (src, index) {
|
4840 | return _this3.vNode.make('div', {
|
4841 | key: "iffd2".concat(unique).concat(index),
|
4842 | class: ['fc-files']
|
4843 | }, [_this3.vNode.icon({
|
4844 | key: "iff".concat(unique).concat(index),
|
4845 | class: ['el-icon-tickets']
|
4846 | }), _this3.makeIcons(src, unique, index)]);
|
4847 | });
|
4848 | vNode.push(this.makeBtn());
|
4849 | return vNode;
|
4850 | }
|
4851 | }, {
|
4852 | key: "makeBtn",
|
4853 | value: function makeBtn() {
|
4854 | var _this4 = this;
|
4855 |
|
4856 | var props = this.handler.rule.props;
|
4857 | if (props.maxLenth > 0 && this.handler.parseValue.length >= props.maxLenth) return;
|
4858 | var unique = this.handler.unique;
|
4859 | return this.vNode.make('div', {
|
4860 | key: "ifbd3".concat(unique),
|
4861 | class: ['fc-upload-btn'],
|
4862 | on: {
|
4863 | click: function click() {
|
4864 | if (props.disabled === true) return;
|
4865 |
|
4866 | _this4.showModel();
|
4867 | }
|
4868 | }
|
4869 | }, [this.vNode.icon({
|
4870 | key: "ifbi3".concat(unique),
|
4871 | class: [this._props.icon]
|
4872 | })]);
|
4873 | }
|
4874 | }, {
|
4875 | key: "makeIcons",
|
4876 | value: function makeIcons(src, key, index) {
|
4877 | var _this5 = this;
|
4878 |
|
4879 | if (this.issetIcon === true) return this.vNode.make('div', {
|
4880 | key: "ifis".concat(key).concat(index),
|
4881 | class: ['fc-upload-cover']
|
4882 | }, function () {
|
4883 | var icon = [];
|
4884 | if (_this5._props.handleIcon !== false) icon.push(_this5.makeHandleIcon(src, key, index));
|
4885 | if (_this5._props.allowRemove === true) icon.push(_this5.makeRemoveIcon(src, key, index));
|
4886 | return icon;
|
4887 | });
|
4888 | }
|
4889 | }, {
|
4890 | key: "makeRemoveIcon",
|
4891 | value: function makeRemoveIcon(src, key, index) {
|
4892 | var _this6 = this;
|
4893 |
|
4894 | return this.vNode.icon({
|
4895 | key: "ifri".concat(key).concat(index),
|
4896 | 'class': ['el-icon-delete'],
|
4897 | on: {
|
4898 | 'click': function click() {
|
4899 | if (_this6._props.disabled === true) return;
|
4900 |
|
4901 | if (_this6.onRemove(src) !== false) {
|
4902 | _this6.handler.parseValue.splice(index, 1);
|
4903 |
|
4904 | _this6.sync();
|
4905 | }
|
4906 | }
|
4907 | }
|
4908 | });
|
4909 | }
|
4910 | }, {
|
4911 | key: "makeHandleIcon",
|
4912 | value: function makeHandleIcon(src, key, index) {
|
4913 | var _this7 = this;
|
4914 |
|
4915 | var props = this._props;
|
4916 | return this.vNode.icon({
|
4917 | key: "ifhi".concat(key).concat(index),
|
4918 | class: [toString$1(props.handleIcon)],
|
4919 | on: {
|
4920 | 'click': function click() {
|
4921 | if (props.disabled === true) return;
|
4922 |
|
4923 | _this7.onHandle(src);
|
4924 | }
|
4925 | }
|
4926 | });
|
4927 | }
|
4928 | }, {
|
4929 | key: "onRemove",
|
4930 | value: function onRemove(src) {
|
4931 | var fn = this.handler.rule.event['on-remove'];
|
4932 | if (fn) return fn(src, this.handler.getValue());
|
4933 | }
|
4934 | }, {
|
4935 | key: "onHandle",
|
4936 | value: function onHandle(src) {
|
4937 | var fn = this.handler.rule.event['on-handle'];
|
4938 | if (fn) return fn(src);else defaultOnHandle(src, this._props.modalTitle);
|
4939 | }
|
4940 | }, {
|
4941 | key: "valid",
|
4942 | value: function valid(field) {
|
4943 | if (field !== this.handler.field) throw new Error('无效的表单字段' + errMsg());
|
4944 | }
|
4945 | }, {
|
4946 | key: "showModel",
|
4947 | value: function showModel() {
|
4948 | var _this8 = this;
|
4949 |
|
4950 | var isShow = false !== this.onOpen(),
|
4951 | _this$_props = this._props,
|
4952 | width = _this$_props.width,
|
4953 | height = _this$_props.height,
|
4954 | src = _this$_props.src,
|
4955 | title = _this$_props.title,
|
4956 | okBtnText = _this$_props.okBtnText,
|
4957 | closeBtnText = _this$_props.closeBtnText;
|
4958 | if (!isShow) return;
|
4959 | mount({
|
4960 | width: width,
|
4961 | title: title
|
4962 | }, function (vNode, _vm) {
|
4963 | _this8.handler.$modal = _vm;
|
4964 | return [vNode.make('iframe', {
|
4965 | attrs: {
|
4966 | src: src
|
4967 | },
|
4968 | style: {
|
4969 | 'height': height,
|
4970 | 'border': "0 none",
|
4971 | 'width': '100%'
|
4972 | },
|
4973 | on: {
|
4974 | 'load': function load(e) {
|
4975 | try {
|
4976 | if (_this8.options.iframeHelper === true) {
|
4977 | var iframe = e.path[0].contentWindow;
|
4978 |
|
4979 | iframe["".concat(_this8.handler.field, "_change")] = function (val) {
|
4980 | _this8.handler.setValue(val);
|
4981 | };
|
4982 |
|
4983 | iframe["form_create_helper"] = {
|
4984 | close: function close(field) {
|
4985 | _this8.valid(field);
|
4986 |
|
4987 | _vm.onClose();
|
4988 | },
|
4989 | set: function set(field, value) {
|
4990 | _this8.valid(field);
|
4991 |
|
4992 | iframe["".concat(field, "_change")](value);
|
4993 | },
|
4994 | get: function get(field) {
|
4995 | _this8.valid(field);
|
4996 |
|
4997 | return _this8.handler.rule.value;
|
4998 | }
|
4999 | };
|
5000 | }
|
5001 | } catch (e) {}
|
5002 | }
|
5003 | }
|
5004 | }), vNode.make('div', {
|
5005 | slot: 'footer'
|
5006 | }, [vNode.button({
|
5007 | on: {
|
5008 | click: function click() {
|
5009 | _vm.onClose();
|
5010 |
|
5011 | _this8.onCancel();
|
5012 | }
|
5013 | }
|
5014 | }, [toString$1(closeBtnText)]), vNode.button({
|
5015 | props: {
|
5016 | type: 'primary'
|
5017 | },
|
5018 | on: {
|
5019 | click: function click() {
|
5020 | _this8.onOk() !== false && _vm.onClose();
|
5021 | }
|
5022 | }
|
5023 | }, [toString$1(okBtnText)])])];
|
5024 | });
|
5025 | }
|
5026 | }]);
|
5027 |
|
5028 | return render;
|
5029 | }(Render);
|
5030 | Object.keys(eventList).forEach(function (k) {
|
5031 | render$f.prototype[k] = function () {
|
5032 | var fn = this.handler.rule.event[eventList[k]];
|
5033 | if (fn) return fn(this.handler.getValue());
|
5034 | };
|
5035 | });
|
5036 |
|
5037 | var name$h = "frame";
|
5038 | var types$1 = {
|
5039 | frameInputs: ['input', 0],
|
5040 | frameFiles: ['file', 0],
|
5041 | frameImages: ['image', 0],
|
5042 | frameInputOne: ['input', 1],
|
5043 | frameFileOne: ['file', 1],
|
5044 | frameImageOne: ['image', 1]
|
5045 | };
|
5046 | var maker$c = Object.keys(types$1).reduce(function (initial, key) {
|
5047 | initial[key] = creatorTypeFactory(name$h, function (m) {
|
5048 | return m.props({
|
5049 | type: types$1[key][0],
|
5050 | maxLength: types$1[key][1]
|
5051 | });
|
5052 | });
|
5053 | return initial;
|
5054 | }, {});
|
5055 | maker$c.frameInput = maker$c.frameInputs;
|
5056 | maker$c.frameFile = maker$c.frameFiles;
|
5057 | maker$c.frameImage = maker$c.frameImages;
|
5058 | var frame = {
|
5059 | handler: handler$g,
|
5060 | render: render$f,
|
5061 | name: name$h,
|
5062 | maker: maker$c
|
5063 | };
|
5064 |
|
5065 | var render$g = function (_Render) {
|
5066 | _inherits(render, _Render);
|
5067 |
|
5068 | function render() {
|
5069 | _classCallCheck(this, render);
|
5070 |
|
5071 | return _possibleConstructorReturn(this, _getPrototypeOf(render).apply(this, arguments));
|
5072 | }
|
5073 |
|
5074 | _createClass(render, [{
|
5075 | key: "parse",
|
5076 | value: function parse() {
|
5077 | var rule = this.handler.rule,
|
5078 | slot = isUndef(rule.props.slot) ? rule.slot : rule.props.slot;
|
5079 | if (!isPlainObject(slot)) slot = {};
|
5080 | return [this.vNode.switch(this.inputProps().scopedSlots({
|
5081 | open: function open() {
|
5082 | return slot.open;
|
5083 | },
|
5084 | close: function close() {
|
5085 | return slot.close;
|
5086 | }
|
5087 | }).style({
|
5088 | 'margin': '4.5px 0px'
|
5089 | }).get())];
|
5090 | }
|
5091 | }]);
|
5092 |
|
5093 | return render;
|
5094 | }(Render);
|
5095 |
|
5096 | var name$i = "switch";
|
5097 | var maker$d = {
|
5098 | sliderRange: creatorTypeFactory(name$i, true, 'range')
|
5099 | };
|
5100 | var iswitch = {
|
5101 | handler: Handler,
|
5102 | render: render$g,
|
5103 | name: name$i,
|
5104 | maker: maker$d
|
5105 | };
|
5106 |
|
5107 | var defineProperty$2 = objectDefineProperty.f;
|
5108 | var FunctionPrototype = Function.prototype;
|
5109 | var FunctionPrototypeToString = FunctionPrototype.toString;
|
5110 | var nameRE = /^\s*function ([^ (]*)/;
|
5111 | var NAME = 'name';
|
5112 |
|
5113 |
|
5114 |
|
5115 | if (descriptors && !(NAME in FunctionPrototype)) {
|
5116 | defineProperty$2(FunctionPrototype, NAME, {
|
5117 | configurable: true,
|
5118 | get: function () {
|
5119 | try {
|
5120 | return FunctionPrototypeToString.call(this).match(nameRE)[1];
|
5121 | } catch (error) {
|
5122 | return '';
|
5123 | }
|
5124 | }
|
5125 | });
|
5126 | }
|
5127 |
|
5128 | function makerFactory(componentList) {
|
5129 | var _m = {};
|
5130 | Object.keys(componentList).forEach(function (key) {
|
5131 | var component = componentList[key];
|
5132 | var undef = isUndef(component.maker);
|
5133 | if (undef || component.maker[component.name] === undefined) _m[component.name] = creatorFactory(component.name);
|
5134 | if (!undef) extend(_m, component.maker);
|
5135 | });
|
5136 | var commonMaker = creatorFactory('');
|
5137 | extend(_m, {
|
5138 | create: function create(type, field, title) {
|
5139 | var make = commonMaker('', field);
|
5140 | make.rule.type = type;
|
5141 | make.rule.title = title;
|
5142 | return make;
|
5143 | },
|
5144 | createTmp: function createTmp(template, vm, field, title) {
|
5145 | var make = commonMaker('', field);
|
5146 | make.rule.type = 'template';
|
5147 | make.rule.template = template;
|
5148 | make.rule.title = title;
|
5149 | make.rule.vm = vm;
|
5150 | return make;
|
5151 | }
|
5152 | });
|
5153 | _m.template = _m.createTmp;
|
5154 | _m.parse = parse;
|
5155 | return _m;
|
5156 | }
|
5157 |
|
5158 | function parse(rule) {
|
5159 | var toMaker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
5160 | if (isString(rule)) rule = JSON.parse(rule);
|
5161 | if (rule instanceof Creator) return toMaker ? rule : rule.getRule();
|
5162 |
|
5163 | if (isPlainObject(rule)) {
|
5164 | var maker = ruleToMaker(rule);
|
5165 | return toMaker ? maker : maker.getRule();
|
5166 | } else if (!Array.isArray(rule)) return rule;else {
|
5167 | var rules = rule.map(function (r) {
|
5168 | return parse(r, toMaker);
|
5169 | });
|
5170 | Object.defineProperty(rules, 'find', {
|
5171 | value: findField,
|
5172 | enumerable: false,
|
5173 | configurable: false
|
5174 | });
|
5175 | return rules;
|
5176 | }
|
5177 | }
|
5178 |
|
5179 | function findField(field) {
|
5180 | var children = [];
|
5181 |
|
5182 | for (var i in this) {
|
5183 | var rule = this[i] instanceof Creator ? this[i].rule : this[i];
|
5184 | if (rule.field === field) return this[i];
|
5185 | if (isValidChildren(rule.children)) children = children.concat(rule.children);
|
5186 | }
|
5187 |
|
5188 | if (children.length > 0) return findField.call(children, field);
|
5189 | }
|
5190 |
|
5191 | function ruleToMaker(rule) {
|
5192 | var maker = new Creator();
|
5193 | Object.keys(rule).forEach(function (key) {
|
5194 | if (Object.keys(maker._data).indexOf(key) === -1) {
|
5195 | maker.rule[key] = rule[key];
|
5196 | } else {
|
5197 | maker._data[key] = rule[key];
|
5198 | }
|
5199 | });
|
5200 | return maker;
|
5201 | }
|
5202 |
|
5203 | function getConfig() {
|
5204 | return {
|
5205 | form: {
|
5206 | inline: false,
|
5207 | labelPosition: 'right',
|
5208 | labelSuffix: undefined,
|
5209 | hideRequiredAsterisk: false,
|
5210 | labelWidth: '125px',
|
5211 | showMessage: true,
|
5212 | inlineMessage: false,
|
5213 | statusIcon: false,
|
5214 | validateOnRuleChange: true,
|
5215 | disabled: false,
|
5216 | size: undefined
|
5217 | },
|
5218 | row: {
|
5219 | gutter: 0,
|
5220 | type: undefined,
|
5221 | align: undefined,
|
5222 | justify: undefined,
|
5223 | tag: 'div'
|
5224 | },
|
5225 | upload: {
|
5226 | onPreview: function onPreview(file) {},
|
5227 | onRemove: function onRemove(file, fileList) {},
|
5228 | onSuccess: function onSuccess() {},
|
5229 | onError: function onError(err, file, fileList) {},
|
5230 | onProgress: function onProgress(event, file, fileList) {},
|
5231 | onChange: function onChange(file, fileList) {},
|
5232 | beforeUpload: function beforeUpload(file) {},
|
5233 | beforeRemove: function beforeRemove(file, fileList) {},
|
5234 | allowRemove: true,
|
5235 | handleIcon: true
|
5236 | },
|
5237 | submitBtn: {
|
5238 | type: "primary",
|
5239 | size: "medium",
|
5240 | plain: false,
|
5241 | round: false,
|
5242 | circle: false,
|
5243 | loading: false,
|
5244 | disabled: false,
|
5245 | icon: 'el-icon-upload',
|
5246 | width: '100%',
|
5247 | autofocus: false,
|
5248 | nativeType: "button",
|
5249 | innerText: "提交",
|
5250 | show: true,
|
5251 | col: undefined,
|
5252 | click: undefined
|
5253 | },
|
5254 | resetBtn: {
|
5255 | type: "default",
|
5256 | size: "medium",
|
5257 | plain: false,
|
5258 | round: false,
|
5259 | circle: false,
|
5260 | loading: false,
|
5261 | disabled: false,
|
5262 | icon: 'el-icon-refresh',
|
5263 | width: '100%',
|
5264 | autofocus: false,
|
5265 | nativeType: "button",
|
5266 | innerText: "重置",
|
5267 | show: false,
|
5268 | col: undefined,
|
5269 | click: undefined
|
5270 | },
|
5271 | iframeHelper: false
|
5272 | };
|
5273 | }
|
5274 |
|
5275 | function getGlobalApi(fComponent) {
|
5276 | var vm = fComponent.vm;
|
5277 |
|
5278 | function tidyFields(fields) {
|
5279 | var all = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
5280 | if (!fields) fields = all ? Object.keys(fComponent.handlers) : vm._formField();else if (!Array.isArray(fields)) fields = [fields];
|
5281 | return fields;
|
5282 | }
|
5283 |
|
5284 | return {
|
5285 | formData: function formData() {
|
5286 | var _this = this;
|
5287 |
|
5288 | var handlers = fComponent.handlers;
|
5289 | return Object.keys(handlers).reduce(function (initial, field) {
|
5290 | var handler = handlers[field];
|
5291 |
|
5292 | if (handler.noValue === true) {
|
5293 | handler.$emit('input', function (val) {
|
5294 | initial[field] = val;
|
5295 | }, _this);
|
5296 | } else {
|
5297 | initial[field] = deepExtend({}, {
|
5298 | value: vm._value(field)
|
5299 | }).value;
|
5300 | }
|
5301 |
|
5302 | return initial;
|
5303 | }, {});
|
5304 | },
|
5305 | getValue: function getValue(field) {
|
5306 | field = toString$1(field);
|
5307 | var handler = fComponent.handlers[field];
|
5308 | if (isUndef(handler)) return;
|
5309 | var val = undefined;
|
5310 | if (handler.noValue === true) handler.$emit('input', function (v) {
|
5311 | val = v;
|
5312 | }, this);else val = deepExtend({}, {
|
5313 | value: vm._value(field)
|
5314 | }).value;
|
5315 | return val;
|
5316 | },
|
5317 | setValue: function setValue(field, value) {
|
5318 | var _this2 = this;
|
5319 |
|
5320 | var formData = field;
|
5321 | if (!isPlainObject(field)) formData = _defineProperty({}, field, value);
|
5322 | Object.keys(formData).forEach(function (key) {
|
5323 | _this2.changeValue(key, formData[key]);
|
5324 | });
|
5325 | },
|
5326 | changeValue: function changeValue(field, value) {
|
5327 | var _this3 = this;
|
5328 |
|
5329 | field = toString$1(field);
|
5330 | var handler = fComponent.handlers[field];
|
5331 | if (handler === undefined) return;
|
5332 | if (isFunction(value)) value(vm._trueData(field), function (changeValue) {
|
5333 | _this3.changeField(field, changeValue);
|
5334 | });else {
|
5335 | if (handler.noValue === true) handler.$emit('set-value', value, this);else handler.setValue(value);
|
5336 | }
|
5337 | },
|
5338 | changeField: function changeField(field, value) {
|
5339 | this.setValue(field, value);
|
5340 | },
|
5341 | removeField: function removeField(field) {
|
5342 | var handler = fComponent.handlers[field];
|
5343 | if (!handler) return;
|
5344 | var fields = handler.root.map(function (rule) {
|
5345 | return rule.__field__;
|
5346 | }),
|
5347 | index = fields.indexOf(toString$1(field));
|
5348 | if (index === -1) return;
|
5349 | handler.root.splice(index, 1);
|
5350 |
|
5351 | vm._refresh();
|
5352 | },
|
5353 | validate: function validate(successFn, errorFn) {
|
5354 | fComponent.getFormRef().validate(function (valid) {
|
5355 | valid === true ? successFn && successFn() : errorFn && errorFn();
|
5356 | });
|
5357 | },
|
5358 | validateField: function validateField(field, callback) {
|
5359 | if (!vm.cptData[field]) return;
|
5360 | fComponent.getFormRef().validateField(field, callback);
|
5361 | },
|
5362 | resetFields: function resetFields(fields) {
|
5363 | var _this4 = this;
|
5364 |
|
5365 | var handlers = fComponent.handlers;
|
5366 | tidyFields(fields, true).forEach(function (field) {
|
5367 | var handler = handlers[field];
|
5368 | if (!handler) return;
|
5369 | if (!handler.noValue) handler.reset();else handler.$emit('reset-field', _this4);
|
5370 | });
|
5371 | this.refresh();
|
5372 | },
|
5373 | destroy: function destroy() {
|
5374 | vm.$el.parentNode.removeChild(vm.$el);
|
5375 | vm.$destroy();
|
5376 | },
|
5377 | fields: function fields() {
|
5378 | return vm._formField();
|
5379 | },
|
5380 | append: function append(rule, after) {
|
5381 | var fields = fComponent.fieldList,
|
5382 | index = fields.indexOf(toString$1(after));
|
5383 | if (rule.field && fields.indexOf(toString$1(rule.field)) !== -1) return console.error("".concat(rule.field, " \u5B57\u6BB5\u5DF2\u5B58\u5728") + errMsg());
|
5384 |
|
5385 | if (isUndef(after)) {
|
5386 | index = fields.length;
|
5387 | } else if (index === -1) return;
|
5388 |
|
5389 | fComponent.rules.splice(index + 1, 0, rule);
|
5390 | },
|
5391 | prepend: function prepend(rule, after) {
|
5392 | var fields = fComponent.fieldList,
|
5393 | index = fields.indexOf(toString$1(after));
|
5394 | if (rule.field && fields.indexOf(toString$1(rule.field)) !== -1) return console.error("".concat(rule.field, " \u5B57\u6BB5\u5DF2\u5B58\u5728") + errMsg());
|
5395 |
|
5396 | if (isUndef(after)) {
|
5397 | index = 0;
|
5398 | } else if (index === -1) return;else index--;
|
5399 |
|
5400 | fComponent.rules.splice(index + 1, 0, rule);
|
5401 | },
|
5402 | submit: function submit(successFn, failFn) {
|
5403 | var _this5 = this;
|
5404 |
|
5405 | this.validate(function () {
|
5406 | var formData = _this5.formData();
|
5407 |
|
5408 | if (isFunction(successFn)) successFn(formData, _this5);else fComponent.options.onSubmit && fComponent.options.onSubmit(formData);
|
5409 | }, function () {
|
5410 | return failFn && failFn();
|
5411 | });
|
5412 | },
|
5413 | hidden: function hidden(fields) {
|
5414 | var _hidden = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
5415 |
|
5416 | tidyFields(fields).forEach(function (field) {
|
5417 | var handler = fComponent.handlers[field];
|
5418 | if (!fComponent.handlers[field]) return;
|
5419 | vm.$set(vm._trueData(field).props, 'hidden', !!_hidden);
|
5420 | handler.render.sync();
|
5421 | });
|
5422 | },
|
5423 | visibility: function visibility(fields) {
|
5424 | var _visibility = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
5425 |
|
5426 | tidyFields(fields).forEach(function (field) {
|
5427 | var handler = fComponent.handlers[field];
|
5428 | if (!handler) return;
|
5429 | vm.$set(vm._trueData(field).props, 'visibility', !!_visibility);
|
5430 | handler.render.sync();
|
5431 | });
|
5432 | },
|
5433 | disabled: function disabled(fields) {
|
5434 | var _this6 = this;
|
5435 |
|
5436 | var _disabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
5437 |
|
5438 | _disabled = !!_disabled;
|
5439 | tidyFields(fields, true).forEach(function (field) {
|
5440 | var handler = fComponent.handlers[field];
|
5441 | if (!handler) return;
|
5442 | if (!handler.noValue) vm.$set(vm._trueData(field).props, 'disabled', _disabled);else handler.$emit('disabled', _disabled, _this6);
|
5443 | handler.render.sync();
|
5444 | });
|
5445 | },
|
5446 | clearValidateState: function clearValidateState(fields) {
|
5447 | tidyFields(fields).forEach(function (field) {
|
5448 | var handler = fComponent.handlers[field];
|
5449 | if (!handler) return;
|
5450 | handler.clearMsg();
|
5451 | });
|
5452 | },
|
5453 | model: function model() {
|
5454 | return _objectSpread({}, vm.trueData);
|
5455 | },
|
5456 | component: function component() {
|
5457 | return _objectSpread({}, vm.components);
|
5458 | },
|
5459 | bind: function bind(fields) {
|
5460 | var bind = {},
|
5461 | properties = {};
|
5462 | tidyFields(fields).forEach(function (field) {
|
5463 | var rule = vm._trueData(field);
|
5464 |
|
5465 | if (!rule) return console.error("".concat(field, " \u5B57\u6BB5\u4E0D\u5B58\u5728") + errMsg());
|
5466 | properties[field] = {
|
5467 | get: function get() {
|
5468 | return rule.value;
|
5469 | },
|
5470 | set: function set(value) {
|
5471 | vm.$set(rule, 'value', value);
|
5472 | },
|
5473 | enumerable: true,
|
5474 | configurable: true
|
5475 | };
|
5476 | });
|
5477 | Object.defineProperties(bind, properties);
|
5478 | return bind;
|
5479 | },
|
5480 | submitStatus: function submitStatus() {
|
5481 | var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5482 |
|
5483 | vm._buttonProps(props);
|
5484 | },
|
5485 | resetStatus: function resetStatus() {
|
5486 | var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5487 |
|
5488 | vm._resetProps(props);
|
5489 | },
|
5490 | btn: {
|
5491 | loading: function loading() {
|
5492 | var _loading = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
5493 |
|
5494 | vm._buttonProps({
|
5495 | loading: _loading
|
5496 | });
|
5497 | },
|
5498 | finish: function finish() {
|
5499 | this.loading(false);
|
5500 | },
|
5501 | disabled: function disabled() {
|
5502 | var _disabled2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
5503 |
|
5504 | vm._buttonProps({
|
5505 | disabled: _disabled2
|
5506 | });
|
5507 | },
|
5508 | show: function show() {
|
5509 | var isShow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
5510 |
|
5511 | vm._buttonProps({
|
5512 | show: isShow
|
5513 | });
|
5514 | }
|
5515 | },
|
5516 | resetBtn: {
|
5517 | loading: function loading() {
|
5518 | var _loading2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
5519 |
|
5520 | vm._resetProps({
|
5521 | loading: _loading2
|
5522 | });
|
5523 | },
|
5524 | finish: function finish() {
|
5525 | this.loading(false);
|
5526 | },
|
5527 | disabled: function disabled() {
|
5528 | var _disabled3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
5529 |
|
5530 | vm._resetProps({
|
5531 | disabled: _disabled3
|
5532 | });
|
5533 | },
|
5534 | show: function show() {
|
5535 | var isShow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
5536 |
|
5537 | vm._resetProps({
|
5538 | show: isShow
|
5539 | });
|
5540 | }
|
5541 | },
|
5542 | closeModal: function closeModal(field) {
|
5543 | var handler = fComponent.handlers[field];
|
5544 |
|
5545 | if (handler && handler.$modal) {
|
5546 | handler.$modal.onClose();
|
5547 | handler.$modal = null;
|
5548 | }
|
5549 | },
|
5550 | set: function set(node, field, value) {
|
5551 | vm.$set(node, field, value);
|
5552 | },
|
5553 | reload: function reload(rules) {
|
5554 | fComponent.reload(rules);
|
5555 | },
|
5556 | options: function options(_options) {
|
5557 | deepExtend(fComponent.options, _options);
|
5558 |
|
5559 | vm._sync();
|
5560 | },
|
5561 | onSuccess: function onSuccess(fn) {
|
5562 | this.onSubmit(fn);
|
5563 | },
|
5564 | onSubmit: function onSubmit(fn) {
|
5565 | this.options({
|
5566 | onSubmit: fn
|
5567 | });
|
5568 | },
|
5569 | sync: function sync(field, callback) {
|
5570 | if (fComponent.handlers[field]) fComponent.handlers[field].render.sync(callback);
|
5571 | },
|
5572 | refresh: function refresh() {
|
5573 | vm._refresh();
|
5574 | },
|
5575 | show: function show() {
|
5576 | var isShow = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
5577 | vm.isShow = !!isShow;
|
5578 | }
|
5579 | };
|
5580 | }
|
5581 |
|
5582 | var componentList = {
|
5583 | hidden: hidden,
|
5584 | checkbox: checkbox,
|
5585 | radio: radio,
|
5586 | input: input,
|
5587 | autocomplete: autocomplete,
|
5588 | inputnumber: inputnumber,
|
5589 | select: select,
|
5590 | cascader: cascader,
|
5591 | slider: slider,
|
5592 | timepicker: timepicker,
|
5593 | datepicker: datepicker,
|
5594 | rate: rate,
|
5595 | colorpicker: colorpicker,
|
5596 | tree: tree,
|
5597 | upload: upload,
|
5598 | frame: frame,
|
5599 | switch: iswitch
|
5600 | };
|
5601 | var style = '.form-create{padding:25px;} .fc-upload-btn,.fc-files{display: inline-block;width: 58px;height: 58px;text-align: center;line-height: 58px;border: 1px solid #c0ccda;border-radius: 4px;overflow: hidden;background: #fff;position: relative;box-shadow: 2px 2px 5px rgba(0,0,0,.1);margin-right: 4px;box-sizing: border-box;}.__fc_h{display:none;}.__fc_v{visibility:hidden;}' + '.fc-files img{width:100%;height:100%;display:inline-block;vertical-align: top;}' + '.fc-upload .el-upload{display: block;}' + '.fc-upload-btn{border: 1px dashed #c0ccda;cursor: pointer;}' + '.fc-upload .fc-upload-con{display:inline-block;}' + '.fc-upload .fc-upload-cover{opacity: 0; position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.6); transition: opacity .3s;}' + '.fc-upload .fc-upload-cover i{ color: #fff; font-size: 20px; cursor: pointer; margin: 0 2px; }' + '.fc-files:hover .fc-upload-cover{opacity: 1; }' + '.form-create .el-form-item .el-rate{margin-top:10px;}' + '.form-create .el-form-item .el-tree{margin-top:7px;}' + '.fc-spin-icon-load{animation: ani-fc-spin 1s linear infinite;} @-webkit-keyframes ani-fc-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes ani-fc-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}50%{-webkit-transform:rotate(180deg);transform:rotate(180deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}';
|
5602 | var nodes = {
|
5603 | modal: 'el-dialog',
|
5604 | progress: 'el-progress',
|
5605 | button: 'el-button',
|
5606 | icon: 'i',
|
5607 | slider: 'el-slider',
|
5608 | rate: 'el-rate',
|
5609 | upload: 'el-upload',
|
5610 | cascader: 'el-cascader',
|
5611 | colorPicker: 'el-color-picker',
|
5612 | timePicker: 'el-time-picker',
|
5613 | datePicker: 'el-date-picker',
|
5614 | 'switch': 'el-switch',
|
5615 | option: 'el-option',
|
5616 | select: 'el-select',
|
5617 | checkbox: 'el-checkbox',
|
5618 | checkboxGroup: 'el-checkbox-Group',
|
5619 | checkboxBtn: 'el-checkbox-button',
|
5620 | radio: 'el-radio',
|
5621 | radioGroup: 'el-radio-group',
|
5622 | radioBtn: 'el-radio-button',
|
5623 | inputNumber: 'el-input-number',
|
5624 | input: 'el-input',
|
5625 | formItem: 'el-form-Item',
|
5626 | form: 'el-form',
|
5627 | col: 'el-col',
|
5628 | row: 'el-row',
|
5629 | tree: 'el-tree',
|
5630 | autoComplete: 'el-autocomplete'
|
5631 | };
|
5632 | function install$1(FormCreate) {
|
5633 | FormCreate.maker = makerFactory(componentList);
|
5634 | VNode.use(nodes);
|
5635 | }
|
5636 | var drive$1 = {
|
5637 | componentList: componentList,
|
5638 | formRender: Form,
|
5639 | style: style,
|
5640 | getConfig: getConfig,
|
5641 | getGlobalApi: getGlobalApi,
|
5642 | install: install$1
|
5643 | };
|
5644 |
|
5645 | setDrive(drive$1);
|
5646 |
|
5647 | if (typeof window !== 'undefined') {
|
5648 | window.formCreate = FormCreate;
|
5649 |
|
5650 | if (window.Vue) {
|
5651 | install(Vue);
|
5652 | }
|
5653 | }
|
5654 |
|
5655 | var maker$e = FormCreate.maker;
|
5656 |
|
5657 | exports.maker = maker$e;
|
5658 | exports.default = FormCreate;
|
5659 |
|
5660 | Object.defineProperty(exports, '__esModule', { value: true });
|
5661 |
|
5662 | })));
|