raise-common-lib 0.0.194 → 0.0.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/raise-common-lib.umd.js +92 -32
- package/bundles/raise-common-lib.umd.js.map +1 -1
- package/bundles/raise-common-lib.umd.min.js +1 -1
- package/bundles/raise-common-lib.umd.min.js.map +1 -1
- package/esm2015/lib/form/drawer-form/drawer-form.component.js +83 -32
- package/esm5/lib/form/drawer-form/drawer-form.component.js +93 -33
- package/fesm2015/raise-common-lib.js +82 -31
- package/fesm2015/raise-common-lib.js.map +1 -1
- package/fesm5/raise-common-lib.js +92 -32
- package/fesm5/raise-common-lib.js.map +1 -1
- package/lib/form/drawer-form/drawer-form.component.d.ts +3 -1
- package/package.json +1 -1
- package/raise-common-lib.metadata.json +1 -1
|
@@ -22282,19 +22282,21 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22282
22282
|
* @return {?}
|
|
22283
22283
|
*/
|
|
22284
22284
|
function (changes) {
|
|
22285
|
+
if (changes._sections) {
|
|
22286
|
+
this.sections = filterShowSection(changes._sections.currentValue);
|
|
22287
|
+
this.form = this.getFormProxy(this.formatForm(this.sections, __assign({}, this.form)));
|
|
22288
|
+
this.syncFormField();
|
|
22289
|
+
}
|
|
22285
22290
|
if (changes._form) {
|
|
22286
22291
|
if (!changes._form.currentValue[FORM_PROXY_TAG]) {
|
|
22287
|
-
this.form = this.getFormProxy(changes._form.currentValue);
|
|
22292
|
+
this.form = this.getFormProxy(this.formatForm(this.sections, changes._form.currentValue));
|
|
22293
|
+
this.syncFormField();
|
|
22288
22294
|
this.formChange.emit(this.form);
|
|
22289
22295
|
}
|
|
22290
22296
|
if (!changes._form.firstChange) {
|
|
22291
22297
|
this.checkFormChange(changes._form.previousValue, changes._form.currentValue);
|
|
22292
22298
|
}
|
|
22293
22299
|
}
|
|
22294
|
-
if (changes._sections) {
|
|
22295
|
-
this.sections = filterShowSection(changes._sections.currentValue);
|
|
22296
|
-
this.formatForm(this.sections);
|
|
22297
|
-
}
|
|
22298
22300
|
};
|
|
22299
22301
|
/**
|
|
22300
22302
|
* @return {?}
|
|
@@ -22399,6 +22401,29 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22399
22401
|
}));
|
|
22400
22402
|
}
|
|
22401
22403
|
};
|
|
22404
|
+
/**
|
|
22405
|
+
* @param {?} value
|
|
22406
|
+
* @param {?} compareValue
|
|
22407
|
+
* @return {?}
|
|
22408
|
+
*/
|
|
22409
|
+
DrawerFormComponent.prototype.equal = /**
|
|
22410
|
+
* @param {?} value
|
|
22411
|
+
* @param {?} compareValue
|
|
22412
|
+
* @return {?}
|
|
22413
|
+
*/
|
|
22414
|
+
function (value, compareValue) {
|
|
22415
|
+
// 只对数组进行特殊判断
|
|
22416
|
+
if (Array.isArray(value) && Array.isArray(compareValue)) {
|
|
22417
|
+
return (value.length === compareValue.length &&
|
|
22418
|
+
value.every((/**
|
|
22419
|
+
* @param {?} i
|
|
22420
|
+
* @param {?} index
|
|
22421
|
+
* @return {?}
|
|
22422
|
+
*/
|
|
22423
|
+
function (i, index) { return i === compareValue[index]; })));
|
|
22424
|
+
}
|
|
22425
|
+
return Object.is(value, compareValue);
|
|
22426
|
+
};
|
|
22402
22427
|
/**
|
|
22403
22428
|
* @param {?} previous
|
|
22404
22429
|
* @param {?} current
|
|
@@ -22417,7 +22442,7 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22417
22442
|
*/
|
|
22418
22443
|
function (_a) {
|
|
22419
22444
|
var _b = __read(_a, 2), key = _b[0], currentValue = _b[1];
|
|
22420
|
-
if (previous[key]
|
|
22445
|
+
if (!_this.equal(previous[key], currentValue)) {
|
|
22421
22446
|
/** @type {?} */
|
|
22422
22447
|
var field = _this.getField(key);
|
|
22423
22448
|
if (field) {
|
|
@@ -22442,17 +22467,47 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22442
22467
|
var date = moment(value);
|
|
22443
22468
|
this.dateForm[field.formKey] = date.isValid() ? date.toDate() : null;
|
|
22444
22469
|
}
|
|
22470
|
+
else {
|
|
22471
|
+
this.dateForm[field.formKey] = null;
|
|
22472
|
+
}
|
|
22473
|
+
};
|
|
22474
|
+
/**
|
|
22475
|
+
* @return {?}
|
|
22476
|
+
*/
|
|
22477
|
+
DrawerFormComponent.prototype.syncFormField = /**
|
|
22478
|
+
* @return {?}
|
|
22479
|
+
*/
|
|
22480
|
+
function () {
|
|
22481
|
+
var _this = this;
|
|
22482
|
+
this.sections.forEach((/**
|
|
22483
|
+
* @param {?} section
|
|
22484
|
+
* @return {?}
|
|
22485
|
+
*/
|
|
22486
|
+
function (section) {
|
|
22487
|
+
section.fields.forEach((/**
|
|
22488
|
+
* @param {?} field
|
|
22489
|
+
* @return {?}
|
|
22490
|
+
*/
|
|
22491
|
+
function (field) {
|
|
22492
|
+
switch (field.fieldFormType) {
|
|
22493
|
+
case "Datepicker":
|
|
22494
|
+
_this.syncFormToDateForm(field, _this.form[field.formKey]);
|
|
22495
|
+
break;
|
|
22496
|
+
}
|
|
22497
|
+
}));
|
|
22498
|
+
}));
|
|
22445
22499
|
};
|
|
22446
22500
|
/**
|
|
22447
22501
|
* @param {?} sections
|
|
22502
|
+
* @param {?} form
|
|
22448
22503
|
* @return {?}
|
|
22449
22504
|
*/
|
|
22450
22505
|
DrawerFormComponent.prototype.formatForm = /**
|
|
22451
22506
|
* @param {?} sections
|
|
22507
|
+
* @param {?} form
|
|
22452
22508
|
* @return {?}
|
|
22453
22509
|
*/
|
|
22454
|
-
function (sections) {
|
|
22455
|
-
var _this = this;
|
|
22510
|
+
function (sections, form) {
|
|
22456
22511
|
sections.forEach((/**
|
|
22457
22512
|
* @param {?} section
|
|
22458
22513
|
* @return {?}
|
|
@@ -22463,30 +22518,32 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22463
22518
|
* @return {?}
|
|
22464
22519
|
*/
|
|
22465
22520
|
function (field) {
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22477
|
-
|
|
22478
|
-
|
|
22479
|
-
|
|
22480
|
-
|
|
22481
|
-
|
|
22482
|
-
|
|
22483
|
-
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22521
|
+
switch (field.fieldFormType) {
|
|
22522
|
+
case "Text":
|
|
22523
|
+
case "Email":
|
|
22524
|
+
case "Textarea":
|
|
22525
|
+
if (form[field.formKey] === undefined) {
|
|
22526
|
+
form[field.formKey] = "";
|
|
22527
|
+
}
|
|
22528
|
+
break;
|
|
22529
|
+
case "Tags":
|
|
22530
|
+
case "Checkbox":
|
|
22531
|
+
case "MultiSelect":
|
|
22532
|
+
if (!Array.isArray(form[field.formKey])) {
|
|
22533
|
+
form[field.formKey] = [];
|
|
22534
|
+
}
|
|
22535
|
+
break;
|
|
22536
|
+
case "Switch":
|
|
22537
|
+
form[field.formKey] = !!form[field.formKey];
|
|
22538
|
+
break;
|
|
22539
|
+
default:
|
|
22540
|
+
if (form[field.formKey] === undefined) {
|
|
22541
|
+
form[field.formKey] = null;
|
|
22542
|
+
}
|
|
22487
22543
|
}
|
|
22488
22544
|
}));
|
|
22489
22545
|
}));
|
|
22546
|
+
return form;
|
|
22490
22547
|
};
|
|
22491
22548
|
/**
|
|
22492
22549
|
* @param {?} form
|
|
@@ -22498,7 +22555,7 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22498
22555
|
*/
|
|
22499
22556
|
function (form) {
|
|
22500
22557
|
var _this = this;
|
|
22501
|
-
//
|
|
22558
|
+
// 现在不支持嵌套 form 属性,只对浅层进行处理
|
|
22502
22559
|
/** @type {?} */
|
|
22503
22560
|
var proxyForm = new Proxy(form, {
|
|
22504
22561
|
set: (/**
|
|
@@ -22511,8 +22568,11 @@ var DrawerFormComponent = /** @class */ (function () {
|
|
|
22511
22568
|
target[prop] = value;
|
|
22512
22569
|
/** @type {?} */
|
|
22513
22570
|
var field = _this.getField(prop);
|
|
22514
|
-
if (field
|
|
22515
|
-
|
|
22571
|
+
if (field) {
|
|
22572
|
+
if (field.fieldFormType === "Datepicker") {
|
|
22573
|
+
_this.syncFormToDateForm(field, value);
|
|
22574
|
+
}
|
|
22575
|
+
_this.formItemValidator(field);
|
|
22516
22576
|
}
|
|
22517
22577
|
return true;
|
|
22518
22578
|
}),
|