m8-codex-mcp 1.0.31 → 1.0.33

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.
@@ -0,0 +1,140 @@
1
+ .classify {
2
+ width: 100%;
3
+ }
4
+
5
+ .classify__bar {
6
+ display: flex;
7
+ align-items: flex-start;
8
+ padding: 10px 12px 8px;
9
+ }
10
+
11
+ .classify__grid {
12
+ flex: 1;
13
+ display: grid;
14
+ }
15
+
16
+ .classify__item {
17
+ display: flex;
18
+ flex-direction: column;
19
+ align-items: center;
20
+ }
21
+
22
+ .classify__item:active {
23
+ opacity: 0.9;
24
+ }
25
+
26
+ .classify__icon {
27
+ box-sizing: border-box;
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ overflow: hidden;
32
+ background: #f2f3f5;
33
+ }
34
+
35
+ .classify__label {
36
+ max-width: 100%;
37
+ margin-top: 6px;
38
+ }
39
+
40
+ .classify__label-text {
41
+ display: block;
42
+ max-width: 100%;
43
+ white-space: nowrap;
44
+ overflow: hidden;
45
+ text-overflow: ellipsis;
46
+ text-align: center;
47
+ }
48
+
49
+ .classify__expand {
50
+ width: 44px;
51
+ margin-left: 8px;
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: center;
55
+ justify-content: center;
56
+ }
57
+
58
+ .classify__expand:active {
59
+ opacity: 0.9;
60
+ }
61
+
62
+ .classify__expand-icon {
63
+ width: 24px;
64
+ height: 24px;
65
+ display: flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ color: #666;
69
+ }
70
+
71
+ .classify__expand-text {
72
+ margin-top: 2px;
73
+ display: flex;
74
+ flex-direction: column;
75
+ align-items: center;
76
+ }
77
+
78
+ .classify__expand-char {
79
+ font-size: 12px;
80
+ line-height: 12px;
81
+ font-weight: 400;
82
+ color: #666;
83
+ }
84
+
85
+ .classify__overlay {
86
+ position: relative;
87
+ z-index: 9999;
88
+ }
89
+
90
+ .classify__panel-inline {
91
+ background: #fff;
92
+ overflow: hidden;
93
+ }
94
+
95
+ .classify__panel {
96
+ position: fixed;
97
+ left: 0;
98
+ right: 0;
99
+ background: #fff;
100
+ z-index: 10001;
101
+ overflow: hidden;
102
+ }
103
+
104
+ .classify__panel-scroll {
105
+ padding: 10px 12px 8px;
106
+ }
107
+
108
+ .classify__panel-grid {
109
+ display: grid;
110
+ }
111
+
112
+ .classify__collapse {
113
+ height: 44px;
114
+ display: flex;
115
+ align-items: center;
116
+ justify-content: center;
117
+ border-top: 1px solid rgba(0, 0, 0, 0.06);
118
+ }
119
+
120
+ .classify__collapse-text {
121
+ font-size: 12px;
122
+ line-height: 16px;
123
+ font-weight: 400;
124
+ color: #999;
125
+ }
126
+
127
+ .classify__collapse-arrow {
128
+ margin-left: 6px;
129
+ font-size: 12px;
130
+ line-height: 16px;
131
+ color: #999;
132
+ }
133
+
134
+ .classify__mask {
135
+ position: fixed;
136
+ left: 0;
137
+ right: 0;
138
+ bottom: 0;
139
+ z-index: 10000;
140
+ }
@@ -0,0 +1,19 @@
1
+ //构建入口,勿动
2
+ import Component from './index.vue';
3
+
4
+ if (!Component.name) {
5
+ console.error('卡片组件vue内请定义name字段后重新构建!');
6
+ }
7
+ const install = function (Vue) {
8
+ Vue.component(Component.name, Component);
9
+ };
10
+
11
+ if (typeof window !== 'undefined' && window.Vue) {
12
+ install(window.Vue);
13
+ }
14
+
15
+ export { default as component } from './index.vue';
16
+
17
+ export default {
18
+ install
19
+ };
@@ -0,0 +1,503 @@
1
+ <template>
2
+ <view class="epoint-component classify" :style="[boxOptionsStyle, boxModelStyle]">
3
+ <view class="classify__bar">
4
+ <view class="classify__grid" :style="collapsedGridStyle">
5
+ <view
6
+ v-for="item in collapsedItems"
7
+ :key="item.id"
8
+ class="classify__item"
9
+ @click.stop="handleItemClick(item)"
10
+ >
11
+ <view class="classify__icon" :style="getIconStyle(item)">
12
+ <em-image :width="iconSize" :height="iconSize" :src="item.icon" />
13
+ </view>
14
+ <view class="classify__label" :style="getLabelStyle(item)">
15
+ <text class="classify__label-text">{{ item.name }}</text>
16
+ </view>
17
+ </view>
18
+ </view>
19
+
20
+ <view
21
+ v-if="showExpandButton"
22
+ class="classify__expand"
23
+ @click.stop="toggleExpand(true)"
24
+ >
25
+ <view class="classify__expand-icon">
26
+ <em-icon name="apps-o" />
27
+ </view>
28
+ <view class="classify__expand-text">
29
+ <text
30
+ v-for="(char, index) in expandTextChars"
31
+ :key="index"
32
+ class="classify__expand-char"
33
+ >
34
+ {{ char }}
35
+ </text>
36
+ </view>
37
+ </view>
38
+ </view>
39
+
40
+ <view v-if="expanded && useFixedOverlay" class="classify__overlay">
41
+ <view class="classify__panel" :style="panelStyle">
42
+ <scroll-view
43
+ class="classify__panel-scroll"
44
+ scroll-y
45
+ :style="panelScrollStyle"
46
+ >
47
+ <view class="classify__panel-grid" :style="expandedGridStyle">
48
+ <view
49
+ v-for="item in mappedItems"
50
+ :key="item.id"
51
+ class="classify__item"
52
+ @click.stop="handleItemClick(item)"
53
+ >
54
+ <view class="classify__icon" :style="getIconStyle(item)">
55
+ <em-image :width="iconSize" :height="iconSize" :src="item.icon" />
56
+ </view>
57
+ <view class="classify__label" :style="getLabelStyle(item)">
58
+ <text class="classify__label-text">{{ item.name }}</text>
59
+ </view>
60
+ </view>
61
+ </view>
62
+ </scroll-view>
63
+
64
+ <view class="classify__collapse" @click.stop="toggleExpand(false)">
65
+ <text class="classify__collapse-text">{{ collapseText }}</text>
66
+ <text class="classify__collapse-arrow">∧</text>
67
+ </view>
68
+ </view>
69
+
70
+ <view
71
+ v-if="closeOnMask"
72
+ class="classify__mask"
73
+ :style="maskStyle"
74
+ @click.stop="toggleExpand(false)"
75
+ />
76
+ </view>
77
+
78
+ <view v-else-if="expanded" class="classify__panel-inline">
79
+ <scroll-view class="classify__panel-scroll" scroll-y :style="panelScrollStyle">
80
+ <view class="classify__panel-grid" :style="expandedGridStyle">
81
+ <view
82
+ v-for="item in mappedItems"
83
+ :key="item.id"
84
+ class="classify__item"
85
+ @click.stop="handleItemClick(item)"
86
+ >
87
+ <view class="classify__icon" :style="getIconStyle(item)">
88
+ <em-image :width="iconSize" :height="iconSize" :src="item.icon" />
89
+ </view>
90
+ <view class="classify__label" :style="getLabelStyle(item)">
91
+ <text class="classify__label-text">{{ item.name }}</text>
92
+ </view>
93
+ </view>
94
+ </view>
95
+ </scroll-view>
96
+
97
+ <view class="classify__collapse" @click.stop="toggleExpand(false)">
98
+ <text class="classify__collapse-text">{{ collapseText }}</text>
99
+ <text class="classify__collapse-arrow">∧</text>
100
+ </view>
101
+ </view>
102
+ </view>
103
+ </template>
104
+
105
+ <script>
106
+ import '@boot';
107
+ import mockData from './mock/data';
108
+ import defaultConfig from './js/config';
109
+ import base from './js/base';
110
+ import eventMixin from './plugin/eventgenerate';
111
+
112
+ export default {
113
+ name: base.module_name,
114
+ mixins: [eventMixin],
115
+ props: {
116
+ data: {
117
+ type: Array,
118
+ default: () => {
119
+ return mockData.data;
120
+ }
121
+ },
122
+ config: {
123
+ type: Object
124
+ },
125
+ cdata: Object
126
+ },
127
+ data() {
128
+ return {
129
+ activeId: '',
130
+ expanded: false,
131
+ panelTop: 0,
132
+ maskTop: 0
133
+ };
134
+ },
135
+ watch: {
136
+ defaultActiveId: {
137
+ immediate: true,
138
+ handler(val) {
139
+ if (val && val !== this.activeId) {
140
+ this.activeId = val;
141
+ }
142
+ }
143
+ },
144
+ mappedItems: {
145
+ immediate: true,
146
+ handler(val) {
147
+ if (!Array.isArray(val) || val.length === 0) {
148
+ this.activeId = '';
149
+ return;
150
+ }
151
+
152
+ if (!this.activeId) {
153
+ this.activeId = this.defaultActiveId || val[0].id;
154
+ return;
155
+ }
156
+
157
+ const exists = val.some((item) => item.id === this.activeId);
158
+ if (!exists) {
159
+ this.activeId = this.defaultActiveId || val[0].id;
160
+ }
161
+ }
162
+ }
163
+ },
164
+ computed: {
165
+ optionRoot() {
166
+ return (this.config && this.config.options) || {};
167
+ },
168
+ dataMapping() {
169
+ return this.optionRoot.dataMapping || {};
170
+ },
171
+ layout() {
172
+ return this.optionRoot.layout || {};
173
+ },
174
+ styleOptions() {
175
+ return this.optionRoot.style || {};
176
+ },
177
+ behavior() {
178
+ return this.optionRoot.behavior || {};
179
+ },
180
+ idField() {
181
+ return this.dataMapping.idField || 'id';
182
+ },
183
+ nameField() {
184
+ return this.dataMapping.nameField || 'name';
185
+ },
186
+ iconField() {
187
+ return this.dataMapping.iconField || 'icon';
188
+ },
189
+ defaultActiveId() {
190
+ return this.dataMapping.defaultActiveId || '';
191
+ },
192
+ columns() {
193
+ const n = Number(this.layout.columns);
194
+ return n > 0 ? Math.floor(n) : 5;
195
+ },
196
+ collapsedRows() {
197
+ const n = Number(this.layout.collapsedRows);
198
+ return n > 0 ? Math.floor(n) : 1;
199
+ },
200
+ showExpandButton() {
201
+ if (!this.expandable) return false;
202
+ if (this.layout.showExpandButton === false) return false;
203
+ return this.mappedItems.length > this.columns * this.collapsedRows;
204
+ },
205
+ expandText() {
206
+ return this.layout.expandText || '全部';
207
+ },
208
+ collapseText() {
209
+ return this.layout.collapseText || '点击收起';
210
+ },
211
+ panelMaxHeight() {
212
+ return this.layout.panelMaxHeight || '320px';
213
+ },
214
+ expandable() {
215
+ return this.behavior.expandable !== false;
216
+ },
217
+ selectable() {
218
+ return this.behavior.selectable !== false;
219
+ },
220
+ allowUnselect() {
221
+ return this.behavior.allowUnselect === true;
222
+ },
223
+ useFixedOverlay() {
224
+ return this.behavior.useFixedOverlay !== false;
225
+ },
226
+ closeOnMask() {
227
+ return this.behavior.closeOnMask !== false;
228
+ },
229
+ itemGap() {
230
+ return this.styleOptions.itemGap || '12px';
231
+ },
232
+ iconSize() {
233
+ return this.styleOptions.iconSize || '44px';
234
+ },
235
+ iconRadius() {
236
+ return this.styleOptions.iconRadius || '999px';
237
+ },
238
+ fontSize() {
239
+ return this.styleOptions.fontSize || '12px';
240
+ },
241
+ lineHeight() {
242
+ return this.styleOptions.lineHeight || '16px';
243
+ },
244
+ fontWeight() {
245
+ return this.styleOptions.fontWeight || '400';
246
+ },
247
+ textColor() {
248
+ return this.styleOptions.textColor || '#666666';
249
+ },
250
+ activeTextColor() {
251
+ return this.styleOptions.activeTextColor || '#ffffff';
252
+ },
253
+ activeBgColor() {
254
+ return this.styleOptions.activeBgColor || '#f23c3c';
255
+ },
256
+ activeBorderColor() {
257
+ return this.styleOptions.activeBorderColor || '#f23c3c';
258
+ },
259
+ borderWidth() {
260
+ return this.styleOptions.borderWidth || '2px';
261
+ },
262
+ labelRadius() {
263
+ return this.styleOptions.labelRadius || '999px';
264
+ },
265
+ labelPadding() {
266
+ return this.styleOptions.labelPadding || '2px 8px';
267
+ },
268
+ activeTranslateY() {
269
+ return this.styleOptions.activeTranslateY || '0px';
270
+ },
271
+ expandTextChars() {
272
+ return String(this.expandText).split('');
273
+ },
274
+ mappedItems() {
275
+ const list = Array.isArray(this.data) ? this.data : [];
276
+ return list
277
+ .map((raw, index) => {
278
+ const rawId = raw ? raw[this.idField] : undefined;
279
+ const rawName = raw ? raw[this.nameField] : undefined;
280
+ const rawIcon = raw ? raw[this.iconField] : undefined;
281
+ const id = rawId !== null && rawId !== undefined ? String(rawId) : String(index);
282
+ const name = rawName !== null && rawName !== undefined ? String(rawName) : '';
283
+ const icon = rawIcon !== null && rawIcon !== undefined ? String(rawIcon) : '';
284
+ return { id, name, icon, raw };
285
+ })
286
+ .filter((item) => item.id);
287
+ },
288
+ collapsedItems() {
289
+ return this.mappedItems.slice(0, this.columns * this.collapsedRows);
290
+ },
291
+ boxOptionsRaw() {
292
+ return this.optionRoot.boxOptions || {};
293
+ },
294
+ boxOptionsStyle() {
295
+ const background = this.styleOptions.backgroundColor || this.boxOptionsRaw.background || '';
296
+ const width = this.boxOptionsRaw.width || '';
297
+ const height = this.boxOptionsRaw.height || '';
298
+ const borderRadius = this.boxOptionsRaw.borderRadius || '';
299
+ const overflow = this.boxOptionsRaw.overflow || '';
300
+ const style = {
301
+ background
302
+ };
303
+
304
+ if (width) style.width = width;
305
+ if (height) style.height = height;
306
+ if (borderRadius) style.borderRadius = borderRadius;
307
+ if (overflow) style.overflow = overflow;
308
+
309
+ return style;
310
+ },
311
+ boxModelStyle() {
312
+ const model = this.normalizeBoxModel(this.boxOptionsRaw.boxmodel);
313
+ const style = {};
314
+
315
+ Object.keys(model).forEach((key) => {
316
+ const value = model[key];
317
+ if (value === null || value === undefined || value === '') return;
318
+ if (typeof value === 'number') {
319
+ style[key] = `${value}px`;
320
+ return;
321
+ }
322
+ if (!isNaN(Number(value))) {
323
+ style[key] = `${value}px`;
324
+ return;
325
+ }
326
+ style[key] = value;
327
+ });
328
+
329
+ return style;
330
+ },
331
+ collapsedGridStyle() {
332
+ return {
333
+ gridTemplateColumns: `repeat(${this.columns}, 1fr)`,
334
+ gap: this.itemGap
335
+ };
336
+ },
337
+ expandedGridStyle() {
338
+ return {
339
+ gridTemplateColumns: `repeat(${this.columns}, 1fr)`,
340
+ gap: this.itemGap
341
+ };
342
+ },
343
+ panelStyle() {
344
+ return {
345
+ top: `${this.panelTop}px`,
346
+ borderRadius: this.styleOptions.panelRadius || '0 0 16px 16px',
347
+ boxShadow: this.styleOptions.panelShadow || '0 8px 24px rgba(0, 0, 0, 0.12)'
348
+ };
349
+ },
350
+ panelScrollStyle() {
351
+ return {
352
+ maxHeight: this.panelMaxHeight
353
+ };
354
+ },
355
+ maskStyle() {
356
+ return {
357
+ top: `${this.maskTop}px`,
358
+ background: this.styleOptions.maskColor || 'rgba(0,0,0,0.35)'
359
+ };
360
+ }
361
+ },
362
+ created() {},
363
+ mounted() {
364
+ this.eventGenerate('onMounted', { activeId: this.activeId });
365
+ },
366
+ methods: {
367
+ normalizeBoxModel(boxmodel) {
368
+ if (!boxmodel) return {};
369
+ if (Array.isArray(boxmodel)) {
370
+ return boxmodel.reduce((acc, item) => {
371
+ if (!item || !item.name) return acc;
372
+ acc[item.name] = item.value;
373
+ return acc;
374
+ }, {});
375
+ }
376
+ if (typeof boxmodel === 'object') return boxmodel;
377
+ return {};
378
+ },
379
+ isActive(item) {
380
+ return item && item.id === this.activeId;
381
+ },
382
+ getIconStyle(item) {
383
+ const active = this.isActive(item);
384
+ const style = {
385
+ borderRadius: this.iconRadius,
386
+ width: this.iconSize,
387
+ height: this.iconSize
388
+ };
389
+
390
+ if (active) {
391
+ style.borderStyle = 'solid';
392
+ style.borderWidth = this.borderWidth;
393
+ style.borderColor = this.activeBorderColor;
394
+ }
395
+
396
+ if (this.activeTranslateY && active && this.activeTranslateY !== '0px') {
397
+ style.transform = `translateY(${this.activeTranslateY})`;
398
+ }
399
+
400
+ return style;
401
+ },
402
+ getLabelStyle(item) {
403
+ const active = this.isActive(item);
404
+ return {
405
+ fontSize: this.fontSize,
406
+ lineHeight: this.lineHeight,
407
+ fontWeight: this.fontWeight,
408
+ borderRadius: this.labelRadius,
409
+ padding: this.labelPadding,
410
+ color: active ? this.activeTextColor : this.textColor,
411
+ background: active ? this.activeBgColor : 'transparent'
412
+ };
413
+ },
414
+ handleItemClick(item) {
415
+ this.eventGenerate('onItemClick', item.raw);
416
+
417
+ if (!this.selectable) return;
418
+
419
+ const nextId = item.id;
420
+ const shouldUnselect = this.allowUnselect && nextId === this.activeId;
421
+ this.activeId = shouldUnselect ? '' : nextId;
422
+
423
+ this.eventGenerate('onChange', {
424
+ activeId: this.activeId,
425
+ item: item.raw
426
+ });
427
+ },
428
+ toggleExpand(next) {
429
+ if (!this.expandable) return;
430
+ if (next === this.expanded) return;
431
+
432
+ if (!next) {
433
+ this.expanded = false;
434
+ this.eventGenerate('onToggleExpand', { expanded: false });
435
+ return;
436
+ }
437
+
438
+ this.updatePanelAnchorTop()
439
+ .then((top) => {
440
+ this.panelTop = top;
441
+ this.expanded = true;
442
+ this.eventGenerate('onToggleExpand', { expanded: true });
443
+ return this.$nextTick();
444
+ })
445
+ .then(() => this.updateMaskTop())
446
+ .catch(() => {
447
+ this.panelTop = 0;
448
+ this.maskTop = 0;
449
+ this.expanded = true;
450
+ this.eventGenerate('onToggleExpand', { expanded: true });
451
+ });
452
+ },
453
+ updatePanelAnchorTop() {
454
+ return new Promise((resolve) => {
455
+ if (typeof uni === 'undefined' || !uni.createSelectorQuery) {
456
+ resolve(0);
457
+ return;
458
+ }
459
+
460
+ const query = uni.createSelectorQuery().in(this);
461
+ query
462
+ .select('.classify')
463
+ .boundingClientRect();
464
+ query.exec((res) => {
465
+ const rect = res && res[0];
466
+ resolve(rect && typeof rect.top === 'number' ? rect.top : 0);
467
+ });
468
+ });
469
+ },
470
+ updateMaskTop() {
471
+ return new Promise((resolve) => {
472
+ if (typeof uni === 'undefined' || !uni.createSelectorQuery) {
473
+ this.maskTop = this.panelTop;
474
+ resolve();
475
+ return;
476
+ }
477
+
478
+ const query = uni.createSelectorQuery().in(this);
479
+ query
480
+ .select('.classify__panel')
481
+ .boundingClientRect();
482
+ query.exec((res) => {
483
+ const rect = res && res[0];
484
+ if (rect && typeof rect.top === 'number' && typeof rect.height === 'number') {
485
+ this.maskTop = rect.top + rect.height;
486
+ resolve();
487
+ return;
488
+ }
489
+ this.maskTop = this.panelTop;
490
+ resolve();
491
+ });
492
+ });
493
+ }
494
+ },
495
+ beforeDestroy() {},
496
+ _getConfig: () => defaultConfig,
497
+ _getMockData: () => mockData
498
+ };
499
+ </script>
500
+
501
+ <style lang="scss" scoped>
502
+ @import './css/index.scss';
503
+ </style>
@@ -0,0 +1,20 @@
1
+ export default {
2
+ name: '一级分类',
3
+ module_name: 'Classify',
4
+ version: '0.1.0'
5
+ // 如果当前组件需要使用三方npm库依赖,可以在这里配置;
6
+ // 配置参考文档:https://epointfe.feishu.cn/wiki/wikcnWfDygigkfyAELeQhjjl3Ch
7
+ // packages: [
8
+ // {
9
+ // title: 'ucharts 图表库',
10
+ // // 组件本地开发、跨端源码构建会使用package和version版本号安装依赖
11
+ // // 在组件开发时,源码引用依赖正常引用package组件包名使用。例如在index.vue中:import uCharts from '@qiun/ucharts/u-charts.js';
12
+ // package: '@qiun/ucharts',
13
+ // version: '^2.5.0-20230101',
14
+ // // 设计器设计、预览使用cdn加载组件
15
+ // urls: ['http://app.epoint.com.cn/h5/fileattaches/20230404/u-charts-20230404170212.js'],
16
+ // // 组件构建上传时会过滤库,需要设计器使用cdn加载或设计器手动上传加载库文件加载到该全局变量名称的库文件
17
+ // library: 'uCharts'
18
+ // }
19
+ // ]
20
+ };