zzz-pc-view 0.0.5 → 0.0.7
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/package.json +1 -1
- package/src/decorators/CurdKey/index.d.ts +1 -1
- package/src/decorators/index.d.ts +1 -0
- package/src/decorators/{CurdKey/RequestUtil.d.ts → useRequestUtil.d.ts} +2 -2
- package/src/index.es.js +111 -65
- package/src/index.umd.js +2 -2
- package/src/pcViews/components/forms/RadioGroupView.vue.d.ts +19 -0
- package/src/pcViews/components/forms/index.d.ts +1 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { FilterHandler } from '../FilterKey';
|
|
|
4
4
|
import { EditTypeEnum, CurdApi, EditType, PaginationResponseConstructor } from './CurdApi';
|
|
5
5
|
import { Config as PrimaryKeyConfig } from './../PrimaryKey';
|
|
6
6
|
import { Config as NameKeyConfig } from './../NameKey';
|
|
7
|
-
import { RequestUtilResponse } from '
|
|
7
|
+
import { RequestUtilResponse } from '../useRequestUtil';
|
|
8
8
|
export * from './CurdApi';
|
|
9
9
|
/**
|
|
10
10
|
* 基础参数接口,用于定义通用的参数属性。
|
package/src/index.es.js
CHANGED
|
@@ -2151,6 +2151,59 @@ const useLoadUtil = () => {
|
|
|
2151
2151
|
};
|
|
2152
2152
|
const loadStore$1 = useLoadUtil();
|
|
2153
2153
|
const useLoadStore = () => loadStore$1;
|
|
2154
|
+
const useRequestUtil = (endableLoadStatus) => {
|
|
2155
|
+
let request;
|
|
2156
|
+
let setLoadStatus = fn;
|
|
2157
|
+
const abort = () => {
|
|
2158
|
+
if (request) {
|
|
2159
|
+
request.ajaxSource.cancel();
|
|
2160
|
+
request = void 0;
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
const response2 = {
|
|
2164
|
+
// 将 abort 方法添加到响应对象中
|
|
2165
|
+
abort,
|
|
2166
|
+
/**
|
|
2167
|
+
* 定义一个方法,用于发送请求并处理响应。
|
|
2168
|
+
* 这个方法会发送一个 HTTP 请求,并根据请求的结果调用相应的回调函数。
|
|
2169
|
+
* @method requestData
|
|
2170
|
+
* @param {T} httpRequest - 一个继承自 httpRequest.HttpRequestPromise 的泛型类型,表示 HTTP 请求对象。
|
|
2171
|
+
* @param {Function} [final] - 一个可选的函数,用于在请求完成后执行最终操作。
|
|
2172
|
+
* @returns {Promise<T extends httpRequest.HttpRequestPromise<infer R> ? R : never>} - 一个返回值为请求结果的 Promise。
|
|
2173
|
+
* @description 这个方法会在请求开始时调用 abort 方法,以取消之前的请求。
|
|
2174
|
+
* @description 它会在请求过程中更新加载状态,并在请求完成后重置加载状态。
|
|
2175
|
+
* @description 如果请求成功,它会返回请求的结果。
|
|
2176
|
+
* @description 如果请求失败,它会抛出错误。
|
|
2177
|
+
* @description 在请求完成后,它会调用 final 方法,并传递一个布尔值表示请求是否被取消。
|
|
2178
|
+
*/
|
|
2179
|
+
async requestData(httpRequestPromise, final) {
|
|
2180
|
+
abort();
|
|
2181
|
+
setLoadStatus(true);
|
|
2182
|
+
request = httpRequestPromise;
|
|
2183
|
+
try {
|
|
2184
|
+
return await request;
|
|
2185
|
+
} catch (err) {
|
|
2186
|
+
throw err;
|
|
2187
|
+
} finally {
|
|
2188
|
+
setLoadStatus(false);
|
|
2189
|
+
let isAbort = false;
|
|
2190
|
+
if (request) {
|
|
2191
|
+
request = void 0;
|
|
2192
|
+
isAbort = true;
|
|
2193
|
+
}
|
|
2194
|
+
final == null ? void 0 : final(isAbort);
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
};
|
|
2198
|
+
if (endableLoadStatus) {
|
|
2199
|
+
const loadStore2 = useLoadUtil();
|
|
2200
|
+
setLoadStatus = (status) => {
|
|
2201
|
+
loadStore2.setLoadStatus(status);
|
|
2202
|
+
};
|
|
2203
|
+
Object.defineProperties(response2, Object.getOwnPropertyDescriptors(loadStore2));
|
|
2204
|
+
}
|
|
2205
|
+
return response2;
|
|
2206
|
+
};
|
|
2154
2207
|
let api;
|
|
2155
2208
|
const setApi = (...args) => {
|
|
2156
2209
|
api = create(...args);
|
|
@@ -3054,49 +3107,6 @@ class CurdApi {
|
|
|
3054
3107
|
URL.revokeObjectURL(a.href);
|
|
3055
3108
|
}
|
|
3056
3109
|
}
|
|
3057
|
-
const useRequestUtil = (endableLoadStatus) => {
|
|
3058
|
-
let request;
|
|
3059
|
-
const abort = () => {
|
|
3060
|
-
if (request) {
|
|
3061
|
-
request.ajaxSource.cancel();
|
|
3062
|
-
request = void 0;
|
|
3063
|
-
}
|
|
3064
|
-
};
|
|
3065
|
-
const response2 = {
|
|
3066
|
-
// 将 abort 方法添加到响应对象中
|
|
3067
|
-
abort,
|
|
3068
|
-
/**
|
|
3069
|
-
* 定义一个方法,用于发送请求并处理响应。
|
|
3070
|
-
* 这个方法会发送一个 HTTP 请求,并根据请求的结果调用相应的回调函数。
|
|
3071
|
-
* @method requestData
|
|
3072
|
-
* @param {T} httpRequest - 一个继承自 httpRequest.HttpRequestPromise 的泛型类型,表示 HTTP 请求对象。
|
|
3073
|
-
* @param {Function} [final] - 一个可选的函数,用于在请求完成后执行最终操作。
|
|
3074
|
-
* @returns {Promise<T extends httpRequest.HttpRequestPromise<infer R> ? R : never>} - 一个返回值为请求结果的 Promise。
|
|
3075
|
-
* @description 这个方法会在请求开始时调用 abort 方法,以取消之前的请求。
|
|
3076
|
-
* @description 它会在请求过程中更新加载状态,并在请求完成后重置加载状态。
|
|
3077
|
-
* @description 如果请求成功,它会返回请求的结果。
|
|
3078
|
-
* @description 如果请求失败,它会抛出错误。
|
|
3079
|
-
* @description 在请求完成后,它会调用 final 方法,并传递一个布尔值表示请求是否被取消。
|
|
3080
|
-
*/
|
|
3081
|
-
async requestData(httpRequestPromise, final) {
|
|
3082
|
-
abort();
|
|
3083
|
-
request = httpRequestPromise;
|
|
3084
|
-
try {
|
|
3085
|
-
return await request;
|
|
3086
|
-
} catch (err) {
|
|
3087
|
-
throw err;
|
|
3088
|
-
} finally {
|
|
3089
|
-
let isAbort = false;
|
|
3090
|
-
if (request) {
|
|
3091
|
-
request = void 0;
|
|
3092
|
-
isAbort = true;
|
|
3093
|
-
}
|
|
3094
|
-
final == null ? void 0 : final(isAbort);
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
};
|
|
3098
|
-
return response2;
|
|
3099
|
-
};
|
|
3100
3110
|
const key = Symbol("CurdKey");
|
|
3101
3111
|
const classCurdKey = Symbol("ClassCurdKey");
|
|
3102
3112
|
var CreateTypeEnum = /* @__PURE__ */ ((CreateTypeEnum2) => {
|
|
@@ -3881,7 +3891,8 @@ const ZDecorators = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
3881
3891
|
combineDecorator,
|
|
3882
3892
|
setApi,
|
|
3883
3893
|
useLoadStore,
|
|
3884
|
-
useLoadUtil
|
|
3894
|
+
useLoadUtil,
|
|
3895
|
+
useRequestUtil
|
|
3885
3896
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3886
3897
|
var zhCn = {
|
|
3887
3898
|
name: "zh-cn",
|
|
@@ -9593,7 +9604,7 @@ class CurdViewHandler extends CurdHandler {
|
|
|
9593
9604
|
const _hoisted_1$4 = { class: "flex column wrapper data-wrapper" };
|
|
9594
9605
|
const _hoisted_2$1 = { class: "flex flex-wrap gap-10 data-wrapper-header" };
|
|
9595
9606
|
const _hoisted_3$1 = { class: "flex gap-10 data-wrapper-footer" };
|
|
9596
|
-
const _sfc_main$
|
|
9607
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
9597
9608
|
__name: "DataWrapperView",
|
|
9598
9609
|
props: {
|
|
9599
9610
|
bodyViewClass: {}
|
|
@@ -9661,7 +9672,7 @@ const useModelValueBridgeComputed = (props, emit) => computed({
|
|
|
9661
9672
|
emit("change", value);
|
|
9662
9673
|
}
|
|
9663
9674
|
});
|
|
9664
|
-
const _sfc_main$
|
|
9675
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
9665
9676
|
__name: "VSlotView",
|
|
9666
9677
|
props: {
|
|
9667
9678
|
component: {},
|
|
@@ -9684,7 +9695,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
9684
9695
|
};
|
|
9685
9696
|
}
|
|
9686
9697
|
});
|
|
9687
|
-
const _sfc_main$
|
|
9698
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
9688
9699
|
__name: "CurdTableView",
|
|
9689
9700
|
props: {
|
|
9690
9701
|
viewHandler: {}
|
|
@@ -9744,7 +9755,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
9744
9755
|
ref_for: true
|
|
9745
9756
|
}, column.colProps || unref(emptyObject2)), {
|
|
9746
9757
|
default: withCtx(({ row }) => [
|
|
9747
|
-
(openBlock(), createBlock(resolveDynamicComponent(column.component || _sfc_main$
|
|
9758
|
+
(openBlock(), createBlock(resolveDynamicComponent(column.component || _sfc_main$9), mergeProps({
|
|
9748
9759
|
viewHandler: _ctx.viewHandler,
|
|
9749
9760
|
model: row,
|
|
9750
9761
|
prop: column.propertyKey,
|
|
@@ -9761,7 +9772,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
9761
9772
|
}
|
|
9762
9773
|
});
|
|
9763
9774
|
const _hoisted_1$3 = { key: 0 };
|
|
9764
|
-
const _sfc_main$
|
|
9775
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
9765
9776
|
__name: "FilterView",
|
|
9766
9777
|
props: {
|
|
9767
9778
|
viewHandler: {},
|
|
@@ -9802,7 +9813,7 @@ const _hoisted_2 = { class: "flex-1 fit-size" };
|
|
|
9802
9813
|
const _hoisted_3 = { class: "curd-list-aside" };
|
|
9803
9814
|
const _hoisted_4 = { class: "flex-1 fit-size curd-list-content" };
|
|
9804
9815
|
const _hoisted_5 = { class: "curd-list-aside" };
|
|
9805
|
-
const _sfc_main$
|
|
9816
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
9806
9817
|
__name: "CurdView",
|
|
9807
9818
|
props: {
|
|
9808
9819
|
viewHandler: {}
|
|
@@ -9811,10 +9822,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9811
9822
|
return (_ctx, _cache) => {
|
|
9812
9823
|
const _component_el_card = resolveComponent("el-card");
|
|
9813
9824
|
const _directive_loading = resolveDirective("loading");
|
|
9814
|
-
return openBlock(), createBlock(_sfc_main$
|
|
9825
|
+
return openBlock(), createBlock(_sfc_main$a, null, {
|
|
9815
9826
|
header: withCtx(() => [
|
|
9816
9827
|
renderSlot(_ctx.$slots, "header-before"),
|
|
9817
|
-
_ctx.viewHandler.displayFilterConfigMap[unref(ZDecorators).FilterKey.PositionEnum.TOP] ? (openBlock(), createBlock(_sfc_main$
|
|
9828
|
+
_ctx.viewHandler.displayFilterConfigMap[unref(ZDecorators).FilterKey.PositionEnum.TOP] ? (openBlock(), createBlock(_sfc_main$7, {
|
|
9818
9829
|
key: 0,
|
|
9819
9830
|
"view-handler": _ctx.viewHandler,
|
|
9820
9831
|
position: unref(ZDecorators).FilterKey.PositionEnum.TOP
|
|
@@ -9835,7 +9846,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9835
9846
|
default: withCtx(() => [
|
|
9836
9847
|
_ctx.viewHandler.displayFilterConfigMap[unref(ZDecorators).FilterKey.PositionEnum.LEFT] ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
9837
9848
|
createElementVNode("div", _hoisted_3, [
|
|
9838
|
-
createVNode(_sfc_main$
|
|
9849
|
+
createVNode(_sfc_main$7, {
|
|
9839
9850
|
"view-handler": _ctx.viewHandler,
|
|
9840
9851
|
position: unref(ZDecorators).FilterKey.PositionEnum.LEFT
|
|
9841
9852
|
}, null, 8, ["view-handler", "position"])
|
|
@@ -9844,7 +9855,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9844
9855
|
], 64)) : createCommentVNode("", true),
|
|
9845
9856
|
withDirectives((openBlock(), createElementBlock("div", _hoisted_4, [
|
|
9846
9857
|
renderSlot(_ctx.$slots, "content", {}, () => [
|
|
9847
|
-
createVNode(_sfc_main$
|
|
9858
|
+
createVNode(_sfc_main$8, { "view-handler": _ctx.viewHandler }, null, 8, ["view-handler"])
|
|
9848
9859
|
])
|
|
9849
9860
|
])), [
|
|
9850
9861
|
[_directive_loading, _ctx.viewHandler.listLoadStatus]
|
|
@@ -9852,7 +9863,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9852
9863
|
_ctx.viewHandler.displayFilterConfigMap[unref(ZDecorators).FilterKey.PositionEnum.RIGHT] ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
9853
9864
|
_cache[1] || (_cache[1] = createElementVNode("div", { class: "curd-list-divider" }, null, -1)),
|
|
9854
9865
|
createElementVNode("div", _hoisted_5, [
|
|
9855
|
-
createVNode(_sfc_main$
|
|
9866
|
+
createVNode(_sfc_main$7, {
|
|
9856
9867
|
"view-handler": _ctx.viewHandler,
|
|
9857
9868
|
position: unref(ZDecorators).FilterKey.PositionEnum.RIGHT
|
|
9858
9869
|
}, null, 8, ["view-handler", "position"])
|
|
@@ -9869,10 +9880,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
9869
9880
|
});
|
|
9870
9881
|
const index$5 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9871
9882
|
__proto__: null,
|
|
9872
|
-
CurdView: _sfc_main$
|
|
9883
|
+
CurdView: _sfc_main$6,
|
|
9873
9884
|
CurdViewHandler
|
|
9874
9885
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9875
|
-
const _sfc_main$
|
|
9886
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
9876
9887
|
__name: "SelectView",
|
|
9877
9888
|
props: {
|
|
9878
9889
|
options: {},
|
|
@@ -9906,7 +9917,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
9906
9917
|
};
|
|
9907
9918
|
}
|
|
9908
9919
|
});
|
|
9909
|
-
const _sfc_main$
|
|
9920
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
9910
9921
|
__name: "VModelView",
|
|
9911
9922
|
props: {
|
|
9912
9923
|
component: {},
|
|
@@ -9916,7 +9927,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
9916
9927
|
},
|
|
9917
9928
|
setup(__props) {
|
|
9918
9929
|
const props = __props;
|
|
9919
|
-
const mappingComputed = useMappingOption(props, _sfc_main$
|
|
9930
|
+
const mappingComputed = useMappingOption(props, _sfc_main$5, ElInput);
|
|
9920
9931
|
const modelValueBridgeComputed = computed({
|
|
9921
9932
|
get: () => props.model[props.prop],
|
|
9922
9933
|
set: (value) => {
|
|
@@ -9932,7 +9943,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
9932
9943
|
};
|
|
9933
9944
|
}
|
|
9934
9945
|
});
|
|
9935
|
-
const _sfc_main$
|
|
9946
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
9936
9947
|
__name: "RadioButtonGroupView",
|
|
9937
9948
|
props: {
|
|
9938
9949
|
options: {},
|
|
@@ -9966,15 +9977,50 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
9966
9977
|
};
|
|
9967
9978
|
}
|
|
9968
9979
|
});
|
|
9980
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
9981
|
+
__name: "RadioGroupView",
|
|
9982
|
+
props: {
|
|
9983
|
+
options: {},
|
|
9984
|
+
primaryKeyConfig: {},
|
|
9985
|
+
nameKeyConfig: {},
|
|
9986
|
+
modelValue: {}
|
|
9987
|
+
},
|
|
9988
|
+
emits: ["update:modelValue", "change"],
|
|
9989
|
+
setup(__props, { emit: __emit }) {
|
|
9990
|
+
const props = __props;
|
|
9991
|
+
const emit = __emit;
|
|
9992
|
+
const modelValueBridgeComputed = useModelValueBridgeComputed(props, emit);
|
|
9993
|
+
return (_ctx, _cache) => {
|
|
9994
|
+
const _component_el_radio = resolveComponent("el-radio");
|
|
9995
|
+
const _component_el_radio_group = resolveComponent("el-radio-group");
|
|
9996
|
+
return openBlock(), createBlock(_component_el_radio_group, {
|
|
9997
|
+
modelValue: unref(modelValueBridgeComputed),
|
|
9998
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValueBridgeComputed) ? modelValueBridgeComputed.value = $event : null)
|
|
9999
|
+
}, {
|
|
10000
|
+
default: withCtx(() => [
|
|
10001
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(props.options, (item) => {
|
|
10002
|
+
return openBlock(), createBlock(_component_el_radio, {
|
|
10003
|
+
key: item[_ctx.primaryKeyConfig.propertyKey],
|
|
10004
|
+
label: item[_ctx.nameKeyConfig.propertyKey],
|
|
10005
|
+
value: item[_ctx.primaryKeyConfig.propertyKey]
|
|
10006
|
+
}, null, 8, ["label", "value"]);
|
|
10007
|
+
}), 128))
|
|
10008
|
+
]),
|
|
10009
|
+
_: 1
|
|
10010
|
+
}, 8, ["modelValue"]);
|
|
10011
|
+
};
|
|
10012
|
+
}
|
|
10013
|
+
});
|
|
9969
10014
|
const index$4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9970
10015
|
__proto__: null,
|
|
9971
|
-
RadioButtonGroupView: _sfc_main$
|
|
9972
|
-
|
|
9973
|
-
|
|
10016
|
+
RadioButtonGroupView: _sfc_main$3,
|
|
10017
|
+
RadioGroupView: _sfc_main$2,
|
|
10018
|
+
SelectView: _sfc_main$5,
|
|
10019
|
+
VModelView: _sfc_main$4
|
|
9974
10020
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9975
10021
|
const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
9976
10022
|
__proto__: null,
|
|
9977
|
-
VSlotView: _sfc_main$
|
|
10023
|
+
VSlotView: _sfc_main$9
|
|
9978
10024
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
9979
10025
|
const _export_sfc = (sfc, props) => {
|
|
9980
10026
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -10008,7 +10054,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
10008
10054
|
});
|
|
10009
10055
|
const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
10010
10056
|
__proto__: null,
|
|
10011
|
-
DataWrapper: _sfc_main$
|
|
10057
|
+
DataWrapper: _sfc_main$a,
|
|
10012
10058
|
Main: _sfc_main
|
|
10013
10059
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10014
10060
|
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|