yc-pro-components 0.0.12 → 0.0.13
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/es/components/dialog-form/index.d.ts +14 -2
- package/es/components/dialog-form/src/index.vue.d.ts +14 -2
- package/es/components/display-item/index.d.ts +42 -6
- package/es/components/display-item/src/index.vue.d.ts +42 -6
- package/es/components/drawer-form/index.d.ts +14 -2
- package/es/components/drawer-form/src/index.vue.d.ts +14 -2
- package/es/components/form/index.d.ts +28 -4
- package/es/components/form/src/form-content.vue.d.ts +42 -6
- package/es/components/form/src/index.vue.d.ts +28 -4
- package/es/components/form-item/index.d.ts +88 -16
- package/es/components/form-item/src/index.vue.d.ts +35 -4
- package/es/components/form-item/src/index.vue2.mjs +1 -0
- package/es/components/page/index.d.ts +224 -32
- package/es/components/page/src/index.vue.d.ts +84 -12
- package/es/components/page/src/index.vue2.mjs +1 -1
- package/es/components/render/index.d.ts +3 -3
- package/es/components/render/src/index.vue.d.ts +1 -1
- package/es/components/search/index.d.ts +98 -14
- package/es/components/search/src/index.vue.d.ts +42 -6
- package/es/components/table/src/table-action-bar.vue2.mjs +1 -1
- package/es/components/table/src/table-column.vue.d.ts +42 -6
- package/es/components/yc-plus-page/src/index.vue.d.ts +154 -22
- package/es/constants/dict.d.ts +78 -0
- package/es/constants/dict.mjs +3 -0
- package/es/constants/index.d.ts +1 -0
- package/es/constants/index.mjs +1 -0
- package/es/hooks/index.d.ts +1 -0
- package/es/hooks/index.mjs +1 -0
- package/es/hooks/useDictInjection.d.ts +38 -0
- package/es/hooks/useDictInjection.mjs +18 -0
- package/es/hooks/useGetOptions.mjs +118 -30
- package/es/hooks/usePlusFormReset.d.ts +84 -12
- package/es/index.d.ts +1 -1
- package/es/index.mjs +2 -0
- package/es/types/plus.d.ts +74 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/yc-components/index.d.ts +1 -1
- package/es/yc-components/version.d.ts +1 -1
- package/index.js +165 -59
- package/index.min.js +7 -7
- package/index.min.mjs +7 -7
- package/index.mjs +165 -61
- package/lib/components/dialog-form/index.d.ts +14 -2
- package/lib/components/dialog-form/src/index.vue.d.ts +14 -2
- package/lib/components/display-item/index.d.ts +42 -6
- package/lib/components/display-item/src/index.vue.d.ts +42 -6
- package/lib/components/drawer-form/index.d.ts +14 -2
- package/lib/components/drawer-form/src/index.vue.d.ts +14 -2
- package/lib/components/form/index.d.ts +28 -4
- package/lib/components/form/src/form-content.vue.d.ts +42 -6
- package/lib/components/form/src/index.vue.d.ts +28 -4
- package/lib/components/form-item/index.d.ts +88 -16
- package/lib/components/form-item/src/index.vue.d.ts +35 -4
- package/lib/components/form-item/src/index.vue2.js +1 -0
- package/lib/components/page/index.d.ts +224 -32
- package/lib/components/page/src/index.vue.d.ts +84 -12
- package/lib/components/page/src/index.vue2.js +1 -1
- package/lib/components/render/index.d.ts +3 -3
- package/lib/components/render/src/index.vue.d.ts +1 -1
- package/lib/components/search/index.d.ts +98 -14
- package/lib/components/search/src/index.vue.d.ts +42 -6
- package/lib/components/table/src/table-action-bar.vue2.js +1 -1
- package/lib/components/table/src/table-column.vue.d.ts +42 -6
- package/lib/components/yc-plus-page/src/index.vue.d.ts +154 -22
- package/lib/constants/dict.d.ts +78 -0
- package/lib/constants/dict.js +5 -0
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/index.js +2 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/useDictInjection.d.ts +38 -0
- package/lib/hooks/useDictInjection.js +20 -0
- package/lib/hooks/useGetOptions.js +117 -29
- package/lib/hooks/usePlusFormReset.d.ts +84 -12
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -0
- package/lib/types/plus.d.ts +74 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/yc-components/index.d.ts +1 -1
- package/lib/yc-components/version.d.ts +1 -1
- package/locale/en.js +1 -1
- package/locale/en.min.js +1 -1
- package/locale/en.min.mjs +1 -1
- package/locale/en.mjs +1 -1
- package/locale/ja.js +1 -1
- package/locale/ja.min.js +1 -1
- package/locale/ja.min.mjs +1 -1
- package/locale/ja.mjs +1 -1
- package/locale/ko.js +1 -1
- package/locale/ko.min.js +1 -1
- package/locale/ko.min.mjs +1 -1
- package/locale/ko.mjs +1 -1
- package/locale/zh-cn.js +1 -1
- package/locale/zh-cn.min.js +1 -1
- package/locale/zh-cn.min.mjs +1 -1
- package/locale/zh-cn.mjs +1 -1
- package/locale/zh-tw.js +1 -1
- package/locale/zh-tw.min.js +1 -1
- package/locale/zh-tw.min.mjs +1 -1
- package/locale/zh-tw.mjs +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! yc-pro-components v0.0.
|
|
1
|
+
/*! yc-pro-components v0.0.13 */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('element-plus')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'vue', 'element-plus'], factory) :
|
|
@@ -4770,6 +4770,36 @@
|
|
|
4770
4770
|
return data;
|
|
4771
4771
|
};
|
|
4772
4772
|
|
|
4773
|
+
const DefaultPageSizeList = [10, 20, 30, 40, 50, 100, 200, 300, 400, 500];
|
|
4774
|
+
const DefaultPageInfo = {
|
|
4775
|
+
page: 1,
|
|
4776
|
+
pageSize: 10
|
|
4777
|
+
};
|
|
4778
|
+
|
|
4779
|
+
const TableFormRefInjectionKey = Symbol("tableFormRefInjectionKey");
|
|
4780
|
+
const TableFormFieldRefInjectionKey = Symbol("tableFormFieldRefInjectionKey");
|
|
4781
|
+
const TableFormRowInfoInjectionKey = Symbol("tableFormRowInfoInjectionKey");
|
|
4782
|
+
const DatePickerValueIsArrayList = ["datetimerange", "daterange", "monthrange"];
|
|
4783
|
+
const ValueIsNumberList = ["rate", "input-number", "slider"];
|
|
4784
|
+
const ValueIsBooleanList = ["switch"];
|
|
4785
|
+
const ValueIsArrayList = [
|
|
4786
|
+
"checkbox",
|
|
4787
|
+
"cascader",
|
|
4788
|
+
"plus-date-picker",
|
|
4789
|
+
"plus-input-tag",
|
|
4790
|
+
"transfer"
|
|
4791
|
+
];
|
|
4792
|
+
|
|
4793
|
+
const selectValueTypeList = [
|
|
4794
|
+
"select",
|
|
4795
|
+
"radio",
|
|
4796
|
+
"checkbox",
|
|
4797
|
+
"select-v2",
|
|
4798
|
+
"plus-radio"
|
|
4799
|
+
];
|
|
4800
|
+
|
|
4801
|
+
const DictStoreInjectionKey = Symbol("DictStore");
|
|
4802
|
+
|
|
4773
4803
|
const throwError = (data) => {
|
|
4774
4804
|
if (!isArray(data)) {
|
|
4775
4805
|
console.error("Uncaught TypeError: ", `options expected Array but got ${toRawType(data)}`);
|
|
@@ -4796,27 +4826,53 @@
|
|
|
4796
4826
|
const useGetOptions = (props) => {
|
|
4797
4827
|
const options = vue.ref([]);
|
|
4798
4828
|
const optionsIsReady = vue.ref(false);
|
|
4799
|
-
|
|
4829
|
+
const injectedDictStore = vue.inject(DictStoreInjectionKey, null);
|
|
4830
|
+
const hasValidOptions = props.options && (!isArray(props.options) || props.options.length > 0);
|
|
4831
|
+
if (hasValidOptions) {
|
|
4832
|
+
handleOptions();
|
|
4833
|
+
} else if (props.autoDict) {
|
|
4834
|
+
handleAutoDict();
|
|
4835
|
+
} else {
|
|
4800
4836
|
options.value = [];
|
|
4801
4837
|
optionsIsReady.value = true;
|
|
4802
|
-
}
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4838
|
+
}
|
|
4839
|
+
function handleOptions() {
|
|
4840
|
+
if (!props.options) {
|
|
4841
|
+
options.value = [];
|
|
4842
|
+
optionsIsReady.value = true;
|
|
4843
|
+
return;
|
|
4844
|
+
}
|
|
4845
|
+
if (vue.isRef(props.options) || vue.isReactive(props.options) || isArray(props.options)) {
|
|
4846
|
+
vue.watch(
|
|
4847
|
+
() => props.options,
|
|
4848
|
+
(val) => {
|
|
4849
|
+
const value = vue.isRef(val) ? val.value : val;
|
|
4850
|
+
options.value = getOptionsByOptionsMap(value, props);
|
|
4851
|
+
optionsIsReady.value = true;
|
|
4852
|
+
},
|
|
4853
|
+
{
|
|
4854
|
+
immediate: true,
|
|
4855
|
+
deep: true
|
|
4856
|
+
}
|
|
4857
|
+
);
|
|
4858
|
+
} else if (isFunction(props.options)) {
|
|
4859
|
+
const getValue = props.options;
|
|
4860
|
+
const result = getValue(props);
|
|
4861
|
+
if (isPromise(result)) {
|
|
4862
|
+
result.then((value) => {
|
|
4863
|
+
options.value = getOptionsByOptionsMap(value, props);
|
|
4864
|
+
optionsIsReady.value = true;
|
|
4865
|
+
throwError(options.value);
|
|
4866
|
+
}).catch((err) => {
|
|
4867
|
+
throw err;
|
|
4868
|
+
});
|
|
4869
|
+
} else {
|
|
4870
|
+
options.value = getOptionsByOptionsMap(result, props);
|
|
4808
4871
|
optionsIsReady.value = true;
|
|
4809
|
-
},
|
|
4810
|
-
{
|
|
4811
|
-
immediate: true,
|
|
4812
|
-
deep: true
|
|
4813
4872
|
}
|
|
4814
|
-
)
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
const result = getValue(props);
|
|
4818
|
-
if (isPromise(result)) {
|
|
4819
|
-
result.then((value) => {
|
|
4873
|
+
} else if (isPromise(props.options)) {
|
|
4874
|
+
const getValue = props.options;
|
|
4875
|
+
getValue.then((value) => {
|
|
4820
4876
|
options.value = getOptionsByOptionsMap(value, props);
|
|
4821
4877
|
optionsIsReady.value = true;
|
|
4822
4878
|
throwError(options.value);
|
|
@@ -4824,21 +4880,82 @@
|
|
|
4824
4880
|
throw err;
|
|
4825
4881
|
});
|
|
4826
4882
|
} else {
|
|
4827
|
-
options.value = getOptionsByOptionsMap(result, props);
|
|
4828
4883
|
optionsIsReady.value = true;
|
|
4884
|
+
throwError(props.options);
|
|
4829
4885
|
}
|
|
4830
|
-
}
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4886
|
+
}
|
|
4887
|
+
function handleAutoDict() {
|
|
4888
|
+
if (isFunction(props.autoDict)) {
|
|
4889
|
+
const autoDictFn = props.autoDict;
|
|
4890
|
+
vue.watch(
|
|
4891
|
+
() => {
|
|
4892
|
+
return autoDictFn(props);
|
|
4893
|
+
},
|
|
4894
|
+
(result) => {
|
|
4895
|
+
if (isPromise(result)) {
|
|
4896
|
+
result.then((value) => {
|
|
4897
|
+
options.value = getOptionsByOptionsMap(value, props);
|
|
4898
|
+
optionsIsReady.value = true;
|
|
4899
|
+
}).catch((err) => {
|
|
4900
|
+
console.error("[yc-components] autoDict function error:", err);
|
|
4901
|
+
options.value = [];
|
|
4902
|
+
optionsIsReady.value = true;
|
|
4903
|
+
});
|
|
4904
|
+
} else {
|
|
4905
|
+
options.value = getOptionsByOptionsMap(result, props);
|
|
4906
|
+
optionsIsReady.value = true;
|
|
4907
|
+
}
|
|
4908
|
+
},
|
|
4909
|
+
{ immediate: true }
|
|
4910
|
+
);
|
|
4911
|
+
} else if (typeof props.autoDict === "object" && props.autoDict !== null) {
|
|
4912
|
+
const { store, method = "getDictData", transform, dictCode } = props.autoDict;
|
|
4913
|
+
const dictStore = store || injectedDictStore;
|
|
4914
|
+
const fieldOrCode = dictCode || props.prop;
|
|
4915
|
+
if (dictStore && isFunction(dictStore[method])) {
|
|
4916
|
+
vue.watch(
|
|
4917
|
+
() => dictStore[method](fieldOrCode),
|
|
4918
|
+
(val) => {
|
|
4919
|
+
try {
|
|
4920
|
+
const data = transform && isFunction(transform) ? transform(val) : val;
|
|
4921
|
+
options.value = getOptionsByOptionsMap(data, props);
|
|
4922
|
+
optionsIsReady.value = true;
|
|
4923
|
+
} catch (err) {
|
|
4924
|
+
console.error("[yc-components] autoDict transform error:", err);
|
|
4925
|
+
options.value = [];
|
|
4926
|
+
optionsIsReady.value = true;
|
|
4927
|
+
}
|
|
4928
|
+
},
|
|
4929
|
+
{ immediate: true }
|
|
4930
|
+
);
|
|
4931
|
+
} else {
|
|
4932
|
+
console.warn(
|
|
4933
|
+
`[yc-components] autoDict: DictStore or method "${method}" not found for field "${fieldOrCode}"`
|
|
4934
|
+
);
|
|
4935
|
+
options.value = [];
|
|
4936
|
+
optionsIsReady.value = true;
|
|
4937
|
+
}
|
|
4938
|
+
} else if (props.autoDict === true) {
|
|
4939
|
+
if (injectedDictStore && isFunction(injectedDictStore.getDictData)) {
|
|
4940
|
+
vue.watch(
|
|
4941
|
+
() => injectedDictStore.getDictData(props.prop),
|
|
4942
|
+
(val) => {
|
|
4943
|
+
options.value = getOptionsByOptionsMap(val, props);
|
|
4944
|
+
optionsIsReady.value = true;
|
|
4945
|
+
},
|
|
4946
|
+
{ immediate: true }
|
|
4947
|
+
);
|
|
4948
|
+
} else {
|
|
4949
|
+
console.warn(
|
|
4950
|
+
`[yc-components] autoDict: DictStore not provided via inject for field "${props.prop}". Please use useDictInjection() in parent component.`
|
|
4951
|
+
);
|
|
4952
|
+
options.value = [];
|
|
4953
|
+
optionsIsReady.value = true;
|
|
4954
|
+
}
|
|
4955
|
+
} else {
|
|
4956
|
+
options.value = [];
|
|
4834
4957
|
optionsIsReady.value = true;
|
|
4835
|
-
|
|
4836
|
-
}).catch((err) => {
|
|
4837
|
-
throw err;
|
|
4838
|
-
});
|
|
4839
|
-
} else {
|
|
4840
|
-
optionsIsReady.value = true;
|
|
4841
|
-
throwError(props.options);
|
|
4958
|
+
}
|
|
4842
4959
|
}
|
|
4843
4960
|
return { customOptions: options, customOptionsIsReady: optionsIsReady };
|
|
4844
4961
|
};
|
|
@@ -4937,34 +5054,6 @@
|
|
|
4937
5054
|
}));
|
|
4938
5055
|
};
|
|
4939
5056
|
|
|
4940
|
-
const DefaultPageSizeList = [10, 20, 30, 40, 50, 100, 200, 300, 400, 500];
|
|
4941
|
-
const DefaultPageInfo = {
|
|
4942
|
-
page: 1,
|
|
4943
|
-
pageSize: 10
|
|
4944
|
-
};
|
|
4945
|
-
|
|
4946
|
-
const TableFormRefInjectionKey = Symbol("tableFormRefInjectionKey");
|
|
4947
|
-
const TableFormFieldRefInjectionKey = Symbol("tableFormFieldRefInjectionKey");
|
|
4948
|
-
const TableFormRowInfoInjectionKey = Symbol("tableFormRowInfoInjectionKey");
|
|
4949
|
-
const DatePickerValueIsArrayList = ["datetimerange", "daterange", "monthrange"];
|
|
4950
|
-
const ValueIsNumberList = ["rate", "input-number", "slider"];
|
|
4951
|
-
const ValueIsBooleanList = ["switch"];
|
|
4952
|
-
const ValueIsArrayList = [
|
|
4953
|
-
"checkbox",
|
|
4954
|
-
"cascader",
|
|
4955
|
-
"plus-date-picker",
|
|
4956
|
-
"plus-input-tag",
|
|
4957
|
-
"transfer"
|
|
4958
|
-
];
|
|
4959
|
-
|
|
4960
|
-
const selectValueTypeList = [
|
|
4961
|
-
"select",
|
|
4962
|
-
"radio",
|
|
4963
|
-
"checkbox",
|
|
4964
|
-
"select-v2",
|
|
4965
|
-
"plus-radio"
|
|
4966
|
-
];
|
|
4967
|
-
|
|
4968
5057
|
function useTable(_pageInfo) {
|
|
4969
5058
|
const defaultPageInfo = vue.unref(_pageInfo) || DefaultPageInfo;
|
|
4970
5059
|
const tableData = vue.ref([]);
|
|
@@ -8485,6 +8574,20 @@
|
|
|
8485
8574
|
};
|
|
8486
8575
|
}
|
|
8487
8576
|
|
|
8577
|
+
function useDictInjection(dictStore) {
|
|
8578
|
+
if (!dictStore) {
|
|
8579
|
+
console.warn("[yc-components] useDictInjection: dictStore is required");
|
|
8580
|
+
return;
|
|
8581
|
+
}
|
|
8582
|
+
if (typeof dictStore.getDictData !== "function") {
|
|
8583
|
+
console.error(
|
|
8584
|
+
"[yc-components] useDictInjection: dictStore must implement getDictData method. Please ensure your dictStore implements DictStoreInterface."
|
|
8585
|
+
);
|
|
8586
|
+
return;
|
|
8587
|
+
}
|
|
8588
|
+
vue.provide(DictStoreInjectionKey, dictStore);
|
|
8589
|
+
}
|
|
8590
|
+
|
|
8488
8591
|
const _hoisted_1$q = { class: "plus-dialog-body" };
|
|
8489
8592
|
var _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
|
|
8490
8593
|
...{
|
|
@@ -15782,6 +15885,7 @@
|
|
|
15782
15885
|
fieldChildrenSlot: { type: Function, default: void 0 },
|
|
15783
15886
|
renderErrorMessage: { type: Function, default: void 0 },
|
|
15784
15887
|
optionsMap: { default: void 0 },
|
|
15888
|
+
autoDict: { type: [Boolean, Function, Object], default: void 0 },
|
|
15785
15889
|
index: { default: 0 },
|
|
15786
15890
|
clearable: { type: Boolean, default: true }
|
|
15787
15891
|
},
|
|
@@ -59639,7 +59743,7 @@
|
|
|
59639
59743
|
|
|
59640
59744
|
var installer = makeInstaller([...plugins]);
|
|
59641
59745
|
|
|
59642
|
-
const version = "0.
|
|
59746
|
+
const version = "0.0.13";
|
|
59643
59747
|
|
|
59644
59748
|
const install = installer.install;
|
|
59645
59749
|
|
|
@@ -59648,6 +59752,7 @@
|
|
|
59648
59752
|
exports.DatePickerValueIsArrayList = DatePickerValueIsArrayList;
|
|
59649
59753
|
exports.DefaultPageInfo = DefaultPageInfo;
|
|
59650
59754
|
exports.DefaultPageSizeList = DefaultPageSizeList;
|
|
59755
|
+
exports.DictStoreInjectionKey = DictStoreInjectionKey;
|
|
59651
59756
|
exports.PlusBreadcrumb = PlusBreadcrumb;
|
|
59652
59757
|
exports.PlusCheckCard = PlusCheckCard;
|
|
59653
59758
|
exports.PlusCheckCardGroup = PlusCheckCardGroup;
|
|
@@ -59755,6 +59860,7 @@
|
|
|
59755
59860
|
exports.selectValueTypeList = selectValueTypeList;
|
|
59756
59861
|
exports.updateDrawer = updateDrawer;
|
|
59757
59862
|
exports.useDialogFormConfig = useDialogFormConfig;
|
|
59863
|
+
exports.useDictInjection = useDictInjection;
|
|
59758
59864
|
exports.useDrawerFormConfig = useDrawerFormConfig;
|
|
59759
59865
|
exports.useGetOptions = useGetOptions;
|
|
59760
59866
|
exports.useLocale = useLocale;
|