xt-element-ui 2.1.72 → 2.2.0
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/lib/index.common.js +267 -61
- package/lib/index.css +1 -1
- package/lib/index.umd.js +267 -61
- package/lib/index.umd.min.js +1 -1
- package/lib/xt-badge/demo.html +10 -0
- package/lib/xt-badge/index.js +1 -0
- package/lib/xt-badge/xt-badge.common.js +335 -0
- package/lib/xt-badge/xt-badge.css +1 -0
- package/lib/xt-badge/xt-badge.umd.js +345 -0
- package/lib/xt-badge/xt-badge.umd.min.js +1 -0
- package/lib/xt-button/demo.html +10 -0
- package/lib/xt-button/index.js +1 -0
- package/lib/xt-button/xt-button.common.js +331 -0
- package/lib/xt-button/xt-button.css +1 -0
- package/lib/xt-button/xt-button.umd.js +341 -0
- package/lib/xt-button/xt-button.umd.min.js +1 -0
- package/lib/xt-card/demo.html +10 -0
- package/lib/xt-card/index.js +1 -0
- package/lib/xt-card/xt-card.common.js +325 -0
- package/lib/xt-card/xt-card.css +1 -0
- package/lib/xt-card/xt-card.umd.js +335 -0
- package/lib/xt-card/xt-card.umd.min.js +1 -0
- package/lib/xt-card-item/demo.html +10 -0
- package/lib/xt-card-item/index.js +1 -0
- package/lib/xt-card-item/xt-card-item.common.js +291 -0
- package/lib/xt-card-item/xt-card-item.css +1 -0
- package/lib/xt-card-item/xt-card-item.umd.js +301 -0
- package/lib/xt-card-item/xt-card-item.umd.min.js +1 -0
- package/lib/xt-chart/demo.html +10 -0
- package/lib/xt-chart/index.js +1 -0
- package/lib/xt-chart/xt-chart.common.js +109203 -0
- package/lib/xt-chart/xt-chart.css +1 -0
- package/lib/xt-chart/xt-chart.umd.js +109213 -0
- package/lib/xt-chart/xt-chart.umd.min.js +1 -0
- package/lib/xt-config-provider/demo.html +10 -0
- package/lib/xt-config-provider/index.js +1 -0
- package/lib/xt-config-provider/xt-config-provider.common.js +108388 -0
- package/lib/xt-config-provider/xt-config-provider.css +1 -0
- package/lib/xt-config-provider/xt-config-provider.umd.js +108398 -0
- package/lib/xt-config-provider/xt-config-provider.umd.min.js +1 -0
- package/lib/xt-date-picker/demo.html +10 -0
- package/lib/xt-date-picker/index.js +1 -0
- package/lib/xt-date-picker/xt-date-picker.common.js +768 -0
- package/lib/xt-date-picker/xt-date-picker.css +1 -0
- package/lib/xt-date-picker/xt-date-picker.umd.js +778 -0
- package/lib/xt-date-picker/xt-date-picker.umd.min.js +1 -0
- package/lib/xt-flex-box/demo.html +10 -0
- package/lib/xt-flex-box/index.js +1 -0
- package/lib/xt-flex-box/xt-flex-box.common.js +303 -0
- package/lib/xt-flex-box/xt-flex-box.css +1 -0
- package/lib/xt-flex-box/xt-flex-box.umd.js +313 -0
- package/lib/xt-flex-box/xt-flex-box.umd.min.js +1 -0
- package/lib/xt-form-schema/demo.html +10 -0
- package/lib/xt-form-schema/index.js +1 -0
- package/lib/xt-form-schema/xt-form-schema.common.js +510 -0
- package/lib/xt-form-schema/xt-form-schema.css +1 -0
- package/lib/xt-form-schema/xt-form-schema.umd.js +520 -0
- package/lib/xt-form-schema/xt-form-schema.umd.min.js +1 -0
- package/lib/xt-grid-box/demo.html +10 -0
- package/lib/xt-grid-box/index.js +1 -0
- package/lib/xt-grid-box/xt-grid-box.common.js +404 -0
- package/lib/xt-grid-box/xt-grid-box.css +1 -0
- package/lib/xt-grid-box/xt-grid-box.umd.js +414 -0
- package/lib/xt-grid-box/xt-grid-box.umd.min.js +1 -0
- package/lib/xt-grid-item/demo.html +10 -0
- package/lib/xt-grid-item/index.js +1 -0
- package/lib/xt-grid-item/xt-grid-item.common.js +381 -0
- package/lib/xt-grid-item/xt-grid-item.css +1 -0
- package/lib/xt-grid-item/xt-grid-item.umd.js +391 -0
- package/lib/xt-grid-item/xt-grid-item.umd.min.js +1 -0
- package/lib/xt-icon/demo.html +10 -0
- package/lib/xt-icon/index.js +1 -0
- package/lib/xt-icon/xt-icon.common.js +430 -0
- package/lib/xt-icon/xt-icon.css +1 -0
- package/lib/xt-icon/xt-icon.umd.js +440 -0
- package/lib/xt-icon/xt-icon.umd.min.js +1 -0
- package/lib/xt-input/demo.html +10 -0
- package/lib/xt-input/index.js +1 -0
- package/lib/xt-input/xt-input.common.js +584 -0
- package/lib/xt-input/xt-input.css +1 -0
- package/lib/xt-input/xt-input.umd.js +594 -0
- package/lib/xt-input/xt-input.umd.min.js +1 -0
- package/lib/xt-list/demo.html +10 -0
- package/lib/xt-list/index.js +1 -0
- package/lib/xt-list/xt-list.common.js +714 -0
- package/lib/xt-list/xt-list.css +1 -0
- package/lib/xt-list/xt-list.umd.js +724 -0
- package/lib/xt-list/xt-list.umd.min.js +1 -0
- package/lib/xt-map/demo.html +10 -0
- package/lib/xt-map/index.js +1 -0
- package/lib/xt-map/xt-map.common.js +1951 -0
- package/lib/xt-map/xt-map.css +1 -0
- package/lib/xt-map/xt-map.umd.js +1961 -0
- package/lib/xt-map/xt-map.umd.min.js +1 -0
- package/lib/xt-map-provider/demo.html +10 -0
- package/lib/xt-map-provider/index.js +1 -0
- package/lib/xt-map-provider/xt-map-provider.common.js +644 -0
- package/lib/xt-map-provider/xt-map-provider.css +1 -0
- package/lib/xt-map-provider/xt-map-provider.umd.js +654 -0
- package/lib/xt-map-provider/xt-map-provider.umd.min.js +1 -0
- package/lib/xt-page/demo.html +10 -0
- package/lib/xt-page/index.js +1 -0
- package/lib/xt-page/xt-page.common.js +353 -0
- package/lib/xt-page/xt-page.css +1 -0
- package/lib/xt-page/xt-page.umd.js +363 -0
- package/lib/xt-page/xt-page.umd.min.js +1 -0
- package/lib/xt-progress/demo.html +10 -0
- package/lib/xt-progress/index.js +1 -0
- package/lib/xt-progress/xt-progress.common.js +327 -0
- package/lib/xt-progress/xt-progress.css +1 -0
- package/lib/xt-progress/xt-progress.umd.js +337 -0
- package/lib/xt-progress/xt-progress.umd.min.js +1 -0
- package/lib/xt-scroll-arrow/demo.html +10 -0
- package/lib/xt-scroll-arrow/index.js +1 -0
- package/lib/xt-scroll-arrow/xt-scroll-arrow.common.js +495 -0
- package/lib/xt-scroll-arrow/xt-scroll-arrow.css +1 -0
- package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.js +505 -0
- package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.min.js +1 -0
- package/lib/xt-select-tree/demo.html +10 -0
- package/lib/xt-select-tree/index.js +1 -0
- package/lib/xt-select-tree/xt-select-tree.common.js +1791 -0
- package/lib/xt-select-tree/xt-select-tree.css +1 -0
- package/lib/xt-select-tree/xt-select-tree.umd.js +1801 -0
- package/lib/xt-select-tree/xt-select-tree.umd.min.js +1 -0
- package/lib/xt-step-price/demo.html +10 -0
- package/lib/xt-step-price/index.js +1 -0
- package/lib/xt-step-price/xt-step-price.common.js +800 -0
- package/lib/xt-step-price/xt-step-price.css +1 -0
- package/lib/xt-step-price/xt-step-price.umd.js +810 -0
- package/lib/xt-step-price/xt-step-price.umd.min.js +1 -0
- package/lib/xt-step-price-item/demo.html +10 -0
- package/lib/xt-step-price-item/index.js +1 -0
- package/lib/xt-step-price-item/xt-step-price-item.common.js +417 -0
- package/lib/xt-step-price-item/xt-step-price-item.umd.js +427 -0
- package/lib/xt-step-price-item/xt-step-price-item.umd.min.js +1 -0
- package/lib/xt-tab-pane/demo.html +10 -0
- package/lib/xt-tab-pane/index.js +1 -0
- package/lib/xt-tab-pane/xt-tab-pane.common.js +309 -0
- package/lib/xt-tab-pane/xt-tab-pane.umd.js +319 -0
- package/lib/xt-tab-pane/xt-tab-pane.umd.min.js +1 -0
- package/lib/xt-table/demo.html +10 -0
- package/lib/xt-table/index.js +1 -0
- package/lib/xt-table/xt-table.common.js +1027 -0
- package/lib/xt-table/xt-table.css +1 -0
- package/lib/xt-table/xt-table.umd.js +1037 -0
- package/lib/xt-table/xt-table.umd.min.js +1 -0
- package/lib/xt-tabs/demo.html +10 -0
- package/lib/xt-tabs/index.js +1 -0
- package/lib/xt-tabs/xt-tabs.common.js +463 -0
- package/lib/xt-tabs/xt-tabs.css +1 -0
- package/lib/xt-tabs/xt-tabs.umd.js +473 -0
- package/lib/xt-tabs/xt-tabs.umd.min.js +1 -0
- package/lib/xt-text/demo.html +10 -0
- package/lib/xt-text/index.js +1 -0
- package/lib/xt-text/xt-text.common.js +536 -0
- package/lib/xt-text/xt-text.css +1 -0
- package/lib/xt-text/xt-text.umd.js +546 -0
- package/lib/xt-text/xt-text.umd.min.js +1 -0
- package/lib/xt-time/demo.html +10 -0
- package/lib/xt-time/index.js +1 -0
- package/lib/xt-time/xt-time.common.js +555 -0
- package/lib/xt-time/xt-time.css +1 -0
- package/lib/xt-time/xt-time.umd.js +565 -0
- package/lib/xt-time/xt-time.umd.min.js +1 -0
- package/lib/xt-transfer-tree/demo.html +10 -0
- package/lib/xt-transfer-tree/index.js +1 -0
- package/lib/xt-transfer-tree/xt-transfer-tree.common.js +594 -0
- package/lib/xt-transfer-tree/xt-transfer-tree.css +1 -0
- package/lib/xt-transfer-tree/xt-transfer-tree.umd.js +604 -0
- package/lib/xt-transfer-tree/xt-transfer-tree.umd.min.js +1 -0
- package/lib/xt-upload/demo.html +10 -0
- package/lib/xt-upload/index.js +1 -0
- package/lib/xt-upload/xt-upload.common.js +1292 -0
- package/lib/xt-upload/xt-upload.css +1 -0
- package/lib/xt-upload/xt-upload.umd.js +1302 -0
- package/lib/xt-upload/xt-upload.umd.min.js +1 -0
- package/package.json +4 -2
- package/src/components/xt-badge/index.js +8 -7
- package/src/components/xt-button/index.js +1 -0
- package/src/components/xt-card/index.js +1 -0
- package/src/components/xt-card-item/index.js +1 -0
- package/src/components/xt-config-provider/index.js +1 -0
- package/src/components/xt-flex-box/index.js +1 -0
- package/src/components/xt-grid-box/index.js +1 -0
- package/src/components/xt-icon/index.js +1 -0
- package/src/components/xt-input/index.js +1 -0
- package/src/components/xt-map/index.js +1 -0
- package/src/components/xt-progress/index.js +8 -7
- package/src/components/xt-scroll-arrow/index.js +8 -7
- package/src/components/xt-step-price/index.js +1 -0
- package/src/components/xt-tabs/index.js +9 -8
- package/src/components/xt-text/index.js +1 -0
- package/src/components/xt-time/index.js +1 -0
- package/src/index.js +32 -2
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["xt-step-price"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["xt-step-price"] = factory();
|
|
10
|
+
})((typeof self !== 'undefined' ? self : this), function() {
|
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
12
|
+
/******/ // The module cache
|
|
13
|
+
/******/ var installedModules = {};
|
|
14
|
+
/******/
|
|
15
|
+
/******/ // The require function
|
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
|
17
|
+
/******/
|
|
18
|
+
/******/ // Check if module is in cache
|
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
|
21
|
+
/******/ }
|
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
|
24
|
+
/******/ i: moduleId,
|
|
25
|
+
/******/ l: false,
|
|
26
|
+
/******/ exports: {}
|
|
27
|
+
/******/ };
|
|
28
|
+
/******/
|
|
29
|
+
/******/ // Execute the module function
|
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
+
/******/
|
|
32
|
+
/******/ // Flag the module as loaded
|
|
33
|
+
/******/ module.l = true;
|
|
34
|
+
/******/
|
|
35
|
+
/******/ // Return the exports of the module
|
|
36
|
+
/******/ return module.exports;
|
|
37
|
+
/******/ }
|
|
38
|
+
/******/
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
+
/******/ __webpack_require__.m = modules;
|
|
42
|
+
/******/
|
|
43
|
+
/******/ // expose the module cache
|
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
|
45
|
+
/******/
|
|
46
|
+
/******/ // define getter function for harmony exports
|
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
+
/******/ }
|
|
51
|
+
/******/ };
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // define __esModule on exports
|
|
54
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
+
/******/ }
|
|
58
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
+
/******/ };
|
|
60
|
+
/******/
|
|
61
|
+
/******/ // create a fake namespace object
|
|
62
|
+
/******/ // mode & 1: value is a module id, require it
|
|
63
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
+
/******/ // mode & 4: return value when already ns object
|
|
65
|
+
/******/ // mode & 8|1: behave like require
|
|
66
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
+
/******/ if(mode & 8) return value;
|
|
69
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
+
/******/ var ns = Object.create(null);
|
|
71
|
+
/******/ __webpack_require__.r(ns);
|
|
72
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
+
/******/ return ns;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
+
/******/ __webpack_require__.n = function(module) {
|
|
79
|
+
/******/ var getter = module && module.__esModule ?
|
|
80
|
+
/******/ function getDefault() { return module['default']; } :
|
|
81
|
+
/******/ function getModuleExports() { return module; };
|
|
82
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
+
/******/ return getter;
|
|
84
|
+
/******/ };
|
|
85
|
+
/******/
|
|
86
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // __webpack_public_path__
|
|
90
|
+
/******/ __webpack_require__.p = "";
|
|
91
|
+
/******/
|
|
92
|
+
/******/
|
|
93
|
+
/******/ // Load entry module and return exports
|
|
94
|
+
/******/ return __webpack_require__(__webpack_require__.s = "fb15");
|
|
95
|
+
/******/ })
|
|
96
|
+
/************************************************************************/
|
|
97
|
+
/******/ ({
|
|
98
|
+
|
|
99
|
+
/***/ "fb15":
|
|
100
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
101
|
+
|
|
102
|
+
"use strict";
|
|
103
|
+
// ESM COMPAT FLAG
|
|
104
|
+
__webpack_require__.r(__webpack_exports__);
|
|
105
|
+
|
|
106
|
+
// EXPORTS
|
|
107
|
+
__webpack_require__.d(__webpack_exports__, "XtStepPrice", function() { return /* reexport */ xt_step_price; });
|
|
108
|
+
__webpack_require__.d(__webpack_exports__, "XtStepPriceItem", function() { return /* reexport */ xt_step_price_item; });
|
|
109
|
+
|
|
110
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
|
|
111
|
+
// This file is imported into lib/wc client bundles.
|
|
112
|
+
|
|
113
|
+
if (typeof window !== 'undefined') {
|
|
114
|
+
var currentScript = window.document.currentScript
|
|
115
|
+
if (false) { var getCurrentScript; }
|
|
116
|
+
|
|
117
|
+
var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
|
|
118
|
+
if (src) {
|
|
119
|
+
__webpack_require__.p = src[1] // eslint-disable-line
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Indicate to webpack that this file can be concatenated
|
|
124
|
+
/* harmony default export */ var setPublicPath = (null);
|
|
125
|
+
|
|
126
|
+
// EXTERNAL MODULE: ./src/components/xt-step-price/style/index.scss
|
|
127
|
+
var style = __webpack_require__("fd93");
|
|
128
|
+
|
|
129
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"b8cd9b04-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price/index.vue?vue&type=template&id=0cb332f3
|
|
130
|
+
var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-step-price",class:{ 'is-disabled': _vm.disabled }},[(_vm.title || _vm.$slots.header)?_c('div',{staticClass:"xt-step-price__header"},[(_vm.title)?_c('xt-text',{attrs:{"bold":"","size":"medium"}},[_vm._v(_vm._s(_vm.title))]):_vm._e(),_vm._t("header"),(!_vm.disabled && !_vm.isLimitReached)?_c('xt-button',{attrs:{"type":"primary","size":"small","icon":"el-icon-plus","plain":""},on:{"click":_vm.onAdd}},[_vm._v("新增"+_vm._s(_vm.stepName))]):_vm._e(),(_vm.isLimitReached)?_c('xt-text',{attrs:{"size":"small","type-color":"info"}},[_vm._v("已达上限("+_vm._s(_vm.localItems.length)+"/"+_vm._s(_vm.limit)+")")]):_vm._e()],2):_vm._e(),_c('div',{staticClass:"xt-step-price__list"},_vm._l((_vm.localItems),function(item,idx){return _c('XtStepPriceItem',{key:idx,attrs:{"value":item,"index":idx,"is-first":idx === 0,"is-last":idx === _vm.localItems.length - 1,"items-length":_vm.localItems.length,"removable":idx !== 0,"min-locked":idx !== 0 ? true : false,"unit":_vm.unit,"precision":_vm.precision,"step-name":_vm.stepName,"step":_vm.step,"left-bracket":_vm.leftBracket,"right-bracket":_vm.rightBracket,"field-keys":_vm.fieldKeys,"disabled":_vm.disabled,"allow-negative":_vm.allowNegative},on:{"input":(val) => _vm.onItemInput(val, idx),"max-change":_vm.onMaxChange,"min-change":_vm.onMinChange,"delete":_vm.onDelete,"blur":_vm.onFieldBlur}})}),1),(_vm.localItems.length === 0)?_c('div',{staticClass:"xt-step-price__empty"},[_c('span',[_vm._v("暂无数据,点击右上角「新增"+_vm._s(_vm.stepName)+"」开始配置")])]):_vm._e(),(_vm.tip || _vm.$slots.tip)?_c('div',{staticClass:"xt-step-price__tip"},[_vm._t("tip",function(){return [_c('xt-text',{attrs:{"size":"small","type-color":"warning"}},[_vm._v(_vm._s(_vm.tip))])]})],2):_vm._e()])
|
|
131
|
+
}
|
|
132
|
+
var staticRenderFns = []
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price/index.vue?vue&type=template&id=0cb332f3
|
|
136
|
+
|
|
137
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"b8cd9b04-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--5!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price-item/index.vue?vue&type=template&id=4d5bb3b1
|
|
138
|
+
var xt_step_price_itemvue_type_template_id_4d5bb3b1_render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:"xt-step-price-item"},[_c('div',{staticClass:"xt-step-price-item__range"},[_c('span',{staticClass:"xt-step-price-item__bracket"},[_vm._v(_vm._s(_vm.finalLeftBracket))]),(_vm.itemsLength > 1)?_c('span',{staticClass:"xt-step-price-item__name"},[_vm._v("第"+_vm._s(_vm.index + 1)+_vm._s(_vm.stepName))]):_vm._e(),_c('span',{staticClass:"xt-step-price-item__bracket"},[_vm._v(_vm._s(_vm.finalRightBracket))]),_c('xt-input',{staticClass:"xt-step-price-item__input",attrs:{"disabled":_vm.disabled || _vm.minLocked,"size":"small","placeholder":"下限"},on:{"blur":(e) => { _vm.onMinBlur(); _vm.onBlur(e) }},model:{value:(_vm.minInput),callback:function ($$v) {_vm.minInput=_vm._n($$v)},expression:"minInput"}}),_c('span',{staticClass:"xt-step-price-item__comma"},[_vm._v("-")]),(!_vm.isLast)?_c('xt-input',{staticClass:"xt-step-price-item__input",attrs:{"type":"number","disabled":_vm.disabled,"size":"small","placeholder":"上限"},on:{"blur":(e) => { _vm.onMaxBlur(); _vm.onBlur(e) }},model:{value:(_vm.maxInput),callback:function ($$v) {_vm.maxInput=_vm._n($$v)},expression:"maxInput"}}):_c('span',{staticClass:"xt-step-price-item__infinity"},[_vm._v("+∞")])],1),_c('div',{staticClass:"xt-step-price-item__price"},[_c('xt-input',{staticClass:"xt-step-price-item__input xt-step-price-item__input--price",attrs:{"type":"number","disabled":_vm.disabled,"size":"small","placeholder":"价格"},on:{"blur":(e) => { _vm.onPriceBlur(); _vm.onBlur(e) }},model:{value:(_vm.priceInput),callback:function ($$v) {_vm.priceInput=_vm._n($$v)},expression:"priceInput"}}),_c('span',{staticClass:"xt-step-price-item__unit"},[_vm._v(_vm._s(_vm.unit))])],1),(!_vm.disabled && _vm.removable && _vm.itemsLength > 1)?_c('xt-button',{staticClass:"xt-step-price-item__delete",attrs:{"type":"text","icon":"el-icon-delete"},on:{"click":_vm.onDelete}}):_vm._e()],1)
|
|
139
|
+
}
|
|
140
|
+
var xt_step_price_itemvue_type_template_id_4d5bb3b1_staticRenderFns = []
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price-item/index.vue?vue&type=template&id=4d5bb3b1
|
|
144
|
+
|
|
145
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price-item/index.vue?vue&type=script&lang=js
|
|
146
|
+
|
|
147
|
+
/* harmony default export */ var xt_step_price_itemvue_type_script_lang_js = ({
|
|
148
|
+
name: 'XtStepPriceItem',
|
|
149
|
+
|
|
150
|
+
props: {
|
|
151
|
+
value: {
|
|
152
|
+
type: Object,
|
|
153
|
+
required: true,
|
|
154
|
+
default: () => ({ min: 0, max: null, price: 0 })
|
|
155
|
+
},
|
|
156
|
+
stepName: { type: String, default: '阶梯' },
|
|
157
|
+
index: { type: Number, default: 0 },
|
|
158
|
+
isFirst: { type: Boolean, default: false },
|
|
159
|
+
isLast: { type: Boolean, default: false },
|
|
160
|
+
itemsLength: { type: Number, default: 1 },
|
|
161
|
+
removable: { type: Boolean, default: true },
|
|
162
|
+
disabled: { type: Boolean, default: false },
|
|
163
|
+
allowNegative: { type: Boolean, default: false },
|
|
164
|
+
minLocked: { type: Boolean, default: false },
|
|
165
|
+
unit: { type: String, default: '元' },
|
|
166
|
+
precision: { type: Number, default: 2 },
|
|
167
|
+
// 阶梯增量:控制新增/校正时的区间跨度,默认 1
|
|
168
|
+
step: { type: Number, default: 1 },
|
|
169
|
+
// 左括号:默认 '[',传空则不显示
|
|
170
|
+
leftBracket: { type: String, default: '[' },
|
|
171
|
+
// 右括号:默认 null,走内置规则(只有1条为 ']',多条为 ')');传值则强制使用
|
|
172
|
+
rightBracket: { type: String, default: null },
|
|
173
|
+
// 字段名映射:{ min, max, price },允许传入的 value 使用自定义字段名
|
|
174
|
+
fieldKeys: {
|
|
175
|
+
type: Object,
|
|
176
|
+
default: () => ({ min: 'min', max: 'max', price: 'price' })
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
computed: {
|
|
181
|
+
keyMin() { return (this.fieldKeys && this.fieldKeys.min) || 'min' },
|
|
182
|
+
keyMax() { return (this.fieldKeys && this.fieldKeys.max) || 'max' },
|
|
183
|
+
keyPrice() { return (this.fieldKeys && this.fieldKeys.price) || 'price' },
|
|
184
|
+
finalRightBracket() {
|
|
185
|
+
if (this.rightBracket !== null && this.rightBracket !== undefined && this.rightBracket !== '') return this.rightBracket
|
|
186
|
+
return this.isLast ? ']' : ')'
|
|
187
|
+
},
|
|
188
|
+
finalLeftBracket() {
|
|
189
|
+
return (this.leftBracket === null || this.leftBracket === undefined) ? '[' : this.leftBracket
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
data() {
|
|
194
|
+
const { minVal, maxVal, priceVal } = this.getPriceItem(this.value)
|
|
195
|
+
return {
|
|
196
|
+
minInput: minVal,
|
|
197
|
+
maxInput: maxVal,
|
|
198
|
+
priceInput: priceVal
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
watch: {
|
|
203
|
+
value: {
|
|
204
|
+
deep: true,
|
|
205
|
+
immediate: true,
|
|
206
|
+
handler(val) {
|
|
207
|
+
const { minVal, maxVal, priceVal } = this.getPriceItem(val)
|
|
208
|
+
this.minInput = minVal
|
|
209
|
+
this.maxInput = maxVal
|
|
210
|
+
this.priceInput = priceVal
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
isLast(val) {
|
|
214
|
+
if (val) {
|
|
215
|
+
this.maxInput = null
|
|
216
|
+
} else {
|
|
217
|
+
const minVal = this.safeNumber(this.minInput, 0)
|
|
218
|
+
const v = this.value
|
|
219
|
+
this.maxInput = this.safeNumber(v && v[this.keyMax], minVal + 1)
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
methods: {
|
|
225
|
+
getPriceItem(value) {
|
|
226
|
+
const v = value
|
|
227
|
+
const minVal = this.safeNumber(v && v[this.keyMin], 0)
|
|
228
|
+
const maxVal = this.isLast ? null : this.safeNumber(v && v[this.keyMax], minVal + 1)
|
|
229
|
+
const priceVal = this.safeNumber(v && v[this.keyPrice], 0)
|
|
230
|
+
return {
|
|
231
|
+
minVal,
|
|
232
|
+
maxVal,
|
|
233
|
+
priceVal
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
// 统一兜底:非数字输入一律转为 fallback(默认 0)
|
|
237
|
+
safeNumber(v, fallback = 0) {
|
|
238
|
+
if (v === null || v === undefined || v === '' || v === Infinity || v === -Infinity) return fallback
|
|
239
|
+
const n = Number(v)
|
|
240
|
+
return isNaN(n) ? fallback : n
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
emitChange(partial) {
|
|
244
|
+
const next = {
|
|
245
|
+
[this.keyMin]: this.minInput,
|
|
246
|
+
[this.keyMax]: this.isLast ? null : this.maxInput,
|
|
247
|
+
[this.keyPrice]: this.priceInput,
|
|
248
|
+
...partial
|
|
249
|
+
}
|
|
250
|
+
this.$emit('input', next)
|
|
251
|
+
this.$emit('change', next, this.index)
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
onMinBlur() {
|
|
255
|
+
let v = this.safeNumber(this.minInput, 0)
|
|
256
|
+
if (v !== 0) {
|
|
257
|
+
v = Number(v.toFixed(this.precision))
|
|
258
|
+
}
|
|
259
|
+
this.minInput = v
|
|
260
|
+
this.$emit('min-change', v, this.index)
|
|
261
|
+
this.emitChange({ [this.keyMin]: v })
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
onMaxBlur() {
|
|
265
|
+
if (this.isLast) return
|
|
266
|
+
const minVal = this.safeNumber(this.minInput, 0)
|
|
267
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
268
|
+
let v = this.safeNumber(this.maxInput, minVal + stepVal)
|
|
269
|
+
if (v <= minVal) v = minVal + stepVal
|
|
270
|
+
v = Number(v.toFixed(this.precision))
|
|
271
|
+
this.maxInput = v
|
|
272
|
+
this.$emit('max-change', v, this.index)
|
|
273
|
+
this.emitChange({ [this.keyMax]: v })
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
onPriceBlur() {
|
|
277
|
+
const rawVal = this.priceInput
|
|
278
|
+
if (rawVal === null || rawVal === undefined || rawVal === '' || isNaN(rawVal)) {
|
|
279
|
+
this.priceInput = ''
|
|
280
|
+
this.emitChange({ [this.keyPrice]: '' })
|
|
281
|
+
return
|
|
282
|
+
}
|
|
283
|
+
let v = this.safeNumber(rawVal, 0)
|
|
284
|
+
if (v < 0 && !this.allowNegative) v = 0
|
|
285
|
+
v = Number(v.toFixed(this.precision))
|
|
286
|
+
this.priceInput = v
|
|
287
|
+
this.emitChange({ [this.keyPrice]: v })
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
onBlur(e) {
|
|
291
|
+
this.$emit('blur', e)
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
onDelete() {
|
|
295
|
+
this.$emit('delete', this.index)
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price-item/index.vue?vue&type=script&lang=js
|
|
301
|
+
/* harmony default export */ var components_xt_step_price_itemvue_type_script_lang_js = (xt_step_price_itemvue_type_script_lang_js);
|
|
302
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
303
|
+
/* globals __VUE_SSR_CONTEXT__ */
|
|
304
|
+
|
|
305
|
+
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
|
|
306
|
+
// This module is a runtime utility for cleaner component module output and will
|
|
307
|
+
// be included in the final webpack user bundle.
|
|
308
|
+
|
|
309
|
+
function normalizeComponent(
|
|
310
|
+
scriptExports,
|
|
311
|
+
render,
|
|
312
|
+
staticRenderFns,
|
|
313
|
+
functionalTemplate,
|
|
314
|
+
injectStyles,
|
|
315
|
+
scopeId,
|
|
316
|
+
moduleIdentifier /* server only */,
|
|
317
|
+
shadowMode /* vue-cli only */
|
|
318
|
+
) {
|
|
319
|
+
// Vue.extend constructor export interop
|
|
320
|
+
var options =
|
|
321
|
+
typeof scriptExports === 'function' ? scriptExports.options : scriptExports
|
|
322
|
+
|
|
323
|
+
// render functions
|
|
324
|
+
if (render) {
|
|
325
|
+
options.render = render
|
|
326
|
+
options.staticRenderFns = staticRenderFns
|
|
327
|
+
options._compiled = true
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// functional template
|
|
331
|
+
if (functionalTemplate) {
|
|
332
|
+
options.functional = true
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// scopedId
|
|
336
|
+
if (scopeId) {
|
|
337
|
+
options._scopeId = 'data-v-' + scopeId
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
var hook
|
|
341
|
+
if (moduleIdentifier) {
|
|
342
|
+
// server build
|
|
343
|
+
hook = function (context) {
|
|
344
|
+
// 2.3 injection
|
|
345
|
+
context =
|
|
346
|
+
context || // cached call
|
|
347
|
+
(this.$vnode && this.$vnode.ssrContext) || // stateful
|
|
348
|
+
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
|
|
349
|
+
// 2.2 with runInNewContext: true
|
|
350
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
|
351
|
+
context = __VUE_SSR_CONTEXT__
|
|
352
|
+
}
|
|
353
|
+
// inject component styles
|
|
354
|
+
if (injectStyles) {
|
|
355
|
+
injectStyles.call(this, context)
|
|
356
|
+
}
|
|
357
|
+
// register component module identifier for async chunk inferrence
|
|
358
|
+
if (context && context._registeredComponents) {
|
|
359
|
+
context._registeredComponents.add(moduleIdentifier)
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
// used by ssr in case component is cached and beforeCreate
|
|
363
|
+
// never gets called
|
|
364
|
+
options._ssrRegister = hook
|
|
365
|
+
} else if (injectStyles) {
|
|
366
|
+
hook = shadowMode
|
|
367
|
+
? function () {
|
|
368
|
+
injectStyles.call(
|
|
369
|
+
this,
|
|
370
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
: injectStyles
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (hook) {
|
|
377
|
+
if (options.functional) {
|
|
378
|
+
// for template-only hot-reload because in that case the render fn doesn't
|
|
379
|
+
// go through the normalizer
|
|
380
|
+
options._injectStyles = hook
|
|
381
|
+
// register for functional component in vue file
|
|
382
|
+
var originalRender = options.render
|
|
383
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
384
|
+
hook.call(context)
|
|
385
|
+
return originalRender(h, context)
|
|
386
|
+
}
|
|
387
|
+
} else {
|
|
388
|
+
// inject component registration as beforeCreate hook
|
|
389
|
+
var existing = options.beforeCreate
|
|
390
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return {
|
|
395
|
+
exports: scriptExports,
|
|
396
|
+
options: options
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price-item/index.vue
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
/* normalize component */
|
|
407
|
+
|
|
408
|
+
var component = normalizeComponent(
|
|
409
|
+
components_xt_step_price_itemvue_type_script_lang_js,
|
|
410
|
+
xt_step_price_itemvue_type_template_id_4d5bb3b1_render,
|
|
411
|
+
xt_step_price_itemvue_type_template_id_4d5bb3b1_staticRenderFns,
|
|
412
|
+
false,
|
|
413
|
+
null,
|
|
414
|
+
null,
|
|
415
|
+
null
|
|
416
|
+
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
/* harmony default export */ var xt_step_price_item = (component.exports);
|
|
420
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-step-price/index.vue?vue&type=script&lang=js
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
/* harmony default export */ var xt_step_pricevue_type_script_lang_js = ({
|
|
425
|
+
name: 'XtStepPrice',
|
|
426
|
+
|
|
427
|
+
components: { XtStepPriceItem: xt_step_price_item },
|
|
428
|
+
|
|
429
|
+
inject: {
|
|
430
|
+
elFormItem: {
|
|
431
|
+
default: ''
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
computed: {
|
|
436
|
+
keyMin() { return (this.fieldKeys && this.fieldKeys.min) || 'min' },
|
|
437
|
+
keyMax() { return (this.fieldKeys && this.fieldKeys.max) || 'max' },
|
|
438
|
+
keyPrice() { return (this.fieldKeys && this.fieldKeys.price) || 'price' },
|
|
439
|
+
isLimitReached() {
|
|
440
|
+
const lim = Number(this.limit)
|
|
441
|
+
return lim > 0 && this.localItems.length >= lim
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
|
|
445
|
+
props: {
|
|
446
|
+
value: {
|
|
447
|
+
type: Array,
|
|
448
|
+
default: () => []
|
|
449
|
+
},
|
|
450
|
+
title: { type: String, default: '' },
|
|
451
|
+
unit: { type: String, default: '元' },
|
|
452
|
+
stepName: { type: String, default: '阶梯' },
|
|
453
|
+
precision: { type: Number, default: 2 },
|
|
454
|
+
// 左括号:默认 '[',传空字符串则不显示
|
|
455
|
+
leftBracket: { type: String, default: '[' },
|
|
456
|
+
// 右括号:默认 null,走内置逻辑(只有1条为 ']',多条为 ')');传具体值则强制使用
|
|
457
|
+
rightBracket: { type: String, default: null },
|
|
458
|
+
// 字段名映射:{ min, max, price },允许传入的 value 使用自定义字段名
|
|
459
|
+
fieldKeys: {
|
|
460
|
+
type: Object,
|
|
461
|
+
default: () => ({ min: 'min', max: 'max', price: 'price' })
|
|
462
|
+
},
|
|
463
|
+
// 阶梯数量上限;<= 0 表示不限制
|
|
464
|
+
limit: { type: Number, default: 0 },
|
|
465
|
+
// 阶梯增量:新增/校正时,下一条阶梯的 min = 当前 max = 当前 min + step(默认 1)
|
|
466
|
+
step: { type: Number, default: 10 },
|
|
467
|
+
disabled: { type: Boolean, default: false },
|
|
468
|
+
allowNegative: { type: Boolean, default: false },
|
|
469
|
+
tip: {
|
|
470
|
+
type: String,
|
|
471
|
+
default: '区间左闭右闭 [min, max],最后一级为 [min, +∞),保证连续且不重叠。'
|
|
472
|
+
},
|
|
473
|
+
// 默认初始值:当传入空数组时,是否自动生成首条默认阶梯 [0, +∞)
|
|
474
|
+
defaultFirst: { type: Boolean, default: true }
|
|
475
|
+
},
|
|
476
|
+
|
|
477
|
+
data() {
|
|
478
|
+
return {
|
|
479
|
+
localItems: this.normalize(this.value)
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
|
|
483
|
+
watch: {
|
|
484
|
+
value: {
|
|
485
|
+
deep: true,
|
|
486
|
+
immediate: true,
|
|
487
|
+
handler(val) {
|
|
488
|
+
this.localItems = this.normalize(val)
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
|
|
493
|
+
methods: {
|
|
494
|
+
// 统一数字转换:空值/非法值一律转为 fallback(默认 0)
|
|
495
|
+
safeNumber(v, fallback = 0) {
|
|
496
|
+
if (v === null || v === undefined || v === '' || v === Infinity || v === -Infinity) return fallback
|
|
497
|
+
const n = Number(v)
|
|
498
|
+
return isNaN(n) ? fallback : n
|
|
499
|
+
},
|
|
500
|
+
|
|
501
|
+
cloneItems(items) {
|
|
502
|
+
if (!Array.isArray(items)) return []
|
|
503
|
+
return items.map((it) => {
|
|
504
|
+
const price = (it && it[this.keyPrice])
|
|
505
|
+
return {
|
|
506
|
+
[this.keyMin]: this.safeNumber(it && it[this.keyMin], 0),
|
|
507
|
+
[this.keyMax]: (it && it[this.keyMax] == null) || (it && it[this.keyMax] === '') ? null : this.safeNumber(it[this.keyMax], null),
|
|
508
|
+
[this.keyPrice]: (price === null || price === undefined || price === '') ? '' : this.safeNumber(price, 0)
|
|
509
|
+
}
|
|
510
|
+
})
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
normalize(items) {
|
|
514
|
+
const list = this.cloneItems(items)
|
|
515
|
+
if (list.length === 0 && this.defaultFirst) {
|
|
516
|
+
list.push({ [this.keyMin]: 0, [this.keyMax]: null, [this.keyPrice]: 0 })
|
|
517
|
+
}
|
|
518
|
+
this.ensureContinuity(list)
|
|
519
|
+
return list
|
|
520
|
+
},
|
|
521
|
+
|
|
522
|
+
// 保证 items 连续且不重叠:items[i].max === items[i+1].min,首条 min === 0,末条 max === null
|
|
523
|
+
ensureContinuity(list) {
|
|
524
|
+
if (!Array.isArray(list) || list.length === 0) return
|
|
525
|
+
list[0][this.keyMin] = 0
|
|
526
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
527
|
+
|
|
528
|
+
for (let i = 0; i < list.length; i++) {
|
|
529
|
+
const cur = list[i]
|
|
530
|
+
const next = list[i + 1]
|
|
531
|
+
const curMin = this.safeNumber(cur[this.keyMin], 0)
|
|
532
|
+
if (next) {
|
|
533
|
+
let curMax = this.safeNumber(cur[this.keyMax], curMin + stepVal)
|
|
534
|
+
if (curMax <= curMin) curMax = curMin + stepVal
|
|
535
|
+
curMax = Number(curMax.toFixed(this.precision))
|
|
536
|
+
cur[this.keyMax] = curMax
|
|
537
|
+
next[this.keyMin] = curMax
|
|
538
|
+
} else {
|
|
539
|
+
cur[this.keyMax] = null
|
|
540
|
+
}
|
|
541
|
+
const price = cur[this.keyPrice]
|
|
542
|
+
cur[this.keyPrice] = (price === null || price === undefined || price === '') ? '' : this.safeNumber(price, 0)
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
|
|
546
|
+
emit() {
|
|
547
|
+
this.ensureContinuity(this.localItems)
|
|
548
|
+
const cloned = this.cloneItems(this.localItems)
|
|
549
|
+
this.$emit('input', cloned)
|
|
550
|
+
this.$emit('change', cloned)
|
|
551
|
+
this.dispatchFormEvent('el.form.change', cloned)
|
|
552
|
+
},
|
|
553
|
+
|
|
554
|
+
dispatchFormEvent(eventName, value) {
|
|
555
|
+
if (this.elFormItem) {
|
|
556
|
+
this.elFormItem.$emit(eventName, value)
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
|
|
560
|
+
onFieldBlur() {
|
|
561
|
+
this.dispatchFormEvent('el.form.blur', this.localItems)
|
|
562
|
+
},
|
|
563
|
+
|
|
564
|
+
validate(callback) {
|
|
565
|
+
const list = this.localItems
|
|
566
|
+
if (!Array.isArray(list) || list.length === 0) {
|
|
567
|
+
callback && callback(false, [{ field: 'stepPrice', message: `请配置${this.stepName}`, type: 'error' }])
|
|
568
|
+
return false
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
const errors = []
|
|
572
|
+
for (let i = 0; i < list.length; i++) {
|
|
573
|
+
const item = list[i]
|
|
574
|
+
const rawPrice = item[this.keyPrice]
|
|
575
|
+
const rawMin = item[this.keyMin]
|
|
576
|
+
const rawMax = item[this.keyMax]
|
|
577
|
+
const price = this.safeNumber(rawPrice, 0)
|
|
578
|
+
const min = this.safeNumber(rawMin, 0)
|
|
579
|
+
|
|
580
|
+
if (rawPrice === null || rawPrice === undefined || rawPrice === '') {
|
|
581
|
+
errors.push({
|
|
582
|
+
field: `stepPrice[${i}].price`,
|
|
583
|
+
message: `第${i + 1}${this.stepName}价格不能为空`,
|
|
584
|
+
type: 'error'
|
|
585
|
+
})
|
|
586
|
+
} else if (price < 0 && !this.allowNegative) {
|
|
587
|
+
errors.push({
|
|
588
|
+
field: `stepPrice[${i}].price`,
|
|
589
|
+
message: `第${i + 1}${this.stepName}价格不能为负数`,
|
|
590
|
+
type: 'error'
|
|
591
|
+
})
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
if (rawMin === null || rawMin === undefined || rawMin === '') {
|
|
595
|
+
errors.push({
|
|
596
|
+
field: `stepPrice[${i}].min`,
|
|
597
|
+
message: `第${i + 1}${this.stepName}下限不能为空`,
|
|
598
|
+
type: 'error'
|
|
599
|
+
})
|
|
600
|
+
} else if (min < 0 && !this.allowNegative) {
|
|
601
|
+
errors.push({
|
|
602
|
+
field: `stepPrice[${i}].min`,
|
|
603
|
+
message: `第${i + 1}${this.stepName}下限不能为负数`,
|
|
604
|
+
type: 'error'
|
|
605
|
+
})
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
if (!this.isLast(i)) {
|
|
609
|
+
if (rawMax === null || rawMax === undefined || rawMax === '') {
|
|
610
|
+
errors.push({
|
|
611
|
+
field: `stepPrice[${i}].max`,
|
|
612
|
+
message: `第${i + 1}${this.stepName}上限不能为空`,
|
|
613
|
+
type: 'error'
|
|
614
|
+
})
|
|
615
|
+
} else if (this.safeNumber(rawMax, 0) <= min) {
|
|
616
|
+
errors.push({
|
|
617
|
+
field: `stepPrice[${i}].max`,
|
|
618
|
+
message: `第${i + 1}${this.stepName}上限必须大于下限`,
|
|
619
|
+
type: 'error'
|
|
620
|
+
})
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
if (i > 0) {
|
|
625
|
+
const prev = list[i - 1]
|
|
626
|
+
const prevMax = prev[this.keyMax]
|
|
627
|
+
if (prevMax !== null && this.safeNumber(prevMax, 0) !== min) {
|
|
628
|
+
errors.push({
|
|
629
|
+
field: `stepPrice[${i}].min`,
|
|
630
|
+
message: `第${i + 1}${this.stepName}下限必须等于上一${this.stepName}上限`,
|
|
631
|
+
type: 'error'
|
|
632
|
+
})
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
if (errors.length > 0) {
|
|
638
|
+
callback && callback(false, errors)
|
|
639
|
+
return false
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
callback && callback(true)
|
|
643
|
+
return true
|
|
644
|
+
},
|
|
645
|
+
|
|
646
|
+
isLast(idx) {
|
|
647
|
+
return idx === this.localItems.length - 1
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
onItemInput(val, idx) {
|
|
651
|
+
const cur = this.localItems[idx]
|
|
652
|
+
if (!cur) return
|
|
653
|
+
if (val && val[this.keyPrice] !== undefined) {
|
|
654
|
+
const p = val[this.keyPrice]
|
|
655
|
+
if (p === null || p === undefined || p === '') {
|
|
656
|
+
cur[this.keyPrice] = ''
|
|
657
|
+
} else {
|
|
658
|
+
let num = this.safeNumber(p, 0)
|
|
659
|
+
num = Number(num.toFixed(this.precision))
|
|
660
|
+
cur[this.keyPrice] = num
|
|
661
|
+
}
|
|
662
|
+
this.emit()
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
|
|
666
|
+
onMaxChange(val, idx) {
|
|
667
|
+
const cur = this.localItems[idx]
|
|
668
|
+
if (!cur) return
|
|
669
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
670
|
+
let n = this.safeNumber(val, this.safeNumber(cur[this.keyMin], 0) + stepVal)
|
|
671
|
+
n = Number(n.toFixed(this.precision))
|
|
672
|
+
cur[this.keyMax] = n
|
|
673
|
+
const next = this.localItems[idx + 1]
|
|
674
|
+
if (next) next[this.keyMin] = n
|
|
675
|
+
this.emit()
|
|
676
|
+
},
|
|
677
|
+
|
|
678
|
+
onMinChange(val, idx) {
|
|
679
|
+
const cur = this.localItems[idx]
|
|
680
|
+
if (!cur) return
|
|
681
|
+
if (idx === 0) {
|
|
682
|
+
cur[this.keyMin] = 0
|
|
683
|
+
} else {
|
|
684
|
+
let n = this.safeNumber(val, this.safeNumber(cur[this.keyMin], 0))
|
|
685
|
+
if (n !== 0) {
|
|
686
|
+
n = Number(n.toFixed(this.precision))
|
|
687
|
+
}
|
|
688
|
+
cur[this.keyMin] = n
|
|
689
|
+
const prev = this.localItems[idx - 1]
|
|
690
|
+
if (prev) prev[this.keyMax] = n
|
|
691
|
+
}
|
|
692
|
+
this.emit()
|
|
693
|
+
},
|
|
694
|
+
|
|
695
|
+
onAdd() {
|
|
696
|
+
const list = this.localItems
|
|
697
|
+
const lim = Number(this.limit)
|
|
698
|
+
if (lim > 0 && list.length >= lim) return
|
|
699
|
+
const stepVal = this.safeNumber(this.step, 1)
|
|
700
|
+
|
|
701
|
+
// 场景 1:空数组 —— 直接 push 一条 [0, +∞)
|
|
702
|
+
if (list.length === 0) {
|
|
703
|
+
list.push({
|
|
704
|
+
[this.keyMin]: 0,
|
|
705
|
+
[this.keyMax]: null,
|
|
706
|
+
[this.keyPrice]: 10
|
|
707
|
+
})
|
|
708
|
+
this.emit()
|
|
709
|
+
return
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// 场景 2:已有数据 —— 在末条前插入新条,新条的 max = 末条 min + step
|
|
713
|
+
const last = list[list.length - 1]
|
|
714
|
+
const newMin = this.safeNumber(last[this.keyMin], 0)
|
|
715
|
+
const newMax = newMin + stepVal
|
|
716
|
+
|
|
717
|
+
// 新条 price:使用默认值,由用户自行填写
|
|
718
|
+
let newPrice = 0
|
|
719
|
+
|
|
720
|
+
const newArr = [
|
|
721
|
+
...list.slice(0, -1),
|
|
722
|
+
{
|
|
723
|
+
[this.keyMin]: newMin,
|
|
724
|
+
[this.keyMax]: newMax,
|
|
725
|
+
[this.keyPrice]: newPrice
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
[this.keyMin]: newMax,
|
|
729
|
+
[this.keyMax]: null,
|
|
730
|
+
[this.keyPrice]: newPrice
|
|
731
|
+
}
|
|
732
|
+
]
|
|
733
|
+
|
|
734
|
+
this.localItems = newArr
|
|
735
|
+
this.emit()
|
|
736
|
+
},
|
|
737
|
+
|
|
738
|
+
onDelete(idx) {
|
|
739
|
+
const list = this.localItems
|
|
740
|
+
if (list.length <= 1) return // 至少保留一条
|
|
741
|
+
if (idx === 0) return // 首条不允许删除,保证区间起点始终为 0
|
|
742
|
+
const cur = list[idx]
|
|
743
|
+
const prev = list[idx - 1]
|
|
744
|
+
const next = list[idx + 1]
|
|
745
|
+
if (prev && next) {
|
|
746
|
+
prev[this.keyMax] = cur[this.keyMax] == null ? null : Number(cur[this.keyMax])
|
|
747
|
+
} else if (prev && !next) {
|
|
748
|
+
prev[this.keyMax] = null
|
|
749
|
+
} else if (!prev && next) {
|
|
750
|
+
next[this.keyMin] = 0
|
|
751
|
+
}
|
|
752
|
+
list.splice(idx, 1)
|
|
753
|
+
this.emit()
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price/index.vue?vue&type=script&lang=js
|
|
759
|
+
/* harmony default export */ var components_xt_step_pricevue_type_script_lang_js = (xt_step_pricevue_type_script_lang_js);
|
|
760
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price/index.vue
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
/* normalize component */
|
|
767
|
+
|
|
768
|
+
var xt_step_price_component = normalizeComponent(
|
|
769
|
+
components_xt_step_pricevue_type_script_lang_js,
|
|
770
|
+
render,
|
|
771
|
+
staticRenderFns,
|
|
772
|
+
false,
|
|
773
|
+
null,
|
|
774
|
+
null,
|
|
775
|
+
null
|
|
776
|
+
|
|
777
|
+
)
|
|
778
|
+
|
|
779
|
+
/* harmony default export */ var xt_step_price = (xt_step_price_component.exports);
|
|
780
|
+
// CONCATENATED MODULE: ./src/components/xt-step-price/index.js
|
|
781
|
+
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
xt_step_price.install = function (Vue) {
|
|
786
|
+
Vue.component(xt_step_price.name, xt_step_price)
|
|
787
|
+
Vue.component(xt_step_price_item.name, xt_step_price_item)
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// 同时导出组件和 install 方法,支持多种引入方式
|
|
791
|
+
/* harmony default export */ var components_xt_step_price = (xt_step_price);
|
|
792
|
+
|
|
793
|
+
// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (components_xt_step_price);
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
/***/ }),
|
|
801
|
+
|
|
802
|
+
/***/ "fd93":
|
|
803
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
804
|
+
|
|
805
|
+
// extracted by mini-css-extract-plugin
|
|
806
|
+
|
|
807
|
+
/***/ })
|
|
808
|
+
|
|
809
|
+
/******/ });
|
|
810
|
+
});
|