@yibozhang/pro-table 0.0.17 → 0.0.19
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/yibozhang-pro-table.umd.js +98 -41
- package/bundles/yibozhang-pro-table.umd.js.map +1 -1
- package/bundles/yibozhang-pro-table.umd.min.js +1 -1
- package/bundles/yibozhang-pro-table.umd.min.js.map +1 -1
- package/esm2015/lib/directives/trim-input.directive.js +66 -0
- package/esm2015/lib/directives/trim-input.module.js +11 -0
- package/esm2015/lib/page-public/antd-form.js +20 -42
- package/esm2015/public-api.js +2 -1
- package/esm2015/yibozhang-pro-table.js +2 -1
- package/fesm2015/yibozhang-pro-table.js +95 -44
- package/fesm2015/yibozhang-pro-table.js.map +1 -1
- package/lib/components/colmuns-setting/colmuns-setting.component.less.shim.ngstyle.d.ts.map +1 -0
- package/lib/components/colmuns-setting/colmuns-setting.component.ngfactory.d.ts.map +1 -0
- package/lib/components/dynamic-search-field/dynamic-search-field.component.ngfactory.d.ts.map +1 -0
- package/lib/directives/trim-input.directive.d.ts +11 -0
- package/lib/directives/trim-input.directive.d.ts.map +1 -0
- package/lib/directives/trim-input.directive.ngfactory.d.ts.map +1 -0
- package/lib/directives/trim-input.module.d.ts +3 -0
- package/lib/directives/trim-input.module.d.ts.map +1 -0
- package/lib/directives/trim-input.module.ngfactory.d.ts.map +1 -0
- package/lib/page-container/page-container.component.less.shim.ngstyle.d.ts.map +1 -0
- package/lib/page-container/page-container.component.ngfactory.d.ts.map +1 -0
- package/lib/page-container/page-container.module.ngfactory.d.ts.map +1 -0
- package/lib/page-public/antd-form.d.ts.map +1 -1
- package/lib/page-public/antd-form.ngfactory.d.ts.map +1 -0
- package/lib/page-public/array-form.ngfactory.d.ts.map +1 -0
- package/lib/plate-input/plate-input.component.less.shim.ngstyle.d.ts.map +1 -0
- package/lib/plate-input/plate-input.component.ngfactory.d.ts.map +1 -0
- package/lib/plate-input/plate-input.module.ngfactory.d.ts.map +1 -0
- package/lib/plate-input/plate-prefix-load.service.ngfactory.d.ts.map +1 -0
- package/lib/pro-table.component.css.shim.ngstyle.d.ts.map +1 -0
- package/lib/pro-table.component.ngfactory.d.ts.map +1 -0
- package/lib/pro-table.module.ngfactory.d.ts.map +1 -0
- package/lib/table-search-bar/table-search-bar-module.ngfactory.d.ts.map +1 -0
- package/lib/table-search-bar/table-search-bar.component.less.shim.ngstyle.d.ts.map +1 -0
- package/lib/table-search-bar/table-search-bar.component.ngfactory.d.ts.map +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/public-api.d.ts.map +1 -1
- package/src/lib/styles/custom-antd.less +18 -0
- package/yibozhang-pro-table.d.ts +1 -0
- package/yibozhang-pro-table.d.ts.map +1 -1
- package/yibozhang-pro-table.metadata.json +1 -1
|
@@ -2453,6 +2453,83 @@
|
|
|
2453
2453
|
{ type: http.HttpClient }
|
|
2454
2454
|
]; };
|
|
2455
2455
|
|
|
2456
|
+
var TrimInputDirective = /** @class */ (function () {
|
|
2457
|
+
function TrimInputDirective(el, ngControl) {
|
|
2458
|
+
this.el = el;
|
|
2459
|
+
this.ngControl = ngControl;
|
|
2460
|
+
}
|
|
2461
|
+
TrimInputDirective.prototype.shouldProcess = function () {
|
|
2462
|
+
if (this.el.nativeElement.hasAttribute("allow-trim")) {
|
|
2463
|
+
return false;
|
|
2464
|
+
}
|
|
2465
|
+
if (this.el.nativeElement.hasAttribute("not-allow-trim")) {
|
|
2466
|
+
return true;
|
|
2467
|
+
}
|
|
2468
|
+
var element = this.el.nativeElement;
|
|
2469
|
+
while (element) {
|
|
2470
|
+
var className = element.className;
|
|
2471
|
+
if (typeof className === "string" &&
|
|
2472
|
+
className.includes("ant-form-custom")) {
|
|
2473
|
+
return true;
|
|
2474
|
+
}
|
|
2475
|
+
element = element.parentElement;
|
|
2476
|
+
}
|
|
2477
|
+
return false;
|
|
2478
|
+
};
|
|
2479
|
+
TrimInputDirective.prototype.onBlur = function () {
|
|
2480
|
+
if (!this.shouldProcess()) {
|
|
2481
|
+
return;
|
|
2482
|
+
}
|
|
2483
|
+
var value = this.el.nativeElement.value;
|
|
2484
|
+
if (typeof value === "string") {
|
|
2485
|
+
var trimmedValue = value.trim();
|
|
2486
|
+
this.el.nativeElement.value = trimmedValue;
|
|
2487
|
+
if (this.ngControl && this.ngControl.control) {
|
|
2488
|
+
this.ngControl.control.setValue(trimmedValue, { emitEvent: false });
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
};
|
|
2492
|
+
TrimInputDirective.prototype.onInput = function () {
|
|
2493
|
+
if (!this.shouldProcess()) {
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
var value = this.el.nativeElement.value;
|
|
2497
|
+
if (typeof value === "string" && /\s/.test(value)) {
|
|
2498
|
+
var noSpaceValue = value.replace(/\s/g, "");
|
|
2499
|
+
this.el.nativeElement.value = noSpaceValue;
|
|
2500
|
+
if (this.ngControl && this.ngControl.control) {
|
|
2501
|
+
this.ngControl.control.setValue(noSpaceValue, { emitEvent: false });
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
};
|
|
2505
|
+
return TrimInputDirective;
|
|
2506
|
+
}());
|
|
2507
|
+
TrimInputDirective.decorators = [
|
|
2508
|
+
{ type: i0.Directive, args: [{
|
|
2509
|
+
selector: "input[nz-input],textarea[nz-input]",
|
|
2510
|
+
},] }
|
|
2511
|
+
];
|
|
2512
|
+
TrimInputDirective.ctorParameters = function () { return [
|
|
2513
|
+
{ type: i0.ElementRef },
|
|
2514
|
+
{ type: i1.NgControl, decorators: [{ type: i0.Optional }] }
|
|
2515
|
+
]; };
|
|
2516
|
+
TrimInputDirective.propDecorators = {
|
|
2517
|
+
onBlur: [{ type: i0.HostListener, args: ["blur",] }],
|
|
2518
|
+
onInput: [{ type: i0.HostListener, args: ["input",] }]
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2521
|
+
var TrimInputModule = /** @class */ (function () {
|
|
2522
|
+
function TrimInputModule() {
|
|
2523
|
+
}
|
|
2524
|
+
return TrimInputModule;
|
|
2525
|
+
}());
|
|
2526
|
+
TrimInputModule.decorators = [
|
|
2527
|
+
{ type: i0.NgModule, args: [{
|
|
2528
|
+
declarations: [TrimInputDirective],
|
|
2529
|
+
exports: [TrimInputDirective],
|
|
2530
|
+
},] }
|
|
2531
|
+
];
|
|
2532
|
+
|
|
2456
2533
|
// ==================== 服务类 ====================
|
|
2457
2534
|
var AntdFormService = /** @class */ (function () {
|
|
2458
2535
|
// ==================== 构造函数 ====================
|
|
@@ -2928,56 +3005,34 @@
|
|
|
2928
3005
|
// ==================== 工具方法 ====================
|
|
2929
3006
|
// 获取表单类名
|
|
2930
3007
|
AntdFormService.prototype.getFormClassName = function (name) {
|
|
2931
|
-
return "" +
|
|
3008
|
+
return this.classPrefix + "custom-" + name + " ";
|
|
2932
3009
|
};
|
|
2933
3010
|
// 设置 CSS 变量到目标元素(支持持久化监听动态添加的元素)
|
|
2934
3011
|
AntdFormService.prototype.setCSSVariablesToTarget = function (name) {
|
|
2935
3012
|
var _this = this;
|
|
2936
|
-
var selector = "." + this.getFormClassName(name) + " .ant-form-item-label";
|
|
2937
3013
|
var formContainerSelector = "." + this.getFormClassName(name);
|
|
2938
|
-
var
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
return;
|
|
2948
|
-
}
|
|
2949
|
-
var customWidth = target.getAttribute("custom-width");
|
|
2950
|
-
var customAlign = target.getAttribute("custom-align");
|
|
2951
|
-
var finalWidth = customWidth || _this.labelWidth;
|
|
2952
|
-
var finalTextAlign = customAlign || _this.labelAlign;
|
|
2953
|
-
if (target.style.width !== finalWidth ||
|
|
2954
|
-
target.style.textAlign !== finalTextAlign) {
|
|
2955
|
-
target.style.width = finalWidth;
|
|
2956
|
-
target.style.textAlign = finalTextAlign;
|
|
2957
|
-
appliedCount++;
|
|
3014
|
+
var formContainer = document.querySelector(formContainerSelector);
|
|
3015
|
+
// 如果容器还不存在,可以用 MutationObserver 等待它出现
|
|
3016
|
+
if (!formContainer) {
|
|
3017
|
+
var observer_1 = new MutationObserver(function () {
|
|
3018
|
+
var container = document.querySelector(formContainerSelector);
|
|
3019
|
+
if (container) {
|
|
3020
|
+
container.style.setProperty("--label-width", _this.labelWidth);
|
|
3021
|
+
container.style.setProperty("--label-align", _this.labelAlign);
|
|
3022
|
+
observer_1.disconnect();
|
|
2958
3023
|
}
|
|
2959
3024
|
});
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
3025
|
+
observer_1.observe(document.body, {
|
|
3026
|
+
childList: true,
|
|
3027
|
+
subtree: true,
|
|
3028
|
+
});
|
|
3029
|
+
// 10秒后自动断开,避免内存泄漏
|
|
3030
|
+
setTimeout(function () { return observer_1.disconnect(); }, 10000);
|
|
2963
3031
|
return;
|
|
2964
3032
|
}
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
timeout = requestAnimationFrame(function () {
|
|
2969
|
-
setTimeout(function () {
|
|
2970
|
-
applyStyles();
|
|
2971
|
-
}, 0);
|
|
2972
|
-
});
|
|
2973
|
-
});
|
|
2974
|
-
var formContainer = document.querySelector(formContainerSelector);
|
|
2975
|
-
observer.observe(formContainer || document.body, {
|
|
2976
|
-
childList: true,
|
|
2977
|
-
subtree: true,
|
|
2978
|
-
attributes: true,
|
|
2979
|
-
});
|
|
2980
|
-
this.labelObservers[name] = observer;
|
|
3033
|
+
// 在容器上设置 CSS 变量
|
|
3034
|
+
formContainer.style.setProperty("--label-width", this.labelWidth);
|
|
3035
|
+
formContainer.style.setProperty("--label-align", this.labelAlign);
|
|
2981
3036
|
};
|
|
2982
3037
|
// ==================== 私有方法 ====================
|
|
2983
3038
|
// 过滤内部字段(递归处理对象和数组)
|
|
@@ -3484,6 +3539,7 @@
|
|
|
3484
3539
|
exports.ProTableComponent = ProTableComponent;
|
|
3485
3540
|
exports.ProTableModule = ProTableModule;
|
|
3486
3541
|
exports.TableSearchBarModule = TableSearchBarModule;
|
|
3542
|
+
exports.TrimInputModule = TrimInputModule;
|
|
3487
3543
|
exports["ɵ0"] = ɵ0;
|
|
3488
3544
|
exports["ɵ1"] = ɵ1;
|
|
3489
3545
|
exports["ɵ2"] = ɵ2;
|
|
@@ -3492,6 +3548,7 @@
|
|
|
3492
3548
|
exports["ɵc"] = PlateInputComponent;
|
|
3493
3549
|
exports["ɵd"] = ColmunsSettingComponent;
|
|
3494
3550
|
exports["ɵe"] = DynamicSearchFieldComponent;
|
|
3551
|
+
exports["ɵf"] = TrimInputDirective;
|
|
3495
3552
|
|
|
3496
3553
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3497
3554
|
|