@ebiz/designer-components 0.0.41 → 0.0.45

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebiz/designer-components",
3
- "version": "0.0.41",
3
+ "version": "0.0.45",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  </div>
44
44
  <div style="margin-top: 8px;">
45
- <slot :data="data"></slot>
45
+ <slot :data="computedData"></slot>
46
46
  </div>
47
47
  </div>
48
48
 
@@ -79,24 +79,30 @@ const refreshing = ref(false)
79
79
  const total = ref(0)
80
80
  const pageSizeOptions = ref([10, 20, 50, 100])
81
81
 
82
- const data = ref([
83
- {
84
- id: 1,
85
- name: '张三',
86
- age: 18,
87
- gender: '男',
88
- address: '北京市海淀区'
89
- },
90
- {
91
- id: 2,
92
- name: '李四',
93
- age: 20,
94
- gender: '女',
95
- address: '北京市朝阳区'
96
- }
97
- ]);
82
+ const data = ref();
98
83
 
99
84
  const props = defineProps({
85
+ showDemoData: {
86
+ type: Boolean,
87
+ default: true
88
+ },
89
+ demoData: {
90
+ type: Array,
91
+ default: () => [{
92
+ id: 1,
93
+ name: '张三',
94
+ age: 18,
95
+ gender: '男',
96
+ address: '北京市海淀区'
97
+ },
98
+ {
99
+ id: 2,
100
+ name: '李四',
101
+ age: 20,
102
+ gender: '女',
103
+ address: '北京市朝阳区'
104
+ }]
105
+ },
100
106
  showPageHeader: {
101
107
  type: Boolean,
102
108
  default: true
@@ -173,6 +179,18 @@ const props = defineProps({
173
179
  }
174
180
  });
175
181
 
182
+ const computedData = computed(() => {
183
+ const developMode = window.localStorage.getItem('ebiz-develop-mode')
184
+ if (developMode === 'designer') {
185
+ if (props.showDemoData) {
186
+ return props.demoData
187
+ }
188
+ return [];
189
+ }
190
+ return data.value
191
+ })
192
+
193
+
176
194
  const defaultFormData = ref({ ...props.formData })
177
195
  const searchValue = ref('')
178
196
 
@@ -24,9 +24,32 @@
24
24
 
25
25
  <!-- 选择器 -->
26
26
  <template v-else-if="type === 'select'">
27
- <t-select v-model="computedModelValue" :options="options" :placeholder="placeholder || '请选择'"
28
- :disabled="disabled" :clearable="clearable" :filterable="filterable" :multiple="multiple"
29
- :loading="loading" @change="handleChange" />
27
+ <template v-if="isRemote">
28
+ <ebiz-remote-select
29
+ v-model="computedModelValue"
30
+ :placeholder="placeholder || '请选择'"
31
+ :disabled="disabled"
32
+ :clearable="clearable"
33
+ :filterable="filterable"
34
+ :multiple="multiple"
35
+ :loading="loading"
36
+ :remote-api-config="remoteApiConfig"
37
+ @change="handleChange"
38
+ />
39
+ </template>
40
+ <template v-else>
41
+ <t-select
42
+ v-model="computedModelValue"
43
+ :options="options"
44
+ :placeholder="placeholder || '请选择'"
45
+ :disabled="disabled"
46
+ :clearable="clearable"
47
+ :filterable="filterable"
48
+ :multiple="multiple"
49
+ :loading="loading"
50
+ @change="handleChange"
51
+ />
52
+ </template>
30
53
  </template>
31
54
 
32
55
  <!-- 日期选择器 -->
@@ -134,6 +157,7 @@ import {
134
157
  TreeSelect as TTreeSelect,
135
158
  ColorPicker as TColorPicker
136
159
  } from 'tdesign-vue-next';
160
+ import EbizRemoteSelect from '../../EbizRemoteSelect.vue';
137
161
 
138
162
  const props = defineProps({
139
163
  /**
@@ -436,6 +460,27 @@ const props = defineProps({
436
460
  type: String,
437
461
  default: 'file',
438
462
  validator: (val) => ['file', 'image', 'image-flow'].includes(val)
463
+ },
464
+ /**
465
+ * 是否开启远程搜索
466
+ */
467
+ isRemote: {
468
+ type: Boolean,
469
+ default: false
470
+ },
471
+ /**
472
+ * 远程搜索配置
473
+ */
474
+ remoteApiConfig: {
475
+ type: Object,
476
+ default: () => ({
477
+ url: '',
478
+ method: 'GET',
479
+ params: {},
480
+ data: {},
481
+ headers: {},
482
+ transformResponse: null
483
+ })
439
484
  }
440
485
  });
441
486