vxe-pc-ui 4.8.12 → 4.8.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/README.md +4 -4
- package/es/form/index.js +0 -1
- package/es/form/src/form.js +1 -0
- package/es/icon/style.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/form/index.js +0 -1
- package/lib/form/index.min.js +1 -1
- package/lib/form/src/form.js +1 -0
- package/lib/form/src/form.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +1577 -1577
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/form/index.ts +0 -1
- package/packages/form/src/form.ts +2 -0
- package/types/components/gantt-module/gantt-view.d.ts +164 -0
- package/types/components/gantt-module/index.d.ts +1 -0
- package/types/components/gantt.d.ts +113 -29
- package/types/components/grid.d.ts +38 -18
- package/types/components/table-module/custom.d.ts +2 -1
- package/types/components/table.d.ts +32 -9
- package/types/ui/commands.d.ts +3 -1
- package/types/ui/hooks.d.ts +2 -0
- /package/es/icon/{iconfont.1754641145942.ttf → iconfont.1754905375075.ttf} +0 -0
- /package/es/icon/{iconfont.1754641145942.woff → iconfont.1754905375075.woff} +0 -0
- /package/es/icon/{iconfont.1754641145942.woff2 → iconfont.1754905375075.woff2} +0 -0
- /package/es/{iconfont.1754641145942.ttf → iconfont.1754905375075.ttf} +0 -0
- /package/es/{iconfont.1754641145942.woff → iconfont.1754905375075.woff} +0 -0
- /package/es/{iconfont.1754641145942.woff2 → iconfont.1754905375075.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1754641145942.ttf → iconfont.1754905375075.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1754641145942.woff → iconfont.1754905375075.woff} +0 -0
- /package/lib/icon/style/{iconfont.1754641145942.woff2 → iconfont.1754905375075.woff2} +0 -0
- /package/lib/{iconfont.1754641145942.ttf → iconfont.1754905375075.ttf} +0 -0
- /package/lib/{iconfont.1754641145942.woff → iconfont.1754905375075.woff} +0 -0
- /package/lib/{iconfont.1754641145942.woff2 → iconfont.1754905375075.woff2} +0 -0
package/lib/index.umd.js
CHANGED
|
@@ -4321,14 +4321,14 @@ function checkDynamic() {
|
|
|
4321
4321
|
}
|
|
4322
4322
|
;// CONCATENATED MODULE: ./packages/ui/src/log.ts
|
|
4323
4323
|
|
|
4324
|
-
const log_version = `ui v${"4.8.
|
|
4324
|
+
const log_version = `ui v${"4.8.13"}`;
|
|
4325
4325
|
const warnLog = log.create('warn', log_version);
|
|
4326
4326
|
const errLog = log.create('error', log_version);
|
|
4327
4327
|
;// CONCATENATED MODULE: ./packages/ui/index.ts
|
|
4328
4328
|
|
|
4329
4329
|
|
|
4330
4330
|
|
|
4331
|
-
const ui_version = "4.8.
|
|
4331
|
+
const ui_version = "4.8.13";
|
|
4332
4332
|
index_esm_VxeUI.uiVersion = ui_version;
|
|
4333
4333
|
index_esm_VxeUI.dynamicApp = dynamicApp;
|
|
4334
4334
|
function config(options) {
|
|
@@ -21703,1672 +21703,1672 @@ const VxeFormConfigItem = defineVxeComponent({
|
|
|
21703
21703
|
}
|
|
21704
21704
|
});
|
|
21705
21705
|
/* harmony default export */ var form_config_item = (VxeFormConfigItem);
|
|
21706
|
-
;// CONCATENATED MODULE: ./packages/form/
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
|
|
21710
|
-
|
|
21711
|
-
|
|
21712
|
-
|
|
21713
|
-
|
|
21714
|
-
|
|
21706
|
+
;// CONCATENATED MODULE: ./packages/form/render/index.ts
|
|
21715
21707
|
|
|
21716
21708
|
|
|
21717
21709
|
|
|
21718
21710
|
|
|
21719
21711
|
|
|
21720
|
-
|
|
21721
|
-
|
|
21722
|
-
|
|
21723
|
-
|
|
21724
|
-
|
|
21725
|
-
|
|
21726
|
-
|
|
21727
|
-
type: rule.type,
|
|
21728
|
-
pattern: rule.pattern,
|
|
21729
|
-
validator: rule.validator,
|
|
21730
|
-
trigger: rule.trigger,
|
|
21731
|
-
maxWidth: rule.maxWidth
|
|
21732
|
-
});
|
|
21733
|
-
}
|
|
21734
|
-
get content() {
|
|
21735
|
-
return getFuncText(this.$options.content || this.$options.message);
|
|
21736
|
-
}
|
|
21737
|
-
get message() {
|
|
21738
|
-
return this.content;
|
|
21739
|
-
}
|
|
21712
|
+
const componentDefaultModelProp = 'modelValue';
|
|
21713
|
+
/**
|
|
21714
|
+
* 已废弃
|
|
21715
|
+
* @deprecated
|
|
21716
|
+
*/
|
|
21717
|
+
function getOldComponentName(name) {
|
|
21718
|
+
return `vxe-${name.replace('$', '')}`;
|
|
21740
21719
|
}
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
}
|
|
21746
|
-
return true;
|
|
21720
|
+
function getDefaultComponent({
|
|
21721
|
+
name
|
|
21722
|
+
}) {
|
|
21723
|
+
return getComponent(name) || (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(name);
|
|
21747
21724
|
}
|
|
21748
|
-
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
21752
|
-
|
|
21753
|
-
|
|
21725
|
+
/**
|
|
21726
|
+
* 已废弃
|
|
21727
|
+
* @deprecated
|
|
21728
|
+
*/
|
|
21729
|
+
function getOldComponent({
|
|
21730
|
+
name
|
|
21731
|
+
}) {
|
|
21732
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(getOldComponentName(name));
|
|
21754
21733
|
}
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21734
|
+
function getNativeAttrs(renderOpts) {
|
|
21735
|
+
let {
|
|
21736
|
+
name,
|
|
21737
|
+
attrs
|
|
21738
|
+
} = renderOpts;
|
|
21739
|
+
if (name === 'input') {
|
|
21740
|
+
attrs = Object.assign({
|
|
21741
|
+
type: 'text'
|
|
21742
|
+
}, attrs);
|
|
21759
21743
|
}
|
|
21760
|
-
return
|
|
21744
|
+
return attrs;
|
|
21761
21745
|
}
|
|
21762
|
-
function
|
|
21746
|
+
function getComponentFormItemProps(renderOpts, params, value, defaultProps) {
|
|
21747
|
+
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign({}, defaultProps, renderOpts.props, {
|
|
21748
|
+
[componentDefaultModelProp]: value
|
|
21749
|
+
});
|
|
21750
|
+
}
|
|
21751
|
+
/**
|
|
21752
|
+
* 原生事件处理
|
|
21753
|
+
* @param renderOpts
|
|
21754
|
+
* @param params
|
|
21755
|
+
* @param modelFunc
|
|
21756
|
+
* @param changeFunc
|
|
21757
|
+
*/
|
|
21758
|
+
function getNativeElementOns(renderOpts, params, modelFunc, changeFunc) {
|
|
21763
21759
|
const {
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
const
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21774
|
-
|
|
21760
|
+
events
|
|
21761
|
+
} = renderOpts;
|
|
21762
|
+
const modelEvent = getModelEvent(renderOpts.name);
|
|
21763
|
+
const changeEvent = getChangeEvent(renderOpts.name);
|
|
21764
|
+
const isSameEvent = changeEvent === modelEvent;
|
|
21765
|
+
const ons = {};
|
|
21766
|
+
if (events) {
|
|
21767
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
|
|
21768
|
+
ons[getOnName(key)] = function (...args) {
|
|
21769
|
+
func(params, ...args);
|
|
21770
|
+
};
|
|
21771
|
+
});
|
|
21775
21772
|
}
|
|
21776
|
-
if (
|
|
21777
|
-
|
|
21778
|
-
|
|
21779
|
-
|
|
21780
|
-
|
|
21781
|
-
if (!val.length) {
|
|
21782
|
-
return false;
|
|
21773
|
+
if (modelFunc) {
|
|
21774
|
+
ons[getOnName(modelEvent)] = function (targetEvnt) {
|
|
21775
|
+
modelFunc(targetEvnt);
|
|
21776
|
+
if (isSameEvent && changeFunc) {
|
|
21777
|
+
changeFunc(targetEvnt);
|
|
21783
21778
|
}
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
return false;
|
|
21787
|
-
}
|
|
21788
|
-
if (!validMaxValue(max, val.length)) {
|
|
21789
|
-
return false;
|
|
21790
|
-
}
|
|
21791
|
-
} else if (isNumType) {
|
|
21792
|
-
const numVal = Number(val);
|
|
21793
|
-
if (isNaN(numVal)) {
|
|
21794
|
-
return false;
|
|
21795
|
-
}
|
|
21796
|
-
if (!validMinValue(min, numVal)) {
|
|
21797
|
-
return false;
|
|
21798
|
-
}
|
|
21799
|
-
if (!validMaxValue(max, numVal)) {
|
|
21800
|
-
return false;
|
|
21801
|
-
}
|
|
21802
|
-
} else {
|
|
21803
|
-
if (isStrType) {
|
|
21804
|
-
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val)) {
|
|
21805
|
-
return false;
|
|
21779
|
+
if (events && events[modelEvent]) {
|
|
21780
|
+
events[modelEvent](params, targetEvnt);
|
|
21806
21781
|
}
|
|
21807
|
-
}
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21782
|
+
};
|
|
21783
|
+
}
|
|
21784
|
+
if (!isSameEvent && changeFunc) {
|
|
21785
|
+
ons[getOnName(changeEvent)] = function (...args) {
|
|
21786
|
+
changeFunc(...args);
|
|
21787
|
+
if (events && events[changeEvent]) {
|
|
21788
|
+
events[changeEvent](params, ...args);
|
|
21811
21789
|
}
|
|
21812
|
-
}
|
|
21813
|
-
if (!validMinValue(min, strVal.length)) {
|
|
21814
|
-
return false;
|
|
21815
|
-
}
|
|
21816
|
-
if (!validMaxValue(max, strVal.length)) {
|
|
21817
|
-
return false;
|
|
21818
|
-
}
|
|
21790
|
+
};
|
|
21819
21791
|
}
|
|
21820
|
-
return
|
|
21792
|
+
return ons;
|
|
21821
21793
|
}
|
|
21822
|
-
|
|
21794
|
+
/**
|
|
21795
|
+
* 组件事件处理
|
|
21796
|
+
* @param renderOpts
|
|
21797
|
+
* @param params
|
|
21798
|
+
* @param modelFunc
|
|
21799
|
+
* @param changeFunc
|
|
21800
|
+
*/
|
|
21801
|
+
function getComponentOns(renderOpts, params, eFns, eventOns) {
|
|
21823
21802
|
const {
|
|
21824
|
-
|
|
21825
|
-
} =
|
|
21826
|
-
const
|
|
21827
|
-
|
|
21828
|
-
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
return false;
|
|
21803
|
+
events
|
|
21804
|
+
} = renderOpts;
|
|
21805
|
+
const {
|
|
21806
|
+
model: modelFunc,
|
|
21807
|
+
change: changeFunc
|
|
21808
|
+
} = eFns || {};
|
|
21809
|
+
const modelEvent = getModelEvent(renderOpts.name);
|
|
21810
|
+
const changeEvent = getChangeEvent(renderOpts.name);
|
|
21811
|
+
const ons = {};
|
|
21812
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
|
|
21813
|
+
ons[getOnName(key)] = function (...args) {
|
|
21814
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
|
|
21815
|
+
errLog('vxe.error.errFunc', [func]);
|
|
21838
21816
|
}
|
|
21839
|
-
|
|
21817
|
+
func(params, ...args);
|
|
21818
|
+
};
|
|
21819
|
+
});
|
|
21820
|
+
if (modelFunc) {
|
|
21821
|
+
ons[getOnName(modelEvent)] = function (targetEvnt) {
|
|
21822
|
+
modelFunc(targetEvnt);
|
|
21823
|
+
if (events && events[modelEvent]) {
|
|
21824
|
+
events[modelEvent](params, targetEvnt);
|
|
21825
|
+
}
|
|
21826
|
+
};
|
|
21840
21827
|
}
|
|
21841
|
-
|
|
21828
|
+
if (changeFunc) {
|
|
21829
|
+
ons[getOnName(changeEvent)] = function (...args) {
|
|
21830
|
+
changeFunc(...args);
|
|
21831
|
+
if (events && events[changeEvent]) {
|
|
21832
|
+
events[changeEvent](params, ...args);
|
|
21833
|
+
}
|
|
21834
|
+
};
|
|
21835
|
+
}
|
|
21836
|
+
return eventOns ? Object.assign(ons, eventOns) : ons;
|
|
21842
21837
|
}
|
|
21843
|
-
function
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21838
|
+
function getItemOns(renderOpts, params) {
|
|
21839
|
+
const {
|
|
21840
|
+
$form,
|
|
21841
|
+
data,
|
|
21842
|
+
field
|
|
21843
|
+
} = params;
|
|
21844
|
+
return getComponentOns(renderOpts, params, {
|
|
21845
|
+
model(value) {
|
|
21846
|
+
// 处理 model 值双向绑定
|
|
21847
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, value);
|
|
21850
21848
|
},
|
|
21851
|
-
|
|
21852
|
-
|
|
21849
|
+
change(params) {
|
|
21850
|
+
// 处理 change 事件相关逻辑
|
|
21851
|
+
$form.updateStatus(params);
|
|
21852
|
+
}
|
|
21853
|
+
});
|
|
21853
21854
|
}
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
|
|
21861
|
-
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
21867
|
-
|
|
21868
|
-
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
21872
|
-
|
|
21873
|
-
|
|
21874
|
-
|
|
21875
|
-
|
|
21876
|
-
|
|
21877
|
-
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
|
|
21881
|
-
|
|
21882
|
-
},
|
|
21883
|
-
titleBackground: {
|
|
21884
|
-
type: Boolean,
|
|
21885
|
-
default: () => getConfig().form.titleBackground
|
|
21886
|
-
},
|
|
21887
|
-
titleBold: {
|
|
21888
|
-
type: Boolean,
|
|
21889
|
-
default: () => getConfig().form.titleBold
|
|
21890
|
-
},
|
|
21891
|
-
titleAlign: {
|
|
21892
|
-
type: String,
|
|
21893
|
-
default: () => getConfig().form.titleAlign
|
|
21894
|
-
},
|
|
21895
|
-
titleWidth: {
|
|
21896
|
-
type: [String, Number],
|
|
21897
|
-
default: () => getConfig().form.titleWidth
|
|
21898
|
-
},
|
|
21899
|
-
titleColon: {
|
|
21900
|
-
type: Boolean,
|
|
21901
|
-
default: () => getConfig().form.titleColon
|
|
21902
|
-
},
|
|
21903
|
-
titleAsterisk: {
|
|
21904
|
-
type: Boolean,
|
|
21905
|
-
default: () => getConfig().form.titleAsterisk
|
|
21906
|
-
},
|
|
21907
|
-
titleOverflow: {
|
|
21908
|
-
type: [Boolean, String],
|
|
21909
|
-
default: () => getConfig().form.titleOverflow
|
|
21910
|
-
},
|
|
21911
|
-
vertical: {
|
|
21912
|
-
type: Boolean,
|
|
21913
|
-
default: () => getConfig().form.vertical
|
|
21914
|
-
},
|
|
21915
|
-
padding: {
|
|
21916
|
-
type: Boolean,
|
|
21917
|
-
default: () => getConfig().form.padding
|
|
21918
|
-
},
|
|
21919
|
-
className: [String, Function],
|
|
21920
|
-
readonly: Boolean,
|
|
21921
|
-
disabled: Boolean,
|
|
21922
|
-
items: Array,
|
|
21923
|
-
rules: Object,
|
|
21924
|
-
preventSubmit: {
|
|
21925
|
-
type: Boolean,
|
|
21926
|
-
default: () => getConfig().form.preventSubmit
|
|
21927
|
-
},
|
|
21928
|
-
validConfig: Object,
|
|
21929
|
-
tooltipConfig: Object,
|
|
21930
|
-
collapseConfig: Object,
|
|
21931
|
-
customLayout: {
|
|
21932
|
-
type: Boolean,
|
|
21933
|
-
default: () => getConfig().form.customLayout
|
|
21934
|
-
},
|
|
21935
|
-
params: Object
|
|
21936
|
-
},
|
|
21937
|
-
emits: ['update:collapseStatus', 'collapse', 'toggle-collapse', 'submit', 'submit-invalid', 'reset'],
|
|
21938
|
-
setup(props, context) {
|
|
21939
|
-
const {
|
|
21940
|
-
slots,
|
|
21941
|
-
emit
|
|
21942
|
-
} = context;
|
|
21943
|
-
const $xeGrid = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGrid', null);
|
|
21944
|
-
const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
|
|
21945
|
-
const {
|
|
21946
|
-
computeSize
|
|
21947
|
-
} = useSize(props);
|
|
21948
|
-
const reactData = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)({
|
|
21949
|
-
collapseAll: props.collapseStatus,
|
|
21950
|
-
staticItems: [],
|
|
21951
|
-
formItems: [],
|
|
21952
|
-
itemWidth: 0
|
|
21953
|
-
});
|
|
21954
|
-
const internalData = createInternalData();
|
|
21955
|
-
const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
|
|
21956
|
-
const refTooltip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
|
|
21957
|
-
let formMethods = {};
|
|
21958
|
-
const computeValidOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
21959
|
-
return Object.assign({}, getConfig().form.validConfig, props.validConfig);
|
|
21960
|
-
});
|
|
21961
|
-
const computeTooltipOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
21962
|
-
return Object.assign({}, getConfig().tooltip, getConfig().form.tooltipConfig, props.tooltipConfig);
|
|
21963
|
-
});
|
|
21964
|
-
const computeCollapseOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
21965
|
-
return Object.assign({}, getConfig().form.collapseConfig, props.collapseConfig);
|
|
21855
|
+
function getNativeItemOns(renderOpts, params) {
|
|
21856
|
+
const {
|
|
21857
|
+
$form,
|
|
21858
|
+
data,
|
|
21859
|
+
field
|
|
21860
|
+
} = params;
|
|
21861
|
+
return getNativeElementOns(renderOpts, params, evnt => {
|
|
21862
|
+
// 处理 model 值双向绑定
|
|
21863
|
+
const itemValue = evnt.target.value;
|
|
21864
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, itemValue);
|
|
21865
|
+
}, () => {
|
|
21866
|
+
// 处理 change 事件相关逻辑
|
|
21867
|
+
$form.updateStatus(params);
|
|
21868
|
+
});
|
|
21869
|
+
}
|
|
21870
|
+
function renderNativeOptgroup(renderOpts, params, renderOptionsMethods) {
|
|
21871
|
+
const {
|
|
21872
|
+
optionGroups,
|
|
21873
|
+
optionGroupProps = {}
|
|
21874
|
+
} = renderOpts;
|
|
21875
|
+
const groupOptions = optionGroupProps.options || 'options';
|
|
21876
|
+
const groupLabel = optionGroupProps.label || 'label';
|
|
21877
|
+
if (optionGroups) {
|
|
21878
|
+
return optionGroups.map((group, gIndex) => {
|
|
21879
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('optgroup', {
|
|
21880
|
+
key: gIndex,
|
|
21881
|
+
label: group[groupLabel]
|
|
21882
|
+
}, renderOptionsMethods(group[groupOptions], renderOpts, params));
|
|
21966
21883
|
});
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21984
|
-
|
|
21985
|
-
|
|
21986
|
-
|
|
21987
|
-
|
|
21988
|
-
|
|
21989
|
-
|
|
21990
|
-
|
|
21991
|
-
|
|
21992
|
-
|
|
21993
|
-
|
|
21884
|
+
}
|
|
21885
|
+
return [];
|
|
21886
|
+
}
|
|
21887
|
+
/**
|
|
21888
|
+
* 渲染表单-项
|
|
21889
|
+
* 用于渲染原生的标签
|
|
21890
|
+
*/
|
|
21891
|
+
function nativeItemRender(renderOpts, params) {
|
|
21892
|
+
const {
|
|
21893
|
+
data,
|
|
21894
|
+
field
|
|
21895
|
+
} = params;
|
|
21896
|
+
const {
|
|
21897
|
+
name
|
|
21898
|
+
} = renderOpts;
|
|
21899
|
+
const attrs = getNativeAttrs(renderOpts);
|
|
21900
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
21901
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(name, {
|
|
21902
|
+
class: `vxe-default-${name}`,
|
|
21903
|
+
...attrs,
|
|
21904
|
+
value: attrs && name === 'input' && (attrs.type === 'submit' || attrs.type === 'reset') ? null : itemValue,
|
|
21905
|
+
...getNativeItemOns(renderOpts, params)
|
|
21906
|
+
})];
|
|
21907
|
+
}
|
|
21908
|
+
function defaultItemRender(renderOpts, params) {
|
|
21909
|
+
const {
|
|
21910
|
+
data,
|
|
21911
|
+
field
|
|
21912
|
+
} = params;
|
|
21913
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
21914
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
21915
|
+
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
21916
|
+
...getItemOns(renderOpts, params)
|
|
21917
|
+
})];
|
|
21918
|
+
}
|
|
21919
|
+
/**
|
|
21920
|
+
* 已废弃
|
|
21921
|
+
* @deprecated
|
|
21922
|
+
*/
|
|
21923
|
+
function oldItemRender(renderOpts, params) {
|
|
21924
|
+
const {
|
|
21925
|
+
data,
|
|
21926
|
+
field
|
|
21927
|
+
} = params;
|
|
21928
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
21929
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getOldComponent(renderOpts), {
|
|
21930
|
+
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
21931
|
+
...getItemOns(renderOpts, params)
|
|
21932
|
+
})];
|
|
21933
|
+
}
|
|
21934
|
+
/**
|
|
21935
|
+
* 已废弃
|
|
21936
|
+
* @deprecated
|
|
21937
|
+
*/
|
|
21938
|
+
function oldButtonItemRender(renderOpts, params) {
|
|
21939
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)('vxe-button'), {
|
|
21940
|
+
...getComponentFormItemProps(renderOpts, params, null),
|
|
21941
|
+
...getComponentOns(renderOpts, params)
|
|
21942
|
+
})];
|
|
21943
|
+
}
|
|
21944
|
+
/**
|
|
21945
|
+
* 已废弃
|
|
21946
|
+
* @deprecated
|
|
21947
|
+
*/
|
|
21948
|
+
function oldButtonsItemRender(renderOpts, params) {
|
|
21949
|
+
return renderOpts.children.map(childRenderOpts => oldButtonItemRender(childRenderOpts, params)[0]);
|
|
21950
|
+
}
|
|
21951
|
+
/**
|
|
21952
|
+
* 渲染原生的 select 标签
|
|
21953
|
+
*/
|
|
21954
|
+
function renderNativeFormOptions(options, renderOpts, params) {
|
|
21955
|
+
const {
|
|
21956
|
+
data,
|
|
21957
|
+
field
|
|
21958
|
+
} = params;
|
|
21959
|
+
const {
|
|
21960
|
+
optionProps = {}
|
|
21961
|
+
} = renderOpts;
|
|
21962
|
+
const labelProp = optionProps.label || 'label';
|
|
21963
|
+
const valueProp = optionProps.value || 'value';
|
|
21964
|
+
const disabledProp = optionProps.disabled || 'disabled';
|
|
21965
|
+
const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
21966
|
+
if (options) {
|
|
21967
|
+
return options.map((item, oIndex) => {
|
|
21968
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('option', {
|
|
21969
|
+
key: oIndex,
|
|
21970
|
+
value: item[valueProp],
|
|
21971
|
+
disabled: item[disabledProp],
|
|
21972
|
+
/* eslint-disable eqeqeq */
|
|
21973
|
+
selected: item[valueProp] == cellValue
|
|
21974
|
+
}, item[labelProp]);
|
|
21994
21975
|
});
|
|
21995
|
-
|
|
21996
|
-
|
|
21997
|
-
|
|
21998
|
-
|
|
21999
|
-
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
|
|
22003
|
-
|
|
22004
|
-
|
|
22005
|
-
|
|
22006
|
-
|
|
22007
|
-
|
|
22008
|
-
|
|
22009
|
-
|
|
22010
|
-
|
|
22011
|
-
|
|
22012
|
-
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22016
|
-
|
|
22017
|
-
|
|
22018
|
-
|
|
22019
|
-
|
|
22020
|
-
|
|
22021
|
-
|
|
22022
|
-
|
|
22023
|
-
|
|
22024
|
-
|
|
22025
|
-
|
|
22026
|
-
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
|
|
22030
|
-
|
|
22031
|
-
|
|
22032
|
-
|
|
22033
|
-
|
|
22034
|
-
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
|
|
22038
|
-
|
|
22039
|
-
|
|
22040
|
-
|
|
22041
|
-
|
|
22042
|
-
|
|
22043
|
-
|
|
22044
|
-
|
|
22045
|
-
|
|
22046
|
-
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
|
|
22050
|
-
|
|
22051
|
-
|
|
22052
|
-
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
|
|
22058
|
-
|
|
22059
|
-
|
|
22060
|
-
|
|
22061
|
-
|
|
22062
|
-
};
|
|
22063
|
-
const getCollapseStatus = () => {
|
|
22064
|
-
return reactData.collapseAll;
|
|
22065
|
-
};
|
|
22066
|
-
const toggleCollapse = () => {
|
|
22067
|
-
const status = !getCollapseStatus();
|
|
22068
|
-
reactData.collapseAll = status;
|
|
22069
|
-
emit('update:collapseStatus', status);
|
|
22070
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
22071
|
-
};
|
|
22072
|
-
const toggleCollapseEvent = evnt => {
|
|
22073
|
-
toggleCollapse();
|
|
22074
|
-
const status = getCollapseStatus();
|
|
22075
|
-
formMethods.dispatchEvent('toggle-collapse', {
|
|
22076
|
-
status,
|
|
22077
|
-
collapse: status,
|
|
22078
|
-
data: props.data
|
|
22079
|
-
}, evnt);
|
|
22080
|
-
formMethods.dispatchEvent('collapse', {
|
|
22081
|
-
status,
|
|
22082
|
-
collapse: status,
|
|
22083
|
-
data: props.data
|
|
22084
|
-
}, evnt);
|
|
22085
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
22086
|
-
recalculate();
|
|
22087
|
-
if ($xeGrid) {
|
|
22088
|
-
$xeGrid.recalculate();
|
|
22089
|
-
}
|
|
22090
|
-
});
|
|
22091
|
-
};
|
|
22092
|
-
const clearValidate = fieldOrItem => {
|
|
22093
|
-
if (fieldOrItem) {
|
|
22094
|
-
let fields = fieldOrItem;
|
|
22095
|
-
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrItem)) {
|
|
22096
|
-
fields = [fieldOrItem];
|
|
22097
|
-
}
|
|
22098
|
-
fields.forEach(field => {
|
|
22099
|
-
if (field) {
|
|
22100
|
-
const item = handleFieldOrItem($xeForm, field);
|
|
22101
|
-
if (item) {
|
|
22102
|
-
item.showError = false;
|
|
22103
|
-
}
|
|
22104
|
-
}
|
|
22105
|
-
});
|
|
22106
|
-
} else {
|
|
22107
|
-
getItems().forEach(item => {
|
|
22108
|
-
item.showError = false;
|
|
22109
|
-
});
|
|
22110
|
-
}
|
|
22111
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
22112
|
-
};
|
|
22113
|
-
const getResetValue = (item, data, itemValue) => {
|
|
22114
|
-
const {
|
|
22115
|
-
field,
|
|
22116
|
-
resetValue
|
|
22117
|
-
} = item;
|
|
22118
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resetValue)) {
|
|
22119
|
-
return resetValue({
|
|
22120
|
-
field,
|
|
22121
|
-
item,
|
|
22122
|
-
data,
|
|
22123
|
-
$form: $xeForm,
|
|
22124
|
-
$grid: $xeGrid
|
|
22125
|
-
});
|
|
22126
|
-
} else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(resetValue)) {
|
|
22127
|
-
// 默认
|
|
22128
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(itemValue)) {
|
|
22129
|
-
return [];
|
|
22130
|
-
}
|
|
22131
|
-
}
|
|
22132
|
-
return resetValue;
|
|
22133
|
-
};
|
|
22134
|
-
const reset = () => {
|
|
22135
|
-
const {
|
|
22136
|
-
data
|
|
22137
|
-
} = props;
|
|
22138
|
-
const itemList = getItems();
|
|
22139
|
-
if (data) {
|
|
22140
|
-
itemList.forEach(item => {
|
|
22141
|
-
const {
|
|
22142
|
-
field,
|
|
22143
|
-
itemRender
|
|
22144
|
-
} = item;
|
|
22145
|
-
if (isEnableConf(itemRender)) {
|
|
22146
|
-
const {
|
|
22147
|
-
name,
|
|
22148
|
-
startField,
|
|
22149
|
-
endField
|
|
22150
|
-
} = itemRender;
|
|
22151
|
-
const compConf = renderer.get(name);
|
|
22152
|
-
const fiResetMethod = compConf ? compConf.formItemResetMethod || compConf.itemResetMethod : null;
|
|
22153
|
-
if (compConf && fiResetMethod) {
|
|
22154
|
-
fiResetMethod({
|
|
22155
|
-
data,
|
|
22156
|
-
field,
|
|
22157
|
-
property: field,
|
|
22158
|
-
item,
|
|
22159
|
-
$form: $xeForm,
|
|
22160
|
-
$grid: $xeGrid
|
|
22161
|
-
});
|
|
22162
|
-
} else if (field) {
|
|
22163
|
-
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22164
|
-
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, getResetValue(item, data, itemValue));
|
|
22165
|
-
}
|
|
22166
|
-
if (startField && endField) {
|
|
22167
|
-
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, startField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, startField)));
|
|
22168
|
-
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, endField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, endField)));
|
|
22169
|
-
}
|
|
22170
|
-
}
|
|
22171
|
-
});
|
|
22172
|
-
}
|
|
22173
|
-
internalData.itemFormatCache = {};
|
|
22174
|
-
clearValidate();
|
|
22175
|
-
return recalculate();
|
|
22176
|
-
};
|
|
22177
|
-
const resetEvent = evnt => {
|
|
22178
|
-
evnt.preventDefault();
|
|
22179
|
-
reset();
|
|
22180
|
-
formMethods.dispatchEvent('reset', {
|
|
22181
|
-
data: props.data
|
|
22182
|
-
}, evnt);
|
|
22183
|
-
};
|
|
22184
|
-
const handleFocus = fields => {
|
|
22185
|
-
const el = refElem.value;
|
|
22186
|
-
if (el) {
|
|
22187
|
-
for (let i = 0; i < fields.length; i++) {
|
|
22188
|
-
const field = fields[i];
|
|
22189
|
-
const item = getItemByField(field);
|
|
22190
|
-
if (item && isEnableConf(item.itemRender)) {
|
|
22191
|
-
const {
|
|
22192
|
-
itemRender
|
|
22193
|
-
} = item;
|
|
22194
|
-
const compConf = renderer.get(itemRender.name);
|
|
22195
|
-
// 定位到第一个
|
|
22196
|
-
if (!i) {
|
|
22197
|
-
scrollToView(el.querySelector(`.${item.id}`));
|
|
22198
|
-
}
|
|
22199
|
-
let inputElem = null;
|
|
22200
|
-
const autoFocus = itemRender.autoFocus || itemRender.autofocus || (compConf ? compConf.formItemAutoFocus : null);
|
|
22201
|
-
// 如果指定了聚焦 class
|
|
22202
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(autoFocus)) {
|
|
22203
|
-
inputElem = autoFocus({
|
|
22204
|
-
$form: $xeForm,
|
|
22205
|
-
$grid: $xeGrid,
|
|
22206
|
-
item,
|
|
22207
|
-
data: props.data,
|
|
22208
|
-
field
|
|
22209
|
-
});
|
|
22210
|
-
} else {
|
|
22211
|
-
if (autoFocus === true) {
|
|
22212
|
-
// 自动匹配模式,会自动匹配第一个可输入元素
|
|
22213
|
-
inputElem = el.querySelector(`.${item.id} input,textarea`);
|
|
22214
|
-
} else if (autoFocus) {
|
|
22215
|
-
inputElem = el.querySelector(`.${item.id} ${autoFocus}`);
|
|
22216
|
-
}
|
|
22217
|
-
}
|
|
22218
|
-
if (inputElem) {
|
|
22219
|
-
inputElem.focus();
|
|
22220
|
-
break;
|
|
22221
|
-
}
|
|
22222
|
-
}
|
|
22223
|
-
}
|
|
22224
|
-
}
|
|
22225
|
-
};
|
|
22226
|
-
/**
|
|
22227
|
-
* 校验数据
|
|
22228
|
-
* 按表格行、列顺序依次校验(同步或异步)
|
|
22229
|
-
* 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
|
|
22230
|
-
* 如果校验失败则,触发回调或者 Promise<(ErrMap 校验不通过列的信息)>
|
|
22231
|
-
* 如果是传回调方式这返回一个 (ErrMap 校验不通过列的信息)
|
|
22232
|
-
*
|
|
22233
|
-
* rule 配置:
|
|
22234
|
-
* required=Boolean 是否必填
|
|
22235
|
-
* min=Number 最小长度
|
|
22236
|
-
* max=Number 最大长度
|
|
22237
|
-
* validator=Function({ itemValue, rule, rules, data, property }) 自定义校验,接收一个 Promise
|
|
22238
|
-
* trigger=change 触发方式
|
|
22239
|
-
*/
|
|
22240
|
-
const validItemRules = (validType, fields, val) => {
|
|
22241
|
-
const {
|
|
22242
|
-
data,
|
|
22243
|
-
rules: formRules
|
|
22244
|
-
} = props;
|
|
22245
|
-
const errorMaps = {};
|
|
22246
|
-
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fields)) {
|
|
22247
|
-
fields = [fields];
|
|
22248
|
-
}
|
|
22249
|
-
return Promise.all(fields.map(property => {
|
|
22250
|
-
const errorRules = [];
|
|
22251
|
-
const syncVailds = [];
|
|
22252
|
-
if (property && formRules) {
|
|
22253
|
-
const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(formRules, property);
|
|
22254
|
-
if (rules) {
|
|
22255
|
-
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(val) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, property) : val;
|
|
22256
|
-
rules.forEach(rule => {
|
|
22257
|
-
const {
|
|
22258
|
-
trigger,
|
|
22259
|
-
validator
|
|
22260
|
-
} = rule;
|
|
22261
|
-
if (validType === 'all' || !trigger || validType === trigger) {
|
|
22262
|
-
if (validator) {
|
|
22263
|
-
const validParams = {
|
|
22264
|
-
itemValue,
|
|
22265
|
-
rule,
|
|
22266
|
-
rules,
|
|
22267
|
-
data,
|
|
22268
|
-
field: property,
|
|
22269
|
-
property,
|
|
22270
|
-
$form: $xeForm
|
|
22271
|
-
};
|
|
22272
|
-
let customValid;
|
|
22273
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
|
|
22274
|
-
const gvItem = validators.get(validator);
|
|
22275
|
-
if (gvItem) {
|
|
22276
|
-
const validatorMethod = gvItem.formItemValidatorMethod || gvItem.itemValidatorMethod;
|
|
22277
|
-
if (validatorMethod) {
|
|
22278
|
-
customValid = validatorMethod(validParams);
|
|
22279
|
-
} else {
|
|
22280
|
-
warnLog('vxe.error.notValidators', [validator]);
|
|
22281
|
-
}
|
|
22282
|
-
} else {
|
|
22283
|
-
errLog('vxe.error.notValidators', [validator]);
|
|
22284
|
-
}
|
|
22285
|
-
} else {
|
|
22286
|
-
customValid = validator(validParams);
|
|
22287
|
-
}
|
|
22288
|
-
if (customValid) {
|
|
22289
|
-
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
|
|
22290
|
-
errorRules.push(new Rule({
|
|
22291
|
-
type: 'custom',
|
|
22292
|
-
trigger,
|
|
22293
|
-
content: customValid.message,
|
|
22294
|
-
rule: new Rule(rule)
|
|
22295
|
-
}));
|
|
22296
|
-
} else if (customValid.catch) {
|
|
22297
|
-
// 如果为异步校验(注:异步校验是并发无序的)
|
|
22298
|
-
syncVailds.push(customValid.catch(e => {
|
|
22299
|
-
errorRules.push(new Rule({
|
|
22300
|
-
type: 'custom',
|
|
22301
|
-
trigger,
|
|
22302
|
-
content: e ? e.message : rule.content || rule.message,
|
|
22303
|
-
rule: new Rule(rule)
|
|
22304
|
-
}));
|
|
22305
|
-
}));
|
|
22306
|
-
}
|
|
22307
|
-
}
|
|
22308
|
-
} else {
|
|
22309
|
-
if (!checkRuleStatus(rule, itemValue)) {
|
|
22310
|
-
errorRules.push(new Rule(rule));
|
|
22311
|
-
}
|
|
22312
|
-
}
|
|
22313
|
-
}
|
|
22314
|
-
});
|
|
22315
|
-
}
|
|
22316
|
-
}
|
|
22317
|
-
return Promise.all(syncVailds).then(() => {
|
|
22318
|
-
if (errorRules.length) {
|
|
22319
|
-
errorMaps[property] = errorRules.map(rule => {
|
|
22320
|
-
return {
|
|
22321
|
-
$form: $xeForm,
|
|
22322
|
-
rule,
|
|
22323
|
-
data,
|
|
22324
|
-
field: property,
|
|
22325
|
-
property
|
|
22326
|
-
};
|
|
22327
|
-
});
|
|
22328
|
-
}
|
|
21976
|
+
}
|
|
21977
|
+
return [];
|
|
21978
|
+
}
|
|
21979
|
+
/**
|
|
21980
|
+
* 渲染表单-项
|
|
21981
|
+
*/
|
|
21982
|
+
function defaultFormItemRender(renderOpts, params) {
|
|
21983
|
+
const {
|
|
21984
|
+
data,
|
|
21985
|
+
field
|
|
21986
|
+
} = params;
|
|
21987
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
21988
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
21989
|
+
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
21990
|
+
...getItemOns(renderOpts, params)
|
|
21991
|
+
})];
|
|
21992
|
+
}
|
|
21993
|
+
function formItemRadioAndCheckboxRender(renderOpts, params) {
|
|
21994
|
+
const {
|
|
21995
|
+
options,
|
|
21996
|
+
optionProps
|
|
21997
|
+
} = renderOpts;
|
|
21998
|
+
const {
|
|
21999
|
+
data,
|
|
22000
|
+
field
|
|
22001
|
+
} = params;
|
|
22002
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22003
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22004
|
+
options,
|
|
22005
|
+
optionProps,
|
|
22006
|
+
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
22007
|
+
...getItemOns(renderOpts, params)
|
|
22008
|
+
})];
|
|
22009
|
+
}
|
|
22010
|
+
/**
|
|
22011
|
+
* 已废弃
|
|
22012
|
+
* @deprecated
|
|
22013
|
+
*/
|
|
22014
|
+
function oldFormItemRadioAndCheckboxRender(renderOpts, params) {
|
|
22015
|
+
const {
|
|
22016
|
+
name,
|
|
22017
|
+
options,
|
|
22018
|
+
optionProps = {}
|
|
22019
|
+
} = renderOpts;
|
|
22020
|
+
const {
|
|
22021
|
+
data,
|
|
22022
|
+
field
|
|
22023
|
+
} = params;
|
|
22024
|
+
const labelProp = optionProps.label || 'label';
|
|
22025
|
+
const valueProp = optionProps.value || 'value';
|
|
22026
|
+
const disabledProp = optionProps.disabled || 'disabled';
|
|
22027
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22028
|
+
const compName = getOldComponentName(name);
|
|
22029
|
+
// 如果是分组
|
|
22030
|
+
if (options) {
|
|
22031
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(`${compName}-group`), {
|
|
22032
|
+
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
22033
|
+
...getItemOns(renderOpts, params)
|
|
22034
|
+
}, {
|
|
22035
|
+
default: () => {
|
|
22036
|
+
return options.map((item, index) => {
|
|
22037
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(compName), {
|
|
22038
|
+
key: index,
|
|
22039
|
+
label: item[valueProp],
|
|
22040
|
+
content: item[labelProp],
|
|
22041
|
+
disabled: item[disabledProp]
|
|
22042
|
+
});
|
|
22329
22043
|
});
|
|
22330
|
-
}
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
|
|
22334
|
-
|
|
22335
|
-
|
|
22336
|
-
|
|
22044
|
+
}
|
|
22045
|
+
})];
|
|
22046
|
+
}
|
|
22047
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(compName), {
|
|
22048
|
+
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
22049
|
+
...getItemOns(renderOpts, params)
|
|
22050
|
+
})];
|
|
22051
|
+
}
|
|
22052
|
+
/**
|
|
22053
|
+
* 表单 - 渲染器
|
|
22054
|
+
*/
|
|
22055
|
+
renderer.mixin({
|
|
22056
|
+
input: {
|
|
22057
|
+
formItemAutoFocus: 'input',
|
|
22058
|
+
renderFormItemContent: nativeItemRender
|
|
22059
|
+
},
|
|
22060
|
+
textarea: {
|
|
22061
|
+
formItemAutoFocus: 'textarea',
|
|
22062
|
+
renderFormItemContent: nativeItemRender
|
|
22063
|
+
},
|
|
22064
|
+
select: {
|
|
22065
|
+
formItemAutoFocus: 'input',
|
|
22066
|
+
renderFormItemContent(renderOpts, params) {
|
|
22067
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('select', {
|
|
22068
|
+
class: 'vxe-default-select',
|
|
22069
|
+
...getNativeAttrs(renderOpts),
|
|
22070
|
+
...getNativeItemOns(renderOpts, params)
|
|
22071
|
+
}, renderOpts.optionGroups ? renderNativeOptgroup(renderOpts, params, renderNativeFormOptions) : renderNativeFormOptions(renderOpts.options, renderOpts, params))];
|
|
22072
|
+
}
|
|
22073
|
+
},
|
|
22074
|
+
VxeInput: {
|
|
22075
|
+
formItemAutoFocus: 'input',
|
|
22076
|
+
renderFormItemContent: defaultItemRender
|
|
22077
|
+
},
|
|
22078
|
+
VxeNumberInput: {
|
|
22079
|
+
formItemAutoFocus: 'input',
|
|
22080
|
+
renderFormItemContent: defaultItemRender
|
|
22081
|
+
},
|
|
22082
|
+
VxePasswordInput: {
|
|
22083
|
+
formItemAutoFocus: 'input',
|
|
22084
|
+
renderFormItemContent: defaultItemRender
|
|
22085
|
+
},
|
|
22086
|
+
VxeTextarea: {
|
|
22087
|
+
formItemAutoFocus: 'textarea',
|
|
22088
|
+
renderFormItemContent: defaultItemRender
|
|
22089
|
+
},
|
|
22090
|
+
VxeDatePicker: {
|
|
22091
|
+
formItemAutoFocus: 'input',
|
|
22092
|
+
renderFormItemContent: defaultItemRender
|
|
22093
|
+
},
|
|
22094
|
+
VxeDateRangePicker: {
|
|
22095
|
+
formItemAutoFocus: 'input',
|
|
22096
|
+
renderFormItemContent(renderOpts, params) {
|
|
22097
|
+
const {
|
|
22098
|
+
startField,
|
|
22099
|
+
endField
|
|
22100
|
+
} = renderOpts;
|
|
22337
22101
|
const {
|
|
22102
|
+
$form,
|
|
22338
22103
|
data,
|
|
22339
|
-
|
|
22340
|
-
} =
|
|
22341
|
-
const
|
|
22342
|
-
const
|
|
22343
|
-
const
|
|
22344
|
-
|
|
22345
|
-
|
|
22346
|
-
|
|
22347
|
-
|
|
22348
|
-
|
|
22349
|
-
|
|
22350
|
-
} = item;
|
|
22351
|
-
if (field && !isHiddenItem($xeForm, item) && isActiveItem($xeForm, item)) {
|
|
22352
|
-
itemValids.push(validItemRules(type || 'all', field).then(() => {
|
|
22353
|
-
item.errRule = null;
|
|
22354
|
-
}).catch(errorMaps => {
|
|
22355
|
-
const rest = errorMaps[field];
|
|
22356
|
-
if (!validRest[field]) {
|
|
22357
|
-
validRest[field] = [];
|
|
22358
|
-
}
|
|
22359
|
-
validRest[field].push(rest);
|
|
22360
|
-
validFields.push(field);
|
|
22361
|
-
item.errRule = rest[0].rule;
|
|
22362
|
-
return Promise.reject(rest);
|
|
22363
|
-
}));
|
|
22104
|
+
field
|
|
22105
|
+
} = params;
|
|
22106
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22107
|
+
const seProps = {};
|
|
22108
|
+
const seOs = {};
|
|
22109
|
+
if (startField && endField) {
|
|
22110
|
+
seProps.startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, startField);
|
|
22111
|
+
seProps.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, endField);
|
|
22112
|
+
seOs['onUpdate:startValue'] = value => {
|
|
22113
|
+
if (startField) {
|
|
22114
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, startField, value);
|
|
22364
22115
|
}
|
|
22365
|
-
}
|
|
22366
|
-
|
|
22367
|
-
if (
|
|
22368
|
-
|
|
22116
|
+
};
|
|
22117
|
+
seOs['onUpdate:endValue'] = value => {
|
|
22118
|
+
if (endField) {
|
|
22119
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, endField, value);
|
|
22369
22120
|
}
|
|
22370
|
-
}
|
|
22371
|
-
return new Promise(resolve => {
|
|
22372
|
-
internalData.meTimeout = setTimeout(() => {
|
|
22373
|
-
itemList.forEach(item => {
|
|
22374
|
-
if (item.errRule) {
|
|
22375
|
-
item.showError = true;
|
|
22376
|
-
}
|
|
22377
|
-
});
|
|
22378
|
-
}, 20);
|
|
22379
|
-
if (validOpts.autoPos !== false) {
|
|
22380
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
22381
|
-
handleFocus(validFields);
|
|
22382
|
-
});
|
|
22383
|
-
}
|
|
22384
|
-
if (callback) {
|
|
22385
|
-
callback(validRest);
|
|
22386
|
-
resolve();
|
|
22387
|
-
} else {
|
|
22388
|
-
resolve(validRest);
|
|
22389
|
-
}
|
|
22390
|
-
});
|
|
22391
|
-
});
|
|
22392
|
-
}
|
|
22393
|
-
if (callback) {
|
|
22394
|
-
callback();
|
|
22121
|
+
};
|
|
22395
22122
|
}
|
|
22396
|
-
return
|
|
22397
|
-
|
|
22398
|
-
|
|
22123
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22124
|
+
...getComponentFormItemProps(renderOpts, params, itemValue, seProps),
|
|
22125
|
+
...getComponentOns(renderOpts, params, {
|
|
22126
|
+
model(value) {
|
|
22127
|
+
// 处理 model 值双向绑定
|
|
22128
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, value);
|
|
22129
|
+
},
|
|
22130
|
+
change() {
|
|
22131
|
+
// 处理 change 事件相关逻辑
|
|
22132
|
+
$form.updateStatus(params);
|
|
22133
|
+
}
|
|
22134
|
+
}, seOs)
|
|
22135
|
+
})];
|
|
22136
|
+
}
|
|
22137
|
+
},
|
|
22138
|
+
VxeButton: {
|
|
22139
|
+
renderFormItemContent: defaultFormItemRender
|
|
22140
|
+
},
|
|
22141
|
+
VxeButtonGroup: {
|
|
22142
|
+
renderFormItemContent(renderOpts, params) {
|
|
22143
|
+
const {
|
|
22144
|
+
options
|
|
22145
|
+
} = renderOpts;
|
|
22146
|
+
const {
|
|
22147
|
+
data,
|
|
22148
|
+
field
|
|
22149
|
+
} = params;
|
|
22150
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22151
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22152
|
+
options,
|
|
22153
|
+
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
22154
|
+
...getItemOns(renderOpts, params)
|
|
22155
|
+
})];
|
|
22156
|
+
}
|
|
22157
|
+
},
|
|
22158
|
+
VxeSelect: {
|
|
22159
|
+
formItemAutoFocus: 'input',
|
|
22160
|
+
renderFormItemContent(renderOpts, params) {
|
|
22161
|
+
const {
|
|
22162
|
+
data,
|
|
22163
|
+
field
|
|
22164
|
+
} = params;
|
|
22165
|
+
const {
|
|
22166
|
+
options,
|
|
22167
|
+
optionProps,
|
|
22168
|
+
optionGroups,
|
|
22169
|
+
optionGroupProps
|
|
22170
|
+
} = renderOpts;
|
|
22171
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22172
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22173
|
+
...getComponentFormItemProps(renderOpts, params, itemValue, {
|
|
22174
|
+
options,
|
|
22175
|
+
optionProps,
|
|
22176
|
+
optionGroups,
|
|
22177
|
+
optionGroupProps
|
|
22178
|
+
}),
|
|
22179
|
+
...getItemOns(renderOpts, params)
|
|
22180
|
+
})];
|
|
22181
|
+
}
|
|
22182
|
+
},
|
|
22183
|
+
VxeTreeSelect: {
|
|
22184
|
+
formItemAutoFocus: 'input',
|
|
22185
|
+
renderFormItemContent(renderOpts, params) {
|
|
22399
22186
|
const {
|
|
22400
|
-
|
|
22401
|
-
|
|
22402
|
-
|
|
22403
|
-
if (readonly) {
|
|
22404
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
22405
|
-
}
|
|
22406
|
-
return beginValidate(getItems(), '', callback).then(params => {
|
|
22407
|
-
recalculate();
|
|
22408
|
-
return params;
|
|
22409
|
-
});
|
|
22410
|
-
};
|
|
22411
|
-
const validateField = (fieldOrItem, callback) => {
|
|
22187
|
+
data,
|
|
22188
|
+
field
|
|
22189
|
+
} = params;
|
|
22412
22190
|
const {
|
|
22413
|
-
|
|
22414
|
-
|
|
22415
|
-
|
|
22416
|
-
|
|
22417
|
-
|
|
22418
|
-
|
|
22419
|
-
|
|
22420
|
-
|
|
22421
|
-
|
|
22422
|
-
|
|
22423
|
-
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
|
|
22428
|
-
|
|
22429
|
-
});
|
|
22430
|
-
};
|
|
22431
|
-
const submitEvent = evnt => {
|
|
22191
|
+
options,
|
|
22192
|
+
optionProps
|
|
22193
|
+
} = renderOpts;
|
|
22194
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22195
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22196
|
+
...getComponentFormItemProps(renderOpts, params, itemValue, {
|
|
22197
|
+
options,
|
|
22198
|
+
optionProps
|
|
22199
|
+
}),
|
|
22200
|
+
...getItemOns(renderOpts, params)
|
|
22201
|
+
})];
|
|
22202
|
+
}
|
|
22203
|
+
},
|
|
22204
|
+
VxeTableSelect: {
|
|
22205
|
+
formItemAutoFocus: 'input',
|
|
22206
|
+
renderFormItemContent(renderOpts, params) {
|
|
22432
22207
|
const {
|
|
22433
|
-
|
|
22434
|
-
|
|
22435
|
-
|
|
22436
|
-
if (!props.preventSubmit) {
|
|
22437
|
-
clearValidate();
|
|
22438
|
-
if (readonly) {
|
|
22439
|
-
formMethods.dispatchEvent('submit', {
|
|
22440
|
-
data: props.data
|
|
22441
|
-
}, evnt);
|
|
22442
|
-
recalculate();
|
|
22443
|
-
return;
|
|
22444
|
-
}
|
|
22445
|
-
beginValidate(getItems()).then(errMap => {
|
|
22446
|
-
if (errMap) {
|
|
22447
|
-
formMethods.dispatchEvent('submit-invalid', {
|
|
22448
|
-
data: props.data,
|
|
22449
|
-
errMap
|
|
22450
|
-
}, evnt);
|
|
22451
|
-
} else {
|
|
22452
|
-
formMethods.dispatchEvent('submit', {
|
|
22453
|
-
data: props.data
|
|
22454
|
-
}, evnt);
|
|
22455
|
-
}
|
|
22456
|
-
recalculate();
|
|
22457
|
-
});
|
|
22458
|
-
}
|
|
22459
|
-
};
|
|
22460
|
-
const closeTooltip = () => {
|
|
22208
|
+
data,
|
|
22209
|
+
field
|
|
22210
|
+
} = params;
|
|
22461
22211
|
const {
|
|
22462
|
-
|
|
22463
|
-
|
|
22464
|
-
|
|
22465
|
-
|
|
22466
|
-
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22212
|
+
options,
|
|
22213
|
+
optionProps
|
|
22214
|
+
} = renderOpts;
|
|
22215
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22216
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22217
|
+
...getComponentFormItemProps(renderOpts, params, itemValue, {
|
|
22218
|
+
options,
|
|
22219
|
+
optionProps
|
|
22220
|
+
}),
|
|
22221
|
+
...getItemOns(renderOpts, params)
|
|
22222
|
+
})];
|
|
22223
|
+
}
|
|
22224
|
+
},
|
|
22225
|
+
VxeColorPicker: {
|
|
22226
|
+
formItemAutoFocus: 'input',
|
|
22227
|
+
renderFormItemContent(renderOpts, params) {
|
|
22477
22228
|
const {
|
|
22478
|
-
|
|
22229
|
+
data,
|
|
22230
|
+
field
|
|
22479
22231
|
} = params;
|
|
22480
22232
|
const {
|
|
22481
|
-
|
|
22482
|
-
} =
|
|
22483
|
-
const
|
|
22484
|
-
|
|
22485
|
-
|
|
22486
|
-
|
|
22487
|
-
|
|
22488
|
-
|
|
22489
|
-
|
|
22490
|
-
|
|
22491
|
-
|
|
22492
|
-
|
|
22493
|
-
|
|
22494
|
-
|
|
22495
|
-
});
|
|
22496
|
-
if ($tooltip) {
|
|
22497
|
-
$tooltip.open(overflowElem, content);
|
|
22498
|
-
}
|
|
22499
|
-
}
|
|
22500
|
-
};
|
|
22501
|
-
const handleTitleTipLeaveEvent = () => {
|
|
22502
|
-
const tooltipOpts = computeTooltipOpts.value;
|
|
22503
|
-
let $tooltip = refTooltip.value;
|
|
22504
|
-
if ($tooltip) {
|
|
22505
|
-
$tooltip.setActived(false);
|
|
22506
|
-
}
|
|
22507
|
-
if (tooltipOpts.enterable) {
|
|
22508
|
-
internalData.stTimeout = setTimeout(() => {
|
|
22509
|
-
$tooltip = refTooltip.value;
|
|
22510
|
-
if ($tooltip && !$tooltip.isActived()) {
|
|
22511
|
-
closeTooltip();
|
|
22512
|
-
}
|
|
22513
|
-
}, tooltipOpts.leaveDelay);
|
|
22514
|
-
} else {
|
|
22515
|
-
closeTooltip();
|
|
22516
|
-
}
|
|
22517
|
-
};
|
|
22518
|
-
const triggerItemEvent = (evnt, field, itemValue) => {
|
|
22519
|
-
if (field) {
|
|
22520
|
-
return validItemRules(evnt ? ['blur'].includes(evnt.type) ? 'blur' : 'change' : 'all', field, itemValue).then(() => {
|
|
22521
|
-
clearValidate(field);
|
|
22522
|
-
}).catch(errorMaps => {
|
|
22523
|
-
const rest = errorMaps[field];
|
|
22524
|
-
const item = getItemByField(field);
|
|
22525
|
-
if (rest && item) {
|
|
22526
|
-
item.showError = true;
|
|
22527
|
-
item.errRule = rest[0].rule;
|
|
22528
|
-
}
|
|
22529
|
-
});
|
|
22530
|
-
}
|
|
22531
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
22532
|
-
};
|
|
22533
|
-
/**
|
|
22534
|
-
* 更新项状态
|
|
22535
|
-
* 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
|
|
22536
|
-
* 如果单元格配置了校验规则,则会进行校验
|
|
22537
|
-
*/
|
|
22538
|
-
const updateStatus = (scope, itemValue) => {
|
|
22233
|
+
options
|
|
22234
|
+
} = renderOpts;
|
|
22235
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22236
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22237
|
+
...getComponentFormItemProps(renderOpts, params, itemValue, {
|
|
22238
|
+
colors: options
|
|
22239
|
+
}),
|
|
22240
|
+
...getItemOns(renderOpts, params)
|
|
22241
|
+
})];
|
|
22242
|
+
}
|
|
22243
|
+
},
|
|
22244
|
+
VxeIconPicker: {
|
|
22245
|
+
formItemAutoFocus: 'input',
|
|
22246
|
+
renderFormItemContent(renderOpts, params) {
|
|
22539
22247
|
const {
|
|
22248
|
+
data,
|
|
22540
22249
|
field
|
|
22541
|
-
} =
|
|
22542
|
-
|
|
22543
|
-
|
|
22544
|
-
|
|
22545
|
-
const
|
|
22546
|
-
|
|
22547
|
-
|
|
22548
|
-
|
|
22549
|
-
|
|
22550
|
-
|
|
22551
|
-
|
|
22552
|
-
|
|
22553
|
-
|
|
22554
|
-
|
|
22555
|
-
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
|
|
22563
|
-
|
|
22564
|
-
|
|
22565
|
-
|
|
22566
|
-
|
|
22567
|
-
|
|
22568
|
-
|
|
22569
|
-
|
|
22570
|
-
|
|
22571
|
-
|
|
22572
|
-
|
|
22573
|
-
|
|
22574
|
-
|
|
22575
|
-
|
|
22576
|
-
|
|
22577
|
-
getItemByField,
|
|
22578
|
-
closeTooltip,
|
|
22579
|
-
recalculate
|
|
22580
|
-
};
|
|
22581
|
-
const formPrivateMethods = {
|
|
22582
|
-
callSlot,
|
|
22583
|
-
triggerItemEvent,
|
|
22584
|
-
toggleCollapseEvent,
|
|
22585
|
-
triggerTitleTipEvent,
|
|
22586
|
-
handleTitleTipLeaveEvent
|
|
22587
|
-
};
|
|
22588
|
-
Object.assign($xeForm, formMethods, formPrivateMethods);
|
|
22589
|
-
const renderVN = () => {
|
|
22250
|
+
} = params;
|
|
22251
|
+
const {
|
|
22252
|
+
options
|
|
22253
|
+
} = renderOpts;
|
|
22254
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22255
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22256
|
+
...getComponentFormItemProps(renderOpts, params, itemValue, {
|
|
22257
|
+
icons: options
|
|
22258
|
+
}),
|
|
22259
|
+
...getItemOns(renderOpts, params)
|
|
22260
|
+
})];
|
|
22261
|
+
}
|
|
22262
|
+
},
|
|
22263
|
+
VxeRadio: {
|
|
22264
|
+
renderFormItemContent: defaultFormItemRender
|
|
22265
|
+
},
|
|
22266
|
+
VxeRadioGroup: {
|
|
22267
|
+
renderFormItemContent: formItemRadioAndCheckboxRender
|
|
22268
|
+
},
|
|
22269
|
+
VxeCheckbox: {
|
|
22270
|
+
renderFormItemContent: defaultFormItemRender
|
|
22271
|
+
},
|
|
22272
|
+
VxeCheckboxGroup: {
|
|
22273
|
+
renderFormItemContent: formItemRadioAndCheckboxRender
|
|
22274
|
+
},
|
|
22275
|
+
VxeSwitch: {
|
|
22276
|
+
renderFormItemContent: defaultItemRender
|
|
22277
|
+
},
|
|
22278
|
+
VxeRate: {
|
|
22279
|
+
renderFormItemContent: defaultItemRender
|
|
22280
|
+
},
|
|
22281
|
+
VxeSlider: {
|
|
22282
|
+
renderFormItemContent: defaultItemRender
|
|
22283
|
+
},
|
|
22284
|
+
VxeImage: {
|
|
22285
|
+
renderFormItemContent(renderOpts, params) {
|
|
22590
22286
|
const {
|
|
22591
|
-
loading,
|
|
22592
|
-
border,
|
|
22593
|
-
className,
|
|
22594
22287
|
data,
|
|
22595
|
-
|
|
22596
|
-
} =
|
|
22288
|
+
field
|
|
22289
|
+
} = params;
|
|
22597
22290
|
const {
|
|
22598
|
-
|
|
22599
|
-
} =
|
|
22600
|
-
const
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22605
|
-
|
|
22606
|
-
items: formItems,
|
|
22607
|
-
data,
|
|
22608
|
-
$form: $xeForm
|
|
22609
|
-
}) : className : '', {
|
|
22610
|
-
[`size--${vSize}`]: vSize,
|
|
22611
|
-
'is--border': border,
|
|
22612
|
-
'custom--layout': customLayout,
|
|
22613
|
-
'is--loading': loading
|
|
22614
|
-
}],
|
|
22615
|
-
onSubmit: submitEvent,
|
|
22616
|
-
onReset: resetEvent
|
|
22617
|
-
}, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
22618
|
-
class: 'vxe-form--wrapper vxe-form--item-row'
|
|
22619
|
-
}, customLayout ? defaultSlot ? defaultSlot({}) : [] : formItems.map((item, index) => {
|
|
22620
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(form_config_item, {
|
|
22621
|
-
key: index,
|
|
22622
|
-
itemConfig: item
|
|
22623
|
-
});
|
|
22624
|
-
})), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
22625
|
-
class: 'vxe-form-slots',
|
|
22626
|
-
ref: 'hideItem'
|
|
22627
|
-
}, customLayout ? [] : defaultSlot ? defaultSlot({}) : []),
|
|
22628
|
-
/**
|
|
22629
|
-
* 加载中
|
|
22630
|
-
*/
|
|
22631
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(src_loading, {
|
|
22632
|
-
class: 'vxe-form--loading',
|
|
22633
|
-
modelValue: loading
|
|
22634
|
-
}),
|
|
22635
|
-
/**
|
|
22636
|
-
* 工具提示
|
|
22637
|
-
*/
|
|
22638
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(tooltip, {
|
|
22639
|
-
ref: refTooltip,
|
|
22640
|
-
...tooltipOpts
|
|
22641
|
-
})]);
|
|
22642
|
-
};
|
|
22643
|
-
const staticItemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
|
|
22644
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems.length, () => {
|
|
22645
|
-
staticItemFlag.value++;
|
|
22646
|
-
});
|
|
22647
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems, () => {
|
|
22648
|
-
staticItemFlag.value++;
|
|
22649
|
-
});
|
|
22650
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(staticItemFlag, () => {
|
|
22651
|
-
reactData.formItems = reactData.staticItems;
|
|
22652
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
|
|
22653
|
-
recalculate();
|
|
22654
|
-
});
|
|
22655
|
-
});
|
|
22656
|
-
const itemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
|
|
22657
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items ? props.items.length : -1, () => {
|
|
22658
|
-
itemFlag.value++;
|
|
22659
|
-
});
|
|
22660
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items, () => {
|
|
22661
|
-
itemFlag.value++;
|
|
22662
|
-
});
|
|
22663
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(itemFlag, () => {
|
|
22664
|
-
loadItem(props.items || []);
|
|
22665
|
-
});
|
|
22666
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.collapseStatus, value => {
|
|
22667
|
-
reactData.collapseAll = !!value;
|
|
22668
|
-
});
|
|
22669
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.readonly, () => {
|
|
22670
|
-
clearValidate();
|
|
22671
|
-
});
|
|
22672
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.disabled, () => {
|
|
22673
|
-
clearValidate();
|
|
22674
|
-
});
|
|
22675
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
|
|
22676
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
22677
|
-
if (props.customLayout && props.items) {
|
|
22678
|
-
errLog('vxe.error.errConflicts', ['custom-layout', 'items']);
|
|
22679
|
-
}
|
|
22680
|
-
});
|
|
22681
|
-
globalEvents.on($xeForm, 'resize', handleGlobalResizeEvent);
|
|
22682
|
-
});
|
|
22683
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.onUnmounted)(() => {
|
|
22684
|
-
globalEvents.off($xeForm, 'resize');
|
|
22685
|
-
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
|
|
22686
|
-
});
|
|
22687
|
-
if (props.items) {
|
|
22688
|
-
loadItem(props.items);
|
|
22291
|
+
props
|
|
22292
|
+
} = renderOpts;
|
|
22293
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22294
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22295
|
+
...props,
|
|
22296
|
+
src: itemValue,
|
|
22297
|
+
...getItemOns(renderOpts, params)
|
|
22298
|
+
})];
|
|
22689
22299
|
}
|
|
22690
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('xeFormItemInfo', null);
|
|
22691
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeForm', $xeForm);
|
|
22692
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormGroup', null);
|
|
22693
|
-
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormItem', null);
|
|
22694
|
-
$xeForm.renderVN = renderVN;
|
|
22695
|
-
return $xeForm;
|
|
22696
22300
|
},
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22706
|
-
|
|
22707
|
-
|
|
22708
|
-
|
|
22709
|
-
|
|
22710
|
-
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22717
|
-
|
|
22718
|
-
|
|
22719
|
-
|
|
22720
|
-
|
|
22721
|
-
|
|
22722
|
-
|
|
22723
|
-
|
|
22724
|
-
|
|
22725
|
-
|
|
22726
|
-
|
|
22727
|
-
|
|
22728
|
-
}
|
|
22729
|
-
|
|
22730
|
-
|
|
22731
|
-
|
|
22732
|
-
|
|
22733
|
-
|
|
22734
|
-
|
|
22735
|
-
|
|
22736
|
-
|
|
22737
|
-
|
|
22738
|
-
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22744
|
-
|
|
22745
|
-
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
}
|
|
22757
|
-
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
|
|
22761
|
-
|
|
22762
|
-
|
|
22763
|
-
|
|
22764
|
-
|
|
22765
|
-
};
|
|
22766
|
-
});
|
|
22767
|
-
}
|
|
22768
|
-
if (modelFunc) {
|
|
22769
|
-
ons[getOnName(modelEvent)] = function (targetEvnt) {
|
|
22770
|
-
modelFunc(targetEvnt);
|
|
22771
|
-
if (isSameEvent && changeFunc) {
|
|
22772
|
-
changeFunc(targetEvnt);
|
|
22773
|
-
}
|
|
22774
|
-
if (events && events[modelEvent]) {
|
|
22775
|
-
events[modelEvent](params, targetEvnt);
|
|
22776
|
-
}
|
|
22777
|
-
};
|
|
22301
|
+
VxeImageGroup: {
|
|
22302
|
+
renderFormItemContent(renderOpts, params) {
|
|
22303
|
+
const {
|
|
22304
|
+
data,
|
|
22305
|
+
field
|
|
22306
|
+
} = params;
|
|
22307
|
+
const {
|
|
22308
|
+
props
|
|
22309
|
+
} = renderOpts;
|
|
22310
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22311
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22312
|
+
...props,
|
|
22313
|
+
urlList: itemValue,
|
|
22314
|
+
...getItemOns(renderOpts, params)
|
|
22315
|
+
})];
|
|
22316
|
+
}
|
|
22317
|
+
},
|
|
22318
|
+
VxeUpload: {
|
|
22319
|
+
renderFormItemContent: defaultItemRender
|
|
22320
|
+
},
|
|
22321
|
+
// 以下已废弃
|
|
22322
|
+
$input: {
|
|
22323
|
+
formItemAutoFocus: 'input',
|
|
22324
|
+
renderFormItemContent: oldItemRender
|
|
22325
|
+
},
|
|
22326
|
+
$textarea: {
|
|
22327
|
+
formItemAutoFocus: 'textarea',
|
|
22328
|
+
renderFormItemContent: oldItemRender
|
|
22329
|
+
},
|
|
22330
|
+
$button: {
|
|
22331
|
+
renderFormItemContent: oldButtonItemRender
|
|
22332
|
+
},
|
|
22333
|
+
$buttons: {
|
|
22334
|
+
renderFormItemContent: oldButtonsItemRender
|
|
22335
|
+
},
|
|
22336
|
+
$select: {
|
|
22337
|
+
formItemAutoFocus: 'input',
|
|
22338
|
+
renderFormItemContent(renderOpts, params) {
|
|
22339
|
+
const {
|
|
22340
|
+
data,
|
|
22341
|
+
field
|
|
22342
|
+
} = params;
|
|
22343
|
+
const {
|
|
22344
|
+
options,
|
|
22345
|
+
optionProps,
|
|
22346
|
+
optionGroups,
|
|
22347
|
+
optionGroupProps
|
|
22348
|
+
} = renderOpts;
|
|
22349
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22350
|
+
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getOldComponent(renderOpts), {
|
|
22351
|
+
...getComponentFormItemProps(renderOpts, params, itemValue, {
|
|
22352
|
+
options,
|
|
22353
|
+
optionProps,
|
|
22354
|
+
optionGroups,
|
|
22355
|
+
optionGroupProps
|
|
22356
|
+
}),
|
|
22357
|
+
...getItemOns(renderOpts, params)
|
|
22358
|
+
})];
|
|
22359
|
+
}
|
|
22360
|
+
},
|
|
22361
|
+
$radio: {
|
|
22362
|
+
renderFormItemContent: oldFormItemRadioAndCheckboxRender
|
|
22363
|
+
},
|
|
22364
|
+
$checkbox: {
|
|
22365
|
+
renderFormItemContent: oldFormItemRadioAndCheckboxRender
|
|
22366
|
+
},
|
|
22367
|
+
$switch: {
|
|
22368
|
+
renderFormItemContent: oldItemRender
|
|
22778
22369
|
}
|
|
22779
|
-
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
22785
|
-
|
|
22370
|
+
// 以上已废弃
|
|
22371
|
+
});
|
|
22372
|
+
;// CONCATENATED MODULE: ./packages/form/src/form.ts
|
|
22373
|
+
|
|
22374
|
+
|
|
22375
|
+
|
|
22376
|
+
|
|
22377
|
+
|
|
22378
|
+
|
|
22379
|
+
|
|
22380
|
+
|
|
22381
|
+
|
|
22382
|
+
|
|
22383
|
+
|
|
22384
|
+
|
|
22385
|
+
|
|
22386
|
+
|
|
22387
|
+
class Rule {
|
|
22388
|
+
constructor(rule) {
|
|
22389
|
+
Object.assign(this, {
|
|
22390
|
+
$options: rule,
|
|
22391
|
+
required: rule.required,
|
|
22392
|
+
min: rule.min,
|
|
22393
|
+
max: rule.min,
|
|
22394
|
+
type: rule.type,
|
|
22395
|
+
pattern: rule.pattern,
|
|
22396
|
+
validator: rule.validator,
|
|
22397
|
+
trigger: rule.trigger,
|
|
22398
|
+
maxWidth: rule.maxWidth
|
|
22399
|
+
});
|
|
22786
22400
|
}
|
|
22787
|
-
|
|
22788
|
-
|
|
22789
|
-
/**
|
|
22790
|
-
* 组件事件处理
|
|
22791
|
-
* @param renderOpts
|
|
22792
|
-
* @param params
|
|
22793
|
-
* @param modelFunc
|
|
22794
|
-
* @param changeFunc
|
|
22795
|
-
*/
|
|
22796
|
-
function getComponentOns(renderOpts, params, eFns, eventOns) {
|
|
22797
|
-
const {
|
|
22798
|
-
events
|
|
22799
|
-
} = renderOpts;
|
|
22800
|
-
const {
|
|
22801
|
-
model: modelFunc,
|
|
22802
|
-
change: changeFunc
|
|
22803
|
-
} = eFns || {};
|
|
22804
|
-
const modelEvent = getModelEvent(renderOpts.name);
|
|
22805
|
-
const changeEvent = getChangeEvent(renderOpts.name);
|
|
22806
|
-
const ons = {};
|
|
22807
|
-
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().objectEach(events, (func, key) => {
|
|
22808
|
-
ons[getOnName(key)] = function (...args) {
|
|
22809
|
-
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
|
|
22810
|
-
errLog('vxe.error.errFunc', [func]);
|
|
22811
|
-
}
|
|
22812
|
-
func(params, ...args);
|
|
22813
|
-
};
|
|
22814
|
-
});
|
|
22815
|
-
if (modelFunc) {
|
|
22816
|
-
ons[getOnName(modelEvent)] = function (targetEvnt) {
|
|
22817
|
-
modelFunc(targetEvnt);
|
|
22818
|
-
if (events && events[modelEvent]) {
|
|
22819
|
-
events[modelEvent](params, targetEvnt);
|
|
22820
|
-
}
|
|
22821
|
-
};
|
|
22401
|
+
get content() {
|
|
22402
|
+
return getFuncText(this.$options.content || this.$options.message);
|
|
22822
22403
|
}
|
|
22823
|
-
|
|
22824
|
-
|
|
22825
|
-
changeFunc(...args);
|
|
22826
|
-
if (events && events[changeEvent]) {
|
|
22827
|
-
events[changeEvent](params, ...args);
|
|
22828
|
-
}
|
|
22829
|
-
};
|
|
22404
|
+
get message() {
|
|
22405
|
+
return this.content;
|
|
22830
22406
|
}
|
|
22831
|
-
return eventOns ? Object.assign(ons, eventOns) : ons;
|
|
22832
|
-
}
|
|
22833
|
-
function getItemOns(renderOpts, params) {
|
|
22834
|
-
const {
|
|
22835
|
-
$form,
|
|
22836
|
-
data,
|
|
22837
|
-
field
|
|
22838
|
-
} = params;
|
|
22839
|
-
return getComponentOns(renderOpts, params, {
|
|
22840
|
-
model(value) {
|
|
22841
|
-
// 处理 model 值双向绑定
|
|
22842
|
-
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, value);
|
|
22843
|
-
},
|
|
22844
|
-
change(params) {
|
|
22845
|
-
// 处理 change 事件相关逻辑
|
|
22846
|
-
$form.updateStatus(params);
|
|
22847
|
-
}
|
|
22848
|
-
});
|
|
22849
|
-
}
|
|
22850
|
-
function getNativeItemOns(renderOpts, params) {
|
|
22851
|
-
const {
|
|
22852
|
-
$form,
|
|
22853
|
-
data,
|
|
22854
|
-
field
|
|
22855
|
-
} = params;
|
|
22856
|
-
return getNativeElementOns(renderOpts, params, evnt => {
|
|
22857
|
-
// 处理 model 值双向绑定
|
|
22858
|
-
const itemValue = evnt.target.value;
|
|
22859
|
-
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, itemValue);
|
|
22860
|
-
}, () => {
|
|
22861
|
-
// 处理 change 事件相关逻辑
|
|
22862
|
-
$form.updateStatus(params);
|
|
22863
|
-
});
|
|
22864
22407
|
}
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
|
|
22868
|
-
|
|
22869
|
-
} = renderOpts;
|
|
22870
|
-
const groupOptions = optionGroupProps.options || 'options';
|
|
22871
|
-
const groupLabel = optionGroupProps.label || 'label';
|
|
22872
|
-
if (optionGroups) {
|
|
22873
|
-
return optionGroups.map((group, gIndex) => {
|
|
22874
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('optgroup', {
|
|
22875
|
-
key: gIndex,
|
|
22876
|
-
label: group[groupLabel]
|
|
22877
|
-
}, renderOptionsMethods(group[groupOptions], renderOpts, params));
|
|
22878
|
-
});
|
|
22408
|
+
// 如果存在 pattern,判断正则
|
|
22409
|
+
function validREValue(pattern, val) {
|
|
22410
|
+
if (pattern && !(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isRegExp(pattern) ? pattern : new RegExp(pattern)).test(val)) {
|
|
22411
|
+
return false;
|
|
22879
22412
|
}
|
|
22880
|
-
return
|
|
22881
|
-
}
|
|
22882
|
-
/**
|
|
22883
|
-
* 渲染表单-项
|
|
22884
|
-
* 用于渲染原生的标签
|
|
22885
|
-
*/
|
|
22886
|
-
function nativeItemRender(renderOpts, params) {
|
|
22887
|
-
const {
|
|
22888
|
-
data,
|
|
22889
|
-
field
|
|
22890
|
-
} = params;
|
|
22891
|
-
const {
|
|
22892
|
-
name
|
|
22893
|
-
} = renderOpts;
|
|
22894
|
-
const attrs = getNativeAttrs(renderOpts);
|
|
22895
|
-
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22896
|
-
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(name, {
|
|
22897
|
-
class: `vxe-default-${name}`,
|
|
22898
|
-
...attrs,
|
|
22899
|
-
value: attrs && name === 'input' && (attrs.type === 'submit' || attrs.type === 'reset') ? null : itemValue,
|
|
22900
|
-
...getNativeItemOns(renderOpts, params)
|
|
22901
|
-
})];
|
|
22902
|
-
}
|
|
22903
|
-
function defaultItemRender(renderOpts, params) {
|
|
22904
|
-
const {
|
|
22905
|
-
data,
|
|
22906
|
-
field
|
|
22907
|
-
} = params;
|
|
22908
|
-
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22909
|
-
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22910
|
-
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
22911
|
-
...getItemOns(renderOpts, params)
|
|
22912
|
-
})];
|
|
22913
|
-
}
|
|
22914
|
-
/**
|
|
22915
|
-
* 已废弃
|
|
22916
|
-
* @deprecated
|
|
22917
|
-
*/
|
|
22918
|
-
function oldItemRender(renderOpts, params) {
|
|
22919
|
-
const {
|
|
22920
|
-
data,
|
|
22921
|
-
field
|
|
22922
|
-
} = params;
|
|
22923
|
-
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22924
|
-
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getOldComponent(renderOpts), {
|
|
22925
|
-
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
22926
|
-
...getItemOns(renderOpts, params)
|
|
22927
|
-
})];
|
|
22928
|
-
}
|
|
22929
|
-
/**
|
|
22930
|
-
* 已废弃
|
|
22931
|
-
* @deprecated
|
|
22932
|
-
*/
|
|
22933
|
-
function oldButtonItemRender(renderOpts, params) {
|
|
22934
|
-
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)('vxe-button'), {
|
|
22935
|
-
...getComponentFormItemProps(renderOpts, params, null),
|
|
22936
|
-
...getComponentOns(renderOpts, params)
|
|
22937
|
-
})];
|
|
22938
|
-
}
|
|
22939
|
-
/**
|
|
22940
|
-
* 已废弃
|
|
22941
|
-
* @deprecated
|
|
22942
|
-
*/
|
|
22943
|
-
function oldButtonsItemRender(renderOpts, params) {
|
|
22944
|
-
return renderOpts.children.map(childRenderOpts => oldButtonItemRender(childRenderOpts, params)[0]);
|
|
22413
|
+
return true;
|
|
22945
22414
|
}
|
|
22946
|
-
|
|
22947
|
-
|
|
22948
|
-
|
|
22949
|
-
|
|
22950
|
-
const {
|
|
22951
|
-
data,
|
|
22952
|
-
field
|
|
22953
|
-
} = params;
|
|
22954
|
-
const {
|
|
22955
|
-
optionProps = {}
|
|
22956
|
-
} = renderOpts;
|
|
22957
|
-
const labelProp = optionProps.label || 'label';
|
|
22958
|
-
const valueProp = optionProps.value || 'value';
|
|
22959
|
-
const disabledProp = optionProps.disabled || 'disabled';
|
|
22960
|
-
const cellValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22961
|
-
if (options) {
|
|
22962
|
-
return options.map((item, oIndex) => {
|
|
22963
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('option', {
|
|
22964
|
-
key: oIndex,
|
|
22965
|
-
value: item[valueProp],
|
|
22966
|
-
disabled: item[disabledProp],
|
|
22967
|
-
/* eslint-disable eqeqeq */
|
|
22968
|
-
selected: item[valueProp] == cellValue
|
|
22969
|
-
}, item[labelProp]);
|
|
22970
|
-
});
|
|
22415
|
+
// 如果存在 max,判断最大值
|
|
22416
|
+
function validMaxValue(max, num) {
|
|
22417
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(max) && num > external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(max)) {
|
|
22418
|
+
return false;
|
|
22971
22419
|
}
|
|
22972
|
-
return
|
|
22420
|
+
return true;
|
|
22973
22421
|
}
|
|
22974
|
-
|
|
22975
|
-
|
|
22976
|
-
|
|
22977
|
-
|
|
22978
|
-
|
|
22979
|
-
|
|
22980
|
-
field
|
|
22981
|
-
} = params;
|
|
22982
|
-
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22983
|
-
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
22984
|
-
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
22985
|
-
...getItemOns(renderOpts, params)
|
|
22986
|
-
})];
|
|
22422
|
+
// 如果存在 min,判断最小值
|
|
22423
|
+
function validMinValue(min, num) {
|
|
22424
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(min) && num < external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(min)) {
|
|
22425
|
+
return false;
|
|
22426
|
+
}
|
|
22427
|
+
return true;
|
|
22987
22428
|
}
|
|
22988
|
-
function
|
|
22989
|
-
const {
|
|
22990
|
-
options,
|
|
22991
|
-
optionProps
|
|
22992
|
-
} = renderOpts;
|
|
22429
|
+
function validRuleValue(rule, val, required) {
|
|
22993
22430
|
const {
|
|
22994
|
-
|
|
22995
|
-
|
|
22996
|
-
|
|
22997
|
-
|
|
22998
|
-
|
|
22999
|
-
|
|
23000
|
-
|
|
23001
|
-
|
|
23002
|
-
|
|
23003
|
-
|
|
22431
|
+
type,
|
|
22432
|
+
min,
|
|
22433
|
+
max,
|
|
22434
|
+
pattern
|
|
22435
|
+
} = rule;
|
|
22436
|
+
const isArrType = type === 'array';
|
|
22437
|
+
const isNumType = type === 'number';
|
|
22438
|
+
const isStrType = type === 'string';
|
|
22439
|
+
const strVal = `${val}`;
|
|
22440
|
+
if (!validREValue(pattern, strVal)) {
|
|
22441
|
+
return false;
|
|
22442
|
+
}
|
|
22443
|
+
if (isArrType) {
|
|
22444
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val)) {
|
|
22445
|
+
return false;
|
|
22446
|
+
}
|
|
22447
|
+
if (required) {
|
|
22448
|
+
if (!val.length) {
|
|
22449
|
+
return false;
|
|
22450
|
+
}
|
|
22451
|
+
}
|
|
22452
|
+
if (!validMinValue(min, val.length)) {
|
|
22453
|
+
return false;
|
|
22454
|
+
}
|
|
22455
|
+
if (!validMaxValue(max, val.length)) {
|
|
22456
|
+
return false;
|
|
22457
|
+
}
|
|
22458
|
+
} else if (isNumType) {
|
|
22459
|
+
const numVal = Number(val);
|
|
22460
|
+
if (isNaN(numVal)) {
|
|
22461
|
+
return false;
|
|
22462
|
+
}
|
|
22463
|
+
if (!validMinValue(min, numVal)) {
|
|
22464
|
+
return false;
|
|
22465
|
+
}
|
|
22466
|
+
if (!validMaxValue(max, numVal)) {
|
|
22467
|
+
return false;
|
|
22468
|
+
}
|
|
22469
|
+
} else {
|
|
22470
|
+
if (isStrType) {
|
|
22471
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(val)) {
|
|
22472
|
+
return false;
|
|
22473
|
+
}
|
|
22474
|
+
}
|
|
22475
|
+
if (required) {
|
|
22476
|
+
if (!strVal) {
|
|
22477
|
+
return false;
|
|
22478
|
+
}
|
|
22479
|
+
}
|
|
22480
|
+
if (!validMinValue(min, strVal.length)) {
|
|
22481
|
+
return false;
|
|
22482
|
+
}
|
|
22483
|
+
if (!validMaxValue(max, strVal.length)) {
|
|
22484
|
+
return false;
|
|
22485
|
+
}
|
|
22486
|
+
}
|
|
22487
|
+
return true;
|
|
23004
22488
|
}
|
|
23005
|
-
|
|
23006
|
-
* 已废弃
|
|
23007
|
-
* @deprecated
|
|
23008
|
-
*/
|
|
23009
|
-
function oldFormItemRadioAndCheckboxRender(renderOpts, params) {
|
|
23010
|
-
const {
|
|
23011
|
-
name,
|
|
23012
|
-
options,
|
|
23013
|
-
optionProps = {}
|
|
23014
|
-
} = renderOpts;
|
|
22489
|
+
function checkRuleStatus(rule, val) {
|
|
23015
22490
|
const {
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
|
|
23023
|
-
|
|
23024
|
-
|
|
23025
|
-
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
default: () => {
|
|
23031
|
-
return options.map((item, index) => {
|
|
23032
|
-
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)(compName), {
|
|
23033
|
-
key: index,
|
|
23034
|
-
label: item[valueProp],
|
|
23035
|
-
content: item[labelProp],
|
|
23036
|
-
disabled: item[disabledProp]
|
|
23037
|
-
});
|
|
23038
|
-
});
|
|
22491
|
+
required
|
|
22492
|
+
} = rule;
|
|
22493
|
+
const isEmptyVal = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(val) ? !val.length : eqEmptyValue(val);
|
|
22494
|
+
if (required) {
|
|
22495
|
+
if (isEmptyVal) {
|
|
22496
|
+
return false;
|
|
22497
|
+
}
|
|
22498
|
+
if (!validRuleValue(rule, val, required)) {
|
|
22499
|
+
return false;
|
|
22500
|
+
}
|
|
22501
|
+
} else {
|
|
22502
|
+
if (!isEmptyVal) {
|
|
22503
|
+
if (!validRuleValue(rule, val, required)) {
|
|
22504
|
+
return false;
|
|
23039
22505
|
}
|
|
23040
|
-
}
|
|
22506
|
+
}
|
|
23041
22507
|
}
|
|
23042
|
-
return
|
|
23043
|
-
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
23044
|
-
...getItemOns(renderOpts, params)
|
|
23045
|
-
})];
|
|
22508
|
+
return true;
|
|
23046
22509
|
}
|
|
23047
|
-
|
|
23048
|
-
|
|
23049
|
-
|
|
23050
|
-
|
|
23051
|
-
|
|
23052
|
-
|
|
23053
|
-
|
|
23054
|
-
|
|
23055
|
-
|
|
23056
|
-
|
|
23057
|
-
|
|
23058
|
-
|
|
23059
|
-
|
|
23060
|
-
|
|
23061
|
-
|
|
23062
|
-
|
|
23063
|
-
|
|
23064
|
-
|
|
23065
|
-
|
|
23066
|
-
|
|
23067
|
-
|
|
23068
|
-
|
|
23069
|
-
|
|
23070
|
-
|
|
23071
|
-
|
|
23072
|
-
|
|
23073
|
-
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23077
|
-
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
|
|
23081
|
-
|
|
23082
|
-
|
|
23083
|
-
|
|
23084
|
-
|
|
23085
|
-
|
|
23086
|
-
|
|
23087
|
-
|
|
22510
|
+
function createInternalData() {
|
|
22511
|
+
return {
|
|
22512
|
+
meTimeout: undefined,
|
|
22513
|
+
stTimeout: undefined,
|
|
22514
|
+
tooltipStore: {
|
|
22515
|
+
item: null,
|
|
22516
|
+
visible: false
|
|
22517
|
+
},
|
|
22518
|
+
itemFormatCache: {}
|
|
22519
|
+
};
|
|
22520
|
+
}
|
|
22521
|
+
/* harmony default export */ var src_form = (defineVxeComponent({
|
|
22522
|
+
name: 'VxeForm',
|
|
22523
|
+
props: {
|
|
22524
|
+
collapseStatus: {
|
|
22525
|
+
type: Boolean,
|
|
22526
|
+
default: true
|
|
22527
|
+
},
|
|
22528
|
+
loading: Boolean,
|
|
22529
|
+
data: Object,
|
|
22530
|
+
size: {
|
|
22531
|
+
type: String,
|
|
22532
|
+
default: () => getConfig().form.size || getConfig().size
|
|
22533
|
+
},
|
|
22534
|
+
span: {
|
|
22535
|
+
type: [String, Number],
|
|
22536
|
+
default: () => getConfig().form.span
|
|
22537
|
+
},
|
|
22538
|
+
align: {
|
|
22539
|
+
type: String,
|
|
22540
|
+
default: () => getConfig().form.align
|
|
22541
|
+
},
|
|
22542
|
+
verticalAlign: {
|
|
22543
|
+
type: String,
|
|
22544
|
+
default: () => getConfig().form.verticalAlign
|
|
22545
|
+
},
|
|
22546
|
+
border: {
|
|
22547
|
+
type: Boolean,
|
|
22548
|
+
default: () => getConfig().form.border
|
|
22549
|
+
},
|
|
22550
|
+
titleBackground: {
|
|
22551
|
+
type: Boolean,
|
|
22552
|
+
default: () => getConfig().form.titleBackground
|
|
22553
|
+
},
|
|
22554
|
+
titleBold: {
|
|
22555
|
+
type: Boolean,
|
|
22556
|
+
default: () => getConfig().form.titleBold
|
|
22557
|
+
},
|
|
22558
|
+
titleAlign: {
|
|
22559
|
+
type: String,
|
|
22560
|
+
default: () => getConfig().form.titleAlign
|
|
22561
|
+
},
|
|
22562
|
+
titleWidth: {
|
|
22563
|
+
type: [String, Number],
|
|
22564
|
+
default: () => getConfig().form.titleWidth
|
|
22565
|
+
},
|
|
22566
|
+
titleColon: {
|
|
22567
|
+
type: Boolean,
|
|
22568
|
+
default: () => getConfig().form.titleColon
|
|
22569
|
+
},
|
|
22570
|
+
titleAsterisk: {
|
|
22571
|
+
type: Boolean,
|
|
22572
|
+
default: () => getConfig().form.titleAsterisk
|
|
22573
|
+
},
|
|
22574
|
+
titleOverflow: {
|
|
22575
|
+
type: [Boolean, String],
|
|
22576
|
+
default: () => getConfig().form.titleOverflow
|
|
22577
|
+
},
|
|
22578
|
+
vertical: {
|
|
22579
|
+
type: Boolean,
|
|
22580
|
+
default: () => getConfig().form.vertical
|
|
22581
|
+
},
|
|
22582
|
+
padding: {
|
|
22583
|
+
type: Boolean,
|
|
22584
|
+
default: () => getConfig().form.padding
|
|
22585
|
+
},
|
|
22586
|
+
className: [String, Function],
|
|
22587
|
+
readonly: Boolean,
|
|
22588
|
+
disabled: Boolean,
|
|
22589
|
+
items: Array,
|
|
22590
|
+
rules: Object,
|
|
22591
|
+
preventSubmit: {
|
|
22592
|
+
type: Boolean,
|
|
22593
|
+
default: () => getConfig().form.preventSubmit
|
|
22594
|
+
},
|
|
22595
|
+
validConfig: Object,
|
|
22596
|
+
tooltipConfig: Object,
|
|
22597
|
+
collapseConfig: Object,
|
|
22598
|
+
customLayout: {
|
|
22599
|
+
type: Boolean,
|
|
22600
|
+
default: () => getConfig().form.customLayout
|
|
22601
|
+
},
|
|
22602
|
+
params: Object
|
|
23088
22603
|
},
|
|
23089
|
-
|
|
23090
|
-
|
|
23091
|
-
|
|
22604
|
+
emits: ['update:collapseStatus', 'collapse', 'toggle-collapse', 'submit', 'submit-invalid', 'reset'],
|
|
22605
|
+
setup(props, context) {
|
|
22606
|
+
const {
|
|
22607
|
+
slots,
|
|
22608
|
+
emit
|
|
22609
|
+
} = context;
|
|
22610
|
+
const $xeGrid = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeGrid', null);
|
|
22611
|
+
const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
|
|
22612
|
+
const {
|
|
22613
|
+
computeSize
|
|
22614
|
+
} = useSize(props);
|
|
22615
|
+
const reactData = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)({
|
|
22616
|
+
collapseAll: props.collapseStatus,
|
|
22617
|
+
staticItems: [],
|
|
22618
|
+
formItems: [],
|
|
22619
|
+
itemWidth: 0
|
|
22620
|
+
});
|
|
22621
|
+
const internalData = createInternalData();
|
|
22622
|
+
const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
|
|
22623
|
+
const refTooltip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
|
|
22624
|
+
let formMethods = {};
|
|
22625
|
+
const computeValidOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
22626
|
+
return Object.assign({}, getConfig().form.validConfig, props.validConfig);
|
|
22627
|
+
});
|
|
22628
|
+
const computeTooltipOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
22629
|
+
return Object.assign({}, getConfig().tooltip, getConfig().form.tooltipConfig, props.tooltipConfig);
|
|
22630
|
+
});
|
|
22631
|
+
const computeCollapseOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
22632
|
+
return Object.assign({}, getConfig().form.collapseConfig, props.collapseConfig);
|
|
22633
|
+
});
|
|
22634
|
+
const computeAutoItemWidthList = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
23092
22635
|
const {
|
|
23093
|
-
|
|
23094
|
-
|
|
23095
|
-
} =
|
|
22636
|
+
titleWidth: allTitleWidth,
|
|
22637
|
+
vertical: allVertical
|
|
22638
|
+
} = props;
|
|
23096
22639
|
const {
|
|
23097
|
-
|
|
23098
|
-
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
|
|
23103
|
-
|
|
23104
|
-
|
|
23105
|
-
|
|
23106
|
-
|
|
23107
|
-
|
|
23108
|
-
|
|
23109
|
-
|
|
22640
|
+
formItems
|
|
22641
|
+
} = reactData;
|
|
22642
|
+
const itemList = [];
|
|
22643
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(formItems, item => {
|
|
22644
|
+
const {
|
|
22645
|
+
titleWidth,
|
|
22646
|
+
vertical
|
|
22647
|
+
} = item;
|
|
22648
|
+
if (titleWidth === 'auto') {
|
|
22649
|
+
itemList.push(item);
|
|
22650
|
+
} else {
|
|
22651
|
+
const itemVertical = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(vertical) ? allVertical : vertical;
|
|
22652
|
+
const itemTitleWidth = itemVertical ? null : external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(titleWidth) ? allTitleWidth : titleWidth;
|
|
22653
|
+
if (itemTitleWidth === 'auto' && (!item.children || !item.children.length)) {
|
|
22654
|
+
itemList.push(item);
|
|
23110
22655
|
}
|
|
23111
|
-
}
|
|
23112
|
-
|
|
23113
|
-
|
|
23114
|
-
|
|
22656
|
+
}
|
|
22657
|
+
}, {
|
|
22658
|
+
children: 'children'
|
|
22659
|
+
});
|
|
22660
|
+
return itemList;
|
|
22661
|
+
});
|
|
22662
|
+
const refMaps = {
|
|
22663
|
+
refElem
|
|
22664
|
+
};
|
|
22665
|
+
const computeMaps = {
|
|
22666
|
+
computeSize,
|
|
22667
|
+
computeValidOpts,
|
|
22668
|
+
computeTooltipOpts,
|
|
22669
|
+
computeCollapseOpts,
|
|
22670
|
+
computeAutoItemWidthList
|
|
22671
|
+
};
|
|
22672
|
+
const $xeForm = {
|
|
22673
|
+
xID,
|
|
22674
|
+
props,
|
|
22675
|
+
context,
|
|
22676
|
+
reactData,
|
|
22677
|
+
internalData,
|
|
22678
|
+
xeGrid: $xeGrid,
|
|
22679
|
+
getRefMaps: () => refMaps,
|
|
22680
|
+
getComputeMaps: () => computeMaps
|
|
22681
|
+
};
|
|
22682
|
+
const callSlot = (slotFunc, params) => {
|
|
22683
|
+
if (slotFunc) {
|
|
22684
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(slotFunc)) {
|
|
22685
|
+
slotFunc = slots[slotFunc] || null;
|
|
22686
|
+
}
|
|
22687
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(slotFunc)) {
|
|
22688
|
+
return vn_getSlotVNs(slotFunc(params));
|
|
22689
|
+
}
|
|
22690
|
+
}
|
|
22691
|
+
return [];
|
|
22692
|
+
};
|
|
22693
|
+
const loadItem = list => {
|
|
22694
|
+
if (list.length) {
|
|
22695
|
+
list.forEach(item => {
|
|
22696
|
+
if (item.slots) {
|
|
22697
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(item.slots, func => {
|
|
22698
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(func)) {
|
|
22699
|
+
if (!slots[func]) {
|
|
22700
|
+
errLog('vxe.error.notSlot', [func]);
|
|
22701
|
+
}
|
|
22702
|
+
}
|
|
22703
|
+
});
|
|
22704
|
+
}
|
|
22705
|
+
});
|
|
22706
|
+
}
|
|
22707
|
+
reactData.staticItems = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().mapTree(list, item => createItem($xeForm, item), {
|
|
22708
|
+
children: 'children'
|
|
22709
|
+
});
|
|
22710
|
+
internalData.itemFormatCache = {};
|
|
22711
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
|
|
22712
|
+
return recalculate();
|
|
22713
|
+
});
|
|
22714
|
+
};
|
|
22715
|
+
const getItems = () => {
|
|
22716
|
+
const itemList = [];
|
|
22717
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(reactData.formItems, item => {
|
|
22718
|
+
itemList.push(item);
|
|
22719
|
+
}, {
|
|
22720
|
+
children: 'children'
|
|
22721
|
+
});
|
|
22722
|
+
return itemList;
|
|
22723
|
+
};
|
|
22724
|
+
const getItemByField = field => {
|
|
22725
|
+
const rest = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().findTree(reactData.formItems, item => item.field === field, {
|
|
22726
|
+
children: 'children'
|
|
22727
|
+
});
|
|
22728
|
+
return rest ? rest.item : null;
|
|
22729
|
+
};
|
|
22730
|
+
const getCollapseStatus = () => {
|
|
22731
|
+
return reactData.collapseAll;
|
|
22732
|
+
};
|
|
22733
|
+
const toggleCollapse = () => {
|
|
22734
|
+
const status = !getCollapseStatus();
|
|
22735
|
+
reactData.collapseAll = status;
|
|
22736
|
+
emit('update:collapseStatus', status);
|
|
22737
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
22738
|
+
};
|
|
22739
|
+
const toggleCollapseEvent = evnt => {
|
|
22740
|
+
toggleCollapse();
|
|
22741
|
+
const status = getCollapseStatus();
|
|
22742
|
+
formMethods.dispatchEvent('toggle-collapse', {
|
|
22743
|
+
status,
|
|
22744
|
+
collapse: status,
|
|
22745
|
+
data: props.data
|
|
22746
|
+
}, evnt);
|
|
22747
|
+
formMethods.dispatchEvent('collapse', {
|
|
22748
|
+
status,
|
|
22749
|
+
collapse: status,
|
|
22750
|
+
data: props.data
|
|
22751
|
+
}, evnt);
|
|
22752
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
22753
|
+
recalculate();
|
|
22754
|
+
if ($xeGrid) {
|
|
22755
|
+
$xeGrid.recalculate();
|
|
22756
|
+
}
|
|
22757
|
+
});
|
|
22758
|
+
};
|
|
22759
|
+
const clearValidate = fieldOrItem => {
|
|
22760
|
+
if (fieldOrItem) {
|
|
22761
|
+
let fields = fieldOrItem;
|
|
22762
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrItem)) {
|
|
22763
|
+
fields = [fieldOrItem];
|
|
22764
|
+
}
|
|
22765
|
+
fields.forEach(field => {
|
|
22766
|
+
if (field) {
|
|
22767
|
+
const item = handleFieldOrItem($xeForm, field);
|
|
22768
|
+
if (item) {
|
|
22769
|
+
item.showError = false;
|
|
22770
|
+
}
|
|
22771
|
+
}
|
|
22772
|
+
});
|
|
22773
|
+
} else {
|
|
22774
|
+
getItems().forEach(item => {
|
|
22775
|
+
item.showError = false;
|
|
22776
|
+
});
|
|
22777
|
+
}
|
|
22778
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
22779
|
+
};
|
|
22780
|
+
const getResetValue = (item, data, itemValue) => {
|
|
22781
|
+
const {
|
|
22782
|
+
field,
|
|
22783
|
+
resetValue
|
|
22784
|
+
} = item;
|
|
22785
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(resetValue)) {
|
|
22786
|
+
return resetValue({
|
|
22787
|
+
field,
|
|
22788
|
+
item,
|
|
22789
|
+
data,
|
|
22790
|
+
$form: $xeForm,
|
|
22791
|
+
$grid: $xeGrid
|
|
22792
|
+
});
|
|
22793
|
+
} else if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eqNull(resetValue)) {
|
|
22794
|
+
// 默认
|
|
22795
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(itemValue)) {
|
|
22796
|
+
return [];
|
|
22797
|
+
}
|
|
22798
|
+
}
|
|
22799
|
+
return resetValue;
|
|
22800
|
+
};
|
|
22801
|
+
const reset = () => {
|
|
22802
|
+
const {
|
|
22803
|
+
data
|
|
22804
|
+
} = props;
|
|
22805
|
+
const itemList = getItems();
|
|
22806
|
+
if (data) {
|
|
22807
|
+
itemList.forEach(item => {
|
|
22808
|
+
const {
|
|
22809
|
+
field,
|
|
22810
|
+
itemRender
|
|
22811
|
+
} = item;
|
|
22812
|
+
if (isEnableConf(itemRender)) {
|
|
22813
|
+
const {
|
|
22814
|
+
name,
|
|
22815
|
+
startField,
|
|
22816
|
+
endField
|
|
22817
|
+
} = itemRender;
|
|
22818
|
+
const compConf = renderer.get(name);
|
|
22819
|
+
const fiResetMethod = compConf ? compConf.formItemResetMethod || compConf.itemResetMethod : null;
|
|
22820
|
+
if (compConf && fiResetMethod) {
|
|
22821
|
+
fiResetMethod({
|
|
22822
|
+
data,
|
|
22823
|
+
field,
|
|
22824
|
+
property: field,
|
|
22825
|
+
item,
|
|
22826
|
+
$form: $xeForm,
|
|
22827
|
+
$grid: $xeGrid
|
|
22828
|
+
});
|
|
22829
|
+
} else if (field) {
|
|
22830
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
22831
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, field, getResetValue(item, data, itemValue));
|
|
22832
|
+
}
|
|
22833
|
+
if (startField && endField) {
|
|
22834
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, startField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, startField)));
|
|
22835
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(data, endField, getResetValue(item, data, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, endField)));
|
|
22836
|
+
}
|
|
23115
22837
|
}
|
|
23116
|
-
};
|
|
22838
|
+
});
|
|
23117
22839
|
}
|
|
23118
|
-
|
|
23119
|
-
|
|
23120
|
-
|
|
23121
|
-
|
|
23122
|
-
|
|
23123
|
-
|
|
23124
|
-
|
|
23125
|
-
|
|
23126
|
-
|
|
23127
|
-
|
|
22840
|
+
internalData.itemFormatCache = {};
|
|
22841
|
+
clearValidate();
|
|
22842
|
+
return recalculate();
|
|
22843
|
+
};
|
|
22844
|
+
const resetEvent = evnt => {
|
|
22845
|
+
evnt.preventDefault();
|
|
22846
|
+
reset();
|
|
22847
|
+
formMethods.dispatchEvent('reset', {
|
|
22848
|
+
data: props.data
|
|
22849
|
+
}, evnt);
|
|
22850
|
+
};
|
|
22851
|
+
const handleFocus = fields => {
|
|
22852
|
+
const el = refElem.value;
|
|
22853
|
+
if (el) {
|
|
22854
|
+
for (let i = 0; i < fields.length; i++) {
|
|
22855
|
+
const field = fields[i];
|
|
22856
|
+
const item = getItemByField(field);
|
|
22857
|
+
if (item && isEnableConf(item.itemRender)) {
|
|
22858
|
+
const {
|
|
22859
|
+
itemRender
|
|
22860
|
+
} = item;
|
|
22861
|
+
const compConf = renderer.get(itemRender.name);
|
|
22862
|
+
// 定位到第一个
|
|
22863
|
+
if (!i) {
|
|
22864
|
+
scrollToView(el.querySelector(`.${item.id}`));
|
|
22865
|
+
}
|
|
22866
|
+
let inputElem = null;
|
|
22867
|
+
const autoFocus = itemRender.autoFocus || itemRender.autofocus || (compConf ? compConf.formItemAutoFocus : null);
|
|
22868
|
+
// 如果指定了聚焦 class
|
|
22869
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(autoFocus)) {
|
|
22870
|
+
inputElem = autoFocus({
|
|
22871
|
+
$form: $xeForm,
|
|
22872
|
+
$grid: $xeGrid,
|
|
22873
|
+
item,
|
|
22874
|
+
data: props.data,
|
|
22875
|
+
field
|
|
22876
|
+
});
|
|
22877
|
+
} else {
|
|
22878
|
+
if (autoFocus === true) {
|
|
22879
|
+
// 自动匹配模式,会自动匹配第一个可输入元素
|
|
22880
|
+
inputElem = el.querySelector(`.${item.id} input,textarea`);
|
|
22881
|
+
} else if (autoFocus) {
|
|
22882
|
+
inputElem = el.querySelector(`.${item.id} ${autoFocus}`);
|
|
22883
|
+
}
|
|
22884
|
+
}
|
|
22885
|
+
if (inputElem) {
|
|
22886
|
+
inputElem.focus();
|
|
22887
|
+
break;
|
|
22888
|
+
}
|
|
23128
22889
|
}
|
|
23129
|
-
}
|
|
23130
|
-
}
|
|
23131
|
-
}
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23135
|
-
|
|
23136
|
-
|
|
23137
|
-
|
|
23138
|
-
|
|
23139
|
-
|
|
23140
|
-
|
|
23141
|
-
|
|
23142
|
-
|
|
23143
|
-
|
|
23144
|
-
|
|
23145
|
-
|
|
23146
|
-
|
|
23147
|
-
options,
|
|
23148
|
-
...getComponentFormItemProps(renderOpts, params, itemValue),
|
|
23149
|
-
...getItemOns(renderOpts, params)
|
|
23150
|
-
})];
|
|
23151
|
-
}
|
|
23152
|
-
},
|
|
23153
|
-
VxeSelect: {
|
|
23154
|
-
formItemAutoFocus: 'input',
|
|
23155
|
-
renderFormItemContent(renderOpts, params) {
|
|
23156
|
-
const {
|
|
23157
|
-
data,
|
|
23158
|
-
field
|
|
23159
|
-
} = params;
|
|
23160
|
-
const {
|
|
23161
|
-
options,
|
|
23162
|
-
optionProps,
|
|
23163
|
-
optionGroups,
|
|
23164
|
-
optionGroupProps
|
|
23165
|
-
} = renderOpts;
|
|
23166
|
-
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, field);
|
|
23167
|
-
return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(getDefaultComponent(renderOpts), {
|
|
23168
|
-
...getComponentFormItemProps(renderOpts, params, itemValue, {
|
|
23169
|
-
options,
|
|
23170
|
-
optionProps,
|
|
23171
|
-
optionGroups,
|
|
23172
|
-
optionGroupProps
|
|
23173
|
-
}),
|
|
23174
|
-
...getItemOns(renderOpts, params)
|
|
23175
|
-
})];
|
|
23176
|
-
}
|
|
23177
|
-
},
|
|
23178
|
-
VxeTreeSelect: {
|
|
23179
|
-
formItemAutoFocus: 'input',
|
|
23180
|
-
renderFormItemContent(renderOpts, params) {
|
|
22890
|
+
}
|
|
22891
|
+
}
|
|
22892
|
+
};
|
|
22893
|
+
/**
|
|
22894
|
+
* 校验数据
|
|
22895
|
+
* 按表格行、列顺序依次校验(同步或异步)
|
|
22896
|
+
* 校验规则根据索引顺序依次校验,如果是异步则会等待校验完成才会继续校验下一列
|
|
22897
|
+
* 如果校验失败则,触发回调或者 Promise<(ErrMap 校验不通过列的信息)>
|
|
22898
|
+
* 如果是传回调方式这返回一个 (ErrMap 校验不通过列的信息)
|
|
22899
|
+
*
|
|
22900
|
+
* rule 配置:
|
|
22901
|
+
* required=Boolean 是否必填
|
|
22902
|
+
* min=Number 最小长度
|
|
22903
|
+
* max=Number 最大长度
|
|
22904
|
+
* validator=Function({ itemValue, rule, rules, data, property }) 自定义校验,接收一个 Promise
|
|
22905
|
+
* trigger=change 触发方式
|
|
22906
|
+
*/
|
|
22907
|
+
const validItemRules = (validType, fields, val) => {
|
|
23181
22908
|
const {
|
|
23182
22909
|
data,
|
|
23183
|
-
|
|
23184
|
-
} =
|
|
23185
|
-
const {
|
|
23186
|
-
|
|
23187
|
-
|
|
23188
|
-
}
|
|
23189
|
-
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
|
|
23193
|
-
|
|
23194
|
-
|
|
23195
|
-
|
|
23196
|
-
|
|
23197
|
-
|
|
23198
|
-
|
|
23199
|
-
|
|
23200
|
-
|
|
23201
|
-
|
|
22910
|
+
rules: formRules
|
|
22911
|
+
} = props;
|
|
22912
|
+
const errorMaps = {};
|
|
22913
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fields)) {
|
|
22914
|
+
fields = [fields];
|
|
22915
|
+
}
|
|
22916
|
+
return Promise.all(fields.map(property => {
|
|
22917
|
+
const errorRules = [];
|
|
22918
|
+
const syncVailds = [];
|
|
22919
|
+
if (property && formRules) {
|
|
22920
|
+
const rules = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(formRules, property);
|
|
22921
|
+
if (rules) {
|
|
22922
|
+
const itemValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(val) ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(data, property) : val;
|
|
22923
|
+
rules.forEach(rule => {
|
|
22924
|
+
const {
|
|
22925
|
+
trigger,
|
|
22926
|
+
validator
|
|
22927
|
+
} = rule;
|
|
22928
|
+
if (validType === 'all' || !trigger || validType === trigger) {
|
|
22929
|
+
if (validator) {
|
|
22930
|
+
const validParams = {
|
|
22931
|
+
itemValue,
|
|
22932
|
+
rule,
|
|
22933
|
+
rules,
|
|
22934
|
+
data,
|
|
22935
|
+
field: property,
|
|
22936
|
+
property,
|
|
22937
|
+
$form: $xeForm
|
|
22938
|
+
};
|
|
22939
|
+
let customValid;
|
|
22940
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(validator)) {
|
|
22941
|
+
const gvItem = validators.get(validator);
|
|
22942
|
+
if (gvItem) {
|
|
22943
|
+
const validatorMethod = gvItem.formItemValidatorMethod || gvItem.itemValidatorMethod;
|
|
22944
|
+
if (validatorMethod) {
|
|
22945
|
+
customValid = validatorMethod(validParams);
|
|
22946
|
+
} else {
|
|
22947
|
+
warnLog('vxe.error.notValidators', [validator]);
|
|
22948
|
+
}
|
|
22949
|
+
} else {
|
|
22950
|
+
errLog('vxe.error.notValidators', [validator]);
|
|
22951
|
+
}
|
|
22952
|
+
} else {
|
|
22953
|
+
customValid = validator(validParams);
|
|
22954
|
+
}
|
|
22955
|
+
if (customValid) {
|
|
22956
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isError(customValid)) {
|
|
22957
|
+
errorRules.push(new Rule({
|
|
22958
|
+
type: 'custom',
|
|
22959
|
+
trigger,
|
|
22960
|
+
content: customValid.message,
|
|
22961
|
+
rule: new Rule(rule)
|
|
22962
|
+
}));
|
|
22963
|
+
} else if (customValid.catch) {
|
|
22964
|
+
// 如果为异步校验(注:异步校验是并发无序的)
|
|
22965
|
+
syncVailds.push(customValid.catch(e => {
|
|
22966
|
+
errorRules.push(new Rule({
|
|
22967
|
+
type: 'custom',
|
|
22968
|
+
trigger,
|
|
22969
|
+
content: e ? e.message : rule.content || rule.message,
|
|
22970
|
+
rule: new Rule(rule)
|
|
22971
|
+
}));
|
|
22972
|
+
}));
|
|
22973
|
+
}
|
|
22974
|
+
}
|
|
22975
|
+
} else {
|
|
22976
|
+
if (!checkRuleStatus(rule, itemValue)) {
|
|
22977
|
+
errorRules.push(new Rule(rule));
|
|
22978
|
+
}
|
|
22979
|
+
}
|
|
22980
|
+
}
|
|
22981
|
+
});
|
|
22982
|
+
}
|
|
22983
|
+
}
|
|
22984
|
+
return Promise.all(syncVailds).then(() => {
|
|
22985
|
+
if (errorRules.length) {
|
|
22986
|
+
errorMaps[property] = errorRules.map(rule => {
|
|
22987
|
+
return {
|
|
22988
|
+
$form: $xeForm,
|
|
22989
|
+
rule,
|
|
22990
|
+
data,
|
|
22991
|
+
field: property,
|
|
22992
|
+
property
|
|
22993
|
+
};
|
|
22994
|
+
});
|
|
22995
|
+
}
|
|
22996
|
+
});
|
|
22997
|
+
})).then(() => {
|
|
22998
|
+
if (!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isEmpty(errorMaps)) {
|
|
22999
|
+
return Promise.reject(errorMaps);
|
|
23000
|
+
}
|
|
23001
|
+
});
|
|
23002
|
+
};
|
|
23003
|
+
const beginValidate = (itemList, type, callback) => {
|
|
23202
23004
|
const {
|
|
23203
23005
|
data,
|
|
23204
|
-
|
|
23205
|
-
} =
|
|
23206
|
-
const
|
|
23207
|
-
|
|
23208
|
-
|
|
23209
|
-
|
|
23210
|
-
|
|
23211
|
-
|
|
23212
|
-
|
|
23213
|
-
|
|
23214
|
-
|
|
23215
|
-
|
|
23216
|
-
|
|
23217
|
-
|
|
23218
|
-
|
|
23219
|
-
|
|
23220
|
-
|
|
23221
|
-
|
|
23222
|
-
|
|
23006
|
+
rules: formRules
|
|
23007
|
+
} = props;
|
|
23008
|
+
const validOpts = computeValidOpts.value;
|
|
23009
|
+
const validRest = {};
|
|
23010
|
+
const validFields = [];
|
|
23011
|
+
const itemValids = [];
|
|
23012
|
+
clearTimeout(internalData.meTimeout);
|
|
23013
|
+
if (data && formRules) {
|
|
23014
|
+
itemList.forEach(item => {
|
|
23015
|
+
const {
|
|
23016
|
+
field
|
|
23017
|
+
} = item;
|
|
23018
|
+
if (field && !isHiddenItem($xeForm, item) && isActiveItem($xeForm, item)) {
|
|
23019
|
+
itemValids.push(validItemRules(type || 'all', field).then(() => {
|
|
23020
|
+
item.errRule = null;
|
|
23021
|
+
}).catch(errorMaps => {
|
|
23022
|
+
const rest = errorMaps[field];
|
|
23023
|
+
if (!validRest[field]) {
|
|
23024
|
+
validRest[field] = [];
|
|
23025
|
+
}
|
|
23026
|
+
validRest[field].push(rest);
|
|
23027
|
+
validFields.push(field);
|
|
23028
|
+
item.errRule = rest[0].rule;
|
|
23029
|
+
return Promise.reject(rest);
|
|
23030
|
+
}));
|
|
23031
|
+
}
|
|
23032
|
+
});
|
|
23033
|
+
return Promise.all(itemValids).then(() => {
|
|
23034
|
+
if (callback) {
|
|
23035
|
+
callback();
|
|
23036
|
+
}
|
|
23037
|
+
}).catch(() => {
|
|
23038
|
+
return new Promise(resolve => {
|
|
23039
|
+
internalData.meTimeout = setTimeout(() => {
|
|
23040
|
+
itemList.forEach(item => {
|
|
23041
|
+
if (item.errRule) {
|
|
23042
|
+
item.showError = true;
|
|
23043
|
+
}
|
|
23044
|
+
});
|
|
23045
|
+
}, 20);
|
|
23046
|
+
if (validOpts.autoPos !== false) {
|
|
23047
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
23048
|
+
handleFocus(validFields);
|
|
23049
|
+
});
|
|
23050
|
+
}
|
|
23051
|
+
if (callback) {
|
|
23052
|
+
callback(validRest);
|
|
23053
|
+
resolve();
|
|
23054
|
+
} else {
|
|
23055
|
+
resolve(validRest);
|
|
23056
|
+
}
|
|
23057
|
+
});
|
|
23058
|
+
});
|
|
23059
|
+
}
|
|
23060
|
+
if (callback) {
|
|
23061
|
+
callback();
|
|
23062
|
+
}
|
|
23063
|
+
return Promise.resolve();
|
|
23064
|
+
};
|
|
23065
|
+
const validate = callback => {
|
|
23223
23066
|
const {
|
|
23224
|
-
|
|
23225
|
-
|
|
23226
|
-
|
|
23067
|
+
readonly
|
|
23068
|
+
} = props;
|
|
23069
|
+
clearValidate();
|
|
23070
|
+
if (readonly) {
|
|
23071
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
23072
|
+
}
|
|
23073
|
+
return beginValidate(getItems(), '', callback).then(params => {
|
|
23074
|
+
recalculate();
|
|
23075
|
+
return params;
|
|
23076
|
+
});
|
|
23077
|
+
};
|
|
23078
|
+
const validateField = (fieldOrItem, callback) => {
|
|
23227
23079
|
const {
|
|
23228
|
-
|
|
23229
|
-
} =
|
|
23230
|
-
|
|
23231
|
-
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
|
|
23235
|
-
|
|
23236
|
-
|
|
23237
|
-
|
|
23238
|
-
|
|
23239
|
-
|
|
23240
|
-
|
|
23241
|
-
|
|
23080
|
+
readonly
|
|
23081
|
+
} = props;
|
|
23082
|
+
if (readonly) {
|
|
23083
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
23084
|
+
}
|
|
23085
|
+
let fields = [];
|
|
23086
|
+
if (fieldOrItem) {
|
|
23087
|
+
if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(fieldOrItem)) {
|
|
23088
|
+
fields = fieldOrItem;
|
|
23089
|
+
} else {
|
|
23090
|
+
fields = [fieldOrItem];
|
|
23091
|
+
}
|
|
23092
|
+
}
|
|
23093
|
+
return beginValidate(fields.map(field => handleFieldOrItem($xeForm, field)), '', callback).then(params => {
|
|
23094
|
+
recalculate();
|
|
23095
|
+
return params;
|
|
23096
|
+
});
|
|
23097
|
+
};
|
|
23098
|
+
const submitEvent = evnt => {
|
|
23242
23099
|
const {
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23100
|
+
readonly
|
|
23101
|
+
} = props;
|
|
23102
|
+
evnt.preventDefault();
|
|
23103
|
+
if (!props.preventSubmit) {
|
|
23104
|
+
clearValidate();
|
|
23105
|
+
if (readonly) {
|
|
23106
|
+
formMethods.dispatchEvent('submit', {
|
|
23107
|
+
data: props.data
|
|
23108
|
+
}, evnt);
|
|
23109
|
+
recalculate();
|
|
23110
|
+
return;
|
|
23111
|
+
}
|
|
23112
|
+
beginValidate(getItems()).then(errMap => {
|
|
23113
|
+
if (errMap) {
|
|
23114
|
+
formMethods.dispatchEvent('submit-invalid', {
|
|
23115
|
+
data: props.data,
|
|
23116
|
+
errMap
|
|
23117
|
+
}, evnt);
|
|
23118
|
+
} else {
|
|
23119
|
+
formMethods.dispatchEvent('submit', {
|
|
23120
|
+
data: props.data
|
|
23121
|
+
}, evnt);
|
|
23122
|
+
}
|
|
23123
|
+
recalculate();
|
|
23124
|
+
});
|
|
23125
|
+
}
|
|
23126
|
+
};
|
|
23127
|
+
const closeTooltip = () => {
|
|
23246
23128
|
const {
|
|
23247
|
-
|
|
23248
|
-
} =
|
|
23249
|
-
const
|
|
23250
|
-
|
|
23251
|
-
|
|
23252
|
-
|
|
23253
|
-
|
|
23254
|
-
|
|
23255
|
-
|
|
23256
|
-
|
|
23257
|
-
|
|
23258
|
-
|
|
23259
|
-
|
|
23260
|
-
|
|
23261
|
-
|
|
23262
|
-
renderFormItemContent: formItemRadioAndCheckboxRender
|
|
23263
|
-
},
|
|
23264
|
-
VxeCheckbox: {
|
|
23265
|
-
renderFormItemContent: defaultFormItemRender
|
|
23266
|
-
},
|
|
23267
|
-
VxeCheckboxGroup: {
|
|
23268
|
-
renderFormItemContent: formItemRadioAndCheckboxRender
|
|
23269
|
-
},
|
|
23270
|
-
VxeSwitch: {
|
|
23271
|
-
renderFormItemContent: defaultItemRender
|
|
23272
|
-
},
|
|
23273
|
-
VxeRate: {
|
|
23274
|
-
renderFormItemContent: defaultItemRender
|
|
23275
|
-
},
|
|
23276
|
-
VxeSlider: {
|
|
23277
|
-
renderFormItemContent: defaultItemRender
|
|
23278
|
-
},
|
|
23279
|
-
VxeImage: {
|
|
23280
|
-
renderFormItemContent(renderOpts, params) {
|
|
23129
|
+
tooltipStore
|
|
23130
|
+
} = internalData;
|
|
23131
|
+
const $tooltip = refTooltip.value;
|
|
23132
|
+
if (tooltipStore.visible) {
|
|
23133
|
+
Object.assign(tooltipStore, {
|
|
23134
|
+
item: null,
|
|
23135
|
+
visible: false
|
|
23136
|
+
});
|
|
23137
|
+
if ($tooltip) {
|
|
23138
|
+
$tooltip.close();
|
|
23139
|
+
}
|
|
23140
|
+
}
|
|
23141
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
23142
|
+
};
|
|
23143
|
+
const triggerTitleTipEvent = (evnt, params) => {
|
|
23281
23144
|
const {
|
|
23282
|
-
|
|
23283
|
-
field
|
|
23145
|
+
item
|
|
23284
23146
|
} = params;
|
|
23285
23147
|
const {
|
|
23286
|
-
|
|
23287
|
-
} =
|
|
23288
|
-
const
|
|
23289
|
-
|
|
23290
|
-
|
|
23291
|
-
|
|
23292
|
-
|
|
23293
|
-
|
|
23294
|
-
|
|
23295
|
-
|
|
23296
|
-
|
|
23297
|
-
|
|
23148
|
+
tooltipStore
|
|
23149
|
+
} = internalData;
|
|
23150
|
+
const $tooltip = refTooltip.value;
|
|
23151
|
+
const overflowElem = evnt.currentTarget.children[0];
|
|
23152
|
+
const content = (overflowElem.textContent || '').trim();
|
|
23153
|
+
const isCellOverflow = overflowElem.scrollWidth > overflowElem.clientWidth;
|
|
23154
|
+
clearTimeout(internalData.stTimeout);
|
|
23155
|
+
if (tooltipStore.item !== item) {
|
|
23156
|
+
closeTooltip();
|
|
23157
|
+
}
|
|
23158
|
+
if (content && isCellOverflow) {
|
|
23159
|
+
Object.assign(tooltipStore, {
|
|
23160
|
+
item,
|
|
23161
|
+
visible: true
|
|
23162
|
+
});
|
|
23163
|
+
if ($tooltip) {
|
|
23164
|
+
$tooltip.open(overflowElem, content);
|
|
23165
|
+
}
|
|
23166
|
+
}
|
|
23167
|
+
};
|
|
23168
|
+
const handleTitleTipLeaveEvent = () => {
|
|
23169
|
+
const tooltipOpts = computeTooltipOpts.value;
|
|
23170
|
+
let $tooltip = refTooltip.value;
|
|
23171
|
+
if ($tooltip) {
|
|
23172
|
+
$tooltip.setActived(false);
|
|
23173
|
+
}
|
|
23174
|
+
if (tooltipOpts.enterable) {
|
|
23175
|
+
internalData.stTimeout = setTimeout(() => {
|
|
23176
|
+
$tooltip = refTooltip.value;
|
|
23177
|
+
if ($tooltip && !$tooltip.isActived()) {
|
|
23178
|
+
closeTooltip();
|
|
23179
|
+
}
|
|
23180
|
+
}, tooltipOpts.leaveDelay);
|
|
23181
|
+
} else {
|
|
23182
|
+
closeTooltip();
|
|
23183
|
+
}
|
|
23184
|
+
};
|
|
23185
|
+
const triggerItemEvent = (evnt, field, itemValue) => {
|
|
23186
|
+
if (field) {
|
|
23187
|
+
return validItemRules(evnt ? ['blur'].includes(evnt.type) ? 'blur' : 'change' : 'all', field, itemValue).then(() => {
|
|
23188
|
+
clearValidate(field);
|
|
23189
|
+
}).catch(errorMaps => {
|
|
23190
|
+
const rest = errorMaps[field];
|
|
23191
|
+
const item = getItemByField(field);
|
|
23192
|
+
if (rest && item) {
|
|
23193
|
+
item.showError = true;
|
|
23194
|
+
item.errRule = rest[0].rule;
|
|
23195
|
+
}
|
|
23196
|
+
});
|
|
23197
|
+
}
|
|
23198
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
23199
|
+
};
|
|
23200
|
+
/**
|
|
23201
|
+
* 更新项状态
|
|
23202
|
+
* 如果组件值 v-model 发生 change 时,调用改函数用于更新某一项编辑状态
|
|
23203
|
+
* 如果单元格配置了校验规则,则会进行校验
|
|
23204
|
+
*/
|
|
23205
|
+
const updateStatus = (scope, itemValue) => {
|
|
23298
23206
|
const {
|
|
23299
|
-
data,
|
|
23300
23207
|
field
|
|
23301
|
-
} =
|
|
23302
|
-
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
const
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23309
|
-
|
|
23310
|
-
|
|
23311
|
-
|
|
23312
|
-
|
|
23313
|
-
|
|
23314
|
-
|
|
23315
|
-
|
|
23316
|
-
|
|
23317
|
-
|
|
23318
|
-
|
|
23319
|
-
|
|
23320
|
-
|
|
23321
|
-
|
|
23322
|
-
|
|
23323
|
-
|
|
23324
|
-
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23328
|
-
|
|
23329
|
-
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
|
|
23208
|
+
} = scope;
|
|
23209
|
+
return triggerItemEvent(new Event('change'), field, itemValue);
|
|
23210
|
+
};
|
|
23211
|
+
const recalculate = () => {
|
|
23212
|
+
const autoItemWidthList = computeAutoItemWidthList.value;
|
|
23213
|
+
const el = refElem.value;
|
|
23214
|
+
if (el && autoItemWidthList.length) {
|
|
23215
|
+
const itemElList = el.querySelectorAll(autoItemWidthList.map(item => `.vxe-form--item-title[itemid="${item.id}"]`).join(','));
|
|
23216
|
+
let maxItemWidth = 0;
|
|
23217
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(itemElList, itemEl => {
|
|
23218
|
+
itemEl.style.width = '';
|
|
23219
|
+
maxItemWidth = Math.max(maxItemWidth, Math.ceil(itemEl.clientWidth + 2));
|
|
23220
|
+
});
|
|
23221
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().arrayEach(itemElList, itemEl => {
|
|
23222
|
+
itemEl.style.width = `${maxItemWidth}px`;
|
|
23223
|
+
});
|
|
23224
|
+
}
|
|
23225
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
|
|
23226
|
+
};
|
|
23227
|
+
const handleGlobalResizeEvent = () => {
|
|
23228
|
+
recalculate();
|
|
23229
|
+
};
|
|
23230
|
+
formMethods = {
|
|
23231
|
+
dispatchEvent(type, params, evnt) {
|
|
23232
|
+
emit(type, createEvent(evnt, {
|
|
23233
|
+
$form: $xeForm,
|
|
23234
|
+
$grid: $xeGrid
|
|
23235
|
+
}, params));
|
|
23236
|
+
},
|
|
23237
|
+
reset,
|
|
23238
|
+
validate,
|
|
23239
|
+
validateField,
|
|
23240
|
+
clearValidate,
|
|
23241
|
+
updateStatus,
|
|
23242
|
+
toggleCollapse,
|
|
23243
|
+
getItems,
|
|
23244
|
+
getItemByField,
|
|
23245
|
+
closeTooltip,
|
|
23246
|
+
recalculate
|
|
23247
|
+
};
|
|
23248
|
+
const formPrivateMethods = {
|
|
23249
|
+
callSlot,
|
|
23250
|
+
triggerItemEvent,
|
|
23251
|
+
toggleCollapseEvent,
|
|
23252
|
+
triggerTitleTipEvent,
|
|
23253
|
+
handleTitleTipLeaveEvent
|
|
23254
|
+
};
|
|
23255
|
+
Object.assign($xeForm, formMethods, formPrivateMethods);
|
|
23256
|
+
const renderVN = () => {
|
|
23334
23257
|
const {
|
|
23258
|
+
loading,
|
|
23259
|
+
border,
|
|
23260
|
+
className,
|
|
23335
23261
|
data,
|
|
23336
|
-
|
|
23337
|
-
} =
|
|
23262
|
+
customLayout
|
|
23263
|
+
} = props;
|
|
23338
23264
|
const {
|
|
23339
|
-
|
|
23340
|
-
|
|
23341
|
-
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23350
|
-
|
|
23351
|
-
|
|
23352
|
-
|
|
23353
|
-
|
|
23265
|
+
formItems
|
|
23266
|
+
} = reactData;
|
|
23267
|
+
const vSize = computeSize.value;
|
|
23268
|
+
const tooltipOpts = computeTooltipOpts.value;
|
|
23269
|
+
const defaultSlot = slots.default;
|
|
23270
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('form', {
|
|
23271
|
+
ref: refElem,
|
|
23272
|
+
class: ['vxe-form', className ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(className) ? className({
|
|
23273
|
+
items: formItems,
|
|
23274
|
+
data,
|
|
23275
|
+
$form: $xeForm
|
|
23276
|
+
}) : className : '', {
|
|
23277
|
+
[`size--${vSize}`]: vSize,
|
|
23278
|
+
'is--border': border,
|
|
23279
|
+
'custom--layout': customLayout,
|
|
23280
|
+
'is--loading': loading
|
|
23281
|
+
}],
|
|
23282
|
+
onSubmit: submitEvent,
|
|
23283
|
+
onReset: resetEvent
|
|
23284
|
+
}, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
23285
|
+
class: 'vxe-form--wrapper vxe-form--item-row'
|
|
23286
|
+
}, customLayout ? defaultSlot ? defaultSlot({}) : [] : formItems.map((item, index) => {
|
|
23287
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(form_config_item, {
|
|
23288
|
+
key: index,
|
|
23289
|
+
itemConfig: item
|
|
23290
|
+
});
|
|
23291
|
+
})), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
|
|
23292
|
+
class: 'vxe-form-slots',
|
|
23293
|
+
ref: 'hideItem'
|
|
23294
|
+
}, customLayout ? [] : defaultSlot ? defaultSlot({}) : []),
|
|
23295
|
+
/**
|
|
23296
|
+
* 加载中
|
|
23297
|
+
*/
|
|
23298
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(src_loading, {
|
|
23299
|
+
class: 'vxe-form--loading',
|
|
23300
|
+
modelValue: loading
|
|
23301
|
+
}),
|
|
23302
|
+
/**
|
|
23303
|
+
* 工具提示
|
|
23304
|
+
*/
|
|
23305
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(tooltip, {
|
|
23306
|
+
ref: refTooltip,
|
|
23307
|
+
...tooltipOpts
|
|
23308
|
+
})]);
|
|
23309
|
+
};
|
|
23310
|
+
const staticItemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
|
|
23311
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems.length, () => {
|
|
23312
|
+
staticItemFlag.value++;
|
|
23313
|
+
});
|
|
23314
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => reactData.staticItems, () => {
|
|
23315
|
+
staticItemFlag.value++;
|
|
23316
|
+
});
|
|
23317
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(staticItemFlag, () => {
|
|
23318
|
+
reactData.formItems = reactData.staticItems;
|
|
23319
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(() => {
|
|
23320
|
+
recalculate();
|
|
23321
|
+
});
|
|
23322
|
+
});
|
|
23323
|
+
const itemFlag = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)(0);
|
|
23324
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items ? props.items.length : -1, () => {
|
|
23325
|
+
itemFlag.value++;
|
|
23326
|
+
});
|
|
23327
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.items, () => {
|
|
23328
|
+
itemFlag.value++;
|
|
23329
|
+
});
|
|
23330
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(itemFlag, () => {
|
|
23331
|
+
loadItem(props.items || []);
|
|
23332
|
+
});
|
|
23333
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.collapseStatus, value => {
|
|
23334
|
+
reactData.collapseAll = !!value;
|
|
23335
|
+
});
|
|
23336
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.readonly, () => {
|
|
23337
|
+
clearValidate();
|
|
23338
|
+
});
|
|
23339
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.disabled, () => {
|
|
23340
|
+
clearValidate();
|
|
23341
|
+
});
|
|
23342
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
|
|
23343
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
|
|
23344
|
+
if (props.customLayout && props.items) {
|
|
23345
|
+
errLog('vxe.error.errConflicts', ['custom-layout', 'items']);
|
|
23346
|
+
}
|
|
23347
|
+
});
|
|
23348
|
+
globalEvents.on($xeForm, 'resize', handleGlobalResizeEvent);
|
|
23349
|
+
});
|
|
23350
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.onUnmounted)(() => {
|
|
23351
|
+
globalEvents.off($xeForm, 'resize');
|
|
23352
|
+
external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(internalData, createInternalData());
|
|
23353
|
+
});
|
|
23354
|
+
if (props.items) {
|
|
23355
|
+
loadItem(props.items);
|
|
23354
23356
|
}
|
|
23357
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('xeFormItemInfo', null);
|
|
23358
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeForm', $xeForm);
|
|
23359
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormGroup', null);
|
|
23360
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.provide)('$xeFormItem', null);
|
|
23361
|
+
$xeForm.renderVN = renderVN;
|
|
23362
|
+
return $xeForm;
|
|
23355
23363
|
},
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
},
|
|
23359
|
-
$checkbox: {
|
|
23360
|
-
renderFormItemContent: oldFormItemRadioAndCheckboxRender
|
|
23361
|
-
},
|
|
23362
|
-
$switch: {
|
|
23363
|
-
renderFormItemContent: oldItemRender
|
|
23364
|
+
render() {
|
|
23365
|
+
return this.renderVN();
|
|
23364
23366
|
}
|
|
23365
|
-
|
|
23366
|
-
});
|
|
23367
|
+
}));
|
|
23367
23368
|
;// CONCATENATED MODULE: ./packages/form/index.ts
|
|
23368
23369
|
|
|
23369
23370
|
|
|
23370
23371
|
|
|
23371
|
-
|
|
23372
23372
|
const VxeForm = Object.assign(src_form, {
|
|
23373
23373
|
install(app) {
|
|
23374
23374
|
app.component(src_form.name, src_form);
|