vxe-pc-ui 4.2.13 → 4.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/es/avatar/style.css +0 -5
  2. package/es/avatar/style.min.css +1 -1
  3. package/es/icon/style.css +1 -1
  4. package/es/slider/src/slider.js +226 -7
  5. package/es/slider/style.css +143 -0
  6. package/es/slider/style.min.css +1 -0
  7. package/es/style.css +1 -1
  8. package/es/style.min.css +1 -1
  9. package/es/ui/index.js +5 -2
  10. package/es/ui/src/log.js +1 -1
  11. package/es/vxe-avatar/style.css +0 -5
  12. package/es/vxe-avatar/style.min.css +1 -1
  13. package/es/vxe-slider/style.css +143 -0
  14. package/es/vxe-slider/style.min.css +1 -0
  15. package/lib/avatar/style/style.css +0 -5
  16. package/lib/avatar/style/style.min.css +1 -1
  17. package/lib/icon/style/style.css +1 -1
  18. package/lib/icon/style/style.min.css +1 -1
  19. package/lib/index.umd.js +238 -8
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/slider/src/slider.js +232 -5
  22. package/lib/slider/src/slider.min.js +1 -1
  23. package/lib/slider/style/style.css +143 -0
  24. package/lib/slider/style/style.min.css +1 -0
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/ui/index.js +5 -2
  28. package/lib/ui/index.min.js +1 -1
  29. package/lib/ui/src/log.js +1 -1
  30. package/lib/ui/src/log.min.js +1 -1
  31. package/lib/vxe-avatar/style/style.css +0 -5
  32. package/lib/vxe-avatar/style/style.min.css +1 -1
  33. package/lib/vxe-slider/style/style.css +143 -0
  34. package/lib/vxe-slider/style/style.min.css +1 -0
  35. package/package.json +1 -1
  36. package/packages/slider/src/slider.ts +236 -5
  37. package/packages/ui/index.ts +4 -1
  38. package/styles/components/avatar.scss +3 -8
  39. package/styles/components/slider.scss +138 -0
  40. package/types/components/slider.d.ts +27 -2
  41. package/types/components/switch.d.ts +1 -1
  42. /package/es/icon/style/{iconfont.1728032207633.ttf → iconfont.1728123639737.ttf} +0 -0
  43. /package/es/icon/style/{iconfont.1728032207633.woff → iconfont.1728123639737.woff} +0 -0
  44. /package/es/icon/style/{iconfont.1728032207633.woff2 → iconfont.1728123639737.woff2} +0 -0
  45. /package/es/{iconfont.1728032207633.ttf → iconfont.1728123639737.ttf} +0 -0
  46. /package/es/{iconfont.1728032207633.woff → iconfont.1728123639737.woff} +0 -0
  47. /package/es/{iconfont.1728032207633.woff2 → iconfont.1728123639737.woff2} +0 -0
  48. /package/lib/icon/style/{iconfont.1728032207633.ttf → iconfont.1728123639737.ttf} +0 -0
  49. /package/lib/icon/style/{iconfont.1728032207633.woff → iconfont.1728123639737.woff} +0 -0
  50. /package/lib/icon/style/{iconfont.1728032207633.woff2 → iconfont.1728123639737.woff2} +0 -0
  51. /package/lib/{iconfont.1728032207633.ttf → iconfont.1728123639737.ttf} +0 -0
  52. /package/lib/{iconfont.1728032207633.woff → iconfont.1728123639737.woff} +0 -0
  53. /package/lib/{iconfont.1728032207633.woff2 → iconfont.1728123639737.woff2} +0 -0
package/lib/index.umd.js CHANGED
@@ -4080,7 +4080,7 @@ function handleBooleanDefaultValue(value) {
4080
4080
  }
4081
4081
  ;// CONCATENATED MODULE: ./packages/ui/src/log.ts
4082
4082
 
4083
- const log_version = `ui v${"4.2.13"}`;
4083
+ const log_version = `ui v${"4.2.14"}`;
4084
4084
  const warnLog = log.create('warn', log_version);
4085
4085
  const errLog = log.create('error', log_version);
4086
4086
  ;// CONCATENATED MODULE: ./packages/ui/index.ts
@@ -4088,7 +4088,7 @@ const errLog = log.create('error', log_version);
4088
4088
 
4089
4089
 
4090
4090
 
4091
- const ui_version = "4.2.13";
4091
+ const ui_version = "4.2.14";
4092
4092
  core_VxeUI.version = ui_version;
4093
4093
  core_VxeUI.uiVersion = ui_version;
4094
4094
  core_VxeUI.tableVersion = '';
@@ -4331,7 +4331,10 @@ setConfig({
4331
4331
  select: {
4332
4332
  multiCharOverflow: 8
4333
4333
  },
4334
- slider: {},
4334
+ slider: {
4335
+ max: 100,
4336
+ min: 0
4337
+ },
4335
4338
  steps: {},
4336
4339
  switch: {},
4337
4340
  tabPane: {},
@@ -40958,18 +40961,91 @@ const Select = VxeSelect;
40958
40961
 
40959
40962
  /* harmony default export */ var slider = ((0,external_commonjs_vue_commonjs2_vue_root_Vue_.defineComponent)({
40960
40963
  name: 'VxeSlider',
40961
- props: {},
40962
- emits: [],
40964
+ props: {
40965
+ modelValue: [String, Number, Array],
40966
+ vertical: Boolean,
40967
+ max: {
40968
+ type: [String, Number],
40969
+ default: () => getConfig().slider.max
40970
+ },
40971
+ min: {
40972
+ type: [String, Number],
40973
+ default: () => getConfig().slider.min
40974
+ },
40975
+ step: {
40976
+ type: [String, Number],
40977
+ default: () => getConfig().slider.step
40978
+ },
40979
+ size: {
40980
+ type: String,
40981
+ default: () => getConfig().slider.size || getConfig().size
40982
+ },
40983
+ range: {
40984
+ type: Boolean,
40985
+ default: () => getConfig().slider.range
40986
+ },
40987
+ readonly: {
40988
+ type: Boolean,
40989
+ default: null
40990
+ },
40991
+ disabled: {
40992
+ type: Boolean,
40993
+ default: null
40994
+ }
40995
+ },
40996
+ emits: ['update:modelValue', 'change'],
40963
40997
  setup(props, context) {
40964
40998
  const {
40965
40999
  emit
40966
41000
  } = context;
41001
+ const $xeForm = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('$xeForm', null);
41002
+ const formItemInfo = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.inject)('xeFormItemInfo', null);
40967
41003
  const xID = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId();
41004
+ const {
41005
+ computeSize
41006
+ } = useSize(props);
40968
41007
  const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
40969
- const reactData = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)({});
41008
+ const refBarElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
41009
+ const refTrackElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
41010
+ const refStartBtnElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
41011
+ const refEndBtnElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
41012
+ const reactData = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.reactive)({
41013
+ startValue: 0,
41014
+ endValue: 0
41015
+ });
40970
41016
  const refMaps = {
40971
41017
  refElem
40972
41018
  };
41019
+ const computeFormReadonly = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
41020
+ const {
41021
+ readonly
41022
+ } = props;
41023
+ if (readonly === null) {
41024
+ if ($xeForm) {
41025
+ return $xeForm.props.readonly;
41026
+ }
41027
+ return false;
41028
+ }
41029
+ return readonly;
41030
+ });
41031
+ const computeIsDisabled = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
41032
+ const {
41033
+ disabled
41034
+ } = props;
41035
+ if (disabled === null) {
41036
+ if ($xeForm) {
41037
+ return $xeForm.props.disabled;
41038
+ }
41039
+ return false;
41040
+ }
41041
+ return disabled;
41042
+ });
41043
+ const computeMaxNum = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
41044
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(props.max || 0);
41045
+ });
41046
+ const computeMinNum = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
41047
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(props.min || 0);
41048
+ });
40973
41049
  const computeMaps = {};
40974
41050
  const $xeSlider = {
40975
41051
  xID,
@@ -40979,6 +41055,9 @@ const Select = VxeSelect;
40979
41055
  getRefMaps: () => refMaps,
40980
41056
  getComputeMaps: () => computeMaps
40981
41057
  };
41058
+ const emitModel = value => {
41059
+ emit('update:modelValue', value);
41060
+ };
40982
41061
  const dispatchEvent = (type, params, evnt) => {
40983
41062
  emit(type, createEvent(evnt, {
40984
41063
  $slider: $xeSlider
@@ -40987,14 +41066,165 @@ const Select = VxeSelect;
40987
41066
  const collapsePaneMethods = {
40988
41067
  dispatchEvent
40989
41068
  };
41069
+ const getStartPercent = startValue => {
41070
+ const {
41071
+ range
41072
+ } = props;
41073
+ const maxNum = computeMaxNum.value;
41074
+ const minNum = computeMinNum.value;
41075
+ return range ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor((startValue - minNum) / external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(maxNum - minNum) * 100) : 0;
41076
+ };
41077
+ const getEndPercent = (startValue, endValue) => {
41078
+ const {
41079
+ range
41080
+ } = props;
41081
+ const maxNum = computeMaxNum.value;
41082
+ const minNum = computeMinNum.value;
41083
+ return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor((endValue - (range ? startValue : 0) - minNum) / external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(maxNum - minNum) * 100);
41084
+ };
41085
+ const updateModel = () => {
41086
+ const {
41087
+ modelValue
41088
+ } = props;
41089
+ if (external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(modelValue)) {
41090
+ const [sVal, eVal] = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().clone(modelValue, true).sort();
41091
+ reactData.startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(sVal || 0));
41092
+ reactData.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(eVal || 0));
41093
+ } else {
41094
+ reactData.startValue = 0;
41095
+ reactData.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(modelValue || 0));
41096
+ }
41097
+ };
41098
+ const updateBarStyle = () => {
41099
+ const {
41100
+ startValue,
41101
+ endValue
41102
+ } = reactData;
41103
+ const trackElem = refTrackElem.value;
41104
+ const startBtnElem = refStartBtnElem.value;
41105
+ const endBtnElem = refEndBtnElem.value;
41106
+ let startPercent = 0;
41107
+ let endPercent = 0;
41108
+ if (startValue > endValue) {
41109
+ startPercent = getStartPercent(endValue);
41110
+ endPercent = getEndPercent(endValue, startValue);
41111
+ } else {
41112
+ startPercent = getStartPercent(startValue);
41113
+ endPercent = getEndPercent(startValue, endValue);
41114
+ }
41115
+ if (trackElem) {
41116
+ trackElem.style.left = `${startPercent}%`;
41117
+ trackElem.style.width = `${endPercent}%`;
41118
+ }
41119
+ if (startBtnElem) {
41120
+ startBtnElem.style.left = `${startPercent}%`;
41121
+ }
41122
+ if (endBtnElem) {
41123
+ endBtnElem.style.left = `${external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(startPercent + endPercent)}%`;
41124
+ }
41125
+ };
41126
+ const changeEvent = evnt => {
41127
+ const {
41128
+ range
41129
+ } = props;
41130
+ const {
41131
+ startValue,
41132
+ endValue
41133
+ } = reactData;
41134
+ const value = range ? [startValue, endValue].sort() : endValue;
41135
+ emitModel(value);
41136
+ dispatchEvent('change', {
41137
+ value
41138
+ }, evnt);
41139
+ // 自动更新校验状态
41140
+ if ($xeForm && formItemInfo) {
41141
+ $xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
41142
+ }
41143
+ };
41144
+ const handleMousedownEvent = (evnt, isEnd) => {
41145
+ const formReadonly = computeFormReadonly.value;
41146
+ const isDisabled = computeIsDisabled.value;
41147
+ const maxNum = computeMaxNum.value;
41148
+ const minNum = computeMinNum.value;
41149
+ if (!(formReadonly || isDisabled)) {
41150
+ evnt.preventDefault();
41151
+ const domMousemove = document.onmousemove;
41152
+ const domMouseup = document.onmouseup;
41153
+ document.onmousemove = evnt => {
41154
+ evnt.preventDefault();
41155
+ const barElem = refBarElem.value;
41156
+ if (barElem) {
41157
+ const barRect = barElem.getBoundingClientRect();
41158
+ const trackWidth = (evnt.clientX - barRect.left) / 914;
41159
+ if (isEnd) {
41160
+ reactData.endValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(Math.max(minNum, Math.min(maxNum, trackWidth * (maxNum - minNum) + minNum)));
41161
+ } else {
41162
+ reactData.startValue = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(Math.max(minNum, Math.min(maxNum, trackWidth * (maxNum - minNum))));
41163
+ }
41164
+ }
41165
+ updateBarStyle();
41166
+ };
41167
+ document.onmouseup = evnt => {
41168
+ document.onmousemove = domMousemove;
41169
+ document.onmouseup = domMouseup;
41170
+ changeEvent(evnt);
41171
+ updateBarStyle();
41172
+ };
41173
+ }
41174
+ };
41175
+ const handleStartMousedownEvent = evnt => {
41176
+ const endBtnElem = refEndBtnElem.value;
41177
+ const startBtnElem = evnt.currentTarget;
41178
+ handleMousedownEvent(evnt, endBtnElem ? endBtnElem.offsetLeft < startBtnElem.offsetLeft : false);
41179
+ };
41180
+ const handleEndMousedownEvent = evnt => {
41181
+ const startBtnElem = refStartBtnElem.value;
41182
+ const endBtnElem = evnt.currentTarget;
41183
+ handleMousedownEvent(evnt, startBtnElem ? endBtnElem.offsetLeft > startBtnElem.offsetLeft : true);
41184
+ };
40990
41185
  const collapsePanePrivateMethods = {};
40991
41186
  Object.assign($xeSlider, collapsePaneMethods, collapsePanePrivateMethods);
40992
41187
  const renderVN = () => {
41188
+ const {
41189
+ vertical,
41190
+ range
41191
+ } = props;
41192
+ const vSize = computeSize.value;
41193
+ const formReadonly = computeFormReadonly.value;
41194
+ const isDisabled = computeIsDisabled.value;
40993
41195
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
40994
41196
  ref: refElem,
40995
- class: 'vxe-slider'
40996
- }, []);
41197
+ class: ['vxe-slider', {
41198
+ [`size--${vSize}`]: vSize,
41199
+ 'is--vertical': vertical,
41200
+ 'is--readonly': formReadonly,
41201
+ 'is--disabled': isDisabled
41202
+ }]
41203
+ }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
41204
+ class: 'vxe-slider--inner'
41205
+ }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
41206
+ ref: refBarElem,
41207
+ class: 'vxe-slider--bar-wrapper'
41208
+ }), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
41209
+ ref: refTrackElem,
41210
+ class: 'vxe-slider--bar-track'
41211
+ }), formReadonly || !range ? renderEmptyElement($xeSlider) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
41212
+ ref: refStartBtnElem,
41213
+ class: 'vxe-slider--bar-btn vxe-slider--start-btn',
41214
+ onMousedown: handleStartMousedownEvent
41215
+ }), formReadonly ? renderEmptyElement($xeSlider) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
41216
+ ref: refEndBtnElem,
41217
+ class: 'vxe-slider--bar-btn vxe-slider--end-btn',
41218
+ onMousedown: handleEndMousedownEvent
41219
+ })])]);
40997
41220
  };
41221
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.modelValue, () => {
41222
+ updateModel();
41223
+ });
41224
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.onMounted)(() => {
41225
+ updateBarStyle();
41226
+ });
41227
+ updateModel();
40998
41228
  $xeSlider.renderVN = renderVN;
40999
41229
  return $xeSlider;
41000
41230
  },