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
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
2
|
/** 是否启用版本检测 */
|
|
3
3
|
enabled?: boolean;
|
|
4
|
+
/** version.json 的请求路径 */
|
|
5
|
+
versionUrl?: string;
|
|
6
|
+
/** 定时轮询间隔(毫秒) */
|
|
7
|
+
checkInterval?: number;
|
|
8
|
+
/** sessionStorage 存储 key */
|
|
9
|
+
sessionKey?: string;
|
|
4
10
|
/** 弹窗标题 */
|
|
5
11
|
title?: string;
|
|
6
12
|
/** 弹窗内容 */
|
|
@@ -18,6 +24,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
18
24
|
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
19
25
|
/** 是否启用版本检测 */
|
|
20
26
|
enabled?: boolean;
|
|
27
|
+
/** version.json 的请求路径 */
|
|
28
|
+
versionUrl?: string;
|
|
29
|
+
/** 定时轮询间隔(毫秒) */
|
|
30
|
+
checkInterval?: number;
|
|
31
|
+
/** sessionStorage 存储 key */
|
|
32
|
+
sessionKey?: string;
|
|
21
33
|
/** 弹窗标题 */
|
|
22
34
|
title?: string;
|
|
23
35
|
/** 弹窗内容 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CheckUpdate/index.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CheckUpdate/index.vue"],"names":[],"mappings":";IAqIM,eAAe;cACL,OAAO;IACjB,yBAAyB;iBACZ,MAAM;IACnB,iBAAiB;oBACD,MAAM;IACtB,4BAA4B;iBACf,MAAM;IACnB,WAAW;YACH,MAAM;IACd,WAAW;cACD,MAAM;IAChB,aAAa;aACJ,MAAM;IACf,aAAa;iBACA,MAAM;;;;;;;;IAfnB,eAAe;cACL,OAAO;IACjB,yBAAyB;iBACZ,MAAM;IACnB,iBAAiB;oBACD,MAAM;IACtB,4BAA4B;iBACf,MAAM;IACnB,WAAW;YACH,MAAM;IACd,WAAW;cACD,MAAM;IAChB,aAAa;aACJ,MAAM;IACf,aAAa;iBACA,MAAM;;;;;;;;aAdT,OAAO;WAQT,MAAM;aAEJ,MAAM;YAEP,MAAM;gBAEF,MAAM;;AArBzB,wBAuBG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QACxE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AACN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/components/Form/useForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,OAAO,GAAE,cAAmB,GAC3B,CAAC,CAAC,YAAY,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../src/components/Form/useForm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAC;AAEzF;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,OAAO,GAAE,cAAmB,GAC3B,CAAC,CAAC,YAAY,EAAE,GAAG,KAAK,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,CAwXhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,EAAE,CAKpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,EAAE,EAAE,GAAG,UAAU,EAAE,CAEzE"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -5544,6 +5544,7 @@ function useForm(options = {}) {
|
|
|
5544
5544
|
});
|
|
5545
5545
|
};
|
|
5546
5546
|
const register = async (formInstance) => {
|
|
5547
|
+
var _a;
|
|
5547
5548
|
await vue.nextTick();
|
|
5548
5549
|
if (unwatchFormRef) {
|
|
5549
5550
|
unwatchFormRef();
|
|
@@ -5551,8 +5552,9 @@ function useForm(options = {}) {
|
|
|
5551
5552
|
}
|
|
5552
5553
|
formRef.value = formInstance;
|
|
5553
5554
|
loadedRef.value = true;
|
|
5554
|
-
|
|
5555
|
-
|
|
5555
|
+
const mergedProps = { ...options, ...propsRef.value };
|
|
5556
|
+
if (Object.keys(mergedProps).length > 0) {
|
|
5557
|
+
await setProps(mergedProps);
|
|
5556
5558
|
}
|
|
5557
5559
|
initFormModel();
|
|
5558
5560
|
if (formInstance.formRef) {
|
|
@@ -5573,8 +5575,12 @@ function useForm(options = {}) {
|
|
|
5573
5575
|
);
|
|
5574
5576
|
}
|
|
5575
5577
|
if (pendingValues.value) {
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
+
const registeredSchemas = (_a = formInstance.getSchema) == null ? void 0 : _a.call(formInstance);
|
|
5579
|
+
if (Array.isArray(registeredSchemas) && registeredSchemas.length > 0) {
|
|
5580
|
+
const pending = pendingValues.value;
|
|
5581
|
+
pendingValues.value = null;
|
|
5582
|
+
await setFieldsValue(pending);
|
|
5583
|
+
}
|
|
5578
5584
|
}
|
|
5579
5585
|
};
|
|
5580
5586
|
const getForm = () => {
|
|
@@ -5606,11 +5612,18 @@ function useForm(options = {}) {
|
|
|
5606
5612
|
return { ...formModel };
|
|
5607
5613
|
};
|
|
5608
5614
|
const setFieldsValue = async (values) => {
|
|
5615
|
+
var _a;
|
|
5609
5616
|
const form = getFormSafe();
|
|
5610
5617
|
if (!form) {
|
|
5611
5618
|
pendingValues.value = { ...pendingValues.value, ...values };
|
|
5612
5619
|
return;
|
|
5613
5620
|
}
|
|
5621
|
+
const currentSchemas = (_a = form.getSchema) == null ? void 0 : _a.call(form);
|
|
5622
|
+
const hasSchemas = Array.isArray(currentSchemas) && currentSchemas.length > 0;
|
|
5623
|
+
if (!hasSchemas) {
|
|
5624
|
+
pendingValues.value = { ...pendingValues.value, ...values };
|
|
5625
|
+
return;
|
|
5626
|
+
}
|
|
5614
5627
|
if (form.setFieldsValue) {
|
|
5615
5628
|
await form.setFieldsValue(values);
|
|
5616
5629
|
} else {
|
|
@@ -5738,6 +5751,11 @@ function useForm(options = {}) {
|
|
|
5738
5751
|
if (form.setProps) {
|
|
5739
5752
|
await form.setProps(formProps);
|
|
5740
5753
|
}
|
|
5754
|
+
if (formProps.schemas && pendingValues.value) {
|
|
5755
|
+
const pending = pendingValues.value;
|
|
5756
|
+
pendingValues.value = null;
|
|
5757
|
+
await setFieldsValue(pending);
|
|
5758
|
+
}
|
|
5741
5759
|
};
|
|
5742
5760
|
const scrollToField = async (name, options2) => {
|
|
5743
5761
|
const form = getFormSafe();
|
|
@@ -10648,6 +10666,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
10648
10666
|
__name: "index",
|
|
10649
10667
|
props: {
|
|
10650
10668
|
enabled: { type: Boolean, default: true },
|
|
10669
|
+
versionUrl: {},
|
|
10670
|
+
checkInterval: {},
|
|
10671
|
+
sessionKey: {},
|
|
10651
10672
|
title: { default: "页面超时" },
|
|
10652
10673
|
content: { default: "页面已超时,请刷新后正常使用" },
|
|
10653
10674
|
okText: { default: "立即刷新" },
|
|
@@ -10656,7 +10677,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
10656
10677
|
setup(__props) {
|
|
10657
10678
|
const props = __props;
|
|
10658
10679
|
const { hasNewVersion, start, stop, applyUpdate, dismissUpdate } = useVersionCheck({
|
|
10659
|
-
enabled: props.enabled
|
|
10680
|
+
enabled: props.enabled,
|
|
10681
|
+
versionUrl: props.versionUrl,
|
|
10682
|
+
checkInterval: props.checkInterval,
|
|
10683
|
+
sessionKey: props.sessionKey
|
|
10660
10684
|
});
|
|
10661
10685
|
vue.onMounted(() => start());
|
|
10662
10686
|
vue.onUnmounted(() => stop());
|