mali-ui-plus 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/mali-ui-plus.common.js +195 -6
- package/lib/mali-ui-plus.css +1 -1
- package/lib/mali-ui-plus.umd.js +195 -6
- package/lib/mali-ui-plus.umd.min.js +2 -2
- package/package.json +4 -2
- package/types/index.d.ts +12 -0
package/README.md
CHANGED
|
@@ -36,10 +36,10 @@ yarn add mali-ui-plus
|
|
|
36
36
|
|
|
37
37
|
```javascript
|
|
38
38
|
import Vue from 'vue'
|
|
39
|
-
import
|
|
39
|
+
import MaliUIPlus from 'mali-ui-plus'
|
|
40
40
|
import 'mali-ui-plus/lib/mali-ui-plus.css'
|
|
41
41
|
|
|
42
|
-
Vue.use(
|
|
42
|
+
Vue.use(MaliUIPlus)
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## 组件编译与发布流程
|
|
@@ -38637,6 +38637,195 @@ const MlInputvue_type_script_lang_ts_setup_true_hoisted_1 = {
|
|
|
38637
38637
|
const MlInput_exports_ = MlInputvue_type_script_lang_ts_setup_true;
|
|
38638
38638
|
|
|
38639
38639
|
/* harmony default export */ var MlInput = (MlInput_exports_);
|
|
38640
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./components/ml-select/MlSelect.vue?vue&type=script&lang=ts&setup=true
|
|
38641
|
+
|
|
38642
|
+
|
|
38643
|
+
|
|
38644
|
+
|
|
38645
|
+
/* harmony default export */ var MlSelectvue_type_script_lang_ts_setup_true = (/*#__PURE__*/(0,external_commonjs_vue_commonjs2_vue_root_Vue_.defineComponent)({
|
|
38646
|
+
__name: 'MlSelect',
|
|
38647
|
+
props: {
|
|
38648
|
+
modelValue: {
|
|
38649
|
+
type: [Number, String, Array],
|
|
38650
|
+
default: null
|
|
38651
|
+
},
|
|
38652
|
+
options: {
|
|
38653
|
+
type: Array,
|
|
38654
|
+
default: () => []
|
|
38655
|
+
},
|
|
38656
|
+
optionProps: {
|
|
38657
|
+
type: Object,
|
|
38658
|
+
default: () => ({})
|
|
38659
|
+
},
|
|
38660
|
+
placeholder: {
|
|
38661
|
+
type: String,
|
|
38662
|
+
default: '请选择'
|
|
38663
|
+
},
|
|
38664
|
+
filterMethod: Function,
|
|
38665
|
+
label: {
|
|
38666
|
+
type: [Number, String],
|
|
38667
|
+
default: null
|
|
38668
|
+
},
|
|
38669
|
+
size: {
|
|
38670
|
+
type: String,
|
|
38671
|
+
default: () => config_0.size
|
|
38672
|
+
},
|
|
38673
|
+
selected: {
|
|
38674
|
+
type: Object,
|
|
38675
|
+
default: null
|
|
38676
|
+
},
|
|
38677
|
+
readonly: {
|
|
38678
|
+
type: Boolean,
|
|
38679
|
+
default: null
|
|
38680
|
+
},
|
|
38681
|
+
clearable: {
|
|
38682
|
+
type: Boolean,
|
|
38683
|
+
default: false
|
|
38684
|
+
},
|
|
38685
|
+
filterable: Boolean,
|
|
38686
|
+
multiple: {
|
|
38687
|
+
type: Boolean,
|
|
38688
|
+
default: false
|
|
38689
|
+
},
|
|
38690
|
+
disabled: {
|
|
38691
|
+
type: Boolean,
|
|
38692
|
+
default: false
|
|
38693
|
+
},
|
|
38694
|
+
maxTagCount: Number
|
|
38695
|
+
},
|
|
38696
|
+
emits: ["update:modelValue", "update:label", "update:selected", "change"],
|
|
38697
|
+
setup(__props, {
|
|
38698
|
+
emit
|
|
38699
|
+
}) {
|
|
38700
|
+
const props = __props;
|
|
38701
|
+
const $xeform = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeform', null);
|
|
38702
|
+
const $xeformiteminfo = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeformiteminfo', null);
|
|
38703
|
+
const mlForm = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('mlForm', null);
|
|
38704
|
+
const isReadonly = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
38705
|
+
if (props.readonly === null) {
|
|
38706
|
+
return $xeform ? $xeform.props.readonly : false;
|
|
38707
|
+
}
|
|
38708
|
+
return props.readonly;
|
|
38709
|
+
});
|
|
38710
|
+
const optOptions = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
38711
|
+
return Object.assign({}, props.optionProps);
|
|
38712
|
+
});
|
|
38713
|
+
const optLabelField = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
38714
|
+
return optOptions.value.label || 'label';
|
|
38715
|
+
});
|
|
38716
|
+
const optValueField = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
|
|
38717
|
+
return optOptions.value.value || 'value';
|
|
38718
|
+
});
|
|
38719
|
+
const updateLabel = () => {
|
|
38720
|
+
const item = props.options.find(item => item[optValueField.value] === props.modelValue);
|
|
38721
|
+
emit('update:label', item ? item[optLabelField.value] : '');
|
|
38722
|
+
};
|
|
38723
|
+
const filterOptMethod = (searchValue, option) => {
|
|
38724
|
+
if (props.filterMethod) {
|
|
38725
|
+
return props.filterMethod({
|
|
38726
|
+
searchValue,
|
|
38727
|
+
option
|
|
38728
|
+
});
|
|
38729
|
+
}
|
|
38730
|
+
return String(option.componentOptions.propsData.label).toLowerCase().indexOf(String(searchValue || '').toLowerCase()) > -1;
|
|
38731
|
+
};
|
|
38732
|
+
const changeEvent = value => {
|
|
38733
|
+
let item;
|
|
38734
|
+
let selected = [];
|
|
38735
|
+
const label = item ? item[optLabelField.value] : '';
|
|
38736
|
+
if (props.multiple) {
|
|
38737
|
+
selected = value.map(v => props.options.find(obj => v === obj[optValueField.value]));
|
|
38738
|
+
} else {
|
|
38739
|
+
selected = props.options.filter(item => item[optValueField.value] === value);
|
|
38740
|
+
item = props.options.find(item => item[optValueField.value] === value);
|
|
38741
|
+
}
|
|
38742
|
+
// 自动更新校验状态
|
|
38743
|
+
if ($xeform && $xeformiteminfo) {
|
|
38744
|
+
$xeform.triggerItemEvent(new Event('change'), $xeformiteminfo.itemConfig.field, value);
|
|
38745
|
+
if (mlForm) {
|
|
38746
|
+
mlForm.changeItemValue($xeformiteminfo.itemConfig.field);
|
|
38747
|
+
}
|
|
38748
|
+
}
|
|
38749
|
+
emit('update:modelValue', value);
|
|
38750
|
+
emit('update:label', label);
|
|
38751
|
+
emit('update:selected', props.multiple ? null : item);
|
|
38752
|
+
emit('change', {
|
|
38753
|
+
value,
|
|
38754
|
+
selected,
|
|
38755
|
+
label
|
|
38756
|
+
});
|
|
38757
|
+
// 值改变自动触发提交
|
|
38758
|
+
if (mlForm && mlForm.changeToSubmit) {
|
|
38759
|
+
mlForm.submit();
|
|
38760
|
+
}
|
|
38761
|
+
};
|
|
38762
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.options, () => {
|
|
38763
|
+
updateLabel();
|
|
38764
|
+
});
|
|
38765
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.modelValue, () => {
|
|
38766
|
+
updateLabel();
|
|
38767
|
+
});
|
|
38768
|
+
(0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
|
|
38769
|
+
updateLabel();
|
|
38770
|
+
});
|
|
38771
|
+
return (_ctx, _cache) => {
|
|
38772
|
+
const _component_MlDictType = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)("MlDictType");
|
|
38773
|
+
const _component_el_option = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)("el-option");
|
|
38774
|
+
const _component_el_select = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.resolveComponent)("el-select");
|
|
38775
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(isReadonly) ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createBlock)(_component_MlDictType, {
|
|
38776
|
+
key: 0,
|
|
38777
|
+
class: "ml-select is-readonly",
|
|
38778
|
+
value: __props.modelValue,
|
|
38779
|
+
options: __props.options,
|
|
38780
|
+
optionProps: __props.optionProps,
|
|
38781
|
+
multiple: __props.multiple
|
|
38782
|
+
}, null, 8, ["value", "options", "optionProps", "multiple"])) : ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createBlock)(_component_el_select, {
|
|
38783
|
+
key: 1,
|
|
38784
|
+
disabled: __props.disabled,
|
|
38785
|
+
class: "ml-select",
|
|
38786
|
+
modelValue: __props.modelValue === null ? undefined : __props.modelValue,
|
|
38787
|
+
multiple: __props.multiple,
|
|
38788
|
+
"filter-method": filterOptMethod,
|
|
38789
|
+
placeholder: __props.placeholder,
|
|
38790
|
+
clearable: __props.clearable,
|
|
38791
|
+
filterable: __props.filterable,
|
|
38792
|
+
onChange: changeEvent
|
|
38793
|
+
}, {
|
|
38794
|
+
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.withCtx)(() => [((0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderList)(__props.options, (item, index) => {
|
|
38795
|
+
return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.createBlock)(_component_el_option, {
|
|
38796
|
+
key: index,
|
|
38797
|
+
value: item[(0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(optValueField)],
|
|
38798
|
+
label: item[(0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(optLabelField)]
|
|
38799
|
+
}, {
|
|
38800
|
+
default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_.withCtx)(() => [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.renderSlot)(_ctx.$slots, "item", (0,external_commonjs_vue_commonjs2_vue_root_Vue_.normalizeProps)((0,external_commonjs_vue_commonjs2_vue_root_Vue_.guardReactiveProps)({
|
|
38801
|
+
row: item,
|
|
38802
|
+
rowIndex: index,
|
|
38803
|
+
data: __props.options
|
|
38804
|
+
})), () => [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.createElementVNode)("span", null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_.toDisplayString)(item[(0,external_commonjs_vue_commonjs2_vue_root_Vue_.unref)(optLabelField)]), 1)])]),
|
|
38805
|
+
_: 2
|
|
38806
|
+
}, 1032, ["value", "label"]);
|
|
38807
|
+
}), 128))]),
|
|
38808
|
+
_: 3
|
|
38809
|
+
}, 8, ["disabled", "modelValue", "multiple", "placeholder", "clearable", "filterable"]));
|
|
38810
|
+
};
|
|
38811
|
+
}
|
|
38812
|
+
}));
|
|
38813
|
+
;// CONCATENATED MODULE: ./components/ml-select/MlSelect.vue?vue&type=script&lang=ts&setup=true
|
|
38814
|
+
|
|
38815
|
+
;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-22.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-22.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-22.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-22.use[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./components/ml-select/MlSelect.vue?vue&type=style&index=0&id=0c71ced4&lang=scss
|
|
38816
|
+
// extracted by mini-css-extract-plugin
|
|
38817
|
+
|
|
38818
|
+
;// CONCATENATED MODULE: ./components/ml-select/MlSelect.vue?vue&type=style&index=0&id=0c71ced4&lang=scss
|
|
38819
|
+
|
|
38820
|
+
;// CONCATENATED MODULE: ./components/ml-select/MlSelect.vue
|
|
38821
|
+
|
|
38822
|
+
|
|
38823
|
+
|
|
38824
|
+
;
|
|
38825
|
+
|
|
38826
|
+
const MlSelect_exports_ = MlSelectvue_type_script_lang_ts_setup_true;
|
|
38827
|
+
|
|
38828
|
+
/* harmony default export */ var MlSelect = (MlSelect_exports_);
|
|
38640
38829
|
;// CONCATENATED MODULE: ./utils/date.ts
|
|
38641
38830
|
|
|
38642
38831
|
/**
|
|
@@ -59133,7 +59322,7 @@ VXETable.setup({
|
|
|
59133
59322
|
|
|
59134
59323
|
|
|
59135
59324
|
// import MlTextarea from './components/ml-textarea/MlTextarea.vue'
|
|
59136
|
-
|
|
59325
|
+
|
|
59137
59326
|
|
|
59138
59327
|
// import MlAmountInput from './components/ml-input/MlAmountInput.vue'
|
|
59139
59328
|
// import MlNumberInput from './components/ml-input/MlNumberInput.vue'
|
|
@@ -59189,7 +59378,7 @@ const componentMaps = {
|
|
|
59189
59378
|
MlButton: MlButton,
|
|
59190
59379
|
MlInput: MlInput,
|
|
59191
59380
|
// MlTextarea:MlTextarea,
|
|
59192
|
-
|
|
59381
|
+
MlSelect: MlSelect,
|
|
59193
59382
|
MlAmountText: MlAmountText,
|
|
59194
59383
|
// MlAmountInput:MlAmountInput,
|
|
59195
59384
|
// MlNumberInput:MlNumberInput,
|
|
@@ -59246,8 +59435,8 @@ function index_config(options) {
|
|
|
59246
59435
|
xe_utils_default().merge(config_0, options);
|
|
59247
59436
|
return config_0;
|
|
59248
59437
|
}
|
|
59249
|
-
const
|
|
59250
|
-
version: "0.1.
|
|
59438
|
+
const MaliUIPlus = {
|
|
59439
|
+
version: "0.1.1",
|
|
59251
59440
|
install: index_install,
|
|
59252
59441
|
config: index_config,
|
|
59253
59442
|
VXETable: index_esm,
|
|
@@ -59255,13 +59444,13 @@ const MaliUI = {
|
|
|
59255
59444
|
MaliStorage: storage
|
|
59256
59445
|
};
|
|
59257
59446
|
index_components.forEach(item => {
|
|
59258
|
-
|
|
59447
|
+
MaliUIPlus[item.name] = item;
|
|
59259
59448
|
});
|
|
59260
59449
|
if (typeof window === 'object' && window.Vue) {
|
|
59261
59450
|
window.MaliUtils = utils_namespaceObject_0;
|
|
59262
59451
|
}
|
|
59263
59452
|
index_esm.use(index_common/* default */.ZP);
|
|
59264
|
-
/* harmony default export */ var index = (
|
|
59453
|
+
/* harmony default export */ var index = (MaliUIPlus);
|
|
59265
59454
|
;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
59266
59455
|
|
|
59267
59456
|
|