knt-shared 1.10.0 → 1.10.2
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/dist/components/CheckUpdate/index.vue.d.ts +12 -0
- package/dist/components/CheckUpdate/index.vue.d.ts.map +1 -1
- package/dist/components/Form/useForm.d.ts.map +1 -1
- package/dist/index.cjs.js +29 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +29 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5542,6 +5542,7 @@ function useForm(options = {}) {
|
|
|
5542
5542
|
});
|
|
5543
5543
|
};
|
|
5544
5544
|
const register = async (formInstance) => {
|
|
5545
|
+
var _a;
|
|
5545
5546
|
await nextTick();
|
|
5546
5547
|
if (unwatchFormRef) {
|
|
5547
5548
|
unwatchFormRef();
|
|
@@ -5549,8 +5550,9 @@ function useForm(options = {}) {
|
|
|
5549
5550
|
}
|
|
5550
5551
|
formRef.value = formInstance;
|
|
5551
5552
|
loadedRef.value = true;
|
|
5552
|
-
|
|
5553
|
-
|
|
5553
|
+
const mergedProps = { ...options, ...propsRef.value };
|
|
5554
|
+
if (Object.keys(mergedProps).length > 0) {
|
|
5555
|
+
await setProps(mergedProps);
|
|
5554
5556
|
}
|
|
5555
5557
|
initFormModel();
|
|
5556
5558
|
if (formInstance.formRef) {
|
|
@@ -5571,8 +5573,12 @@ function useForm(options = {}) {
|
|
|
5571
5573
|
);
|
|
5572
5574
|
}
|
|
5573
5575
|
if (pendingValues.value) {
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
+
const registeredSchemas = (_a = formInstance.getSchema) == null ? void 0 : _a.call(formInstance);
|
|
5577
|
+
if (Array.isArray(registeredSchemas) && registeredSchemas.length > 0) {
|
|
5578
|
+
const pending = pendingValues.value;
|
|
5579
|
+
pendingValues.value = null;
|
|
5580
|
+
await setFieldsValue(pending);
|
|
5581
|
+
}
|
|
5576
5582
|
}
|
|
5577
5583
|
};
|
|
5578
5584
|
const getForm = () => {
|
|
@@ -5604,11 +5610,18 @@ function useForm(options = {}) {
|
|
|
5604
5610
|
return { ...formModel };
|
|
5605
5611
|
};
|
|
5606
5612
|
const setFieldsValue = async (values) => {
|
|
5613
|
+
var _a;
|
|
5607
5614
|
const form = getFormSafe();
|
|
5608
5615
|
if (!form) {
|
|
5609
5616
|
pendingValues.value = { ...pendingValues.value, ...values };
|
|
5610
5617
|
return;
|
|
5611
5618
|
}
|
|
5619
|
+
const currentSchemas = (_a = form.getSchema) == null ? void 0 : _a.call(form);
|
|
5620
|
+
const hasSchemas = Array.isArray(currentSchemas) && currentSchemas.length > 0;
|
|
5621
|
+
if (!hasSchemas) {
|
|
5622
|
+
pendingValues.value = { ...pendingValues.value, ...values };
|
|
5623
|
+
return;
|
|
5624
|
+
}
|
|
5612
5625
|
if (form.setFieldsValue) {
|
|
5613
5626
|
await form.setFieldsValue(values);
|
|
5614
5627
|
} else {
|
|
@@ -5736,6 +5749,11 @@ function useForm(options = {}) {
|
|
|
5736
5749
|
if (form.setProps) {
|
|
5737
5750
|
await form.setProps(formProps);
|
|
5738
5751
|
}
|
|
5752
|
+
if (formProps.schemas && pendingValues.value) {
|
|
5753
|
+
const pending = pendingValues.value;
|
|
5754
|
+
pendingValues.value = null;
|
|
5755
|
+
await setFieldsValue(pending);
|
|
5756
|
+
}
|
|
5739
5757
|
};
|
|
5740
5758
|
const scrollToField = async (name, options2) => {
|
|
5741
5759
|
const form = getFormSafe();
|
|
@@ -10646,6 +10664,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10646
10664
|
__name: "index",
|
|
10647
10665
|
props: {
|
|
10648
10666
|
enabled: { type: Boolean, default: true },
|
|
10667
|
+
versionUrl: {},
|
|
10668
|
+
checkInterval: {},
|
|
10669
|
+
sessionKey: {},
|
|
10649
10670
|
title: { default: "页面超时" },
|
|
10650
10671
|
content: { default: "页面已超时,请刷新后正常使用" },
|
|
10651
10672
|
okText: { default: "立即刷新" },
|
|
@@ -10654,7 +10675,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10654
10675
|
setup(__props) {
|
|
10655
10676
|
const props = __props;
|
|
10656
10677
|
const { hasNewVersion, start, stop, applyUpdate, dismissUpdate } = useVersionCheck({
|
|
10657
|
-
enabled: props.enabled
|
|
10678
|
+
enabled: props.enabled,
|
|
10679
|
+
versionUrl: props.versionUrl,
|
|
10680
|
+
checkInterval: props.checkInterval,
|
|
10681
|
+
sessionKey: props.sessionKey
|
|
10658
10682
|
});
|
|
10659
10683
|
onMounted(() => start());
|
|
10660
10684
|
onUnmounted(() => stop());
|