@yibozhang/pro-table 0.0.17 → 0.0.18
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 +19 -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/page-public/antd-form.js +20 -42
- package/fesm2015/yibozhang-pro-table.js +19 -41
- package/fesm2015/yibozhang-pro-table.js.map +1 -1
- package/lib/page-public/antd-form.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/styles/custom-antd.less +18 -0
|
@@ -2928,56 +2928,34 @@
|
|
|
2928
2928
|
// ==================== 工具方法 ====================
|
|
2929
2929
|
// 获取表单类名
|
|
2930
2930
|
AntdFormService.prototype.getFormClassName = function (name) {
|
|
2931
|
-
return "" +
|
|
2931
|
+
return this.classPrefix + "custom-" + name + " ";
|
|
2932
2932
|
};
|
|
2933
2933
|
// 设置 CSS 变量到目标元素(支持持久化监听动态添加的元素)
|
|
2934
2934
|
AntdFormService.prototype.setCSSVariablesToTarget = function (name) {
|
|
2935
2935
|
var _this = this;
|
|
2936
|
-
var selector = "." + this.getFormClassName(name) + " .ant-form-item-label";
|
|
2937
2936
|
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++;
|
|
2937
|
+
var formContainer = document.querySelector(formContainerSelector);
|
|
2938
|
+
// 如果容器还不存在,可以用 MutationObserver 等待它出现
|
|
2939
|
+
if (!formContainer) {
|
|
2940
|
+
var observer_1 = new MutationObserver(function () {
|
|
2941
|
+
var container = document.querySelector(formContainerSelector);
|
|
2942
|
+
if (container) {
|
|
2943
|
+
container.style.setProperty("--label-width", _this.labelWidth);
|
|
2944
|
+
container.style.setProperty("--label-align", _this.labelAlign);
|
|
2945
|
+
observer_1.disconnect();
|
|
2958
2946
|
}
|
|
2959
2947
|
});
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2948
|
+
observer_1.observe(document.body, {
|
|
2949
|
+
childList: true,
|
|
2950
|
+
subtree: true,
|
|
2951
|
+
});
|
|
2952
|
+
// 10秒后自动断开,避免内存泄漏
|
|
2953
|
+
setTimeout(function () { return observer_1.disconnect(); }, 10000);
|
|
2963
2954
|
return;
|
|
2964
2955
|
}
|
|
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;
|
|
2956
|
+
// 在容器上设置 CSS 变量
|
|
2957
|
+
formContainer.style.setProperty("--label-width", this.labelWidth);
|
|
2958
|
+
formContainer.style.setProperty("--label-align", this.labelAlign);
|
|
2981
2959
|
};
|
|
2982
2960
|
// ==================== 私有方法 ====================
|
|
2983
2961
|
// 过滤内部字段(递归处理对象和数组)
|