sadais-piui 1.2.7-beta92 → 1.2.7-beta94

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.
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2022-05-18 11:08:49
4
- * @LastEditTime: 2024-01-12 11:09:10
4
+ * @LastEditTime: 2024-01-15 14:50:23
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 选择输入
7
7
  * @FilePath: /piui/components/pi-select-input/index.vue
@@ -16,7 +16,7 @@
16
16
  <pi-input
17
17
  v-else
18
18
  type="text"
19
- :value="getInputValue"
19
+ :value="getInputValue || remoteVal"
20
20
  :custom-class="getInput.customClass"
21
21
  :custom-style="getInput.customStyle"
22
22
  :placeholder="getInput.placeholder"
@@ -149,7 +149,8 @@ export default {
149
149
  },
150
150
  data() {
151
151
  return {
152
- show: false
152
+ show: false,
153
+ remoteVal: ''
153
154
  }
154
155
  },
155
156
  computed: {
@@ -160,6 +161,28 @@ export default {
160
161
  return this.$pi.lang.mergeDeep(selectInput.input, this.input)
161
162
  },
162
163
  getInputValue() {
164
+ return this.handleGetInputValue()
165
+ }
166
+ },
167
+ created() {
168
+ this.initRemoteSelectData()
169
+ },
170
+ methods: {
171
+ initRemoteSelectData() {
172
+ // 如果开启了远程搜索 则在创建之初 先触发一次搜索 让代码触发到用户自定义的parseRemoteSearchResult方法中
173
+ // 目的为了回显数据
174
+ if (
175
+ this.getSelect.remoteSearchConfig.enable &&
176
+ this.getSelect.parseRemoteSearchResult &&
177
+ this.val
178
+ ) {
179
+ this.$nextTick(async () => {
180
+ await this.$refs['pi-select'].handleRemoteSearch()
181
+ this.remoteVal = this.handleGetInputValue()
182
+ })
183
+ }
184
+ },
185
+ handleGetInputValue() {
163
186
  const parseValueFn = this.parseValueFn[PI_DEFAULT_FN_FLAG]
164
187
  ? this.parseValueFn.fn
165
188
  : this.parseValueFn
@@ -195,20 +218,6 @@ export default {
195
218
  return val ? val[this.getSelect.displayField] : ''
196
219
  }
197
220
  }
198
- }
199
- },
200
- created() {
201
- this.initRemoteSelectData()
202
- },
203
- methods: {
204
- initRemoteSelectData() {
205
- // 如果开启了远程搜索 则在创建之初 先触发一次搜索 让代码触发到用户自定义的parseRemoteSearchResult方法中
206
- // 目的为了回显数据
207
- if (this.getSelect.remoteSearchConfig.enable && this.getSelect.parseRemoteSearchResult) {
208
- this.$nextTick(() => {
209
- this.$refs['pi-select'].handleRemoteSearch()
210
- })
211
- }
212
221
  },
213
222
  handlePopupClose() {
214
223
  this.val = false
@@ -43,7 +43,7 @@ const { stepper } = getConfig()
43
43
  const TAG = 'PiStepper'
44
44
 
45
45
  export default {
46
- name: 'PiStepper',
46
+ name: TAG,
47
47
  // 混入v-model
48
48
  mixins: [ValueSync],
49
49
  props: {
@@ -299,8 +299,8 @@ export default {
299
299
  this.handleInputChange({ detail: { value: `${val}` } })
300
300
  },
301
301
  handleInputChange(e) {
302
- const val = e.detail.value
303
- const reg = /^(\d+)(\.)?(?:(.+)$)?/
302
+ let val = e.detail.value
303
+ const reg = /^-?\d*\.?\d+$/
304
304
  const result = val.match(reg)
305
305
  const decimal = this.decimal
306
306
  if (!result) {
@@ -313,6 +313,7 @@ export default {
313
313
  const dot = result[2]
314
314
  const right = result[3]
315
315
  let tmpVal = ''
316
+
316
317
  if (!dot || !right) {
317
318
  tmpVal = dot ? `${left}${dot}` : left
318
319
  } else if (/^\d+/.test(right)) {
@@ -324,10 +325,7 @@ export default {
324
325
  // 若小数点右边不是以数字开头
325
326
  tmpVal = `${left}${dot}`
326
327
  }
327
- // target.value = tmpVal
328
- console.log(`tmpVal = ${tmpVal}`)
329
328
  this.val = 0
330
- // this.handleEmitChange()
331
329
  this.$nextTick(() => {
332
330
  let tmp = parseFloat(tmpVal)
333
331
  if (this.integer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7-beta92",
3
+ "version": "1.2.7-beta94",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {