@maxax/ui 1.1.12 → 1.1.14
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/basic-checkbox-group/BasicCheckboxGroup.d.ts +95 -0
- package/dist/components/basic-checkbox-group/BasicCheckboxGroup.d.ts.map +1 -1
- package/dist/components/basic-checkbox-group/interface.d.ts +46 -0
- package/dist/components/basic-checkbox-group/interface.d.ts.map +1 -1
- package/dist/components/basic-radio-group/BasicRadioGroup.d.ts +95 -0
- package/dist/components/basic-radio-group/BasicRadioGroup.d.ts.map +1 -1
- package/dist/components/basic-radio-group/interface.d.ts +46 -0
- package/dist/components/basic-radio-group/interface.d.ts.map +1 -1
- package/dist/index.cjs +240 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +240 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -7379,6 +7379,56 @@ const basicCheckboxGroupProps = {
|
|
|
7379
7379
|
showCheckboxAll: {
|
|
7380
7380
|
type: Boolean,
|
|
7381
7381
|
default: true
|
|
7382
|
+
},
|
|
7383
|
+
labelField: {
|
|
7384
|
+
type: [String, Number, Function],
|
|
7385
|
+
default: "label"
|
|
7386
|
+
},
|
|
7387
|
+
valueField: {
|
|
7388
|
+
type: [String, Number, Function],
|
|
7389
|
+
default: "value"
|
|
7390
|
+
},
|
|
7391
|
+
// 立即请求接口
|
|
7392
|
+
immediate: {
|
|
7393
|
+
type: Boolean,
|
|
7394
|
+
default: true
|
|
7395
|
+
},
|
|
7396
|
+
// 接口请求对象
|
|
7397
|
+
api: {
|
|
7398
|
+
type: Function,
|
|
7399
|
+
default: void 0
|
|
7400
|
+
},
|
|
7401
|
+
// 动态请求
|
|
7402
|
+
dynamicApi: {
|
|
7403
|
+
type: Function,
|
|
7404
|
+
default: void 0
|
|
7405
|
+
},
|
|
7406
|
+
// 请求之前处理参数
|
|
7407
|
+
beforeFetch: {
|
|
7408
|
+
type: Function,
|
|
7409
|
+
default: void 0
|
|
7410
|
+
},
|
|
7411
|
+
// 自定义处理接口返回参数
|
|
7412
|
+
afterFetch: {
|
|
7413
|
+
type: Function,
|
|
7414
|
+
default: void 0
|
|
7415
|
+
},
|
|
7416
|
+
// 查询条件请求之前处理
|
|
7417
|
+
handleSearchInfoFn: {
|
|
7418
|
+
type: Function,
|
|
7419
|
+
default: void 0
|
|
7420
|
+
},
|
|
7421
|
+
// 额外的请求参数
|
|
7422
|
+
searchInfo: {
|
|
7423
|
+
type: Object,
|
|
7424
|
+
default: () => ({})
|
|
7425
|
+
},
|
|
7426
|
+
// 请求接口配置
|
|
7427
|
+
fetchSetting: {
|
|
7428
|
+
type: Object,
|
|
7429
|
+
default: () => ({
|
|
7430
|
+
listField: "resultList"
|
|
7431
|
+
})
|
|
7382
7432
|
}
|
|
7383
7433
|
};
|
|
7384
7434
|
function _isSlot$2(s) {
|
|
@@ -7400,7 +7450,8 @@ const BasicCheckboxGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
7400
7450
|
},
|
|
7401
7451
|
setup(props, {
|
|
7402
7452
|
emit,
|
|
7403
|
-
slots
|
|
7453
|
+
slots,
|
|
7454
|
+
expose
|
|
7404
7455
|
}) {
|
|
7405
7456
|
const {
|
|
7406
7457
|
b,
|
|
@@ -7412,19 +7463,33 @@ const BasicCheckboxGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
7412
7463
|
const {
|
|
7413
7464
|
disabled
|
|
7414
7465
|
} = vue.toRefs(props);
|
|
7466
|
+
const loading = vue.ref(false);
|
|
7467
|
+
const dataSourceRef = vue.ref([]);
|
|
7468
|
+
const rawDataSourceRef = vue.ref({});
|
|
7469
|
+
const searchInfoRef = vue.ref({});
|
|
7415
7470
|
const $value = vue.ref(props.defaultValue);
|
|
7416
7471
|
const computedValue = vue.computed(() => utils.isArray(props.value) ? props.value : $value.value);
|
|
7417
7472
|
const isMaxed = vue.computed(() => props.max === void 0 ? false : computedValue.value.length >= props.max);
|
|
7418
7473
|
const options = vue.computed(() => {
|
|
7419
7474
|
var _a;
|
|
7420
|
-
|
|
7475
|
+
const {
|
|
7476
|
+
labelField,
|
|
7477
|
+
valueField
|
|
7478
|
+
} = props;
|
|
7479
|
+
const source = (_a = dataSourceRef.value && dataSourceRef.value.length > 0 ? dataSourceRef.value : props.options) != null ? _a : [];
|
|
7480
|
+
return source.map((option) => {
|
|
7421
7481
|
if (utils.isString(option) || utils.isNumber(option)) {
|
|
7422
7482
|
return {
|
|
7423
7483
|
label: option,
|
|
7424
7484
|
value: option
|
|
7425
7485
|
};
|
|
7426
7486
|
}
|
|
7427
|
-
|
|
7487
|
+
const opt = option;
|
|
7488
|
+
return {
|
|
7489
|
+
...opt,
|
|
7490
|
+
label: utils.getValueKey(labelField, opt),
|
|
7491
|
+
value: utils.getValueKey(valueField, opt)
|
|
7492
|
+
};
|
|
7428
7493
|
});
|
|
7429
7494
|
});
|
|
7430
7495
|
const allChecked = vue.ref(false);
|
|
@@ -7449,6 +7514,52 @@ const BasicCheckboxGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
7449
7514
|
emit("all-change", newValue, e);
|
|
7450
7515
|
};
|
|
7451
7516
|
const cls = vue.computed(() => [b(), is(`direction-${props.direction}`)]);
|
|
7517
|
+
vue.watch(() => props.searchInfo, () => {
|
|
7518
|
+
fetch2();
|
|
7519
|
+
}, {
|
|
7520
|
+
deep: true,
|
|
7521
|
+
immediate: props.immediate
|
|
7522
|
+
});
|
|
7523
|
+
async function fetch2(opt) {
|
|
7524
|
+
const {
|
|
7525
|
+
api,
|
|
7526
|
+
dynamicApi,
|
|
7527
|
+
searchInfo,
|
|
7528
|
+
fetchSetting,
|
|
7529
|
+
beforeFetch,
|
|
7530
|
+
afterFetch,
|
|
7531
|
+
handleSearchInfoFn
|
|
7532
|
+
} = props;
|
|
7533
|
+
if (!api && !dynamicApi || loading.value) return;
|
|
7534
|
+
try {
|
|
7535
|
+
loading.value = true;
|
|
7536
|
+
const {
|
|
7537
|
+
listField
|
|
7538
|
+
} = {
|
|
7539
|
+
listField: "resultList",
|
|
7540
|
+
...fetchSetting
|
|
7541
|
+
};
|
|
7542
|
+
const searchInfoParams = handleSearchInfoFn ? handleSearchInfoFn() : {};
|
|
7543
|
+
let params = lodashEs.merge(searchInfoParams, searchInfo, opt != null ? opt : {});
|
|
7544
|
+
if (beforeFetch && utils.isFunction(beforeFetch)) {
|
|
7545
|
+
params = await beforeFetch(params) || params;
|
|
7546
|
+
}
|
|
7547
|
+
searchInfoRef.value = params;
|
|
7548
|
+
const apiFn = api || (dynamicApi == null ? void 0 : dynamicApi(params));
|
|
7549
|
+
const res = await (apiFn == null ? void 0 : apiFn(params));
|
|
7550
|
+
rawDataSourceRef.value = res.data;
|
|
7551
|
+
const isArrayResult = Array.isArray(res.data);
|
|
7552
|
+
let resultItems = isArrayResult ? res.data : lodashEs.get(res.data, listField);
|
|
7553
|
+
if (afterFetch && utils.isFunction(afterFetch)) {
|
|
7554
|
+
resultItems = await afterFetch(resultItems) || resultItems;
|
|
7555
|
+
}
|
|
7556
|
+
dataSourceRef.value = resultItems;
|
|
7557
|
+
} catch (error) {
|
|
7558
|
+
console.error(error);
|
|
7559
|
+
} finally {
|
|
7560
|
+
loading.value = false;
|
|
7561
|
+
}
|
|
7562
|
+
}
|
|
7452
7563
|
vue.watch(() => props.value, (curValue) => {
|
|
7453
7564
|
if (utils.isArray(curValue)) {
|
|
7454
7565
|
$value.value = [...curValue];
|
|
@@ -7501,6 +7612,12 @@ const BasicCheckboxGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
7501
7612
|
default: () => [_slot]
|
|
7502
7613
|
});
|
|
7503
7614
|
};
|
|
7615
|
+
async function reload(opt) {
|
|
7616
|
+
return await fetch2(opt);
|
|
7617
|
+
}
|
|
7618
|
+
expose({
|
|
7619
|
+
reload
|
|
7620
|
+
});
|
|
7504
7621
|
return () => {
|
|
7505
7622
|
var _a;
|
|
7506
7623
|
return vue.createVNode("span", {
|
|
@@ -8683,6 +8800,56 @@ const basicRadioGroupProps = {
|
|
|
8683
8800
|
type: Array,
|
|
8684
8801
|
default: () => []
|
|
8685
8802
|
},
|
|
8803
|
+
labelField: {
|
|
8804
|
+
type: [String, Number, Function],
|
|
8805
|
+
default: "label"
|
|
8806
|
+
},
|
|
8807
|
+
valueField: {
|
|
8808
|
+
type: [String, Number, Function],
|
|
8809
|
+
default: "value"
|
|
8810
|
+
},
|
|
8811
|
+
// 立即请求接口
|
|
8812
|
+
immediate: {
|
|
8813
|
+
type: Boolean,
|
|
8814
|
+
default: true
|
|
8815
|
+
},
|
|
8816
|
+
// 接口请求对象
|
|
8817
|
+
api: {
|
|
8818
|
+
type: Function,
|
|
8819
|
+
default: void 0
|
|
8820
|
+
},
|
|
8821
|
+
// 动态请求
|
|
8822
|
+
dynamicApi: {
|
|
8823
|
+
type: Function,
|
|
8824
|
+
default: void 0
|
|
8825
|
+
},
|
|
8826
|
+
// 请求之前处理参数
|
|
8827
|
+
beforeFetch: {
|
|
8828
|
+
type: Function,
|
|
8829
|
+
default: void 0
|
|
8830
|
+
},
|
|
8831
|
+
// 自定义处理接口返回参数
|
|
8832
|
+
afterFetch: {
|
|
8833
|
+
type: Function,
|
|
8834
|
+
default: void 0
|
|
8835
|
+
},
|
|
8836
|
+
// 查询条件请求之前处理
|
|
8837
|
+
handleSearchInfoFn: {
|
|
8838
|
+
type: Function,
|
|
8839
|
+
default: void 0
|
|
8840
|
+
},
|
|
8841
|
+
// 额外的请求参数
|
|
8842
|
+
searchInfo: {
|
|
8843
|
+
type: Object,
|
|
8844
|
+
default: () => ({})
|
|
8845
|
+
},
|
|
8846
|
+
// 请求接口配置
|
|
8847
|
+
fetchSetting: {
|
|
8848
|
+
type: Object,
|
|
8849
|
+
default: () => ({
|
|
8850
|
+
listField: "resultList"
|
|
8851
|
+
})
|
|
8852
|
+
},
|
|
8686
8853
|
"onUpdate:value": {
|
|
8687
8854
|
type: Function,
|
|
8688
8855
|
default: void 0
|
|
@@ -8700,12 +8867,17 @@ const BasicRadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
8700
8867
|
name: "XBasicRadioGroup",
|
|
8701
8868
|
props: basicRadioGroupProps,
|
|
8702
8869
|
setup(props, {
|
|
8703
|
-
slots
|
|
8870
|
+
slots,
|
|
8871
|
+
expose
|
|
8704
8872
|
}) {
|
|
8705
8873
|
const {
|
|
8706
8874
|
b,
|
|
8707
8875
|
m
|
|
8708
8876
|
} = useNamespace("basic-radio-group");
|
|
8877
|
+
const loading = vue.ref(false);
|
|
8878
|
+
const dataSourceRef = vue.ref([]);
|
|
8879
|
+
const rawDataSourceRef = vue.ref({});
|
|
8880
|
+
const searchInfoRef = vue.ref({});
|
|
8709
8881
|
const uncontrolledValueRef = vue.ref(props.defaultValue);
|
|
8710
8882
|
const controlledValueRef = vue.toRef(props, "value");
|
|
8711
8883
|
const mergedValueRef = hooks.useMergedState(controlledValueRef, uncontrolledValueRef);
|
|
@@ -8714,20 +8886,76 @@ const BasicRadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
8714
8886
|
} = vue.toRefs(props);
|
|
8715
8887
|
const options = vue.computed(() => {
|
|
8716
8888
|
var _a;
|
|
8717
|
-
|
|
8889
|
+
const {
|
|
8890
|
+
labelField,
|
|
8891
|
+
valueField
|
|
8892
|
+
} = props;
|
|
8893
|
+
const source = (_a = dataSourceRef.value && dataSourceRef.value.length > 0 ? dataSourceRef.value : props.options) != null ? _a : [];
|
|
8894
|
+
return source.map((option) => {
|
|
8718
8895
|
if (utils.isString(option) || utils.isNumber(option)) {
|
|
8719
8896
|
return {
|
|
8720
8897
|
label: option,
|
|
8721
8898
|
value: option
|
|
8722
8899
|
};
|
|
8723
8900
|
}
|
|
8724
|
-
|
|
8901
|
+
const opt = option;
|
|
8902
|
+
return {
|
|
8903
|
+
...opt,
|
|
8904
|
+
label: utils.getValueKey(labelField, opt),
|
|
8905
|
+
value: utils.getValueKey(valueField, opt)
|
|
8906
|
+
};
|
|
8725
8907
|
});
|
|
8726
8908
|
});
|
|
8727
8909
|
const cls = vue.computed(() => [`${b()}`, {
|
|
8728
8910
|
[`${m(props.size)}`]: props.size,
|
|
8729
8911
|
[`${m("disabled")}`]: disabled.value
|
|
8730
8912
|
}]);
|
|
8913
|
+
vue.watch(() => props.searchInfo, () => {
|
|
8914
|
+
fetch2();
|
|
8915
|
+
}, {
|
|
8916
|
+
deep: true,
|
|
8917
|
+
immediate: props.immediate
|
|
8918
|
+
});
|
|
8919
|
+
async function fetch2(opt) {
|
|
8920
|
+
const {
|
|
8921
|
+
api,
|
|
8922
|
+
dynamicApi,
|
|
8923
|
+
searchInfo,
|
|
8924
|
+
fetchSetting,
|
|
8925
|
+
beforeFetch,
|
|
8926
|
+
afterFetch,
|
|
8927
|
+
handleSearchInfoFn
|
|
8928
|
+
} = props;
|
|
8929
|
+
if (!api && !dynamicApi || loading.value) return;
|
|
8930
|
+
try {
|
|
8931
|
+
loading.value = true;
|
|
8932
|
+
const {
|
|
8933
|
+
listField
|
|
8934
|
+
} = {
|
|
8935
|
+
listField: "resultList",
|
|
8936
|
+
...fetchSetting
|
|
8937
|
+
};
|
|
8938
|
+
const searchInfoParams = handleSearchInfoFn ? handleSearchInfoFn() : {};
|
|
8939
|
+
let params = lodashEs.merge(searchInfoParams, searchInfo, opt != null ? opt : {});
|
|
8940
|
+
if (beforeFetch && utils.isFunction(beforeFetch)) {
|
|
8941
|
+
params = await beforeFetch(params) || params;
|
|
8942
|
+
}
|
|
8943
|
+
searchInfoRef.value = params;
|
|
8944
|
+
const apiFn = api || (dynamicApi == null ? void 0 : dynamicApi(params));
|
|
8945
|
+
const res = await (apiFn == null ? void 0 : apiFn(params));
|
|
8946
|
+
rawDataSourceRef.value = res.data;
|
|
8947
|
+
const isArrayResult = Array.isArray(res.data);
|
|
8948
|
+
let resultItems = isArrayResult ? res.data : lodashEs.get(res.data, listField);
|
|
8949
|
+
if (afterFetch && utils.isFunction(afterFetch)) {
|
|
8950
|
+
resultItems = await afterFetch(resultItems) || resultItems;
|
|
8951
|
+
}
|
|
8952
|
+
dataSourceRef.value = resultItems;
|
|
8953
|
+
} catch (error) {
|
|
8954
|
+
console.error(error);
|
|
8955
|
+
} finally {
|
|
8956
|
+
loading.value = false;
|
|
8957
|
+
}
|
|
8958
|
+
}
|
|
8731
8959
|
const handleChange = (value) => {
|
|
8732
8960
|
if (props.disabled) return;
|
|
8733
8961
|
const {
|
|
@@ -8762,6 +8990,12 @@ const BasicRadioGroup = /* @__PURE__ */ vue.defineComponent({
|
|
|
8762
8990
|
handleChange
|
|
8763
8991
|
});
|
|
8764
8992
|
createBasicRadioGroupContext(context);
|
|
8993
|
+
async function reload(opt) {
|
|
8994
|
+
return await fetch2(opt);
|
|
8995
|
+
}
|
|
8996
|
+
expose({
|
|
8997
|
+
reload
|
|
8998
|
+
});
|
|
8765
8999
|
return () => {
|
|
8766
9000
|
var _a;
|
|
8767
9001
|
return vue.createVNode("div", {
|