@weitutech/by-components 1.0.30 → 1.0.31

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/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@weitutech/by-components",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "private": false,
5
5
  "main": "src/index",
6
6
  "scripts": {
7
+ "dev": "vue-cli-service serve",
7
8
  "build": "npm run build:js && npm run build:css",
8
9
  "build:js": "vue-cli-service build --target lib --name by-components src/index.js",
9
10
  "build:css": "sass src/style/index.scss lib/index.css --no-source-map --style=compressed"
@@ -39,6 +39,14 @@ export default {
39
39
  size: "mini",
40
40
  active: ""
41
41
  })
42
+ },
43
+ startTimeField: {
44
+ type: String,
45
+ default: ""
46
+ },
47
+ endTimeField: {
48
+ type: String,
49
+ default: ""
42
50
  }
43
51
  },
44
52
 
@@ -95,14 +103,32 @@ export default {
95
103
  handleChange(e) {
96
104
  if (!e) {
97
105
  this.$emit("input", [])
106
+ if (this.startTimeField && this.endTimeField) {
107
+ this.$emit("range-change", { startTime: "", endTime: "" })
108
+ }
98
109
  } else {
99
- this.$emit("input", e.map(item => moment(item).format("YYYY-MM-DD")))
110
+ const formattedDates = e.map(item => moment(item).format("YYYY-MM-DD"))
111
+ this.$emit("input", formattedDates)
112
+
113
+ if (this.startTimeField && this.endTimeField) {
114
+ this.$emit("range-change", {
115
+ startTime: formattedDates[0],
116
+ endTime: formattedDates[1]
117
+ })
118
+ }
100
119
  }
101
120
  this.active = ""
102
121
  },
103
122
  handleClick(item) {
104
123
  this.active = item.key
105
124
  this.$emit("input", [item.start_time, item.end_time])
125
+
126
+ if (this.startTimeField && this.endTimeField) {
127
+ this.$emit("range-change", {
128
+ startTime: item.start_time,
129
+ endTime: item.end_time
130
+ })
131
+ }
106
132
  }
107
133
  }
108
134
  }
@@ -192,6 +192,7 @@
192
192
  :value="value[`${item.field}`]"
193
193
  v-bind="item"
194
194
  @input="handleValueChange($event, item)"
195
+ @range-change="handleRangeChange($event, item)"
195
196
  />
196
197
  </template>
197
198
  <!-- 自定义 -->
@@ -344,6 +345,22 @@ export default {
344
345
  this.$emit("change", { ...item, value })
345
346
  this.$emit("input", this.replacementData)
346
347
  },
348
+ handleRangeChange({ startTime, endTime }, item) {
349
+ if (!item.startTimeField || !item.endTimeField) return
350
+
351
+ if (this.replacementData) {
352
+ this.replacementData[item.startTimeField] = startTime
353
+ this.replacementData[item.endTimeField] = endTime
354
+ } else {
355
+ this.replacementData = {
356
+ ...this.value,
357
+ [item.startTimeField]: startTime,
358
+ [item.endTimeField]: endTime
359
+ }
360
+ }
361
+
362
+ this.$emit("input", this.replacementData)
363
+ },
347
364
  handleQueryClick() {
348
365
  this.$emit("queryBtnClick")
349
366
  }
package/.browserslistrc DELETED
@@ -1,3 +0,0 @@
1
- > 1%
2
- last 2 versions
3
- not dead
package/babel.config.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- '@vue/cli-plugin-babel/preset'
4
- ],
5
- plugins: [
6
- "@babel/plugin-proposal-optional-chaining",
7
- "@babel/plugin-proposal-nullish-coalescing-operator"
8
- ]
9
- }
package/jsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es5",
4
- "module": "esnext",
5
- "baseUrl": "./",
6
- "moduleResolution": "node",
7
- "paths": {
8
- "@/*": [
9
- "src/*"
10
- ]
11
- },
12
- "lib": [
13
- "esnext",
14
- "dom",
15
- "dom.iterable",
16
- "scripthost"
17
- ]
18
- }
19
- }
package/postcss.config.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- plugins: {
3
- // 可以根据您的需求添加具体的 PostCSS 插件
4
- // 例如 autoprefixer 用于添加浏览器前缀
5
- 'autoprefixer': {}
6
- }
7
- }
package/vue.config.js DELETED
@@ -1,7 +0,0 @@
1
- const { defineConfig } = require('@vue/cli-service')
2
-
3
- module.exports = defineConfig({
4
- transpileDependencies: true,
5
- outputDir: 'lib',
6
- productionSourceMap: false
7
- })