xt-element-ui 2.1.61 → 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.
Files changed (202) hide show
  1. package/docs/components/base/xt-bar.md +5 -5
  2. package/docs/components/base/xt-chart.md +5 -5
  3. package/docs/components/base/xt-line.md +4 -4
  4. package/docs/components/base/xt-multi.md +5 -5
  5. package/docs/components/base/xt-pie.md +5 -5
  6. package/lib/index.common.js +503 -165
  7. package/lib/index.css +1 -1
  8. package/lib/index.umd.js +506 -168
  9. package/lib/index.umd.min.js +1 -1
  10. package/lib/xt-badge/demo.html +10 -0
  11. package/lib/xt-badge/index.js +1 -0
  12. package/lib/xt-badge/xt-badge.common.js +335 -0
  13. package/lib/xt-badge/xt-badge.css +1 -0
  14. package/lib/xt-badge/xt-badge.umd.js +345 -0
  15. package/lib/xt-badge/xt-badge.umd.min.js +1 -0
  16. package/lib/xt-button/demo.html +10 -0
  17. package/lib/xt-button/index.js +1 -0
  18. package/lib/xt-button/xt-button.common.js +331 -0
  19. package/lib/xt-button/xt-button.css +1 -0
  20. package/lib/xt-button/xt-button.umd.js +341 -0
  21. package/lib/xt-button/xt-button.umd.min.js +1 -0
  22. package/lib/xt-card/demo.html +10 -0
  23. package/lib/xt-card/index.js +1 -0
  24. package/lib/xt-card/xt-card.common.js +325 -0
  25. package/lib/xt-card/xt-card.css +1 -0
  26. package/lib/xt-card/xt-card.umd.js +335 -0
  27. package/lib/xt-card/xt-card.umd.min.js +1 -0
  28. package/lib/xt-card-item/demo.html +10 -0
  29. package/lib/xt-card-item/index.js +1 -0
  30. package/lib/xt-card-item/xt-card-item.common.js +291 -0
  31. package/lib/xt-card-item/xt-card-item.css +1 -0
  32. package/lib/xt-card-item/xt-card-item.umd.js +301 -0
  33. package/lib/xt-card-item/xt-card-item.umd.min.js +1 -0
  34. package/lib/xt-chart/demo.html +10 -0
  35. package/lib/xt-chart/index.js +1 -0
  36. package/lib/xt-chart/xt-chart.common.js +109203 -0
  37. package/lib/xt-chart/xt-chart.css +1 -0
  38. package/lib/xt-chart/xt-chart.umd.js +109213 -0
  39. package/lib/xt-chart/xt-chart.umd.min.js +1 -0
  40. package/lib/xt-config-provider/demo.html +10 -0
  41. package/lib/xt-config-provider/index.js +1 -0
  42. package/lib/xt-config-provider/xt-config-provider.common.js +108388 -0
  43. package/lib/xt-config-provider/xt-config-provider.css +1 -0
  44. package/lib/xt-config-provider/xt-config-provider.umd.js +108398 -0
  45. package/lib/xt-config-provider/xt-config-provider.umd.min.js +1 -0
  46. package/lib/xt-date-picker/demo.html +10 -0
  47. package/lib/xt-date-picker/index.js +1 -0
  48. package/lib/xt-date-picker/xt-date-picker.common.js +768 -0
  49. package/lib/xt-date-picker/xt-date-picker.css +1 -0
  50. package/lib/xt-date-picker/xt-date-picker.umd.js +778 -0
  51. package/lib/xt-date-picker/xt-date-picker.umd.min.js +1 -0
  52. package/lib/xt-flex-box/demo.html +10 -0
  53. package/lib/xt-flex-box/index.js +1 -0
  54. package/lib/xt-flex-box/xt-flex-box.common.js +303 -0
  55. package/lib/xt-flex-box/xt-flex-box.css +1 -0
  56. package/lib/xt-flex-box/xt-flex-box.umd.js +313 -0
  57. package/lib/xt-flex-box/xt-flex-box.umd.min.js +1 -0
  58. package/lib/xt-form-schema/demo.html +10 -0
  59. package/lib/xt-form-schema/index.js +1 -0
  60. package/lib/xt-form-schema/xt-form-schema.common.js +510 -0
  61. package/lib/xt-form-schema/xt-form-schema.css +1 -0
  62. package/lib/xt-form-schema/xt-form-schema.umd.js +520 -0
  63. package/lib/xt-form-schema/xt-form-schema.umd.min.js +1 -0
  64. package/lib/xt-grid-box/demo.html +10 -0
  65. package/lib/xt-grid-box/index.js +1 -0
  66. package/lib/xt-grid-box/xt-grid-box.common.js +404 -0
  67. package/lib/xt-grid-box/xt-grid-box.css +1 -0
  68. package/lib/xt-grid-box/xt-grid-box.umd.js +414 -0
  69. package/lib/xt-grid-box/xt-grid-box.umd.min.js +1 -0
  70. package/lib/xt-grid-item/demo.html +10 -0
  71. package/lib/xt-grid-item/index.js +1 -0
  72. package/lib/xt-grid-item/xt-grid-item.common.js +381 -0
  73. package/lib/xt-grid-item/xt-grid-item.css +1 -0
  74. package/lib/xt-grid-item/xt-grid-item.umd.js +391 -0
  75. package/lib/xt-grid-item/xt-grid-item.umd.min.js +1 -0
  76. package/lib/xt-icon/demo.html +10 -0
  77. package/lib/xt-icon/index.js +1 -0
  78. package/lib/xt-icon/xt-icon.common.js +430 -0
  79. package/lib/xt-icon/xt-icon.css +1 -0
  80. package/lib/xt-icon/xt-icon.umd.js +440 -0
  81. package/lib/xt-icon/xt-icon.umd.min.js +1 -0
  82. package/lib/xt-input/demo.html +10 -0
  83. package/lib/xt-input/index.js +1 -0
  84. package/lib/xt-input/xt-input.common.js +584 -0
  85. package/lib/xt-input/xt-input.css +1 -0
  86. package/lib/xt-input/xt-input.umd.js +594 -0
  87. package/lib/xt-input/xt-input.umd.min.js +1 -0
  88. package/lib/xt-list/demo.html +10 -0
  89. package/lib/xt-list/index.js +1 -0
  90. package/lib/xt-list/xt-list.common.js +714 -0
  91. package/lib/xt-list/xt-list.css +1 -0
  92. package/lib/xt-list/xt-list.umd.js +724 -0
  93. package/lib/xt-list/xt-list.umd.min.js +1 -0
  94. package/lib/xt-map/demo.html +10 -0
  95. package/lib/xt-map/index.js +1 -0
  96. package/lib/xt-map/xt-map.common.js +1951 -0
  97. package/lib/xt-map/xt-map.css +1 -0
  98. package/lib/xt-map/xt-map.umd.js +1961 -0
  99. package/lib/xt-map/xt-map.umd.min.js +1 -0
  100. package/lib/xt-map-provider/demo.html +10 -0
  101. package/lib/xt-map-provider/index.js +1 -0
  102. package/lib/xt-map-provider/xt-map-provider.common.js +644 -0
  103. package/lib/xt-map-provider/xt-map-provider.css +1 -0
  104. package/lib/xt-map-provider/xt-map-provider.umd.js +654 -0
  105. package/lib/xt-map-provider/xt-map-provider.umd.min.js +1 -0
  106. package/lib/xt-page/demo.html +10 -0
  107. package/lib/xt-page/index.js +1 -0
  108. package/lib/xt-page/xt-page.common.js +353 -0
  109. package/lib/xt-page/xt-page.css +1 -0
  110. package/lib/xt-page/xt-page.umd.js +363 -0
  111. package/lib/xt-page/xt-page.umd.min.js +1 -0
  112. package/lib/xt-progress/demo.html +10 -0
  113. package/lib/xt-progress/index.js +1 -0
  114. package/lib/xt-progress/xt-progress.common.js +327 -0
  115. package/lib/xt-progress/xt-progress.css +1 -0
  116. package/lib/xt-progress/xt-progress.umd.js +337 -0
  117. package/lib/xt-progress/xt-progress.umd.min.js +1 -0
  118. package/lib/xt-scroll-arrow/demo.html +10 -0
  119. package/lib/xt-scroll-arrow/index.js +1 -0
  120. package/lib/xt-scroll-arrow/xt-scroll-arrow.common.js +495 -0
  121. package/lib/xt-scroll-arrow/xt-scroll-arrow.css +1 -0
  122. package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.js +505 -0
  123. package/lib/xt-scroll-arrow/xt-scroll-arrow.umd.min.js +1 -0
  124. package/lib/xt-select-tree/demo.html +10 -0
  125. package/lib/xt-select-tree/index.js +1 -0
  126. package/lib/xt-select-tree/xt-select-tree.common.js +1791 -0
  127. package/lib/xt-select-tree/xt-select-tree.css +1 -0
  128. package/lib/xt-select-tree/xt-select-tree.umd.js +1801 -0
  129. package/lib/xt-select-tree/xt-select-tree.umd.min.js +1 -0
  130. package/lib/xt-step-price/demo.html +10 -0
  131. package/lib/xt-step-price/index.js +1 -0
  132. package/lib/xt-step-price/xt-step-price.common.js +800 -0
  133. package/lib/xt-step-price/xt-step-price.css +1 -0
  134. package/lib/xt-step-price/xt-step-price.umd.js +810 -0
  135. package/lib/xt-step-price/xt-step-price.umd.min.js +1 -0
  136. package/lib/xt-step-price-item/demo.html +10 -0
  137. package/lib/xt-step-price-item/index.js +1 -0
  138. package/lib/xt-step-price-item/xt-step-price-item.common.js +417 -0
  139. package/lib/xt-step-price-item/xt-step-price-item.umd.js +427 -0
  140. package/lib/xt-step-price-item/xt-step-price-item.umd.min.js +1 -0
  141. package/lib/xt-tab-pane/demo.html +10 -0
  142. package/lib/xt-tab-pane/index.js +1 -0
  143. package/lib/xt-tab-pane/xt-tab-pane.common.js +309 -0
  144. package/lib/xt-tab-pane/xt-tab-pane.umd.js +319 -0
  145. package/lib/xt-tab-pane/xt-tab-pane.umd.min.js +1 -0
  146. package/lib/xt-table/demo.html +10 -0
  147. package/lib/xt-table/index.js +1 -0
  148. package/lib/xt-table/xt-table.common.js +1027 -0
  149. package/lib/xt-table/xt-table.css +1 -0
  150. package/lib/xt-table/xt-table.umd.js +1037 -0
  151. package/lib/xt-table/xt-table.umd.min.js +1 -0
  152. package/lib/xt-tabs/demo.html +10 -0
  153. package/lib/xt-tabs/index.js +1 -0
  154. package/lib/xt-tabs/xt-tabs.common.js +463 -0
  155. package/lib/xt-tabs/xt-tabs.css +1 -0
  156. package/lib/xt-tabs/xt-tabs.umd.js +473 -0
  157. package/lib/xt-tabs/xt-tabs.umd.min.js +1 -0
  158. package/lib/xt-text/demo.html +10 -0
  159. package/lib/xt-text/index.js +1 -0
  160. package/lib/xt-text/xt-text.common.js +536 -0
  161. package/lib/xt-text/xt-text.css +1 -0
  162. package/lib/xt-text/xt-text.umd.js +546 -0
  163. package/lib/xt-text/xt-text.umd.min.js +1 -0
  164. package/lib/xt-time/demo.html +10 -0
  165. package/lib/xt-time/index.js +1 -0
  166. package/lib/xt-time/xt-time.common.js +555 -0
  167. package/lib/xt-time/xt-time.css +1 -0
  168. package/lib/xt-time/xt-time.umd.js +565 -0
  169. package/lib/xt-time/xt-time.umd.min.js +1 -0
  170. package/lib/xt-transfer-tree/demo.html +10 -0
  171. package/lib/xt-transfer-tree/index.js +1 -0
  172. package/lib/xt-transfer-tree/xt-transfer-tree.common.js +594 -0
  173. package/lib/xt-transfer-tree/xt-transfer-tree.css +1 -0
  174. package/lib/xt-transfer-tree/xt-transfer-tree.umd.js +604 -0
  175. package/lib/xt-transfer-tree/xt-transfer-tree.umd.min.js +1 -0
  176. package/lib/xt-upload/demo.html +10 -0
  177. package/lib/xt-upload/index.js +1 -0
  178. package/lib/xt-upload/xt-upload.common.js +1292 -0
  179. package/lib/xt-upload/xt-upload.css +1 -0
  180. package/lib/xt-upload/xt-upload.umd.js +1302 -0
  181. package/lib/xt-upload/xt-upload.umd.min.js +1 -0
  182. package/package.json +10 -7
  183. package/src/components/xt-badge/index.js +8 -7
  184. package/src/components/xt-button/index.js +1 -0
  185. package/src/components/xt-card/index.js +1 -0
  186. package/src/components/xt-card-item/index.js +1 -0
  187. package/src/components/xt-config-provider/index.js +1 -0
  188. package/src/components/xt-flex-box/index.js +1 -0
  189. package/src/components/xt-grid-box/index.js +1 -0
  190. package/src/components/xt-icon/index.js +1 -0
  191. package/src/components/xt-input/index.js +1 -0
  192. package/src/components/xt-map/index.js +1 -0
  193. package/src/components/xt-progress/index.js +8 -7
  194. package/src/components/xt-scroll-arrow/index.js +8 -7
  195. package/src/components/xt-step-price/index.js +1 -0
  196. package/src/components/xt-tab-pane/index.js +10 -0
  197. package/src/components/{xt-tabs/TabPane.vue → xt-tab-pane/index.vue} +14 -1
  198. package/src/components/xt-tabs/index.js +9 -10
  199. package/src/components/xt-tabs/index.vue +303 -44
  200. package/src/components/xt-text/index.js +1 -0
  201. package/src/components/xt-time/index.js +1 -0
  202. package/src/index.js +34 -2
@@ -0,0 +1,555 @@
1
+ module.exports =
2
+ /******/ (function(modules) { // webpackBootstrap
3
+ /******/ // The module cache
4
+ /******/ var installedModules = {};
5
+ /******/
6
+ /******/ // The require function
7
+ /******/ function __webpack_require__(moduleId) {
8
+ /******/
9
+ /******/ // Check if module is in cache
10
+ /******/ if(installedModules[moduleId]) {
11
+ /******/ return installedModules[moduleId].exports;
12
+ /******/ }
13
+ /******/ // Create a new module (and put it into the cache)
14
+ /******/ var module = installedModules[moduleId] = {
15
+ /******/ i: moduleId,
16
+ /******/ l: false,
17
+ /******/ exports: {}
18
+ /******/ };
19
+ /******/
20
+ /******/ // Execute the module function
21
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
+ /******/
23
+ /******/ // Flag the module as loaded
24
+ /******/ module.l = true;
25
+ /******/
26
+ /******/ // Return the exports of the module
27
+ /******/ return module.exports;
28
+ /******/ }
29
+ /******/
30
+ /******/
31
+ /******/ // expose the modules object (__webpack_modules__)
32
+ /******/ __webpack_require__.m = modules;
33
+ /******/
34
+ /******/ // expose the module cache
35
+ /******/ __webpack_require__.c = installedModules;
36
+ /******/
37
+ /******/ // define getter function for harmony exports
38
+ /******/ __webpack_require__.d = function(exports, name, getter) {
39
+ /******/ if(!__webpack_require__.o(exports, name)) {
40
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
+ /******/ }
42
+ /******/ };
43
+ /******/
44
+ /******/ // define __esModule on exports
45
+ /******/ __webpack_require__.r = function(exports) {
46
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ /******/ }
49
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
+ /******/ };
51
+ /******/
52
+ /******/ // create a fake namespace object
53
+ /******/ // mode & 1: value is a module id, require it
54
+ /******/ // mode & 2: merge all properties of value into the ns
55
+ /******/ // mode & 4: return value when already ns object
56
+ /******/ // mode & 8|1: behave like require
57
+ /******/ __webpack_require__.t = function(value, mode) {
58
+ /******/ if(mode & 1) value = __webpack_require__(value);
59
+ /******/ if(mode & 8) return value;
60
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
+ /******/ var ns = Object.create(null);
62
+ /******/ __webpack_require__.r(ns);
63
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
+ /******/ return ns;
66
+ /******/ };
67
+ /******/
68
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
69
+ /******/ __webpack_require__.n = function(module) {
70
+ /******/ var getter = module && module.__esModule ?
71
+ /******/ function getDefault() { return module['default']; } :
72
+ /******/ function getModuleExports() { return module; };
73
+ /******/ __webpack_require__.d(getter, 'a', getter);
74
+ /******/ return getter;
75
+ /******/ };
76
+ /******/
77
+ /******/ // Object.prototype.hasOwnProperty.call
78
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
+ /******/
80
+ /******/ // __webpack_public_path__
81
+ /******/ __webpack_require__.p = "";
82
+ /******/
83
+ /******/
84
+ /******/ // Load entry module and return exports
85
+ /******/ return __webpack_require__(__webpack_require__.s = "fb15");
86
+ /******/ })
87
+ /************************************************************************/
88
+ /******/ ({
89
+
90
+ /***/ "6c9e":
91
+ /***/ (function(module, exports, __webpack_require__) {
92
+
93
+ // extracted by mini-css-extract-plugin
94
+
95
+ /***/ }),
96
+
97
+ /***/ "fb15":
98
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
99
+
100
+ "use strict";
101
+ // ESM COMPAT FLAG
102
+ __webpack_require__.r(__webpack_exports__);
103
+
104
+ // EXPORTS
105
+ __webpack_require__.d(__webpack_exports__, "XtTime", function() { return /* reexport */ xt_time; });
106
+
107
+ // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
108
+ // This file is imported into lib/wc client bundles.
109
+
110
+ if (typeof window !== 'undefined') {
111
+ var currentScript = window.document.currentScript
112
+ if (false) { var getCurrentScript; }
113
+
114
+ var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
115
+ if (src) {
116
+ __webpack_require__.p = src[1] // eslint-disable-line
117
+ }
118
+ }
119
+
120
+ // Indicate to webpack that this file can be concatenated
121
+ /* harmony default export */ var setPublicPath = (null);
122
+
123
+ // EXTERNAL MODULE: ./src/components/xt-time/style/index.scss
124
+ var style = __webpack_require__("6c9e");
125
+
126
+ // 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-time/index.vue?vue&type=template&id=d29acf2c
127
+ var render = function render(){var _vm=this,_c=_vm._self._c;return _c('span',{staticClass:"xt-time",class:[
128
+ _vm.typeColor ? 'xt-time--' + _vm.typeColor : '',
129
+ 'xt-time--' + _vm.size,
130
+ { 'xt-time--bold': _vm.bold }
131
+ ],style:(_vm.customStyle),on:{"click":_vm.handleClick}},[_vm._t("prefix",function(){return [_vm._v(_vm._s(_vm.prefix))]}),_vm._t("default",function(){return [(_vm.mode === 'text')?[(_vm.displayText !== undefined)?[_vm._v(_vm._s(_vm.displayText))]:(!_vm.hideEmpty)?[_vm._v(_vm._s(_vm.emptyText))]:_vm._e()]:(_vm.mode === 'now')?[_vm._v(" "+_vm._s(_vm.nowText)+" ")]:(_vm.mode === 'countdown')?[(_vm.isCountdownFinished)?[_vm._t("finished",function(){return [_vm._v(_vm._s(_vm.finishedText))]})]:[_vm._v(" "+_vm._s(_vm.countdownText)+" ")]]:_vm._e()]}),_vm._t("suffix",function(){return [_vm._v(_vm._s(_vm.suffix))]})],2)
132
+ }
133
+ var staticRenderFns = []
134
+
135
+
136
+ // CONCATENATED MODULE: ./src/components/xt-time/index.vue?vue&type=template&id=d29acf2c
137
+
138
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/xt-time/index.vue?vue&type=script&lang=js
139
+
140
+ const DEFAULT_FORMAT = 'YYYY-MM-DD HH:mm:ss'
141
+
142
+ function pad(n) {
143
+ const s = String(n)
144
+ return s.length < 2 ? '0' + s : s
145
+ }
146
+
147
+ /**
148
+ * 根据字符串/数字/Date 解析为 Date 对象
149
+ * 兼容:时间戳(ms/s)、Date、"2024-01-01"、"2024/01/01 12:00:00"、ISO 字符串
150
+ */
151
+ function parseDate(value) {
152
+ if (value === null || value === undefined || value === '') return null
153
+ if (value instanceof Date) return isNaN(value.getTime()) ? null : value
154
+
155
+ // 数字时间戳
156
+ if (typeof value === 'number') {
157
+ // 10 位秒级时间戳补 000
158
+ const t = value < 1e12 ? value * 1000 : value
159
+ const d = new Date(t)
160
+ return isNaN(d.getTime()) ? null : d
161
+ }
162
+
163
+ if (typeof value === 'string') {
164
+ // 纯数字字符串
165
+ if (/^\d+$/.test(value)) {
166
+ const n = Number(value)
167
+ const t = n < 1e12 ? n * 1000 : n
168
+ const d = new Date(t)
169
+ return isNaN(d.getTime()) ? null : d
170
+ }
171
+ // 将 "-" 统一为 "/",避免 Safari 下 "YYYY-MM-DD" 解析失败
172
+ const normalized = value.replace(/-/g, '/')
173
+ const d = new Date(normalized)
174
+ return isNaN(d.getTime()) ? null : d
175
+ }
176
+
177
+ return null
178
+ }
179
+
180
+ /**
181
+ * 简易 formatDateTime 实现(不依赖外部库)
182
+ * 支持占位符:YYYY MM DD HH mm ss SSS
183
+ */
184
+ function formatDateTime(date, fmt) {
185
+ if (!date) return ''
186
+ const f = fmt || DEFAULT_FORMAT
187
+ const map = {
188
+ YYYY: date.getFullYear(),
189
+ MM: pad(date.getMonth() + 1),
190
+ DD: pad(date.getDate()),
191
+ HH: pad(date.getHours()),
192
+ mm: pad(date.getMinutes()),
193
+ ss: pad(date.getSeconds()),
194
+ SSS: String(date.getMilliseconds()).padStart(3, '0')
195
+ }
196
+ return f.replace(/YYYY|MM|DD|HH|mm|ss|SSS/g, (k) => map[k])
197
+ }
198
+
199
+ /* harmony default export */ var xt_timevue_type_script_lang_js = ({
200
+ name: 'XtTime',
201
+
202
+ props: {
203
+ // 显示模式:now(当前时间实时刷新)/ countdown(倒计时)/ text(格式化日期文本)
204
+ type: {
205
+ type: String,
206
+ default: 'now',
207
+ validator: (val) => ['now', 'countdown', 'text'].includes(val)
208
+ },
209
+
210
+ // ===== 通用 =====
211
+ size: {
212
+ type: String,
213
+ default: 'base',
214
+ validator: (val) =>
215
+ ['extra-large', 'large', 'medium', 'base', 'small', 'extra-small'].includes(val)
216
+ },
217
+ typeColor: {
218
+ type: String,
219
+ default: '',
220
+ validator: (val) => ['', 'primary', 'success', 'warning', 'danger'].includes(val)
221
+ },
222
+ bold: {
223
+ type: Boolean,
224
+ default: false
225
+ },
226
+ format: {
227
+ type: String,
228
+ default: DEFAULT_FORMAT
229
+ },
230
+ prefix: {
231
+ type: String,
232
+ default: ''
233
+ },
234
+ suffix: {
235
+ type: String,
236
+ default: ''
237
+ },
238
+ emptyText: {
239
+ type: String,
240
+ default: '-'
241
+ },
242
+ hideEmpty: {
243
+ type: Boolean,
244
+ default: false
245
+ },
246
+ interval: {
247
+ type: Number,
248
+ default: 1000,
249
+ validator: (val) => val >= 100
250
+ },
251
+
252
+ // ===== text 模式 =====
253
+ // 兼容 v-model 用法,也可直接传 value / :value
254
+ value: {
255
+ type: [String, Number, Date],
256
+ default: ''
257
+ },
258
+
259
+ // ===== countdown 模式 =====
260
+ targetTime: {
261
+ type: [String, Number, Date],
262
+ default: ''
263
+ },
264
+ // 倒计时显示格式:
265
+ // DHMS -> 3天 12时 08分 30秒
266
+ // HMS -> 12时 08分 30秒(天数自动折算到小时)
267
+ // MS -> 08分 30秒(全部折算到分钟)
268
+ // SEC -> 3200秒
269
+ countdownFormat: {
270
+ type: String,
271
+ default: 'DHMS',
272
+ validator: (val) => ['DHMS', 'HMS', 'MS', 'SEC'].includes(val)
273
+ },
274
+ finishedText: {
275
+ type: String,
276
+ default: '已结束'
277
+ }
278
+ },
279
+
280
+ data() {
281
+ return {
282
+ tick: 0
283
+ }
284
+ },
285
+
286
+ computed: {
287
+ mode() {
288
+ return this.type
289
+ },
290
+
291
+ parsedValue() {
292
+ return parseDate(this.value)
293
+ },
294
+
295
+ parsedTarget() {
296
+ return parseDate(this.targetTime)
297
+ },
298
+
299
+ displayText() {
300
+ if (!this.parsedValue) return undefined
301
+ return formatDateTime(this.parsedValue, this.format)
302
+ },
303
+
304
+ nowText() {
305
+ // 通过 tick 触发刷新
306
+ // eslint-disable-next-line no-unused-vars
307
+ const _ = this.tick
308
+ return formatDateTime(new Date(), this.format)
309
+ },
310
+
311
+ // 剩余毫秒数(countdown 模式)
312
+ remainingMs() {
313
+ if (this.mode !== 'countdown') return 0
314
+ // eslint-disable-next-line no-unused-vars
315
+ const _ = this.tick
316
+ if (!this.parsedTarget) return 0
317
+ const diff = this.parsedTarget.getTime() - Date.now()
318
+ return diff > 0 ? diff : 0
319
+ },
320
+
321
+ isCountdownFinished() {
322
+ return this.mode === 'countdown' && this.parsedTarget && this.remainingMs <= 0
323
+ },
324
+
325
+ countdownText() {
326
+ if (!this.parsedTarget) return this.emptyText
327
+ const total = Math.floor(this.remainingMs / 1000)
328
+ if (total <= 0) return this.finishedText
329
+
330
+ switch (this.countdownFormat) {
331
+ case 'SEC':
332
+ return `${total}秒`
333
+ case 'MS': {
334
+ const m = Math.floor(total / 60)
335
+ const s = total % 60
336
+ return `${pad(m)}分${pad(s)}秒`
337
+ }
338
+ case 'HMS': {
339
+ const h = Math.floor(total / 3600)
340
+ const m = Math.floor((total % 3600) / 60)
341
+ const s = total % 60
342
+ return `${pad(h)}时${pad(m)}分${pad(s)}秒`
343
+ }
344
+ case 'DHMS':
345
+ default: {
346
+ const d = Math.floor(total / 86400)
347
+ const h = Math.floor((total % 86400) / 3600)
348
+ const m = Math.floor((total % 3600) / 60)
349
+ const s = total % 60
350
+ return `${d}天${pad(h)}时${pad(m)}分${pad(s)}秒`
351
+ }
352
+ }
353
+ },
354
+
355
+ customStyle() {
356
+ return {}
357
+ }
358
+ },
359
+
360
+ watch: {
361
+ type() {
362
+ this.restartTimer()
363
+ },
364
+ interval() {
365
+ this.restartTimer()
366
+ }
367
+ },
368
+
369
+ mounted() {
370
+ this.restartTimer()
371
+ },
372
+
373
+ beforeDestroy() {
374
+ this.clearTimer()
375
+ },
376
+
377
+ activated() {
378
+ this.restartTimer()
379
+ },
380
+
381
+ deactivated() {
382
+ this.clearTimer()
383
+ },
384
+
385
+ methods: {
386
+ restartTimer() {
387
+ this.clearTimer()
388
+ if (this.mode === 'now' || this.mode === 'countdown') {
389
+ // 立即刷新一次,避免首次渲染时 tick=0 导致的差异
390
+ this.tick++
391
+ this._timer = setInterval(() => {
392
+ this.tick++
393
+ // 倒计时结束触发 finish 事件
394
+ if (this.mode === 'countdown' && this.parsedTarget && this.remainingMs <= 0) {
395
+ this.clearTimer()
396
+ this.$emit('finish')
397
+ }
398
+ }, this.interval)
399
+ }
400
+ },
401
+
402
+ clearTimer() {
403
+ if (this._timer) {
404
+ clearInterval(this._timer)
405
+ this._timer = null
406
+ }
407
+ },
408
+
409
+ handleClick(e) {
410
+ this.$emit('click', e)
411
+ }
412
+ }
413
+ });
414
+
415
+ // CONCATENATED MODULE: ./src/components/xt-time/index.vue?vue&type=script&lang=js
416
+ /* harmony default export */ var components_xt_timevue_type_script_lang_js = (xt_timevue_type_script_lang_js);
417
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
418
+ /* globals __VUE_SSR_CONTEXT__ */
419
+
420
+ // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
421
+ // This module is a runtime utility for cleaner component module output and will
422
+ // be included in the final webpack user bundle.
423
+
424
+ function normalizeComponent(
425
+ scriptExports,
426
+ render,
427
+ staticRenderFns,
428
+ functionalTemplate,
429
+ injectStyles,
430
+ scopeId,
431
+ moduleIdentifier /* server only */,
432
+ shadowMode /* vue-cli only */
433
+ ) {
434
+ // Vue.extend constructor export interop
435
+ var options =
436
+ typeof scriptExports === 'function' ? scriptExports.options : scriptExports
437
+
438
+ // render functions
439
+ if (render) {
440
+ options.render = render
441
+ options.staticRenderFns = staticRenderFns
442
+ options._compiled = true
443
+ }
444
+
445
+ // functional template
446
+ if (functionalTemplate) {
447
+ options.functional = true
448
+ }
449
+
450
+ // scopedId
451
+ if (scopeId) {
452
+ options._scopeId = 'data-v-' + scopeId
453
+ }
454
+
455
+ var hook
456
+ if (moduleIdentifier) {
457
+ // server build
458
+ hook = function (context) {
459
+ // 2.3 injection
460
+ context =
461
+ context || // cached call
462
+ (this.$vnode && this.$vnode.ssrContext) || // stateful
463
+ (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
464
+ // 2.2 with runInNewContext: true
465
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
466
+ context = __VUE_SSR_CONTEXT__
467
+ }
468
+ // inject component styles
469
+ if (injectStyles) {
470
+ injectStyles.call(this, context)
471
+ }
472
+ // register component module identifier for async chunk inferrence
473
+ if (context && context._registeredComponents) {
474
+ context._registeredComponents.add(moduleIdentifier)
475
+ }
476
+ }
477
+ // used by ssr in case component is cached and beforeCreate
478
+ // never gets called
479
+ options._ssrRegister = hook
480
+ } else if (injectStyles) {
481
+ hook = shadowMode
482
+ ? function () {
483
+ injectStyles.call(
484
+ this,
485
+ (options.functional ? this.parent : this).$root.$options.shadowRoot
486
+ )
487
+ }
488
+ : injectStyles
489
+ }
490
+
491
+ if (hook) {
492
+ if (options.functional) {
493
+ // for template-only hot-reload because in that case the render fn doesn't
494
+ // go through the normalizer
495
+ options._injectStyles = hook
496
+ // register for functional component in vue file
497
+ var originalRender = options.render
498
+ options.render = function renderWithStyleInjection(h, context) {
499
+ hook.call(context)
500
+ return originalRender(h, context)
501
+ }
502
+ } else {
503
+ // inject component registration as beforeCreate hook
504
+ var existing = options.beforeCreate
505
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
506
+ }
507
+ }
508
+
509
+ return {
510
+ exports: scriptExports,
511
+ options: options
512
+ }
513
+ }
514
+
515
+ // CONCATENATED MODULE: ./src/components/xt-time/index.vue
516
+
517
+
518
+
519
+
520
+
521
+ /* normalize component */
522
+
523
+ var component = normalizeComponent(
524
+ components_xt_timevue_type_script_lang_js,
525
+ render,
526
+ staticRenderFns,
527
+ false,
528
+ null,
529
+ null,
530
+ null
531
+
532
+ )
533
+
534
+ /* harmony default export */ var xt_time = (component.exports);
535
+ // CONCATENATED MODULE: ./src/components/xt-time/index.js
536
+
537
+
538
+
539
+ xt_time.install = function (Vue) {
540
+ Vue.component(xt_time.name, xt_time)
541
+ }
542
+
543
+ /* harmony default export */ var components_xt_time = (xt_time);
544
+
545
+
546
+ // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
547
+
548
+
549
+ /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (components_xt_time);
550
+
551
+
552
+
553
+ /***/ })
554
+
555
+ /******/ });
@@ -0,0 +1 @@
1
+ .xt-time{display:inline-block;color:var(--xt-text-color,#303133);font-variant-numeric:tabular-nums;transition:color .2s ease}.xt-time--extra-large{font-size:var(--xt-font-size-extra-large,20px)}.xt-time--large{font-size:var(--xt-font-size-large,18px)}.xt-time--medium{font-size:var(--xt-font-size-medium,16px)}.xt-time--base{font-size:var(--xt-font-size-small,14px)}.xt-time--small{font-size:var(--xt-font-size-mini,13px)}.xt-time--extra-small{font-size:var(--xt-font-size-extra-small,12px)}.xt-time--bold{font-weight:700}.xt-time--primary{color:var(--xt-color-primary,#409eff)}.xt-time--success{color:var(--xt-color-success,#67c23a)}.xt-time--warning{color:var(--xt-color-warning,#e6a23c)}.xt-time--danger{color:var(--xt-color-danger,#f56c6c)}